]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - keys.c
fix image loading sRGB conversion
[xonotic/darkplaces.git] / keys.c
diff --git a/keys.c b/keys.c
index c955570ce6a3fdb55e149c050b74c03483152bfa..28f74a42b0dfcbb343ba094af647fdf1c2d89761 100644 (file)
--- a/keys.c
+++ b/keys.c
@@ -498,6 +498,11 @@ static const keyname_t   keynames[] = {
        {"X360_RIGHT_THUMB_LEFT", K_X360_RIGHT_THUMB_LEFT},
        {"X360_RIGHT_THUMB_RIGHT", K_X360_RIGHT_THUMB_RIGHT},
 
+       {"JOY_UP", K_JOY_UP},
+       {"JOY_DOWN", K_JOY_DOWN},
+       {"JOY_LEFT", K_JOY_LEFT},
+       {"JOY_RIGHT", K_JOY_RIGHT},
+
        {"SEMICOLON", ';'},                     // because a raw semicolon separates commands
        {"TILDE", '~'},
        {"BACKQUOTE", '`'},
@@ -1195,7 +1200,7 @@ Key_Message (int key, int ascii)
        if (key == K_ENTER || ascii == 10 || ascii == 13)
        {
                if(chat_mode < 0)
-                       Cmd_ExecuteString(chat_buffer, src_command); // not Cbuf_AddText to allow semiclons in args; however, this allows no variables then. Use aliases!
+                       Cmd_ExecuteString(chat_buffer, src_command, true); // not Cbuf_AddText to allow semiclons in args; however, this allows no variables then. Use aliases!
                else
                        Cmd_ForwardStringToServer(va("%s %s", chat_mode ? "say_team" : "say ", chat_buffer));
 
@@ -1681,7 +1686,7 @@ void Key_FindKeysForCommand (const char *command, int *keys, int numkeys, int bi
        }
 }
 
-qboolean CL_VM_InputEvent (qboolean down, int key, int ascii);
+extern qboolean CL_VM_InputEvent (int eventtype, int x, int y);
 
 /*
 ===================
@@ -1847,7 +1852,7 @@ Key_Event (int key, int ascii, qboolean down)
 
                        case key_game:
                                // csqc has priority over toggle menu if it wants to (e.g. handling escape for UI stuff in-game.. :sick:)
-                               q = CL_VM_InputEvent(down, key, ascii);
+                               q = CL_VM_InputEvent(down ? 0 : 1, key, ascii);
                                if (!q && down)
                                        MR_ToggleMenu(1);
                                break;
@@ -1894,6 +1899,10 @@ Key_Event (int key, int ascii, qboolean down)
                        Con_ToggleConsole_f ();
                        return;
                }
+
+               if (COM_CheckParm ("-noconsole"))
+                       return; // only allow the key bind to turn off console
+
                Key_Console (key, ascii);
                return;
        }
@@ -1931,7 +1940,7 @@ Key_Event (int key, int ascii, qboolean down)
                        MR_KeyEvent (key, ascii, down);
                        break;
                case key_game:
-                       q = CL_VM_InputEvent(down, key, ascii);
+                       q = CL_VM_InputEvent(down ? 0 : 1, key, ascii);
                        // ignore key repeats on binds and only send the bind if the event hasnt been already processed by csqc
                        if (!q && bind)
                        {
@@ -1954,6 +1963,21 @@ Key_Event (int key, int ascii, qboolean down)
        }
 }
 
+// a helper to simulate release of ALL keys
+void
+Key_ReleaseAll (void)
+{
+       int key;
+       // clear the event queue first
+       eventqueue_idx = 0;
+       // then send all down events (possibly into the event queue)
+       for(key = 0; key < MAX_KEYS; ++key)
+               if(keydown[key])
+                       Key_Event(key, 0, false);
+       // now all keys are guaranteed down (once the event queue is unblocked)
+       // and only future events count
+}
+
 /*
 ===================
 Key_ClearStates