Add OF_StateChanged handling to NoDelay

This commit is contained in:
Randy Heit 2016-02-08 22:11:42 -06:00
commit 8d159b8506
3 changed files with 38 additions and 22 deletions

View file

@ -3841,17 +3841,8 @@ void AActor::Tick ()
Destroy();
return;
}
if ((flags7 & MF7_HANDLENODELAY) && !(flags2 & MF2_DORMANT))
{
flags7 &= ~MF7_HANDLENODELAY;
if (state->GetNoDelay())
{
// For immediately spawned objects with the NoDelay flag set for their
// Spawn state, explicitly call the current state's function.
if (state->CallAction(this, this) && (ObjectFlags & OF_EuthanizeMe))
return; // freed itself
}
}
if (!CheckNoDelay())
return; // freed itself
// cycle through states, calling action functions at transitions
if (tics != -1)
{
@ -3892,6 +3883,38 @@ void AActor::Tick ()
}
}
//==========================================================================
//
// AActor :: CheckNoDelay
//
//==========================================================================
bool AActor::CheckNoDelay()
{
if ((flags7 & MF7_HANDLENODELAY) && !(flags2 & MF2_DORMANT))
{
flags7 &= ~MF7_HANDLENODELAY;
if (state->GetNoDelay())
{
// For immediately spawned objects with the NoDelay flag set for their
// Spawn state, explicitly call the current state's function.
if (state->CallAction(this, this))
{
if (ObjectFlags & OF_EuthanizeMe)
{
return false; // freed itself
}
if (ObjectFlags & OF_StateChanged)
{
ObjectFlags &= ~OF_StateChanged;
return SetState(state);
}
}
}
}
return true;
}
//==========================================================================
//
// AActor :: CheckSectorTransition