mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 15:31:39 +00:00
* keys.h: renamed KP_* key macros to K_KP_*.
* key.c (Key_ClearStates): Instead of clearing all key's down state and repeat count, run KeyEvent(k,false) keys in down state, which will already clear those states for them. This also helps getting rid of several actions bound to keypad keys. Minor cleanups. * gl_vidsdl.c (ClearAllStates): Removed code triggering every key with a release event, because we just changed Key_ClearStates() to do that for the necessary keys. * in_sdl.c: Minor cleanups. Made K_KP_5 to send '5' when not in game mode, regardless of the numlock status. Moved prev_gamekey to top level and call SDL_EnableUNICODE() correctly. git-svn-id: http://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@686 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
798b777233
commit
e39b2ca3c8
4 changed files with 121 additions and 164 deletions
|
@ -824,14 +824,6 @@ ClearAllStates
|
||||||
*/
|
*/
|
||||||
static void ClearAllStates (void)
|
static void ClearAllStates (void)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
// send an up event for each key, to make sure the server clears them all
|
|
||||||
for (i = 0; i < 256; i++)
|
|
||||||
{
|
|
||||||
Key_Event (i, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
Key_ClearStates ();
|
Key_ClearStates ();
|
||||||
IN_ClearStates ();
|
IN_ClearStates ();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
|
|
||||||
|
static qboolean prev_gamekey;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
/* Mouse acceleration needs to be disabled on OS X */
|
/* Mouse acceleration needs to be disabled on OS X */
|
||||||
#define MACOS_X_ACCELERATION_HACK
|
#define MACOS_X_ACCELERATION_HACK
|
||||||
|
@ -204,7 +206,8 @@ void IN_Deactivate (qboolean free_cursor)
|
||||||
|
|
||||||
void IN_Init (void)
|
void IN_Init (void)
|
||||||
{
|
{
|
||||||
SDL_EnableUNICODE (0); /* frame updates will change this as key_dest changes */
|
prev_gamekey = (key_dest == key_game || m_keys_bind_grab);
|
||||||
|
SDL_EnableUNICODE (!prev_gamekey);
|
||||||
if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL) == -1)
|
if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL) == -1)
|
||||||
Con_Printf("Warning: SDL_EnableKeyRepeat() failed.\n");
|
Con_Printf("Warning: SDL_EnableKeyRepeat() failed.\n");
|
||||||
|
|
||||||
|
@ -299,15 +302,13 @@ void IN_SendKeyEvents (void)
|
||||||
int sym, state;
|
int sym, state;
|
||||||
int modstate;
|
int modstate;
|
||||||
qboolean gamekey;
|
qboolean gamekey;
|
||||||
static qboolean prev_gamekey;
|
|
||||||
|
|
||||||
gamekey = (key_dest == key_game || m_keys_bind_grab);
|
gamekey = (key_dest == key_game || m_keys_bind_grab);
|
||||||
|
|
||||||
if (gamekey != prev_gamekey)
|
if (gamekey != prev_gamekey)
|
||||||
{
|
{
|
||||||
SDL_EnableUNICODE(!gamekey);
|
|
||||||
Key_ClearStates();
|
|
||||||
prev_gamekey = gamekey;
|
prev_gamekey = gamekey;
|
||||||
|
Key_ClearStates();
|
||||||
|
SDL_EnableUNICODE(!gamekey);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (SDL_PollEvent(&event))
|
while (SDL_PollEvent(&event))
|
||||||
|
@ -318,15 +319,8 @@ void IN_SendKeyEvents (void)
|
||||||
if (event.active.state & (SDL_APPINPUTFOCUS|SDL_APPACTIVE))
|
if (event.active.state & (SDL_APPINPUTFOCUS|SDL_APPACTIVE))
|
||||||
{
|
{
|
||||||
if (event.active.gain)
|
if (event.active.gain)
|
||||||
{
|
|
||||||
/* Sys_Printf("FOCUS GAIN\n");*/
|
|
||||||
S_UnblockSound();
|
S_UnblockSound();
|
||||||
}
|
else S_BlockSound();
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Sys_Printf("FOCUS LOSS\n");*/
|
|
||||||
S_BlockSound();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -337,13 +331,13 @@ void IN_SendKeyEvents (void)
|
||||||
VID_Toggle();
|
VID_Toggle();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if ((event.key.keysym.sym == SDLK_ESCAPE) &&
|
if ((event.key.keysym.sym == SDLK_ESCAPE) &&
|
||||||
(event.key.keysym.mod & KMOD_SHIFT))
|
(event.key.keysym.mod & KMOD_SHIFT))
|
||||||
{
|
{
|
||||||
Con_ToggleConsole_f();
|
Con_ToggleConsole_f();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/* fallthrough */
|
||||||
case SDL_KEYUP:
|
case SDL_KEYUP:
|
||||||
sym = event.key.keysym.sym;
|
sym = event.key.keysym.sym;
|
||||||
state = event.key.state;
|
state = event.key.state;
|
||||||
|
@ -473,87 +467,87 @@ void IN_SendKeyEvents (void)
|
||||||
break;
|
break;
|
||||||
case SDLK_NUMLOCK:
|
case SDLK_NUMLOCK:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_NUMLOCK;
|
sym = K_KP_NUMLOCK;
|
||||||
else sym = 0;
|
else sym = 0;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP0:
|
case SDLK_KP0:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_INS;
|
sym = K_KP_INS;
|
||||||
else sym = (modstate & KMOD_NUM) ? SDLK_0 : K_INS;
|
else sym = (modstate & KMOD_NUM) ? SDLK_0 : K_INS;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP1:
|
case SDLK_KP1:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_END;
|
sym = K_KP_END;
|
||||||
else sym = (modstate & KMOD_NUM) ? SDLK_1 : K_END;
|
else sym = (modstate & KMOD_NUM) ? SDLK_1 : K_END;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP2:
|
case SDLK_KP2:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_DOWNARROW;
|
sym = K_KP_DOWNARROW;
|
||||||
else sym = (modstate & KMOD_NUM) ? SDLK_2 : K_DOWNARROW;
|
else sym = (modstate & KMOD_NUM) ? SDLK_2 : K_DOWNARROW;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP3:
|
case SDLK_KP3:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_PGDN;
|
sym = K_KP_PGDN;
|
||||||
else sym = (modstate & KMOD_NUM) ? SDLK_3 : K_PGDN;
|
else sym = (modstate & KMOD_NUM) ? SDLK_3 : K_PGDN;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP4:
|
case SDLK_KP4:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_LEFTARROW;
|
sym = K_KP_LEFTARROW;
|
||||||
else sym = (modstate & KMOD_NUM) ? SDLK_4 : K_LEFTARROW;
|
else sym = (modstate & KMOD_NUM) ? SDLK_4 : K_LEFTARROW;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP5:
|
case SDLK_KP5:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_5;
|
sym = K_KP_5;
|
||||||
else sym = (modstate & KMOD_NUM) ? SDLK_5 : 0;
|
else sym = SDLK_5;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP6:
|
case SDLK_KP6:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_RIGHTARROW;
|
sym = K_KP_RIGHTARROW;
|
||||||
else sym = (modstate & KMOD_NUM) ? SDLK_6 : K_RIGHTARROW;
|
else sym = (modstate & KMOD_NUM) ? SDLK_6 : K_RIGHTARROW;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP7:
|
case SDLK_KP7:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_HOME;
|
sym = K_KP_HOME;
|
||||||
else sym = (modstate & KMOD_NUM) ? SDLK_7 : K_HOME;
|
else sym = (modstate & KMOD_NUM) ? SDLK_7 : K_HOME;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP8:
|
case SDLK_KP8:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_UPARROW;
|
sym = K_KP_UPARROW;
|
||||||
else sym = (modstate & KMOD_NUM) ? SDLK_8 : K_UPARROW;
|
else sym = (modstate & KMOD_NUM) ? SDLK_8 : K_UPARROW;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP9:
|
case SDLK_KP9:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_PGUP;
|
sym = K_KP_PGUP;
|
||||||
else sym = (modstate & KMOD_NUM) ? SDLK_9 : K_PGUP;
|
else sym = (modstate & KMOD_NUM) ? SDLK_9 : K_PGUP;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP_PERIOD:
|
case SDLK_KP_PERIOD:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_DEL;
|
sym = K_KP_DEL;
|
||||||
else sym = (modstate & KMOD_NUM) ? SDLK_PERIOD : K_DEL;
|
else sym = (modstate & KMOD_NUM) ? SDLK_PERIOD : K_DEL;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP_DIVIDE:
|
case SDLK_KP_DIVIDE:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_SLASH;
|
sym = K_KP_SLASH;
|
||||||
else sym = SDLK_SLASH;
|
else sym = SDLK_SLASH;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP_MULTIPLY:
|
case SDLK_KP_MULTIPLY:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_STAR;
|
sym = K_KP_STAR;
|
||||||
else sym = SDLK_ASTERISK;
|
else sym = SDLK_ASTERISK;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP_MINUS:
|
case SDLK_KP_MINUS:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_MINUS;
|
sym = K_KP_MINUS;
|
||||||
else sym = SDLK_MINUS;
|
else sym = SDLK_MINUS;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP_PLUS:
|
case SDLK_KP_PLUS:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_PLUS;
|
sym = K_KP_PLUS;
|
||||||
else sym = SDLK_PLUS;
|
else sym = SDLK_PLUS;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP_ENTER:
|
case SDLK_KP_ENTER:
|
||||||
if (gamekey)
|
if (gamekey)
|
||||||
sym = KP_ENTER;
|
sym = K_KP_ENTER;
|
||||||
else sym = SDLK_RETURN;
|
else sym = SDLK_RETURN;
|
||||||
break;
|
break;
|
||||||
case SDLK_KP_EQUALS:
|
case SDLK_KP_EQUALS:
|
||||||
|
|
107
Quake/keys.c
107
Quake/keys.c
|
@ -19,13 +19,10 @@ along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
|
||||||
/*
|
/* key up events are sent even if in console mode */
|
||||||
|
|
||||||
key up events are sent even if in console mode
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define HISTORY_FILE_NAME "history.txt"
|
#define HISTORY_FILE_NAME "history.txt"
|
||||||
#define CMDLINES 32
|
#define CMDLINES 32
|
||||||
|
@ -76,25 +73,23 @@ keyname_t keynames[] =
|
||||||
{"CTRL", K_CTRL},
|
{"CTRL", K_CTRL},
|
||||||
{"SHIFT", K_SHIFT},
|
{"SHIFT", K_SHIFT},
|
||||||
|
|
||||||
//johnfitz -- keypad
|
// {"KP_NUMLOCK", K_KP_NUMLOCK},
|
||||||
{"KP_NUMLOCK", KP_NUMLOCK},
|
{"KP_SLASH", K_KP_SLASH},
|
||||||
{"KP_SLASH", KP_SLASH },
|
{"KP_STAR", K_KP_STAR},
|
||||||
{"KP_STAR", KP_STAR },
|
{"KP_MINUS", K_KP_MINUS},
|
||||||
{"KP_MINUS", KP_MINUS },
|
{"KP_HOME", K_KP_HOME},
|
||||||
{"KP_HOME", KP_HOME },
|
{"KP_UPARROW", K_KP_UPARROW},
|
||||||
{"KP_UPARROW", KP_UPARROW },
|
{"KP_PGUP", K_KP_PGUP},
|
||||||
{"KP_PGUP", KP_PGUP },
|
{"KP_PLUS", K_KP_PLUS},
|
||||||
{"KP_PLUS", KP_PLUS },
|
{"KP_LEFTARROW", K_KP_LEFTARROW},
|
||||||
{"KP_LEFTARROW", KP_LEFTARROW },
|
{"KP_5", K_KP_5},
|
||||||
{"KP_5", KP_5 },
|
{"KP_RIGHTARROW", K_KP_RIGHTARROW},
|
||||||
{"KP_RIGHTARROW", KP_RIGHTARROW },
|
{"KP_END", K_KP_END},
|
||||||
{"KP_END", KP_END },
|
{"KP_DOWNARROW", K_KP_DOWNARROW},
|
||||||
{"KP_DOWNARROW", KP_DOWNARROW },
|
{"KP_PGDN", K_KP_PGDN},
|
||||||
{"KP_PGDN", KP_PGDN },
|
{"KP_ENTER", K_KP_ENTER},
|
||||||
{"KP_ENTER", KP_ENTER },
|
{"KP_INS", K_KP_INS},
|
||||||
{"KP_INS", KP_INS },
|
{"KP_DEL", K_KP_DEL},
|
||||||
{"KP_DEL", KP_DEL },
|
|
||||||
//johnfitz
|
|
||||||
|
|
||||||
{"F1", K_F1},
|
{"F1", K_F1},
|
||||||
{"F2", K_F2},
|
{"F2", K_F2},
|
||||||
|
@ -187,9 +182,9 @@ Interactive line editing and console scrollback
|
||||||
*/
|
*/
|
||||||
void Key_Console (int key)
|
void Key_Console (int key)
|
||||||
{
|
{
|
||||||
|
static char current[MAXCMDLINE] = "";
|
||||||
extern int con_vislines;
|
extern int con_vislines;
|
||||||
extern char key_tabpartial[MAXCMDLINE];
|
extern char key_tabpartial[MAXCMDLINE];
|
||||||
static char current[MAXCMDLINE]="";
|
|
||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
|
@ -249,8 +244,10 @@ void Key_Console (int key)
|
||||||
{
|
{
|
||||||
line = con_text + (i % con_totallines) * con_linewidth;
|
line = con_text + (i % con_totallines) * con_linewidth;
|
||||||
for (x = 0; x < con_linewidth; x++)
|
for (x = 0; x < con_linewidth; x++)
|
||||||
|
{
|
||||||
if (line[x] != ' ')
|
if (line[x] != ' ')
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if (x != con_linewidth)
|
if (x != con_linewidth)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -313,9 +310,8 @@ void Key_Console (int key)
|
||||||
// Needs rewriting as we have persistent history
|
// Needs rewriting as we have persistent history
|
||||||
|
|
||||||
// if (history_line == 0) return;
|
// if (history_line == 0) return;
|
||||||
if (history_line == edit_line) {
|
if (history_line == edit_line)
|
||||||
Q_strcpy(current,key_lines[edit_line]);
|
Q_strcpy(current,key_lines[edit_line]);
|
||||||
};
|
|
||||||
key_tabpartial[0] = 0;
|
key_tabpartial[0] = 0;
|
||||||
history_line = (history_line - 1) & 31;
|
history_line = (history_line - 1) & 31;
|
||||||
|
|
||||||
|
@ -509,8 +505,8 @@ FIXME: handle quote special (general escape sequence?)
|
||||||
*/
|
*/
|
||||||
const char *Key_KeynumToString (int keynum)
|
const char *Key_KeynumToString (int keynum)
|
||||||
{
|
{
|
||||||
keyname_t *kn;
|
|
||||||
static char tinystr[2];
|
static char tinystr[2];
|
||||||
|
keyname_t *kn;
|
||||||
|
|
||||||
if (keynum == -1)
|
if (keynum == -1)
|
||||||
return "<KEY NOT FOUND>";
|
return "<KEY NOT FOUND>";
|
||||||
|
@ -522,8 +518,10 @@ const char *Key_KeynumToString (int keynum)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (kn = keynames; kn->name; kn++)
|
for (kn = keynames; kn->name; kn++)
|
||||||
|
{
|
||||||
if (keynum == kn->keynum)
|
if (keynum == kn->keynum)
|
||||||
return kn->name;
|
return kn->name;
|
||||||
|
}
|
||||||
|
|
||||||
return "<UNKNOWN KEYNUM>";
|
return "<UNKNOWN KEYNUM>";
|
||||||
}
|
}
|
||||||
|
@ -536,9 +534,6 @@ Key_SetBinding
|
||||||
*/
|
*/
|
||||||
void Key_SetBinding (int keynum, const char *binding)
|
void Key_SetBinding (int keynum, const char *binding)
|
||||||
{
|
{
|
||||||
char *new_binding;
|
|
||||||
int l;
|
|
||||||
|
|
||||||
if (keynum == -1)
|
if (keynum == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -550,11 +545,7 @@ void Key_SetBinding (int keynum, const char *binding)
|
||||||
}
|
}
|
||||||
|
|
||||||
// allocate memory for new binding
|
// allocate memory for new binding
|
||||||
l = Q_strlen (binding);
|
keybindings[keynum] = Z_Strdup(binding);
|
||||||
new_binding = (char *) Z_Malloc (l+1);
|
|
||||||
Q_strcpy (new_binding, binding);
|
|
||||||
new_binding[l] = 0;
|
|
||||||
keybindings[keynum] = new_binding;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -587,9 +578,11 @@ void Key_Unbindall_f (void)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
|
{
|
||||||
if (keybindings[i])
|
if (keybindings[i])
|
||||||
Key_SetBinding (i, "");
|
Key_SetBinding (i, "");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
|
@ -602,12 +595,13 @@ void Key_Bindlist_f (void)
|
||||||
|
|
||||||
count = 0;
|
count = 0;
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
if (keybindings[i])
|
{
|
||||||
if (*keybindings[i])
|
if (keybindings[i] && *keybindings[i])
|
||||||
{
|
{
|
||||||
Con_SafePrintf (" %s \"%s\"\n", Key_KeynumToString(i), keybindings[i]);
|
Con_SafePrintf (" %s \"%s\"\n", Key_KeynumToString(i), keybindings[i]);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Con_SafePrintf ("%i bindings\n", count);
|
Con_SafePrintf ("%i bindings\n", count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -645,7 +639,7 @@ void Key_Bind_f (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the rest of the command line
|
// copy the rest of the command line
|
||||||
cmd[0] = 0; // start out with a null string
|
cmd[0] = 0;
|
||||||
for (i = 2; i < c; i++)
|
for (i = 2; i < c; i++)
|
||||||
{
|
{
|
||||||
q_strlcat (cmd, Cmd_Argv(i), sizeof(cmd));
|
q_strlcat (cmd, Cmd_Argv(i), sizeof(cmd));
|
||||||
|
@ -668,10 +662,11 @@ void Key_WriteBindings (FILE *f)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
if (keybindings[i])
|
{
|
||||||
if (*keybindings[i])
|
if (keybindings[i] && *keybindings[i])
|
||||||
fprintf (f, "bind \"%s\" \"%s\"\n", Key_KeynumToString(i), keybindings[i]);
|
fprintf (f, "bind \"%s\" \"%s\"\n", Key_KeynumToString(i), keybindings[i]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void History_Init (void)
|
void History_Init (void)
|
||||||
|
@ -858,9 +853,7 @@ void Key_Event (int key, qboolean down)
|
||||||
key_lastpress = key;
|
key_lastpress = key;
|
||||||
key_count++;
|
key_count++;
|
||||||
if (key_count <= 0)
|
if (key_count <= 0)
|
||||||
{
|
|
||||||
return; // just catching keys for Con_NotifyBox
|
return; // just catching keys for Con_NotifyBox
|
||||||
}
|
|
||||||
|
|
||||||
// update auto-repeat status
|
// update auto-repeat status
|
||||||
if (down)
|
if (down)
|
||||||
|
@ -881,13 +874,10 @@ void Key_Event (int key, qboolean down)
|
||||||
}
|
}
|
||||||
|
|
||||||
autorep0:
|
autorep0:
|
||||||
|
|
||||||
if (key == K_SHIFT)
|
if (key == K_SHIFT)
|
||||||
shift_down = down;
|
shift_down = down;
|
||||||
|
|
||||||
//
|
|
||||||
// handle escape specialy, so the user can never unbind it
|
// handle escape specialy, so the user can never unbind it
|
||||||
//
|
|
||||||
if (key == K_ESCAPE)
|
if (key == K_ESCAPE)
|
||||||
{
|
{
|
||||||
if (!down)
|
if (!down)
|
||||||
|
@ -910,20 +900,11 @@ autorep0:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// johnfitz -- alt-enter to toggle fullscreen. FIXME -- this does NOT work
|
|
||||||
// But this hack (from sf.net/uhexen2) for SDLFitz works for me. S.A
|
|
||||||
// *** moved to main.c so that it works properly ***
|
|
||||||
// if (!down && (key == K_ENTER) && keydown[K_ALT])
|
|
||||||
// VID_Toggle();
|
|
||||||
// johnfitz
|
|
||||||
|
|
||||||
//
|
|
||||||
// key up events only generate commands if the game key binding is
|
// key up events only generate commands if the game key binding is
|
||||||
// a button command (leading + sign). These will occur even in console mode,
|
// a button command (leading + sign). These will occur even in console mode,
|
||||||
// to keep the character from continuing an action started before a console
|
// to keep the character from continuing an action started before a console
|
||||||
// switch. Button commands include the kenum as a parameter, so multiple
|
// switch. Button commands include the kenum as a parameter, so multiple
|
||||||
// downs can be matched with ups
|
// downs can be matched with ups
|
||||||
//
|
|
||||||
if (!down)
|
if (!down)
|
||||||
{
|
{
|
||||||
kb = keybindings[key];
|
kb = keybindings[key];
|
||||||
|
@ -944,21 +925,17 @@ autorep0:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// during demo playback, most keys bring up the main menu
|
// during demo playback, most keys bring up the main menu
|
||||||
//
|
|
||||||
if (cls.demoplayback && down && consolekeys[key] && key_dest == key_game && key != K_TAB)
|
if (cls.demoplayback && down && consolekeys[key] && key_dest == key_game && key != K_TAB)
|
||||||
{
|
{
|
||||||
M_ToggleMenu_f ();
|
M_ToggleMenu_f ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// if not a consolekey, send to the interpreter no matter what mode is
|
// if not a consolekey, send to the interpreter no matter what mode is
|
||||||
//
|
if ((key_dest == key_menu && menubound[key]) ||
|
||||||
if ( (key_dest == key_menu && menubound[key])
|
(key_dest == key_console && !consolekeys[key]) ||
|
||||||
|| (key_dest == key_console && !consolekeys[key])
|
(key_dest == key_game && (!con_forcedup || !consolekeys[key])))
|
||||||
|| (key_dest == key_game && ( !con_forcedup || !consolekeys[key] ) ) )
|
|
||||||
{
|
{
|
||||||
kb = keybindings[key];
|
kb = keybindings[key];
|
||||||
if (kb)
|
if (kb)
|
||||||
|
@ -981,9 +958,7 @@ autorep0:
|
||||||
return; // other systems only care about key down events
|
return; // other systems only care about key down events
|
||||||
|
|
||||||
if (shift_down)
|
if (shift_down)
|
||||||
{
|
|
||||||
key = keyshift[key];
|
key = keyshift[key];
|
||||||
}
|
|
||||||
|
|
||||||
switch (key_dest)
|
switch (key_dest)
|
||||||
{
|
{
|
||||||
|
@ -1015,8 +990,8 @@ void Key_ClearStates (void)
|
||||||
|
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
{
|
{
|
||||||
keydown[i] = false;
|
if (keydown[i])
|
||||||
key_repeats[i] = 0;
|
Key_Event (i, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
40
Quake/keys.h
40
Quake/keys.h
|
@ -60,25 +60,23 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define K_HOME 151
|
#define K_HOME 151
|
||||||
#define K_END 152
|
#define K_END 152
|
||||||
|
|
||||||
//johnfitz -- keypad
|
#define K_KP_NUMLOCK 153
|
||||||
#define KP_NUMLOCK 153
|
#define K_KP_SLASH 154
|
||||||
#define KP_SLASH 154
|
#define K_KP_STAR 155
|
||||||
#define KP_STAR 155
|
#define K_KP_MINUS 156
|
||||||
#define KP_MINUS 156
|
#define K_KP_HOME 157
|
||||||
#define KP_HOME 157
|
#define K_KP_UPARROW 158
|
||||||
#define KP_UPARROW 158
|
#define K_KP_PGUP 159
|
||||||
#define KP_PGUP 159
|
#define K_KP_PLUS 160
|
||||||
#define KP_PLUS 160
|
#define K_KP_LEFTARROW 161
|
||||||
#define KP_LEFTARROW 161
|
#define K_KP_5 162
|
||||||
#define KP_5 162
|
#define K_KP_RIGHTARROW 163
|
||||||
#define KP_RIGHTARROW 163
|
#define K_KP_END 164
|
||||||
#define KP_END 164
|
#define K_KP_DOWNARROW 165
|
||||||
#define KP_DOWNARROW 165
|
#define K_KP_PGDN 166
|
||||||
#define KP_PGDN 166
|
#define K_KP_ENTER 167
|
||||||
#define KP_ENTER 167
|
#define K_KP_INS 168
|
||||||
#define KP_INS 168
|
#define K_KP_DEL 169
|
||||||
#define KP_DEL 169
|
|
||||||
//johnfitz
|
|
||||||
|
|
||||||
#define K_PAUSE 255
|
#define K_PAUSE 255
|
||||||
|
|
||||||
|
@ -96,11 +94,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define K_JOY2 204
|
#define K_JOY2 204
|
||||||
#define K_JOY3 205
|
#define K_JOY3 205
|
||||||
#define K_JOY4 206
|
#define K_JOY4 206
|
||||||
|
|
||||||
//
|
|
||||||
// aux keys are for multi-buttoned joysticks to generate so they can use
|
// aux keys are for multi-buttoned joysticks to generate so they can use
|
||||||
// the normal binding process
|
// the normal binding process
|
||||||
//
|
// aux29-32: reserved for the HAT (POV) switch motion
|
||||||
#define K_AUX1 207
|
#define K_AUX1 207
|
||||||
#define K_AUX2 208
|
#define K_AUX2 208
|
||||||
#define K_AUX3 209
|
#define K_AUX3 209
|
||||||
|
|
Loading…
Reference in a new issue