]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
New cvar hud_panel_physics_progressbar_acceleration_mode to also allow the old way...
authorterencehill <piuntn@gmail.com>
Wed, 12 Jan 2011 18:56:00 +0000 (19:56 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 15 Jan 2011 15:25:23 +0000 (16:25 +0100)
_hud_descriptions.cfg
hud_luminos.cfg
hud_nexuiz.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud_config.qc

index c72cd85366086902b61d23f2cf25f98c056b2950..16ae97565bbf45e6bcd25aa3fc06f05e0b39eab3 100644 (file)
@@ -231,3 +231,4 @@ seta hud_panel_physics_bg_padding "" "if set to something else than \"\" = overr
 seta hud_panel_physics_baralign "" "0 = align bars to the left, 1 = align bars to the right, 2 = align only left bar to the right, 3 = align only right bar to the right, 4 = align bars to the center"
 seta hud_panel_physics_flip "" "flip speed/acceleration positions"
 seta hud_panel_physics_progressbar "" "enable progressbar in panel"
+seta hud_panel_physics_progressbar_acceleration_mode "" "0 = progressbar increases from the center to the right if the acceleration is positive, to the left if it's negative; 1 = progressbar increases from the border in the same direction for both positive and negative accelerations"
index 1352b80469140f3bb066f73ee46e08c5b633bea4..7e94d8ce081aa4c5ec7d53ec19e147f25aca2cc0 100644 (file)
@@ -229,5 +229,6 @@ seta hud_panel_physics_bg_padding ""
 seta hud_panel_physics_flip "0"
 seta hud_panel_physics_baralign "0"
 seta hud_panel_physics_progressbar "1"
+seta hud_panel_physics_progressbar_acceleration_mode "0"
 
 menu_sync
index 32c25f496656ded0be2bf8f3004e333770f5b3f7..9969a5e2761bbbb146805d406f1cbe378efe177c 100644 (file)
@@ -229,5 +229,6 @@ seta hud_panel_physics_bg_padding ""
 seta hud_panel_physics_flip "0"
 seta hud_panel_physics_baralign "0"
 seta hud_panel_physics_progressbar "1"
+seta hud_panel_physics_progressbar_acceleration_mode "0"
 
 menu_sync
index 38140b017c42c0f083ea390fbe30564a18533b77..4a5696369590b8c7d8a13481184bb3ed26cd8ce8 100644 (file)
@@ -189,6 +189,7 @@ float autocvar_hud_panel_notify_flip;
 float autocvar_hud_panel_notify_print;
 float autocvar_hud_panel_notify_time;
 float autocvar_hud_panel_physics;
+float autocvar_hud_panel_physics_progressbar_acceleration_mode;
 float autocvar_hud_panel_physics_acceleration_max;
 float autocvar_hud_panel_physics_acceleration_z;
 float autocvar_hud_panel_physics_baralign;
index 67cd5d49a8c1bbe3c812ae77a77d75bd0c513d6f..7fa4c8626e2d9d35ebdf362c9003a78b68808630 100644 (file)
@@ -427,10 +427,17 @@ if(highlightedPanel == hud_configure_active_panel && autocvar__hud_configure)\
 //basically the same code of draw_ButtonPicture and draw_VertButtonPicture for the menu
 void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, float length_ratio, float vertical, float baralign, vector theColor, float theAlpha, float drawflag)
 {
-       if(length_ratio <= 0 || !theAlpha)
+       if(!length_ratio || !theAlpha)
                return;
        if(length_ratio > 1)
                length_ratio = 1;
+       if (baralign == 3)
+       {
+               if(length_ratio < -1)
+                       length_ratio = -1;
+       }
+       else if(length_ratio < 0)
+               return;
 
        vector square;
        vector width, height;
@@ -444,6 +451,17 @@ void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, flo
                        theOrigin_y += (1 - length_ratio) * theSize_y;
         else if (baralign == 2) // center align
             theOrigin_y += 0.5 * (1 - length_ratio) * theSize_y;
+        else if (baralign == 3) // center align, positive values down, negative up
+               {
+                       theSize_y *= 0.5;
+                       if (length_ratio > 0)
+                               theOrigin_y += theSize_y;
+                       else
+                       {
+                               theOrigin_y += (1 + length_ratio) * theSize_y;
+                               length_ratio = -length_ratio;
+                       }
+               }
                theSize_y *= length_ratio;
 
                vector bH;
@@ -475,6 +493,17 @@ void HUD_Panel_DrawProgressBar(vector theOrigin, vector theSize, string pic, flo
                        theOrigin_x += (1 - length_ratio) * theSize_x;
         else if (baralign == 2) // center align
             theOrigin_x += 0.5 * (1 - length_ratio) * theSize_x;
+        else if (baralign == 3) // center align, positive values on the right, negative on the left
+               {
+                       theSize_x *= 0.5;
+                       if (length_ratio > 0)
+                               theOrigin_x += theSize_x;
+                       else
+                       {
+                               theOrigin_x += (1 + length_ratio) * theSize_x;
+                               length_ratio = -length_ratio;
+                       }
+               }
                theSize_x *= length_ratio;
 
                vector bW;
@@ -4273,6 +4302,8 @@ void HUD_Physics(void)
                speed_baralign = (autocvar_hud_panel_physics_baralign == 2);
                acceleration_baralign = (autocvar_hud_panel_physics_baralign == 3);
        }
+       if (autocvar_hud_panel_physics_progressbar_acceleration_mode == 0)
+               acceleration_baralign = 3; //override hud_panel_physics_baralign value for acceleration
 
        //draw speed
        if(speed && autocvar_hud_panel_physics_progressbar)
@@ -4372,7 +4403,7 @@ void HUD_Physics(void)
                        HUD_Panel_GetProgressBarColor(acceleration_neg);
                else
                        HUD_Panel_GetProgressBarColor(acceleration);
-               HUD_Panel_DrawProgressBar(panel_pos + acceleration_offset, panel_size, "progressbar", fabs(acceleration)/autocvar_hud_panel_physics_acceleration_max, 0, acceleration_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+               HUD_Panel_DrawProgressBar(panel_pos + acceleration_offset, panel_size, "progressbar", acceleration/autocvar_hud_panel_physics_acceleration_max, 0, acceleration_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
        }
        drawstring_aspect(panel_pos + acceleration_offset, ftos_decimals(acceleration, 3), panel_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 }
index dd82a9731a3e0955736ce306f200695bdf67f041..b0cc07d42217ecde70ae797f5659d1e4b1b39118 100644 (file)
@@ -121,6 +121,7 @@ void HUD_Panel_ExportCfg(string cfgname)
                                        HUD_Write_PanelCvar_q("_flip");
                                        HUD_Write_PanelCvar_q("_baralign");
                                        HUD_Write_PanelCvar_q("_progressbar");
+                                       HUD_Write_PanelCvar_q("_acceleration_mode");
                                        break;
                        }
                        HUD_Write("\n");