seta hud_colorset_kill_3 "4" "'good' or 'beneficial' text (you fragging someone, etc)"
seta hud_colorset_background "7" "neutral/unimportant text"
+seta hud_speed_unit "1" "speed unit (1 = qu/s, 2 = m/s, 3 = km/h, 4 = mph, 5 = knots)"
+
// general hud panel cvars (i.e. shouldn't be adjusted by a skin config)
seta hud_panel_weapons 1 "enable this panel"
seta hud_panel_ammo 1 "enable this panel"
seta hud_panel_physics_acceleration_movingaverage 1 "use an averaging method for calculating acceleration instead of the real value"
seta hud_panel_physics_update_interval 0.016 "how often (in seconds) numeric values get updated on screen"
-seta hud_panel_physics_speed_unit "1" "speed unit (1 = qu/s, 2 = m/s, 3 = km/h, 4 = mph, 5 = knots)"
seta hud_panel_itemstime_progressbar_maxtime "30" "when left time is at least this amount, the status bar is full"
seta hud_panel_itemstime_hidespawned "1" "if 1 hide an item from the panel when all the occurrences of it are available again; if 2 hide it when at least one occurrence is available again"
seta hud_panel_strafehud_mode "0" "strafehud mode which controls whether the strafehud is centered at \"0\" = view angle, \"1\" = velocity angle"
seta hud_panel_strafehud_range "0" "the angle range up to 360 degrees displayed on the strafehud, \"0\" = dynamic (chooses the minimum range required to still see the whole area needed for accelerating at once)"
seta hud_panel_strafehud_style "1" "\"0\" = no styling, \"1\" = progress bar style for the strafe bar, \"2\" = gradient for the strafe bar"
-seta hud_panel_strafehud_unit "1" "speed unit (1 = qu/s, 2 = m/s, 3 = km/h, 4 = mph, 5 = knots), length unit (1 = qu, 2 = m, 3 = km, 4 = mi, 5 = nmi)"
seta hud_panel_strafehud_unit_show "1" "show units"
seta hud_panel_strafehud_bar_neutral_color "1 1 1" "color of the strafe meter neutral zone"
seta hud_panel_strafehud_bar_neutral_alpha "0.3" "opacity of the strafe meter neutral zone"
float autocvar_hud_progressbar_alpha;
float autocvar_hud_panel_update_interval;
+int autocvar_hud_speed_unit;
+
float autocvar_hud_dynamic_follow;
float autocvar_hud_dynamic_follow_scale;
vector autocvar_hud_dynamic_follow_scale_xyz;
text_scale = min(autocvar_hud_panel_physics_text_scale, 1);
//compute speed
- float speed, conversion_factor = GetSpeedUnitFactor(autocvar_hud_panel_physics_speed_unit);
+ float speed, conversion_factor = GetSpeedUnitFactor(autocvar_hud_speed_unit);
vector vel = (csqcplayer ? csqcplayer.velocity : pmove_vel);
float max_speed = floor( autocvar_hud_panel_physics_speed_max * conversion_factor + 0.5 );
tmp_size.x = panel_size.x * (1 - 0.75);
tmp_size.y = panel_size.y * 0.4 * text_scale;
tmp_offset.y = (panel_size.y * 0.4 - tmp_size.y) / 2;
- string unit = GetSpeedUnit(autocvar_hud_panel_physics_speed_unit);
+ string unit = GetSpeedUnit(autocvar_hud_speed_unit);
drawstring_aspect(panel_pos + speed_offset + tmp_offset, unit, tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
}
}
bool autocvar_hud_panel_physics_flip;
bool autocvar_hud_panel_physics_dynamichud = true;
float autocvar_hud_panel_physics_speed_max;
-int autocvar_hud_panel_physics_speed_unit;
bool autocvar_hud_panel_physics_speed_unit_show;
bool autocvar_hud_panel_physics_speed_vertical;
int autocvar_hud_panel_physics_text;
if(MUTATOR_CALLHOOK(ShowRankings)) {
string ranktitle = M_ARGV(0, string);
- string unit = GetSpeedUnit(autocvar_hud_panel_physics_speed_unit);
+ string unit = GetSpeedUnit(autocvar_hud_speed_unit);
+ float conversion_factor = GetSpeedUnitFactor(autocvar_hud_speed_unit);
if(race_speedaward_alltimebest)
{
string name;
if(race_speedaward)
{
name = textShortenToWidth(ColorTranslateRGB(race_speedaward_holder), namesize, hud_fontsize, stringwidth_colors);
- str = sprintf(_("Speed award: %d%s ^7(%s^7)"), race_speedaward, unit, name);
+ str = sprintf(_("Speed award: %d%s ^7(%s^7)"), race_speedaward * conversion_factor, unit, name);
str = strcat(str, " / ");
}
name = textShortenToWidth(ColorTranslateRGB(race_speedaward_alltimebest_holder), namesize, hud_fontsize, stringwidth_colors);
- str = strcat(str, sprintf(_("All-time fastest: %d%s ^7(%s^7)"), race_speedaward_alltimebest, unit, name));
+ str = strcat(str, sprintf(_("All-time fastest: %d%s ^7(%s^7)"), race_speedaward_alltimebest * conversion_factor, unit, name));
drawcolorcodedstring(pos, str, hud_fontsize, panel_fg_alpha, DRAWFLAG_NORMAL);
pos.y += 1.25 * hud_fontsize.y; // line height + line spacing
}
// HUD
int mode = autocvar_hud_panel_strafehud_mode >= 0 && autocvar_hud_panel_strafehud_mode <= 1 ? autocvar_hud_panel_strafehud_mode : 0;
- float speed_conversion_factor = GetSpeedUnitFactor(autocvar_hud_panel_strafehud_unit);
- float length_conversion_factor = GetLengthUnitFactor(autocvar_hud_panel_strafehud_unit);
- int length_decimals = autocvar_hud_panel_strafehud_unit >= 3 && autocvar_hud_panel_strafehud_unit <= 5 ? 6 : 2; // use more decimals when displaying km or miles
+ float speed_conversion_factor = GetSpeedUnitFactor(autocvar_hud_speed_unit);
+ float length_conversion_factor = GetLengthUnitFactor(autocvar_hud_speed_unit);
+ int length_decimals = autocvar_hud_speed_unit >= 3 && autocvar_hud_speed_unit <= 5 ? 6 : 2; // use more decimals when displaying km or miles
float antiflicker_angle = bound(0, autocvar_hud_panel_strafehud_antiflicker_angle, 180);
float antiflicker_speed = max(0, autocvar_hud_panel_strafehud_antiflicker_speed);
float minspeed;
{
vector startspeed_size = panel_size;
startspeed_size.y = panel_size.y * min(autocvar_hud_panel_strafehud_startspeed_size, 5);
- string speed_unit = GetSpeedUnit(autocvar_hud_panel_strafehud_unit);
+ string speed_unit = GetSpeedUnit(autocvar_hud_speed_unit);
drawstring_aspect(panel_pos + eY * panel_size.y, strcat(ftos_decimals(startspeed * speed_conversion_factor, 2), autocvar_hud_panel_strafehud_unit_show ? speed_unit : ""), startspeed_size, autocvar_hud_panel_strafehud_startspeed_color, text_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
}
float text_alpha = cos(((time - jumptime) / autocvar_hud_panel_strafehud_jumpheight_fade) * 90 * DEG2RAD); // fade non-linear like the physics panel does
vector jumpheight_size = panel_size;
jumpheight_size.y = panel_size.y * min(autocvar_hud_panel_strafehud_jumpheight_size, 5);
- string length_unit = GetLengthUnit(autocvar_hud_panel_strafehud_unit);
+ string length_unit = GetLengthUnit(autocvar_hud_speed_unit);
drawstring_aspect(panel_pos - eY * jumpheight_size.y, strcat(ftos_decimals(jumpheight, length_decimals), autocvar_hud_panel_strafehud_unit_show ? length_unit : ""), jumpheight_size, autocvar_hud_panel_strafehud_jumpheight_color, text_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
}
}
int autocvar_hud_panel_strafehud_mode = 0;
float autocvar_hud_panel_strafehud_range = 0;
int autocvar_hud_panel_strafehud_style = 1;
-int autocvar_hud_panel_strafehud_unit = 1;
bool autocvar_hud_panel_strafehud_unit_show = true;
vector autocvar_hud_panel_strafehud_bar_neutral_color = '1 1 1';
float autocvar_hud_panel_strafehud_bar_neutral_alpha = 0.3;
race_server_record = ReadInt24_t();
break;
case RACE_NET_SPEED_AWARD:
- race_speedaward = ReadInt24_t() * GetSpeedUnitFactor(autocvar_hud_panel_physics_speed_unit);
+ race_speedaward = ReadInt24_t();
strcpy(race_speedaward_holder, ReadString());
break;
case RACE_NET_SPEED_AWARD_BEST:
- race_speedaward_alltimebest = ReadInt24_t() * GetSpeedUnitFactor(autocvar_hud_panel_physics_speed_unit);
+ race_speedaward_alltimebest = ReadInt24_t();
strcpy(race_speedaward_alltimebest_holder, ReadString());
break;
case RACE_NET_RANKINGS_CNT:
// me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("qu/s")));
// setDependent(e, "hud_panel_physics_progressbar", 1, 1);
me.TR(me);
- me.TDempty(me, 0.2);
- me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, _("Speed unit:")));
- me.TD(me, 1, 2.6/3*2, e = makeXonoticTextSlider("hud_panel_physics_speed_unit"));
- e.addValue(e, _("qu/s") , "1");
- e.addValue(e, _("m/s") , "2");
- e.addValue(e, _("km/h") , "3");
- e.addValue(e, _("mph") , "4");
- e.addValue(e, _("knots"), "5");
- e.configureXonoticTextSliderValues(e);
- me.TD(me, 1, 2.6/3, e = makeXonoticCheckBox(0, "hud_panel_physics_speed_unit_show", _("Show")));
+ me.TDempty(me, 1);
+ me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_panel_physics_speed_unit_show", _("Show speed unit")));
me.TR(me);
me.TDempty(me, 0.2);
me.TD(me, 1, 3.8/2, e = makeXonoticCheckBox(0, "hud_panel_physics_topspeed", _("Top speed")));
setDependent(e, "hud_shownames", 1, 1);
me.TR(me);
+ me.TR(me);
+ me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Speed unit:")));
+ me.TD(me, 1, 2, e = makeXonoticTextSlider("hud_speed_unit"));
+ e.addValue(e, _("qu/s") , "1");
+ e.addValue(e, _("m/s") , "2");
+ e.addValue(e, _("km/h") , "3");
+ e.addValue(e, _("mph") , "4");
+ e.addValue(e, _("knots"), "5");
+ e.configureXonoticTextSliderValues(e);
me.TR(me);
me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Damage overlay:")));
me.TD(me, 1, 2, e = makeXonoticSlider(0, 1, 0.05, "hud_damage"));