瀏覽代碼

Bound actions properly populate BreakEvent table.

capnlove 9 年之前
父節點
當前提交
ca8dc6cde6
共有 1 個文件被更改,包括 20 次插入7 次删除
  1. 20 7
      engine/source/input/actionMap.cc

+ 20 - 7
engine/source/input/actionMap.cc

@@ -528,10 +528,12 @@ const ActionMap::Node* ActionMap::findNode(const U32 inDeviceType, const U32 inD
 
 
    for (i = 0; i < (U32)pDeviceMap->nodeMap.size(); i++)
    for (i = 0; i < (U32)pDeviceMap->nodeMap.size(); i++)
    {
    {
-      if (pDeviceMap->nodeMap[i].action == KEY_ANYKEY && pDeviceMap->nodeMap[i].modifiers == realMods && dIsDecentChar(inAction))
-         return &pDeviceMap->nodeMap[i];
-      else if (pDeviceMap->nodeMap[i].modifiers == realMods && pDeviceMap->nodeMap[i].action    == inAction)
-         return &pDeviceMap->nodeMap[i];
+       if (pDeviceMap->nodeMap[i].action == KEY_ANYKEY && pDeviceMap->nodeMap[i].modifiers == realMods && dIsDecentChar(inAction))
+           return &pDeviceMap->nodeMap[i];
+       else if (inModifiers == 0 && pDeviceMap->nodeMap[i].modifiers == 0 && pDeviceMap->nodeMap[i].action == inAction)
+           return &pDeviceMap->nodeMap[i];
+       else if (pDeviceMap->nodeMap[i].modifiers == realMods && pDeviceMap->nodeMap[i].action    == inAction)
+           return &pDeviceMap->nodeMap[i];
    }
    }
 
 
    return NULL;
    return NULL;
@@ -1505,10 +1507,21 @@ bool ActionMap::processButton(const InputEvent* pEvent)
     // after the execs and don't use pNode again.
     // after the execs and don't use pNode again.
     pNode = findNode( pEvent->deviceType, pEvent->deviceInst, pEvent->modifier, pEvent->objInst );
     pNode = findNode( pEvent->deviceType, pEvent->deviceInst, pEvent->modifier, pEvent->objInst );
 
 
-    if( pNode == NULL )
-        return true; // We already called any bound methods/functions so our job is done
+    if (pNode == NULL)
+    {
+        if (pEvent->modifier != 0)
+        {
+            // Check to see if we clear the modifiers, do we find an action?
+            pNode = findNode(pEvent->deviceType, pEvent->deviceInst, 0, pEvent->objInst);
+
+            if (pNode == NULL)
+            {
+                // We already called any bound methods/functions so our job is done
+                return true;
+            }
+        }
+    }
 
 
-    //
     // And enter the break into the table if this is a make event...
     // And enter the break into the table if this is a make event...
     enterBreakEvent(pEvent, pNode);
     enterBreakEvent(pEvent, pNode);