Merge pull request #634 from lazd/altloadfix

Flush keys when server data is parsed
This commit is contained in:
Yamagi 2020-12-12 14:12:50 +01:00 committed by GitHub
commit bd4f7bed65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View file

@ -829,6 +829,9 @@ CL_ParseServerData(void)
char *str; char *str;
int i; int i;
/* Clear all key states */
In_FlushQueue();
Com_DPrintf("Serverdata packet received.\n"); Com_DPrintf("Serverdata packet received.\n");
/* wipe the client_state_t struct */ /* wipe the client_state_t struct */

View file

@ -577,7 +577,7 @@ IN_Update(void)
} }
else else
{ {
Com_Printf("Pressed unknown key with SDL_Keycode %d, SDL_Scancode %d.\n", kc, (int)sc); Com_DPrintf("Pressed unknown key with SDL_Keycode %d, SDL_Scancode %d.\n", kc, (int)sc);
} }
} }
} }
@ -822,16 +822,6 @@ IN_Update(void)
sys_frame_time = Sys_Milliseconds(); sys_frame_time = Sys_Milliseconds();
} }
/*
* Removes all pending events from SDLs queue.
*/
void
In_FlushQueue(void)
{
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
Key_MarkAllUp();
}
/* /*
* Move handling * Move handling
*/ */
@ -981,6 +971,17 @@ IN_JoyAltSelectorUp(void)
joy_altselector_pressed = false; joy_altselector_pressed = false;
} }
/*
* Removes all pending events from SDLs queue.
*/
void
In_FlushQueue(void)
{
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
Key_MarkAllUp();
IN_JoyAltSelectorUp();
}
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
static void IN_Haptic_Shutdown(void); static void IN_Haptic_Shutdown(void);