]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/hud/panel/physics.qc
Transifex autosync
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / hud / panel / physics.qc
index da205262229150e1a10a4113c594f638af490ebd..53d778a4ba2ffac65fd43658cd5d861199e50d9c 100644 (file)
@@ -1,6 +1,5 @@
 #include "physics.qh"
 
-#include <client/autocvars.qh>
 #include <client/draw.qh>
 #include <lib/csqcmodel/cl_player.qh>
 
@@ -65,7 +64,6 @@ void HUD_Physics()
 
        //compute speed
        float speed, conversion_factor = GetSpeedUnitFactor(autocvar_hud_panel_physics_speed_unit);
-       string unit = GetSpeedUnit(autocvar_hud_panel_physics_speed_unit);
        vector vel = (csqcplayer ? csqcplayer.velocity : pmove_vel);
 
        float max_speed = floor( autocvar_hud_panel_physics_speed_max * conversion_factor + 0.5 );
@@ -137,7 +135,7 @@ void HUD_Physics()
        int speed_baralign, acceleration_baralign;
        if (autocvar_hud_panel_physics_baralign == 1)
                acceleration_baralign = speed_baralign = 1;
-    else if(autocvar_hud_panel_physics_baralign == 4)
+       else if(autocvar_hud_panel_physics_baralign == 4)
                acceleration_baralign = speed_baralign = 2;
        else if (autocvar_hud_panel_physics_flip)
        {
@@ -179,6 +177,7 @@ void HUD_Physics()
                        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);
                        drawstring_aspect(panel_pos + speed_offset + tmp_offset, unit, tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
        }
@@ -205,7 +204,7 @@ void HUD_Physics()
                                // divide by f to make it start from 1
                                f = cos( ((time - top_speed_time) / f) * PI/2 );
                        }
-            else //hide top speed 0, it would be stupid
+                       else // hide top speed 0
                                f = 0;
                }
                if (f > 0)
@@ -218,19 +217,19 @@ void HUD_Physics()
                                vector peak_size = '0 0 0';
                                if (speed_baralign == 0)
                                        peak_offsetX = min(top_speed, max_speed)/max_speed * panel_size.x;
-                else if (speed_baralign == 1)
+                               else if (speed_baralign == 1)
                                        peak_offsetX = (1 - min(top_speed, max_speed)/max_speed) * panel_size.x;
-                else // if (speed_baralign == 2)
-                    peak_offsetX = min(top_speed, max_speed)/max_speed * panel_size.x * 0.5;
+                               else // if (speed_baralign == 2)
+                                       peak_offsetX = min(top_speed, max_speed)/max_speed * panel_size.x * 0.5;
                                peak_size.x = floor(panel_size.x * 0.01 + 1.5);
-                peak_size.y = panel_size.y;
-                if (speed_baralign == 2) // draw two peaks, on both sides
-                {
-                    drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size.x + peak_offsetX - peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-                    drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size.x - peak_offsetX + peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
-                }
-                else
-                    drawfill(panel_pos + speed_offset + eX * (peak_offsetX - peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               peak_size.y = panel_size.y;
+                               if (speed_baralign == 2) // draw two peaks, on both sides
+                               {
+                                       drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size.x + peak_offsetX - peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                                       drawfill(panel_pos + speed_offset + eX * (0.5 * panel_size.x - peak_offsetX + peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+                               }
+                               else
+                                       drawfill(panel_pos + speed_offset + eX * (peak_offsetX - peak_size.x), peak_size, autocvar_hud_progressbar_speed_color, f * autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
                        }
 
                        //top speed