--------------------------------------------------------------------------
| 1136 | |
| 1137 | //-------------------------------------------------------------------------- |
| 1138 | bool ActionMap::processBindCmd(const char *device, const char *action, const char *makeCmd, const char *breakCmd) |
| 1139 | { |
| 1140 | U32 deviceType; |
| 1141 | U32 deviceInst; |
| 1142 | |
| 1143 | if(!getDeviceTypeAndInstance(device, deviceType, deviceInst)) |
| 1144 | { |
| 1145 | Con::printf("processBindCmd: unknown device: %s", device); |
| 1146 | return false; |
| 1147 | } |
| 1148 | |
| 1149 | // Ok, we now have the deviceType and instance. Create an event descriptor |
| 1150 | // for the bind... |
| 1151 | // |
| 1152 | EventDescriptor eventDescriptor; |
| 1153 | if (createEventDescriptor(action, &eventDescriptor) == false) { |
| 1154 | Con::printf("Could not create a description for binding: %s", action); |
| 1155 | return false; |
| 1156 | } |
| 1157 | |
| 1158 | // SI_POV == SI_MOVE, and the POV works fine with bindCmd, so we have to add these manually. |
| 1159 | if( ( eventDescriptor.eventCode == SI_XAXIS ) || |
| 1160 | ( eventDescriptor.eventCode == SI_YAXIS ) || |
| 1161 | ( eventDescriptor.eventCode == SI_ZAXIS ) || |
| 1162 | ( eventDescriptor.eventCode == SI_RXAXIS ) || |
| 1163 | ( eventDescriptor.eventCode == SI_RYAXIS ) || |
| 1164 | ( eventDescriptor.eventCode == SI_RZAXIS ) || |
| 1165 | ( eventDescriptor.eventCode == SI_SLIDER ) || |
| 1166 | ( eventDescriptor.eventCode == SI_XPOV ) || |
| 1167 | ( eventDescriptor.eventCode == SI_YPOV ) || |
| 1168 | ( eventDescriptor.eventCode == SI_XPOV2 ) || |
| 1169 | ( eventDescriptor.eventCode == SI_YPOV2 ) ) |
| 1170 | { |
| 1171 | Con::warnf( "ActionMap::processBindCmd - Cannot use 'bindCmd' with a move event type. Use 'bind' instead." ); |
| 1172 | return false; |
| 1173 | } |
| 1174 | |
| 1175 | // Create the full bind entry, and place it in the map |
| 1176 | // |
| 1177 | // DMMTODO |
| 1178 | Node* pBindNode = getNode(deviceType, deviceInst, |
| 1179 | eventDescriptor.flags, |
| 1180 | eventDescriptor.eventCode); |
| 1181 | |
| 1182 | pBindNode->flags = Node::BindCmd; |
| 1183 | pBindNode->deadZoneBegin = 0; |
| 1184 | pBindNode->deadZoneEnd = 0; |
| 1185 | pBindNode->scaleFactor = 1; |
| 1186 | |
| 1187 | if( pBindNode->makeConsoleCommand ) |
| 1188 | dFree( pBindNode->makeConsoleCommand ); |
| 1189 | if( pBindNode->breakConsoleCommand ) |
| 1190 | dFree( pBindNode->breakConsoleCommand ); |
| 1191 | |
| 1192 | if(makeCmd[0]) |
| 1193 | pBindNode->makeConsoleCommand = dStrdup(makeCmd); |
| 1194 | else |
| 1195 | pBindNode->makeConsoleCommand = dStrdup(""); |
no test coverage detected