seta hud_panel_radar 1 "enable this panel, \"2\" = also enable in non-teambased game modes"
seta hud_panel_score 1 "enable this panel"
seta hud_panel_racetimer 1 "enable this panel"
+seta hud_panel_checkpoints 1 "enable this panel"
seta hud_panel_vote 1 "enable this panel"
seta hud_panel_modicons 1 "enable this panel"
seta hud_panel_pressedkeys 1 "enable this panel, \"1\" = show only when spectating other players, \"2\" = show always"
seta hud_panel_radar_dynamichud 1 "apply the dynamic HUD effects to this panel"
seta hud_panel_score_dynamichud 1 "apply the dynamic HUD effects to this panel"
seta hud_panel_racetimer_dynamichud 1 "apply the dynamic HUD effects to this panel"
+seta hud_panel_checkpoints_dynamichud 1 "apply the dynamic HUD effects to this panel"
seta hud_panel_vote_dynamichud 1 "apply the dynamic HUD effects to this panel"
seta hud_panel_modicons_dynamichud 1 "apply the dynamic HUD effects to this panel"
seta hud_panel_pressedkeys_dynamichud 1 "apply the dynamic HUD effects to this panel"
seta hud_panel_racetimer_bg_border "" "if set to something else than \"\" = override default size of border around the background"
seta hud_panel_racetimer_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
+seta hud_panel_checkpoints_pos "" "position of this base of the panel"
+seta hud_panel_checkpoints_size "" "size of this panel"
+seta hud_panel_checkpoints_bg "" "if set to something else than \"\" = override default background"
+seta hud_panel_checkpoints_bg_color "" "if set to something else than \"\" = override default panel background color"
+seta hud_panel_checkpoints_bg_color_team "" "override panel color with team color in team based games"
+seta hud_panel_checkpoints_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
+seta hud_panel_checkpoints_bg_border "" "if set to something else than \"\" = override default size of border around the background"
+seta hud_panel_checkpoints_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
+seta hud_panel_checkpoints_align "" "text alignment; \"0\" = left, \"0.5\" = center, \"1\" = right"
+seta hud_panel_checkpoints_flip "" "order the list top to bottom instead of bottom to top"
+seta hud_panel_checkpoints_fontscale "" "scale the text font by this amount"
+
seta hud_panel_vote_pos "" "position of this base of the panel"
seta hud_panel_vote_size "" "size of this panel"
seta hud_panel_vote_alreadyvoted_alpha "" "alpha of the vote dialog after you have voted"
seta hud_progressbar_vehicles_ammo1_color "0.77 0.67 0"
seta hud_progressbar_vehicles_ammo2_color "0.86 0.35 0"
-seta _hud_panelorder "17 25 15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 25 26 "
+seta _hud_panelorder "17 25 15 12 9 5 10 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 25 26 27 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.005000"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_checkpoints_pos "0.700000 0.190000"
+seta hud_panel_checkpoints_size "0.250000 0.170000"
+seta hud_panel_checkpoints_bg ""
+seta hud_panel_checkpoints_bg_color ""
+seta hud_panel_checkpoints_bg_color_team ""
+seta hud_panel_checkpoints_bg_alpha ""
+seta hud_panel_checkpoints_bg_border ""
+seta hud_panel_checkpoints_bg_padding ""
+seta hud_panel_checkpoints_flip "0"
+seta hud_panel_checkpoints_align "1"
+seta hud_panel_checkpoints_fontscale "1"
+
seta hud_panel_vote_pos "0.740000 0.690000"
seta hud_panel_vote_size "0.190000 0.090000"
seta hud_panel_vote_bg "border_default"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 25 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 25 26 "
+seta _hud_panelorder "17 25 15 12 9 10 5 6 14 0 7 4 11 2 1 3 8 13 16 18 23 19 20 21 22 24 25 26 27 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_checkpoints_pos "0.670000 0.200000"
+seta hud_panel_checkpoints_size "0.250000 0.170000"
+seta hud_panel_checkpoints_bg ""
+seta hud_panel_checkpoints_bg_color ""
+seta hud_panel_checkpoints_bg_color_team ""
+seta hud_panel_checkpoints_bg_alpha ""
+seta hud_panel_checkpoints_bg_border ""
+seta hud_panel_checkpoints_bg_padding ""
+seta hud_panel_checkpoints_flip "0"
+seta hud_panel_checkpoints_align "1"
+seta hud_panel_checkpoints_fontscale "1"
+
seta hud_panel_vote_pos "0.720000 0.670000"
seta hud_panel_vote_size "0.190000 0.090000"
seta hud_panel_vote_bg "border_default"
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 25 15 16 18 23 19 20 21 22 24 25 26 "
+seta _hud_panelorder "17 10 3 0 14 6 9 13 4 1 2 11 12 7 5 8 25 15 16 18 23 19 20 21 22 24 25 26 27 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_checkpoints_pos "0.740000 0.110000"
+seta hud_panel_checkpoints_size "0.250000 0.170000"
+seta hud_panel_checkpoints_bg ""
+seta hud_panel_checkpoints_bg_color ""
+seta hud_panel_checkpoints_bg_color_team ""
+seta hud_panel_checkpoints_bg_alpha ""
+seta hud_panel_checkpoints_bg_border ""
+seta hud_panel_checkpoints_bg_padding ""
+seta hud_panel_checkpoints_flip "0"
+seta hud_panel_checkpoints_align "1"
+seta hud_panel_checkpoints_fontscale "1"
+
seta hud_panel_vote_pos "0.720000 0.890000"
seta hud_panel_vote_size "0.170000 0.110000"
seta hud_panel_vote_bg ""
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 25 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 18 23 19 20 21 22 24 25 26 "
+seta _hud_panelorder "17 25 15 3 1 2 11 10 0 14 6 9 13 4 12 7 5 8 16 18 23 19 20 21 22 24 25 26 27 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_checkpoints_pos "0.740000 0.110000"
+seta hud_panel_checkpoints_size "0.250000 0.170000"
+seta hud_panel_checkpoints_bg ""
+seta hud_panel_checkpoints_bg_color ""
+seta hud_panel_checkpoints_bg_color_team ""
+seta hud_panel_checkpoints_bg_alpha ""
+seta hud_panel_checkpoints_bg_border ""
+seta hud_panel_checkpoints_bg_padding ""
+seta hud_panel_checkpoints_flip "0"
+seta hud_panel_checkpoints_align "1"
+seta hud_panel_checkpoints_fontscale "1"
+
seta hud_panel_vote_pos "0.720000 0.890000"
seta hud_panel_vote_size "0.170000 0.110000"
seta hud_panel_vote_bg ""
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 25 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 18 23 19 20 21 22 24 25 26 "
+seta _hud_panelorder "17 25 15 10 9 6 8 14 5 0 4 13 2 7 1 3 11 12 16 18 23 19 20 21 22 24 25 26 27 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_checkpoints_pos "0.660000 0.110000"
+seta hud_panel_checkpoints_size "0.250000 0.170000"
+seta hud_panel_checkpoints_bg "0"
+seta hud_panel_checkpoints_bg_color ""
+seta hud_panel_checkpoints_bg_color_team ""
+seta hud_panel_checkpoints_bg_alpha ""
+seta hud_panel_checkpoints_bg_border ""
+seta hud_panel_checkpoints_bg_padding ""
+seta hud_panel_checkpoints_flip "0"
+seta hud_panel_checkpoints_align "1"
+seta hud_panel_checkpoints_fontscale "1"
+
seta hud_panel_vote_pos "0.020000 0.650000"
seta hud_panel_vote_size "0.230000 0.110000"
seta hud_panel_vote_bg ""
seta hud_progressbar_vehicles_ammo1_color "0.8 0.7 0"
seta hud_progressbar_vehicles_ammo2_color "0.7 0.4 0"
-seta _hud_panelorder "17 25 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 18 23 19 20 21 22 24 25 26 "
+seta _hud_panelorder "17 25 15 0 11 8 5 6 14 9 13 7 2 3 1 10 12 4 16 18 23 19 20 21 22 24 25 26 27 "
seta hud_configure_grid "1"
seta hud_configure_grid_xsize "0.010000"
seta hud_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_checkpoints_pos "0.740000 0.420000"
+seta hud_panel_checkpoints_size "0.250000 0.170000"
+seta hud_panel_checkpoints_bg "0"
+seta hud_panel_checkpoints_bg_color ""
+seta hud_panel_checkpoints_bg_color_team ""
+seta hud_panel_checkpoints_bg_alpha ""
+seta hud_panel_checkpoints_bg_border ""
+seta hud_panel_checkpoints_bg_padding ""
+seta hud_panel_checkpoints_flip "0"
+seta hud_panel_checkpoints_align "1"
+seta hud_panel_checkpoints_fontscale "1"
+
seta hud_panel_vote_pos "0.690000 0.750000"
seta hud_panel_vote_size "0.300000 0.100000"
seta hud_panel_vote_bg ""
REGISTER_HUD_PANEL(SCOREBOARD, Scoreboard_Draw, PANEL_CONFIG_NO , PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // SCOREBOARD
REGISTER_HUD_PANEL(STRAFEHUD, HUD_StrafeHUD, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME ) // STRAFEHUD
REGISTER_HUD_PANEL(PICKUP, HUD_Pickup, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME ) // PICKUP
-// always add new panels to the end of list
+REGISTER_HUD_PANEL(CHECKPOINTS, HUD_Checkpoints, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME ) // CHECKPOINTS
+// always add new panels to the end of list and add a comment in the form of
+// "// Panel Name (#nr)" with the relative panel nr in your main panelname.qc
// Because calling lots of functions in QC apparently cuts fps in half on many machines:
// ----------------------
#include <client/hud/panel/ammo.qc>
#include <client/hud/panel/centerprint.qc>
#include <client/hud/panel/chat.qc>
+#include <client/hud/panel/checkpoints.qc>
#include <client/hud/panel/engineinfo.qc>
#include <client/hud/panel/healtharmor.qc>
#include <client/hud/panel/infomessages.qc>
#include <client/hud/panel/ammo.qh>
#include <client/hud/panel/centerprint.qh>
#include <client/hud/panel/chat.qh>
+#include <client/hud/panel/checkpoints.qh>
#include <client/hud/panel/engineinfo.qh>
#include <client/hud/panel/healtharmor.qh>
#include <client/hud/panel/infomessages.qh>
--- /dev/null
+#include "checkpoints.qh"
+#include "racetimer.qh"
+#include "physics.qh"
+
+#include <common/gamemodes/gamemode/race/race.qh>
+#include <client/draw.qh>
+#include <common/ent_cs.qh>
+
+// Checkpoints (#27)
+
+void HUD_Checkpoints_Export(int fh)
+{
+ // allow saving cvars that aesthetically change the panel into hud skin files
+ HUD_Write_Cvar("hud_panel_checkpoints_align");
+ HUD_Write_Cvar("hud_panel_checkpoints_flip");
+ HUD_Write_Cvar("hud_panel_checkpoints_fontscale");
+}
+
+const float CHECKPOINTS_SPACING = 0.25;
+const float CHECKPOINTS_BASE_SIZE = 0.75;
+
+string demolines[10];
+
+vector Checkpoints_drawstring(string s, vector pos, vector sz, float a, vector fontsize)
+{
+ getWrappedLine_remaining = s;
+ const float align = bound(0, autocvar_hud_panel_checkpoints_align, 1);
+ float offset = 0;
+ if (autocvar_hud_panel_checkpoints_flip)
+ {
+ const string s_original = s;
+ do
+ {
+ s = getWrappedLine(sz.x - offset, fontsize, stringwidth_colors);
+ if (autocvar_hud_panel_checkpoints_align)
+ offset = (sz.x - stringwidth_colors(s, fontsize) - offset) * align;
+ pos.y -= fontsize.y;
+ offset = fontsize.x;
+ }
+ while (getWrappedLine_remaining);
+
+ getWrappedLine_remaining = s_original;
+ offset = 0;
+ }
+ const float old_pos_y = pos.y;
+
+ do
+ {
+ s = getWrappedLine(sz.x - offset, fontsize, stringwidth_colors);
+ if (autocvar_hud_panel_checkpoints_align)
+ offset = (sz.x - stringwidth_colors(s, fontsize) - offset) * align;
+ drawcolorcodedstring(pos + eX * offset, s, fontsize, a, DRAWFLAG_NORMAL);
+ pos.y += fontsize.y;
+ offset = fontsize.x;
+ }
+ while (getWrappedLine_remaining);
+
+ if (autocvar_hud_panel_checkpoints_flip)
+ {
+ pos.y = old_pos_y;
+ pos.y -= CHECKPOINTS_SPACING * fontsize.y;
+ }
+ else
+ pos.y += CHECKPOINTS_SPACING * fontsize.y;
+
+ return pos;
+}
+
+vector Checkpoints_Draw(int end, vector pos, vector fontsize, vector rs_fontsize)
+{
+ string s;
+ for (int j = end; j >= 0; --j)
+ {
+ s = autocvar__hud_configure ? demolines[j] : race_checkpoint_splits[j];
+ if (s == "")
+ continue;
+ pos = Checkpoints_drawstring(s, pos, panel_size, panel_fg_alpha, fontsize);
+ if (autocvar_hud_panel_checkpoints_flip) // now check if the next line can be shown (fit)
+ {
+ if (pos.y < panel_pos.y)
+ break;
+ }
+ else
+ {
+ if (pos.y > panel_pos.y + panel_size.y - rs_fontsize.y)
+ break;
+ }
+ }
+ return pos;
+}
+
+void HUD_Checkpoints()
+{
+ if (!autocvar__hud_configure)
+ {
+ if (!autocvar_hud_panel_checkpoints) return;
+ }
+
+ HUD_Panel_LoadCvars();
+
+ if (autocvar_hud_panel_checkpoints_dynamichud)
+ HUD_Scale_Enable();
+ else
+ HUD_Scale_Disable();
+ HUD_Panel_DrawBg();
+
+ if (panel_bg_padding)
+ {
+ panel_pos += '1 1 0' * panel_bg_padding;
+ panel_size -= '2 2 0' * panel_bg_padding;
+ }
+
+ vector pos = panel_pos;
+ if (autocvar_hud_panel_checkpoints_flip)
+ pos.y += panel_size.y;
+
+ const vector rs_fontsize = hud_fontsize * CHECKPOINTS_BASE_SIZE;
+ const vector fontsize = autocvar_hud_panel_checkpoints_fontscale > 0.125 ? rs_fontsize * autocvar_hud_panel_checkpoints_fontscale : rs_fontsize;
+
+ int i;
+ if (!autocvar__hud_configure)
+ {
+ // show up to race_nextcheckpoint (not including) or everything if you are before start (0 or 254)
+ // (except race_laptime != 0 for race, means next is start+finish so don't show previous lap finish)
+ if (race_checkpoint != 0 && race_checkpoint != 254) // middle of run/race
+ i = race_checkpoint;
+ else if (ISGAMETYPE(RACE) && race_nextcheckpoint == 0) // before start, but on race, so don't keep old finish visible
+ i = 253;
+ else // before start, not on race (cts), keep old run cps visible
+ i = 255;
+ }
+ else
+ {
+ const string units_text = autocvar_cl_race_cptimes_showspeed_unit ? GetSpeedUnit(autocvar_hud_speed_unit) : "";
+ const float speed_conv_f = GetSpeedUnitFactor(autocvar_hud_speed_unit);
+ for (i = 0; i < 4; ++i)
+ {
+ string timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(18.7 + i * 5.33), false);
+ string time_split = i == 0 ? "+0.39" : i == 1 ? "+0.0" : i == 2 ? "-0.14" : "-0.08";
+ string col = i == 0 ? "^1" : i == 1 ? "^3" : "^2";
+ float speed_split = speed_conv_f * (1086 + i * 51);
+ float speed_diff = speed_conv_f * (i == 0 ? -34 : i == 1 ? 86 : i == 2 ? 25 : 0);
+ string speed_color = rgb_to_hexcolor(i == 0 ? autocvar_hud_progressbar_acceleration_neg_color : autocvar_hud_progressbar_acceleration_color);
+ if (i == 3)
+ speed_color = "^3";
+ demolines[i] = sprintf(strcat("%s %s", _("Checkpoint %d"), " (%s) ^7%d%s %s"), timestr, col, i+1, time_split, speed_split, units_text, sprintf("%s(%+d%s)", speed_color, speed_diff, units_text));
+ }
+ for (; i < 10; ++i) // iust draw 10 for configuring the HUD
+ demolines[i] = sprintf(strcat("%s ^7", _("Checkpoint %d"), " ^7%d%s"), TIME_ENCODED_TOSTRING(TIME_ENCODE(i*9.37), false), i+1, (1100 + i*63) * speed_conv_f, units_text);
+ --i;
+ }
+
+ pos = Checkpoints_Draw(i, pos, fontsize, rs_fontsize);
+}
--- /dev/null
+#pragma once
+#include "../panel.qh"
+
+bool autocvar_hud_panel_checkpoints = true;
+bool autocvar_hud_panel_checkpoints_dynamichud = true;
+bool autocvar_hud_panel_checkpoints_flip = false;
+bool autocvar_hud_panel_checkpoints_align = true;
+float autocvar_hud_panel_checkpoints_fontscale = 1;
#include "infomessages.qh"
-#include "racetimer.qh" // for race_checkpoint_splits
-#include <common/gamemodes/gamemode/race/race.qh> // for ISGAMETYPE(RACE)
#include <client/draw.qh>
#include <common/ent_cs.qh>
InfoMessage(s);
}
}
- if(autocvar_cl_race_checkpoint_splits_hud && !spectatee_status) {
- int lines[6];
- int ln = 5;
- // show up to race_nextcheckpoint (not including) or everything
- // if you are before start (0 or 254)
- // (except race_laptime != 0 for race, means next is
- // start+finish so don't show previous lap finish)
- int i;
- if (race_checkpoint != 0 && race_checkpoint != 254)
- { // middle of run/race
- i = race_checkpoint;
- }
- else if (ISGAMETYPE(RACE) && race_nextcheckpoint == 0)
- { // before start, but on race, so don't keep old finish visible
- i = 253;
- }
- else
- { // before start, not on race (cts), keep old run cps visible
- i = 255;
- }
- for (; ln >= 0 && i >= 0; --i)
- {
- if (race_checkpoint_splits[i])
- {
- lines[ln] = i;
- --ln;
- }
- }
- for (int j = 0; j < 6; ++j)
- InfoMessage(race_checkpoint_splits[lines[j]]);
- }
}
else
{
string racetimer_checkpoint_comparison;
string racetimer_checkpoint_time;
bool racetimer_have_stored_splits;
+float racetimer_have_stored_splits_player;
// Race timer (#8)
return strcat(col, sprintf("%s (%s %s)", cpname, timestr, strcat(theirname, col, lapstr)));
}
-void ClearRaceSplits() {
+void ClearCheckpointSplits(bool quiet)
+{
bool once = true;
- racetimer_lastcheckpoint = 0;
- for (int i = 0; i <= 255; ++i)
+ bool changed_player = (racetimer_have_stored_splits_player != (current_player + 1));
+ for (int i = 0; i < 256; ++i)
{
if(race_checkpoint_splits[i]
- && autocvar_cl_race_checkpoint_splits_console)
+ && autocvar_cl_race_checkpoint_splits_console
+ && !quiet)
{
if(once)
{
LOG_HELP(race_checkpoint_splits[i]);
}
strfree(race_checkpoint_splits[i]);
+ if(changed_player) race_checkpoint_splits_speed[i] = 0;
}
racetimer_have_stored_splits = false;
+ racetimer_lastcheckpoint = 0;
+ if(changed_player) racetimer_have_stored_splits_player = 0;
}
-void StoreRaceSplits(float race_checkpoint, string forcetime, string s) {
+void StoreCheckpointSplits(float race_checkpoint, string forcetime, string s)
+{
// store checkpoint splits string for later printing
- if (!entcs_IsSpectating(player_localnum))
- {
- // 0 or 255 go to 255 as finish, strcpy does the free if needed
- strcpy(race_checkpoint_splits[race_checkpoint ? race_checkpoint : 255], (forcetime != "") ? sprintf("%s %s", forcetime, s) : s);
- }
+ if (racetimer_have_stored_splits && racetimer_have_stored_splits_player != (current_player + 1)) // we changed player
+ ClearCheckpointSplits(true);
+ // 0 or 255 go to 255 as finish, strcpy does the free if needed
+ strcpy(race_checkpoint_splits[race_checkpoint ? race_checkpoint : 255], (forcetime != "") ? sprintf("%s %s", forcetime, s) : s);
// cache
racetimer_lastcheckpoint = race_checkpoint;
strcpy(racetimer_checkpoint_comparison, s);
strcpy(racetimer_checkpoint_time, forcetime);
racetimer_have_stored_splits = true;
+ racetimer_have_stored_splits_player = (current_player + 1);
}
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 = strcat("^1", sprintf(_("Checkpoint %d"), 1), " (+15.42)");
+ float speed_conversion_factor = GetSpeedUnitFactor(autocvar_hud_speed_unit);
+ string units_text = autocvar_cl_race_cptimes_showspeed_unit ? GetSpeedUnit(autocvar_hud_speed_unit) : "";
+ s = strcat("^1", sprintf(_("Checkpoint %d"), 1), " (+15.42)", autocvar_cl_race_cptimes_showspeed ? sprintf(" ^7%d%s %s(%+d%s)", 345 * speed_conversion_factor, units_text, rgb_to_hexcolor(autocvar_hud_progressbar_acceleration_color), 123 * speed_conversion_factor, units_text) : "");
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(_("PENALTY: %.1f (%s)"), 2, _("missing a checkpoint"));
{
if(race_checkpoint != 254 && race_time != 0)
{
- if (race_checkpoint == racetimer_lastcheckpoint)
+ if (race_checkpoint == racetimer_lastcheckpoint // same cp *and* player
+ && racetimer_have_stored_splits_player == (current_player + 1))
{
// use cached strings
s = racetimer_checkpoint_comparison;
}
else
{
+ if (racetimer_have_stored_splits && racetimer_have_stored_splits_player != (current_player + 1)) // we changed player
+ ClearCheckpointSplits(true);
+
// build checkpoint split strings
if(race_time && race_previousbesttime)
s = MakeRaceString(race_checkpoint, TIME_DECODE(race_time) - TIME_DECODE(race_previousbesttime), 0, ((race_mypreviousbesttime) ? TIME_DECODE(race_time) - TIME_DECODE(race_mypreviousbesttime) : 0), 0, race_previousbestname);
{
race_checkpoint_splits_speed[race_checkpoint] = speed;
}
-
}
if(race_time)
forcetime = TIME_ENCODED_TOSTRING(race_time, false);
- StoreRaceSplits(race_checkpoint, forcetime, s);
+ StoreCheckpointSplits(race_checkpoint, forcetime, s);
}
}
else
{
// clean cp splits on start
if(racetimer_have_stored_splits && race_time == 0)
- ClearRaceSplits();
+ ClearCheckpointSplits(false);
}
}
else
else
{
if(racetimer_have_stored_splits && (race_time == 0 || time < STAT(GAMESTARTTIME)))
- ClearRaceSplits();
+ ClearCheckpointSplits(false);
if(race_mycheckpointtime)
{
cvar_settemp("_scoreboard_team_selection_available", "1");
cvar_set("_scoreboard_team_selection", "0"); // in case it has been left set to 1
+ // XONRELEASE: default values for <= 0.8.6 can be removed after next release
+ registercvar("hud_panel_checkpoints_pos", "0.700000 0.190000");
+ registercvar("hud_panel_checkpoints_size", "0.250000 0.170000");
+
gametype = NULL;
postinit = false;
// or the release after it to support the old-stable release
// this can't be done now as players would lack these from their configs then
bool autocvar_cl_race_checkpoint_splits_console;
-bool autocvar_cl_race_checkpoint_splits_hud;
bool autocvar_cl_race_cptimes_showspeed = false;
bool autocvar_cl_race_cptimes_showspeed_unit = true;
float autocvar_cl_race_cptimes_namesize = 10;
#else
AUTOCVAR_SAVE(cl_race_checkpoint_splits_console, bool, 1, "print checkpoint splits to console");
-AUTOCVAR_SAVE(cl_race_checkpoint_splits_hud, bool, 1, "show race checkpoint splits on HUD in infomessages");
AUTOCVAR_SAVE(cl_race_cptimes_showspeed, bool, 0, "show race checkpoint speed (NOTE: ignores vertical speed)");
AUTOCVAR_SAVE(cl_race_cptimes_showspeed_unit, bool, 1, "show race checkpoint speed units");
AUTOCVAR_SAVE(cl_race_cptimes_namesize, float, 10, "maximum player name length in race checkpoint messages");
#include <menu/xonotic/dialog_hudpanel_ammo.qc>
#include <menu/xonotic/dialog_hudpanel_centerprint.qc>
#include <menu/xonotic/dialog_hudpanel_chat.qc>
+#include <menu/xonotic/dialog_hudpanel_checkpoints.qc>
#include <menu/xonotic/dialog_hudpanel_engineinfo.qc>
#include <menu/xonotic/dialog_hudpanel_healtharmor.qc>
#include <menu/xonotic/dialog_hudpanel_infomessages.qc>
#include <menu/xonotic/dialog_hudpanel_ammo.qh>
#include <menu/xonotic/dialog_hudpanel_centerprint.qh>
#include <menu/xonotic/dialog_hudpanel_chat.qh>
+#include <menu/xonotic/dialog_hudpanel_checkpoints.qh>
#include <menu/xonotic/dialog_hudpanel_engineinfo.qh>
#include <menu/xonotic/dialog_hudpanel_healtharmor.qh>
#include <menu/xonotic/dialog_hudpanel_infomessages.qh>
--- /dev/null
+#include "dialog_hudpanel_checkpoints.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "slider.qh"
+#include "radiobutton.qh"
+
+void XonoticHUDCheckpointsDialog_fill(entity me)
+{
+ entity e;
+ string panelname = "checkpoints";
+
+ dialog_hudpanel_main_checkbox(me, panelname);
+
+ dialog_hudpanel_main_settings(me, panelname);
+
+ me.TR(me);
+ me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, _("Font scale:")));
+ me.TD(me, 1, 2.6, e = makeXonoticSlider(0.8, 2, 0.1, "hud_panel_checkpoints_fontscale"));
+ me.TR(me);
+ me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Align:")));
+ me.TD(me, 1, 1, e = makeXonoticRadioButton(3, "hud_panel_checkpoints_align", "0", _("Left")));
+ me.TD(me, 1, 1, e = makeXonoticRadioButton(3, "hud_panel_checkpoints_align", "0.5", _("Center")));
+ me.TD(me, 1, 1, e = makeXonoticRadioButton(3, "hud_panel_checkpoints_align", "1", _("Right")));
+ me.TR(me);
+ me.TD(me, 1, 4, e = makeXonoticCheckBox(0, "hud_panel_checkpoints_flip", _("Flip checkpoint order")));
+}
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDCheckpointsDialog, XonoticRootDialog)
+ METHOD(XonoticHUDCheckpointsDialog, fill, void(entity));
+ ATTRIB(XonoticHUDCheckpointsDialog, title, string, _("Checkpoints Panel"));
+ ATTRIB(XonoticHUDCheckpointsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT);
+ ATTRIB(XonoticHUDCheckpointsDialog, intendedWidth, float, 0.4);
+ ATTRIB(XonoticHUDCheckpointsDialog, rows, float, 15.5);
+ ATTRIB(XonoticHUDCheckpointsDialog, columns, float, 4);
+ ATTRIB(XonoticHUDCheckpointsDialog, name, string, "HUDcheckpoints");
+ ATTRIB(XonoticHUDCheckpointsDialog, requiresConnection, float, true);
+ENDCLASS(XonoticHUDCheckpointsDialog)
#include "dialog_hudpanel_powerups.qh"
#include "dialog_hudpanel_pressedkeys.qh"
#include "dialog_hudpanel_racetimer.qh"
+#include "dialog_hudpanel_checkpoints.qh"
#include "dialog_hudpanel_radar.qh"
#include "dialog_hudpanel_score.qh"
#include "dialog_hudpanel_timer.qh"
i.configureDialog(i);
me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+ i = NEW(XonoticHUDCheckpointsDialog);
+ i.configureDialog(i);
+ me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
+
i = NEW(XonoticHUDRadarDialog);
i.configureDialog(i);
me.addItemRightCentered(me, i, i.intendedWidth * eX + i.intendedHeight * eY, SKINALPHAS_MAINMENU_z);
seta cl_race_cptimes_showspeed_unit 1 "show race checkpoint speed units"
seta cl_race_cptimes_namesize 10 "maximum length of player names in race checkpoint messages"
seta cl_race_checkpoint_splits_console 1 "print race checkpoint splits to console"
-seta cl_race_checkpoint_splits_hud 1 "show race checkpoint splits on HUD in infomessages"
seta cl_autoswitch_cts -1 "\"-1\" = fallback to the behavior of cl_autoswitch, \"0\" = never autoswitch in CTS, \"1\" = always autoswitch in CTS (regardless of weapon priority)"