From: Mario Date: Mon, 28 Dec 2015 02:33:27 +0000 (+1000) Subject: Turn some stupidly long cvars into autocvars X-Git-Tag: xonotic-v0.8.2~1379 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8d3a3c59b0ddecfd208cc011118ccbef08d1aa27;p=xonotic%2Fxonotic-data.pk3dir.git Turn some stupidly long cvars into autocvars --- diff --git a/qcsrc/client/hud/panel/engineinfo.qc b/qcsrc/client/hud/panel/engineinfo.qc index 01e7ae3da..1a22c54e8 100644 --- a/qcsrc/client/hud/panel/engineinfo.qc +++ b/qcsrc/client/hud/panel/engineinfo.qc @@ -7,6 +7,9 @@ int framecounter; float frametimeavg; float frametimeavg1; // 1 frame ago float frametimeavg2; // 2 frames ago +float autocvar_hud_panel_engineinfo_framecounter_exponentialmovingaverage; +float autocvar_hud_panel_engineinfo_framecounter_exponentialmovingaverage_new_weight; +float autocvar_hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold; void HUD_EngineInfo() { if(!autocvar__hud_configure) @@ -27,7 +30,7 @@ void HUD_EngineInfo() } float currentTime = gettime(GETTIME_REALTIME); - if(cvar("hud_panel_engineinfo_framecounter_exponentialmovingaverage")) + if(autocvar_hud_panel_engineinfo_framecounter_exponentialmovingaverage) { float currentframetime = currentTime - prevfps_time; frametimeavg = (frametimeavg + frametimeavg1 + frametimeavg2 + currentframetime)/4; // average three frametimes into framecounter for slightly more stable fps readings :P @@ -35,10 +38,10 @@ void HUD_EngineInfo() frametimeavg1 = frametimeavg; float weight; - weight = cvar("hud_panel_engineinfo_framecounter_exponentialmovingaverage_new_weight"); + weight = autocvar_hud_panel_engineinfo_framecounter_exponentialmovingaverage_new_weight; if(currentframetime > 0.0001) // filter out insane values which sometimes seem to occur and throw off the average? If you are getting 10,000 fps or more, then you don't need a framerate counter. { - if(fabs(prevfps - (1/frametimeavg)) > prevfps * cvar("hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold")) // if there was a big jump in fps, just force prevfps at current (1/currentframetime) to make big updates instant + if(fabs(prevfps - (1/frametimeavg)) > prevfps * autocvar_hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold) // if there was a big jump in fps, just force prevfps at current (1/currentframetime) to make big updates instant prevfps = (1/currentframetime); prevfps = (1 - weight) * prevfps + weight * (1/frametimeavg); // framecounter just used so there's no need for a new variable, think of it as "frametime average" }