feat: show queued spell icon in cast bar and expose getQueuedSpellId()

When a spell is queued in the 400ms window before the current cast ends,
render its icon dimmed (0.8 alpha) to the right of the cast bar progress,
with a "Queued: <name>" tooltip. The progress bar shrinks to accommodate
the icon when one is present.

Also exposes getQueuedSpellId() as a public const accessor on GameHandler
so the UI can observe the spell queue state without friend access.
This commit is contained in:
Kelsi 2026-03-18 04:34:36 -07:00
parent 277a26b351
commit 5f3bc79653
2 changed files with 25 additions and 3 deletions

View file

@ -807,6 +807,9 @@ public:
int getCraftQueueRemaining() const { return craftQueueRemaining_; }
uint32_t getCraftQueueSpellId() const { return craftQueueSpellId_; }
// 400ms spell-queue window: next spell to cast when current finishes
uint32_t getQueuedSpellId() const { return queuedSpellId_; }
// Unit cast state (tracked per GUID for target frame + boss frames)
struct UnitCastState {
bool casting = false;

View file

@ -9732,13 +9732,32 @@ void GameScreen::renderCastBar(game::GameHandler& gameHandler) {
}
}
// Queued spell icon (right edge): the next spell queued to fire within 400ms.
uint32_t queuedId = gameHandler.getQueuedSpellId();
VkDescriptorSet queuedTex = (queuedId != 0 && assetMgr)
? getSpellIcon(queuedId, assetMgr) : VK_NULL_HANDLE;
const float iconSz = 20.0f;
const float reservedRight = (queuedTex) ? (iconSz + 4.0f) : 0.0f;
if (iconTex) {
// Spell icon to the left of the progress bar
ImGui::Image((ImTextureID)(uintptr_t)iconTex, ImVec2(20, 20));
ImGui::Image((ImTextureID)(uintptr_t)iconTex, ImVec2(iconSz, iconSz));
ImGui::SameLine(0, 4);
ImGui::ProgressBar(progress, ImVec2(-1, 20), overlay);
ImGui::ProgressBar(progress, ImVec2(-reservedRight - 1.0f, iconSz), overlay);
} else {
ImGui::ProgressBar(progress, ImVec2(-1, 20), overlay);
ImGui::ProgressBar(progress, ImVec2(-reservedRight - 1.0f, iconSz), overlay);
}
// Draw queued-spell icon on the right with a ">" arrow prefix tooltip.
if (queuedTex) {
ImGui::SameLine(0, 4);
ImGui::Image((ImTextureID)(uintptr_t)queuedTex, ImVec2(iconSz, iconSz),
ImVec2(0,0), ImVec2(1,1),
ImVec4(1,1,1,0.8f), ImVec4(0,0,0,0)); // slightly dimmed
if (ImGui::IsItemHovered()) {
const std::string& qn = gameHandler.getSpellName(queuedId);
ImGui::SetTooltip("Queued: %s", qn.empty() ? "Unknown" : qn.c_str());
}
}
ImGui::PopStyleColor();
}