seta hud_panel_radar 1 "enable this panel, 2 = also enable in non-teambased gamemodes"
seta hud_panel_score 1 "enable this panel"
seta hud_panel_racetimer 1 "enable this panel"
+seta hud_panel_racesplits 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_racesplits_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_racesplits_pos "" "position of this base of the panel"
+seta hud_panel_racesplits_size "" "size of this panel"
+seta hud_panel_racesplits_bg "" "if set to something else than \"\" = override default background"
+seta hud_panel_racesplits_bg_color "" "if set to something else than \"\" = override default panel background color"
+seta hud_panel_racesplits_bg_color_team "" "override panel color with team color in team based games"
+seta hud_panel_racesplits_bg_alpha "" "if set to something else than \"\" = override default panel background alpha"
+seta hud_panel_racesplits_bg_border "" "if set to something else than \"\" = override default size of border around the background"
+seta hud_panel_racesplits_bg_padding "" "if set to something else than \"\" = override default padding of contents from border"
+seta hud_panel_racesplits_lines "" "amount of lines to show, max 50, font size will adapt accordingly"
+seta hud_panel_racesplits_flip "" "1 = align the items to the right"
+
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_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_racesplits_pos "0.700000 0.190000"
+seta hud_panel_racesplits_size "0.250000 0.170000"
+seta hud_panel_racesplits_bg ""
+seta hud_panel_racesplits_bg_color ""
+seta hud_panel_racesplits_bg_color_team ""
+seta hud_panel_racesplits_bg_alpha ""
+seta hud_panel_racesplits_bg_border ""
+seta hud_panel_racesplits_bg_padding ""
+seta hud_panel_racesplits_lines "8"
+seta hud_panel_racesplits_flip "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_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_racesplits_pos "0.700000 0.190000"
+seta hud_panel_racesplits_size "0.250000 0.170000"
+seta hud_panel_racesplits_bg ""
+seta hud_panel_racesplits_bg_color ""
+seta hud_panel_racesplits_bg_color_team ""
+seta hud_panel_racesplits_bg_alpha ""
+seta hud_panel_racesplits_bg_border ""
+seta hud_panel_racesplits_bg_padding ""
+seta hud_panel_racesplits_lines "8"
+seta hud_panel_racesplits_flip "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_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_racesplits_pos "0.700000 0.190000"
+seta hud_panel_racesplits_size "0.250000 0.170000"
+seta hud_panel_racesplits_bg ""
+seta hud_panel_racesplits_bg_color ""
+seta hud_panel_racesplits_bg_color_team ""
+seta hud_panel_racesplits_bg_alpha ""
+seta hud_panel_racesplits_bg_border ""
+seta hud_panel_racesplits_bg_padding ""
+seta hud_panel_racesplits_lines "8"
+seta hud_panel_racesplits_flip "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_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_racesplits_pos "0.700000 0.190000"
+seta hud_panel_racesplits_size "0.250000 0.170000"
+seta hud_panel_racesplits_bg ""
+seta hud_panel_racesplits_bg_color ""
+seta hud_panel_racesplits_bg_color_team ""
+seta hud_panel_racesplits_bg_alpha ""
+seta hud_panel_racesplits_bg_border ""
+seta hud_panel_racesplits_bg_padding ""
+seta hud_panel_racesplits_lines "8"
+seta hud_panel_racesplits_flip "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_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_racesplits_pos "0.700000 0.190000"
+seta hud_panel_racesplits_size "0.250000 0.170000"
+seta hud_panel_racesplits_bg ""
+seta hud_panel_racesplits_bg_color ""
+seta hud_panel_racesplits_bg_color_team ""
+seta hud_panel_racesplits_bg_alpha ""
+seta hud_panel_racesplits_bg_border ""
+seta hud_panel_racesplits_bg_padding ""
+seta hud_panel_racesplits_lines "6"
+seta hud_panel_racesplits_flip "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_panel_racetimer_bg_border ""
seta hud_panel_racetimer_bg_padding ""
+seta hud_panel_racesplits_pos "0.700000 0.190000"
+seta hud_panel_racesplits_size "0.250000 0.170000"
+seta hud_panel_racesplits_bg ""
+seta hud_panel_racesplits_bg_color ""
+seta hud_panel_racesplits_bg_color_team ""
+seta hud_panel_racesplits_bg_alpha ""
+seta hud_panel_racesplits_bg_border ""
+seta hud_panel_racesplits_bg_padding ""
+seta hud_panel_racesplits_lines "6"
+seta hud_panel_racesplits_flip "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(RADAR, HUD_Radar, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME ) // RADAR
REGISTER_HUD_PANEL(SCORE, HUD_Score, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME ) // SCORE
REGISTER_HUD_PANEL(RACETIMER, HUD_RaceTimer, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME ) // RACETIMER
+REGISTER_HUD_PANEL(RACESPLITS, HUD_RaceSplits, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME ) // RACESPLITS
REGISTER_HUD_PANEL(VOTE, HUD_Vote, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_MINIGAME | PANEL_SHOW_MAPVOTE | PANEL_SHOW_WITH_SB) // VOTE
REGISTER_HUD_PANEL(MODICONS, HUD_ModIcons, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME | PANEL_SHOW_WITH_SB) // MODICONS
REGISTER_HUD_PANEL(PRESSEDKEYS, HUD_PressedKeys, PANEL_CONFIG_MAIN | PANEL_CONFIG_CANBEOFF, PANEL_SHOW_MAINGAME ) // PRESSEDKEYS
#include <client/hud/panel/powerups.qc>
#include <client/hud/panel/pressedkeys.qc>
#include <client/hud/panel/quickmenu.qc>
+#include <client/hud/panel/racesplits.qc>
#include <client/hud/panel/racetimer.qc>
#include <client/hud/panel/radar.qc>
#include <client/hud/panel/score.qc>
#include <client/hud/panel/powerups.qh>
#include <client/hud/panel/pressedkeys.qh>
#include <client/hud/panel/quickmenu.qh>
+#include <client/hud/panel/racesplits.qh>
#include <client/hud/panel/racetimer.qh>
#include <client/hud/panel/radar.qh>
#include <client/hud/panel/score.qh>
#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
{
--- /dev/null
+#include "racesplits.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>
+
+
+void HUD_RaceSplits_Export(int fh)
+{
+ // allow saving cvars that aesthetically change the panel into hud skin files
+ HUD_Write_Cvar("hud_panel_racesplits_flip");
+}
+
+vector RaceSplits_drawstring(string s, vector pos, vector sz, float a, vector fontsize)
+{
+ getWrappedLine_remaining = s;
+ float offset = 0;
+ while(getWrappedLine_remaining)
+ {
+ s = getWrappedLine(sz.x - offset, fontsize, stringwidth_colors);
+ if(autocvar_hud_panel_racesplits_flip)
+ offset = sz.x - stringwidth_colors(s, fontsize) - offset;
+ drawcolorcodedstring(pos + eX * offset, s, fontsize, a, DRAWFLAG_NORMAL);
+ pos.y += fontsize.y;
+ offset = fontsize.x;
+ }
+ pos.y += fontsize.y * 0.25;
+ return pos;
+}
+
+#define RaceSplit(s) MACRO_BEGIN \
+ pos = RaceSplits_drawstring(s, pos, mySize, panel_fg_alpha, fontsize); \
+MACRO_END
+
+void HUD_RaceSplits()
+{
+ if(!autocvar__hud_configure)
+ {
+ if(!autocvar_hud_panel_racesplits) return;
+ }
+
+ HUD_Panel_LoadCvars();
+ vector pos, mySize;
+ pos = panel_pos;
+ mySize = panel_size;
+
+ if (autocvar_hud_panel_racesplits_dynamichud)
+ HUD_Scale_Enable();
+ else
+ HUD_Scale_Disable();
+ HUD_Panel_DrawBg();
+ if(panel_bg_padding)
+ {
+ pos += '1 1 0' * panel_bg_padding;
+ mySize -= '2 2 0' * panel_bg_padding;
+ }
+
+ #define HUD_RACESPLITS_MAX_NRLINES 50 // feels like twice more than enough
+ int nrlines = autocvar_hud_panel_racesplits_lines <= HUD_RACESPLITS_MAX_NRLINES ? autocvar_hud_panel_racesplits_lines : HUD_RACESPLITS_MAX_NRLINES;
+ vector fontsize = '0.8 1 0' * (mySize.y / (nrlines+2));
+ string s;
+ if(!autocvar__hud_configure)
+ {
+ if(spectatee_status)
+ {
+ // RaceSplit(_("Splits not supported while spectating"));
+ }
+
+ if(autocvar_cl_race_checkpoint_splits_hud && !spectatee_status)
+ {
+ int mlines[HUD_RACESPLITS_MAX_NRLINES];
+ int ln = nrlines -1;
+ // 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])
+ {
+ mlines[ln] = i;
+ --ln;
+ }
+ }
+ for (int j = 0; j < nrlines; ++j)
+ RaceSplit(race_checkpoint_splits[mlines[j]]);
+ }
+ }
+ else
+ {
+ string col[4]; col[0] = "^7"; col[1] = "^1"; col[2] = "^3"; col[3] = "^2";
+ for (int j = 0; j < nrlines; ++j)
+ // strcat to use same string as racetimer does, ugly but it's just for hud_configure
+ RaceSplit(sprintf(strcat("%s",_("Intermediate %d"),"..."), col[j%4], j+1));
+ }
+}
--- /dev/null
+#pragma once
+#include "../panel.qh"
+
+bool autocvar_hud_panel_racesplits;
+bool autocvar_hud_panel_racesplits_dynamichud = false;
+bool autocvar_hud_panel_racesplits_flip;
+int autocvar_hud_panel_racesplits_lines;
+
#include <common/animdecide.qc>
#include <common/campaign_file.qc>
#include <common/campaign_setup.qc>
+#include <common/checkextension.qc>
#include <common/ent_cs.qc>
#include <common/mapinfo.qc>
#include <common/net_notice.qc>
#include <common/animdecide.qh>
#include <common/campaign_file.qh>
#include <common/campaign_setup.qh>
+#include <common/checkextension.qh>
#include <common/ent_cs.qh>
#include <common/mapinfo.qh>
#include <common/net_notice.qh>
#include <menu/xonotic/dialog_hudpanel_powerups.qc>
#include <menu/xonotic/dialog_hudpanel_pressedkeys.qc>
#include <menu/xonotic/dialog_hudpanel_quickmenu.qc>
+#include <menu/xonotic/dialog_hudpanel_racesplits.qc>
#include <menu/xonotic/dialog_hudpanel_racetimer.qc>
#include <menu/xonotic/dialog_hudpanel_radar.qc>
#include <menu/xonotic/dialog_hudpanel_score.qc>
#include <menu/xonotic/dialog_hudpanel_powerups.qh>
#include <menu/xonotic/dialog_hudpanel_pressedkeys.qh>
#include <menu/xonotic/dialog_hudpanel_quickmenu.qh>
+#include <menu/xonotic/dialog_hudpanel_racesplits.qh>
#include <menu/xonotic/dialog_hudpanel_racetimer.qh>
#include <menu/xonotic/dialog_hudpanel_radar.qh>
#include <menu/xonotic/dialog_hudpanel_score.qh>
--- /dev/null
+#include "dialog_hudpanel_racesplits.qh"
+
+#include "textlabel.qh"
+#include "checkbox.qh"
+#include "slider.qh"
+
+void XonoticHUDRaceSplitsDialog_fill(entity me)
+{
+ entity e;
+ string panelname = "racesplits";
+
+ dialog_hudpanel_main_checkbox(me, panelname);
+
+ dialog_hudpanel_main_settings(me, panelname);
+
+ me.TR(me);
+ me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Race Splits:")));
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_racesplits_flip", _("Flip align")));
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Splits to keep on screen:")));
+ me.TD(me, 1, 2.6, e = makeXonoticSlider(1, 50, 1, "hud_panel_racesplits_lines"));
+}
--- /dev/null
+#pragma once
+
+#include "rootdialog.qh"
+CLASS(XonoticHUDRaceSplitsDialog, XonoticRootDialog)
+ METHOD(XonoticHUDRaceSplitsDialog, fill, void(entity));
+ ATTRIB(XonoticHUDRaceSplitsDialog, title, string, _("Race Splits Panel"));
+ ATTRIB(XonoticHUDRaceSplitsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT);
+ ATTRIB(XonoticHUDRaceSplitsDialog, intendedWidth, float, 0.4);
+ ATTRIB(XonoticHUDRaceSplitsDialog, rows, float, 15.5);
+ ATTRIB(XonoticHUDRaceSplitsDialog, columns, float, 4);
+ ATTRIB(XonoticHUDRaceSplitsDialog, name, string, "HUDracesplits");
+ ATTRIB(XonoticHUDRaceSplitsDialog, requiresConnection, float, true);
+ENDCLASS(XonoticHUDRaceSplitsDialog)
#include "dialog_hudpanel_powerups.qh"
#include "dialog_hudpanel_pressedkeys.qh"
#include "dialog_hudpanel_racetimer.qh"
+#include "dialog_hudpanel_racesplits.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(XonoticHUDRaceSplitsDialog);
+ 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);