mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +00:00
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:
parent
6951b7803d
commit
4d39736d29
3 changed files with 61 additions and 0 deletions
|
|
@ -2093,6 +2093,22 @@ void GameScreen::renderTargetFrame(game::GameHandler& gameHandler) {
|
|||
}
|
||||
}
|
||||
|
||||
// Target cast bar — shown when the target is casting
|
||||
if (gameHandler.isTargetCasting()) {
|
||||
float castPct = gameHandler.getTargetCastProgress();
|
||||
float castLeft = gameHandler.getTargetCastTimeRemaining();
|
||||
uint32_t tspell = gameHandler.getTargetCastSpellId();
|
||||
const std::string& castName = (tspell != 0) ? gameHandler.getSpellName(tspell) : "";
|
||||
ImGui::PushStyleColor(ImGuiCol_PlotHistogram, ImVec4(0.9f, 0.3f, 0.2f, 1.0f));
|
||||
char castLabel[72];
|
||||
if (!castName.empty())
|
||||
snprintf(castLabel, sizeof(castLabel), "%s (%.1fs)", castName.c_str(), castLeft);
|
||||
else
|
||||
snprintf(castLabel, sizeof(castLabel), "Casting... (%.1fs)", castLeft);
|
||||
ImGui::ProgressBar(castPct, ImVec2(-1, 14), castLabel);
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
// Distance
|
||||
const auto& movement = gameHandler.getMovementInfo();
|
||||
float dx = target->getX() - movement.x;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue