From fd1bba567567822ac4f68fb404e8d31699699cd8 Mon Sep 17 00:00:00 2001 From: terencehill Date: Fri, 10 Dec 2010 19:59:16 +0100 Subject: [PATCH] Put part2 of HUD_Panel_UpdatePosSizeForId within the main switch to avoid enclosing macro calls by brackets (code didn't compile because of missing brackets) Convert hud_panel_physics_* cvars into autocvars --- qcsrc/client/autocvars.qh | 11 +++++++++++ qcsrc/client/hud.qc | 24 ++++++++++++------------ qcsrc/client/hud.qh | 8 ++++---- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/qcsrc/client/autocvars.qh b/qcsrc/client/autocvars.qh index 142d5269c..e2d07315f 100644 --- a/qcsrc/client/autocvars.qh +++ b/qcsrc/client/autocvars.qh @@ -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; diff --git a/qcsrc/client/hud.qc b/qcsrc/client/hud.qc index b2892bd11..0314ab954 100644 --- a/qcsrc/client/hud.qc +++ b/qcsrc/client/hud.qc @@ -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 ); } diff --git a/qcsrc/client/hud.qh b/qcsrc/client/hud.qh index fc898ba64..1f11f9e68 100644 --- a/qcsrc/client/hud.qh +++ b/qcsrc/client/hud.qh @@ -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)\ +} -- 2.39.2