mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-05 00:33:51 +00:00
feat(animation): decompose AnimationController into FSM-based architecture
Replace the 2,200-line monolithic AnimationController (goto-driven, single class, untestable) with a composed FSM architecture per refactor.md. New subsystem (src/rendering/animation/ — 16 headers, 10 sources): - CharacterAnimator: FSM composer implementing ICharacterAnimator - LocomotionFSM: idle/walk/run/sprint/jump/swim/strafe - CombatFSM: melee/ranged/spell cast/stun/hit reaction/charge - ActivityFSM: emote/loot/sit-down/sitting/sit-up - MountFSM: idle/run/flight/taxi/fidget/rear-up (per-instance RNG) - AnimCapabilitySet + AnimCapabilityProbe: probe once at model load, eliminate per-frame hasAnimation() linear search - AnimationManager: registry of CharacterAnimator by GUID - EmoteRegistry: DBC-backed emote command → animId singleton - FootstepDriver, SfxStateDriver: extracted from AnimationController animation_ids.hpp/.cpp moved to animation/ subdirectory (452 named constants); all include paths updated. AnimationController retained as thin adapter (~400 LOC): collects FrameInput, delegates to CharacterAnimator, applies AnimOutput. Priority order: Mount > Stun > HitReaction > Spell > Charge > Melee/Ranged > CombatIdle > Emote > Loot > Sit > Locomotion. STAY_IN_STATE policy when all FSMs return valid=false. Bugs fixed: - Remove static mt19937 in mount fidget (shared state across all mounted units) — replaced with per-instance seeded RNG - Remove goto from mounted animation branch (skipped init) - Remove per-frame hasAnimation() calls (now one probe at load) - Fix VK_INDEX_TYPE_UINT16 → UINT32 in shadow pass Tests (4 new suites, all ASAN+UBSan clean): - test_locomotion_fsm: 167 assertions - test_combat_fsm: 125 cases - test_activity_fsm: 112 cases - test_anim_capability: 56 cases docs/ANIMATION_SYSTEM.md added (architecture reference).
This commit is contained in:
parent
e58f9b4b40
commit
b4989dc11f
53 changed files with 5110 additions and 2099 deletions
|
|
@ -940,7 +940,9 @@ public:
|
|||
|
||||
// Spell cast animation callbacks — true=start cast/channel, false=finish/cancel
|
||||
// guid: caster (may be player or another unit), isChannel: channel vs regular cast
|
||||
using SpellCastAnimCallback = std::function<void(uint64_t guid, bool start, bool isChannel)>;
|
||||
// castType: DIRECTED (unit target), OMNI (self/no target), AREA (ground AoE)
|
||||
using SpellCastAnimCallback = std::function<void(uint64_t guid, bool start, bool isChannel,
|
||||
SpellCastType castType)>;
|
||||
void setSpellCastAnimCallback(SpellCastAnimCallback cb) { spellCastAnimCallback_ = std::move(cb); }
|
||||
|
||||
// Fired when the player's own spell cast fails (spellId of the failed spell).
|
||||
|
|
|
|||
|
|
@ -40,13 +40,25 @@ struct TalentTabEntry {
|
|||
|
||||
// ---- Spell / cast state ----
|
||||
|
||||
// Spell targeting classification for animation selection.
|
||||
// Derived from the spell packet's targetGuid field — NOT the player's UI target.
|
||||
// DIRECTED — spell targets a specific unit (Frostbolt, Heal, Shadow Bolt)
|
||||
// OMNI — self-cast / no explicit target (Arcane Explosion, buffs)
|
||||
// AREA — ground-targeted AoE (Blizzard, Rain of Fire, Flamestrike)
|
||||
enum class SpellCastType : uint8_t {
|
||||
DIRECTED = 0, // Has a specific unit target
|
||||
OMNI = 1, // Self / no target
|
||||
AREA = 2, // Ground-targeted AoE
|
||||
};
|
||||
|
||||
struct UnitCastState {
|
||||
bool casting = false;
|
||||
bool isChannel = false;
|
||||
uint32_t spellId = 0;
|
||||
float timeRemaining = 0.0f;
|
||||
float timeTotal = 0.0f;
|
||||
bool interruptible = true;
|
||||
bool casting = false;
|
||||
bool isChannel = false;
|
||||
uint32_t spellId = 0;
|
||||
float timeRemaining = 0.0f;
|
||||
float timeTotal = 0.0f;
|
||||
bool interruptible = true;
|
||||
SpellCastType castType = SpellCastType::OMNI;
|
||||
};
|
||||
|
||||
// ---- Equipment sets (WotLK) ----
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue