game/rendering: play SpellCast animation during SMSG_SPELL_START

Add SpellCastAnimCallback to GameHandler, triggered on SMSG_SPELL_START
(start=true) and cleared on SMSG_SPELL_GO / SMSG_SPELL_FAILURE
(start=false) for both the player and other units.

Connect the callback in Application to play animation 3 (SpellCast) on
the player character, NPCs, and other players when they begin a cast.
The cast animation is one-shot (loop=false) so it auto-returns to Stand
when complete via the existing return-to-idle logic.

Also fire stop-cast on spell failure to cancel any stuck cast pose.
This commit is contained in:
Kelsi 2026-03-10 09:42:17 -07:00
parent c20d7c2638
commit 59c50e3beb
3 changed files with 61 additions and 0 deletions

View file

@ -2605,9 +2605,15 @@ void GameHandler::handlePacket(network::Packet& packet) {
ssm->stopPrecast();
}
}
if (spellCastAnimCallback_) {
spellCastAnimCallback_(playerGuid, false, false);
}
} else {
// Another unit's cast failed — clear their tracked cast bar
unitCastStates_.erase(failGuid);
if (spellCastAnimCallback_) {
spellCastAnimCallback_(failGuid, false, false);
}
}
break;
}
@ -12949,6 +12955,10 @@ void GameHandler::handleSpellStart(network::Packet& packet) {
s.spellId = data.spellId;
s.timeTotal = data.castTime / 1000.0f;
s.timeRemaining = s.timeTotal;
// Trigger cast animation on the casting unit
if (spellCastAnimCallback_) {
spellCastAnimCallback_(data.casterUnit, true, false);
}
}
// If this is the player's own cast, start cast bar
@ -12970,6 +12980,11 @@ void GameHandler::handleSpellStart(network::Packet& packet) {
}
}
// Trigger cast animation on player character
if (spellCastAnimCallback_) {
spellCastAnimCallback_(playerGuid, true, false);
}
// Hearthstone cast: begin pre-loading terrain at bind point during cast time
// so tiles are ready when the teleport fires (avoids falling through un-loaded terrain).
// Spell IDs: 6948 = Vanilla Hearthstone (rank 1), 8690 = TBC/WotLK Hearthstone
@ -13021,6 +13036,14 @@ void GameHandler::handleSpellGo(network::Packet& packet) {
casting = false;
currentCastSpellId = 0;
castTimeRemaining = 0.0f;
// End cast animation on player character
if (spellCastAnimCallback_) {
spellCastAnimCallback_(playerGuid, false, false);
}
} else if (spellCastAnimCallback_) {
// End cast animation on other unit
spellCastAnimCallback_(data.casterUnit, false, false);
}
// Clear unit cast bar when the spell lands (for any tracked unit)