- 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)
This commit is contained in:
Christoph Oelckers 2010-10-06 17:57:56 +00:00
parent 62f846b0ab
commit ec3e4bb7c7
2 changed files with 38 additions and 21 deletions

View file

@ -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)

View file

@ -243,6 +243,8 @@ class DIntermissionScreenCast : public DIntermissionScreen
int castframes;
int castonmelee;
void PlayAttackSound();
public:
DIntermissionScreenCast() {}