]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/client/View.qc
Oops! Forgot the underwater blur code. Blur postprocessing will properly work now.
[voretournament/voretournament.git] / data / qcsrc / client / View.qc
index 0b37bef0d349dd267ddc7ab329bee25081f1e7eb..b8f17b1c031cc623d9cdef84da0f7d7fa10b7e96 100644 (file)
@@ -512,6 +512,22 @@ void CSQC_UpdateView(float w, float h)
                \r
                if(contentavgalpha)\r
                        drawfill('0 0 0', '1 0 0' * vid_conwidth + '0 1 0' * vid_conheight, liquidcolor_prev, contentavgalpha * liquidalpha_prev, DRAWFLAG_NORMAL);\r
+\r
+               if(cvar("hud_postprocessing"))\r
+               {\r
+                       if(cvar("hud_contents_blur"))\r
+                       {\r
+                               content_blurpostprocess_x = 1;\r
+                               content_blurpostprocess_y = contentavgalpha * cvar("hud_contents_blur");\r
+                               content_blurpostprocess_z = contentavgalpha * cvar("hud_contents_blur_alpha");\r
+                       }\r
+                       else\r
+                       {\r
+                               content_blurpostprocess_x = 0;\r
+                               content_blurpostprocess_y = 0;\r
+                               content_blurpostprocess_z = 0;\r
+                       }\r
+               }\r
        }\r
 \r
        if(cvar("hud_damage"))\r
@@ -620,7 +636,8 @@ void CSQC_UpdateView(float w, float h)
        }\r
 \r
        if(cvar("hud_postprocessing"))\r
-       { // lets apply the postprocess effects from the previous two functions if needed\r
+       {\r
+               // lets apply the postprocess effects from the previous two functions if needed\r
                if(damage_blurpostprocess_x || content_blurpostprocess_x)\r
                {\r
                        float blurradius = bound(0, damage_blurpostprocess_y + content_blurpostprocess_y, cvar("hud_postprocessing_maxblurradius"));\r
@@ -633,6 +650,40 @@ void CSQC_UpdateView(float w, float h)
                        cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");\r
                        cvar_set("r_glsl_postprocess_uservec1_enable", "0");\r
                }\r
+\r
+               if(cvar("hud_powerup"))\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
+                       {\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
+                       }\r
+                       else\r
+                       {\r
+                               cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");\r
+                               cvar_set("r_glsl_postprocess_uservec2_enable", "0");\r
+                       }\r
+               }\r
+       }\r
+\r
+       if not(cvar("hud_damage") && cvar("hud_postprocessing"))\r
+       {\r
+               // don't allow blur to get stuck on if we disable the cvar while damaged\r
+               cvar_set("r_glsl_postprocess_uservec1", "0 0 0 0");\r
+               cvar_set("r_glsl_postprocess_uservec1_enable", "0");\r
+       }\r
+       if not(cvar("hud_powerup") && cvar("hud_postprocessing"))\r
+       {\r
+               // don't allow sharpen to get stuck on if we disable the cvar while powered up\r
+               cvar_set("r_glsl_postprocess_uservec2", "0 0 0 0");\r
+               cvar_set("r_glsl_postprocess_uservec2_enable", "0");\r
        }\r
 \r
        // Draw the mouse cursor\r