sound loads during gameplay print warnings and get denied for looping sounds

This commit is contained in:
myT 2020-10-15 05:07:55 +02:00
parent bb9e814837
commit e50a60fe17
2 changed files with 29 additions and 3 deletions

View file

@ -7,6 +7,8 @@ DD Mmm 20 - 1.53
add: r_alphaToCoverageMipBoost <0.0 to 0.5> (default: 0.125) boosts the alpha value of higher mip levels
with A2C enabled, it prevents alpha-tested surfaces from fading (too much) in the distance
chg: sound loads from disk during gameplay print warnings and get denied for looping sounds
chg: com_soundMegs now defaults to 16
chg: all rendering backends use depth clipping, near clip plane distance is 1 instead of 4

View file

@ -196,9 +196,33 @@ static sfx_t* S_FindName( const char *name )
}
static void S_memoryLoad( sfx_t* sfx )
static void S_memoryLoad( sfx_t* sfx, qbool looping = qfalse )
{
if ( !S_LoadSound( sfx ) ) {
if ( cls.state == CA_ACTIVE ) {
static int64_t lastMessage = -1000;
const int64_t currTime = Sys_Milliseconds();
if ( currTime >= lastMessage + 1000 ) {
Com_Printf(
"^3WARNING^7: " S_COLOR_CVAR "com_soundMegs " S_COLOR_VAL "%d ^7is too low for this map!\n",
Cvar_VariableIntegerValue( "com_soundMegs" ) );
if ( looping )
Com_Printf( "^1ERROR ^7: blocked sound load: '%s'\n", sfx->soundName );
else
Com_Printf( "^3WARNING^7: allowed sound load: '%s'\n", sfx->soundName );
}
lastMessage = currTime;
}
if ( cls.state == CA_ACTIVE && looping ) {
// never load a looping sound on demand when the map is already loaded
// this should help prevent performance dropping massively on some maps
// with very long ambient sounds, e.g. ct3tourney3
// the downside is that some legit stuff can be filtered out (e.g. RG hum)
// that should be fine though as we expect the user to take action quickly
sfx->defaultSound = qtrue;
}
else if ( !S_LoadSound( sfx ) ) {
//Com_Printf( S_COLOR_YELLOW "WARNING: couldn't load sound: %s\n", sfx->soundName );
sfx->defaultSound = qtrue;
}
@ -537,7 +561,7 @@ static void S_Base_AddLoopingSound( int entityNum, const vec3_t origin, sfxHandl
sfx_t* sfx = &s_knownSfx[ sfxHandle ];
if (sfx->inMemory == qfalse) {
S_memoryLoad(sfx);
S_memoryLoad( sfx, qtrue );
}
if ( !sfx->soundLength ) {