- Blood: add a dummy sound entry at index 0.

Parts of the sound system treat entry 0 as "no sound" so nothing placed there would play.
This made the one custom sound in "The Way of Ira" not play because as the last sound being defined it ended up in the first, invalid slot.
This commit is contained in:
Christoph Oelckers 2021-04-12 00:10:43 +02:00
parent d25838fe15
commit f87e40131f
4 changed files with 54 additions and 48 deletions

View file

@ -297,3 +297,18 @@ CCMD(playsoundid)
} }
} }
} }
//==========================================================================
//
// CCMD listsounds
//
//==========================================================================
CCMD(listsounds)
{
auto& S_sfx = soundEngine->GetSounds();
for (unsigned i = 0; i < S_sfx.Size(); i++)
{
Printf("%4d: name = %s, resId = %d, lumpnum = %d\n", i, S_sfx[i].name.GetChars(), S_sfx[i].ResourceId, S_sfx[i].lumpnum);
}
}

View file

@ -58,15 +58,6 @@ public:
}; };
void sfxInit(void)
{
soundEngine = new BloodSoundEngine;
}
void sfxTerm()
{
}
//========================================================================== //==========================================================================
// //
// //

View file

@ -106,7 +106,8 @@ static void S_AddBloodSFX(int lumpnum)
void sndInit(void) void sndInit(void)
{ {
sfxInit(); soundEngine = new BloodSoundEngine;
soundEngine->AddSoundLump("", 0, 0, -1, 6); // add a dummy entry at index #0
for (int i = fileSystem.GetNumEntries() - 1; i >= 0; i--) for (int i = fileSystem.GetNumEntries() - 1; i >= 0; i--)
{ {
auto type = fileSystem.GetResourceType(i); auto type = fileSystem.GetResourceType(i);
@ -117,6 +118,7 @@ void sndInit(void)
} }
else if (!stricmp(type, "WAV") || !stricmp(type, "OGG") || !stricmp(type, "FLAC") || !stricmp(type, "VOC")) else if (!stricmp(type, "WAV") || !stricmp(type, "OGG") || !stricmp(type, "FLAC") || !stricmp(type, "VOC"))
{ {
if (fileSystem.GetFileNamespace(i) != ns_music)
soundEngine->AddSoundLump(fileSystem.GetFileFullName(i), i, 0, fileSystem.GetResourceId(i)| 0x40000000, 6); // mark the resource ID as special. soundEngine->AddSoundLump(fileSystem.GetFileFullName(i), i, 0, fileSystem.GetResourceId(i)| 0x40000000, 6); // mark the resource ID as special.
} }
} }

View file

@ -50,8 +50,6 @@ void sndProcess(void);
void sndTerm(void); void sndTerm(void);
void sndInit(void); void sndInit(void);
void sfxInit(void);
void sfxTerm(void);
void sfxPlay3DSound(int x, int y, int z, int soundId, int nSector); void sfxPlay3DSound(int x, int y, int z, int soundId, int nSector);
void sfxPlay3DSound(spritetype *pSprite, int soundId, int a3 = -1, int a4 = 0); void sfxPlay3DSound(spritetype *pSprite, int soundId, int a3 = -1, int a4 = 0);
void sfxPlay3DSoundCP(spritetype* pSprite, int soundId, int a3 = -1, int a4 = 0, int pitch = 0, int volume = 0); void sfxPlay3DSoundCP(spritetype* pSprite, int soundId, int a3 = -1, int a4 = 0, int pitch = 0, int volume = 0);