From 5d1a4fd8af946208a96dc06d4c1d653a721825d5 Mon Sep 17 00:00:00 2001 From: Gleb Mazovetskiy Date: Thu, 30 Jun 2022 10:23:34 +0100 Subject: [PATCH] `IncProgress`: Do not render bar if not active Loading the game from within the game calls `IncProgress` multiple times but we should not render the progress bar when that happens. --- Source/diablo.cpp | 6 ++++-- Source/interfac.cpp | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 3f24af6f7..1b945554c 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -2328,8 +2328,10 @@ void LoadGameLevel(bool firstflag, lvl_entry lvldir) music_mute(); } - while (!IncProgress()) - ; + if (firstflag) { + while (!IncProgress()) + ; + } if (!gbIsSpawn && setlevel && setlvlnum == SL_SKELKING && Quests[Q_SKELKING]._qactive == QUEST_ACTIVE) PlaySFX(USFX_SKING1); diff --git a/Source/interfac.cpp b/Source/interfac.cpp index bd751e7c2..8393e3210 100644 --- a/Source/interfac.cpp +++ b/Source/interfac.cpp @@ -32,6 +32,7 @@ namespace { std::optional sgpBackCel; +bool IsProgress; uint32_t sgdwProgress; int progress_id; @@ -217,6 +218,8 @@ void interface_msg_pump() bool IncProgress() { interface_msg_pump(); + if (!IsProgress) + return false; sgdwProgress += 23; if (sgdwProgress > 534) sgdwProgress = 534; @@ -227,6 +230,7 @@ bool IncProgress() void ShowProgress(interface_mode uMsg) { WNDPROC saveProc; + IsProgress = true; gbSomebodyWonGameKludge = false; plrmsg_delay(true); @@ -413,6 +417,7 @@ void ShowProgress(interface_mode uMsg) saveProc = SetWindowProc(saveProc); assert(saveProc == DisableInputWndProc); + IsProgress = false; NetSendCmdLocParam2(true, CMD_PLAYER_JOINLEVEL, myPlayer.position.tile, myPlayer.plrlevel, myPlayer.plrIsOnSetLevel ? 1 : 0); plrmsg_delay(false);