diff --git a/Source/diablo.cpp b/Source/diablo.cpp index fe3a610e6ea..4f71b4c987e 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -116,6 +116,7 @@ bool gbProcessPlayers; bool gbLoadGame; bool cineflag; int PauseMode; +int BattlePauseMode; bool gbBard; bool gbBarbarian; bool HeadlessMode = false; @@ -208,6 +209,13 @@ void FreeGame() music_stop(); } +bool isBattlePaused() +{ + if (BattlePauseMode == 2) { + return false; + } +} + bool ProcessInput() { if (PauseMode == 2) { @@ -1425,20 +1433,24 @@ void GameLogic() return; } if (gbProcessPlayers) { - gGameLogicStep = GameLogicStep::ProcessPlayers; - ProcessPlayers(); + if (BattlePauseMode != 2) { + gGameLogicStep = GameLogicStep::ProcessPlayers; + ProcessPlayers(); + } } if (leveltype != DTYPE_TOWN) { - gGameLogicStep = GameLogicStep::ProcessMonsters; - ProcessMonsters(); - gGameLogicStep = GameLogicStep::ProcessObjects; - ProcessObjects(); - gGameLogicStep = GameLogicStep::ProcessMissiles; - ProcessMissiles(); - gGameLogicStep = GameLogicStep::ProcessItems; - ProcessItems(); - ProcessLightList(); - ProcessVisionList(); + if (BattlePauseMode != 2) { + gGameLogicStep = GameLogicStep::ProcessMonsters; + ProcessMonsters(); + gGameLogicStep = GameLogicStep::ProcessObjects; + ProcessObjects(); + gGameLogicStep = GameLogicStep::ProcessMissiles; + ProcessMissiles(); + gGameLogicStep = GameLogicStep::ProcessItems; + ProcessItems(); + ProcessLightList(); + ProcessVisionList(); + } } else { gGameLogicStep = GameLogicStep::ProcessTowners; ProcessTowners(); @@ -1447,21 +1459,25 @@ void GameLogic() gGameLogicStep = GameLogicStep::ProcessMissilesTown; ProcessMissiles(); } - gGameLogicStep = GameLogicStep::None; + + //removethis + if (BattlePauseMode != 2) { + gGameLogicStep = GameLogicStep::None; #ifdef _DEBUG - if (DebugScrollViewEnabled && (SDL_GetModState() & KMOD_SHIFT) != 0) { - ScrollView(); - } + if (DebugScrollViewEnabled && (SDL_GetModState() & KMOD_SHIFT) != 0) { + ScrollView(); + } #endif - sound_update(); - CheckTriggers(); - CheckQuests(); - RedrawViewport(); - pfile_update(false); + sound_update(); + CheckTriggers(); + CheckQuests(); + RedrawViewport(); + pfile_update(false); - plrctrls_after_game_logic(); + plrctrls_after_game_logic(); + } } void TimeoutCursor(bool bTimeout) @@ -1893,7 +1909,7 @@ void InitKeymapActions() N_("Pause Game"), N_("Pauses the game."), 'P', - diablo_pause_game); + diablo_battle_pause_game); sgOptions.Keymapper.AddAction( "Pause Game (Alternate)", N_("Pause Game (Alternate)"), @@ -2692,6 +2708,15 @@ void diablo_pause_game() } } +void diablo_battle_pause_game() +{ + if (BattlePauseMode != 0) { + BattlePauseMode = 0; + } else { + BattlePauseMode = 2; + } +} + bool GameWasAlreadyPaused = false; bool MinimizePaused = false; diff --git a/Source/diablo.h b/Source/diablo.h index a0116a14c62..cfb6d88012e 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -69,6 +69,7 @@ extern bool cineflag; /* These are defined in fonts.h */ extern void FontsCleanup(); extern DVL_API_FOR_TEST int PauseMode; +extern DVL_API_FOR_TEST int BattlePauseMode; extern bool gbBard; extern bool gbBarbarian; /** @@ -89,6 +90,7 @@ bool StartGame(bool bNewGame, bool bSinglePlayer); int DiabloMain(int argc, char **argv); bool TryIconCurs(); void diablo_pause_game(); +void diablo_battle_pause_game(); bool diablo_is_focused(); void diablo_focus_pause(); void diablo_focus_unpause(); diff --git a/Source/nthread.cpp b/Source/nthread.cpp index b3507826a49..d5191d84618 100644 --- a/Source/nthread.cpp +++ b/Source/nthread.cpp @@ -239,7 +239,7 @@ bool nthread_has_500ms_passed(bool *drawGame /*= nullptr*/) void nthread_UpdateProgressToNextGameTick() { - if (!gbRunGame || PauseMode != 0 || (!gbIsMultiplayer && gmenu_is_active()) || !gbProcessPlayers || demo::IsRunning()) // if game is not running or paused there is no next gametick in the near future + if (!gbRunGame || PauseMode != 0 || BattlePauseMode != 0 || (!gbIsMultiplayer && gmenu_is_active()) || !gbProcessPlayers || demo::IsRunning()) // if game is not running or paused there is no next gametick in the near future return; int currentTickCount = SDL_GetTicks(); int ticksMissing = last_tick - currentTickCount;