From b9fadf81cc9d4b94e2c08f5733d438e85f529cd6 Mon Sep 17 00:00:00 2001 From: MirceaKitsune Date: Sat, 19 Nov 2011 00:59:41 +0200 Subject: [PATCH] Volume cutting: Don't reduce music and sound volume when in the stomach only. But also account prey swallow progress. Therefore, volume will start fading while you are being swallowed, and reach its minimum point once you have been eaten completely --- data/defaultVT.cfg | 5 +-- data/qcsrc/client/View.qc | 81 +++++++++++---------------------------- 2 files changed, 25 insertions(+), 61 deletions(-) diff --git a/data/defaultVT.cfg b/data/defaultVT.cfg index 2bd4aec8..4555317d 100644 --- a/data/defaultVT.cfg +++ b/data/defaultVT.cfg @@ -1605,9 +1605,8 @@ seta g_ghost_items_color "-1 -1 -1" "color of ghosted items, 0 0 0 leaves the co seta cl_vore_stomachmodel 1 "when enabled, we see the stomach model around us when eaten. -1 = disabled, 1 = enabled, anything between = alpha" seta cl_vore_swallowmodel 1 "when enabled, we see the swallow model around us while getting eaten. -1 = disabled, 1 = enabled, anything between = alpha" -seta cl_vore_cutvolume_sound 0.75 "sound volume is reduced to this amount when you are in a stomach" -seta cl_vore_cutvolume_music 0.25 "music volume is reduced to this amount when you are in a stomach" -seta cl_vore_cutvolume_fade 1 "fading speed of the volume change" +seta cl_vore_cutvolume_sound 0.75 "sound volume is reduced to this amount when you are in a stomach or being swallowed" +seta cl_vore_cutvolume_music 0.15 "music volume is reduced to this amount when you are in a stomach or being swallowed" seta cl_vore_autodigest 0 "when enabled, the player will automatically begin digesting enemy prey after eating them, as long as no team mates are inside (automated digest key)" seta cl_vore_vieweffects_idlescale_predator 35 "the view will move around by this ammount while swallowing someone (based on progress), reserves the cvar v_idlescale" seta cl_vore_vieweffects_idlescale_prey 50 "the view will move around by this ammount while being swallowed (based on progress), reserves the cvar v_idlescale" diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index 113d8c54..58e1082b 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -255,8 +255,6 @@ float myhealth, myhealth_prev, myhealth_flash; float contentavgalpha, liquidalpha_prev; float old_blurradius, old_bluralpha, old_cartoon_intensity; float stomachsplash_alpha; -float volume_modify_1, volume_modify_2, volume_modify_default_1, volume_modify_default_2; -float volume_modify_changed_1, volume_modify_changed_2; float eventchase_current_distance; float helper_pause, helper_health, helper_armor, helper_ammo, helper_speed, helper_stomachload; vector myhealth_gentlergb; @@ -961,63 +959,30 @@ void CSQC_UpdateView(float w, float h) cvar_set("r_glsl_saturation", "1"); } - // volume cutting - if(cvar("cl_vore_cutvolume_sound") < 1 || cvar("cl_vore_cutvolume_music") < 1 && frametime) + float target_volume; + if(cvar("cl_vore_cutvolume_sound") && frametime) { - float volume_modify_1_target, volume_modify_2_target, volume_modify_fade; - - if(volume_modify_changed_1 != cvar("menu_volume") || volume_modify_changed_2 != cvar("menu_bgmvolume")) - { - // 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 = cvar("menu_volume"); - volume_modify_default_2 = cvar("menu_bgmvolume"); - - volume_modify_changed_1 = cvar("menu_volume"); - volume_modify_changed_2 = cvar("menu_bgmvolume"); - } - else - { - if(spectatee_status == -1 || intermission) - { - volume_modify_1_target = volume_modify_default_1; - volume_modify_2_target = volume_modify_default_2; - } - 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_1_target = volume_modify_default_1; - volume_modify_2_target = volume_modify_default_2; - } - 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; - else - volume_modify_2 = volume_modify_2_target; - - 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 - } - } + // sound volume cutting + if(getstatf(STAT_VORE_PROGRESS_PREY)) + target_volume = getstatf(STAT_VORE_PROGRESS_PREY); + else if(getstati(STAT_VORE_EATEN)) + target_volume = 1; + target_volume = cvar("menu_volume") * (1 - target_volume * cvar("cl_vore_cutvolume_sound")); + + if(cvar("volume") != target_volume) // reduce cvar_set spam as much as possible + cvar_set("volume", ftos(target_volume)); + } + if(cvar("cl_vore_cutvolume_music") && frametime) + { + // music volume cutting + if(getstatf(STAT_VORE_PROGRESS_PREY)) + target_volume = getstatf(STAT_VORE_PROGRESS_PREY); + else if(getstati(STAT_VORE_EATEN)) + target_volume = 1; + target_volume = cvar("menu_bgmvolume") * (1 - target_volume * cvar("cl_vore_cutvolume_music")); + + if(cvar("bgmvolume") != target_volume) // reduce cvar_set spam as much as possible + cvar_set("bgmvolume", ftos(target_volume)); } // Draw the mouse cursor -- 2.39.2