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";
65 lapstr = sprintf(_(
" (-%dL)"), lapdelta);
68 else if (lapdelta < 0)
70 lapstr = sprintf(_(
" (+%dL)"), -lapdelta);
74 else if (theirtime > 0)
76 if (mytime >= theirtime)
81 if (mytime >= othertime)
90 cpname = _(
"Start line");
92 cpname = _(
"Finish line");
94 cpname = sprintf(_(
"Checkpoint %d"), cp);
96 cpname = _(
"Finish line");
98 if (theirname !=
"" && theirtime >= 0)
100 float namesize = autocvar_cl_race_cptimes_namesize *
hud_fontsize.x;
105 return strcat(col, cpname);
106 else if (theirname ==
"")
107 return strcat(col, sprintf(
"%s (%s)", cpname, timestr));
109 return strcat(col, sprintf(
"%s %s(%s)%s (%s %s)", cpname, othercol, othertimestr, col, timestr,
strcat(theirname, col, lapstr)));
111 return strcat(col, sprintf(
"%s (%s %s)", cpname, timestr,
strcat(theirname, col, lapstr)));
118 for (
int i = 0; i < 256; ++i)
121 && autocvar_cl_race_checkpoint_splits_console
185 if (mySize.x / mySize.y > 4)
187 newSize.x = 4 * mySize.y;
188 newSize.y = mySize.y;
190 pos.x += (mySize.x - newSize.x) * 0.5;
194 newSize.y = 1/4 * mySize.x;
195 newSize.x = mySize.x;
197 pos.y += (mySize.y - newSize.y) * 0.5;
209 str_pos = pos +
eX * 0.5 * (mySize.x -
stringwidth(s,
false,
'1 1 0' * 0.6 * mySize.y));
215 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
217 s = sprintf(_(
"PENALTY: %.1f (%s)"), 2, _(
"missing a checkpoint"));
219 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.8 * mySize.y);
226 string forcetime =
"";
248 if (autocvar_cl_race_cptimes_showspeed)
259 else if (speed_diff == 0)
263 s = sprintf(
"%s ^7%d%s %s(%+d%s)", s,
speed * speed_conversion_factor, units_text, speed_color, speed_diff * speed_conversion_factor, units_text);
265 s = sprintf(
"%s ^7%d%s", s,
speed * speed_conversion_factor, units_text);
298 if (s !=
"" && a > 0)
300 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
311 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.8 * mySize.y);
321 str_pos = pos +
eX * 0.5 * (mySize.x -
stringwidth(forcetime,
false,
'1 1 0' * 0.6 * mySize.y));
330 str_pos = pos +
eX * 0.5 * (mySize.x -
stringwidth(s,
false,
'0.6 0.6 0' * mySize.y));
345 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
352 str_pos = pos +
vec2(0.5 * (mySize.x -
stringwidth(s,
true,
'1 1 0' * 0.2 * mySize.y)), 0.6 * mySize.y);
365 t = (t -
time) * 0.1;
374 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(id,...)
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
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)
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)