From: Des Date: Thu, 19 Sep 2024 15:43:39 +0000 (-0300) Subject: Add option to flip order of splits, rename old _flip to _align more common in other... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c5aa794d7fd9c0b449d49e9a198be905730cee8c;p=xonotic%2Fxonotic-data.pk3dir.git Add option to flip order of splits, rename old _flip to _align more common in other panels --- diff --git a/_hud_descriptions.cfg b/_hud_descriptions.cfg index b306d2116..8db185cdd 100644 --- a/_hud_descriptions.cfg +++ b/_hud_descriptions.cfg @@ -186,7 +186,8 @@ seta hud_panel_racesplits_bg_alpha "" "if set to something else than \"\" = over 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_racesplits_flip "" "order the list top to bottom instead of bottom to top" +seta hud_panel_racesplits_align "" "text alignment: 0 left, 1 right" seta hud_panel_vote_pos "" "position of this base of the panel" seta hud_panel_vote_size "" "size of this panel" diff --git a/hud_luma.cfg b/hud_luma.cfg index ee85f0467..360bcb285 100644 --- a/hud_luma.cfg +++ b/hud_luma.cfg @@ -187,7 +187,8 @@ 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_racesplits_flip "0" +seta hud_panel_racesplits_align "1" seta hud_panel_vote_pos "0.740000 0.690000" seta hud_panel_vote_size "0.190000 0.090000" diff --git a/hud_luminos.cfg b/hud_luminos.cfg index af5c75191..b34ee5a41 100644 --- a/hud_luminos.cfg +++ b/hud_luminos.cfg @@ -187,7 +187,8 @@ 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_racesplits_flip "0" +seta hud_panel_racesplits_align "1" seta hud_panel_vote_pos "0.720000 0.670000" seta hud_panel_vote_size "0.190000 0.090000" diff --git a/hud_luminos_minimal.cfg b/hud_luminos_minimal.cfg index 44f643707..fa55d0bf4 100644 --- a/hud_luminos_minimal.cfg +++ b/hud_luminos_minimal.cfg @@ -187,7 +187,8 @@ 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_racesplits_flip "0" +seta hud_panel_racesplits_align "1" seta hud_panel_vote_pos "0.720000 0.890000" seta hud_panel_vote_size "0.170000 0.110000" diff --git a/hud_luminos_minimal_xhair.cfg b/hud_luminos_minimal_xhair.cfg index e5bc48492..b4e54c65d 100644 --- a/hud_luminos_minimal_xhair.cfg +++ b/hud_luminos_minimal_xhair.cfg @@ -187,7 +187,8 @@ 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_racesplits_flip "0" +seta hud_panel_racesplits_align "1" seta hud_panel_vote_pos "0.720000 0.890000" seta hud_panel_vote_size "0.170000 0.110000" diff --git a/hud_luminos_old.cfg b/hud_luminos_old.cfg index 2ec1d347a..31719c868 100644 --- a/hud_luminos_old.cfg +++ b/hud_luminos_old.cfg @@ -187,7 +187,8 @@ 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_racesplits_flip "0" +seta hud_panel_racesplits_align "1" seta hud_panel_vote_pos "0.020000 0.650000" seta hud_panel_vote_size "0.230000 0.110000" diff --git a/hud_nexuiz.cfg b/hud_nexuiz.cfg index a40409302..37fa2efac 100644 --- a/hud_nexuiz.cfg +++ b/hud_nexuiz.cfg @@ -187,7 +187,8 @@ 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_racesplits_flip "0" +seta hud_panel_racesplits_align "1" seta hud_panel_vote_pos "0.690000 0.750000" seta hud_panel_vote_size "0.300000 0.100000" diff --git a/qcsrc/client/hud/panel/racesplits.qc b/qcsrc/client/hud/panel/racesplits.qc index a0ffb3a68..269deca1e 100644 --- a/qcsrc/client/hud/panel/racesplits.qc +++ b/qcsrc/client/hud/panel/racesplits.qc @@ -10,6 +10,7 @@ void HUD_RaceSplits_Export(int fh) { // allow saving cvars that aesthetically change the panel into hud skin files + HUD_Write_Cvar("hud_panel_racesplits_align"); HUD_Write_Cvar("hud_panel_racesplits_flip"); HUD_Write_Cvar("hud_panel_racesplits_lines"); } @@ -21,13 +22,13 @@ vector RaceSplits_drawstring(string s, vector pos, vector sz, float a, vector fo while(getWrappedLine_remaining) { s = getWrappedLine(sz.x - offset, fontsize, stringwidth_colors); - if(autocvar_hud_panel_racesplits_flip) + if(autocvar_hud_panel_racesplits_align) 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; + pos.y += fontsize.y * (offset ? 0.25 : 1.25); return pos; } @@ -60,7 +61,9 @@ void HUD_RaceSplits() #define HUD_RACESPLITS_MAX_NRLINES 50 // feels like twice more than enough int nrlines = min(HUD_RACESPLITS_MAX_NRLINES, autocvar_hud_panel_racesplits_lines); - vector fontsize = '0.8 1 0' * (mySize.y / (nrlines+2)); + vector fontsize = '0.8 1 0' * (mySize.y / (nrlines*1.25)); + + string s; if(!autocvar__hud_configure) { @@ -92,13 +95,14 @@ void HUD_RaceSplits() } } for (int j = 0; j < nrlines; ++j) - RaceSplit(race_checkpoint_splits[mlines[j]]); + RaceSplit(race_checkpoint_splits[mlines[autocvar_hud_panel_racesplits_flip ? nrlines - 1 -j : j]]); } else { string units_text = autocvar_cl_race_cptimes_showspeed_unit ? GetSpeedUnit(autocvar_hud_speed_unit) : ""; float speed_conv_f = GetSpeedUnitFactor(autocvar_hud_speed_unit); int j; + string demolines[HUD_RACESPLITS_MAX_NRLINES]; for(j = 0; j < nrlines && j < 4; ++j) { string timestr = TIME_ENCODED_TOSTRING(TIME_ENCODE(18.7 + (j-1) * 5.33), false); @@ -109,10 +113,12 @@ void HUD_RaceSplits() string speed_color = rgb_to_hexcolor(j == 0 ? autocvar_hud_progressbar_acceleration_neg_color : autocvar_hud_progressbar_acceleration_color); if(j == 3) speed_color = "^3"; - RaceSplit(sprintf(strcat("%s %s", _("Intermediate %d"), " (%s) ^7%d%s %s"), timestr, col, j+1, time_split, speed_split, units_text, sprintf("%s(%+d%s)", speed_color, speed_diff, units_text))); + demolines[j] = sprintf(strcat("%s %s", _("Intermediate %d"), " (%s) ^7%d%s %s"), timestr, col, j+1, time_split, speed_split, units_text, sprintf("%s(%+d%s)", speed_color, speed_diff, units_text)); } for(; j < nrlines; ++j) - RaceSplit(sprintf(strcat("%s ^7", _("Intermediate %d"), " ^7%d%s"), TIME_ENCODED_TOSTRING(TIME_ENCODE(j*9.37), false), j+1, (1100 + j*63) * speed_conv_f, units_text)); + demolines[j] = sprintf(strcat("%s ^7", _("Intermediate %d"), " ^7%d%s"), TIME_ENCODED_TOSTRING(TIME_ENCODE(j*9.37), false), j+1, (1100 + j*63) * speed_conv_f, units_text); + for (int j = 0; j < nrlines; ++j) + RaceSplit(demolines[autocvar_hud_panel_racesplits_flip ? nrlines - 1 -j : j]); } } diff --git a/qcsrc/client/hud/panel/racesplits.qh b/qcsrc/client/hud/panel/racesplits.qh index 6f4f5b87f..4f4c5988e 100644 --- a/qcsrc/client/hud/panel/racesplits.qh +++ b/qcsrc/client/hud/panel/racesplits.qh @@ -4,5 +4,6 @@ bool autocvar_hud_panel_racesplits; bool autocvar_hud_panel_racesplits_dynamichud = false; bool autocvar_hud_panel_racesplits_flip; +bool autocvar_hud_panel_racesplits_align; int autocvar_hud_panel_racesplits_lines; diff --git a/qcsrc/menu/xonotic/dialog_hudpanel_racesplits.qc b/qcsrc/menu/xonotic/dialog_hudpanel_racesplits.qc index bbaa1924d..3a9836e8c 100644 --- a/qcsrc/menu/xonotic/dialog_hudpanel_racesplits.qc +++ b/qcsrc/menu/xonotic/dialog_hudpanel_racesplits.qc @@ -17,7 +17,10 @@ void XonoticHUDRaceSplitsDialog_fill(entity 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.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_racesplits_align", _("Align right"))); + me.TR(me); + me.TDempty(me, 0.2); + me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_racesplits_flip", _("Flip splits order"))); me.TR(me); me.TDempty(me, 0.2); me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Splits to keep on screen:")));