fix: NumLock shouldn't trigger frame delay changes
Posted: Sun Jun 11, 2017 8:52 am
Couldn't figure out why my game kept dropping to ultra-slow frame rate...
It turned out that my '1' key (toggle single-step) was also being seen as 'go to 2 frames/sec mode' despite:
debug.frame_delay.use_mod_key: true
in my options.conf. And this was because I apparently have NumLock turned on. (Can't really tell: this laptop has a numeric pad integrated into the keyboard, and for my 'convenience' the NumLock key has no visual indicator of whether it's on...)
Anyway:
It turned out that my '1' key (toggle single-step) was also being seen as 'go to 2 frames/sec mode' despite:
debug.frame_delay.use_mod_key: true
in my options.conf. And this was because I apparently have NumLock turned on. (Can't really tell: this laptop has a numeric pad integrated into the keyboard, and for my 'convenience' the NumLock key has no visual indicator of whether it's on...)
Anyway:
Code: Select all
diff --git a/src/events.c b/src/events.c
index 25d243b..441e092 100644
--- a/src/events.c
+++ b/src/events.c
@@ -1425,7 +1425,7 @@ void HandleKeysDebug(Key key)
if (game_status == GAME_MODE_PLAYING || !setup.debug.frame_delay_game_only)
{
- boolean mod_key_pressed = (GetKeyModState() != KMOD_None);
+ boolean mod_key_pressed = ((GetKeyModState() & (KMOD_Shift | KMOD_Control | KMOD_Alt | KMOD_Meta)) != KMOD_None);
for (i = 0; i < NUM_DEBUG_FRAME_DELAY_KEYS; i++)
{