]> de.git.xonotic.org Git - voretournament/voretournament.git/blobdiff - data/qcsrc/client/View.qc
Correct check on the cutsound cvars
[voretournament/voretournament.git] / data / qcsrc / client / View.qc
index aabe319c0fa1f876509b8cbb508b7407432cacf2..37926193de12c2cd1d3dfe33b0c19105096cbef5 100644 (file)
@@ -256,6 +256,7 @@ float pickup_crosshair_time, pickup_crosshair_size;
 float myhealth, myhealth_prev, myhealth_flash;\r
 float contentavgalpha, liquidalpha_prev;\r
 float stomachsplash_alpha, stomachsplash_remove_at_respawn;\r
+float volume_modify_1, volume_modify_2, volume_modify_default_1, volume_modify_default_2, volume_modify_default_set;\r
 vector myhealth_gentlergb;\r
 vector liquidcolor_prev;\r
 vector damage_blurpostprocess, content_blurpostprocess;\r
@@ -512,6 +513,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
@@ -635,18 +652,18 @@ void CSQC_UpdateView(float w, float h)
                        cvar_set("r_glsl_postprocess_uservec1_enable", "0");\r
                }\r
 \r
-               if(cvar("hud_postprocessing_maxsharpenalpha"))\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 match it\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("1 ", ftos(-sharpen_intensity * cvar("hud_postprocessing_maxsharpenalpha")), " 0 0"));\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
@@ -663,13 +680,59 @@ 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 not(cvar("hud_postprocessing_maxsharpenalpha") && cvar("hud_postprocessing"))\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
+       if(cvar("cl_vore_cutvolume_sound") < 1 || cvar("cl_vore_cutvolume_music") < 1)\r
+       {\r
+               if(!volume_modify_default_set)\r
+               {\r
+                       // set the initial volume\r
+                       volume_modify_default_1 = cvar("volume");\r
+                       volume_modify_default_2 = cvar("bgmvolume");\r
+                       volume_modify_default_set = TRUE;\r
+               }\r
+               if(spectatee_status == -1 || intermission)\r
+                       volume_modify_1 = volume_modify_2 = 1;\r
+               else if (getstati(STAT_VORE_EATEN))\r
+               {\r
+                       if (volume_modify_1 > cvar("cl_vore_cutvolume_sound"))\r
+                       {\r
+                               volume_modify_1 -= cvar("cl_vore_cutvolume_fade") * frametime;\r
+                               if(volume_modify_1 < cvar("cl_vore_cutvolume_sound"))\r
+                                       volume_modify_1 = cvar("cl_vore_cutvolume_sound");\r
+                       }\r
+                       if (volume_modify_2 > cvar("cl_vore_cutvolume_music"))\r
+                       {\r
+                               volume_modify_2 -= cvar("cl_vore_cutvolume_fade") * frametime;\r
+                               if(volume_modify_2 < cvar("cl_vore_cutvolume_music"))\r
+                                       volume_modify_2 = cvar("cl_vore_cutvolume_music");\r
+                       }\r
+               }\r
+               else\r
+               {\r
+                       if (volume_modify_1 < 1)\r
+                       {\r
+                               volume_modify_1 += cvar("cl_vore_cutvolume_fade") * frametime;\r
+                               if(volume_modify_1 > 1)\r
+                                       volume_modify_1 = 1;\r
+                       }\r
+                       if (volume_modify_2 < 1)\r
+                       {\r
+                               volume_modify_2 += cvar("cl_vore_cutvolume_fade") * frametime;\r
+                               if(volume_modify_2 > 1)\r
+                                       volume_modify_2 = 1;\r
+                       }\r
+               }\r
+               cvar_set("volume", ftos(volume_modify_default_1 * volume_modify_1));\r
+               cvar_set("bgmvolume", ftos(volume_modify_default_2 * volume_modify_2));\r
+               // TODO: Setting the "volume" cvar is a bad way to go, and modifies the menu slider! We need a better way to go\r
+       }\r
+\r
        // Draw the mouse cursor\r
        // NOTE: drawpic must happen after R_RenderScene for some reason\r
        //drawpic(getmousepos(), "gfx/cursor.tga", '11 14 0', '1 1 1', 1, 0);\r