From e078ea6ebd6b4bcfd29dc6cb0a8061211a816a09 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 24 Sep 2020 00:15:51 +1000 Subject: [PATCH] - Blood/Exhumed/SW: Hook up `gi->clearlocalinputstate()`. --- source/blood/src/blood.h | 1 + source/blood/src/controls.cpp | 12 ++++++++++++ source/exhumed/src/exhumed.h | 1 + source/exhumed/src/input.cpp | 13 +++++++++++++ source/sw/src/game.h | 1 + source/sw/src/input.cpp | 12 ++++++++++++ 6 files changed, 40 insertions(+) diff --git a/source/blood/src/blood.h b/source/blood/src/blood.h index 203742226..2f8e81afd 100644 --- a/source/blood/src/blood.h +++ b/source/blood/src/blood.h @@ -71,6 +71,7 @@ struct GameInterface : ::GameInterface { const char* Name() override { return "Blood"; } void app_init() override; + void clearlocalinputstate() override; bool GenerateSavePic() override; void FreeLevelData() override; void FreeGameData() override; diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index a2108ca33..e365cd850 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -170,4 +170,16 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) } } +//--------------------------------------------------------------------------- +// +// This is called from ImputState::ClearAllInput and resets all static state being used here. +// +//--------------------------------------------------------------------------- + +void GameInterface::clearlocalinputstate() +{ + gInput = {}; + turnHeldTime = 0; +} + END_BLD_NS diff --git a/source/exhumed/src/exhumed.h b/source/exhumed/src/exhumed.h index 113f9d764..d9aa19767 100644 --- a/source/exhumed/src/exhumed.h +++ b/source/exhumed/src/exhumed.h @@ -235,6 +235,7 @@ struct GameInterface : ::GameInterface { const char* Name() override { return "Exhumed"; } void app_init() override; + void clearlocalinputstate() override; bool GenerateSavePic() override; void DrawNativeMenuText(int fontnum, int state, double xpos, double ypos, float fontscale, const char* text, int flags) override; void MenuOpened() override; diff --git a/source/exhumed/src/input.cpp b/source/exhumed/src/input.cpp index 04f64a0a4..2df7586a3 100644 --- a/source/exhumed/src/input.cpp +++ b/source/exhumed/src/input.cpp @@ -232,4 +232,17 @@ void GameInterface::GetInput(InputPacket* packet, ControlInfo* const hidInput) if (packet) *packet = localInput; } +//--------------------------------------------------------------------------- +// +// This is called from ImputState::ClearAllInput and resets all static state being used here. +// +//--------------------------------------------------------------------------- + +void GameInterface::clearlocalinputstate() +{ + localInput = {}; + turn = 0; + counter = 0; +} + END_PS_NS diff --git a/source/sw/src/game.h b/source/sw/src/game.h index e297550c7..dedcf503b 100644 --- a/source/sw/src/game.h +++ b/source/sw/src/game.h @@ -2182,6 +2182,7 @@ struct GameInterface : ::GameInterface { const char* Name() override { return "ShadowWarrior"; } void app_init() override; + void clearlocalinputstate() override; void FreeGameData() override; void FreeLevelData() override; bool GenerateSavePic() override; diff --git a/source/sw/src/input.cpp b/source/sw/src/input.cpp index 9034e77a6..0dce53998 100644 --- a/source/sw/src/input.cpp +++ b/source/sw/src/input.cpp @@ -344,4 +344,16 @@ void GameInterface::GetInput(InputPacket *packet, ControlInfo* const hidInput) } } +//--------------------------------------------------------------------------- +// +// This is called from ImputState::ClearAllInput and resets all static state being used here. +// +//--------------------------------------------------------------------------- + +void GameInterface::clearlocalinputstate() +{ + loc = {}; + turnheldtime = 0; +} + END_SW_NS