diff --git a/src/g_inventory/a_pickups.cpp b/src/g_inventory/a_pickups.cpp index 7b7721b48..2ed78aef3 100644 --- a/src/g_inventory/a_pickups.cpp +++ b/src/g_inventory/a_pickups.cpp @@ -200,71 +200,6 @@ bool AInventory::Grind(bool 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 diff --git a/src/g_inventory/a_pickups.h b/src/g_inventory/a_pickups.h index 4cb202f7d..d831bb3de 100644 --- a/src/g_inventory/a_pickups.h +++ b/src/g_inventory/a_pickups.h @@ -86,9 +86,6 @@ public: double GetSpeedFactor(); // virtual on the script side. bool GetNoTeleportFreeze(); // virtual on the script side. - void BecomeItem (); - void BecomePickup (); - bool DoRespawn(); AInventory *PrevItem(); // Returns the item preceding this one in the list. diff --git a/wadsrc/static/zscript/inventory/inventory.txt b/wadsrc/static/zscript/inventory/inventory.txt index b903a09b6..813119089 100644 --- a/wadsrc/static/zscript/inventory/inventory.txt +++ b/wadsrc/static/zscript/inventory/inventory.txt @@ -50,8 +50,6 @@ class Inventory : Actor native } native bool DoRespawn(); - native void BecomeItem(); - native void BecomePickup(); native static void PrintPickupMessage (bool localview, String str); 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