X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fclient%2Fhud%2Fpanel%2Fphysics.qc;h=aa77690a6a4a23ee36aa39548511289239ab8ad1;hb=6c319c2baf6bcac5d7f57d097b7773d1f6f23294;hp=5fc8c1ca9018cba6b656bf6628d4c59a9edd59bc;hpb=2300937585fd409c578a516ed5e051ba389646d4;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/client/hud/panel/physics.qc b/qcsrc/client/hud/panel/physics.qc index 5fc8c1ca9..aa77690a6 100644 --- a/qcsrc/client/hud/panel/physics.qc +++ b/qcsrc/client/hud/panel/physics.qc @@ -1,10 +1,13 @@ #include "physics.qh" +#include +#include +#include #include #include #include -// Physics panel (#15) +// Physics (#15) vector acc_prevspeed; float acc_prevtime, acc_avg, top_speed, top_speed_time; @@ -15,10 +18,10 @@ void HUD_Physics() { if(!autocvar_hud_panel_physics) return; if(spectatee_status == -1 && (autocvar_hud_panel_physics == 1 || autocvar_hud_panel_physics == 3)) return; - if(autocvar_hud_panel_physics == 3 && !(gametype == MAPINFO_TYPE_RACE || gametype == MAPINFO_TYPE_CTS)) return; + if(autocvar_hud_panel_physics == 3 && !(ISGAMETYPE(RACE) || ISGAMETYPE(CTS))) return; } - HUD_Panel_UpdateCvars(); + HUD_Panel_LoadCvars(); draw_beginBoldFont(); @@ -26,7 +29,7 @@ void HUD_Physics() HUD_Scale_Enable(); else HUD_Scale_Disable(); - HUD_Panel_DrawBg(1); + HUD_Panel_DrawBg(); if(panel_bg_padding) { panel_pos += '1 1 0' * panel_bg_padding; @@ -82,15 +85,17 @@ void HUD_Physics() } } - int acc_decimals = 2; + const int acc_decimals = 2; if(time > physics_update_time) { + discrete_acceleration = acceleration; // workaround for ftos_decimals returning a negative 0 - if(discrete_acceleration > -1 / pow(10, acc_decimals) && discrete_acceleration < 0) + if(discrete_acceleration > -1 / (10 ** acc_decimals) && discrete_acceleration < 0) discrete_acceleration = 0; - discrete_acceleration = acceleration; discrete_speed = speed; physics_update_time += autocvar_hud_panel_physics_update_interval; + if(physics_update_time < time) + physics_update_time = time + autocvar_hud_panel_physics_update_interval; } //compute layout