X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fpanel%2Fracetimer.qc;h=0703c4f2dcb9eaecd29a70f49213f091f08591d3;hb=6ae488fa94396ad9ffa0dc3dbfbedb54c8b7983a;hp=b107a40c0378b95c62ea046030e6dc03d99209d9;hpb=f28bafd2da379d00bd179459e73a77620552a66f;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/hud/panel/racetimer.qc b/qcsrc/client/hud/panel/racetimer.qc index b107a40c0..0703c4f2d 100644 --- a/qcsrc/client/hud/panel/racetimer.qc +++ b/qcsrc/client/hud/panel/racetimer.qc @@ -1,8 +1,15 @@ #include "racetimer.qh" -#include +#include +#include +#include -// Race timer (#6) +// Race timer (#8) + +void HUD_RaceTimer_Export(int fh) +{ + // allow saving cvars that aesthetically change the panel into hud skin files +} // return the string of the onscreen race timer string MakeRaceString(int cp, float mytime, float theirtime, float othertime, float lapdelta, string theirname) @@ -95,7 +102,7 @@ void HUD_RaceTimer () if(!autocvar__hud_configure) { if(!autocvar_hud_panel_racetimer) return; - if(!(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return; + if(!MUTATOR_CALLHOOK(ShowRaceTimer)) return; if(spectatee_status == -1) return; } @@ -145,10 +152,11 @@ void HUD_RaceTimer () str_pos = pos + eX * 0.5 * (mySize.x - stringwidth(s, false, '1 1 0' * 0.6 * mySize.y)); drawstring(str_pos, s, '1 1 0' * 0.6 * mySize.y, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL); draw_endBoldFont(); - s = _("^1Intermediate 1 (+15.42)"); + s = strcat("^1", sprintf(_("Intermediate %d"), 1), " (+15.42)"); str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y); drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL); - s = sprintf(_("^1PENALTY: %.1f (%s)"), 2, "missing a checkpoint"); + s = sprintf(_("PENALTY: %.1f (%s)"), 2, _("missing a checkpoint")); + s = strcat("^1", s); str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.8 * mySize.y); drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha, DRAWFLAG_NORMAL); } @@ -194,7 +202,8 @@ void HUD_RaceTimer () a = bound(0, 2 - (time - race_penaltyeventtime), 1); if(a > 0) { - s = sprintf(_("^1PENALTY: %.1f (%s)"), race_penaltytime * 0.1, race_penaltyreason); + s = sprintf(_("PENALTY: %.1f (%s)"), race_penaltytime * 0.1, race_penaltyreason); + s = strcat("^1", s); str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.8 * mySize.y); drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL); } @@ -243,10 +252,19 @@ void HUD_RaceTimer () a = bound(0, (1 + t - time), 1); if(a > 0) { + string col; if(time < t) - s = sprintf(_("^1PENALTY: %.1f (%s)"), (t - time) * 0.1, race_penaltyreason); + { + t = (t - time) * 0.1; + col = "^1"; + } else - s = sprintf(_("^2PENALTY: %.1f (%s)"), 0, race_penaltyreason); + { + t = 0; + col = "^2"; + } + s = sprintf(_("PENALTY: %.1f (%s)"), t, race_penaltyreason); + s = strcat(col, s); str_pos = pos + vec2(0.5 * (mySize.x - stringwidth(s, true, '1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y); drawcolorcodedstring(str_pos, s, '1 1 0' * 0.2 * mySize.y, panel_fg_alpha * a, DRAWFLAG_NORMAL); }