From: MirceaKitsune Date: Sat, 26 Feb 2011 13:34:09 +0000 (+0200) Subject: Sound and music cutting effect when inside the stomach X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=53a2c041041c0d9d9eddc4cb0f43f842349a2b03;p=voretournament%2Fvoretournament.git Sound and music cutting effect when inside the stomach --- diff --git a/data/defaultVoretournament.cfg b/data/defaultVoretournament.cfg index 866a6cbc..29bbf3cb 100644 --- a/data/defaultVoretournament.cfg +++ b/data/defaultVoretournament.cfg @@ -1512,6 +1512,9 @@ seta g_ghost_items_color "-1 -1 -1" "color of ghosted items, 0 0 0 leaves the co set cl_vore_stomachmodel 1 "when enabled, we see the stomach model around us when eaten. -1 = disabled, 1 = enabled, anything between 0 and 1 = alpha" set cl_vore_cameraspeed 1.5 "speed at which you see yourself sliding down when swallowed, 0 disables" set cl_vore_punchangle 10 "your view gets tilted by this amount when swallowing or regurgitating someone" +set cl_vore_cutvolume_sound 0.5 "sound volume is reduced by this amount when you are in a stomach" +set cl_vore_cutvolume_music 0.5 "music volume is reduced by this amount when you are in a stomach" +set cl_vore_cutvolume_fade 0.1 "fading speed of the volume change" set g_vore 1 "enables the vore system, you want this on!" set g_vore_digestion 1 "enables digestion system, you want this on!" set g_vore_kick 1 "enables stomach kick system, you want this on!" diff --git a/data/qcsrc/client/View.qc b/data/qcsrc/client/View.qc index b8f17b1c..98c97ab7 100644 --- a/data/qcsrc/client/View.qc +++ b/data/qcsrc/client/View.qc @@ -256,6 +256,7 @@ float pickup_crosshair_time, pickup_crosshair_size; 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, volume_modify_default_set; vector myhealth_gentlergb; vector liquidcolor_prev; vector damage_blurpostprocess, content_blurpostprocess; @@ -686,6 +687,52 @@ void CSQC_UpdateView(float w, float h) cvar_set("r_glsl_postprocess_uservec2_enable", "0"); } + if(cvar("cl_vore_cutvolume_sound") || cvar("cl_vore_cutvolume_music")) + { + if(!volume_modify_default_set) + { + // set the initial volume + volume_modify_default_1 = cvar("volume"); + volume_modify_default_2 = cvar("bgmvolume"); + volume_modify_default_set = TRUE; + } + if(spectatee_status == -1 || intermission) + volume_modify_1 = volume_modify_2 = 1; + else if (getstati(STAT_VORE_EATEN)) + { + if (volume_modify_1 > cvar("cl_vore_cutvolume_sound")) + { + volume_modify_1 -= cvar("cl_vore_cutvolume_fade") * frametime; + if(volume_modify_1 < cvar("cl_vore_cutvolume_sound")) + volume_modify_1 = cvar("cl_vore_cutvolume_sound"); + } + if (volume_modify_2 > cvar("cl_vore_cutvolume_music")) + { + volume_modify_2 -= cvar("cl_vore_cutvolume_fade") * frametime; + if(volume_modify_2 < cvar("cl_vore_cutvolume_music")) + volume_modify_2 = cvar("cl_vore_cutvolume_music"); + } + } + else + { + if (volume_modify_1 < 1) + { + volume_modify_1 += cvar("cl_vore_cutvolume_fade") * frametime; + if(volume_modify_1 > 1) + volume_modify_1 = 1; + } + if (volume_modify_2 < 1) + { + volume_modify_2 += cvar("cl_vore_cutvolume_fade") * frametime; + if(volume_modify_2 > 1) + volume_modify_2 = 1; + } + } + cvar_set("volume", ftos(volume_modify_default_1 * volume_modify_1)); + cvar_set("bgmvolume", ftos(volume_modify_default_2 * volume_modify_2)); + // TODO: Setting the "volume" cvar is a bad way to go, and modifies the menu slider! We need a better way to go + } + // Draw the mouse cursor // NOTE: drawpic must happen after R_RenderScene for some reason //drawpic(getmousepos(), "gfx/cursor.tga", '11 14 0', '1 1 1', 1, 0);