From: MirceaKitsune Date: Sat, 26 Feb 2011 17:32:39 +0000 (+0200) Subject: Make the hack less ugly, first step. Still needs one more fix to even work as it... X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=65cc4d0d63c1cf585a455900ecab71350a6fbbbf;p=voretournament%2Fvoretournament.git Make the hack less ugly, first step. Still needs one more fix to even work as it should --- diff --git a/data/defaultVoretournament.cfg b/data/defaultVoretournament.cfg index 639bf5c8..249497d9 100644 --- a/data/defaultVoretournament.cfg +++ b/data/defaultVoretournament.cfg @@ -1056,8 +1056,6 @@ seta menu_skin "earthy" set menu_slowmo 1 seta menu_sounds 2 "enables menu sound effects. 1 enables click sounds, 2 also enables hover sounds" -set menu_block_sound_sliders 0 "part of an ugly hack to allow the cl_vore_cutvolume cvars to work properly" - r_textbrightness 0.2 r_textcontrast 0.8 r_textshadow 1 @@ -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" set g_vore_regurgitatecolor_digest "0.15 0.25 0" "the color players will have when digested" +// part of an ugly hack for the menu audio sliders to work with the cutsound feature +set menu_volume $volume +set menu_bgmvolume $bgmvolume + set sv_weaponstats_damagefile "" "when set to a file name, per-weapon damage stats get written to that file" set sv_weaponstats_killfile "" "when set to a file name, per-weapon kill stats get written to that file" diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index e4d4aa3d..0228949c 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -257,6 +257,7 @@ float myhealth, myhealth_prev, myhealth_flash; float contentavgalpha, liquidalpha_prev; float stomachsplash_alpha, stomachsplash_remove_at_respawn; float volume_modify_1, volume_modify_2, volume_modify_default_1, volume_modify_default_2; +float volume_modify_changed_1, volume_modify_changed_2; vector myhealth_gentlergb; vector liquidcolor_prev; vector damage_blurpostprocess, content_blurpostprocess; @@ -699,59 +700,60 @@ void CSQC_UpdateView(float w, float h) if(cvar("cl_vore_cutvolume_sound") < 1 || cvar("cl_vore_cutvolume_music") < 1) { float volume_modify_1_target, volume_modify_2_target, volume_modify_fade; - if(spectatee_status == -1 || intermission) - { - volume_modify_1_target = 1; - volume_modify_2_target = 1; - } - else if(getstati(STAT_VORE_EATEN)) + + if(volume_modify_changed_1 != cvar("menu_volume") || volume_modify_changed_2 != cvar("menu_bgmvolume")) { - volume_modify_1_target = volume_modify_default_1 * cvar("cl_vore_cutvolume_sound"); - volume_modify_2_target = volume_modify_default_2 * cvar("cl_vore_cutvolume_music"); + // An ugly hack to allow the cutvolume feature to work with the menu audio sliders. + // Without it, adjusting the music or master sound sliders while fading that volume would have bad results. + // This needs to be done in a better way! Currently, changing the volume sliders will just reset the fading. + + volume_modify_default_1 = volume_modify_1 = cvar("volume"); + volume_modify_default_2 = volume_modify_2 = cvar("bgmvolume"); + + volume_modify_changed_1 = cvar("menu_volume"); + volume_modify_changed_2 = cvar("menu_bgmvolume"); } else { - volume_modify_1_target = 1; - volume_modify_2_target = 1; - } - volume_modify_fade = cvar("cl_vore_cutvolume_fade") * frametime; - - if(volume_modify_1 != volume_modify_1_target || volume_modify_2 != volume_modify_2_target) - { - if (volume_modify_1 > volume_modify_1_target + volume_modify_fade) - volume_modify_1 -= volume_modify_fade; - else if (volume_modify_1 < volume_modify_1_target - volume_modify_fade) - volume_modify_1 += volume_modify_fade; - else - volume_modify_1 = volume_modify_1_target; - - if (volume_modify_2 > volume_modify_2_target + volume_modify_fade) - volume_modify_2 -= volume_modify_fade; - else if (volume_modify_2 < volume_modify_2_target - volume_modify_fade) - volume_modify_2 += volume_modify_fade; + if(spectatee_status == -1 || intermission) + { + volume_modify_1_target = 1; + volume_modify_2_target = 1; + } + else if(getstati(STAT_VORE_EATEN)) + { + volume_modify_1_target = volume_modify_default_1 * cvar("cl_vore_cutvolume_sound"); + volume_modify_2_target = volume_modify_default_2 * cvar("cl_vore_cutvolume_music"); + } else - volume_modify_2 = volume_modify_1_target; + { + volume_modify_1_target = 1; + volume_modify_2_target = 1; + } + volume_modify_fade = cvar("cl_vore_cutvolume_fade") * frametime; - cvar_set("volume", ftos(volume_modify_1)); - cvar_set("bgmvolume", ftos(volume_modify_2)); - // TODO: Setting the "volume" cvar is a bad way to go, and modifies the menu slider! We need a better way + if(volume_modify_1 != volume_modify_1_target || volume_modify_2 != volume_modify_2_target) + { + if (volume_modify_1 > volume_modify_1_target + volume_modify_fade) + volume_modify_1 -= volume_modify_fade; + else if (volume_modify_1 < volume_modify_1_target - volume_modify_fade) + volume_modify_1 += volume_modify_fade; + else + volume_modify_1 = volume_modify_1_target; - if(!cvar("menu_block_sound_sliders")) - cvar_set("menu_block_sound_sliders", "1"); // ugly hack to block the sound sliders - } - else if not(getstati(STAT_VORE_EATEN)) - { - // no volume fading is currently taking place, and we are not inside the stomach. - // so if we change the volume settings, update the initial volume - volume_modify_default_1 = cvar("volume"); - volume_modify_default_2 = cvar("bgmvolume"); + if (volume_modify_2 > volume_modify_2_target + volume_modify_fade) + volume_modify_2 -= volume_modify_fade; + else if (volume_modify_2 < volume_modify_2_target - volume_modify_fade) + volume_modify_2 += volume_modify_fade; + else + volume_modify_2 = volume_modify_1_target; - if(cvar("menu_block_sound_sliders")) - cvar_set("menu_block_sound_sliders", "0"); // ugly hack to block the sound sliders + cvar_set("volume", ftos(volume_modify_1)); + cvar_set("bgmvolume", ftos(volume_modify_2)); + // TODO: Setting the "volume" cvar is a bad way to go, and modifies the menu slider! We need a better way + } } } - else if(cvar("menu_block_sound_sliders")) - cvar_set("menu_block_sound_sliders", "0"); // ugly hack to block the sound sliders // Draw the mouse cursor // NOTE: drawpic must happen after R_RenderScene for some reason diff --git a/data/qcsrc/menu/voret/dialog_settings_audio.c b/data/qcsrc/menu/voret/dialog_settings_audio.c index 5968216c..b96b05af 100644 --- a/data/qcsrc/menu/voret/dialog_settings_audio.c +++ b/data/qcsrc/menu/voret/dialog_settings_audio.c @@ -26,15 +26,15 @@ void fillVoretAudioSettingsTab(entity me) s = makeVoretDecibelsSlider(-20, 0, 0.5, "bgmvolume"); me.TD(me, 1, 1, e = makeVoretSliderCheckBox(-1000000, 1, s, "Music:")); me.TD(me, 1, 2, s); - setDependent(e, "menu_block_sound_sliders", 0, 0); // part of an ugly hack that needs to be fixed - setDependent(s, "menu_block_sound_sliders", 0, 0); // part of an ugly hack that needs to be fixed + makeMulti(e, "menu_bgmvolume"); // part of an ugly hack for the menu audio sliders to work with the cutsound feature + makeMulti(s, "menu_bgmvolume"); // part of an ugly hack for the menu audio sliders to work with the cutsound feature me.TR(me); me.TR(me); s = makeVoretDecibelsSlider(-20, 0, 0.5, "volume"); me.TD(me, 1, 1, e = makeVoretSliderCheckBox(-1000000, 1, s, "Master:")); me.TD(me, 1, 2, s); - setDependent(e, "menu_block_sound_sliders", 0, 0); // part of an ugly hack that needs to be fixed - setDependent(s, "menu_block_sound_sliders", 0, 0); // part of an ugly hack that needs to be fixed + makeMulti(e, "menu_volume"); // part of an ugly hack for the menu audio sliders to work with the cutsound feature + makeMulti(s, "menu_volume"); // part of an ugly hack for the menu audio sliders to work with the cutsound feature me.TR(me); me.TDempty(me, 0.2); s = makeVoretDecibelsSlider(-20, 0, 0.5, "snd_staticvolume");