- 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
parent 558a18cf5c
commit 2b6203f950
8 changed files with 54 additions and 16 deletions

View file

@ -1,4 +1,11 @@
December 24, 2006 (Changes by Graf Zahl) December 24, 2006 (Changes by Graf Zahl)
- 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.
- Added new flag MF5_NOBLOODDECALS that prevents bleeding actors from spawning - Added new flag MF5_NOBLOODDECALS that prevents bleeding actors from spawning
blood decals. blood decals.
@ -23,7 +30,6 @@ December 22, 2006
they received were from the host. they received were from the host.
- Removed the -net command line option. I'm not sure it even worked anymore. - Removed the -net command line option. I'm not sure it even worked anymore.
>>>>>>> .r421
December 20, 2006 December 20, 2006
- Turned on warning level 4 just to see what it would produce: a lot of - Turned on warning level 4 just to see what it would produce: a lot of
warnings. At first, I was going to try and clean them all up. Then I decided warnings. At first, I was going to try and clean them all up. Then I decided
@ -33,7 +39,6 @@ December 20, 2006
C4702 (unreachable code) C4702 (unreachable code)
C4512 (assignment operator could not be generated) C4512 (assignment operator could not be generated)
>>>>>>> .r420
December 19, 2006 December 19, 2006
- Fixed: D3DFB::Reset() also needs to restore the texture border color, - Fixed: D3DFB::Reset() also needs to restore the texture border color,
otherwise it gets reset to black and unused. otherwise it gets reset to black and unused.

View file

@ -2074,11 +2074,6 @@ void D_DoomMain (void)
// Base systems have been inited; enable cvar callbacks // Base systems have been inited; enable cvar callbacks
FBaseCVar::EnableCallbacks (); FBaseCVar::EnableCallbacks ();
// [RH] Parse any SNDINFO lumps
Printf ("S_ParseSndInfo: Load sound definitions.\n");
S_ParseSndInfo ();
S_ParseSndEax ();
Printf ("S_Init: Setting up sound.\n"); Printf ("S_Init: Setting up sound.\n");
S_Init (); S_Init ();
@ -2093,6 +2088,10 @@ void D_DoomMain (void)
Printf ("G_ParseMapInfo: Load map definitions.\n"); Printf ("G_ParseMapInfo: Load map definitions.\n");
G_ParseMapInfo (); G_ParseMapInfo ();
// [RH] Parse any SNDINFO lumps
Printf ("S_InitData: Load sound definitions.\n");
S_InitData ();
FActorInfo::StaticInit (); FActorInfo::StaticInit ();
// [GRB] Initialize player class list // [GRB] Initialize player class list

View file

@ -78,7 +78,7 @@ void DEarthquake::Tick ()
return; return;
} }
if (!S_GetSoundPlayingInfo (m_Spot, m_QuakeSFX)) if (!S_IsActorPlayingSomething (m_Spot, CHAN_BODY, m_QuakeSFX))
S_SoundID (m_Spot, CHAN_BODY, m_QuakeSFX, 1, ATTN_NORM); S_SoundID (m_Spot, CHAN_BODY, m_QuakeSFX, 1, ATTN_NORM);
if (m_DamageRadius > 0) if (m_DamageRadius > 0)

View file

