]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/client/View.qc
Make saturation depend on the amount of armor the player has (post process effect)
[voretournament/voretournament.git] / data / qcsrc / client / View.qc
index 6ae6d038c7a7b80db19593a418452c6ea1aa2417..843d0df23e2f572117cc9d1ac0802e94b8f33343 100644 (file)
@@ -253,7 +253,7 @@ float camera_mode;
 float reticle_type;\r
 float chase_active_old;\r
 float artwork_fade;\r
-float pickup_crosshair_time, pickup_crosshair_size;\r
+float pickup_crosshair_time, pickup_crosshair_size, pickup_flash_time;\r
 float myhealth, myhealth_prev, myhealth_flash;\r
 float contentavgalpha, liquidalpha_prev;\r
 float old_blurradius, old_bluralpha, old_sharpen_intensity;\r
@@ -322,6 +322,7 @@ void CSQC_UpdateView(float w, float h)
                        eventchase_target_origin = pmove_org - v_forward * eventchase_current_distance * (trace_fraction - 0.1);\r
 \r
                        R_SetView(VF_ORIGIN, eventchase_target_origin);\r
+                       R_SetView(VF_ANGLES, view_angles);\r
                }\r
                else if(cvar("chase_active") < 0) // time to disable chase_active if it was set by this code\r
                {\r
@@ -596,7 +597,7 @@ void CSQC_UpdateView(float w, float h)
                        \r
                contentalpha_temp = bound(0, drawframetime / max(0.0001, contentfadetime), 1);\r
                contentavgalpha = contentavgalpha * (1 - contentalpha_temp) + incontent * contentalpha_temp;\r
-               \r
+\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
@@ -740,6 +741,10 @@ void CSQC_UpdateView(float w, float h)
        {\r
                // all of this should be done in the engine eventually\r
 \r
+               // disable damage blur when dead, but keep content blur\r
+               if(getstati(STAT_HEALTH) <= 0)\r
+                       damage_blurpostprocess = '0 0 0';\r
+\r
                // 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
@@ -747,7 +752,7 @@ void CSQC_UpdateView(float w, float h)
                        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)\r
+               if((damage_blurpostprocess_x || content_blurpostprocess_x) && cvar("chase_active") >= 0) // not while the event chase camera is active\r
                {\r
                        float blurradius = bound(0, damage_blurpostprocess_y + content_blurpostprocess_y, cvar("hud_postprocessing_maxblurradius"));\r
                        float bluralpha = bound(0, damage_blurpostprocess_z + content_blurpostprocess_z, cvar("hud_postprocessing_maxbluralpha"));\r
@@ -771,7 +776,7 @@ void CSQC_UpdateView(float w, float h)
                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
+               if(cvar("hud_powerup") && sharpen_intensity > 0 && cvar("chase_active") >= 0) // not while the event chase camera is active\r
                {\r
                        sharpen_intensity = bound(0, sharpen_intensity, 5); // powerup warning time is 5 seconds, so fade the effect from there\r
 \r
@@ -803,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
@@ -1152,6 +1175,13 @@ void CSQC_UpdateView(float w, float h)
                                        wcross_scale += sin(pickup_crosshair_size) * cvar("crosshair_pickup");\r
                                }\r
 \r
+                               if(cvar("cl_flash_pickup"))\r
+                               if(pickup_flash_time < getstatf(STAT_LAST_PICKUP))\r
+                               {\r
+                                       localcmd(strcat("bf ", cvar_string("cl_flash_pickup_color"), " ", cvar_string("cl_flash_pickup"), "\n"));\r
+                                       pickup_flash_time = getstatf(STAT_LAST_PICKUP);\r
+                               }\r
+\r
                                if(shottype == SHOTTYPE_HITENEMY)\r
                                        wcross_scale *= cvar("crosshair_hittest"); // is not queried if hittest is 0\r
                                if(shottype == SHOTTYPE_HITTEAM)\r