Improve the cutsound code. Unfortunately, as long as the cutsound feature is enabled...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 26 Feb 2011 16:32:43 +0000 (18:32 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 26 Feb 2011 16:32:43 +0000 (18:32 +0200)
data/qcsrc/client/View.qc

index 0e4167c..f7a268e 100644 (file)
@@ -699,7 +699,12 @@ void CSQC_UpdateView(float w, float h)
        if(cvar("cl_vore_cutvolume_sound") < 1 || cvar("cl_vore_cutvolume_music") < 1)\r
        {\r
                float volume_modify_1_target, volume_modify_2_target, volume_modify_fade;\r
-               if(getstati(STAT_VORE_EATEN))\r
+               if(spectatee_status == -1 || intermission)\r
+               {\r
+                       volume_modify_1_target = 1;\r
+                       volume_modify_2_target = 1;\r
+               }\r
+               else if(getstati(STAT_VORE_EATEN))\r
                {\r
                        volume_modify_1_target = volume_modify_default_1 * cvar("cl_vore_cutvolume_sound");\r
                        volume_modify_2_target = volume_modify_default_2 * cvar("cl_vore_cutvolume_music");\r
@@ -711,13 +716,7 @@ void CSQC_UpdateView(float w, float h)
                }\r
                volume_modify_fade = cvar("cl_vore_cutvolume_fade") * frametime;\r
 \r
-               if(spectatee_status == -1 || intermission)\r
-               {\r
-                       // no volume fading is currently taking place, so if we change the volume settings, update the initial volume\r
-                       volume_modify_default_1 = cvar("volume");\r
-                       volume_modify_default_2 = cvar("bgmvolume");\r
-               }\r
-               else if(volume_modify_1 != volume_modify_1_target || volume_modify_2 != volume_modify_2_target)\r
+               if(volume_modify_1 != volume_modify_1_target || volume_modify_2 != volume_modify_2_target)\r
                {\r
                        if (volume_modify_1 > volume_modify_1_target + volume_modify_fade)\r
                                volume_modify_1 -= volume_modify_fade;\r
@@ -737,9 +736,10 @@ void CSQC_UpdateView(float w, float h)
                        cvar_set("bgmvolume", ftos(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\r
                }\r
-               else if(cvar("volume") != volume_modify_default_1 || cvar("bgmvolume") != volume_modify_default_2)\r
+               else if not(getstati(STAT_VORE_EATEN))\r
                {\r
-                       // no volume fading is currently taking place, so if we change the volume settings, update the initial volume\r
+                       // no volume fading is currently taking place, and we are not inside the stomach.\r
+                       // so if we change the volume settings, update the initial volume\r
                        volume_modify_default_1 = cvar("volume");\r
                        volume_modify_default_2 = cvar("bgmvolume");\r
                }\r