mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Fix drop in volume when shooting into a Brains power screen.
If too many of these sounds are started in one frame (for example if the player shoots with the super shotgun into the power screen of a Brain) things get too loud and OpenAL is forced to scale the volume of several other sounds and the background music down. That leads to a noticable and annoying drop in the overall volume. Work around that by limiting the number of sounds started. 16 was choosen by empirical testing.
This commit is contained in:
parent
e30f824944
commit
e3e5bd1bdd
3 changed files with 32 additions and 1 deletions
|
@ -92,6 +92,11 @@ centity_t cl_entities[MAX_EDICTS];
|
|||
|
||||
entity_state_t cl_parse_entities[MAX_PARSE_ENTITIES];
|
||||
|
||||
/*Evil hack against too many power screen and power
|
||||
shield impact sounds. For example if the player
|
||||
fires his shotgun onto a Brain. */
|
||||
int num_power_sounds;
|
||||
|
||||
extern cvar_t *allow_download;
|
||||
extern cvar_t *allow_download_players;
|
||||
extern cvar_t *allow_download_models;
|
||||
|
@ -733,6 +738,9 @@ CL_Frame(int packetdelta, int renderdelta, int timedelta, qboolean packetframe,
|
|||
cls.netchan.last_received = Sys_Milliseconds();
|
||||
}
|
||||
|
||||
// Reset power shield / power screen sound counter.
|
||||
num_power_sounds = 0;
|
||||
|
||||
if (!cl_timedemo->value)
|
||||
{
|
||||
// Don't throttle too much when connecting / loading.
|
||||
|
|
|
@ -24,7 +24,9 @@
|
|||
* =======================================================================
|
||||
*/
|
||||
|
||||
#include <SDL2/SDL_scancode.h>
|
||||
#include "header/client.h"
|
||||
#include "sound/header/local.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
@ -716,7 +718,23 @@ CL_ParseTEnt(void)
|
|||
CL_ParticleEffect(pos, dir, 0xb0, 40);
|
||||
}
|
||||
|
||||
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
||||
num_power_sounds++;
|
||||
|
||||
/* If too many of these sounds are started in one frame (for
|
||||
* example if the player shoots with the super shotgun into
|
||||
* the power screen of a Brain) things get too loud and OpenAL
|
||||
* is forced to scale the volume of several other sounds and
|
||||
* the background music down. That leads to a noticable and
|
||||
* annoying drop in the overall volume.
|
||||
*
|
||||
* Work around that by limiting the number of sounds started.
|
||||
* 16 was choosen by empirical testing.
|
||||
*/
|
||||
if (sound_started == SS_OAL && num_power_sounds < 16)
|
||||
{
|
||||
S_StartSound(pos, 0, 0, cl_sfx_lashit, 1, ATTN_NORM, 0);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TE_SHOTGUN: /* bullet hitting wall */
|
||||
|
|
|
@ -249,6 +249,11 @@ typedef struct
|
|||
|
||||
extern client_static_t cls;
|
||||
|
||||
/*Evil hack against too many power screen and power
|
||||
shield impact sounds. For example if the player
|
||||
fires his shotgun onto a Brain. */
|
||||
extern int num_power_sounds;
|
||||
|
||||
/* cvars */
|
||||
extern cvar_t *gl_stereo_separation;
|
||||
extern cvar_t *gl_stereo_convergence;
|
||||
|
|
Loading…
Reference in a new issue