Commit graph

178 commits

Author SHA1 Message Date
Kelsi
40c016ccdb Fix online equipment slot mapping, auto-equip packet, and backpack slot offsets
Correct PLAYER_FIELD_INV_SLOT_HEAD default from 322 to 324 (UNIT_END+0xB0)
which was shifting every equipment slot by one position. Fix auto-detection
to validate against known 3.3.5a base. Change CMSG_AUTOEQUIP_ITEM to send
uint8 bag+slot instead of uint64 GUID, and add slot offset 23 for backpack
items in both auto-equip and use-item packets.
2026-02-06 19:13:38 -08:00
Kelsi
e38c0213e4 Fix online item GUID resolution, async terrain loading, and inventory enrichment
Enrich online inventory from local DB when server data is incomplete, add
resolveOnlineItemGuid fallback for sell/equip/use, use async enqueueTile for
initial terrain load, improve walk/run animation fallbacks, clear target on
loot close, and broaden equipability detection to include armor/subclass.
2026-02-06 18:52:28 -08:00
Kelsi
db4a40a4e6 Avoid online loading hang on stalled terrain streaming 2026-02-06 18:40:09 -08:00
Kelsi
fdc614902b Fix online interactions, UI, and inventory sync 2026-02-06 18:34:45 -08:00
Kelsi
7436420cd1 Add player death handling, race-aware faction hostility, and all-race texture support
- Death screen with "Release Spirit" button sends CMSG_REPOP_REQUEST
- Detect player death/resurrection via health updates (VALUES and CREATE)
- Faction hostility map now built per-character race instead of hardcoded Human
- CharSections.dbc texture lookup enabled for all races (was Human-only)
- Fallback texture paths use race folder names instead of hardcoded Human
- Player name in unit frame is clickable for self-targeting
2026-02-06 17:27:20 -08:00
Kelsi
046111d037 Fix faction hostility using Faction.dbc base reputation for neutral-flagged hostile mobs
FactionTemplate entries like FT[7] (Defias) have all-zero group flags but are
hostile via their parent Faction.dbc base reputation. Load Faction.dbc, check
ReputationBase for Human race mask, and mark factions with negative base rep
as hostile. Also add symmetric group check and fix Faction.dbc field offsets
(ReputationRaceMask at fields 2-5, ReputationBase at fields 10-13).
2026-02-06 17:15:46 -08:00
Kelsi
d7a26ed3c5 Fix Monster faction group bit: use 8 (Monster) not 4 (Horde)
FactionGroupMask bits are 1=Player, 2=Alliance, 4=Horde, 8=Monster.
The hostility check was using bit 4 (Horde) to detect monsters, causing
all hostile mobs to appear friendly/green.
2026-02-06 17:01:00 -08:00
Kelsi
2859c95372 Make killXp public for level-based mob coloring in UI 2026-02-06 16:53:09 -08:00
Kelsi
81166346ef Fix respawned corpse movement, faction hostility, and add WoW-canonical mob level colors
Reset NPC animation to idle when health goes from 0 to >0 (respawn), prevent
dead NPCs from being moved by server movement packets. Fix faction hostility
to check factionGroup Monster bit and individual enemy arrays, not just
enemyGroup. Add level-based mob coloring: grey (no XP), green (easy), yellow
(even), orange (hard), red (very hard) for target frame and selection circle.
2026-02-06 16:47:07 -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
2ddef93f52 Fix spell targeting, item query parsing, loot UI, hair/skin textures, and attack animations
Fix spell cast target fallback using selected target instead of no-op tautology.
Fix SMSG_ITEM_QUERY_SINGLE_RESPONSE to always read 10 stat pairs (server sends
all 10 regardless of statsCount), fixing misaligned armor/stat reads. Fix XP gain
parser to read float groupRate + uint8 RAF instead of bogus uint32 groupBonus.
Add item icons and quality-colored names to loot window. Use actual character
appearance bytes for CharSections.dbc skin/face/hair lookups instead of hardcoded
defaults. Add weapon-type-aware attack animation selection (2H prioritizes anim 18).
Add readable spell cast failure messages and vendor sell hint.
2026-02-06 15:41:29 -08:00
Kelsi
f0aad5e97f Fix spline parsing, hair texture, and popup window positioning
Restore unconditional verticalAccel/effectStartTime reads in spline parser
with pointCount safety cap at 256. Load player hair texture from
CharSections.dbc instead of hardcoded path, and restrict render fallback
to not apply skin composite to hair batches. Change loot/gossip/vendor
windows to re-center on each open via ImGuiCond_Appearing.
2026-02-06 15:18:50 -08:00
Kelsi
aa11ffda72 Fix terrain streaming loop and auto-select single realm/character
Use getRemainingTileCount (pending + readyQueue) and processAllReadyTiles
to prevent loading screen from exiting before tiles are finalized. Auto-select
realm and character when only one is available.
2026-02-06 14:56:26 -08:00
Kelsi
81d712121e Add loading screen to online mode, fix ImGui frame conflict, truncate log on start
Online world entry now shows a progress bar during character model,
terrain, and tile streaming. Fixed loading screen crash from calling
ImGui::NewFrame while a frame was already in progress. Log file is
now truncated on each launch instead of appending.
2026-02-06 14:49:53 -08:00
Kelsi
6f33392155 Add progress bar to loading screen and handle resize during loading
Loading screen now shows a gold progress bar with percentage and status
text. All loading steps poll SDL events for window resize and quit.
2026-02-06 14:43:18 -08:00
Kelsi
a0c24e70f9 Load creature display DBC lookups at startup instead of first spawn
Moves buildCreatureDisplayLookups() from lazy init on first creature
spawn to eagerly run after asset manager init, eliminating a 133s hang.
2026-02-06 14:37:31 -08:00
Kelsi
a09bea5e1e Add spell icons to action bar from SpellIcon.dbc
Load spell icons via Spell.dbc field 133 (SpellIconID) -> SpellIcon.dbc
(icon path) -> BLP texture from Interface\Icons\. Icons are cached as GL
textures and rendered with ImageButton, with cooldown text overlaid on the
icon. Falls back to truncated spell name text for missing icons.
2026-02-06 14:30:54 -08:00
Kelsi
394e91cd9e Add character screen model preview, item icons, stats panel, and fix targeting bugs
Enhanced the C-key character screen with a 3-column layout featuring a 3D
character model preview (with drag-to-rotate), item icons loaded from BLP
textures via ItemDisplayInfo.dbc, and a stats panel showing base + equipment
bonuses. Fixed selection circle clipping under terrain by adding a Z offset,
and corrected faction hostility logic that was wrongly marking hostile mobs
as friendly.
2026-02-06 14:24:38 -08:00
Kelsi
7128ea1417 Restructure inventory UI, add vendor selling, camera intro on all spawns, and quest log
Split inventory into bags-only (B key) and character screen (C key). Vendor window
auto-opens bags with sell prices on hover and right-click to sell. Add camera intro
pan on all login/spawn/teleport/hearthstone events and idle orbit after 2 minutes.
Add quest log UI, SMSG_MONSTER_MOVE handling, deferred creature spawn queue, and
creature fade-in/movement interpolation for online mode.
2026-02-06 13:47:03 -08:00
Kelsi
a4a39c7f0f Fix quest details parser, ImGui ID conflict, and gossip reopen guard
Quest details parser now reads all 6 choice + 4 reward item slots
(matching AzerothCore's fixed-size arrays) with bounds checking at
every step. Use loop index for quest ImGui IDs instead of questId to
avoid conflicts. Don't reopen gossip window while quest details are
showing.
2026-02-06 12:08:47 -08:00
Kelsi
67a3da3bae Add quest details dialog, fix vendor UI, suppress both-button clicks
Parse SMSG_QUESTGIVER_QUEST_DETAILS and show quest text with Accept/
Decline buttons. Vendor window now shows item names with quality colors,
stat tooltips on hover, player money, and closes properly via X button.
Suppress left/right-click targeting and interaction when the other mouse
button is held (both-button run forward).
2026-02-06 11:59:51 -08:00
Kelsi
60be428250 Add quest opcodes, fix gossip select packet, and NPC combat animations
Fix CMSG_GOSSIP_SELECT_OPTION missing menuId field (was causing
ByteBufferException). Add 12 quest opcodes and clickable quest items in
gossip dialog. NPC attack/death animation callbacks now work for both
single-player and server-spawned creatures, and SMSG_ATTACKERSTATEUPDATE
triggers NPC swing animations.
2026-02-06 11:45:35 -08:00
Kelsi
b5336d784a Fix movement packet format: write fallTime unconditionally
AzerothCore's ReadMovementInfo always reads fallTime regardless of flags.
Also write all four jump fields together when FALLING (remove nested
FALLINGFAR check), and use real millisecond timestamps via steady_clock.
2026-02-06 09:14:22 -08:00
Kelsi
3043cc5203 Fix loot and gossip opcode values for 3.3.5a
Corrected CMSG_AUTOSTORE_LOOT_ITEM (0x162→0x108), CMSG_LOOT_RELEASE
(0x15E→0x15F), SMSG_LOOT_REMOVED (0x163→0x162), SMSG_LOOT_MONEY_NOTIFY
(0x164→0x163), and gossip opcodes (CMSG_GOSSIP_HELLO 0x17C→0x17B,
CMSG_GOSSIP_SELECT_OPTION 0x17E→0x17C, SMSG_GOSSIP_COMPLETE 0x17F→0x17E).
Added missing CMSG_LOOT_MONEY (0x15E).
2026-02-06 09:14:16 -08:00
Kelsi
88241cbddc Render M2 glow batches as billboarded light sprites
Replace flat mesh rendering of additive/mod blend batches (blendMode >= 3)
with camera-facing point sprites using a soft radial gradient texture and
additive blending. Adds M2 particle emitter infrastructure (structs, shader,
parsing stubs) but disables emitter parsing — the assumed 476-byte struct
size is wrong for WotLK 3.3.5a, causing misaligned reads that explode RAM.
2026-02-06 08:58:26 -08:00
Kelsi
b9fdc3396d Skip additive/mod blend batches in M2 rendering
These batches are particle emitter placeholder geometry (glow halos,
light volumes) that render as visible transparent discs without a proper
particle system. Skip them entirely instead of attempting to render as
raw mesh geometry.
2026-02-06 08:05:40 -08:00
Kelsi
81b1f87313 Fix lantern glow rendering and add NPC combat animations
Disable depth testing for additive/mod blend mode batches so glow quads
render as proper light halos instead of visible transparent discs. Add
NPC swing callback to play attack animation (anim 16) when NPCs melee
in single-player combat.
2026-02-06 03:39:36 -08:00
Kelsi
74bcce4f57 Double WMO group distance cull from 80 to 160 units 2026-02-06 03:28:56 -08:00
Kelsi
e01d80f4eb Add unlit rendering for M2 glow/additive batches
Batches with the M2 unlit material flag (0x01) or additive blend modes
(3+) now skip lighting, shadows, and fog, emitting texture color directly.
Fixes lantern glow quads appearing as dull transparent circles.
2026-02-06 03:28:21 -08:00
Kelsi
fbeb14fc98 Add movement packed GUID, inventory money display, and character screen buttons
Fix movement packets to include packed player GUID prefix so the server
tracks position. Fix inventory money display being clipped by child panels.
Add Back and Delete Character buttons to character selection screen with
two-step delete confirmation.
2026-02-06 03:24:46 -08:00
Kelsi
82e63fc95d Trigger player model visual update when online inventory changes
rebuildOnlineInventory() now sets a dirty flag that GameScreen checks
each frame to call updateCharacterGeosets/Textures and loadEquippedWeapons.
2026-02-06 03:13:42 -08:00
Kelsi
ab1f39c73b Fix online mode combat and implement server inventory sync
Right-click now attacks hostile NPCs (npcFlags==0) and interacts with
friendly ones in online mode. Parse UNIT_FIELD_FLAGS (59) and
UNIT_NPC_FLAGS (82) from update packets. Stop auto-attack when target
dies or despawns. Add CMSG_ITEM_QUERY_SINGLE/SMSG_ITEM_QUERY_SINGLE_RESPONSE
to populate inventory from server item objects and player slot fields.
2026-02-06 03:11:43 -08:00
Kelsi
4d80b92c39 Parse M2 render flags and apply per-batch blend modes
Water/lava batches in fountain and Ironforge M2 models use non-opaque
blend modes (alpha, additive) defined in the M2 material table. Without
parsing these, they rendered as solid surfaces extending visibly beyond
their containers. Now each batch looks up its blend mode from the
material array and sets the appropriate GL blend function.
2026-02-06 01:54:25 -08:00
Kelsi
ad04da31c3 Implement M2 texture animation (UV scrolling) for fountain water
Parse M2TextureTransform entries and texture transform lookups from the
M2 binary, then apply per-batch UV offsets in the vertex shader using
the existing animation time base and global sequence durations.
2026-02-06 01:49:27 -08:00
Kelsi
4bb2828b21 Fix NPC head/facial hair rendering and add helmet model loading
- Add race/gender suffix to helmet M2 paths (e.g. _HuM for Human Male)
  so helmet models actually load from MPQ archives
- Include bald scalp mesh (submeshId=1) for hairStyle=0 to cover the
  hole at the crown of the body base mesh
- Fix CharacterFacialHairStyles.dbc column indices (no ID column, so
  cols 0/1/2 for race/sex/variation instead of 1/2/3)
- Convert facial hair DBC values to proper submeshIds by adding group
  base (100+, 200+, 300+)
- Hide hair geosets under helmets and replace with bald scalp cap
2026-02-06 01:36:06 -08:00
Kelsi
5623f9ea6c Keep scalp mesh visible under helmets to prevent transparency 2026-02-06 01:04:59 -08:00
Kelsi
e8fecfb3be Fix NPC hair/geoset rendering using DBC lookups
Use CharHairGeosets.dbc to map (race, sex, hairStyleId) to the correct
group 0 scalp mesh instead of the broken 101+hairStyleId formula. Filter
group 0 submeshes so only the body base and correct hair mesh render
(prevents overlapping scalp variants). Fix ItemDisplayInfo.dbc column
indices (5→7) and geoset formulas for equipment. Add CharSections.dbc
hair texture lookup and CharacterFacialHairStyles.dbc support.
2026-02-06 01:02:35 -08:00
Kelsi
4c77f7ee7b Add texture fallback for body parts with white texture
For body part batches (group 0) that resolve to white/fallback texture,
fall back to the first valid texture in the model. This handles humanoid
NPCs where body parts use different texture slots that may not be set.
2026-02-05 23:51:50 -08:00
Kelsi
9de3f2d327 Fix NPC body parts by applying baked texture to all skin slots
Baked NPC textures must be applied to all skin-related texture slots
(type 1 char skin, type 2 object skin, type 6 hair) since body parts
use different texture slots. Removed separate hair texture lookup as
baked textures already include the complete NPC appearance.
2026-02-05 23:48:06 -08:00
Kelsi
ec937bc6d3 Fix NPC body parts by skipping batches with fallback texture
M2 humanoid models have duplicate body meshes - one set for baked textures
and another for skin compositing. Skip body part batches (group 0) that
resolve to white/fallback texture to avoid rendering the wrong set.
2026-02-05 23:44:45 -08:00
Kelsi
c053631c7a Fix geoset filtering for M2 models
Group 0 (body parts 0-18) always renders all submeshes since they represent
different body parts. Other groups filter by exact submeshId match to show
only one variation per group.
2026-02-05 23:42:05 -08:00
Kelsi
b4ae2c7b67 Disable geoset filtering until submesh ID format is determined
Geoset filtering was causing body parts to disappear. Disabled until we
can properly map submesh IDs to geoset groups.
2026-02-05 23:37:26 -08:00
Kelsi
99fd4ca537 Fix geoset filtering to always show body parts (group 0)
Body parts (submeshId 0-99) now always render regardless of activeGeosets.
Other geoset groups (hair, chest, etc.) still require explicit enabling.
This fixes missing body parts while maintaining equipment filtering.
2026-02-05 23:35:28 -08:00
Kelsi
9c5e2fb93d Fix geoset filtering with expanded body range and debug logging
Expanded body part geoset range from 0-18 to 0-99 to cover all humanoid
submesh IDs. Added per-model debug logging to track submesh IDs and
geoset filtering behavior.
2026-02-05 23:33:28 -08:00
Kelsi
136dd0ac43 Disable NPC geoset filtering to fix missing body parts
Geoset filtering was incorrectly hiding NPC body parts because submesh
IDs don't match the expected geoset ID convention. Disabled until proper
mapping is implemented.
2026-02-05 23:29:10 -08:00
Kelsi
ec6c575894 Revert "Fix geoset filtering using correct geosetId from M2 batch"
This reverts commit 45048757ef.
2026-02-05 23:27:59 -08:00
Kelsi
45048757ef Fix geoset filtering using correct geosetId from M2 batch
M2 batches have a geosetIndex field that determines the geoset group for
filtering (0-18=body, 1xx=hair, etc.). We were incorrectly using submeshId
from the submesh struct instead. Now properly stores and uses geosetId.
2026-02-05 23:26:30 -08:00
Kelsi
3e50b1071d Fix character spawning at saved position instead of default preset
selectSpawnPreset() was always returning a preset (Goldshire by default),
overriding the saved character position. Now returns nullptr when no
WOW_SPAWN env var is set, allowing saved position to be used.
2026-02-05 23:24:52 -08:00
Kelsi
8cb38b91f9 Fix invisible NPC body parts caused by texture alpha
Character fragment shader was using texture alpha, which could be 0 in
baked NPC textures. Force alpha=1 for opaque character rendering.
2026-02-05 23:22:24 -08:00