]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/client/View.qc
Use celshading and celoutlines for the cartoon effect. Keep the old system for poweru...
[voretournament/voretournament.git] / data / qcsrc / client / View.qc
index bd47712070c7091674e5f565b9da4397e1617d6b..b6eb14c10dc630d416110877b361795e4d4257c8 100644 (file)
@@ -904,8 +904,8 @@ void CSQC_UpdateView(float w, float h)
                // 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_cartoon") != 0))\r
-                       cvar_set("r_glsl_postprocess_uservec2_enable", ftos(cvar("hud_cartoon") != 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) && cvar("chase_active") >= 0) // not while the event chase camera is active\r
@@ -926,20 +926,24 @@ void CSQC_UpdateView(float w, float h)
                        old_bluralpha = 0;\r
                }\r
 \r
-               if(cvar("hud_cartoon"))\r
+               if(cvar("hud_powerup"))\r
                {\r
-                       // When having the strength or invincible powerups, cartoon lines will be white instead of black.\r
-                       // As powerup time goes under 5 seconds (warning time), lines will fade from white to nothing then from nothing back to black.\r
-                       float cartoon_intensity, cartoon_powerup;\r
-                       cartoon_intensity = -cvar("hud_cartoon");\r
-                       cartoon_powerup = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 5) + bound(0, getstatf(STAT_INVINCIBLE_FINISHED) - time, 5);\r
-                       cartoon_powerup = bound(0, cartoon_powerup, 5);\r
-                       if (cartoon_powerup && cvar("chase_active") >= 0) // not while the event chase camera is active\r
-                               cartoon_intensity *= 1 - cartoon_powerup / 2.5; // cycle between -1 and 1\r
+                       // When having the strength or invincible powerups, enable white outlines\r
+                       // As powerup time goes under 5 seconds (warning time) the lines fade away\r
+                       float cartoon_intensity;\r
+\r
+                       if((getstatf(STAT_STRENGTH_FINISHED) >= time || getstatf(STAT_INVINCIBLE_FINISHED) >= time) && cvar("chase_active") >= 0)\r
+                       {\r
+                               // not while the event chase camera is active\r
+                               cartoon_intensity = bound(0, getstatf(STAT_STRENGTH_FINISHED) - time, 5) + bound(0, getstatf(STAT_INVINCIBLE_FINISHED) - time, 5);\r
+                               cartoon_intensity = cvar("hud_powerup") * bound(0, cartoon_intensity, 5);\r
+                       }\r
+                       else\r
+                               cartoon_intensity = 0;\r
 \r
                        if(cartoon_intensity != old_cartoon_intensity) // reduce cvar_set spam as much as possible\r
                        {\r
-                               cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(cartoon_intensity), " ", cvar_string("hud_cartoon_tolerance"), " 0"));\r
+                               cvar_set("r_glsl_postprocess_uservec2", strcat("0 ", ftos(cartoon_intensity), " ", cvar_string("hud_powerup_tolerance"), " 0"));\r
                                old_cartoon_intensity = cartoon_intensity;\r
                        }\r
                }\r
@@ -957,7 +961,7 @@ 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
-       if(cvar("hud_postprocessing") && !cvar("hud_cartoon"))\r
+       if(cvar("hud_postprocessing") && !cvar("hud_powerup"))\r
        if(cvar("r_glsl_postprocess_uservec2_enable"))\r
        {\r
                // don't allow sharpen to get stuck on if we disable the cvar while powered up\r