diff --git a/Source/control.cpp b/Source/control.cpp index 44243f93c..3d5634972 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -57,10 +57,9 @@ namespace devilution { * @brief Set if the life flask needs to be redrawn during next frame */ bool drawhpflag; -bool dropGoldFlag; +bool IsDropGoldOpen; bool chrbtn[4]; -bool lvlbtndown; -int dropGoldValue; +int DropGoldValue; /** * @brief Set if the mana flask needs to be redrawn during the next frame */ @@ -69,14 +68,14 @@ bool chrbtnactive; int pnumlines; UiFlags InfoColor; int sbooktab; -int8_t initialDropGoldIndex; +int8_t InitialDropGoldIndex; bool talkflag; bool sbookflag; bool chrflag; bool drawbtnflag; std::string InfoString; bool panelflag; -int initialDropGoldValue; +int InitialDropGoldValue; bool panbtndown; bool spselflag; Rectangle MainPanel; @@ -129,6 +128,7 @@ std::optional pDurIcons; std::optional multiButtons; std::optional pPanelButtons; +bool IsLevelUpButtonPressed; bool PanelButtons[8]; int PanelButtonIndex; char TalkSave[8][MAX_SEND_STR_LEN]; @@ -364,17 +364,17 @@ void ControlUpDown(int v) void RemoveGold(Player &player, int goldIndex) { int gi = goldIndex - INVITEM_INV_FIRST; - player.InvList[gi]._ivalue -= dropGoldValue; + player.InvList[gi]._ivalue -= DropGoldValue; if (player.InvList[gi]._ivalue > 0) SetPlrHandGoldCurs(player.InvList[gi]); else player.RemoveInvItem(gi); - MakeGoldStack(player.HoldItem, dropGoldValue); + MakeGoldStack(player.HoldItem, DropGoldValue); NewCursor(player.HoldItem._iCurs + CURSOR_FIRSTITEM); player._pGold = CalculateGold(player); - dropGoldValue = 0; + DropGoldValue = 0; } bool IsLevelUpButtonVisible() @@ -549,7 +549,7 @@ void InitControlPan() } LoadMainPanel(); panelflag = false; - lvlbtndown = false; + IsLevelUpButtonPressed = false; pPanelButtons = LoadCel("CtrlPan\\Panel8bu.CEL", 71); ClearPanBtn(); if (!IsChatAvailable()) @@ -574,9 +574,9 @@ void InitControlPan() pQLogCel = LoadCel("Data\\Quest.CEL", SPANEL_WIDTH); pGBoxBuff = LoadCel("CtrlPan\\Golddrop.cel", 261); CloseGoldDrop(); - dropGoldValue = 0; - initialDropGoldValue = 0; - initialDropGoldIndex = 0; + DropGoldValue = 0; + InitialDropGoldValue = 0; + InitialDropGoldIndex = 0; CalculatePanelAreas(); @@ -792,16 +792,16 @@ void CheckBtnUp() sbookflag = false; IsStashOpen = false; invflag = !invflag; - if (dropGoldFlag) { + if (IsDropGoldOpen) { CloseGoldDrop(); - dropGoldValue = 0; + DropGoldValue = 0; } break; case PanelButtonSpellbook: CloseInventory(); - if (dropGoldFlag) { + if (IsDropGoldOpen) { CloseGoldDrop(); - dropGoldValue = 0; + DropGoldValue = 0; } sbookflag = !sbookflag; break; @@ -899,35 +899,43 @@ void DrawInfoBox(const Surface &out) PrintInfo(out); } -void CheckLvlBtn() +bool CheckLevelUpButtonPress() { if (!IsLevelUpButtonVisible()) { - return; + return false; } - auto &mainPanelPosition = GetMainPanel().position; - if (!lvlbtndown && MousePosition.x >= 40 + mainPanelPosition.x && MousePosition.x <= 81 + mainPanelPosition.x && MousePosition.y >= -39 + mainPanelPosition.y && MousePosition.y <= -17 + mainPanelPosition.y) - lvlbtndown = true; + Rectangle button = { GetPanelPosition(UiPanels::Main, { 40, -39 }), { 41, 22 } }; + if (button.Contains(MousePosition)) { + IsLevelUpButtonPressed = true; + } + + return IsLevelUpButtonPressed; } -void ReleaseLvlBtn() +void CheckLevelUpButtonRelease() { - auto &mainPanelPosition = GetMainPanel().position; - if (MousePosition.x >= 40 + mainPanelPosition.x && MousePosition.x <= 81 + mainPanelPosition.x && MousePosition.y >= -39 + mainPanelPosition.y && MousePosition.y <= -17 + mainPanelPosition.y) { + if (!IsLevelUpButtonPressed) { + return; + } + + Rectangle button = { GetPanelPosition(UiPanels::Main, { 40, -39 }), { 41, 22 } }; + if (button.Contains(MousePosition)) { QuestLogIsOpen = false; IsStashOpen = false; chrflag = true; } - lvlbtndown = false; + IsLevelUpButtonPressed = false; } -void DrawLevelUpIcon(const Surface &out) +void DrawLevelUpButton(const Surface &out) { - if (IsLevelUpButtonVisible()) { - int nCel = lvlbtndown ? 3 : 2; - DrawString(out, _("Level Up"), { { PANEL_LEFT + 0, PANEL_TOP - 62 }, { 120, 0 } }, UiFlags::ColorWhite | UiFlags::AlignCenter); - CelDrawTo(out, { 40 + PANEL_X, -17 + PANEL_Y }, *pChrButtons, nCel); + if (!IsLevelUpButtonVisible()) { + return; } + + DrawString(out, _("Level Up"), { { PANEL_LEFT + 0, PANEL_TOP - 62 }, { 120, 0 } }, UiFlags::ColorWhite | UiFlags::AlignCenter); + CelDrawTo(out, { 40 + PANEL_X, -17 + PANEL_Y }, *pChrButtons, IsLevelUpButtonPressed ? 3 : 2); } void CheckChrBtns() @@ -1026,6 +1034,10 @@ void RedBack(const Surface &out) void DrawGoldSplit(const Surface &out, int amount) { + if (!IsDropGoldOpen) { + return; + } + const int dialogX = 30; CelDrawTo(out, GetPanelPosition(UiPanels::Inventory, { dialogX, 178 }), *pGBoxBuff, 1); @@ -1035,8 +1047,8 @@ void DrawGoldSplit(const Surface &out, int amount) ngettext( "You have {:d} gold piece. How many do you want to remove?", "You have {:d} gold pieces. How many do you want to remove?", - initialDropGoldValue), - initialDropGoldValue); + InitialDropGoldValue), + InitialDropGoldValue); // Pre-wrap the string at spaces, otherwise DrawString would hard wrap in the middle of words const std::string wrapped = WordWrapString(description, 200); @@ -1055,25 +1067,25 @@ void DrawGoldSplit(const Surface &out, int amount) DrawString(out, value, GetPanelPosition(UiPanels::Inventory, { dialogX + 37, 128 }), UiFlags::ColorWhite | UiFlags::PentaCursor); } -void control_drop_gold(char vkey) +void DropGoldKeyPress(char vkey) { auto &myPlayer = Players[MyPlayerId]; if (myPlayer._pHitPoints >> 6 <= 0) { CloseGoldDrop(); - dropGoldValue = 0; + DropGoldValue = 0; return; } if (vkey == DVL_VK_RETURN) { - if (dropGoldValue > 0) - RemoveGold(myPlayer, initialDropGoldIndex); + if (DropGoldValue > 0) + RemoveGold(myPlayer, InitialDropGoldIndex); CloseGoldDrop(); } else if (vkey == DVL_VK_ESCAPE) { CloseGoldDrop(); - dropGoldValue = 0; + DropGoldValue = 0; } else if (vkey == DVL_VK_BACK) { - dropGoldValue /= 10; + DropGoldValue /= 10; } } @@ -1271,9 +1283,9 @@ void DiabloHotkeyMsg(uint32_t dwMsg) void CloseGoldDrop() { - if (!dropGoldFlag) + if (!IsDropGoldOpen) return; - dropGoldFlag = false; + IsDropGoldOpen = false; SDL_StopTextInput(); } @@ -1282,10 +1294,10 @@ void GoldDropNewText(string_view text) for (char vkey : text) { int digit = vkey - '0'; if (digit >= 0 && digit <= 9) { - int newGoldValue = dropGoldValue * 10; + int newGoldValue = DropGoldValue * 10; newGoldValue += digit; - if (newGoldValue <= initialDropGoldValue) { - dropGoldValue = newGoldValue; + if (newGoldValue <= InitialDropGoldValue) { + DropGoldValue = newGoldValue; } } } diff --git a/Source/control.h b/Source/control.h index 721c5d5a3..e928ad4b3 100644 --- a/Source/control.h +++ b/Source/control.h @@ -33,25 +33,25 @@ namespace devilution { #define SPANEL_HEIGHT 352 extern bool drawhpflag; -extern bool dropGoldFlag; +extern bool IsDropGoldOpen; extern bool chrbtn[4]; -extern bool lvlbtndown; -extern int dropGoldValue; +extern int DropGoldValue; extern bool drawmanaflag; extern bool chrbtnactive; extern DVL_API_FOR_TEST int pnumlines; extern UiFlags InfoColor; extern int sbooktab; -extern int8_t initialDropGoldIndex; +extern int8_t InitialDropGoldIndex; extern bool talkflag; extern bool sbookflag; extern bool chrflag; extern bool drawbtnflag; extern std::string InfoString; extern bool panelflag; -extern int initialDropGoldValue; +extern int InitialDropGoldValue; extern bool panbtndown; extern bool spselflag; + const Rectangle &GetMainPanel(); const Rectangle &GetLeftPanel(); const Rectangle &GetRightPanel(); @@ -163,16 +163,16 @@ void FreeControlPan(); * Sets a string to be drawn in the info box and then draws it. */ void DrawInfoBox(const Surface &out); -void CheckLvlBtn(); -void ReleaseLvlBtn(); -void DrawLevelUpIcon(const Surface &out); +bool CheckLevelUpButtonPress(); +void CheckLevelUpButtonRelease(); +void DrawLevelUpButton(const Surface &out); void CheckChrBtns(); void ReleaseChrBtns(bool addAllStatPoints); void DrawDurIcon(const Surface &out); void RedBack(const Surface &out); void DrawSpellBook(const Surface &out); void DrawGoldSplit(const Surface &out, int amount); -void control_drop_gold(char vkey); +void DropGoldKeyPress(char vkey); void DrawTalkPan(const Surface &out); bool control_check_talk_btn(); void control_release_talk_btn(); diff --git a/Source/controls/plrctrls.cpp b/Source/controls/plrctrls.cpp index 2116af205..1613efc61 100644 --- a/Source/controls/plrctrls.cpp +++ b/Source/controls/plrctrls.cpp @@ -1727,26 +1727,16 @@ void PerformSpellAction() void CtrlUseInvItem() { - Item *item; - if (pcursinvitem == -1) return; - auto &myPlayer = Players[MyPlayerId]; - - if (pcursinvitem < INVITEM_INV_FIRST) - item = &myPlayer.InvBody[pcursinvitem]; - else if (pcursinvitem <= INVITEM_INV_LAST) - item = &myPlayer.InvList[pcursinvitem - INVITEM_INV_FIRST]; - else - item = &myPlayer.SpdList[pcursinvitem - INVITEM_BELT_FIRST]; - - if (item->IsScroll() && spelldata[item->_iSpell].sTargeted) { + const Item &item = GetInventoryItem(pcursinvitem); + if (item.IsScroll() && spelldata[item._iSpell].sTargeted) { return; } int itemId = GetItemIdOnSlot(Slot); - if (item->isEquipment()) { + if (item.isEquipment()) { CheckInvItem(true, false); // auto-equip if it's an equipment } else { UseInvItem(MyPlayerId, pcursinvitem); diff --git a/Source/controls/touch/renderers.cpp b/Source/controls/touch/renderers.cpp index 4b23768c6..de328ba4b 100644 --- a/Source/controls/touch/renderers.cpp +++ b/Source/controls/touch/renderers.cpp @@ -455,16 +455,9 @@ VirtualGamepadButtonType SecondaryActionButtonRenderer::GetButtonType() return GetApplyButtonType(virtualPadButton->isHeld); if (pcursinvitem != -1) { - Item *item; - if (pcursinvitem < INVITEM_INV_FIRST) - item = &MyPlayer->InvBody[pcursinvitem]; - else if (pcursinvitem <= INVITEM_INV_LAST) - item = &MyPlayer->InvList[pcursinvitem - INVITEM_INV_FIRST]; - else - item = &MyPlayer->SpdList[pcursinvitem - INVITEM_BELT_FIRST]; - - if (!item->IsScroll() || !spelldata[item->_iSpell].sTargeted) { - if (!item->isEquipment()) { + const Item &item = GetInventoryItem(pcursinvitem); + if (!item.IsScroll() || !spelldata[item._iSpell].sTargeted) { + if (!item.isEquipment()) { return GetApplyButtonType(virtualPadButton->isHeld); } } diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 2890a471a..1015581fd 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -334,7 +334,7 @@ void LeftMouseDown(int wParam) } else if (chrflag && GetLeftPanel().Contains(MousePosition)) { CheckChrBtns(); } else if (invflag && GetRightPanel().Contains(MousePosition)) { - if (!dropGoldFlag) + if (!IsDropGoldOpen) CheckInvItem(isShiftHeld, isCtrlHeld); } else if (IsStashOpen && GetLeftPanel().Contains(MousePosition)) { if (!IsWithdrawGoldOpen) @@ -348,13 +348,12 @@ void LeftMouseDown(int wParam) NewCursor(CURSOR_HAND); } } else { - CheckLvlBtn(); - if (!lvlbtndown) + if (!CheckLevelUpButtonPress()) LeftMouseCmd(isShiftHeld); } } } else { - if (!talkflag && !dropGoldFlag && !IsWithdrawGoldOpen && !gmenu_is_active()) + if (!talkflag && !IsDropGoldOpen && !IsWithdrawGoldOpen && !gmenu_is_active()) CheckInvScrn(isShiftHeld, isCtrlHeld); DoPanBtn(); CheckStashButtonPress(MousePosition); @@ -373,8 +372,7 @@ void LeftMouseUp(int wParam) CheckStashButtonRelease(MousePosition); if (chrbtnactive) ReleaseChrBtns(isShiftHeld); - if (lvlbtndown) - ReleaseLvlBtn(); + CheckLevelUpButtonRelease(); if (stextflag != STORE_NONE) ReleaseStoreBtn(); } @@ -422,7 +420,7 @@ bool PressSysKey(int wParam) void ReleaseKey(int vkey) { - if (sgnTimeoutCurs != CURSOR_NONE || dropGoldFlag) + if (sgnTimeoutCurs != CURSOR_NONE || IsDropGoldOpen) return; sgOptions.Keymapper.KeyReleased(vkey); } @@ -473,7 +471,7 @@ void PressKey(int vkey) return; } - if (sgnTimeoutCurs != CURSOR_NONE || dropGoldFlag || IsWithdrawGoldOpen) { + if (sgnTimeoutCurs != CURSOR_NONE || IsDropGoldOpen || IsWithdrawGoldOpen) { return; } @@ -568,8 +566,8 @@ void PressChar(char vkey) doom_close(); return; } - if (dropGoldFlag) { - control_drop_gold(vkey); + if (IsDropGoldOpen) { + DropGoldKeyPress(vkey); return; } if (IsWithdrawGoldOpen) { @@ -1978,8 +1976,8 @@ bool PressEscKey() rv = true; } - if (dropGoldFlag) { - control_drop_gold(DVL_VK_ESCAPE); + if (IsDropGoldOpen) { + DropGoldKeyPress(DVL_VK_ESCAPE); rv = true; } diff --git a/Source/error.cpp b/Source/error.cpp index c7f61348b..6b9fc3097 100644 --- a/Source/error.cpp +++ b/Source/error.cpp @@ -143,6 +143,10 @@ void ClrDiabloMsg() void DrawDiabloMsg(const Surface &out) { + if (!IsDiabloMsgAvailable()) { + return; + } + int dialogStartY = ((gnScreenHeight - PANEL_HEIGHT) / 2) - (ErrorWindowHeight / 2) + 9; CelDrawTo(out, { PANEL_X + 101, dialogStartY }, *pSTextSlidCels, 1); diff --git a/Source/help.cpp b/Source/help.cpp index 11e4dbff8..92511bf81 100644 --- a/Source/help.cpp +++ b/Source/help.cpp @@ -166,6 +166,10 @@ void InitHelp() void DrawHelp(const Surface &out) { + if (!HelpFlag) { + return; + } + DrawSTextHelp(); DrawQTextBack(out); diff --git a/Source/inv.cpp b/Source/inv.cpp index e2abdc855..ea9020e21 100644 --- a/Source/inv.cpp +++ b/Source/inv.cpp @@ -610,9 +610,9 @@ void CheckInvCut(int pnum, Point cursorPosition, bool automaticMove, bool dropIt return; } - if (dropGoldFlag) { + if (IsDropGoldOpen) { CloseGoldDrop(); - dropGoldValue = 0; + DropGoldValue = 0; } bool done = false; @@ -1099,14 +1099,14 @@ void StartGoldDrop() { CloseGoldWithdraw(); - initialDropGoldIndex = pcursinvitem; + InitialDropGoldIndex = pcursinvitem; auto &myPlayer = Players[MyPlayerId]; if (pcursinvitem <= INVITEM_INV_LAST) - initialDropGoldValue = myPlayer.InvList[pcursinvitem - INVITEM_INV_FIRST]._ivalue; + InitialDropGoldValue = myPlayer.InvList[pcursinvitem - INVITEM_INV_FIRST]._ivalue; else - initialDropGoldValue = myPlayer.SpdList[pcursinvitem - INVITEM_BELT_FIRST]._ivalue; + InitialDropGoldValue = myPlayer.SpdList[pcursinvitem - INVITEM_BELT_FIRST]._ivalue; if (talkflag) control_reset_talk(); @@ -1115,8 +1115,8 @@ void StartGoldDrop() SDL_Rect rect = MakeSdlRect(start.x, start.y, 180, 20); SDL_SetTextInputRect(&rect); - dropGoldFlag = true; - dropGoldValue = 0; + IsDropGoldOpen = true; + DropGoldValue = 0; SDL_StartTextInput(); } @@ -1616,9 +1616,9 @@ void CheckInvScrn(bool isShiftHeld, bool isCtrlHeld) void InvGetItem(int pnum, int ii) { auto &item = Items[ii]; - if (dropGoldFlag) { + if (IsDropGoldOpen) { CloseGoldDrop(); - dropGoldValue = 0; + DropGoldValue = 0; } if (dItem[item.position.x][item.position.y] == 0) @@ -1648,9 +1648,9 @@ void AutoGetItem(int pnum, Item *itemPointer, int ii) Item &item = *itemPointer; auto &player = Players[pnum]; - if (dropGoldFlag) { + if (IsDropGoldOpen) { CloseGoldDrop(); - dropGoldValue = 0; + DropGoldValue = 0; } if (dItem[item.position.x][item.position.y] == 0) @@ -2040,6 +2040,19 @@ bool UseStaff() return CanUseStaff(myPlayer.InvBody[INVLOC_HAND_LEFT], myPlayer._pRSpell); } +const Item &GetInventoryItem(int location) +{ + Player &myPlayer = Players[MyPlayerId]; + + if (location < INVITEM_INV_FIRST) + return myPlayer.InvBody[location]; + + if (location <= INVITEM_INV_LAST) + return myPlayer.InvList[location - INVITEM_INV_FIRST]; + + return myPlayer.SpdList[location - INVITEM_BELT_FIRST]; +} + bool UseInvItem(int pnum, int cii) { int c; @@ -2117,9 +2130,9 @@ bool UseInvItem(int pnum, int cii) return true; } - if (dropGoldFlag) { + if (IsDropGoldOpen) { CloseGoldDrop(); - dropGoldValue = 0; + DropGoldValue = 0; } if (item->IsScroll() && currlevel == 0 && !spelldata[item->_iSpell].sTownSpell) { diff --git a/Source/inv.h b/Source/inv.h index 9733a67ae..8aefffa81 100644 --- a/Source/inv.h +++ b/Source/inv.h @@ -200,6 +200,7 @@ void RemoveScroll(Player &player); bool UseScroll(); void UseStaffCharge(Player &player); bool UseStaff(); +const Item &GetInventoryItem(int pcursinvitem); bool UseInvItem(int pnum, int cii); void DoTelekinesis(); int CalculateGold(Player &player); diff --git a/Source/items.cpp b/Source/items.cpp index 3991df9bc..baaf680c1 100644 --- a/Source/items.cpp +++ b/Source/items.cpp @@ -2265,7 +2265,7 @@ bool IsItemAvailable(int i) *sgOptions.Gameplay.testBard && IsAnyOf(i, IDI_BARDSWORD, IDI_BARDDAGGER)); } -BYTE GetOutlineColor(const Item &item, bool checkReq) +uint8_t GetOutlineColor(const Item &item, bool checkReq) { if (checkReq && !item._iStatFlag) return ICOL_RED; @@ -3727,6 +3727,10 @@ bool DoOil(Player &player, int cii) void DrawUniqueInfo(const Surface &out) { + if (!ShowUniqueItemInfoBox) { + return; + } + const Point position = GetRightPanel().position - Displacement { SPANEL_WIDTH, 0 }; if ((chrflag || QuestLogIsOpen || IsStashOpen) && GetLeftPanel().Contains(position)) { return; diff --git a/Source/items.h b/Source/items.h index 08fa87a82..0d701f221 100644 --- a/Source/items.h +++ b/Source/items.h @@ -423,7 +423,7 @@ extern bool ShowUniqueItemInfoBox; extern CornerStoneStruct CornerStone; extern bool UniqueItemFlags[128]; -BYTE GetOutlineColor(const Item &item, bool checkReq); +uint8_t GetOutlineColor(const Item &item, bool checkReq); bool IsItemAvailable(int i); bool IsUniqueAvailable(int i); void InitItemGFX(); diff --git a/Source/minitext.cpp b/Source/minitext.cpp index ae89a1045..05c680431 100644 --- a/Source/minitext.cpp +++ b/Source/minitext.cpp @@ -151,6 +151,10 @@ void DrawQTextBack(const Surface &out) void DrawQText(const Surface &out) { + if (!qtextflag) { + return; + } + DrawQTextBack(out); DrawQTextContent(out.subregionY(UI_OFFSET_Y + 49, 260)); } diff --git a/Source/miniwin/misc_msg.cpp b/Source/miniwin/misc_msg.cpp index e410693a4..444ab39a0 100644 --- a/Source/miniwin/misc_msg.cpp +++ b/Source/miniwin/misc_msg.cpp @@ -489,14 +489,14 @@ bool FetchMessage_Real(tagMSG *lpMsg) case SDL_KEYDOWN: case SDL_KEYUP: { #ifdef USE_SDL1 - if (gbRunGame && (IsTalkActive() || dropGoldFlag)) { + if (gbRunGame && (IsTalkActive() || IsDropGoldOpen)) { Uint16 unicode = e.key.keysym.unicode; if (unicode >= ' ') { std::wstring_convert, char32_t> convert; std::string utf8 = convert.to_bytes(unicode); if (IsTalkActive()) control_new_text(utf8); - if (dropGoldFlag) + if (IsDropGoldOpen) GoldDropNewText(utf8); } } @@ -606,7 +606,7 @@ bool FetchMessage_Real(tagMSG *lpMsg) control_new_text(e.text.text); break; } - if (gbRunGame && dropGoldFlag) { + if (gbRunGame && IsDropGoldOpen) { GoldDropNewText(e.text.text); break; } diff --git a/Source/objects.cpp b/Source/objects.cpp index b52dc19d0..32d458755 100644 --- a/Source/objects.cpp +++ b/Source/objects.cpp @@ -3523,9 +3523,9 @@ bool OperateShrineMurphys(int pnum) void OperateShrine(int pnum, int i, _sfx_id sType) { - if (dropGoldFlag) { + if (IsDropGoldOpen) { CloseGoldDrop(); - dropGoldValue = 0; + DropGoldValue = 0; } assert(i >= 0 && i < MAXOBJECTS); diff --git a/Source/panels/spell_list.cpp b/Source/panels/spell_list.cpp index 4480510a6..bc8cffb67 100644 --- a/Source/panels/spell_list.cpp +++ b/Source/panels/spell_list.cpp @@ -124,6 +124,10 @@ void DrawSpell(const Surface &out) void DrawSpellList(const Surface &out) { + if (!spselflag) { + return; + } + InfoString.clear(); ClearPanel(); diff --git a/Source/qol/chatlog.cpp b/Source/qol/chatlog.cpp index 589f1a3d9..c6a23b870 100644 --- a/Source/qol/chatlog.cpp +++ b/Source/qol/chatlog.cpp @@ -140,6 +140,10 @@ void AddMessageToChatLog(const std::string &message, Player *player, UiFlags fla void DrawChatLog(const Surface &out) { + if (!ChatLogFlag) { + return; + } + DrawSTextHelp(); DrawQTextBack(out); diff --git a/Source/scrollrt.cpp b/Source/scrollrt.cpp index 38b3fb306..8cf4fba19 100644 --- a/Source/scrollrt.cpp +++ b/Source/scrollrt.cpp @@ -1278,29 +1278,15 @@ void DrawView(const Surface &out, Point startPosition) } else if (IsStashOpen) { DrawStash(out); } - DrawLevelUpIcon(out); - if (ShowUniqueItemInfoBox) { - DrawUniqueInfo(out); - } - if (qtextflag) { - DrawQText(out); - } - if (spselflag) { - DrawSpellList(out); - } - if (dropGoldFlag) { - DrawGoldSplit(out, dropGoldValue); - } + DrawLevelUpButton(out); + DrawUniqueInfo(out); + DrawQText(out); + DrawSpellList(out); + DrawGoldSplit(out, DropGoldValue); DrawGoldWithdraw(out, WithdrawGoldValue); - if (HelpFlag) { - DrawHelp(out); - } - if (ChatLogFlag) { - DrawChatLog(out); - } - if (IsDiabloMsgAvailable()) { - DrawDiabloMsg(out); - } + DrawHelp(out); + DrawChatLog(out); + DrawDiabloMsg(out); if (MyPlayerIsDead) { RedBack(out); } else if (PauseMode != 0) {