mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +00:00
some more minor changes to accomodate r761
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@763 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
3d5787a4c4
commit
d27dcc2bf8
2 changed files with 23 additions and 62 deletions
|
@ -210,8 +210,7 @@ void IN_Deactivate (qboolean free_cursor)
|
|||
|
||||
void IN_Init (void)
|
||||
{
|
||||
prev_gamekey = ((key_dest == key_game && !con_forcedup) ||
|
||||
(key_dest == key_menu && m_state == m_keys && m_keys_bind_grab));
|
||||
prev_gamekey = ((key_dest == key_game && !con_forcedup) || m_keys_bind_grab);
|
||||
SDL_EnableUNICODE (!prev_gamekey);
|
||||
if (SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL) == -1)
|
||||
Con_Printf("Warning: SDL_EnableKeyRepeat() failed.\n");
|
||||
|
@ -304,11 +303,10 @@ void IN_ClearStates (void)
|
|||
void IN_SendKeyEvents (void)
|
||||
{
|
||||
SDL_Event event;
|
||||
int sym, usym, state, modstate;
|
||||
int sym, state, modstate;
|
||||
qboolean gamekey;
|
||||
|
||||
gamekey = ((key_dest == key_game && !con_forcedup) ||
|
||||
(key_dest == key_menu && m_state == m_keys && m_keys_bind_grab));
|
||||
gamekey = ((key_dest == key_game && !con_forcedup) || m_keys_bind_grab);
|
||||
if (gamekey != prev_gamekey)
|
||||
{
|
||||
prev_gamekey = gamekey;
|
||||
|
@ -348,50 +346,33 @@ void IN_SendKeyEvents (void)
|
|||
state = event.key.state;
|
||||
modstate = SDL_GetModState();
|
||||
|
||||
switch (key_dest)
|
||||
if (event.key.keysym.unicode != 0)
|
||||
{
|
||||
case key_game:
|
||||
if (event.key.keysym.unicode != 0)
|
||||
{ /* only use unicode for ~ and ` in game mode */
|
||||
if ((event.key.keysym.unicode & 0xFF80) == 0)
|
||||
{
|
||||
usym = event.key.keysym.unicode & 0x7F;
|
||||
if (usym == '`' || usym == '~')
|
||||
sym = usym;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case key_message:
|
||||
case key_console:
|
||||
if (event.key.keysym.unicode != 0)
|
||||
if ((event.key.keysym.unicode & 0xFF80) == 0)
|
||||
{
|
||||
int usym = event.key.keysym.unicode & 0x7F;
|
||||
if (modstate & KMOD_CTRL && usym < 32 && sym >= 32)
|
||||
{
|
||||
/* control characters */
|
||||
if (modstate & KMOD_SHIFT)
|
||||
usym += 64;
|
||||
else usym += 96;
|
||||
}
|
||||
#if defined(__APPLE__) && defined(__MACH__)
|
||||
if (sym == SDLK_BACKSPACE)
|
||||
break; /* avoid change to SDLK_DELETE */
|
||||
usym = sym; /* avoid change to SDLK_DELETE */
|
||||
#endif /* Mac OS X */
|
||||
#if defined(__QNX__)
|
||||
if ((sym == SDLK_BACKSPACE) || (sym == SDLK_RETURN))
|
||||
break; /* S.A: fixes QNX weirdness */
|
||||
if (sym == SDLK_BACKSPACE || sym == SDLK_RETURN)
|
||||
usym = sym; /* S.A: fixes QNX weirdness */
|
||||
#endif /* __QNX__ */
|
||||
if ((event.key.keysym.unicode & 0xFF80) == 0)
|
||||
{
|
||||
usym = event.key.keysym.unicode & 0x7F;
|
||||
if (modstate & KMOD_CTRL && usym < 32 && sym >= 32)
|
||||
{
|
||||
/* control characters */
|
||||
if (modstate & KMOD_SHIFT)
|
||||
usym += 64;
|
||||
else usym += 96;
|
||||
}
|
||||
/* only use unicode for ` and ~ in game mode */
|
||||
if (!gamekey || usym == '`' || usym == '~')
|
||||
sym = usym;
|
||||
}
|
||||
/* else: it's an international character */
|
||||
}
|
||||
/* printf("You pressed %s (%d) (%c)\n", SDL_GetKeyName(sym), sym, sym);*/
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
/* else: it's an international character */
|
||||
}
|
||||
/*printf("You pressed %s (%d) (%c)\n", SDL_GetKeyName(sym), sym, sym);*/
|
||||
|
||||
switch (sym)
|
||||
{
|
||||
|
|
26
Quake/keys.c
26
Quake/keys.c
|
@ -50,8 +50,6 @@ qboolean consolekeys[256]; // if true, can't be rebound while in console
|
|||
qboolean menubound[256]; // if true, can't be rebound while in menu
|
||||
qboolean keydown[256];
|
||||
|
||||
qboolean repeatkeys[256]; //johnfitz -- if true, autorepeat is enabled for this key
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *name;
|
||||
|
@ -834,18 +832,6 @@ void Key_Init (void)
|
|||
consolekeys['`'] = false;
|
||||
consolekeys['~'] = false;
|
||||
|
||||
//johnfitz -- repeating keys
|
||||
for (i = 0; i < 256; i++)
|
||||
repeatkeys[i] = false;
|
||||
repeatkeys[K_BACKSPACE] = true;
|
||||
repeatkeys[K_DEL] = true;
|
||||
repeatkeys[K_PAUSE] = true;
|
||||
repeatkeys[K_PGUP] = true;
|
||||
repeatkeys[K_PGDN] = true;
|
||||
repeatkeys[K_LEFTARROW] = true;
|
||||
repeatkeys[K_RIGHTARROW] = true;
|
||||
//johnfitz
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
keyshift[i] = i;
|
||||
for (i = 'a' ; i <= 'z'; i++)
|
||||
|
@ -914,19 +900,13 @@ void Key_Event (int key, qboolean down)
|
|||
key_repeats[key]++;
|
||||
if (key_repeats[key] > 1)
|
||||
{
|
||||
if (key_dest == key_console)
|
||||
goto autorep0;
|
||||
if (key_dest == key_message)
|
||||
goto autorep0;
|
||||
if (!repeatkeys[key]) //johnfitz -- use repeatkeys[]
|
||||
return; // ignore most autorepeats
|
||||
if ((key_dest == key_game && !con_forcedup) || m_keys_bind_grab)
|
||||
return; // ignore autorepeats in game mode
|
||||
}
|
||||
|
||||
if (key >= 200 && !keybindings[key])
|
||||
else if (key >= 200 && !keybindings[key])
|
||||
Con_Printf ("%s is unbound, hit F4 to set.\n", Key_KeynumToString (key) );
|
||||
}
|
||||
|
||||
autorep0:
|
||||
if (key == K_SHIFT)
|
||||
shift_down = down;
|
||||
|
||||
|
|
Loading…
Reference in a new issue