This commit is contained in:
Christoph Oelckers 2016-02-09 11:51:39 +01:00
commit 26b657b637
11 changed files with 965 additions and 26 deletions

View file

@ -647,6 +647,8 @@ public:
// Returns true if this actor is within melee range of its target
bool CheckMeleeRange();
bool CheckNoDelay();
virtual void BeginPlay(); // Called immediately after the actor is created
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

View file

@ -138,17 +138,8 @@ void AFastProjectile::Tick ()
}
}
}
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
// Advance the state
if (tics != -1)
{

View file

@ -484,7 +484,7 @@ void FSliderItem::Drawer(bool selected)
screen->DrawText(mFont, selected? OptionSettings.mFontColorSelection : mFontColor, mXpos, mYpos, text, DTA_Clean, true, TAG_DONE);
int x = SmallFont->StringWidth ("Green") + 8 + mXpos;
int x2 = SmallFont->StringWidth (mText) + 8 + mXpos;
int x2 = SmallFont->StringWidth (text) + 8 + mXpos;
DrawSlider (MAX(x2, x), mYpos);
}

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

View file

@ -238,14 +238,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, CountInv)
self = COPY_AAPTR(self, pick_pointer);
if (self == NULL || itemtype == NULL)
{
ret->SetInt(false);
ret->SetInt(0);
}
else
{
AInventory *item = self->FindInventory(itemtype);
ret->SetInt(item ? item->Amount : 0);
return 1;
}
return 1;
}
return 0;
}