]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Move checkpoint splits from infomessages to their own HUD panel
authorDes - <gitlab@damianv.com.ar>
Tue, 13 May 2025 08:06:11 +0000 (08:06 +0000)
committerbones_was_here <bones_was_here@xonotic.au>
Tue, 13 May 2025 08:06:11 +0000 (18:06 +1000)
23 files changed:
_hud_common.cfg
_hud_descriptions.cfg
hud_luma.cfg
hud_luminos.cfg
hud_luminos_minimal.cfg
hud_luminos_minimal_xhair.cfg
hud_luminos_old.cfg
hud_nexuiz.cfg
qcsrc/client/hud/hud.qh
qcsrc/client/hud/panel/_mod.inc
qcsrc/client/hud/panel/_mod.qh
qcsrc/client/hud/panel/checkpoints.qc [new file with mode: 0644]
qcsrc/client/hud/panel/checkpoints.qh [new file with mode: 0644]
qcsrc/client/hud/panel/infomessages.qc
qcsrc/client/hud/panel/racetimer.qc
qcsrc/client/main.qc
qcsrc/client/main.qh
qcsrc/menu/xonotic/_mod.inc
qcsrc/menu/xonotic/_mod.qh
qcsrc/menu/xonotic/dialog_hudpanel_checkpoints.qc [new file with mode: 0644]
qcsrc/menu/xonotic/dialog_hudpanel_checkpoints.qh [new file with mode: 0644]
qcsrc/menu/xonotic/mainwindow.qc
xonotic-client.cfg

index d574fcb0ce7197bef3ecfddaab5e91405a132ce7..332994700c6fe9682b9469baec2063c8e9a8f102 100644 (file)
@@ -32,6 +32,7 @@ seta hud_panel_timer            1 "enable this panel"
 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"
@@ -63,6 +64,7 @@ seta hud_panel_timer_dynamichud            1 "apply the dynamic HUD effects to t
 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"
index 56c1e9d7ca63526dc9e924504acc08e47887b8f0..ba05a968cfd7a293ce482c0b70d59d70d6f3f36e 100644 (file)
@@ -177,6 +177,18 @@ seta hud_panel_racetimer_bg_alpha "" "if set to something else than \"\" = overr
 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"
index 579a5bd7a89c7bff1b5f10bab4f6b316eb44647e..c947e10f4af23a981b8f32a672741330e40243e4 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.86 0.35 0"
 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"
@@ -178,6 +178,18 @@ seta hud_panel_racetimer_bg_alpha ""
 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"
index 362dbf5e52d53dbbd297981edf7a08ae9f6ec9d7..3e32a8358684df00b544031ee896ad7618730c6a 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 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"
@@ -178,6 +178,18 @@ seta hud_panel_racetimer_bg_alpha ""
 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"
index 8fd1d6892b8717deb3b8a80936c30f52e7231b55..49544db643088526dd3368fc7330456776bc258c 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 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"
@@ -178,6 +178,18 @@ seta hud_panel_racetimer_bg_alpha ""
 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 ""
index ff7c94328e47e2818011055b771677d9937d7db9..c3ac4684f4b8b04329be26dcd2206349e4f41037 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 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"
@@ -178,6 +178,18 @@ seta hud_panel_racetimer_bg_alpha ""
 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 ""
index ff9661362b3ea89233356480c0489ebd0d095f53..66e0f65dbbf25b0c18082b63290e9ddba213dfa9 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 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"
@@ -178,6 +178,18 @@ seta hud_panel_racetimer_bg_alpha ""
 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 ""
index 5c50c9adfcb942a2b15d486e16b3bb43875ab185..846e98bba71d2156cc3ece7ad1d39053312a0611 100644 (file)
@@ -30,7 +30,7 @@ seta hud_progressbar_acceleration_neg_color "0.125 0.25 0.5"
 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"
@@ -178,6 +178,18 @@ seta hud_panel_racetimer_bg_alpha ""
 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 ""
