Make saturation depend on the amount of armor the player has (post process effect)
[voretournament/voretournament.git] / data / qcsrc / client / View.qc
index 3daed15576e4d181a64aa3272457ad572c5ca250..843d0df23e2f572117cc9d1ac0802e94b8f33343 100644 (file)
@@ -808,6 +808,24 @@ void CSQC_UpdateView(float w, float h)
                cvar_set("r_glsl_postprocess_uservec2_enable", "0");\r
        }\r
 \r
+       if(cvar("hud_postprocessing") && cvar("hud_saturation"))\r
+       {\r
+               // change saturation based on the amount of armor we have\r
+               // ranges between 0 and 50 armor. 0 armor is saturation 0.5, and 0.5 armor or above is saturation 1\r
+\r
+               if(armor_enabled && spectatee_status != -1 && getstati(STAT_HEALTH) > 0)\r
+               {\r
+                       float saturation;\r
+                       saturation = 0.5 + (getstati(STAT_ARMOR) * 1 * 0.01);\r
+                       saturation = bound(0, saturation, 1);\r
+\r
+                       if(cvar("r_glsl_saturation") != saturation)\r
+                               cvar_set("r_glsl_saturation", ftos(saturation));\r
+               }\r
+               else if(cvar("r_glsl_saturation") != 1)\r
+                       cvar_set("r_glsl_saturation", "1");\r
+       }\r
+\r
        // volume cutting\r
        if(cvar("cl_vore_cutvolume_sound") < 1 || cvar("cl_vore_cutvolume_music") < 1)\r
        {\r