CaravelGames / drod

The official public repository of Deadly Rooms of Death and DROD RPG
http://caravelgames.com
56 stars 17 forks source link

Fix Ctrl-Wait sometimes waiting for 60 turns #493

Closed Hypexion closed 1 year ago

Hypexion commented 1 year ago

Keyboard inputs are weird, and this is somehow causing some players to wait 60 turns when they do a Ctrl-Wait instead of 30 turns. This is because two input events are registered by SDL, which causes a macro'd wait command to be sent to the engine twice.

Luckily FrontEndLib can tell when a key event is repeated. When a repeated keypress is seen, we can increment its repeat value by one. Then in CGameScreen::OnKeyDown if we see a macro'd wait command with exactly one repeat, we do not pass it to the engine. This solves the problem.