]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Put part2 of HUD_Panel_UpdatePosSizeForId within the main switch to avoid enclosing...
authorterencehill <piuntn@gmail.com>
Fri, 10 Dec 2010 18:59:16 +0000 (19:59 +0100)
committerterencehill <piuntn@gmail.com>
Fri, 10 Dec 2010 20:39:40 +0000 (21:39 +0100)
Convert hud_panel_physics_* cvars into autocvars

qcsrc/client/autocvars.qh
qcsrc/client/hud.qc
qcsrc/client/hud.qh

index 142d5269c996fb84bedcd0ebbfe9ee5634018320..e2d07315fce663cd6d34135930b1b9a79b0002be 100644 (file)
@@ -199,6 +199,17 @@ 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_acceleration_max;
+float autocvar_hud_panel_physics_acceleration_z;
+float autocvar_hud_panel_physics_baralign;
+float autocvar_hud_panel_physics_flip;
+float autocvar_hud_panel_physics_progressbar;
+float autocvar_hud_panel_physics_speed_max;
+float autocvar_hud_panel_physics_speed_unit;
+float autocvar_hud_panel_physics_speed_unit_show;
+float autocvar_hud_panel_physics_speed_z;
+float autocvar_hud_panel_physics_topspeed;
+float autocvar_hud_panel_physics_topspeed_time;
 float autocvar_hud_panel_powerups;
 float autocvar_hud_panel_powerups_baralign;
 float autocvar_hud_panel_powerups_flip;
index b2892bd112d9086988a3d19e461ba0f92a72e00b..0314ab954c2fd77e784118c1497979dca6590dea 100644 (file)
@@ -5176,23 +5176,23 @@ void HUD_Physics(void)
                        break;
        }
 
-       float max_speed = floor( cvar("hud_panel_physics_speed_max") * conversion_factor + 0.5 );
+       float max_speed = floor( autocvar_hud_panel_physics_speed_max * conversion_factor + 0.5 );
        if (autocvar__hud_configure)
                speed = floor( max_speed * 0.65 + 0.5 );
-       else if(cvar("hud_panel_physics_speed_z"))
+       else if(autocvar_hud_panel_physics_speed_z)
                speed = floor( vlen(pmove_vel) * conversion_factor + 0.5 );
        else
                speed = floor( vlen(pmove_vel - pmove_vel_z * '0 0 1') * conversion_factor + 0.5 );
 
        //compute acceleration
        float acceleration, f;
-       float max_acceleration = cvar("hud_panel_physics_acceleration_max");
+       float max_acceleration = autocvar_hud_panel_physics_acceleration_max;
        if (autocvar__hud_configure)
                acceleration = max_acceleration * 0.3;
        else
        {
                f = time - acc_prevtime;
-               if(cvar("hud_panel_physics_acceleration_z"))
+               if(autocvar_hud_panel_physics_acceleration_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);
@@ -5206,14 +5206,14 @@ void HUD_Physics(void)
 
        //compute layout
        drawfont = hud_bigfont;
-       float baralign = cvar("hud_panel_physics_baralign");
-       float progressbar = cvar("hud_panel_physics_progressbar");
+       float baralign = autocvar_hud_panel_physics_baralign;
+       float progressbar = autocvar_hud_panel_physics_progressbar;
        float panel_ar = panel_size_x/panel_size_y;
        vector speed_offset, acceleration_offset;
        if (panel_ar >= 5)
        {
                panel_size_x *= 0.5;
-               if (cvar("hud_panel_physics_flip"))
+               if (autocvar_hud_panel_physics_flip)
                        speed_offset_x = panel_size_x;
                else
                        acceleration_offset_x = panel_size_x;
@@ -5221,13 +5221,13 @@ void HUD_Physics(void)
        else
        {
                panel_size_y *= 0.5;
-               if (cvar("hud_panel_physics_flip"))
+               if (autocvar_hud_panel_physics_flip)
                        speed_offset_y = panel_size_y;
                else
                        acceleration_offset_y = panel_size_y;
        }
        float speed_baralign, acceleration_baralign;
-       if (cvar("hud_panel_physics_flip"))
+       if (autocvar_hud_panel_physics_flip)
        {
                acceleration_baralign = (baralign == 1 || baralign == 2);
                speed_baralign = (baralign == 1 || baralign == 3);
@@ -5259,7 +5259,7 @@ void HUD_Physics(void)
                tmp_offset_x = 0;
        else
                tmp_offset_x = tmp_size_x;
-       if (cvar("hud_panel_physics_speed_unit_show"))
+       if (autocvar_hud_panel_physics_speed_unit_show)
        {
                //tmp_offset_y = 0;
                tmp_size_x = panel_size_x * (1 - 0.75);
@@ -5268,7 +5268,7 @@ void HUD_Physics(void)
        }
 
        //compute and draw top speed
-       if (cvar("hud_panel_physics_topspeed"))
+       if (autocvar_hud_panel_physics_topspeed)
        {
                if (autocvar__hud_configure)
                {
@@ -5286,7 +5286,7 @@ void HUD_Physics(void)
                                f = 0;
                        else
                        {
-                               f = max(1, cvar("hud_panel_physics_topspeed_time"));
+                               f = max(1, autocvar_hud_panel_physics_topspeed_time);
                                // divide by f to make it start from 1
                                f = cos( ((time - top_speed_time) / f) * PI/2 );
                        }
index fc898ba642f23fb7602dd66d688651609f8ddd61..1f11f9e684720191fd2fe270385ba34a2f18bcb8 100644 (file)
@@ -295,8 +295,8 @@ switch(id) { \
        case HUD_PANEL_PRESSEDKEYS: HUD_Panel_UpdateCvars(pressedkeys) break; \
        case HUD_PANEL_CHAT: HUD_Panel_UpdateCvars(chat) break; \
        case HUD_PANEL_ENGINEINFO: HUD_Panel_UpdateCvars(engineinfo) break; \
-}\
-HUD_Panel_UpdateCvarsForId_Part2(id)
+       default: HUD_Panel_UpdateCvarsForId_Part2(id)\
+}
 
 #define HUD_Panel_UpdatePosSize(name) \
 panel_pos = stov(cvar_string("hud_panel_" #name "_pos")); \
@@ -331,5 +331,5 @@ switch(id) { \
        case HUD_PANEL_PRESSEDKEYS: HUD_Panel_UpdatePosSize(pressedkeys) break;\
        case HUD_PANEL_CHAT: HUD_Panel_UpdatePosSize(chat) break;\
        case HUD_PANEL_ENGINEINFO: HUD_Panel_UpdatePosSize(engineinfo) break;\
-}\
-HUD_Panel_UpdatePosSizeForId_Part2(id)
+       default: HUD_Panel_UpdatePosSizeForId_Part2(id)\
+}