mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-10 23:01:50 +00:00
Add OF_StateChanged handling to NoDelay
This commit is contained in:
parent
4c2bcede61
commit
8d159b8506
3 changed files with 38 additions and 22 deletions
|
@ -647,6 +647,8 @@ public:
|
||||||
// Returns true if this actor is within melee range of its target
|
// Returns true if this actor is within melee range of its target
|
||||||
bool CheckMeleeRange();
|
bool CheckMeleeRange();
|
||||||
|
|
||||||
|
bool CheckNoDelay();
|
||||||
|
|
||||||
virtual void BeginPlay(); // Called immediately after the actor is created
|
virtual void BeginPlay(); // Called immediately after the actor is created
|
||||||
virtual void PostBeginPlay(); // Called immediately before the actor's first tick
|
virtual void PostBeginPlay(); // Called immediately before the actor's first tick
|
||||||
virtual void LevelSpawned(); // Called after BeginPlay if this actor was spawned by the world
|
virtual void LevelSpawned(); // Called after BeginPlay if this actor was spawned by the world
|
||||||
|
|
|
@ -138,17 +138,8 @@ void AFastProjectile::Tick ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((flags7 & MF7_HANDLENODELAY) && !(flags2 & MF2_DORMANT))
|
if (!CheckNoDelay())
|
||||||
{
|
return; // freed itself
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Advance the state
|
// Advance the state
|
||||||
if (tics != -1)
|
if (tics != -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3841,17 +3841,8 @@ void AActor::Tick ()
|
||||||
Destroy();
|
Destroy();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ((flags7 & MF7_HANDLENODELAY) && !(flags2 & MF2_DORMANT))
|
if (!CheckNoDelay())
|
||||||
{
|
return; // freed itself
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// cycle through states, calling action functions at transitions
|
// cycle through states, calling action functions at transitions
|
||||||
if (tics != -1)
|
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
|
// AActor :: CheckSectorTransition
|
||||||
|
|
Loading…
Reference in a new issue