Browse Source

show item labels toggle in menu

Co-Authored-By: obligaron <25415264+obligaron@users.noreply.github.com>
pull/4932/head
Trihedraf 4 years ago committed by Anders Jenbo
parent
commit
64ea43d538
  1. 2
      Source/options.cpp
  2. 2
      Source/options.h
  3. 6
      Source/qol/itemlabels.cpp

2
Source/options.cpp

@ -833,6 +833,7 @@ GameplayOptions::GameplayOptions()
, autoEquipJewelry("Auto Equip Jewelry", OptionEntryFlags::None, N_("Auto Equip Jewelry"), N_("Jewelry will be automatically equipped on pickup or purchase if enabled."), false)
, randomizeQuests("Randomize Quests", OptionEntryFlags::CantChangeInGame, N_("Randomize Quests"), N_("Randomly selecting available quests for new games."), true)
, showMonsterType("Show Monster Type", OptionEntryFlags::None, N_("Show Monster Type"), N_("Hovering over a monster will display the type of monster in the description box in the UI."), false)
, showItemLabels("Show Item Labels", OptionEntryFlags::None, N_("Show Item Labels"), N_("Show labels for items on the ground when enabled."), false)
, autoRefillBelt("Auto Refill Belt", OptionEntryFlags::None, N_("Auto Refill Belt"), N_("Refill belt from inventory when belt item is consumed."), false)
, disableCripplingShrines("Disable Crippling Shrines", OptionEntryFlags::None, N_("Disable Crippling Shrines"), N_("When enabled Cauldrons, Fascinating Shrines, Goat Shrines, Ornate Shrines and Sacred Shrines are not able to be clicked on and labeled as disabled."), false)
, quickCast("Quick Cast", OptionEntryFlags::None, N_("Quick Cast"), N_("Spell hotkeys instantly cast the spell, rather than switching the readied spell."), false)
@ -863,6 +864,7 @@ std::vector<OptionEntryBase *> GameplayOptions::GetEntries()
&experienceBar,
&enemyHealthBar,
&showMonsterType,
&showItemLabels,
&disableCripplingShrines,
&quickCast,
&autoRefillBelt,

2
Source/options.h

@ -466,6 +466,8 @@ struct GameplayOptions : OptionCategoryBase {
OptionEntryBoolean randomizeQuests;
/** @brief Indicates whether or not monster type (Animal, Demon, Undead) is shown along with other monster information. */
OptionEntryBoolean showMonsterType;
/** @brief Displays item labels for items on the ground. */
OptionEntryBoolean showItemLabels;
/** @brief Refill belt from inventory, or rather, use potions/scrolls from inventory first when belt item is consumed. */
OptionEntryBoolean autoRefillBelt;
/** @brief Locally disable clicking on shrines which permanently cripple character. */

6
Source/qol/itemlabels.cpp

@ -13,6 +13,7 @@
#include "gmenu.h"
#include "inv.h"
#include "itemlabels.h"
#include "options.h"
#include "qol/stash.h"
#include "utils/language.h"
#include "utils/stdcompat/string_view.hpp"
@ -32,7 +33,6 @@ std::vector<ItemLabel> labelQueue;
bool altPressed = false;
bool isLabelHighlighted = false;
std::array<std::optional<int>, ITEMTYPES> labelCenterOffsets;
bool invertHighlightToggle = false;
const int BorderX = 4; // minimal horizontal space between labels
const int BorderY = 2; // minimal vertical space between labels
@ -44,7 +44,7 @@ const int Height = 11 + MarginY * 2; // going above 13 scatters labels of items
void ToggleItemLabelHighlight()
{
invertHighlightToggle = !invertHighlightToggle;
sgOptions.Gameplay.showItemLabels.SetValue(!*sgOptions.Gameplay.showItemLabels);
}
void AltPressed(bool pressed)
@ -59,7 +59,7 @@ bool IsItemLabelHighlighted()
bool IsHighlightingLabelsEnabled()
{
return altPressed != invertHighlightToggle;
return altPressed != *sgOptions.Gameplay.showItemLabels;
}
void AddItemToLabelQueue(int id, int x, int y)

Loading…
Cancel
Save