Centralize input handling #21
Labels
Bug
Something isn't working
Input
Keyboard and joypad input.
~≤0.33 pushes
Projected number of pushes needed. Might turn out to get more expensive!
The game calls
Key_Read()
in way too many places. It would be cleaner to do it once inWinMain()
, and then pass the current inputs to the game state procedures as a parameter.By itself, this would only be an architectural concern. What turns this into an actual bug is that the Game Over and High Score screens repeatedly call
Key_Read()
in a blockingwhile
loop:ssg/GIAN07/GAMEMAIN.CPP
Lines 931 to 932 in 7dcab4f
You really should not do this in a single-threaded Windows application. This completely prevents the Windows message loop from running, which in turn makes your program unresponsive to any sort of Windows event. Apart from pressing a key to end the loop, the only thing you can do in this state is to quit the program via the Task Manager or other equally forceful methods.
In fact, you would expect even key presses to be blocked in this state. It only works for the original game because DirectInput 7 installs its own low-level keyboard hook (
WH_KEYBOARD_LL
) that bypasses the Windows message system.Fixing this would require a slight rearchitecture of the Game Over and High Score screens, replacing the blocking loops with proper wait states.
The text was updated successfully, but these errors were encountered: