- made CallTryPickup a global function.

This one still gets called in too many places but stands in the way of moving Inventory fully to the script side.
This commit is contained in:
Christoph Oelckers 2018-11-30 00:06:20 +01:00 committed by drfrag
parent 9981674a27
commit a7909c16e5
6 changed files with 8 additions and 8 deletions

View file

@ -289,11 +289,11 @@ DEFINE_ACTION_FUNCTION(AInventory, DoRespawn)
//
//===========================================================================
bool AInventory::CallTryPickup(AActor *toucher, AActor **toucher_return)
bool CallTryPickup(AInventory *item, AActor *toucher, AActor **toucher_return)
{
static VMFunction *func = nullptr;
if (func == nullptr) PClass::FindFunction(&func, NAME_Inventory, NAME_CallTryPickup);
VMValue params[2] = { (DObject*)this, toucher };
VMValue params[2] = { (DObject*)item, toucher };
VMReturn ret[2];
int res;
AActor *tret;

View file

@ -73,8 +73,6 @@ public:
virtual void Serialize(FSerializer &arc) override;
virtual void Tick() override;
bool CallTryPickup(AActor *toucher, AActor **toucher_return = NULL); // Wrapper for script function.
void DepleteOrDestroy (); // virtual on the script side.
PalEntry CallGetBlend(); // virtual on the script side.
bool GetNoTeleportFreeze(); // virtual on the script side.
@ -100,4 +98,6 @@ public:
FSoundIDNoInit PickupSound;
};
bool CallTryPickup(AInventory *item, AActor *toucher, AActor **toucher_return = nullptr);
#endif //__A_PICKUPS_H__

View file

@ -4165,7 +4165,7 @@ static bool DoRadiusGive(AActor *self, AActor *thing, PClassActor *item, int amo
}
gift->flags |= MF_DROPPED;
gift->ClearCounters();
if (!gift->CallTryPickup(thing))
if (!CallTryPickup(gift, thing))
{
gift->Destroy();
return false;

View file

@ -979,7 +979,7 @@ static void HandleReply(player_t *player, bool isconsole, int nodenum, int reply
item->IntVar(NAME_AmmoGive1) = 40;
}
item->flags |= MF_DROPPED;
if (!item->CallTryPickup(player->mo))
if (!CallTryPickup(item, player->mo))
{
item->Destroy();
takestuff = false;

View file

@ -940,7 +940,7 @@ AInventory *AActor::GiveInventoryType (PClassActor *type)
if (type != NULL)
{
item = static_cast<AInventory *>(Spawn (type));
if (!item->CallTryPickup (this))
if (!CallTryPickup (item, this))
{
item->Destroy ();
return NULL;

View file

@ -967,7 +967,7 @@ void APlayerPawn::GiveDeathmatchInventory()
if (key->special1 != 0)
{
key = (AInventory*)Spawn(PClassActor::AllActorClasses[i]);
if (!key->CallTryPickup (this))
if (!CallTryPickup (key, this))
{
key->Destroy ();
}