]> de.git.xonotic.org Git - voretournament/voretournament.git/commitdiff
Make the hack less ugly, first step. Still needs one more fix to even work as it...
authorMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 26 Feb 2011 17:32:39 +0000 (19:32 +0200)
committerMirceaKitsune <sonichedgehog_hyperblast00@yahoo.com>
Sat, 26 Feb 2011 17:32:39 +0000 (19:32 +0200)
data/defaultVoretournament.cfg
data/qcsrc/client/View.qc
data/qcsrc/menu/voret/dialog_settings_audio.c

index 639bf5c845d0a2d9d5ab0770e9cd33dffe27a2cd..249497d911ee05293db05256b259499f3ee908d1 100644 (file)
@@ -1056,8 +1056,6 @@ seta menu_skin "earthy"
 set menu_slowmo 1\r
 seta menu_sounds 2 "enables menu sound effects. 1 enables click sounds, 2 also enables hover sounds"\r
 \r
-set menu_block_sound_sliders 0 "part of an ugly hack to allow the cl_vore_cutvolume cvars to work properly"\r
-\r
 r_textbrightness 0.2\r
 r_textcontrast 0.8\r
 r_textshadow 1\r
@@ -1532,6 +1530,10 @@ set g_vore_regurgitatecolor_release "0.4 0.6 0.1" "the color players will have w
 set g_vore_regurgitatecolor_release_fade 0.01 "how quickly the regurgitation color washes off players once they leave the stomach"\r
 set g_vore_regurgitatecolor_digest "0.15 0.25 0" "the color players will have when digested"\r
 \r
+// part of an ugly hack for the menu audio sliders to work with the cutsound feature\r
+set menu_volume $volume\r
+set menu_bgmvolume $bgmvolume\r
+\r
 set sv_weaponstats_damagefile "" "when set to a file name, per-weapon damage stats get written to that file"\r
 set sv_weaponstats_killfile "" "when set to a file name, per-weapon kill stats get written to that file"\r
 \r
index e4d4aa3d195eb952d6a9059fad6758edc580088d..0228949c6de4eb04a2889f9a72e33f6517899aad 100644 (file)
@@ -257,6 +257,7 @@ float myhealth, myhealth_prev, myhealth_flash;
 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;\r
+float volume_modify_changed_1, volume_modify_changed_2;\r
 vector myhealth_gentlergb;\r
 vector liquidcolor_prev;\r
 vector damage_blurpostprocess, content_blurpostprocess;\r
@@ -699,59 +700,60 @@ 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(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
+               if(volume_modify_changed_1 != cvar("menu_volume") || volume_modify_changed_2 != cvar("menu_bgmvolume"))\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
+                       // An ugly hack to allow the cutvolume feature to work with the menu audio sliders.\r
+                       // Without it, adjusting the music or master sound sliders while fading that volume would have bad results.\r
+                       // This needs to be done in a better way! Currently, changing the volume sliders will just reset the fading.\r
+\r
+                       volume_modify_default_1 = volume_modify_1 = cvar("volume");\r
+                       volume_modify_default_2 = volume_modify_2 = cvar("bgmvolume");\r
+\r
+                       volume_modify_changed_1 = cvar("menu_volume");\r
+                       volume_modify_changed_2 = cvar("menu_bgmvolume");\r
                }\r
                else\r
                {\r
-                       volume_modify_1_target = 1;\r
-                       volume_modify_2_target = 1;\r
-               }\r
-               volume_modify_fade = cvar("cl_vore_cutvolume_fade") * frametime;\r
-\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
-                       else if (volume_modify_1 < volume_modify_1_target - volume_modify_fade)\r
-                               volume_modify_1 += volume_modify_fade;\r
-                       else\r
-                               volume_modify_1 = volume_modify_1_target;\r
-\r
-                       if (volume_modify_2 > volume_modify_2_target + volume_modify_fade)\r
-                               volume_modify_2 -= volume_modify_fade;\r
-                       else if (volume_modify_2 < volume_modify_2_target - volume_modify_fade)\r
-                               volume_modify_2 += volume_modify_fade;\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
+                       }\r
                        else\r
