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:
Paul 2026-04-04 23:02:53 +03:00
parent d54e262048
commit e58f9b4b40
59 changed files with 3903 additions and 483 deletions

View file

@ -28,6 +28,38 @@ enum class EquipSlot : uint8_t {
NUM_SLOTS // = 23
};
// WoW InventoryType field values (from ItemDisplayInfo / Item.dbc / CMSG_ITEM_QUERY)
// Used in ItemDef::inventoryType and equipment update packets.
namespace InvType {
constexpr uint8_t NON_EQUIP = 0; // Not equippable / unarmed
constexpr uint8_t HEAD = 1;
constexpr uint8_t NECK = 2;
constexpr uint8_t SHOULDERS = 3;
constexpr uint8_t SHIRT = 4;
constexpr uint8_t CHEST = 5; // Chest armor
constexpr uint8_t WAIST = 6;
constexpr uint8_t LEGS = 7;
constexpr uint8_t FEET = 8;
constexpr uint8_t WRISTS = 9;
constexpr uint8_t HANDS = 10;
constexpr uint8_t FINGER = 11; // Ring
constexpr uint8_t TRINKET = 12;
constexpr uint8_t ONE_HAND = 13; // One-handed weapon (sword, mace, dagger, fist)
constexpr uint8_t SHIELD = 14;
constexpr uint8_t RANGED_BOW = 15; // Bow
constexpr uint8_t BACK = 16; // Cloak
constexpr uint8_t TWO_HAND = 17; // Two-handed weapon (also polearm/staff by inventoryType alone)
constexpr uint8_t BAG = 18;
constexpr uint8_t TABARD = 19;
constexpr uint8_t ROBE = 20; // Chest (robe variant)
constexpr uint8_t MAIN_HAND = 21; // Main-hand only weapon
constexpr uint8_t OFF_HAND = 22; // Off-hand (held-in-off-hand items, not weapons)
constexpr uint8_t HOLDABLE = 23; // Off-hand holdable (books, orbs)
constexpr uint8_t AMMO = 24;
constexpr uint8_t THROWN = 25;
constexpr uint8_t RANGED_GUN = 26; // Gun / Crossbow / Wand
} // namespace InvType
struct ItemDef {
uint32_t itemId = 0;
std::string name;