mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 15:02:39 +00:00
- scriptified BecomeItem and BecomePickup
This commit is contained in:
parent
3d892d3970
commit
337750b874
3 changed files with 49 additions and 70 deletions
|
@ -200,71 +200,6 @@ bool AInventory::Grind(bool items)
|
||||||
return Super::Grind(items);
|
return Super::Grind(items);
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// AInventory :: BecomeItem
|
|
||||||
//
|
|
||||||
// Lets this actor know that it's about to be placed in an inventory.
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
void AInventory::BecomeItem ()
|
|
||||||
{
|
|
||||||
if (!(flags & (MF_NOBLOCKMAP|MF_NOSECTOR)))
|
|
||||||
{
|
|
||||||
UnlinkFromWorld (nullptr);
|
|
||||||
flags |= MF_NOBLOCKMAP|MF_NOSECTOR;
|
|
||||||
LinkToWorld (nullptr);
|
|
||||||
}
|
|
||||||
RemoveFromHash ();
|
|
||||||
flags &= ~MF_SPECIAL;
|
|
||||||
ChangeStatNum(STAT_INVENTORY);
|
|
||||||
// stop all sounds this item is playing.
|
|
||||||
for(int i = 1;i<=7;i++) S_StopSound(this, i);
|
|
||||||
SetState (FindState("Held"));
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AInventory, BecomeItem)
|
|
||||||
{
|
|
||||||
PARAM_SELF_PROLOGUE(AInventory);
|
|
||||||
self->BecomeItem();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
|
||||||
//
|
|
||||||
// AInventory :: BecomePickup
|
|
||||||
//
|
|
||||||
// Lets this actor know it should wait to be picked up.
|
|
||||||
//
|
|
||||||
//===========================================================================
|
|
||||||
|
|
||||||
void AInventory::BecomePickup ()
|
|
||||||
{
|
|
||||||
if (Owner != NULL)
|
|
||||||
{
|
|
||||||
Owner->RemoveInventory (this);
|
|
||||||
}
|
|
||||||
if (flags & (MF_NOBLOCKMAP|MF_NOSECTOR))
|
|
||||||
{
|
|
||||||
UnlinkFromWorld (nullptr);
|
|
||||||
flags &= ~(MF_NOBLOCKMAP|MF_NOSECTOR);
|
|
||||||
LinkToWorld (nullptr);
|
|
||||||
P_FindFloorCeiling (this);
|
|
||||||
}
|
|
||||||
flags = (GetDefault()->flags | MF_DROPPED) & ~MF_COUNTITEM;
|
|
||||||
renderflags &= ~RF_INVISIBLE;
|
|
||||||
ChangeStatNum(STAT_DEFAULT);
|
|
||||||
SetState (SpawnState);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFINE_ACTION_FUNCTION(AInventory, BecomePickup)
|
|
||||||
{
|
|
||||||
PARAM_SELF_PROLOGUE(AInventory);
|
|
||||||
self->BecomePickup();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// AInventory :: GetSpeedFactor
|
// AInventory :: GetSpeedFactor
|
||||||
|
|
|
@ -86,9 +86,6 @@ public:
|
||||||
double GetSpeedFactor(); // virtual on the script side.
|
double GetSpeedFactor(); // virtual on the script side.
|
||||||
bool GetNoTeleportFreeze(); // virtual on the script side.
|
bool GetNoTeleportFreeze(); // virtual on the script side.
|
||||||
|
|
||||||
void BecomeItem ();
|
|
||||||
void BecomePickup ();
|
|
||||||
|
|
||||||
bool DoRespawn();
|
bool DoRespawn();
|
||||||
|
|
||||||
AInventory *PrevItem(); // Returns the item preceding this one in the list.
|
AInventory *PrevItem(); // Returns the item preceding this one in the list.
|
||||||
|
|
|
@ -50,8 +50,6 @@ class Inventory : Actor native
|
||||||
}
|
}
|
||||||
|
|
||||||
native bool DoRespawn();
|
native bool DoRespawn();
|
||||||
native void BecomeItem();
|
|
||||||
native void BecomePickup();
|
|
||||||
native static void PrintPickupMessage (bool localview, String str);
|
native static void PrintPickupMessage (bool localview, String str);
|
||||||
|
|
||||||
States(Actor)
|
States(Actor)
|
||||||
|
@ -145,6 +143,55 @@ class Inventory : Actor native
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// AInventory :: BecomeItem
|
||||||
|
//
|
||||||
|
// Lets this actor know that it's about to be placed in an inventory.
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
void BecomeItem ()
|
||||||
|
{
|
||||||
|
if (!bNoBlockmap || !bNoSector)
|
||||||
|
{
|
||||||
|
A_ChangeLinkFlags(1, 1);
|
||||||
|
}
|
||||||
|
ChangeTid(0);
|
||||||
|
bSpecial = false;
|
||||||
|
ChangeStatNum(STAT_INVENTORY);
|
||||||
|
// stop all sounds this item is playing.
|
||||||
|
for(int i = 1;i<=7;i++) A_StopSound(i);
|
||||||
|
SetState (FindState("Held"));
|
||||||
|
}
|
||||||
|
|
||||||
|
//===========================================================================
|
||||||
|
//
|
||||||
|
// AInventory :: BecomePickup
|
||||||
|
//
|
||||||
|
// Lets this actor know it should wait to be picked up.
|
||||||
|
//
|
||||||
|
//===========================================================================
|
||||||
|
|
||||||
|
void BecomePickup ()
|
||||||
|
{
|
||||||
|
if (Owner != NULL)
|
||||||
|
{
|
||||||
|
Owner.RemoveInventory (self);
|
||||||
|
}
|
||||||
|
if (bNoBlockmap || bNoSector)
|
||||||
|
{
|
||||||
|
A_ChangeLinkFlags(0, 0);
|
||||||
|
FindFloorCeiling();
|
||||||
|
}
|
||||||
|
bSpecial = true;
|
||||||
|
bDropped = true;
|
||||||
|
bCountItem = false;
|
||||||
|
bInvisible = false;
|
||||||
|
ChangeStatNum(STAT_DEFAULT);
|
||||||
|
SetState (SpawnState);
|
||||||
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// AInventory :: CreateCopy
|
// AInventory :: CreateCopy
|
||||||
|
|
Loading…
Reference in a new issue