MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / findNode

Method findNode

Engine/source/sim/actionMap.cpp:666–710  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

664
665//------------------------------------------------------------------------------
666const ActionMap::Node* ActionMap::findNode(const U32 inDeviceType, const U32 inDeviceInst,
667 const U32 inModifiers, const U32 inAction)
668{
669 // DMMTODO - Slow INITIAL implementation. Replace with a faster version...
670 //
671 DeviceMap* pDeviceMap = NULL;
672 U32 i;
673 for (i = 0; i < mDeviceMaps.size(); i++)
674 {
675 if (mDeviceMaps[i]->deviceType == inDeviceType && mDeviceMaps[i]->deviceInst == inDeviceInst)
676 {
677 pDeviceMap = mDeviceMaps[i];
678 break;
679 }
680 }
681
682 if (pDeviceMap == NULL)
683 return NULL;
684
685 U32 realMods = inModifiers;
686 if (realMods & SI_SHIFT)
687 realMods |= SI_SHIFT;
688 if (realMods & SI_CTRL)
689 realMods |= SI_CTRL;
690 if (realMods & SI_ALT)
691 realMods |= SI_ALT;
692 if (realMods & SI_MAC_OPT)
693 realMods |= SI_MAC_OPT;
694
695 for (i = 0; i < pDeviceMap->nodeMap.size(); i++)
696 {
697 // Special case for an ANYKEY bind...
698 if (pDeviceMap->nodeMap[i].action == KEY_ANYKEY
699 && pDeviceMap->nodeMap[i].modifiers == realMods
700 && dIsDecentChar(inAction)
701 && inAction <= U8_MAX)
702 return &pDeviceMap->nodeMap[i];
703
704 if (pDeviceMap->nodeMap[i].modifiers == realMods
705 && pDeviceMap->nodeMap[i].action == inAction)
706 return &pDeviceMap->nodeMap[i];
707 }
708
709 return NULL;
710}
711
712//------------------------------------------------------------------------------
713bool ActionMap::findBoundNode( const char* function, U32 &devMapIndex, U32 &nodeIndex )

Callers

nothing calls this directly

Calls 2

dIsDecentCharFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected