added quickly toggling team mode by clicking on main menu "name/team" text
[rocksndiamonds.git] / src / events.c
index 8c8ae5a910f25ee6fb41a11d0661dad4bd062e0a..7b2ba984732b8fa857478f9bfc44d26d9259d041 100644 (file)
@@ -1849,9 +1849,9 @@ boolean HandleKeysDebug(Key key, int key_status)
       return TRUE;
     }
   }
+#endif
 
   return FALSE;
-#endif
 }
 
 void HandleKey(Key key, int key_status)
@@ -2360,6 +2360,16 @@ void HandleJoystick(void)
     return;
   }
 
+  if (newbutton && (game_status == GAME_MODE_PSEUDO_TYPENAME ||
+                   anyTextGadgetActive()))
+  {
+    // leave name input in main menu or text input gadget
+    HandleKey(KSYM_Escape, KEY_PRESSED);
+    HandleKey(KSYM_Escape, KEY_RELEASED);
+
+    return;
+  }
+
   if (level.game_engine_type == GAME_ENGINE_TYPE_MM)
   {
     if (game_status == GAME_MODE_PLAYING)