- Replaced several calls to S_GetSoundPlayingInfo with S_IsActorPlayingSomething

because S_GetSoundPlayingInfo cannot properly resolve player and random sounds.
- Fixed: S_IsActorPlayingSomething has to resolve aliases and player sounds.
- Took S_ParseSndSeq call out of S_Init. This doesn't work when parsing SNDINFO
  in D_DoomMain.
- Moved SNDINFO reading back to its old place after MAPINFO. This is necessary
  for Hexen's music definitions.


SVN r425 (trunk)
This commit is contained in:
Christoph Oelckers 2006-12-24 23:08:49 +00:00
commit 2b6203f950
8 changed files with 54 additions and 16 deletions

View file

@ -282,7 +282,6 @@ void S_Init ()
atterm (S_Shutdown);
// remove old data (S_Init can be called multiple times!)
LastLocalSndInfo = LastLocalSndSeq = "";
if (SoundCurve) delete [] SoundCurve;
// Heretic and Hexen have sound curve lookup tables. Doom does not.
@ -310,9 +309,6 @@ void S_Init ()
}
}
// [RH] Read in sound sequences
S_ParseSndSeq (-1);
// Allocating the virtual channels
numChannels = GSnd ? GSnd->SetChannels (snd_channels) : 0;
if (Channel != NULL)
@ -340,6 +336,20 @@ void S_Init ()
// S_sfx[i].usefulness = -1;
}
//==========================================================================
//
// S_InitData
//
//==========================================================================
void S_InitData ()
{
LastLocalSndInfo = LastLocalSndSeq = "";
S_ParseSndInfo ();
S_ParseSndSeq (-1);
S_ParseSndEax ();
}
//==========================================================================
//
// S_Shutdown
@ -1172,7 +1182,7 @@ bool S_GetSoundPlayingInfo (fixed_t *pt, int sound_id)
{
int i;
if (sound_id != 0)
if (sound_id > 0)
{
for (i = 0; i < numChannels; i++)
{
@ -1203,6 +1213,29 @@ bool S_IsActorPlayingSomething (AActor *actor, int channel, int sound_id)
channel = 0;
}
// Resolve player sounds, random sounds, and aliases
if (sound_id > 0)
{
while (S_sfx[sound_id].link != sfxinfo_t::NO_LINK)
{
if (S_sfx[sound_id].bPlayerReserve)
{
sound_id = S_FindSkinnedSound (actor, sound_id);
}
else if (S_sfx[sound_id].bRandomHeader)
{
// This can't really be checked properly
// so return true if the channel is playing something, no matter what.
sound_id = -1;
break;
}
else
{
sound_id = S_sfx[sound_id].link;
}
}
}
for (i = 0; i < numChannels; ++i)
{
if (Channel[i].pt == &actor->x)