Commit graph

21 commits

Author SHA1 Message Date
Kelsi
fcb133dbbe fix: guard optional DBC field reads against out-of-bounds indices for Classic/TBC
When expansion DBC layouts lack PowerType/ManaCost/CastingTimeIndex/RangeIndex,
default to UINT32_MAX instead of WotLK hardcoded indices to prevent reading wrong
data from Classic/TBC Spell.dbc files. tryLoad now skips any field index >= fieldCount.
2026-03-10 17:41:05 -07:00
Kelsi
59597ff39e feat: display mana cost, cast time, and range in spellbook tooltip
Load SpellCastTimes.dbc and SpellRange.dbc during DBC init and
populate SpellInfo.castTimeMs, manaCost, powerType, rangeIndex.
renderSpellTooltip now shows resource cost (Mana/Rage/Energy/Focus),
cast time ("Instant cast" or "X.X sec cast"), and range ("X yd range"
or "Melee range") for active spells, matching WoW's native tooltip
layout with cost on left and cast time aligned to the right.
2026-03-10 17:14:46 -07:00
Kelsi
c2b271df6f Fix spellbook tabs race condition with DBC lazy loading
lookupSpellName() (called by action bar tooltips) was triggering
loadSpellDBC() early, setting dbcLoadAttempted=true before the
spellbook opened. This caused loadSkillLineDBCs() to be skipped,
so all spells were categorized into "General". Fixed by checking
each DBC's own loaded flag independently and re-categorizing when
skill line data becomes available.
2026-02-26 01:21:51 -08:00
Kelsi
c919477e74 Fix item use (CMSG_USE_ITEM), mount tab, and inventory right-click
- Fix SMSG_ITEM_QUERY_SINGLE_RESPONSE parsing: read statsCount stat
  pairs instead of always 10, use 2 damage entries (MAX_ITEM_PROTO_DAMAGES),
  and parse item spell data (spellId + spellTrigger per slot)
- Pass item spell ID in CMSG_USE_ITEM packet so server processes item
  use requests (spellId=0 caused silent server rejection)
- Add spellId parameter to buildUseItem interface across all expansions
- Fix spellbook mount tab to use SkillLine 777 (Mounts) instead of 762
  (Riding), so known mount summon spells appear correctly
- Fix inventory right-click: use IsItemHovered+IsMouseClicked instead
  of IsItemClicked for InvisibleButton (which only tracks left-clicks)
- Fix SlotKind enum declaration order in inventory_screen.hpp
2026-02-26 00:59:07 -08:00
Kelsi
7982815a67 Add Companions tab to spellbook for vanity pets (SkillLine 778)
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
- Companion pet spells (SkillLine 778) get their own "Companions" tab
- Mounts (SkillLine 762) and Companions are now split out from secondary
  skills instead of being lumped into profession tabs
- Refactored tab grouping into addGroupedTabs helper to reduce duplication
- Tab order: Specs > General > Professions > Mounts > Companions
- Double-click to summon companions/mounts works via existing castSpell
2026-02-25 15:04:17 -08:00
Kelsi
0d87a86516 Separate spellbook into spec, general, profession, and mount tabs
- Class spec abilities now get individual tabs (e.g. Fire, Frost, Arcane)
- Primary professions each get their own tab (Alchemy, Blacksmithing, etc.)
- Secondary professions get tabs (Cooking, First Aid, Fishing)
- Mounts tab for all spells linked to Riding skill line (762)
- General tab for everything else (racials, weapon skills, etc.)
- Tab order: specs first, then General, then professions, then Mounts
2026-02-25 14:59:09 -08:00
Kelsi
da959cfb8f 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
2026-02-25 14:55:40 -08:00
Kelsi
325254dfcb Port UI icon textures from OpenGL to Vulkan, fix loading screen clear values
Replace all glGenTextures/glTexImage2D calls in UI code with Vulkan texture
uploads via new VkContext::uploadImGuiTexture() helper. This fixes segfaults
from calling OpenGL functions without a GL context (null GLEW function pointers).

- Add uploadImGuiTexture() to VkContext with staging buffer upload pattern
- Convert game_screen, inventory_screen, spellbook_screen, talent_screen
  from GLuint/GL calls to VkDescriptorSet/Vulkan uploads
- Fix loading_screen clearValueCount (was 1, needs 2 or 3 for MSAA)
2026-02-22 03:32:08 -08:00
Kelsi
df0bfaea4f Fix action bar and buff bar spell tooltips showing 'Spell #xxx'
The action bar's inline Spell.dbc loader had a broken field index lookup:
operator[] on the layout map would silently insert 0 if 'Name' wasn't a
key, causing all names to be read from field 0 (the spell ID). Also the
once-only 'attempted' flag meant if assetMgr wasn't ready, it never retried.

Replace the duplicated broken DBC loading in the action bar and buff bar
with SpellbookScreen::lookupSpellName(), which reuses the spellbook's
already-correct loading (expansion layout + WotLK fallback). Remove the
now-unused actionSpellNames/actionSpellDbAttempted/actionSpellDbLoaded fields.
2026-02-17 15:41:55 -08:00
Kelsi
827679579f Fix WAV decode cache and spell lookup performance
- audio_engine.cpp: cache key was based on vector pointer address, not
  content — cache never hit since each asset load produces a new
  allocation. Replace with FNV-1a over head+tail bytes + size, giving
  correct content-based identity at O(1) cost. Add 256-entry cap with
  eviction to prevent unbounded growth over long sessions.

- game_handler.hpp/cpp, spellbook_screen, game_screen: knownSpells was
  a std::vector with O(n) std::find lookups scattered across packet
  handlers and UI code. Switch to std::unordered_set for O(1) insert,
  erase, and membership checks. Update all push_back/erase-remove/find
  call sites to use set operations.
