From ec3e4bb7c71618b78d642abd853789127485127a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 6 Oct 2010 17:57:56 +0000 Subject: [PATCH] - fixed: The Player played no sounds in the Doom2 cast. - fixed: The player's melee state is not a proper melee state so it should not be entered when used in the cast. - fixed: Sounds were played before changing states. That missed situations where the state was entered from anywhere else but the previous state. SVN r2915 (trunk) --- src/intermission/intermission.cpp | 57 +++++++++++++++++++------------ src/intermission/intermission.h | 2 ++ 2 files changed, 38 insertions(+), 21 deletions(-) diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 461495f63..acb9fb62c 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -452,6 +452,25 @@ int DIntermissionScreenCast::Responder (event_t *ev) return true; } +void DIntermissionScreenCast::PlayAttackSound() +{ + // sound hacks.... + if (caststate != NULL && castattacking) + { + for (unsigned i = 0; i < mCastSounds.Size(); i++) + { + if ((!!mCastSounds[i].mSequence) == (basestate != mDefaults->MissileState) && + (caststate == basestate + mCastSounds[i].mIndex)) + { + S_StopAllChannels (); + S_Sound (CHAN_WEAPON | CHAN_UI, mCastSounds[i].mSound, 1, ATTN_NONE); + return; + } + } + } + +} + int DIntermissionScreenCast::Ticker () { Super::Ticker(); @@ -465,26 +484,13 @@ int DIntermissionScreenCast::Ticker () } else { - // sound hacks.... - if (caststate != NULL && castattacking) - { - for (unsigned i = 0; i < mCastSounds.Size(); i++) - { - if ((!!mCastSounds[i].mSequence) == (basestate != mDefaults->MissileState) && - (caststate == basestate + mCastSounds[i].mIndex - 1)) - { - S_StopAllChannels (); - S_Sound (CHAN_WEAPON | CHAN_UI, mCastSounds[i].mSound, 1, ATTN_NONE); - break; - } - } - } - // just advance to next state in animation if (caststate == advplayerstate) goto stopattack; // Oh, gross hack! caststate = caststate->GetNextState(); + + PlayAttackSound(); castframes++; } @@ -492,18 +498,27 @@ int DIntermissionScreenCast::Ticker () { // go into attack frame castattacking = true; - if (castonmelee) - basestate = caststate = mDefaults->MeleeState; - else - basestate = caststate = mDefaults->MissileState; - castonmelee ^= 1; - if (caststate == NULL) + if (!mClass->IsDescendantOf(RUNTIME_CLASS(APlayerPawn))) { if (castonmelee) basestate = caststate = mDefaults->MeleeState; else basestate = caststate = mDefaults->MissileState; + castonmelee ^= 1; + if (caststate == NULL) + { + if (castonmelee) + basestate = caststate = mDefaults->MeleeState; + else + basestate = caststate = mDefaults->MissileState; + } } + else + { + // The players use the melee state differently so it can't be used here + basestate = caststate = mDefaults->MissileState; + } + PlayAttackSound(); } if (castattacking) diff --git a/src/intermission/intermission.h b/src/intermission/intermission.h index d777d46d3..72dd5a2e1 100644 --- a/src/intermission/intermission.h +++ b/src/intermission/intermission.h @@ -243,6 +243,8 @@ class DIntermissionScreenCast : public DIntermissionScreen int castframes; int castonmelee; + void PlayAttackSound(); + public: DIntermissionScreenCast() {}