mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-25 22:10:59 +00:00
Empty SDLs event queue when starting cinematic playback.
Sometimes cinematics are skipped after the first frame even if the player didn't press any key. I'm unable to reliable reproduce that, so my educated guess is that one or more events are still waiting in SDLs event queue. For example, during intermission IN_Update() is not called for 5 seconds, key presses by impatient players are just added to the queue and not processed. The first event is used to skip leave the intermission, the second event skips the cinematic... Fix this by implementing a new function IN_FlushQueue() to flush SDLs event queue and calling it when starting cinematic playback. Yes, this is just another layer violation. :(
This commit is contained in:
parent
c0b768278f
commit
98276aeb91
2 changed files with 21 additions and 0 deletions
|
@ -49,4 +49,9 @@ void IN_Shutdown(void);
|
|||
*/
|
||||
void IN_Update(void);
|
||||
|
||||
/*
|
||||
* Removes all pending events from SDLs queue.
|
||||
*/
|
||||
void In_FlushQueue(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -465,6 +465,22 @@ IN_Update(void)
|
|||
GLimp_GrabInput(want_grab);
|
||||
}
|
||||
|
||||
/*
|
||||
* Removes all pending events from SDLs queue.
|
||||
*/
|
||||
void
|
||||
In_FlushQueue(void)
|
||||
{
|
||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||
SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT);
|
||||
#else
|
||||
SDL_Event event;
|
||||
while(SDL_PollEvent(&event));
|
||||
#endif
|
||||
|
||||
Key_MarkAllUp();
|
||||
}
|
||||
|
||||
/*
|
||||
* Move handling
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue