diff options
author | Simon Howard | 2008-09-25 18:14:46 +0000 |
---|---|---|
committer | Simon Howard | 2008-09-25 18:14:46 +0000 |
commit | 6ebcafd7003cce44d1edd1115e737f1aa826ba1c (patch) | |
tree | 415dd7efa69bbbee473447e62350b7a88b7551b3 /src/i_sdlsound.c | |
parent | facc2f70b1bfac51ddaefb78fcbef04a8d5c8e2b (diff) | |
download | chocolate-doom-6ebcafd7003cce44d1edd1115e737f1aa826ba1c.tar.gz chocolate-doom-6ebcafd7003cce44d1edd1115e737f1aa826ba1c.tar.bz2 chocolate-doom-6ebcafd7003cce44d1edd1115e737f1aa826ba1c.zip |
Add option to low-level sound API to disable the DS prefix for sound
effects, for Heretic. Fix sound links.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1281
Diffstat (limited to 'src/i_sdlsound.c')
-rw-r--r-- | src/i_sdlsound.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/i_sdlsound.c b/src/i_sdlsound.c index 242fcb1c..1586ef18 100644 --- a/src/i_sdlsound.c +++ b/src/i_sdlsound.c @@ -57,6 +57,7 @@ static sfxinfo_t *channels_playing[NUM_CHANNELS]; static int mixer_freq; static Uint16 mixer_format; static int mixer_channels; +static boolean use_sfx_prefix; static void (*ExpandSoundData)(sfxinfo_t *sfxinfo, byte *data, int samplerate, @@ -462,7 +463,7 @@ static void I_SDL_PrecacheSounds(sfxinfo_t *sounds, int num_sounds) fflush(stdout); } - sprintf(namebuf, "ds%s", DEH_String(sounds[i].name)); + GetSfxLumpName(&sounds[i], namebuf); sounds[i].lumpnum = W_CheckNumForName(namebuf); @@ -512,18 +513,39 @@ static boolean LockSound(sfxinfo_t *sfxinfo) return true; } +static void GetSfxLumpName(sfxinfo_t *sfx, char *buf) +{ + // Linked sfx lumps? Get the lump number for the sound linked to. + + if (sfx->link != NULL) + { + sfx = sfx->link; + } + + // Doom adds a DS* prefix to sound lumps; Heretic and Hexen don't + // do this. + + if (use_sfx_prefix) + { + sprintf(buf, "ds%s", DEH_String(sfx->name)); + } + else + { + strcpy(buf, DEH_String(sfx->name)); + } +} // // Retrieve the raw data lump index // for a given SFX name. // -static int I_SDL_GetSfxLumpNum(sfxinfo_t* sfx) +static int I_SDL_GetSfxLumpNum(sfxinfo_t *sfx) { char namebuf[9]; - sprintf(namebuf, "ds%s", DEH_String(sfx->name)); - + GetSfxLumpName(sfx, namebuf); + return W_GetNumForName(namebuf); } @@ -654,10 +676,12 @@ static void I_SDL_ShutdownSound(void) } -static boolean I_SDL_InitSound(void) +static boolean I_SDL_InitSound(boolean _use_sfx_prefix) { int i; + use_sfx_prefix = _use_sfx_prefix; + // No sounds yet for (i=0; i<NUM_CHANNELS; ++i) |