------------------------------------------------------------------------------
| 1312 | |
| 1313 | //------------------------------------------------------------------------------ |
| 1314 | bool ActionMap::processAction(const InputEventInfo* pEvent) |
| 1315 | { |
| 1316 | // Suppress excluded input events, like alt-tab. |
| 1317 | if(Platform::checkKeyboardInputExclusion(pEvent)) |
| 1318 | return false; |
| 1319 | |
| 1320 | static const char *argv[5]; |
| 1321 | if (pEvent->action == SI_MAKE) { |
| 1322 | const Node* pNode = findNode(pEvent->deviceType, pEvent->deviceInst, |
| 1323 | pEvent->modifier, pEvent->objInst); |
| 1324 | |
| 1325 | if( pNode == NULL ) |
| 1326 | return false; |
| 1327 | |
| 1328 | // Enter the break into the table if this is a make event... |
| 1329 | // Do this now rather than after command is processed because |
| 1330 | // command might add a binding which can move the vector of nodes. |
| 1331 | enterBreakEvent(pEvent, pNode); |
| 1332 | |
| 1333 | // Whadda ya know, we have this bound. Set up, and call the console |
| 1334 | // function associated with it... |
| 1335 | // |
| 1336 | F32 value = pEvent->fValue; |
| 1337 | if (pNode->flags & Node::Ranged) { |
| 1338 | value = (value * 2.0f) - 1.0f; |
| 1339 | if (pNode->flags & Node::Inverted) |
| 1340 | value *= -1.0f; |
| 1341 | } else { |
| 1342 | if (pNode->flags & Node::Inverted) |
| 1343 | value = 1.0f - value; |
| 1344 | } |
| 1345 | |
| 1346 | if (pNode->flags & Node::HasScale) |
| 1347 | value *= pNode->scaleFactor; |
| 1348 | |
| 1349 | if ( pNode->flags & Node::HasDeadZone ) |
| 1350 | { |
| 1351 | if ( value >= pNode->deadZoneBegin && value <= pNode->deadZoneEnd ) |
| 1352 | value = 0.0f; |
| 1353 | else |
| 1354 | { |
| 1355 | if( value > 0 ) |
| 1356 | value = ( value - pNode->deadZoneBegin ) * ( 1.f / ( 1.f - pNode->deadZoneBegin ) ); |
| 1357 | else |
| 1358 | value = ( value + pNode->deadZoneBegin ) * ( 1.f / ( 1.f - pNode->deadZoneBegin ) ); |
| 1359 | } |
| 1360 | } |
| 1361 | |
| 1362 | if( pNode->flags & Node::NonLinear ) |
| 1363 | value = ( value < 0.f ? -1.f : 1.f ) * mPow( mFabs( value ), CONST_E ); |
| 1364 | |
| 1365 | // Ok, we're all set up, call the function. |
| 1366 | if(pNode->flags & Node::BindCmd) |
| 1367 | { |
| 1368 | // it's a bind command |
| 1369 | if(pNode->makeConsoleCommand) |
| 1370 | Con::evaluate(pNode->makeConsoleCommand); |
| 1371 | } |
no test coverage detected