diff --git a/CHANGELOG.md b/CHANGELOG.md index 9dab845db..4e17ee3ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,12 +9,13 @@ TombEngine releases are located in this repository (alongside with Tomb Editor): * Added live console input to perform Lua commands in realtime. ### Bug fixes -* Fixed pathfinding for friendly NPCs, such as monkeys. +* Fixed pathfinding for friendly NPCs such as monkeys. * Fixed particles remaining in the level after reloading from the savegame. * Fixed particles being canceled by fog bulbs. * Fixed crash in case hair object is the last object in a level. * Fixed crash with incorrectly applied animated textures on static meshes. * Fixed console window not hiding in non-debug mode on Windows 11. +* Fixed key binding settings saving for the current play session after hitting Esc to cancel. ### Lua API changes * Added missing constructor for `Collision.Probe` without room number. diff --git a/TombEngine/Game/gui.cpp b/TombEngine/Game/gui.cpp index a024419a2..46558185d 100644 --- a/TombEngine/Game/gui.cpp +++ b/TombEngine/Game/gui.cpp @@ -690,7 +690,7 @@ namespace TEN::Gui CurrentSettings.IgnoreInput = true; } - if (CurrentSettings.NewKeyWaitTimer > 0.0f) + if (CurrentSettings.NewKeyWaitTimer > 0) { ClearAllActions(); @@ -699,15 +699,15 @@ namespace TEN::Gui bool legacy30FpsDoneDraw = false; bool decreaseCounter = false; - while (CurrentSettings.NewKeyWaitTimer > 0.0f) + while (CurrentSettings.NewKeyWaitTimer > 0) { g_Synchronizer.Sync(); while (g_Synchronizer.Synced()) { - CurrentSettings.NewKeyWaitTimer -= 1.0f; - if (CurrentSettings.NewKeyWaitTimer <= 0.0f) - CurrentSettings.NewKeyWaitTimer = 0.0f; + CurrentSettings.NewKeyWaitTimer--; + if (CurrentSettings.NewKeyWaitTimer <= 0) + CurrentSettings.NewKeyWaitTimer = 0; if (!fromPauseMenu) { @@ -760,7 +760,7 @@ namespace TEN::Gui g_Bindings.SetKeyBinding(InputDeviceID::Custom, InputActionID(baseIndex + SelectedOption), selectedKeyID); DefaultConflict(); - CurrentSettings.NewKeyWaitTimer = 0.0f; + CurrentSettings.NewKeyWaitTimer = 0; CurrentSettings.IgnoreInput = true; return; } @@ -850,6 +850,7 @@ namespace TEN::Gui if (SelectedOption == (OptionCount - 2)) { SoundEffect(SFX_TR4_MENU_SELECT, nullptr, SoundEnvironment::Always); + ApplyDefaultBindings(); return; } @@ -858,9 +859,11 @@ namespace TEN::Gui if (SelectedOption == (OptionCount - 1)) { SoundEffect(SFX_TR4_MENU_SELECT, nullptr, SoundEnvironment::Always); + CurrentSettings.Configuration.Bindings = g_Bindings.GetBindingProfile(InputDeviceID::Custom); g_Configuration.Bindings = g_Bindings.GetBindingProfile(InputDeviceID::Custom); SaveConfiguration(); + MenuToDisplay = fromPauseMenu ? Menu::Pause : Menu::Options; SelectedOption = 2; return; @@ -870,7 +873,9 @@ namespace TEN::Gui if (SelectedOption == OptionCount) { SoundEffect(SFX_TR4_MENU_SELECT, nullptr, SoundEnvironment::Always); + g_Bindings.SetBindingProfile(InputDeviceID::Custom, CurrentSettings.Configuration.Bindings); + MenuToDisplay = fromPauseMenu ? Menu::Pause : Menu::Options; SelectedOption = 2; return; @@ -881,6 +886,8 @@ namespace TEN::Gui { SoundEffect(SFX_TR4_MENU_SELECT, nullptr, SoundEnvironment::Always); + g_Bindings.SetBindingProfile(InputDeviceID::Custom, CurrentSettings.Configuration.Bindings); + MenuToDisplay = Menu::Options; SelectedOption = 2; } diff --git a/TombEngine/Game/gui.h b/TombEngine/Game/gui.h index bca6f8b3a..8a04f1e9c 100644 --- a/TombEngine/Game/gui.h +++ b/TombEngine/Game/gui.h @@ -111,9 +111,9 @@ namespace TEN::Gui GameConfiguration Configuration = {}; - int SelectedScreenResolution = 0; - bool IgnoreInput = false; // Ignore input until all actions are inactive. - float NewKeyWaitTimer = 0.0f; + int SelectedScreenResolution = 0; + bool IgnoreInput = false; // Ignore input until all actions are inactive. + int NewKeyWaitTimer = 0; }; class GuiController