diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 5ed9c4447..5efe7da7a 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,11 @@ 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 blood decals. @@ -23,7 +30,6 @@ December 22, 2006 they received were from the host. - Removed the -net command line option. I'm not sure it even worked anymore. ->>>>>>> .r421 December 20, 2006 - 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 @@ -33,7 +39,6 @@ December 20, 2006 C4702 (unreachable code) C4512 (assignment operator could not be generated) ->>>>>>> .r420 December 19, 2006 - Fixed: D3DFB::Reset() also needs to restore the texture border color, otherwise it gets reset to black and unused. diff --git a/src/d_main.cpp b/src/d_main.cpp index debd5fbc7..c0fe147e6 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -2074,11 +2074,6 @@ void D_DoomMain (void) // Base systems have been inited; enable cvar callbacks 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"); S_Init (); @@ -2093,6 +2088,10 @@ void D_DoomMain (void) Printf ("G_ParseMapInfo: Load map definitions.\n"); G_ParseMapInfo (); + // [RH] Parse any SNDINFO lumps + Printf ("S_InitData: Load sound definitions.\n"); + S_InitData (); + FActorInfo::StaticInit (); // [GRB] Initialize player class list diff --git a/src/g_shared/a_quake.cpp b/src/g_shared/a_quake.cpp index 621f73fa8..ba1913d0a 100644 --- a/src/g_shared/a_quake.cpp +++ b/src/g_shared/a_quake.cpp @@ -78,7 +78,7 @@ void DEarthquake::Tick () 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); if (m_DamageRadius > 0) diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 5474a96bb..7304203c4 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2314,7 +2314,7 @@ int AActor::GetMissileDamage (int mask, int add) void AActor::Howl () { 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); } diff --git a/src/p_user.cpp b/src/p_user.cpp index 7a0a42e22..dc0c86363 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2058,7 +2058,7 @@ void P_PlayerThink (player_t *player) player->mo->waterlevel == 0) { 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); } diff --git a/src/s_sndseq.cpp b/src/s_sndseq.cpp index 0caf5cac5..eb3e57b6a 100644 --- a/src/s_sndseq.cpp +++ b/src/s_sndseq.cpp @@ -104,7 +104,7 @@ public: void Serialize (FArchive &arc); 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); } - 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; } DSeqNode *SpawnChild (int seqnum) { return SN_StartSequence (m_Actor, seqnum, SEQ_NOTRANS, m_ModeNum, true); } private: diff --git a/src/s_sound.cpp b/src/s_sound.cpp index a8be68178..22d32de50 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -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) diff --git a/src/s_sound.h b/src/s_sound.h index 462d02dcf..908003055 100644 --- a/src/s_sound.h +++ b/src/s_sound.h @@ -76,6 +76,7 @@ extern TArray S_sfx; // allocates channel buffer, sets S_sfx lookup. // void S_Init (); +void S_InitData (); void S_Shutdown (); // Per level startup code.