mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 01:23:51 +00:00
feat(animation): 452 named constants, 30-phase character animation state machine
Add animation_ids.hpp/cpp with all 452 WoW animation ID constants (anim::STAND, anim::RUN, anim::FIRE_BOW, ... anim::FLY_BACKWARDS, etc.), nameFromId() O(1) lookup, and flyVariant() compact 218-element ground→FLY_* resolver. Expand AnimationController into a full state machine with 20+ named states: spell cast (directed→omni→cast fallback chain, instant one-shot release), hit reactions (WOUND/CRIT/DODGE/BLOCK/SHIELD_BLOCK), stun, wounded idle, stealth animation substitution, loot, fishing channel, sit/sleep/kneel down→loop→up transitions, sheathe/unsheathe combat enter/exit, ranged weapons (BOW/GUN/CROSSBOW/THROWN with reload states), game object OPEN/CLOSE/DESTROY, vehicle enter/exit, mount flight directionals (FLY_LEFT/RIGHT/UP/DOWN/BACKWARDS), emote state variants, off-hand/pierce/dual-wield alternation, NPC birth/spawn/drown/rise, sprint aura override, totem idle, NPC greeting/farewell. Add spell_defines.hpp with SpellEffect (~45 constants) and SpellMissInfo (12 constants) namespaces; replace all magic numbers in spell_handler.cpp. Add GAMEOBJECT_BYTES_1 to update field table (all 4 expansion JSONs) and wire GameObjectStateCallback. Add DBC cross-validation on world entry. Expand tools/_ANIM_NAMES from ~35 to 452 entries in m2_viewer.py and asset_pipeline_gui.py. Add tests/test_animation_ids.cpp. Bug fixes included: - Stand state 1 was animating READY_2H(27) — fixed to SITTING(97) - Spell casts ended freeze-frame — add one-shot release animation - NPC 2H swing probe chain missing ATTACK_2H_LOOSE (polearm/staff) - Chair sits (states 2/4/5/6) incorrectly played floor-sit transition - STOP(3) used for all spell casts — replaced with model-aware chain
This commit is contained in:
parent
d54e262048
commit
e58f9b4b40
59 changed files with 3903 additions and 483 deletions
|
|
@ -934,7 +934,8 @@ public:
|
|||
void setGhostStateCallback(GhostStateCallback cb) { ghostStateCallback_ = std::move(cb); }
|
||||
|
||||
// Melee swing callback (for driving animation/SFX)
|
||||
using MeleeSwingCallback = std::function<void()>;
|
||||
// spellId: 0 = regular auto-attack swing, non-zero = melee ability (special attack)
|
||||
using MeleeSwingCallback = std::function<void(uint32_t spellId)>;
|
||||
void setMeleeSwingCallback(MeleeSwingCallback cb) { meleeSwingCallback_ = std::move(cb); }
|
||||
|
||||
// Spell cast animation callbacks — true=start cast/channel, false=finish/cancel
|
||||
|
|
@ -959,6 +960,23 @@ public:
|
|||
using NpcSwingCallback = std::function<void(uint64_t guid)>;
|
||||
void setNpcSwingCallback(NpcSwingCallback cb) { npcSwingCallback_ = std::move(cb); }
|
||||
|
||||
// Hit reaction callback — triggers victim animation (dodge, block, wound, crit wound)
|
||||
enum class HitReaction : uint8_t { WOUND, CRIT_WOUND, DODGE, PARRY, BLOCK, SHIELD_BLOCK };
|
||||
using HitReactionCallback = std::function<void(uint64_t victimGuid, HitReaction reaction)>;
|
||||
void setHitReactionCallback(HitReactionCallback cb) { hitReactionCallback_ = std::move(cb); }
|
||||
|
||||
// Stun state callback — fires when UNIT_FLAG_STUNNED changes on the local player
|
||||
using StunStateCallback = std::function<void(bool stunned)>;
|
||||
void setStunStateCallback(StunStateCallback cb) { stunStateCallback_ = std::move(cb); }
|
||||
|
||||
// Stealth state callback — fires when UNIT_FLAG_SNEAKING changes on the local player
|
||||
using StealthStateCallback = std::function<void(bool stealthed)>;
|
||||
void setStealthStateCallback(StealthStateCallback cb) { stealthStateCallback_ = std::move(cb); }
|
||||
|
||||
// Player health changed callback — fires when local player HP changes
|
||||
using PlayerHealthCallback = std::function<void(uint32_t health, uint32_t maxHealth)>;
|
||||
void setPlayerHealthCallback(PlayerHealthCallback cb) { playerHealthCallback_ = std::move(cb); }
|
||||
|
||||
// NPC greeting callback (plays voice line when NPC is clicked)
|
||||
using NpcGreetingCallback = std::function<void(uint64_t guid, const glm::vec3& position)>;
|
||||
void setNpcGreetingCallback(NpcGreetingCallback cb) { npcGreetingCallback_ = std::move(cb); }
|
||||
|
|
@ -1093,6 +1111,19 @@ public:
|
|||
using GameObjectCustomAnimCallback = std::function<void(uint64_t guid, uint32_t animId)>;
|
||||
void setGameObjectCustomAnimCallback(GameObjectCustomAnimCallback cb) { gameObjectCustomAnimCallback_ = std::move(cb); }
|
||||
|
||||
// GameObject state change callback (triggered when GAMEOBJECT_BYTES_1 updates — state byte changes)
|
||||
// goState: 0=READY(closed), 1=OPEN, 2=DESTROYED
|
||||
using GameObjectStateCallback = std::function<void(uint64_t guid, uint8_t goState)>;
|
||||
void setGameObjectStateCallback(GameObjectStateCallback cb) { gameObjectStateCallback_ = std::move(cb); }
|
||||
|
||||
// Sprint aura callback — fired when sprint-type aura active state changes on player
|
||||
using SprintAuraCallback = std::function<void(bool active)>;
|
||||
void setSprintAuraCallback(SprintAuraCallback cb) { sprintAuraCallback_ = std::move(cb); }
|
||||
|
||||
// Vehicle state callback — fired when player enters/exits a vehicle
|
||||
using VehicleStateCallback = std::function<void(bool entered, uint32_t vehicleId)>;
|
||||
void setVehicleStateCallback(VehicleStateCallback cb) { vehicleStateCallback_ = std::move(cb); }
|
||||
|
||||
// Faction hostility map (populated from FactionTemplate.dbc by Application)
|
||||
void setFactionHostileMap(std::unordered_map<uint32_t, bool> map) { factionHostileMap_ = std::move(map); }
|
||||
|
||||
|
|
@ -1806,6 +1837,10 @@ public:
|
|||
using ItemLootCallback = std::function<void(uint32_t itemId, uint32_t count, uint32_t quality, const std::string& name)>;
|
||||
void setItemLootCallback(ItemLootCallback cb) { itemLootCallback_ = std::move(cb); }
|
||||
|
||||
// Loot window open/close callback (for loot kneel animation)
|
||||
using LootWindowCallback = std::function<void(bool open)>;
|
||||
void setLootWindowCallback(LootWindowCallback cb) { lootWindowCallback_ = std::move(cb); }
|
||||
|
||||
// Quest turn-in completion callback
|
||||
using QuestCompleteCallback = std::function<void(uint32_t questId, const std::string& questTitle)>;
|
||||
void setQuestCompleteCallback(QuestCompleteCallback cb) { questCompleteCallback_ = std::move(cb); }
|
||||
|
|
@ -2532,6 +2567,9 @@ private:
|
|||
GameObjectMoveCallback gameObjectMoveCallback_;
|
||||
GameObjectDespawnCallback gameObjectDespawnCallback_;
|
||||
GameObjectCustomAnimCallback gameObjectCustomAnimCallback_;
|
||||
GameObjectStateCallback gameObjectStateCallback_;
|
||||
SprintAuraCallback sprintAuraCallback_;
|
||||
VehicleStateCallback vehicleStateCallback_;
|
||||
|
||||
// Transport tracking
|
||||
struct TransportAttachment {
|
||||
|
|
@ -3111,6 +3149,10 @@ private:
|
|||
UnitAnimHintCallback unitAnimHintCallback_;
|
||||
UnitMoveFlagsCallback unitMoveFlagsCallback_;
|
||||
NpcSwingCallback npcSwingCallback_;
|
||||
HitReactionCallback hitReactionCallback_;
|
||||
StunStateCallback stunStateCallback_;
|
||||
StealthStateCallback stealthStateCallback_;
|
||||
PlayerHealthCallback playerHealthCallback_;
|
||||
NpcGreetingCallback npcGreetingCallback_;
|
||||
NpcFarewellCallback npcFarewellCallback_;
|
||||
NpcVendorCallback npcVendorCallback_;
|
||||
|
|
@ -3210,6 +3252,9 @@ private:
|
|||
// ---- Item loot callback ----
|
||||
ItemLootCallback itemLootCallback_;
|
||||
|
||||
// ---- Loot window callback ----
|
||||
LootWindowCallback lootWindowCallback_;
|
||||
|
||||
// ---- Quest completion callback ----
|
||||
QuestCompleteCallback questCompleteCallback_;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue