diff --git a/Source/diablo.cpp b/Source/diablo.cpp index e40407586..42d84e3a2 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -533,7 +533,7 @@ void PressKey(int vkey) stream_stop(); } AutomapActive = false; - msgdelay = 0; + CancelCurrentDiabloMsg(); gamemenu_off(); doom_close(); } @@ -1228,7 +1228,7 @@ void HelpKeyPressed() } QuestLogIsOpen = false; AutomapActive = false; - msgdelay = 0; + CancelCurrentDiabloMsg(); gamemenu_off(); DisplayHelp(); doom_close(); @@ -1738,7 +1738,7 @@ bool PressEscKey() } if (IsDiabloMsgAvailable()) { - msgdelay = 0; + CancelCurrentDiabloMsg(); rv = true; } diff --git a/Source/error.cpp b/Source/error.cpp index 92e01bf8a..a008274bd 100644 --- a/Source/error.cpp +++ b/Source/error.cpp @@ -13,13 +13,12 @@ namespace devilution { -uint32_t msgdelay; - namespace { diablo_message msgtable[MAX_SEND_STR_LEN]; uint8_t msgcnt; diablo_message msgflag; +uint32_t msgdelay; } // namespace @@ -104,6 +103,11 @@ bool IsDiabloMsgAvailable() return msgflag != EMSG_NONE; } +void CancelCurrentDiabloMsg() +{ + msgdelay = 0; +} + void ClrDiabloMsg() { for (auto &msg : msgtable) diff --git a/Source/error.h b/Source/error.h index 3219146bd..a0382fe66 100644 --- a/Source/error.h +++ b/Source/error.h @@ -69,10 +69,9 @@ enum diablo_message : uint8_t { EMSG_SHRINE_MURPHYS, }; -extern uint32_t msgdelay; - void InitDiabloMsg(diablo_message e); bool IsDiabloMsgAvailable(); +void CancelCurrentDiabloMsg(); void ClrDiabloMsg(); void DrawDiabloMsg(const Surface &out);