game/ui: add target cast bar to target frame (SMSG_SPELL_START tracking)

SMSG_SPELL_START fires for all units, not just the player. Previously only
the player's own cast was tracked; now we also track when the current
target is casting, enabling interrupt decisions.

- GameHandler: track targetCasting_/targetCastSpellId_/targetCastTimeTotal_
  /targetCastTimeRemaining_ — updated by SMSG_SPELL_START for the current
  target and ticked down in the update loop each frame
- Target cast cleared when: target changes (setTarget), target's spell
  lands (SMSG_SPELL_GO), or cast timer expires naturally
- game_screen: renderTargetFrame shows a red cast progress bar between
  the power bar and distance line when the target is casting, with
  spell name + remaining seconds
- Public accessors: isTargetCasting(), getTargetCastSpellId(),
  getTargetCastProgress(), getTargetCastTimeRemaining()
This commit is contained in:
Kelsi 2026-03-09 23:06:40 -07:00
parent 6951b7803d
commit 4d39736d29
3 changed files with 61 additions and 0 deletions

View file

@ -513,6 +513,16 @@ public:
float getCastProgress() const { return castTimeTotal > 0 ? (castTimeTotal - castTimeRemaining) / castTimeTotal : 0.0f; }
float getCastTimeRemaining() const { return castTimeRemaining; }
// Target cast bar (shows when the current target is casting)
bool isTargetCasting() const { return targetCasting_; }
uint32_t getTargetCastSpellId() const { return targetCastSpellId_; }
float getTargetCastProgress() const {
return targetCastTimeTotal_ > 0.0f
? (targetCastTimeTotal_ - targetCastTimeRemaining_) / targetCastTimeTotal_
: 0.0f;
}
float getTargetCastTimeRemaining() const { return targetCastTimeRemaining_; }
// Talents
uint8_t getActiveTalentSpec() const { return activeTalentSpec_; }
uint8_t getUnspentTalentPoints() const { return unspentTalentPoints_[activeTalentSpec_]; }
@ -1754,6 +1764,11 @@ private:
bool casting = false;
uint32_t currentCastSpellId = 0;
float castTimeRemaining = 0.0f;
// Target cast bar state (populated from SMSG_SPELL_START for the current target)
bool targetCasting_ = false;
uint32_t targetCastSpellId_ = 0;
float targetCastTimeRemaining_= 0.0f;
float targetCastTimeTotal_ = 0.0f;
uint64_t pendingGameObjectInteractGuid_ = 0;
// Talents (dual-spec support)