22string MakeRaceString(
int cp,
float mytime,
float theirtime,
float othertime,
float lapdelta,
string theirname)
25 string lapstr =
"", timestr =
"", col =
"^7", othercol =
"^7", othertimestr =
"";
52 else if (othertime == 0)
54 othertimestr =
"+0.0";
67 string lapdiff = sprintf(
CTX(_(
"LAP_DIFF^%+dL")), -lapdelta);
68 lapstr = sprintf(_(
" (%s)"), lapdiff);
69 col = lapdelta > 0 ?
"^2" :
"^1";
72 else if (theirtime > 0)
74 if (mytime >= theirtime)
79 if (mytime >= othertime)
88 cpname = _(
"Start line");
90 cpname = _(
"Finish line");
92 cpname = sprintf(_(
"Checkpoint %d"), cp);
94 cpname = _(
"Finish line");
96 if (theirname !=
"" && theirtime >= 0)
98 float namesize = autocvar_cl_race_cptimes_namesize *
hud_fontsize.x;
103 return strcat(col, cpname);
104 else if (theirname ==
"")
105 return strcat(col, cpname, sprintf(_(
" (%s)"), timestr));
109 string time_and_their_name = sprintf(
CTX(_(
"TIMEDIFF_PLAYER^%s %s")), timestr,
strcat(theirname, col, lapstr));
110 time_and_their_name = sprintf(_(
" (%s)"), time_and_their_name);
112 return strcat(col, cpname, othercol, sprintf(_(
" (%s)"), othertimestr), col, time_and_their_name);
114 return strcat(col, cpname, time_and_their_name);
122 for (
int i = 0; i < 256; ++i)
125 && autocvar_cl_race_checkpoint_splits_console
191 if (mySize.x / mySize.y > 4)
193 newSize.x = 4 * mySize.y;
194 newSize.y = mySize.y;
196 pos.x += (mySize.x - newSize.x) * 0.5;
200 newSize.y = 1/4 * mySize.x;
201 newSize.x = mySize.x;
203 pos.y += (mySize.y - newSize.y) * 0.5;
215 str_pos = pos +
eX * 0.5 * (mySize.x -
stringwidth(s,
false,
'1 1 0' * 0.6 * mySize.y));
222 string cpname = sprintf(_(
"Checkpoint %d"), 1);
223 string timestr =
"+15.42";
225 s =
strcat(col, cpname, sprintf(_(
" (%s)"), timestr));
226 if (autocvar_cl_race_cptimes_showspeed)
228 string speed_str = sprintf(
CTX(_(
"SPEED^ %d%s")), 345 * speed_conversion_factor, units_text);
230 float speed_diff = 123;
232 s =
strcat(s,
"^7", speed_str, speed_color, sprintf(_(
" (%s)"), sprintf(
CTX(_(
"SPEED_DIFF^%+d%s")), speed_diff * speed_conversion_factor, units_text)));
235 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
241 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.8 * mySize.y);
248 string forcetime =
"";
270 if (autocvar_cl_race_cptimes_showspeed)
281 else if (speed_diff == 0)
284 string speed_str = sprintf(
CTX(_(
"SPEED^ %d%s")),
speed * speed_conversion_factor, units_text);
286 s =
strcat(s,
"^7", speed_str, speed_color, sprintf(_(
" (%s)"), sprintf(
CTX(_(
"SPEED_DIFF^%+d%s")), speed_diff * speed_conversion_factor, units_text)));
288 s =
strcat(s,
"^7", speed_str);
321 if (s !=
"" && a > 0)
323 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
333 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.8 * mySize.y);
343 str_pos = pos +
eX * 0.5 * (mySize.x -
stringwidth(forcetime,
false,
'1 1 0' * 0.6 * mySize.y));
352 str_pos = pos +
eX * 0.5 * (mySize.x -
stringwidth(s,
false,
'0.6 0.6 0' * mySize.y));
367 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
374 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
387 t = (t -
time) * 0.1;
396 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
#define MUTATOR_CALLHOOK(name,...)
void drawstring_expanding(vector position, string text, vector theScale, vector rgb, float theAlpha, float flag, float fadelerp)
#define drawcolorcodedstring(position, text, scale, alpha, flag)
#define drawstring(position, text, scale, rgb, alpha, flag)
#define draw_beginBoldFont()
#define draw_endBoldFont()
vector autocvar_hud_progressbar_acceleration_neg_color
vector autocvar_hud_progressbar_acceleration_color
string GetSpeedUnit(int speed_unit)
float GetSpeedUnitFactor(int speed_unit)
int spectatee_status
the -1 disables HUD panels before CSQC receives necessary data
bool autocvar_cl_race_cptimes_showself
ERASEABLE string rgb_to_hexcolor(vector rgb)
string textShortenToWidth(string theText, float maxWidth, vector theFontSize, textLengthUpToWidth_widthFunction_t tw)
#define TIME_ENCODED_TOSTRING(n, compact)
const float DRAWFLAG_NORMAL
void HUD_Panel_LoadCvars()
int autocvar_hud_speed_unit
#define HUD_Panel_DrawBg()
bool autocvar__hud_configure
ERASEABLE string CTX(string s)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void HUD_RaceTimer_Export(int fh)
void ClearCheckpointSplits(bool quiet)
string MakeRaceString(int cp, float mytime, float theirtime, float othertime, float lapdelta, string theirname)
string racetimer_checkpoint_time
float racetimer_have_stored_splits_player
string racetimer_checkpoint_comparison
float racetimer_lastcheckpoint
bool racetimer_have_stored_splits
void StoreCheckpointSplits(float race_checkpoint, string forcetime, string s)
void HUD_RaceTimer(bool should_draw)
float race_othercheckpointtime
string race_othercheckpointenemy
float race_nextcheckpoint
float race_checkpoint_splits_speed[256]
float race_othercheckpoint
float race_penaltyaccumulator
float race_mycheckpointlapsdelta
string race_penaltyreason
string race_mycheckpointenemy
float race_othercheckpointdelta
float race_previousbesttime
float race_mypreviousbesttime
bool autocvar_hud_panel_racetimer_dynamichud
bool autocvar_hud_panel_racetimer
float race_checkpointtime
float race_mycheckpointtime
float race_othercheckpointlapsdelta
float race_penaltyeventtime
float race_mycheckpointdelta
string race_previousbestname
string race_checkpoint_splits[256]
ERASEABLE string ColorTranslateRGB(string s)
ERASEABLE string ftos_decimals(float number, int decimals)
Converts a number to a string with the indicated number of decimals.
float stringwidth_colors(string s, vector theSize)