2026-02-17 15:13:54 -08:00
Kelsi
36fc1df706 Fix Turtle WoW compatibility: NPC spawning, quests, spells, realm display, and music
- Add TurtlePacketParsers with dedicated movement block parser (Classic format + transport timestamp)
- Fix quest giver status: read uint32 and translate vanilla enum values for Classic/Turtle
- Fix quest accept packet: remove trailing uint32 that vanilla servers reject
- Fix quest details parser: auto-detect vanilla vs WotLK format (informUnit field)
- Fix spellbook and action bar icons: fallback to WotLK DBC field indices when expansion layout fails
- Fix spell cast failure messages: translate vanilla SpellCastResult codes (+1 offset)
- Fix realm list: correct type values (6=RP, 8=RP-PvP) and population thresholds
- Fix music: disable looping for zone music, auto-advance to next random track when finished
- Add music anti-repeat: avoid playing the same track back-to-back
- Make TBC update block parsing resilient (keep parsed blocks on failure instead of aborting)
- Add right-click attack on hostile mobs
- Add name query diagnostic logging
2026-02-17 05:27:03 -08:00
Kelsi
09de52f310 Fix UI window hotkey toggles and silent mount sound fallback 2026-02-14 21:56:38 -08:00
Kelsi
7092844b5e Add multi-expansion support with data-driven protocol layer
Replace hardcoded WotLK protocol constants with a data-driven architecture
supporting Classic 1.12.1, TBC 2.4.3, and WotLK 3.3.5a. Each expansion
has JSON profiles for opcodes, update fields, and DBC layouts, plus C++
polymorphic packet parsers for binary format differences (movement flags,
speed fields, transport data, spline format, char enum layout).

Key components:
- ExpansionRegistry: scans Data/expansions/*/expansion.json at startup
- OpcodeTable: logical enum <-> wire values loaded from JSON
- UpdateFieldTable: field indices loaded from JSON per expansion
- DBCLayout: schema-driven DBC field lookups replacing magic numbers
- PacketParsers: WotLK/TBC/Classic parsers with correct flag positions
- Multi-manifest AssetManager: layered manifests with priority ordering
- HDPackManager: overlay texture packs with expansion compatibility
- Auth screen expansion picker replacing hardcoded version dropdown
2026-02-12 22:56:36 -08:00
Kelsi
6296c32a47 Simplify spellbook tabs to class specialties + General
Only SkillLine category 7 (Class) gets its own tab, giving the 3 spec tabs
(e.g. Discipline/Holy/Shadow for Priest). Weapon skills, racials, professions,
and utility spells all go into the General tab.
2026-02-06 21:27:34 -08:00
Kelsi
836a629513 Organize spellbook tabs by skill line specialty using SkillLine.dbc and SkillLineAbility.dbc 2026-02-06 20:40:17 -08:00
Kelsi
2fae698f48 Use Selectable for spellbook rows to properly consume clicks and prevent window dragging 2026-02-06 20:34:20 -08:00
Kelsi
ec63037543 Prevent spellbook window from moving during spell drag and escaping screen bounds 2026-02-06 20:29:59 -08:00
Kelsi
37d6298b72 Fix action bar click-to-cast and add spellbook drag-and-drop
Left-click on action bar slots now casts spells/uses items instead of starting a drag. Right-click-drag rearranges slots. Spells can be dragged from the spellbook directly onto the action bar, replacing the old "Assign to" button row.
2026-02-06 20:27:01 -08:00
Kelsi
2aa8187562 Fix camera orbit, deselect, chat formatting, loot/vendor bugs, critter hostility, and character screen
Smooth idle camera orbit without jump at loop boundary, click empty space to
deselect target, auto-target when attacked, fix critter hostility so neutral
factions aren't flagged red, add armor/stats to item templates, fix loot
iterator invalidation, show item template names as fallback, position drop
confirmation at cursor, remove [SYSTEM] chat prefix, show NPC names in monster
say/yell, and prevent auto-login on character select screen.
2026-02-06 16:40:44 -08:00
Kelsi
caeb6f56f7 Fix hair/vendor/loot bugs, revamp spellbook with tabs and icons, clean up action bar, add talent placeholder
- Fix white hair: always override M2 type-6 texture with DBC hair texture when available
- Fix vendor sell: add sellPrice to ItemDef/ItemTemplateRow, use directly instead of empty cache
- Fix empty loot: skip loot window when corpse has no items and no gold
- Revamp spellbook (P key): tabbed UI (General/Active/Passive), spell icons from SpellIcon.dbc, rank text
- Clean up action bar: only auto-populate Attack and Hearthstone, rest assigned via spellbook
- Add talent placeholder (N key): 3-tab window with level/talent point display
- Fix ffplay cleanup: non-blocking waitpid with SIGKILL fallback to prevent orphaned audio processes
- Fix pre-existing getQualityColor visibility for loot window rendering
2026-02-06 16:04:25 -08:00
Kelsi
4bc5064515 Add spellbook, fix WMO floor clipping, and polish UI/visuals
- Add spellbook screen (P key) with Spell.dbc name lookup and action bar assignment
- Default Attack and Hearthstone spells available in single player
- Fix WMO floor clipping (gryphon roost) by tightening ceiling rejection threshold
- Darken ocean water, increase wave motion and opacity
- Add M2 model distance fade-in to prevent pop-in
- Reposition chat window, add slash/enter key focus
- Remove debug key commands (keep only F1 perf HUD, N minimap)
- Performance: return chat history by const ref, use deque for O(1) pop_front
2026-02-04 11:31:08 -08:00