mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-24 21:21:04 +00:00
- exported Powerup.InitEffect and EndEffect to scripting.
This commit is contained in:
parent
5e34bad03b
commit
fe0f19e1e0
4 changed files with 55 additions and 9 deletions
|
@ -21,6 +21,7 @@
|
|||
#include "v_palette.h"
|
||||
#include "serializer.h"
|
||||
#include "r_utility.h"
|
||||
#include "virtual.h"
|
||||
|
||||
#include "r_data/colormaps.h"
|
||||
|
||||
|
@ -182,6 +183,25 @@ void APowerup::InitEffect ()
|
|||
{
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(APowerup, InitEffect)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(APowerup);
|
||||
self->InitEffect();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void APowerup::CallInitEffect()
|
||||
{
|
||||
IFVIRTUAL(APowerup, InitEffect)
|
||||
{
|
||||
VMValue params[1] = { (DObject*)this };
|
||||
VMFrameStack stack;
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||
}
|
||||
else InitEffect();
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerup :: DoEffect
|
||||
|
@ -230,6 +250,25 @@ void APowerup::EndEffect ()
|
|||
}
|
||||
}
|
||||
|
||||
DEFINE_ACTION_FUNCTION(APowerup, EndEffect)
|
||||
{
|
||||
PARAM_SELF_PROLOGUE(APowerup);
|
||||
self->EndEffect();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void APowerup::CallEndEffect()
|
||||
{
|
||||
IFVIRTUAL(APowerup, InitEffect)
|
||||
{
|
||||
VMValue params[1] = { (DObject*)this };
|
||||
VMFrameStack stack;
|
||||
GlobalVMStack.Call(func, params, 1, nullptr, 0, nullptr);
|
||||
}
|
||||
else EndEffect();
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// APowerup :: Destroy
|
||||
|
@ -238,7 +277,7 @@ void APowerup::EndEffect ()
|
|||
|
||||
void APowerup::Destroy ()
|
||||
{
|
||||
EndEffect ();
|
||||
CallEndEffect ();
|
||||
Super::Destroy ();
|
||||
}
|
||||
|
||||
|
@ -325,7 +364,7 @@ AInventory *APowerup::CreateCopy (AActor *other)
|
|||
// properly attached to anything yet.
|
||||
Owner = other;
|
||||
// Actually activate the powerup.
|
||||
InitEffect ();
|
||||
CallInitEffect ();
|
||||
// Clear the Owner field, unless it was
|
||||
// changed by the activation, for example,
|
||||
// if this instance is a morph powerup;
|
||||
|
@ -599,7 +638,7 @@ void APowerInvisibility::InitEffect ()
|
|||
flags5 &= ~(Owner->flags5 & INVISIBILITY_FLAGS5);
|
||||
Owner->flags5 |= flags5 & INVISIBILITY_FLAGS5;
|
||||
|
||||
DoEffect();
|
||||
CallDoEffect();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1261,7 +1300,7 @@ IMPLEMENT_CLASS(APowerTargeter, false, false)
|
|||
|
||||
void APowerTargeter::Travelled ()
|
||||
{
|
||||
InitEffect ();
|
||||
CallInitEffect ();
|
||||
}
|
||||
|
||||
void APowerTargeter::InitEffect ()
|
||||
|
@ -1299,14 +1338,14 @@ void APowerTargeter::AttachToOwner(AActor *other)
|
|||
Super::AttachToOwner(other);
|
||||
|
||||
// Let's actually properly call this for the targeters.
|
||||
InitEffect();
|
||||
CallInitEffect();
|
||||
}
|
||||
|
||||
bool APowerTargeter::HandlePickup(AInventory *item)
|
||||
{
|
||||
if (Super::HandlePickup(item))
|
||||
{
|
||||
InitEffect(); // reset the HUD sprites
|
||||
CallInitEffect(); // reset the HUD sprites
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -26,11 +26,15 @@ public:
|
|||
FNameNoInit Mode;
|
||||
double Strength;
|
||||
|
||||
protected:
|
||||
public:
|
||||
virtual void InitEffect ();
|
||||
virtual void DoEffect () override;
|
||||
virtual void EndEffect ();
|
||||
|
||||
protected:
|
||||
void CallInitEffect();
|
||||
void CallEndEffect();
|
||||
|
||||
friend void EndAllPowerupEffects(AInventory *item);
|
||||
friend void InitAllPowerupEffects(AInventory *item);
|
||||
};
|
||||
|
|
|
@ -585,7 +585,7 @@ void EndAllPowerupEffects(AInventory *item)
|
|||
{
|
||||
if (item->IsKindOf(RUNTIME_CLASS(APowerup)))
|
||||
{
|
||||
static_cast<APowerup *>(item)->EndEffect();
|
||||
static_cast<APowerup *>(item)->CallEndEffect();
|
||||
}
|
||||
item = item->Inventory;
|
||||
}
|
||||
|
@ -605,7 +605,7 @@ void InitAllPowerupEffects(AInventory *item)
|
|||
{
|
||||
if (item->IsKindOf(RUNTIME_CLASS(APowerup)))
|
||||
{
|
||||
static_cast<APowerup *>(item)->InitEffect();
|
||||
static_cast<APowerup *>(item)->CallInitEffect();
|
||||
}
|
||||
item = item->Inventory;
|
||||
}
|
||||
|
|
|
@ -25,6 +25,9 @@ class Powerup : Inventory native
|
|||
|
||||
// Note, that while this is an inventory flag, it only has meaning on an active powerup.
|
||||
override bool GetNoTeleportFreeze() { return bNoTeleportFreeze; }
|
||||
|
||||
native virtual void InitEffect();
|
||||
native virtual void EndEffect();
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue