------------------------------------------------------------------------------
| 1424 | |
| 1425 | //------------------------------------------------------------------------------ |
| 1426 | bool ActionMap::processAction(const InputEventInfo* pEvent) |
| 1427 | { |
| 1428 | // Suppress excluded input events, like alt-tab. |
| 1429 | if(Platform::checkKeyboardInputExclusion(pEvent)) |
| 1430 | return false; |
| 1431 | |
| 1432 | static const char *argv[5]; |
| 1433 | if (pEvent->action == SI_MAKE) { |
| 1434 | const Node* pNode = findNode(pEvent->deviceType, pEvent->deviceInst, |
| 1435 | pEvent->modifier, pEvent->objInst); |
| 1436 | |
| 1437 | if( pNode == NULL ) |
| 1438 | return false; |
| 1439 | |
| 1440 | // Enter the break into the table if this is a make event... |
| 1441 | // Do this now rather than after command is processed because |
| 1442 | // command might add a binding which can move the vector of nodes. |
| 1443 | // Filter to prevent Hold buttons from being eaten |
| 1444 | if (!(pNode->flags & Node::Held)) |
| 1445 | enterBreakEvent(pEvent, pNode); |
| 1446 | |
| 1447 | // Whadda ya know, we have this bound. Set up, and call the console |
| 1448 | // function associated with it... |
| 1449 | // |
| 1450 | F32 value = pEvent->fValue; |
| 1451 | if (pNode->flags & Node::Ranged) { |
| 1452 | value = (value * 2.0f) - 1.0f; |
| 1453 | if (pNode->flags & Node::Inverted) |
| 1454 | value *= -1.0f; |
| 1455 | } else { |
| 1456 | if (pNode->flags & Node::Inverted) |
| 1457 | value = 1.0f - value; |
| 1458 | } |
| 1459 | |
| 1460 | if (pNode->flags & Node::HasScale) |
| 1461 | value *= pNode->scaleFactor; |
| 1462 | |
| 1463 | if ( pNode->flags & Node::HasDeadZone ) |
| 1464 | { |
| 1465 | if ( value >= pNode->deadZoneBegin && value <= pNode->deadZoneEnd ) |
| 1466 | value = 0.0f; |
| 1467 | else |
| 1468 | { |
| 1469 | if( value > 0 ) |
| 1470 | value = ( value - pNode->deadZoneBegin ) * ( 1.f / ( 1.f - pNode->deadZoneBegin ) ); |
| 1471 | else |
| 1472 | value = ( value + pNode->deadZoneBegin ) * ( 1.f / ( 1.f - pNode->deadZoneBegin ) ); |
| 1473 | } |
| 1474 | } |
| 1475 | |
| 1476 | if( pNode->flags & Node::NonLinear ) |
| 1477 | value = ( value < 0.f ? -1.f : 1.f ) * mPow( mFabs( value ), CONST_E ); |
| 1478 | |
| 1479 | // Ok, we're all set up, call the function. |
| 1480 | if(pNode->flags & Node::BindCmd) |
| 1481 | { |
| 1482 | // it's a bind command |
| 1483 | if(pNode->makeConsoleCommand) |
no test coverage detected