Kelsidavis-WoWee/include/rendering/animation/i_character_animator.hpp
Paul b4989dc11f 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).
2026-04-05 12:27:35 +03:00

42 lines
1.6 KiB
C++

#pragma once
#include "rendering/animation/i_animator.hpp"
#include "rendering/animation/weapon_type.hpp"
#include <cstdint>
#include <string>
namespace wowee {
namespace rendering {
// ============================================================================
// ICharacterAnimator
//
// Player-specific animation interface. Extends IAnimator with combat,
// spell, emote, and mount operations.
// ============================================================================
class ICharacterAnimator : public IAnimator {
public:
virtual void startSpellCast(uint32_t precast, uint32_t cast, bool loop, uint32_t finalize) = 0;
virtual void stopSpellCast() = 0;
virtual void triggerMeleeSwing() = 0;
virtual void triggerRangedShot() = 0;
virtual void triggerHitReaction(uint32_t animId) = 0;
virtual void triggerSpecialAttack(uint32_t spellId) = 0;
virtual void setEquippedWeaponType(const WeaponLoadout& loadout) = 0;
virtual void setEquippedRangedType(RangedWeaponType type) = 0;
virtual void playEmote(uint32_t animId, bool loop) = 0;
virtual void cancelEmote() = 0;
virtual void startLooting() = 0;
virtual void stopLooting() = 0;
virtual void setStunned(bool stunned) = 0;
virtual void setCharging(bool charging) = 0;
virtual void setStandState(uint8_t state) = 0;
virtual void setStealthed(bool stealth) = 0;
virtual void setInCombat(bool combat) = 0;
virtual void setLowHealth(bool low) = 0;
virtual void setSprintAuraActive(bool active) = 0;
virtual ~ICharacterAnimator() = default;
};
} // namespace rendering
} // namespace wowee