mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 07:12:02 +00:00
- 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:
parent
7b63e088e1
commit
3922f817fb
6 changed files with 8 additions and 8 deletions
|
@ -260,11 +260,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;
|
||||
|
|
|
@ -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.
|
||||
|
||||
bool DoRespawn();
|
||||
|
@ -98,4 +96,6 @@ public:
|
|||
FSoundIDNoInit PickupSound;
|
||||
};
|
||||
|
||||
bool CallTryPickup(AInventory *item, AActor *toucher, AActor **toucher_return = nullptr);
|
||||
|
||||
#endif //__A_PICKUPS_H__
|
||||
|
|
|
@ -4150,7 +4150,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;
|
||||
|
|
|
@ -972,7 +972,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;
|
||||
|
|
|
@ -926,7 +926,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;
|
||||
|
|
|
@ -980,7 +980,7 @@ void APlayerPawn::GiveDeathmatchInventory()
|
|||
if (key->special1 != 0)
|
||||
{
|
||||
key = (AInventory*)Spawn(PClassActor::AllActorClasses[i]);
|
||||
if (!key->CallTryPickup (this))
|
||||
if (!CallTryPickup (key, this))
|
||||
{
|
||||
key->Destroy ();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue