Skip to content

Commit d40c1c7

Browse files
committed
MenuPowers: Add upgrade_button_offset property
This setting allows overriding where the upgrade buttons get placed. If not set, the old behavior of placing them to the right of the icons is used.
1 parent 4d10063 commit d40c1c7

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

RELEASE_NOTES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Engine features:
2626
* Power 'trait_elemental' now works with all damage types (despite the name). Any additional damage bonuses for the specified damage type will apply on top of the converted damage.
2727
* Added 'tab.text_padding' to engine/widget_settings.txt config.
2828
* Added 'enabled' property to Char/Inv/Pow/Log menus for modders that wish to prevent the player from opening those menus.
29+
* Added 'upgrade_button_offset' property to menu/powers.txt config.
2930
* Android: Enabled use of external input devices (gamepads, keyboards, mice)
3031

3132
Engine fixes:

docs/attribute-reference.html

+4
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,8 @@ <h4>Menu</h4>
14861486

14871487
<p><strong>background</strong> | <code>filename</code> | Filename of the background image for this menu.</p>
14881488

1489+
<p><strong>enabled</strong> | <code>bool</code> | Used to toggle the ability to open this menu. Only used for Character, Inventory, Powers, and Log menus.</p>
1490+
14891491
<hr />
14901492

14911493
<h4>MenuDevConsole</h4>
@@ -1670,6 +1672,8 @@ <h4>MenuPowers: Menu layout</h4>
16701672

16711673
<p><strong>tab_area</strong> | <code>rectangle</code> | Position and dimensions of the tree pages.</p>
16721674

1675+
<p><strong>upgrade_button_offset</strong> | <code>point</code> | X/Y offset of the upgrade button relative to each power icon. Defaults to (ICON_SIZE, 0)</p>
1676+
16731677
<hr />
16741678

16751679
<h4>MenuPowers: Power tree layout</h4>

src/MenuPowers.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ MenuPowers::MenuPowers()
123123
, tab_control(NULL)
124124
, tree_loaded(false)
125125
, default_power_tab(-1)
126+
, upgrade_button_offset(eset->resolutions.icon_size, 0)
126127
, newPowerNotification(false)
127128
{
128129

@@ -148,6 +149,8 @@ MenuPowers::MenuPowers()
148149
else if (infile.key == "close") close_pos = Parse::toPoint(infile.val);
149150
// @ATTR tab_area|rectangle|Position and dimensions of the tree pages.
150151
else if (infile.key == "tab_area") tab_area = Parse::toRect(infile.val);
152+
// @ATTR upgrade_button_offset|point|X/Y offset of the upgrade button relative to each power icon. Defaults to (ICON_SIZE, 0)
153+
else if (infile.key == "upgrade_button_offset") upgrade_button_offset = Parse::toPoint(infile.val);
151154

152155
else infile.error("MenuPowers: '%s' is not a valid key.", infile.key.c_str());
153156
}
@@ -349,7 +352,7 @@ void MenuPowers::loadPowerTree(const std::string &filename) {
349352
}
350353

351354
if (power_cell[i].upgrade_button != NULL) {
352-
power_cell[i].upgrade_button->setBasePos(power_cell[i].pos.x + eset->resolutions.icon_size, power_cell[i].pos.y, Utils::ALIGN_TOPLEFT);
355+
power_cell[i].upgrade_button->setBasePos(power_cell[i].pos.x + upgrade_button_offset.x, power_cell[i].pos.y + upgrade_button_offset.y, Utils::ALIGN_TOPLEFT);
353356
}
354357
}
355358
}

src/MenuPowers.h

+2
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,8 @@ class MenuPowers : public Menu {
155155

156156
int default_power_tab;
157157

158+
Point upgrade_button_offset;
159+
158160
std::vector<MenuPowersCell*> recently_locked_cells;
159161

160162
public:

src/Version.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ FLARE. If not, see http://www.gnu.org/licenses/
3030

3131
#include <SDL.h>
3232

33-
Version VersionInfo::ENGINE(1, 14, 110);
33+
Version VersionInfo::ENGINE(1, 14, 111);
3434
Version VersionInfo::MIN(0, 0, 0);
3535
Version VersionInfo::MAX(USHRT_MAX, USHRT_MAX, USHRT_MAX);
3636

0 commit comments

Comments
 (0)