]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Code a check in a more optimal way, reducing some code.
authorMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 1 Mar 2011 15:23:12 +0000 (17:23 +0200)
committerMircea Kitsune <sonichedgehog_hyperblast00@yahoo.com>
Tue, 1 Mar 2011 15:23:12 +0000 (17:23 +0200)
qcsrc/client/View.qc

index afc53901b2c6c3f0e1da5925245597031a8b7bd1..1bafa462b6d25b7f532debec877beb5db04f40a8 100644 (file)
@@ -845,45 +845,28 @@ void CSQC_UpdateView(float w, float h)
                        cvar_set("r_glsl_postprocess_uservec1_enable", "0");
                }
 
-               if(autocvar_hud_powerup)
+               float sharpen_intensity;
+               if (getstatf(STAT_STRENGTH_FINISHED) - time > 0)
+                       sharpen_intensity += (getstatf(STAT_STRENGTH_FINISHED) - time);
+               if (getstatf(STAT_INVINCIBLE_FINISHED) - time > 0)
+                       sharpen_intensity += (getstatf(STAT_INVINCIBLE_FINISHED) - time);
+
+               if(autocvar_hud_powerup && sharpen_intensity > 0)
                {
-                       float sharpen_intensity;
-                       if (getstatf(STAT_STRENGTH_FINISHED) - time > 0)
-                               sharpen_intensity += (getstatf(STAT_STRENGTH_FINISHED) - time);
-                       if (getstatf(STAT_INVINCIBLE_FINISHED) - time > 0)
-                               sharpen_intensity += (getstatf(STAT_INVINCIBLE_FINISHED) - time);
                        sharpen_intensity = bound(0, sharpen_intensity, 5); // powerup warning time is 5 seconds, so fade the effect from there
 
-                       if(sharpen_intensity > 0)
+                       if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible
                        {
-                               if(sharpen_intensity != old_sharpen_intensity) // reduce cvar_set spam as much as possible
-                               {
-                                       cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(-sharpen_intensity * cvar("hud_powerup")), " 0 0"));
-                                       cvar_set("r_glsl_postprocess_uservec2_enable", "1");
-                                       old_sharpen_intensity = sharpen_intensity;
-                               }
-                       }
-                       else if(cvar("r_glsl_postprocess_uservec2_enable")) // reduce cvar_set spam as much as possible
-                       {
-                               cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");
-                               cvar_set("r_glsl_postprocess_uservec2_enable", "0");
+                               cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(-sharpen_intensity * cvar("hud_powerup")), " 0 0"));
+                               cvar_set("r_glsl_postprocess_uservec2_enable", "1");
+                               old_sharpen_intensity = sharpen_intensity;
                        }
                }
-       }
-
-       if(autocvar_hud_postprocessing && !autocvar_hud_postprocessing_maxbluralpha)
-       if(cvar("r_glsl_postprocess_uservec1_enable"))
-       {
-               // don't allow blur to get stuck on if we disable the cvar while damaged
-               cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");
-               cvar_set("r_glsl_postprocess_uservec1_enable", "0");
-       }
-       if(autocvar_hud_postprocessing && !autocvar_hud_powerup)
-       if(cvar("r_glsl_postprocess_uservec2_enable"))
-       {
-               // don't allow sharpen to get stuck on if we disable the cvar while powered up
-               cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");
-               cvar_set("r_glsl_postprocess_uservec2_enable", "0");
+               else if(cvar("r_glsl_postprocess_uservec2_enable")) // reduce cvar_set spam as much as possible
+               {
+                       cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");
+                       cvar_set("r_glsl_postprocess_uservec2_enable", "0");
+               }
        }
 
        // Draw the mouse cursor