From 18f7f2df6969a28cf6f34dcee04a94bafebf7aff Mon Sep 17 00:00:00 2001 From: otta8634 Date: Thu, 12 Sep 2024 11:01:39 +0800 Subject: [PATCH] Fix issues with stringwidth Forgot to change over to stringwidth_colors --- qcsrc/client/hud/panel/pickup.qc | 4 ++-- qcsrc/client/hud/panel/racetimer.qc | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/qcsrc/client/hud/panel/pickup.qc b/qcsrc/client/hud/panel/pickup.qc index b9e9fe018..46162fd33 100644 --- a/qcsrc/client/hud/panel/pickup.qc +++ b/qcsrc/client/hud/panel/pickup.qc @@ -94,14 +94,14 @@ void HUD_Pickup() str_timer = seconds_tostring(HUD_Pickup_Time(last_pickup_time)); str_timer = strcat(CCR("^BG"), str_timer); drawcolorcodedstring(pos, str_timer, fontsize, panel_fg_alpha * a, DRAWFLAG_NORMAL); - pos.x += stringwidth(str_timer, false, fontsize) + fontsize.x * 0.25; + pos.x += stringwidth(str_timer, true, fontsize) + fontsize.x * 0.25; } } drawpic(pos - eY * ((iconsize.y - fontsize.y) / 2), icon, sz2, '1 1 1', panel_fg_alpha * a, DRAWFLAG_NORMAL); pos.x += sz2.x + fontsize.x * 0.25; - str_name = textShortenToWidth(str_name, mySize.x - (pos.x - panel_pos.x), fontsize, stringwidth_nocolors); str_name = strcat(CCR("^BG"), str_name); + str_name = textShortenToWidth(str_name, mySize.x - (pos.x - panel_pos.x), fontsize, stringwidth_colors); drawcolorcodedstring(pos, str_name, fontsize, panel_fg_alpha * a, DRAWFLAG_NORMAL); } } diff --git a/qcsrc/client/hud/panel/racetimer.qc b/qcsrc/client/hud/panel/racetimer.qc index fe546e9d5..5b0a6d5d6 100644 --- a/qcsrc/client/hud/panel/racetimer.qc +++ b/qcsrc/client/hud/panel/racetimer.qc @@ -192,7 +192,7 @@ void HUD_RaceTimer () { s = CCR("^BG0:13:37"); draw_beginBoldFont(); - str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(s, false, '1 1 0' * 0.6 * mySize.y)); + str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.6 * mySize.y)); drawcolorcodedstring(str_pos, s, '1 1 0' * 0.6 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL); draw_endBoldFont(); s = strcat(CCR("^C1"), sprintf(_("Intermediate %d"), 1), " (+15.42)"); @@ -275,7 +275,7 @@ void HUD_RaceTimer () { forcetime = strcat(CCR("^BG"), forcetime); a = bound(0, (time - race_checkpointtime) / 0.5, 1); - str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(forcetime, false, '1 1 0' * 0.6 * mySize.y)); + str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(forcetime, true, '1 1 0' * 0.6 * mySize.y)); drawcolorcodedstring_expanding(str_pos, forcetime, '1 1 0' * 0.6 * mySize.y, panel_fg_alpha, 0, a); } else @@ -285,7 +285,7 @@ void HUD_RaceTimer () { s = TIME_ENCODED_TOSTRING(TIME_ENCODE(time + TIME_DECODE(race_penaltyaccumulator) - race_laptime), false); s = strcat(CCR("^BG"), s); - str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(s, false, '0.6 0.6 0' * mySize.y)); + str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(s, true, '0.6 0.6 0' * mySize.y)); drawcolorcodedstring(str_pos, s, '0.6 0.6 0' * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL); } -- 2.39.2