From dc4ca9b29046ec6536890b1960373789bf254722 Mon Sep 17 00:00:00 2001 From: Spoike Date: Thu, 5 Oct 2006 22:11:17 +0000 Subject: [PATCH] When sounds can't be found, don't spam the same message over and over again. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2401 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_main.c | 1 + engine/client/cl_parse.c | 1 + engine/client/snd_dma.c | 7 +++++++ engine/client/snd_mem.c | 6 ++++++ engine/client/sound.h | 1 + 5 files changed, 16 insertions(+) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 53fd759b8..14629b1a3 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -922,6 +922,7 @@ void CL_ClearState (void) CL_AllowIndependantSendCmd(false); //model stuff could be a problem. S_StopAllSounds (true); + S_ResetFailedLoad(); Cvar_ApplyLatches(CVAR_SERVEROVERRIDE); diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index 06d26a84b..bc418d9eb 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -432,6 +432,7 @@ void CL_FinishDownload(char *filename, char *tempname) break; } } + S_ResetFailedLoad(); //okay, so this can still get a little spammy in bad places... //this'll do the magic for us Skin_FlushSkin(filename); diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index 709cdccd8..b00c8895f 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -720,6 +720,13 @@ sfx_t *S_FindName (char *name) return sfx; } +void S_ResetFailedLoad(void) +{ + int i; + for (i=0 ; i < num_sfx ; i++) + known_sfx[i].failedload = false; +} + /* ================== diff --git a/engine/client/snd_mem.c b/engine/client/snd_mem.c index f2e337557..7b738d55d 100644 --- a/engine/client/snd_mem.c +++ b/engine/client/snd_mem.c @@ -785,6 +785,9 @@ sfxcache_t *S_LoadSound (sfx_t *s) char *name = s->name; + if (s->failedload) + return NULL; //it failed to load once before, don't bother trying again. + // see if still in memory sc = Cache_Check (&s->cache); if (sc) @@ -854,6 +857,7 @@ sfxcache_t *S_LoadSound (sfx_t *s) { //FIXME: check to see if qued for download. Con_DPrintf ("Couldn't load %s\n", namebuffer); + s->failedload = true; return NULL; } @@ -866,6 +870,8 @@ sfxcache_t *S_LoadSound (sfx_t *s) return sc; } } + + s->failedload = true; return NULL; } diff --git a/engine/client/sound.h b/engine/client/sound.h index c442a1c12..a3d3b408b 100644 --- a/engine/client/sound.h +++ b/engine/client/sound.h @@ -48,6 +48,7 @@ typedef struct { typedef struct sfx_s { char name[MAX_OSPATH]; + qboolean failedload; //no more super-spammy cache_user_t cache; sfxdecode_t *decoder; } sfx_t;