-                               volume_modify_2 = volume_modify_1_target;\r
+                       {\r
+                               volume_modify_1_target = 1;\r
+                               volume_modify_2_target = 1;\r
+                       }\r
+                       volume_modify_fade = cvar("cl_vore_cutvolume_fade") * frametime;\r
 \r
-                       cvar_set("volume", ftos(volume_modify_1));\r
-                       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
+                       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
+                               else if (volume_modify_1 < volume_modify_1_target - volume_modify_fade)\r
+                                       volume_modify_1 += volume_modify_fade;\r
+                               else\r
+                                       volume_modify_1 = volume_modify_1_target;\r
 \r
-                       if(!cvar("menu_block_sound_sliders"))\r
-                               cvar_set("menu_block_sound_sliders", "1"); // ugly hack to block the sound sliders\r
-               }\r
-               else if not(getstati(STAT_VORE_EATEN))\r
-               {\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
+                               if (volume_modify_2 > volume_modify_2_target + volume_modify_fade)\r
+                                       volume_modify_2 -= volume_modify_fade;\r
+                               else if (volume_modify_2 < volume_modify_2_target - volume_modify_fade)\r
+                                       volume_modify_2 += volume_modify_fade;\r
+                               else\r
+                                       volume_modify_2 = volume_modify_1_target;\r
 \r
-                       if(cvar("menu_block_sound_sliders"))\r
-                               cvar_set("menu_block_sound_sliders", "0"); // ugly hack to block the sound sliders\r
+                               cvar_set("volume", ftos(volume_modify_1));\r
+                               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
                }\r
        }\r
-       else if(cvar("menu_block_sound_sliders"))\r
-               cvar_set("menu_block_sound_sliders", "0"); // ugly hack to block the sound sliders\r
 \r
        // Draw the mouse cursor\r
        // NOTE: drawpic must happen after R_RenderScene for some reason\r
index 5968216c22747feaf4ae13270ca719e599c1db05..b96b05af77b97f0ac4d10fd1f93ce4fb2f0baeca 100644 (file)
@@ -26,15 +26,15 @@ void fillVoretAudioSettingsTab(entity me)
                s = makeVoretDecibelsSlider(-20, 0, 0.5, "bgmvolume");\r
                me.TD(me, 1, 1, e = makeVoretSliderCheckBox(-1000000, 1, s, "Music:"));\r
                me.TD(me, 1, 2, s);\r
-               setDependent(e, "menu_block_sound_sliders", 0, 0); // part of an ugly hack that needs to be fixed\r
-               setDependent(s, "menu_block_sound_sliders", 0, 0); // part of an ugly hack that needs to be fixed\r
+               makeMulti(e, "menu_bgmvolume"); // part of an ugly hack for the menu audio sliders to work with the cutsound feature\r
+               makeMulti(s, "menu_bgmvolume"); // part of an ugly hack for the menu audio sliders to work with the cutsound feature\r
        me.TR(me);\r
        me.TR(me);\r
                s = makeVoretDecibelsSlider(-20, 0, 0.5, "volume");\r
                me.TD(me, 1, 1, e = makeVoretSliderCheckBox(-1000000, 1, s, "Master:"));\r
                me.TD(me, 1, 2, s);\r
-               setDependent(e, "menu_block_sound_sliders", 0, 0); // part of an ugly hack that needs to be fixed\r
-               setDependent(s, "menu_block_sound_sliders", 0, 0); // part of an ugly hack that needs to be fixed\r
+               makeMulti(e, "menu_volume"); // part of an ugly hack for the menu audio sliders to work with the cutsound feature\r
+               makeMulti(s, "menu_volume"); // part of an ugly hack for the menu audio sliders to work with the cutsound feature\r
        me.TR(me);\r
                me.TDempty(me, 0.2);\r
                s = makeVoretDecibelsSlider(-20, 0, 0.5, "snd_staticvolume");\r