Revamp talent and spellbook UIs with proper visuals and functionality

Talent screen:
- Remove all debug text and per-frame LOG_INFO spam
- Show class name in window title (e.g. "Warrior Talents")
- Display point distribution in header (0/31/20) and per-tab counts
- Highlighted active spec button with styled spec switcher
- Load and render tree background textures from TalentTab.dbc
- Draw prerequisite arrows with arrowheads (green=met, gray=unmet)
- Fix rank display (was showing rank+1, now correct 1-indexed values)
- Rank counter with dark background pill for readability
- Hover glow effect, rounded corners, centered grid layout
- Wider window (680x600) for 4-column WoW talent grid

Spellbook:
- Add search/filter bar for finding spells by name
- Add spell descriptions from Spell.dbc tooltip field
- Rich tooltips with name, rank, passive indicator, cooldown, description
- Visual icon borders: yellow=passive, red=cooldown, default=active
- Cooldown overlay on icon with countdown number
- Hover highlight on spell rows
- Tab counts update to reflect search filter results
- Rounded corners on icons and hover states
- Extracted renderSpellTooltip helper for consistent tooltip rendering
This commit is contained in:
Kelsi 2026-02-25 14:55:40 -08:00
parent 889cd86fb0
commit da959cfb8f
4 changed files with 530 additions and 297 deletions

View file

@ -18,8 +18,13 @@ struct SpellInfo {
uint32_t spellId = 0;
std::string name;
std::string rank;
uint32_t iconId = 0; // SpellIconID
uint32_t attributes = 0; // Spell attributes (field 75)
std::string description; // Tooltip/description text from Spell.dbc
uint32_t iconId = 0; // SpellIconID
uint32_t attributes = 0; // Spell attributes (field 4)
uint32_t castTimeMs = 0; // Cast time in ms (0 = instant)
uint32_t manaCost = 0; // Mana cost
uint32_t powerType = 0; // 0=mana, 1=rage, 2=focus, 3=energy
uint32_t rangeIndex = 0; // Range index from SpellRange.dbc
bool isPassive() const { return (attributes & 0x40) != 0; }
};
@ -55,19 +60,21 @@ private:
// Icon data (loaded from SpellIcon.dbc)
bool iconDbLoaded = false;
std::unordered_map<uint32_t, std::string> spellIconPaths; // SpellIconID -> path
std::unordered_map<uint32_t, VkDescriptorSet> spellIconCache; // SpellIconID -> GL texture
std::unordered_map<uint32_t, VkDescriptorSet> spellIconCache; // SpellIconID -> texture
// Skill line data (loaded from SkillLine.dbc + SkillLineAbility.dbc)
bool skillLineDbLoaded = false;
std::unordered_map<uint32_t, std::string> skillLineNames; // skillLineID -> name
std::unordered_map<uint32_t, uint32_t> skillLineCategories; // skillLineID -> categoryID
std::unordered_map<uint32_t, uint32_t> spellToSkillLine; // spellID -> skillLineID
std::unordered_map<uint32_t, std::string> skillLineNames;
std::unordered_map<uint32_t, uint32_t> skillLineCategories;
std::unordered_map<uint32_t, uint32_t> spellToSkillLine;
// Categorized spell tabs (rebuilt when spell list changes)
// ordered map so tabs appear in consistent order
// Categorized spell tabs
std::vector<SpellTabInfo> spellTabs;
size_t lastKnownSpellCount = 0;
// Search filter
char searchFilter_[128] = "";
// Drag-and-drop from spellbook to action bar
bool draggingSpell_ = false;
uint32_t dragSpellId_ = 0;
@ -79,6 +86,9 @@ private:
void categorizeSpells(const std::unordered_set<uint32_t>& knownSpells);
VkDescriptorSet getSpellIcon(uint32_t iconId, pipeline::AssetManager* assetManager);
const SpellInfo* getSpellInfo(uint32_t spellId) const;
// Tooltip rendering helper
void renderSpellTooltip(const SpellInfo* info, game::GameHandler& gameHandler);
};
} // namespace ui

View file

@ -20,8 +20,11 @@ public:
private:
void renderTalentTrees(game::GameHandler& gameHandler);
void renderTalentTree(game::GameHandler& gameHandler, uint32_t tabId);
void renderTalent(game::GameHandler& gameHandler, const game::GameHandler::TalentEntry& talent);
void renderTalentTree(game::GameHandler& gameHandler, uint32_t tabId,
const std::string& bgFile);
void renderTalent(game::GameHandler& gameHandler,
const game::GameHandler::TalentEntry& talent,
uint32_t pointsInTree);
void loadSpellDBC(pipeline::AssetManager* assetManager);
void loadSpellIconDBC(pipeline::AssetManager* assetManager);
@ -33,10 +36,11 @@ private:
// DBC caches
bool spellDbcLoaded = false;
bool iconDbcLoaded = false;
std::unordered_map<uint32_t, uint32_t> spellIconIds; // spellId -> iconId
std::unordered_map<uint32_t, uint32_t> spellIconIds; // spellId -> iconId
std::unordered_map<uint32_t, std::string> spellIconPaths; // iconId -> path
std::unordered_map<uint32_t, VkDescriptorSet> spellIconCache; // iconId -> texture
std::unordered_map<uint32_t, std::string> spellTooltips; // spellId -> description
std::unordered_map<uint32_t, std::string> spellTooltips; // spellId -> description
std::unordered_map<uint32_t, VkDescriptorSet> bgTextureCache_; // tabId -> bg texture
};
} // namespace ui