From 6a6fd404dc822916dc7ce5a1bca91cdc1c33a298 Mon Sep 17 00:00:00 2001 From: Felipe Wannmacher Date: Tue, 25 Jan 2022 21:08:24 +0000 Subject: [PATCH] improved hints and added icons --- CMake/Assets.cmake | 3 + Packaging/resources/assets/data/hintbox.pcx | Bin 0 -> 1464 bytes .../assets/data/hintboxbackground.pcx | Bin 0 -> 2794 bytes Packaging/resources/assets/data/hinticons.pcx | Bin 0 -> 4947 bytes Source/control.cpp | 4 + Source/controls/modifier_hints.cpp | 189 ++++++++---------- Source/controls/modifier_hints.h | 2 + 7 files changed, 94 insertions(+), 104 deletions(-) create mode 100644 Packaging/resources/assets/data/hintbox.pcx create mode 100644 Packaging/resources/assets/data/hintboxbackground.pcx create mode 100644 Packaging/resources/assets/data/hinticons.pcx diff --git a/CMake/Assets.cmake b/CMake/Assets.cmake index ac2e1ebb6..bbe466a17 100644 --- a/CMake/Assets.cmake +++ b/CMake/Assets.cmake @@ -49,6 +49,9 @@ set(devilutionx_assets data/dirtybucp.pcx data/healthbox.pcx data/health.pcx + data/hintbox.pcx + data/hintboxbackground.pcx + data/hinticons.pcx data/panel8buc.pcx data/panel8bucp.pcx data/monstertags.pcx diff --git a/Packaging/resources/assets/data/hintbox.pcx b/Packaging/resources/assets/data/hintbox.pcx new file mode 100644 index 0000000000000000000000000000000000000000..0d0e869d22b1a530634803eff27dcf6f801dec88 GIT binary patch literal 1464 zcmd;LW#nK00yQA?078-hqXq*b$(j%v4xT=A{OHlc#}6Gn2&4}lKMceNPaHXZ=*Yoi zV0`@Gv4h7M4xR>5r;nXEc=|XHAA;h8XAS|`$4(zQ1(XLWI(6{aW5$DL4ju)mKZ0Pw zMUfOBF@bu)YT+h;4TG5gwj6HQDNJ*L3V>E3Y=bkAM9+Y&I1O>x37Fb52O&(b2_Pm^ z0mL~#U%(WAJp>X3y9{RT37ExD_kt{jDu8tHGcfFBVCZ6C2xnlB z{12A+r=s!!EIN^aA&P-P85mc8=l}l`{_nTShc^s|4>Pp2F@%RQNJ=vN+qd9^XBdC@88_eu%fVVX;jo4PtR^g$4X1f3`4^( zO-&a?MPo@xX+Az4cJ>ozUv1iceg4v8lV|R1?_E<_zaXt(W<+wYUqr35PrjvNyuMk0 zs zYp5Y6CBh-X&G7%x<}W9wJ>Oh+XMVwjo}}Z|L1z+;k9*5+be5iNEzxQuoUbVmrNm<| z&Y{Z3%+Jd3fA8Ke)26+st$mP_b0a$Xyr<`J3yb~g>MNC$Cd7?;CnqQ< I`2YWZ0I$g(w*UYD literal 0 HcmV?d00001 diff --git a/Packaging/resources/assets/data/hintboxbackground.pcx b/Packaging/resources/assets/data/hintboxbackground.pcx new file mode 100644 index 0000000000000000000000000000000000000000..e6e327222037f89a732656c63825da7ca1c49565 GIT binary patch literal 2794 zcmeHIO=w(I6uv=1Qca?RtvU^kG@TfO7>N~WkWfQiG#LCtohCv2DFh3Fv;@JTiQS|H zn-ZiUwJJ>^7Am?iSu_Qs-ur%M=DmroDx#_A!Xl!9bf?Ml`_6rnth;e#Lh{}{_nh;c z^L^*ucWZ4;y~0mkwW3dn>=bpVeeLN$hw_f6F6xpl`XOzm{`L<+3g zRtz`C;-;Y$FxY1`PXQEK}0MxQLZnX~B-CjrOD~OAQivNN8(8 z!(JdocyJYRY$`PBAq{%6m97iEFRng>LtquvIMOnmfrxjq47srObu8S5Vik&PTv`{n z1pgL<^?UFGAo2*WG0LXeXc0}Z83zT}Mkzyi^PRMD&&p-#p-i$ib`)e~sy;qS6w;iO za(Ig(wlAT`ux>a3n(3{mDXcJRcWoG5;pQ1T0bFt0)88Nz0w`a)E6} zljXv0Cyoh=Qb&arq`~L_zldngDB-9z@~|qQljB8CIa8L_qAU@L7VN0-v>;SkVX$au zv<^^jDb<2aP((WM^h$nCjD%ryc{bP$v4w>S0-%BecLZ+DI&~*i;w&_J2)D!`*6L06 zslN-YnUO)rZCOwIW<{HW;`tm7dxC%l)~z(v%m8GK)wV_5O>XRpr&VSSY0A7!;xtJ5 zkODxjj0NeWFlm5bSv*=rU7S<7qu7rtiKtTGqBuE|az&9IB$Oa~K7~o9f;9L~R;~W5 z-$DQy60%vGeG68>CA(=hoHbrv5Z>_s#^GkAn`DJ<5!>L@MQbug$Xz7&aHN~PWN_2~ zBEUQz+Ldt?BDuyGY!L;CsTF}lsr3FvjmS@Mh%7VBK`6_o0nTUw*CeL{%mRyp1!pwI zn}Rpv*4)@i{` z+QBgu7au-W=ah{+aoA$17T-)fW!FToa>Y-isrbwKnyz@uPQ@&nYav#Ap2bKt@SB@# zeR%(W`;QrzolOdbB%j}?srgH(C8gd|s-RRhk&TUfepRgRD>b0hZfLbWoBUJQ_&dM) zhjJWs;)E)^sIpnL@zsT7vaoSDzuKpQ9yQgW3OiMy6INm)hH(+_h^@Hrw3P)KFI!#=p;BzB+r+KXdNN$8{19$D*Ucdb|mHe`Bqd4>1!uXG~N4}kWJ$U>1 z=(Rn;Q}=zbzxkub@0oby&XM*z23i{S-Cf_>bj$6vDp^{(F*9?0Z0zUZ;qM0rmwS7I zy?eiIYx}gNc+lq9|HiT%4Pmo1UJYn3xzH d9UU4P>hJIG>+9?8?(XR5$mMdGOeRT^e*tCgGlT#D literal 0 HcmV?d00001 diff --git a/Packaging/resources/assets/data/hinticons.pcx b/Packaging/resources/assets/data/hinticons.pcx new file mode 100644 index 0000000000000000000000000000000000000000..c284f720046bfffb8b02d982d46f455ebcad3fc7 GIT binary patch literal 4947 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 literal 0 HcmV?d00001 diff --git a/Source/control.cpp b/Source/control.cpp index f3a6d392b..6a104ac49 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -14,6 +14,7 @@ #include "DiabloUI/art.h" #include "DiabloUI/art_draw.h" #include "automap.h" +#include "controls/modifier_hints.h" #include "controls/plrctrls.h" #include "cursor.h" #include "engine/cel_sprite.hpp" @@ -565,6 +566,8 @@ void InitControlPan() initialDropGoldIndex = 0; CalculatePanelAreas(); + + InitModifierHints(); } void DrawCtrlPan(const Surface &out) @@ -830,6 +833,7 @@ void FreeControlPan() pGBoxBuff = std::nullopt; FreeMainPanel(); FreeCharPanel(); + FreeModifierHints(); } void DrawInfoBox(const Surface &out) diff --git a/Source/controls/modifier_hints.cpp b/Source/controls/modifier_hints.cpp index 12d0e6ba6..8b11210e4 100644 --- a/Source/controls/modifier_hints.cpp +++ b/Source/controls/modifier_hints.cpp @@ -2,6 +2,7 @@ #include +#include "DiabloUI/art_draw.h" #include "DiabloUI/ui_flags.hpp" #include "control.h" #include "controls/controller.h" @@ -18,15 +19,6 @@ extern std::optional pSBkIconCels; namespace { -int SpaceWidth() -{ - static const int Result = GetLineWidth(" "); - return Result; -} - -/** The number of spaces between left and right hints. */ -constexpr int MidSpaces = 5; - /** Vertical distance between text lines. */ constexpr int LineHeight = 25; @@ -45,121 +37,95 @@ constexpr int IconSizeTextMarginRight = 3; /** Spell icon text top margin. */ constexpr int IconSizeTextMarginTop = 2; +constexpr int HintBoxSize = 39; +constexpr int HintBoxMargin = 5; + +Art hintBox; +Art hintBoxBackground; +Art hintIcons; + +enum HintIcon : uint8_t { + IconChar, + IconInv, + IconQuests, + IconSpells, + IconMap, + IconMenu, + IconNull +}; + struct CircleMenuHint { - CircleMenuHint(bool isDpad, const char *top, const char *right, const char *bottom, const char *left) - : isDpad(isDpad) - , top(top) - , topW(GetLineWidth(top)) + CircleMenuHint(HintIcon top, HintIcon right, HintIcon bottom, HintIcon left) + : top(top) , right(right) - , rightW(GetLineWidth(right)) , bottom(bottom) - , bottomW(GetLineWidth(bottom)) , left(left) - , leftW(GetLineWidth(left)) - , xMid(leftW + SpaceWidth() * MidSpaces / 2) { } - [[nodiscard]] int Width() const - { - return 2 * xMid; - } - - bool isDpad; - - const char *top; - int topW; - const char *right; - int rightW; - const char *bottom; - int bottomW; - const char *left; - int leftW; - - int xMid; + HintIcon top; + HintIcon right; + HintIcon bottom; + HintIcon left; }; -bool IsTopActive(const CircleMenuHint &hint) -{ - if (hint.isDpad) - return IsControllerButtonPressed(ControllerButton_BUTTON_DPAD_UP); - return IsControllerButtonPressed(ControllerButton_BUTTON_Y); -} - -bool IsRightActive(const CircleMenuHint &hint) -{ - if (hint.isDpad) - return IsControllerButtonPressed(ControllerButton_BUTTON_DPAD_RIGHT); - return IsControllerButtonPressed(ControllerButton_BUTTON_B); -} - -bool IsBottomActive(const CircleMenuHint &hint) -{ - if (hint.isDpad) - return IsControllerButtonPressed(ControllerButton_BUTTON_DPAD_DOWN); - return IsControllerButtonPressed(ControllerButton_BUTTON_A); -} - -bool IsLeftActive(const CircleMenuHint &hint) -{ - if (hint.isDpad) - return IsControllerButtonPressed(ControllerButton_BUTTON_DPAD_LEFT); - return IsControllerButtonPressed(ControllerButton_BUTTON_X); -} - -UiFlags CircleMenuHintTextColor(bool active) -{ - return active ? UiFlags::ColorBlue : UiFlags::ColorWhitegold; -} - -UiFlags CircleSpellMenuHintTextColor(bool active) -{ - return active ? UiFlags::ColorBlue : UiFlags::ColorWhite; -} - /** * @brief Draws hint text for a four button layout with the top/left edge of the bounding box at the position given by origin. * @param out The output buffer to draw on. - * @param hint Struct describing the text to draw and the dimensions of the layout. + * @param hint Struct describing the icon to draw. * @param origin Top left corner of the layout (relative to the output buffer). */ void DrawCircleMenuHint(const Surface &out, const CircleMenuHint &hint, const Point &origin) { - DrawString(out, hint.top, origin + Displacement { hint.xMid - hint.topW / 2, 0 }, CircleMenuHintTextColor(IsTopActive(hint))); + const Displacement backgroundDisplacement = { (HintBoxSize - IconSize) / 2 + 1, (HintBoxSize - IconSize) / 2 - 1 }; + Point hintBoxPositions[4] = { + origin + Displacement { 0, LineHeight - HintBoxSize }, + origin + Displacement { HintBoxSize + HintBoxMargin, LineHeight - HintBoxSize * 2 - HintBoxMargin }, + origin + Displacement { HintBoxSize + HintBoxMargin, LineHeight + HintBoxMargin }, + origin + Displacement { HintBoxSize * 2 + HintBoxMargin * 2, LineHeight - HintBoxSize } + }; + Point iconPositions[4] = { + hintBoxPositions[0] + backgroundDisplacement, + hintBoxPositions[1] + backgroundDisplacement, + hintBoxPositions[2] + backgroundDisplacement, + hintBoxPositions[3] + backgroundDisplacement, + }; + uint8_t iconIndices[4] { hint.left, hint.top, hint.bottom, hint.right }; - DrawString(out, hint.left, origin + Displacement { 0, LineHeight }, CircleMenuHintTextColor(IsLeftActive(hint))); - DrawString(out, hint.right, origin + Displacement { hint.leftW + MidSpaces * SpaceWidth(), LineHeight }, CircleMenuHintTextColor(IsRightActive(hint))); + for (int slot = 0; slot < 4; ++slot) { + if (iconIndices[slot] == HintIcon::IconNull) + continue; - DrawString(out, hint.bottom, origin + Displacement { hint.xMid - hint.bottomW / 2, LineHeight * 2 }, CircleMenuHintTextColor(IsBottomActive(hint))); + DrawArt(out, iconPositions[slot], &hintBoxBackground); + DrawArt(out, iconPositions[slot], &hintIcons, iconIndices[slot], 37, 38); + DrawArt(out, hintBoxPositions[slot], &hintBox); + } } /** * @brief Draws hint text for a four button layout with the top/left edge of the bounding box at the position given by origin plus the icon for the spell mapped to that entry. * @param out The output buffer to draw on. - * @param hint Struct describing the text to draw and the dimensions of the layout. * @param origin Top left corner of the layout (relative to the output buffer). */ -void DrawSpellsCircleMenuHint(const Surface &out, const CircleMenuHint &hint, const Point &origin) +void DrawSpellsCircleMenuHint(const Surface &out, const Point &origin) { const auto &myPlayer = Players[MyPlayerId]; - Point positions[4] = { - origin + Displacement { 0, LineHeight }, - origin + Displacement { IconSize, LineHeight - IconSize }, - origin + Displacement { IconSize, LineHeight + IconSize }, - origin + Displacement { IconSize * 2, LineHeight } + const Displacement spellIconDisplacement = { (HintBoxSize - IconSize) / 2 + 1, HintBoxSize - (HintBoxSize - IconSize) / 2 - 1 }; + Point hintBoxPositions[4] = { + origin + Displacement { 0, LineHeight - HintBoxSize }, + origin + Displacement { HintBoxSize + HintBoxMargin, LineHeight - HintBoxSize * 2 - HintBoxMargin }, + origin + Displacement { HintBoxSize + HintBoxMargin, LineHeight + HintBoxMargin }, + origin + Displacement { HintBoxSize * 2 + HintBoxMargin * 2, LineHeight - HintBoxSize } }; - Point textPositions[4] = { - positions[0] + Displacement { IconSize - hint.leftW - IconSizeTextMarginRight, IconSizeTextMarginTop - IconSize }, - positions[1] + Displacement { IconSize - hint.topW - IconSizeTextMarginRight, IconSizeTextMarginTop - IconSize }, - positions[2] + Displacement { IconSize - hint.bottomW - IconSizeTextMarginRight, IconSizeTextMarginTop - IconSize }, - positions[3] + Displacement { IconSize - hint.rightW - IconSizeTextMarginRight, IconSizeTextMarginTop - IconSize } + Point spellIconPositions[4] = { + hintBoxPositions[0] + spellIconDisplacement, + hintBoxPositions[1] + spellIconDisplacement, + hintBoxPositions[2] + spellIconDisplacement, + hintBoxPositions[3] + spellIconDisplacement, }; - const char *texts[4] = { hint.left, hint.top, hint.bottom, hint.right }; - bool isActive[4] = { IsLeftActive(hint), IsTopActive(hint), IsBottomActive(hint), IsRightActive(hint) }; uint64_t spells = myPlayer._pAblSpells | myPlayer._pMemSpells | myPlayer._pScrlSpells | myPlayer._pISpells; spell_id splId; spell_type splType; - Point textPosition; for (int slot = 0; slot < 4; ++slot) { splId = myPlayer._pSplHotKey[slot]; @@ -172,11 +138,8 @@ void DrawSpellsCircleMenuHint(const Surface &out, const CircleMenuHint &hint, co } SetSpellTrans(splType); - DrawSpellCel(out, positions[slot], *pSBkIconCels, SpellITbl[splId]); - textPosition = textPositions[slot]; - // Drop shadow - DrawString(out, texts[slot], textPosition + Displacement { -1, 1 }, UiFlags::ColorBlack); - DrawString(out, texts[slot], textPosition, CircleSpellMenuHintTextColor(isActive[slot])); + DrawSpellCel(out, spellIconPositions[slot], *pSBkIconCels, SpellITbl[splId]); + DrawArt(out, hintBoxPositions[slot], &hintBox); } } @@ -184,10 +147,10 @@ void DrawStartModifierMenu(const Surface &out) { if (!start_modifier_active) return; - static const CircleMenuHint DPad(/*isDpad=*/true, /*top=*/_("Menu"), /*right=*/_("Inv"), /*bottom=*/_("Map"), /*left=*/_("Char")); - static const CircleMenuHint Buttons(/*isDpad=*/false, /*top=*/"", /*right=*/"", /*bottom=*/_("Spells"), /*left=*/_("Quests")); + static const CircleMenuHint DPad(/*top=*/HintIcon::IconMenu, /*right=*/HintIcon::IconInv, /*bottom=*/HintIcon::IconMap, /*left=*/HintIcon::IconChar); + static const CircleMenuHint Buttons(/*top=*/HintIcon::IconNull, /*right=*/HintIcon::IconNull, /*bottom=*/HintIcon::IconSpells, /*left=*/HintIcon::IconQuests); DrawCircleMenuHint(out, DPad, { PANEL_LEFT + CircleMarginX, PANEL_TOP - CircleTop }); - DrawCircleMenuHint(out, Buttons, { PANEL_LEFT + PANEL_WIDTH - Buttons.Width() - CircleMarginX, PANEL_TOP - CircleTop }); + DrawCircleMenuHint(out, Buttons, { PANEL_LEFT + PANEL_WIDTH - HintBoxSize * 3 - CircleMarginX - HintBoxMargin * 2, PANEL_TOP - CircleTop }); } void DrawSelectModifierMenu(const Surface &out) @@ -196,15 +159,33 @@ void DrawSelectModifierMenu(const Surface &out) return; if (sgOptions.Controller.bDpadHotkeys) { - static const CircleMenuHint DPad(/*isDpad=*/true, /*top=*/"F6", /*right=*/"F8", /*bottom=*/"F7", /*left=*/"F5"); - DrawSpellsCircleMenuHint(out, DPad, { PANEL_LEFT + CircleMarginX, PANEL_TOP - CircleTop }); + DrawSpellsCircleMenuHint(out, { PANEL_LEFT + CircleMarginX, PANEL_TOP - CircleTop }); } - static const CircleMenuHint Spells(/*isDpad=*/false, "F6", "F8", "F7", "F5"); - DrawSpellsCircleMenuHint(out, Spells, { PANEL_LEFT + PANEL_WIDTH - IconSize * 3 - CircleMarginX, PANEL_TOP - CircleTop }); + DrawSpellsCircleMenuHint(out, { PANEL_LEFT + PANEL_WIDTH - HintBoxSize * 3 - CircleMarginX - HintBoxMargin * 2, PANEL_TOP - CircleTop }); } } // namespace +void InitModifierHints() +{ + LoadMaskedArt("data\\hintbox.pcx", &hintBox, 1, 1); + LoadMaskedArt("data\\hintboxbackground.pcx", &hintBoxBackground, 1, 1); + LoadMaskedArt("data\\hinticons.pcx", &hintIcons, 6, 1); + + if (hintBox.surface == nullptr || hintBoxBackground.surface == nullptr) { + app_fatal("%s", _("Failed to load UI resources.\n" + "\n" + "Make sure devilutionx.mpq is in the game folder and that it is up to date.")); + } +} + +void FreeModifierHints() +{ + hintBox.Unload(); + hintBoxBackground.Unload(); + hintIcons.Unload(); +} + void DrawControllerModifierHints(const Surface &out) { DrawStartModifierMenu(out); diff --git a/Source/controls/modifier_hints.h b/Source/controls/modifier_hints.h index 87edba29e..817397818 100644 --- a/Source/controls/modifier_hints.h +++ b/Source/controls/modifier_hints.h @@ -5,5 +5,7 @@ namespace devilution { void DrawControllerModifierHints(const Surface &out); +void InitModifierHints(); +void FreeModifierHints(); } // namespace devilution