seta hud_panel_scoreboard_team_size_position 0 "where to show the team size (0 = do not show, 1 = left of scoreboard, 2 = right of scoreboard), will move team scores to the other side if necessary"
seta _hud_panel_strafehud_demo "0" "strafehud changes angle during configure"
-seta _hud_panel_strafehud_center "0" "puts the angle indicator in the center during HUD configure"
seta hud_panel_strafehud_mode "0" "strafehud mode which controls whether the strafehud is centered at: \"0\" = view angle, \"1\" = velocity direction"
seta hud_panel_strafehud_bar_alpha "0.3" "opacity of the strafe meter"
seta hud_panel_strafehud_bar_color "1 1 1" "color of the strafe meter"
bool autocvar_hud_panel_score_rankings;
int autocvar_hud_panel_strafehud = 3;
bool autocvar__hud_panel_strafehud_demo = false;
-bool autocvar__hud_panel_strafehud_center = false;
int autocvar_hud_panel_strafehud_mode = 0;
float autocvar_hud_panel_strafehud_bar_alpha = 0.3;
vector autocvar_hud_panel_strafehud_bar_color = '1 1 1';
}
else // simulate turning for HUD setup
{
- if(autocvar__hud_panel_strafehud_center)
+ if(autocvar__hud_panel_strafehud_demo && ((time - demo_time) >= .025))
{
- angle = demo_angle = 0;
- demo_time = 0;
- wishangle = 0;
- }
- else
- {
- if(autocvar__hud_panel_strafehud_demo && ((time - demo_time) >= .025))
+ demo_time = time;
+ demo_angle += demo_direction;
+ if(fabs(demo_angle) >= 55)
{
- demo_time = time;
- demo_angle += demo_direction;
- if(fabs(demo_angle) >= 55)
- {
- demo_direction = -demo_direction;
- }
+ demo_direction = -demo_direction;
}
- angle = demo_angle;
- wishangle = 45 * (demo_angle > 0 ? 1 : -1);
}
+ angle = demo_angle;
+ wishangle = 45 * (demo_angle > 0 ? 1 : -1);
}
// invert the wish angle when strafing backwards
#include "textlabel.qh"
#include "textslider.qh"
+void StrafeHUD_CenterPanel(entity btn, entity me)
+{
+ vector size = stov(str_cvar("hud_panel_strafehud_size"));
+ vector pos = stov(str_cvar("hud_panel_strafehud_pos"));
+ pos.x = 0.5 - size.x / 2;
+ cvar_set("hud_panel_strafehud_pos", strcat(ftos(pos.x), " ", ftos(pos.y)));
+}
+
void StrafeHUD_ColorReset(entity btn, entity me)
{
cvar_set("hud_panel_strafehud_bar_color", cvar_defstring("hud_panel_strafehud_bar_color"));
e.configureXonoticTextSliderValues(e);
me.TR(me);
me.TD(me, 1, 1.2, e = makeXonoticCheckBoxString("1", "0", "_hud_panel_strafehud_demo", _("Demo mode")));
- setDependentStringNotEqual(e, "_hud_panel_strafehud_center", "1");
me.TDempty(me, 0.4);
me.TD(me, 1, 0.6, e = makeXonoticTextLabel(0, _("Range:")));
me.TD(me, 1, 1.8, e = makeXonoticSlider(0, 360, 5, "hud_panel_strafehud_angle"));
me.TR(me);
- me.TD(me, 1, 1.2, e = makeXonoticCheckBoxString("1", "0", "_hud_panel_strafehud_center", _("Center angle")));
+ me.TD(me, 1, 1.9, e = makeXonoticButton(_("Center StrafeHUD"), '0 0 0'));
+ e.onClick = StrafeHUD_CenterPanel;
+ e.onClickEntity = me;
- me.TDempty(me, 0.4);
- me.TD(me, 1, 2.4, e = makeXonoticButton(_("Reset colors"), '0 0 0'));
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.9, e = makeXonoticButton(_("Reset colors"), '0 0 0'));
e.onClick = StrafeHUD_ColorReset;
e.onClickEntity = me;
me.TR(me);