Several other fixes to the blur / sharpen effects
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 1 Mar 2011 15:32:48 +0000 (17:32 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 1 Mar 2011 15:32:48 +0000 (17:32 +0200)
data/qcsrc/client/View.qc

index 7bf9b48af180224946f1099e8bb1347350368825..b96fb7e071ac0cfa2f49bcb673a7e16baba96362 100644 (file)
@@ -712,32 +712,33 @@ void CSQC_UpdateView(float w, float h)
                {\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
 \r
-               if(cvar("hud_powerup"))\r
+               float sharpen_intensity;\r
+               if (getstatf(STAT_STRENGTH_FINISHED) - time > 0)\r
+                       sharpen_intensity += (getstatf(STAT_STRENGTH_FINISHED) - time);\r
+               if (getstatf(STAT_INVINCIBLE_FINISHED) - time > 0)\r
+                       sharpen_intensity += (getstatf(STAT_INVINCIBLE_FINISHED) - time);\r
+\r
+               if(cvar("hud_powerup") && sharpen_intensity > 0)\r
                {\r
-                       float sharpen_intensity;\r
-                       if (getstatf(STAT_STRENGTH_FINISHED) - time > 0)\r
-                               sharpen_intensity += (getstatf(STAT_STRENGTH_FINISHED) - time);\r
-                       if (getstatf(STAT_INVINCIBLE_FINISHED) - time > 0)\r
-                               sharpen_intensity += (getstatf(STAT_INVINCIBLE_FINISHED) - time);\r
                        sharpen_intensity = bound(0, sharpen_intensity, 5); // powerup warning time is 5 seconds, so fade the effect from there\r
 \r
-                       if(sharpen_intensity > 0)\r
+                       if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible\r
                        {\r
-                               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
-                       {\r
-                               cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");\r
-                               cvar_set("r_glsl_postprocess_uservec2_enable", "0");\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
+               {\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
 \r
        if(cvar("hud_postprocessing") && !cvar("hud_postprocessing_maxbluralpha"))\r