@ -2314,7 +2314,7 @@ int AActor::GetMissileDamage (int mask, int add)
void AActor::Howl () void AActor::Howl ()
{ {
int howl = GetClass()->Meta.GetMetaInt(AMETA_HowlSound); int howl = GetClass()->Meta.GetMetaInt(AMETA_HowlSound);
if (!S_GetSoundPlayingInfo (this, howl)) if (!S_IsActorPlayingSomething(this, CHAN_BODY, howl))
{ {
S_SoundID (this, CHAN_BODY, howl, 1, ATTN_NORM); S_SoundID (this, CHAN_BODY, howl, 1, ATTN_NORM);
} }

View file

@ -2058,7 +2058,7 @@ void P_PlayerThink (player_t *player)
player->mo->waterlevel == 0) player->mo->waterlevel == 0)
{ {
int id = S_FindSkinnedSound (player->mo, "*falling"); int id = S_FindSkinnedSound (player->mo, "*falling");
if (id != 0 && !S_GetSoundPlayingInfo (player->mo, id)) if (id != 0 && !S_IsActorPlayingSomething (player->mo, CHAN_VOICE, id))
{ {
S_SoundID (player->mo, CHAN_VOICE, id, 1, ATTN_NORM); S_SoundID (player->mo, CHAN_VOICE, id, 1, ATTN_NORM);
} }

View file

@ -104,7 +104,7 @@ public:
void Serialize (FArchive &arc); void Serialize (FArchive &arc);
void MakeSound () { S_SoundID (m_Actor, CHAN_BODY, m_CurrentSoundID, clamp(m_Volume, 0.f, 1.f), m_Atten); } void MakeSound () { S_SoundID (m_Actor, CHAN_BODY, m_CurrentSoundID, clamp(m_Volume, 0.f, 1.f), m_Atten); }
void MakeLoopedSound () { S_LoopedSoundID (m_Actor, CHAN_BODY, m_CurrentSoundID, clamp(m_Volume, 0.f, 1.f), m_Atten); } void MakeLoopedSound () { S_LoopedSoundID (m_Actor, CHAN_BODY, m_CurrentSoundID, clamp(m_Volume, 0.f, 1.f), m_Atten); }
bool IsPlaying () { return S_GetSoundPlayingInfo (m_Actor, m_CurrentSoundID); } bool IsPlaying () { return S_IsActorPlayingSomething (m_Actor, CHAN_BODY, m_CurrentSoundID); }
void *Source () { return m_Actor; } void *Source () { return m_Actor; }
DSeqNode *SpawnChild (int seqnum) { return SN_StartSequence (m_Actor, seqnum, SEQ_NOTRANS, m_ModeNum, true); } DSeqNode *SpawnChild (int seqnum) { return SN_StartSequence (m_Actor, seqnum, SEQ_NOTRANS, m_ModeNum, true); }
private: private:

View file

@ -282,7 +282,6 @@ void S_Init ()
atterm (S_Shutdown); atterm (S_Shutdown);
// remove old data (S_Init can be called multiple times!) // remove old data (S_Init can be called multiple times!)
LastLocalSndInfo = LastLocalSndSeq = "";
if (SoundCurve) delete [] SoundCurve; if (SoundCurve) delete [] SoundCurve;
// Heretic and Hexen have sound curve lookup tables. Doom does not. // 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 // Allocating the virtual channels
numChannels = GSnd ? GSnd->SetChannels (snd_channels) : 0; numChannels = GSnd ? GSnd->SetChannels (snd_channels) : 0;
if (Channel != NULL) if (Channel != NULL)
@ -340,6 +336,20 @@ void S_Init ()
// S_sfx[i].usefulness = -1; // S_sfx[i].usefulness = -1;
} }
//==========================================================================
//
// S_InitData
//
//==========================================================================
void S_InitData ()
{
LastLocalSndInfo = LastLocalSndSeq = "";
S_ParseSndInfo ();
S_ParseSndSeq (-1);
S_ParseSndEax ();
}
//========================================================================== //==========================================================================
// //
// S_Shutdown // S_Shutdown
@ -1172,7 +1182,7 @@ bool S_GetSoundPlayingInfo (fixed_t *pt, int sound_id)
{ {
int i; int i;
if (sound_id != 0) if (sound_id > 0)
{ {
for (i = 0; i < numChannels; i++) for (i = 0; i < numChannels; i++)
{ {
@ -1203,6 +1213,29 @@ bool S_IsActorPlayingSomething (AActor *actor, int channel, int sound_id)
channel = 0; 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) for (i = 0; i < numChannels; ++i)
{ {
if (Channel[i].pt == &actor->x) if (Channel[i].pt == &actor->x)

View file

@ -76,6 +76,7 @@ extern TArray<sfxinfo_t> S_sfx;
// allocates channel buffer, sets S_sfx lookup. // allocates channel buffer, sets S_sfx lookup.
// //
void S_Init (); void S_Init ();
void S_InitData ();
void S_Shutdown (); void S_Shutdown ();
// Per level startup code. // Per level startup code.