feat: show decimal precision for short action bar cooldowns

Display "1.5" instead of "1s" for cooldowns under 5 seconds,
matching WoW's default cooldown text behaviour for GCDs and
short ability cooldowns where sub-second timing matters.
This commit is contained in:
Kelsi 2026-03-12 03:48:12 -07:00
parent 6068d0d68d
commit 66ec35b106

View file

@ -4985,9 +4985,10 @@ void GameScreen::renderActionBar(game::GameHandler& gameHandler) {
char cdText[16];
float cd = slot.cooldownRemaining;
if (cd >= 3600.0f) snprintf(cdText, sizeof(cdText), "%dh", (int)cd / 3600);
else if (cd >= 60.0f) snprintf(cdText, sizeof(cdText), "%dm%ds", (int)cd / 60, (int)cd % 60);
else snprintf(cdText, sizeof(cdText), "%ds", (int)cd);
if (cd >= 3600.0f) snprintf(cdText, sizeof(cdText), "%dh", (int)cd / 3600);
else if (cd >= 60.0f) snprintf(cdText, sizeof(cdText), "%dm%ds", (int)cd / 60, (int)cd % 60);
else if (cd >= 5.0f) snprintf(cdText, sizeof(cdText), "%ds", (int)cd);
else snprintf(cdText, sizeof(cdText), "%.1f", cd);
ImVec2 textSize = ImGui::CalcTextSize(cdText);
float tx = cx - textSize.x * 0.5f;
float ty = cy - textSize.y * 0.5f;