]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Physics panel updates: acceleration progressbar can now be scaled to display better...
authorterencehill <piuntn@gmail.com>
Sat, 1 Oct 2011 11:26:06 +0000 (13:26 +0200)
committerterencehill <piuntn@gmail.com>
Sat, 1 Oct 2011 11:26:06 +0000 (13:26 +0200)
defaultXonotic.cfg
qcsrc/client/autocvars.qh
qcsrc/client/hud.qc

index a0d50e3e7a996bf234d765d634097f23d5b2357e..88bdda0432f33782b2a5e34d8fed19f46c04d73d 100644 (file)
@@ -1486,6 +1486,9 @@ seta hud_panel_physics_topspeed 1 "also show top speed"
 seta hud_panel_physics_topspeed_time 4 "how many seconds the top speed takes to fade out"
 seta hud_panel_physics_acceleration_max 1.5 "acceleration progressbar gets completely filled up by this value (in g)"
 seta hud_panel_physics_acceleration_vertical 0 "include the acceleration on the Z-axis"
+seta hud_panel_physics_acceleration_progressbar_scale 0 "multiply acceleration progressbar values by this factor (allow progressbar to go out of panel bounds)";
+seta hud_panel_physics_acceleration_progressbar_nonlinear 1 "use a non linear function to display acceleration progressbar values (amplify more smaller values)";
+seta hud_panel_physics_text_scale 0.7 "scale text height by this factor";
 
 seta hud_showbinds 1   "what to show in the HUD to indicate certain keys to press: 0 display commands, 1 bound keys, 2 both"
 seta hud_showbinds_limit 2     "maximum number of bound keys to show for a command. 0 for unlimited"
index 7451ee7c300a13b54d9f0bb56f1898798434d23e..87d1809fc71d66949b7cd392496c5b09717de110 100644 (file)
@@ -249,6 +249,8 @@ float autocvar_hud_panel_notify_print;
 float autocvar_hud_panel_notify_time;
 float autocvar_hud_panel_physics;
 float autocvar_hud_panel_physics_acceleration_progressbar_mode;
+float autocvar_hud_panel_physics_acceleration_progressbar_scale;
+float autocvar_hud_panel_physics_acceleration_progressbar_nonlinear;
 float autocvar_hud_panel_physics_acceleration_max;
 float autocvar_hud_panel_physics_progressbar;
 float autocvar_hud_panel_physics_acceleration_vertical;
@@ -259,6 +261,7 @@ float autocvar_hud_panel_physics_speed_unit;
 float autocvar_hud_panel_physics_speed_unit_show;
 float autocvar_hud_panel_physics_speed_vertical;
 float autocvar_hud_panel_physics_text;
+float autocvar_hud_panel_physics_text_scale;
 float autocvar_hud_panel_physics_topspeed;
 float autocvar_hud_panel_physics_topspeed_time;
 float autocvar_hud_panel_powerups;
index 043b5ea98a957b60fd2b32ae7a343b81773102ed..32883b8dc4203b7d4528e784b58b2a0c88fcf1ca 100644 (file)
@@ -4186,6 +4186,16 @@ void HUD_Physics(void)
                panel_size -= '2 2 0' * panel_bg_padding;
        }
 
+       float acceleration_progressbar_scale;
+       if(autocvar_hud_panel_physics_progressbar && autocvar_hud_panel_physics_acceleration_progressbar_scale > 1)
+               acceleration_progressbar_scale = autocvar_hud_panel_physics_acceleration_progressbar_scale;
+
+       float text_scale;
+       if (autocvar_hud_panel_physics_text_scale <= 0)
+               text_scale = 1;
+       else
+               text_scale = min(autocvar_hud_panel_physics_text_scale, 1);
+
        //compute speed
        float speed, conversion_factor;
        string unit;
@@ -4245,7 +4255,7 @@ void HUD_Physics(void)
        //compute layout
        float panel_ar = panel_size_x/panel_size_y;
        vector speed_offset, acceleration_offset;
