==================
*/
-void HUD_ShowSpeed(void)
-{
- vector numsize;
- float pos, conversion_factor;
- string speed, zspeed, unit;
-
- switch(cvar("cl_showspeed_unit"))
- {
- default:
- case 0:
- unit = "";
- conversion_factor = 1.0;
- break;
- case 1:
- unit = " qu/s";
- conversion_factor = 1.0;
- break;
- case 2:
- unit = " m/s";
- conversion_factor = 0.0254;
- break;
- case 3:
- unit = " km/h";
- conversion_factor = 0.0254 * 3.6;
- break;
- case 4:
- unit = " mph";
- conversion_factor = 0.0254 * 3.6 * 0.6213711922;
- break;
- case 5:
- unit = " knots";
- conversion_factor = 0.0254 * 1.943844492; // 1 m/s = 1.943844492 knots, because 1 knot = 1.852 km/h
- break;
- }
-
- speed = strcat(ftos(floor( vlen(pmove_vel - pmove_vel_z * '0 0 1') * conversion_factor + 0.5 )), unit);
-
- numsize_x = numsize_y = cvar("cl_showspeed_size");
- pos = (vid_conheight - numsize_y) * cvar("cl_showspeed_position");
-
- drawfont = hud_bigfont;
- drawstringcenter(eX + pos * eY, speed, numsize, '1 1 1', autocvar_hud_panel_fg_alpha * hud_fade_alpha, DRAWFLAG_NORMAL);
-
- if (cvar("cl_showspeed_z") == 1) {
- zspeed = strcat(ftos(fabs(floor( pmove_vel_z * conversion_factor + 0.5 ))), unit);
- drawstringcenter(eX + pos * eY + numsize_y * eY, zspeed, numsize * 0.5, '1 1 1', autocvar_hud_panel_fg_alpha * hud_fade_alpha, DRAWFLAG_NORMAL);
- }
-
- drawfont = hud_font;
-}
-
-void HUD_ShowAcceleration(void)
-{
- float acceleration, sz, scale, alpha, f;
- vector pos, mySize, rgb;
-
- f = time - acc_prevtime;
- if(cvar("cl_showacceleration_z"))
- acceleration = (vlen(pmove_vel) - vlen(acc_prevspeed)) * (1 / f);
- else
- acceleration = (vlen(pmove_vel - '0 0 1' * pmove_vel_z) - vlen(acc_prevspeed - '0 0 1' * acc_prevspeed_z)) * (1 / f);
- acc_prevspeed = pmove_vel;
- acc_prevtime = time;
-
- f = bound(0, f * 10, 1);
- acc_avg = acc_avg * (1 - f) + acceleration * f;
- acceleration = acc_avg / getstatf(STAT_MOVEVARS_MAXSPEED);
- if (acceleration == 0)
- return;
-
- sz = cvar("cl_showacceleration_size");
- scale = cvar("cl_showacceleration_scale");
- alpha = cvar("cl_showacceleration_alpha");
- if (cvar("cl_showacceleration_color_custom"))
- rgb = stov(cvar_string("cl_showacceleration_color"));
- else {
- if (acceleration < 0)
- rgb = '1 .5 .5' - '0 .5 .5' * bound(0, -acceleration * 0.2, 1);
- else
- rgb = '.5 1 .5' - '.5 0 .5' * bound(0, +acceleration * 0.2, 1);
- }
-
- mySize_x = vid_conwidth/2;
- mySize_y = sz;
- pos_y = cvar("cl_showacceleration_position") * vid_conheight - sz/2;
- if (acceleration > 0)
- {
- pos_x = mySize_x;
- HUD_Panel_DrawProgressBar(pos, mySize, acceleration * scale, 0, 0, rgb, alpha * autocvar_hud_panel_fg_alpha * hud_fade_alpha, DRAWFLAG_NORMAL);
- }
- else
- {
- //pos_x = 0;
- HUD_Panel_DrawProgressBar(pos, mySize, -acceleration * scale, 0, 1, rgb, alpha * autocvar_hud_panel_fg_alpha * hud_fade_alpha, DRAWFLAG_NORMAL);
- }
-}
-
void HUD_Reset (void)
{
// reset gametype specific icons
if(autocvar__con_chat_maximized)
HUD_Chat(); // HUD_DrawPanel(HUD_PANEL_CHAT);
- // TODO hud_'ify these
- if (cvar("cl_showspeed"))
- HUD_ShowSpeed();
- if (cvar("cl_showacceleration"))
- HUD_ShowAcceleration();
-
if (autocvar__hud_configure && spectatee_status && hud_configure_prev == -1) // try to join if we are in hud_configure mode, but still spectating, and in the first frame (in order to get rid of motd when launching a server via the menu "HUD Setup" button)
localcmd("cmd selectteam auto; cmd join\n");
--- /dev/null
+#ifdef INTERFACE
+CLASS(XonoticHUDPhysicsDialog) EXTENDS(XonoticRootDialog)
+ METHOD(XonoticHUDPhysicsDialog, fill, void(entity))
+ ATTRIB(XonoticHUDPhysicsDialog, title, string, "Physics Panel")
+ ATTRIB(XonoticHUDPhysicsDialog, color, vector, SKINCOLOR_DIALOG_TEAMSELECT)
+ ATTRIB(XonoticHUDPhysicsDialog, intendedWidth, float, 0.4)
+ ATTRIB(XonoticHUDPhysicsDialog, rows, float, 15)
+ ATTRIB(XonoticHUDPhysicsDialog, columns, float, 4)
+ ATTRIB(XonoticHUDPhysicsDialog, name, string, "HUDphysics")
+ ATTRIB(XonoticHUDPhysicsDialog, sliderTopspeedTime, entity, NULL)
+ENDCLASS(XonoticHUDPhysicsDialog)
+#endif
+
+#ifdef IMPLEMENTATION
+void XonoticHUDPhysicsDialog_fill(entity me)
+{
+ entity e;
+ string panelname = "physics";
+ float i;
+
+ me.TR(me);
+ me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_panel_physics", "Enable panel"));
+ me.TR(me);
+ me.TD(me, 1, 1.4, e = makeXonoticTextLabel(0, "Background:"));
+ me.TD(me, 1, 1.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg"))));
+ e.addValue(e, "Default", "");
+ e.addValue(e, "Disable", "0");
+ e.addValue(e, strzone(strcat("border_", panelname)), strzone(strcat("border_", panelname)));
+ e.configureXonoticTextSliderValues(e);
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, "Color:"));
+ me.TD(me, 2, 2.4, e = makeXonoticColorpickerString(strzone(strcat("hud_panel_", panelname, "_bg_color")), "hud_panel_bg_color"));
+ setDependentStringNotEqual(e, strzone(strcat("hud_panel_", panelname, "_bg_color")), "");
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.2, e = makeXonoticCheckBoxString("", "1 1 1", strzone(strcat("hud_panel_", panelname, "_bg_color")), "Use default"));
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, "Border size:"));
+ me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_border"))));
+ e.addValue(e, "Default", "");
+ e.addValue(e, "Disable", "0");
+ for(i = 1; i <= 10; ++i)
+ e.addValue(e, strzone(ftos_decimals(i * 2, 0)), strzone(ftos(i * 2)));
+ e.configureXonoticTextSliderValues(e);
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, "Alpha:"));
+ me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_alpha"))));
+ e.addValue(e, "Default", "");
+ for(i = 1; i <= 10; ++i)
+ e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
+ e.configureXonoticTextSliderValues(e);
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, "Team Color:"));
+ me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_color_team"))));
+ e.addValue(e, "Default", "");
+ e.addValue(e, "Disable", "0");
+ for(i = 1; i <= 10; ++i)
+ e.addValue(e, strzone(ftos_decimals(i/10, 1)), strzone(ftos(i/10)));
+ e.configureXonoticTextSliderValues(e);
+ me.TR(me);
+ me.TDempty(me, 0.4);
+ me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_configure_teamcolorforced", "Test the team color in HUD configure mode"));
+ me.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.2, e = makeXonoticTextLabel(0, "Padding:"));
+ me.TD(me, 1, 2.6, e = makeXonoticTextSlider(strzone(strcat("hud_panel_", panelname, "_bg_padding"))));
+ e.addValue(e, "Default", "");
+ for(i = 0; i <= 10; ++i)
+ e.addValue(e, strzone(ftos_decimals(i - 5, 0)), strzone(ftos(i - 5)));
+ e.configureXonoticTextSliderValues(e);
+ me.TR(me);
+ me.TD(me, 1, 1.4, e = makeXonoticCheckBox(0, "hud_panel_physics_progressbar", "Status bar"));
+ me.TD(me, 1, 1.6, e = makeXonoticTextSlider("hud_panel_physics_baralign"));
+ e.addValue(e, "Left align" , "0");
+ e.addValue(e, "Right align" , "1");
+ e.addValue(e, "Inward align" , "2");
+ e.addValue(e, "Outward align", "3");
+ e.configureXonoticTextSliderValues(e);
+ setDependent(e, "hud_panel_physics_progressbar", 1, 1);
+ me.TR(me);
+ me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_panel_physics_flip", "Flip speed/acceleration positions"));
+
+//speed
+ me.TR(me);
+ me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Speed:"));
+ me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_panel_physics_speed_z", "Include vertical speed"));
+ // me.TR(me);
+ // me.TDempty(me, 0.2);
+ // me.TD(me, 1, 1.8, e = makeXonoticTextLabel(0, "Full status bar at:"));
+ // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
+ // me.TD(me, 1, 1, e = makeXonoticInputBox(1, "hud_panel_physics_speed_max"));
+ // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
+ // 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.TR(me);
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 3.8/2, e = makeXonoticCheckBox(0, "hud_panel_physics_topspeed", "Top Speed"));
+ me.TD(me, 1, 3.8/2, e = makeXonoticSlider(1, 10, 1, "hud_panel_physics_topspeed_time"));
+ setDependent(e, "hud_panel_physics_topspeed", 1, 1);
+
+//acceleration
+ me.TR(me);
+ me.TD(me, 1, 1, e = makeXonoticTextLabel(0, "Acceleration:"));
+ me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "hud_panel_physics_acceleration_z", "Include vertical acc."));
+ // me.TR(me);
+ // me.TDempty(me, 0.2);
+ // me.TD(me, 1, 1.8, e = makeXonoticTextLabel(0, "Full status bar at:"));
+ // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
+ // me.TD(me, 1, 0.6, e = makeXonoticInputBox(1, "hud_panel_physics_acceleration_max"));
+ // setDependent(e, "hud_panel_physics_progressbar", 1, 1);
+}
+#endif
\ No newline at end of file
me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "showdate", "Show current date"));
me.TR(me);
me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "showfps", "Show frames per second"));
- me.TR(me);
- me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_showspeed", "Speedometer"));
- me.TR(me);
- me.TDempty(me, 0.2);
- me.TD(me, 1, 2.8/3, e = makeXonoticRadioButton(1, "cl_showspeed_unit", "0", "qu/s (hidden)"));
- setDependent(e, "cl_showspeed", 1, 1);
- me.TD(me, 1, 2.8/3, e = makeXonoticRadioButton(1, "cl_showspeed_unit", "1", "qu/s"));
- setDependent(e, "cl_showspeed", 1, 1);
- me.TD(me, 1, 2.8/3, e = makeXonoticRadioButton(1, "cl_showspeed_unit", "2", "m/s"));
- setDependent(e, "cl_showspeed", 1, 1);
- me.TR(me);
- me.TDempty(me, 0.2);
- me.TD(me, 1, 2.8/3, e = makeXonoticRadioButton(1, "cl_showspeed_unit", "3", "km/h"));
- setDependent(e, "cl_showspeed", 1, 1);
- me.TD(me, 1, 2.8/3, e = makeXonoticRadioButton(1, "cl_showspeed_unit", "4", "mph"));
- setDependent(e, "cl_showspeed", 1, 1);
- me.TD(me, 1, 2.8/3, e = makeXonoticRadioButton(1, "cl_showspeed_unit", "5", "knots"));
- setDependent(e, "cl_showspeed", 1, 1);
- me.TR(me);
- me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_showacceleration", "Show accelerometer"));
- me.TR(me);
- me.TDempty(me, 0.2);
- me.TD(me, 1, 2.8/2, e = makeXonoticTextLabel(0, "Accelerometer scale:"));
- setDependent(e, "cl_showacceleration", 1, 1);
- me.TD(me, 1, 2.8/2, e = makeXonoticSlider(1, 10, 0.5, "cl_showacceleration_scale"));
- setDependent(e, "cl_showacceleration", 1, 1);
me.TR(me);
me.TR(me);
me.TDempty(me, 0.2);