From f16d4fbaf2fa31357b5d277428ba5305b8b493d3 Mon Sep 17 00:00:00 2001 From: Justin Jacobs Date: Sat, 4 May 2024 15:33:00 -0400 Subject: [PATCH] MenuActionBar: Add powers_overlap_slots attribute The purpose of this property is to allow composition of the power icon with the slot icon. Previous, only one or the other was drawn. --- RELEASE_NOTES.txt | 1 + docs/attribute-reference.html | 8 ++++++++ src/MenuActionBar.cpp | 13 +++++++++---- src/MenuActionBar.h | 1 + src/Version.cpp | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index 839d11854..33f5a890a 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -10,6 +10,7 @@ Engine features: * Added randomized items. Items can now be spawned with random level, quality, and bonus attributes. * Added 'default_zoom_level' property to menu/minimap.txt config. * Added support for developer mode command shortcuts. +* Added 'powers_overlap_slots' to menu/actionbar.txt config. Engine fixes: diff --git a/docs/attribute-reference.html b/docs/attribute-reference.html index b182b4984..c201aed50 100644 --- a/docs/attribute-reference.html +++ b/docs/attribute-reference.html @@ -1008,6 +1008,12 @@

InputState: Default Keybindings

default.developer_menu | [int, string], int : Bind, Type | Bindings for "Developer Menu".

+

default.developer_cmd_1 | [int, string], int : Bind, Type | Bindings for "Developer Command 1".

+ +

default.developer_cmd_2 | [int, string], int : Bind, Type | Bindings for "Developer Command 2".

+ +

default.developer_cmd_3 | [int, string], int : Bind, Type | Bindings for "Developer Command 3".

+

ItemManager: Items

@@ -1312,6 +1318,8 @@

MenuActionBar

tooltip_length | ["short", "long_menu", "long_all"] | The length of power descriptions in tooltips. 'short' will display only the power name. 'long_menu' (the default setting) will display full tooltips, but only for powers that are in the Powers menu. 'long_all' will display full tooltips for all powers.

+

powers_overlap_slots | bool | When true, the power icon is drawn on top of the empty slot graphic for any given slot. If false, the empty slot graphic will only be drawn if there's not a power in the slot. The default value is false.

+

MenuActiveEffects

diff --git a/src/MenuActionBar.cpp b/src/MenuActionBar.cpp index 19606f8ef..f4e68faa2 100644 --- a/src/MenuActionBar.cpp +++ b/src/MenuActionBar.cpp @@ -58,6 +58,7 @@ MenuActionBar::MenuActionBar() : sprite_emptyslot(NULL) , sfx_unable_to_cast(0) , tooltip_length(MenuPowers::TOOLTIP_LONG_MENU) + , powers_overlap_slots(false) , slots_count(0) , drag_prev_slot(-1) , updated(false) @@ -166,6 +167,10 @@ MenuActionBar::MenuActionBar() else infile.error("MenuActionBar: '%s' is not a valid tooltip_length setting.", infile.val.c_str()); } + // @ATTR powers_overlap_slots|bool|When true, the power icon is drawn on top of the empty slot graphic for any given slot. If false, the empty slot graphic will only be drawn if there's not a power in the slot. The default value is false. + else if (infile.key == "powers_overlap_slots") { + powers_overlap_slots = Parse::toBool(infile.val); + } else infile.error("MenuActionBar: '%s' is not a valid key.", infile.key.c_str()); } @@ -396,16 +401,16 @@ void MenuActionBar::render() { for (unsigned i = 0; i < slots_count; i++) { if (!slots[i]) continue; - if (hotkeys[i] != 0) { - slots[i]->render(); - } - else { + if (hotkeys[i] == 0 || (powers_overlap_slots && slots[i]->enabled)) { // TODO move this to WidgetSlot? if (sprite_emptyslot) { sprite_emptyslot->setDestFromRect(slots[i]->pos); render_device->render(sprite_emptyslot); } } + if (hotkeys[i] != 0) { + slots[i]->render(); + } } // render primary menu buttons diff --git a/src/MenuActionBar.h b/src/MenuActionBar.h index 7a1bd5bdf..02ff318b6 100644 --- a/src/MenuActionBar.h +++ b/src/MenuActionBar.h @@ -59,6 +59,7 @@ class MenuActionBar : public Menu { SoundID sfx_unable_to_cast; int tooltip_length; + bool powers_overlap_slots; public: enum { diff --git a/src/Version.cpp b/src/Version.cpp index 4feaaa47c..af94f876c 100644 --- a/src/Version.cpp +++ b/src/Version.cpp @@ -30,7 +30,7 @@ FLARE. If not, see http://www.gnu.org/licenses/ #include -Version VersionInfo::ENGINE(1, 14, 38); +Version VersionInfo::ENGINE(1, 14, 39); Version VersionInfo::MIN(0, 0, 0); Version VersionInfo::MAX(USHRT_MAX, USHRT_MAX, USHRT_MAX);