------------------------------------------------------------------------------ This function is for the use of the control remapper. The intent of this function is to determine if the given event descriptor is already bound in this action map. If so, this function returns the command it is bound to. If not, it returns NULL.
| 804 | // If not, it returns NULL. |
| 805 | // |
| 806 | const char* ActionMap::getCommand( const char* device, const char* action ) |
| 807 | { |
| 808 | U32 deviceType; |
| 809 | U32 deviceInst; |
| 810 | if ( getDeviceTypeAndInstance( device, deviceType, deviceInst ) ) |
| 811 | { |
| 812 | EventDescriptor eventDescriptor; |
| 813 | if ( createEventDescriptor( action, &eventDescriptor ) ) |
| 814 | { |
| 815 | const ActionMap::Node* mapNode = findNode( deviceType, deviceInst, eventDescriptor.flags, eventDescriptor.eventCode ); |
| 816 | if ( mapNode ) |
| 817 | { |
| 818 | if ( mapNode->flags & Node::BindCmd ) |
| 819 | { |
| 820 | S32 bufferLen = dStrlen( mapNode->makeConsoleCommand ) + dStrlen( mapNode->breakConsoleCommand ) + 2; |
| 821 | char* returnString = Con::getReturnBuffer( bufferLen ); |
| 822 | dSprintf( returnString, bufferLen, "%s\t%s", |
| 823 | ( mapNode->makeConsoleCommand ? mapNode->makeConsoleCommand : "" ), |
| 824 | ( mapNode->breakConsoleCommand ? mapNode->breakConsoleCommand : "" ) ); |
| 825 | return( returnString ); |
| 826 | } |
| 827 | if (mapNode->flags & Node::Held) |
| 828 | { |
| 829 | S32 bufferLen = dStrlen(mapNode->consoleFunction) + dStrlen(mapNode->contextEvent->mConsoleFunctionHeld) + 2; |
| 830 | char* returnString = Con::getReturnBuffer(bufferLen); |
| 831 | |
| 832 | dSprintf(returnString, bufferLen, "%st%s", |
| 833 | (mapNode->consoleFunction ? mapNode->consoleFunction : ""), |
| 834 | (mapNode->contextEvent->mConsoleFunctionHeld ? mapNode->contextEvent->mConsoleFunctionHeld : "")); |
| 835 | |
| 836 | return(returnString); |
| 837 | } |
| 838 | else |
| 839 | return( mapNode->consoleFunction ); |
| 840 | } |
| 841 | } |
| 842 | } |
| 843 | |
| 844 | return( "" ); |
| 845 | } |
| 846 | |
| 847 | //------------------------------------------------------------------------------ |
| 848 | // This function returns whether or not the mapping specified is inverted. |
no test coverage detected