From 7caec5fa694b240c60f1bb98348cdc48ce7ff336 Mon Sep 17 00:00:00 2001 From: Mitchell Richters <mjr4077au@gmail.com> Date: Wed, 29 Mar 2023 08:54:38 +1100 Subject: [PATCH] - Clean out where `inputState.ClearAllInput()` is called. * We can do this from just a few places and achieve the same result as having it sprinkled everywhere did. --- source/core/gamecontrol.cpp | 2 -- source/core/mainloop.cpp | 1 + source/core/maploader.cpp | 2 -- source/core/menu/razemenu.cpp | 2 -- source/core/savegamehelp.cpp | 1 - source/games/blood/src/blood.cpp | 6 ------ source/games/duke/src/premap.cpp | 1 - source/games/exhumed/src/player.cpp | 4 +--- 8 files changed, 2 insertions(+), 17 deletions(-) diff --git a/source/core/gamecontrol.cpp b/source/core/gamecontrol.cpp index 845521e54..e6155e915 100644 --- a/source/core/gamecontrol.cpp +++ b/source/core/gamecontrol.cpp @@ -1103,8 +1103,6 @@ int RunGame() StartWindow = FStartupScreen::CreateInstance(8, true); StartWindow->Progress(); - inputState.ClearAllInput(); - if (!GameConfig->IsInitialized()) { CONFIG_ReadCombatMacros(); diff --git a/source/core/mainloop.cpp b/source/core/mainloop.cpp index 4d98fbf49..c80ed5bce 100644 --- a/source/core/mainloop.cpp +++ b/source/core/mainloop.cpp @@ -266,6 +266,7 @@ static void GameTicker() case ga_level: Net_ClearFifo(); + inputState.ClearAllInput(); gamestate = GS_LEVEL; break; diff --git a/source/core/maploader.cpp b/source/core/maploader.cpp index d5e35fd3c..815e2683a 100644 --- a/source/core/maploader.cpp +++ b/source/core/maploader.cpp @@ -467,8 +467,6 @@ void validateStartSector(const char* filename, const DVector3& pos, sectortype** void loadMap(const char* filename, int flags, DVector3* pos, int16_t* ang, sectortype** cursect, SpawnSpriteDef& sprites) { - inputState.ClearAllInput(); - FileReader fr = fileSystem.OpenFileReader(filename); if (!fr.isOpen()) I_Error("Unable to open map %s", filename); int mapversion = fr.ReadInt32(); diff --git a/source/core/menu/razemenu.cpp b/source/core/menu/razemenu.cpp index ce85bfb10..29b82ea25 100644 --- a/source/core/menu/razemenu.cpp +++ b/source/core/menu/razemenu.cpp @@ -157,7 +157,6 @@ bool M_SetSpecialMenu(FName& menu, int param) int ep = NewGameStartupInfo.Episode; auto vol = FindVolume(ep); if (vol) STAT_StartNewGame(vol->name, NewGameStartupInfo.Skill); - inputState.ClearAllInput(); } return false; @@ -206,7 +205,6 @@ void OnMenuOpen(bool makeSound) void System_MenuClosed() { GSnd->SetSfxPaused(false, PAUSESFX_MENU); - inputState.ClearAllInput(); gi->MenuClosed(); } diff --git a/source/core/savegamehelp.cpp b/source/core/savegamehelp.cpp index 5d10798e2..a3017350d 100644 --- a/source/core/savegamehelp.cpp +++ b/source/core/savegamehelp.cpp @@ -733,7 +733,6 @@ static int nextquicksave = -1; gamestate = GS_HIDECONSOLE; } - inputState.ClearAllInput(); DoLoadGame(savename); BackupSaveGame = savename; } diff --git a/source/games/blood/src/blood.cpp b/source/games/blood/src/blood.cpp index 5fde861e7..7fcbab533 100644 --- a/source/games/blood/src/blood.cpp +++ b/source/games/blood/src/blood.cpp @@ -245,7 +245,6 @@ void StartLevel(MapRecord* level, bool newgame) if (!level) return; gFrameCount = 0; PlayClock = 0; - inputState.ClearAllInput(); currentLevel = level; if (gGameOptions.nGameType == 0) @@ -636,11 +635,6 @@ static void gameInit() gViewIndex = myconnectindex; UpdateNetworkMenus(); - if (gGameOptions.nGameType > 0) - { - inputState.ClearAllInput(); - } - } diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index e32d9daeb..982cfd4ef 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -1180,7 +1180,6 @@ void GameInterface::NewGame(MapRecord* map, int skill, bool) if (isShareware() && ud.recstat != 2) FTA(QUOTE_F1HELP, &ps[myconnectindex]); PlayerColorChanged(); - inputState.ClearAllInput(); } //--------------------------------------------------------------------------- diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index 39cbb76f0..cb3267e9b 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -335,9 +335,6 @@ void RestartPlayer(int nPlayer) } BuildRa(nPlayer); - - // clear out all input before finishing here - inputState.ClearAllInput(); } //--------------------------------------------------------------------------- @@ -1934,6 +1931,7 @@ static bool doPlayerDeathRestart(Player* const pPlayer) // will invalidate nPlayerSprite RestartPlayer(pPlayer->nPlayer); + inputState.ClearAllInput(); } else {