diff options
Diffstat (limited to 'src/i_pcsound.c')
-rw-r--r-- | src/i_pcsound.c | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/src/i_pcsound.c b/src/i_pcsound.c index c2c77fe7..7ea545c4 100644 --- a/src/i_pcsound.c +++ b/src/i_pcsound.c @@ -25,12 +25,10 @@ #include "SDL.h" -#include "doomdef.h" #include "doomtype.h" -#include "deh_main.h" -#include "s_sound.h" -#include "sounds.h" +#include "deh_str.h" +#include "i_sound.h" #include "w_wad.h" #include "z_zone.h" @@ -103,7 +101,7 @@ static void PCSCallbackFunc(int *duration, int *freq) SDL_UnlockMutex(sound_lock); } -static boolean CachePCSLump(int sound_id) +static boolean CachePCSLump(sfxinfo_t *sfxinfo) { int lumplen; int headerlen; @@ -118,8 +116,8 @@ static boolean CachePCSLump(int sound_id) // Load from WAD - current_sound_lump = W_CacheLumpNum(S_sfx[sound_id].lumpnum, PU_STATIC); - lumplen = W_LumpLength(S_sfx[sound_id].lumpnum); + current_sound_lump = W_CacheLumpNum(sfxinfo->lumpnum, PU_STATIC); + lumplen = W_LumpLength(sfxinfo->lumpnum); // Read header @@ -139,12 +137,39 @@ static boolean CachePCSLump(int sound_id) current_sound_remaining = headerlen; current_sound_pos = current_sound_lump + 4; - current_sound_lump_num = S_sfx[sound_id].lumpnum; + current_sound_lump_num = sfxinfo->lumpnum; return true; } -static int I_PCS_StartSound(int id, +// These Doom PC speaker sounds are not played - this can be seen in the +// Heretic source code, where there are remnants of this left over +// from Doom. + +static boolean IsDisabledSound(sfxinfo_t *sfxinfo) +{ + int i; + const char *disabled_sounds[] = { + "posact", + "bgact", + "dmact", + "dmpain", + "popain", + "sawidl", + }; + + for (i=0; i<arrlen(disabled_sounds); ++i) + { + if (!strcmp(sfxinfo->name, disabled_sounds[i])) + { + return true; + } + } + + return false; +} + +static int I_PCS_StartSound(sfxinfo_t *sfxinfo, int channel, int vol, int sep) @@ -156,12 +181,7 @@ static int I_PCS_StartSound(int id, return -1; } - // These PC speaker sounds are not played - this can be seen in the - // Heretic source code, where there are remnants of this left over - // from Doom. - - if (id == sfx_posact || id == sfx_bgact || id == sfx_dmact - || id == sfx_dmpain || id == sfx_popain || id == sfx_sawidl) + if (IsDisabledSound(sfxinfo)) { return -1; } @@ -171,7 +191,7 @@ static int I_PCS_StartSound(int id, return -1; } - result = CachePCSLump(id); + result = CachePCSLump(sfxinfo); if (result) { |