Fix uservec*_enable cvars getting set dynamically, causing hiccups. They will now...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 1 Mar 2011 17:55:33 +0000 (19:55 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 1 Mar 2011 17:55:33 +0000 (19:55 +0200)
data/qcsrc/client/View.qc

index b96fb7e071ac0cfa2f49bcb673a7e16baba96362..ef62afcbad2f315832e975313f07328a0946f140 100644 (file)
@@ -695,6 +695,14 @@ void CSQC_UpdateView(float w, float h)
 \r
        if(cvar("hud_postprocessing"))\r
        {\r
+               // all of this should be done in the engine eventually\r
+\r
+               // enable or disable rendering types if they are used or not\r
+               if(cvar("r_glsl_postprocess_uservec1_enable") != (cvar("hud_postprocessing_maxbluralpha") != 0))\r
+                       cvar_set("r_glsl_postprocess_uservec1_enable", ftos(cvar("hud_postprocessing_maxbluralpha") != 0));\r
+               if(cvar("r_glsl_postprocess_uservec2_enable") != (cvar("hud_powerup") != 0))\r
+                       cvar_set("r_glsl_postprocess_uservec2_enable", ftos(cvar("hud_powerup") != 0));\r
+\r
                // lets apply the postprocess effects from the previous two functions if needed\r
                if(damage_blurpostprocess_x || content_blurpostprocess_x)\r
                {\r
@@ -703,15 +711,13 @@ void CSQC_UpdateView(float w, float h)
                        if(blurradius != old_blurradius || bluralpha != old_bluralpha) // reduce cvar_set spam as much as possible\r
                        {\r
                                cvar_set("r_glsl_postprocess_uservec1", strcat(ftos(blurradius), " ", ftos(bluralpha), " 0 0"));\r
-                               cvar_set("r_glsl_postprocess_uservec1_enable", "1");\r
                                old_blurradius = blurradius;\r
                                old_bluralpha = bluralpha;\r
                        }\r
                }\r
-               else if(cvar("r_glsl_postprocess_uservec1_enable")) // reduce cvar_set spam as much as possible\r
+               else if(cvar_string("r_glsl_postprocess_uservec1") != "0 0 0 0") // reduce cvar_set spam as much as possible\r
                {\r
                        cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");\r
-                       cvar_set("r_glsl_postprocess_uservec1_enable", "0");\r
                        old_blurradius = 0;\r
                        old_bluralpha = 0;\r
                }\r
@@ -729,14 +735,12 @@ void CSQC_UpdateView(float w, float h)
                        if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible\r
                        {\r
                                cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(-sharpen_intensity * cvar("hud_powerup")), " 0 0"));\r
-                               cvar_set("r_glsl_postprocess_uservec2_enable", "1");\r
                                old_sharpen_intensity = sharpen_intensity;\r
                        }\r
                }\r
-               else if(cvar("r_glsl_postprocess_uservec2_enable")) // reduce cvar_set spam as much as possible\r
+               else if(cvar_string("r_glsl_postprocess_uservec2") != "0 0 0 0") // reduce cvar_set spam as much as possible\r
                {\r
                        cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");\r
-                       cvar_set("r_glsl_postprocess_uservec2_enable", "0");\r
                        old_sharpen_intensity = 0;\r
                }\r
        }\r