-       if (panel_ar >= 5)
+       if (panel_ar >= 5 && !acceleration_progressbar_scale)
        {
                panel_size_x *= 0.5;
                if (autocvar_hud_panel_physics_flip)
@@ -4290,11 +4300,12 @@ void HUD_Physics(void)
        if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 2)
        {
                tmp_size_x = panel_size_x * 0.75;
-               tmp_size_y = panel_size_y;
+               tmp_size_y = panel_size_y * text_scale;
                if (speed_baralign)
                        tmp_offset_x = panel_size_x - tmp_size_x;
                //else
                        //tmp_offset_x = 0;
+               tmp_offset_y = (panel_size_y - tmp_size_y) / 2;
                drawstring_aspect(panel_pos + speed_offset + tmp_offset, ftos(speed), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 
                //draw speed unit
@@ -4306,7 +4317,8 @@ void HUD_Physics(void)
                {
                        //tmp_offset_y = 0;
                        tmp_size_x = panel_size_x * (1 - 0.75);
-                       tmp_size_y = panel_size_y * 0.4;
+                       tmp_size_y = panel_size_y * 0.4 * text_scale;
+                       tmp_offset_y = (panel_size_y * 0.4 - tmp_size_y) / 2;
                        drawstring_aspect(panel_pos + speed_offset + tmp_offset, unit, tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
                }
        }
@@ -4367,7 +4379,8 @@ void HUD_Physics(void)
                        //top speed
                        tmp_offset_y = panel_size_y * 0.4;
                        tmp_size_x = panel_size_x * (1 - 0.75);
-                       tmp_size_y = panel_size_y - tmp_offset_y;
+                       tmp_size_y = (panel_size_y - tmp_offset_y) * text_scale;
+                       tmp_offset_y += (panel_size_y - tmp_offset_y - tmp_size_y) / 2;
                        drawstring_aspect(panel_pos + speed_offset + tmp_offset, ftos(top_speed), tmp_size, '1 0 0', f * panel_fg_alpha, DRAWFLAG_NORMAL);
                }
                else
@@ -4382,10 +4395,37 @@ void HUD_Physics(void)
                        HUD_Panel_GetProgressBarColor(acceleration_neg);
                else
                        HUD_Panel_GetProgressBarColor(acceleration);
-               HUD_Panel_DrawProgressBar(panel_pos + acceleration_offset, panel_size, "accelbar", acceleration/autocvar_hud_panel_physics_acceleration_max, 0, acceleration_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
+
+               f = acceleration/autocvar_hud_panel_physics_acceleration_max;
+               if (autocvar_hud_panel_physics_acceleration_progressbar_nonlinear)
+                       f = sqrt(f);
+
+               if (acceleration_progressbar_scale) // allow progressbar to go out of panel bounds
+               {
+                       tmp_size = acceleration_progressbar_scale * panel_size_x * eX + panel_size_y * eY;
+
+                       if (acceleration_baralign == 1)
+                               tmp_offset_x = panel_size_x - tmp_size_x;
+                       else if (acceleration_baralign == 2 || acceleration_baralign == 3)
+                               tmp_offset_x = (panel_size_x - tmp_size_x) / 2;
+                       else
+                               tmp_offset_x = 0;
+                       tmp_offset_y = 0;
+               }
+               else
+               {
+                       tmp_size = panel_size;
+                       tmp_offset = '0 0 0';
+               }
+
+               HUD_Panel_DrawProgressBar(panel_pos + acceleration_offset + tmp_offset, tmp_size, "accelbar", f, 0, acceleration_baralign, progressbar_color, autocvar_hud_progressbar_alpha * panel_fg_alpha, DRAWFLAG_NORMAL);
        }
+       tmp_size_x = panel_size_x;
+       tmp_size_y = panel_size_y * text_scale;
+       tmp_offset_x = 0;
+       tmp_offset_y = (panel_size_y - tmp_size_y) / 2;
        if (autocvar_hud_panel_physics_text == 1 || autocvar_hud_panel_physics_text == 3)
-               drawstring_aspect(panel_pos + acceleration_offset, strcat(ftos_decimals(acceleration, 2), "g"), panel_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
+               drawstring_aspect(panel_pos + acceleration_offset + tmp_offset, strcat(ftos_decimals(acceleration, 2), "g"), tmp_size, '1 1 1', panel_fg_alpha, DRAWFLAG_NORMAL);
 }
 
 // CenterPrint (#16)