index d1daf419760a13ebd4dab8c22b0049eecb3b711c..edd34e87c46da04adb60bafebc66af8868a5a682 100644 (file)
@@ -278,7 +278,9 @@ REGISTER_HUD_PANEL(QUICKMENU,       HUD_QuickMenu,      PANEL_CONFIG_MAIN
 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:
 // ----------------------
index 73f61c3a71b76200ae50483f4d56fae14d4be620..8a9d6baeb6acaa09d70711cbe1acd1e2497b1921 100644 (file)
@@ -2,6 +2,7 @@
 #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>
index 4a6ca59c84996337a5203b465342ffa5008b5517..097ff4babe2487792edb6a4f8900b46afcca4021 100644 (file)
@@ -2,6 +2,7 @@
 #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>
diff --git a/qcsrc/client/hud/panel/checkpoints.qc b/qcsrc/client/hud/panel/checkpoints.qc
new file mode 100644 (file)
index 0000000..f9cba39
--- /dev/null
@@ -0,0 +1,154 @@
+#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);
+}
diff --git a/qcsrc/client/hud/panel/checkpoints.qh b/qcsrc/client/hud/panel/checkpoints.qh
new file mode 100644 (file)
index 0000000..5151789
--- /dev/null
@@ -0,0 +1,8 @@
+#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;
index 5866271ef97c6944f64fd22aaece9099bc765190..2774d64983b31eec4325821072f0014c74ac0831 100644 (file)
@@ -1,6 +1,4 @@
 #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>
@@ -230,37 +228,6 @@ void HUD_InfoMessages()
                                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
        {
index 3ce7e55efc6429c14dae8b309a2f87af611a57e1..91e4d3fec0dfd407047d11ef8c69fcc328c90027 100644 (file)
@@ -9,6 +9,7 @@ float racetimer_lastcheckpoint;
 string racetimer_checkpoint_comparison;
 string racetimer_checkpoint_time;
 bool racetimer_have_stored_splits;
+float racetimer_have_stored_splits_player;
 
 // Race timer (#8)
 
@@ -107,13 +108,15 @@ string MakeRaceString(int cp, float mytime, float theirtime, float othertime, fl
                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)
                        {
@@ -123,23 +126,27 @@ void ClearRaceSplits() {
                        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 ()
@@ -197,7 +204,9 @@ 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"));
@@ -214,7 +223,8 @@ void HUD_RaceTimer ()
                {
                        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;
@@ -222,6 +232,9 @@ void HUD_RaceTimer ()
                                }
                                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);
@@ -250,19 +263,18 @@ void HUD_RaceTimer ()
                                                {
                                                        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
@@ -320,7 +332,7 @@ void HUD_RaceTimer ()
        else
        {
                if(racetimer_have_stored_splits && (race_time == 0 || time < STAT(GAMESTARTTIME)))
-                       ClearRaceSplits();
+                       ClearCheckpointSplits(false);
 
                if(race_mycheckpointtime)
                {
index e2a192dfb263e05581701a045dbcb33365bb3f2c..d534b891083d0fd4601f05b21bf1e9b71bfecb5b 100644 (file)
@@ -109,6 +109,10 @@ void CSQC_Init(float apilevel, string enginename, float engineversion)
                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;
index 9a80347dc832911600b6697df452081a3b3f4616..111aa87f64ee6fb100159fa84f2b92af41031944 100644 (file)
@@ -17,13 +17,11 @@ bool autocvar_developer_csqcentities;
 // 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");
index 1382a751956b456f28f8504088acae3b45ffac84..b1de3b47fbfe25470ea8b67d75adb58ec409c511 100644 (file)
@@ -24,6 +24,7 @@
 #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>
index ab2dd6c5b288a77297fe3c844e7ed267791d6aba..18ac74a5e0d4e5e32350bc7402cf7da8431a2ac3 100644 (file)
@@ -24,6 +24,7 @@
 #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>
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_checkpoints.qc b/qcsrc/menu/xonotic/dialog_hudpanel_checkpoints.qc
new file mode 100644 (file)
index 0000000..be6ac2a
--- /dev/null
@@ -0,0 +1,27 @@
+#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")));
+}
diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_checkpoints.qh b/qcsrc/menu/xonotic/dialog_hudpanel_checkpoints.qh
new file mode 100644 (file)
index 0000000..621470e
--- /dev/null
@@ -0,0 +1,13 @@
+#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)
index 039d3452fd0038762f728159950f26807c1ee9ae..131dfed582b637f2e87a37ba97bc7382f117c9bf 100644 (file)
@@ -15,6 +15,7 @@
 #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"
@@ -135,6 +136,10 @@ void MainWindow_configureMainWindow(entity me)
        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);
index 7dd42f8b504cbdbbdccbfcd2d9a40d0a8820ad5f..0cb0370f00b3057beaa939acaf1d228343a6f4ae 100644 (file)
@@ -733,7 +733,6 @@ seta cl_race_cptimes_showspeed 0 "show race checkpoint speed (NOTE: ignores vert
 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)"