- Moved IF_ALWAYSPICKUP and GiveQuest into CallTryPickup so that they are

automatically used by all inventory classes.
- The previous change made it necessary to replace all TryPickup calls with
  another function that just calls TryPickup.
- Fixed: AInventory::TryPickup can change the toucher so this must be reported
  to subclasses calling the super function. Changed TryPickup to pass the
  toucher pointer by reference.


SVN r1221 (trunk)
This commit is contained in:
Christoph Oelckers 2008-09-13 22:08:41 +00:00
parent f625b92704
commit 2cad1c2c19
28 changed files with 107 additions and 89 deletions

View file

@ -1,4 +1,11 @@
September 13, 2008 (Changes by Graf Zahl)
- Moved IF_ALWAYSPICKUP and GiveQuest into CallTryPickup so that they are
automatically used by all inventory classes.
- The previous change made it necessary to replace all TryPickup calls with
another function that just calls TryPickup.
- Fixed: AInventory::TryPickup can change the toucher so this must be reported
to subclasses calling the super function. Changed TryPickup to pass the
toucher pointer by reference.
- Prefixed all names of CQ decorations with Chex after seeing some conflicts
with PWADs.
- Removed Chex Quest actors that were just unaltered duplicates of Doom's.

View file

@ -2614,7 +2614,7 @@ void FinishDehPatch ()
void ModifyDropAmount(AInventory *inv, int dropamount);
bool ADehackedPickup::TryPickup (AActor *toucher)
bool ADehackedPickup::TryPickup (AActor *&toucher)
{
const PClass *type = DetermineType ();
if (type == NULL)
@ -2634,7 +2634,7 @@ bool ADehackedPickup::TryPickup (AActor *toucher)
{
ModifyDropAmount(RealPickup, 0);
}
if (!RealPickup->TryPickup (toucher))
if (!RealPickup->CallTryPickup (toucher))
{
RealPickup->Destroy ();
RealPickup = NULL;

View file

@ -45,7 +45,7 @@ public:
const char *PickupMessage ();
bool ShouldRespawn ();
bool ShouldStay ();
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
void PlayPickupSound (AActor *toucher);
void DoPickupSpecial (AActor *toucher);
void Serialize(FArchive &arc);

View file

@ -31,7 +31,7 @@ bool AArtiBoostArmor::Use (bool pickup)
armor->flags |= MF_DROPPED;
armor->health = i;
armor->Amount = 1;
if (!armor->TryPickup (Owner))
if (!armor->CallTryPickup (Owner))
{
armor->Destroy ();
}
@ -48,7 +48,7 @@ bool AArtiBoostArmor::Use (bool pickup)
armor->flags |= MF_DROPPED;
armor->SaveAmount = 50;
armor->MaxSaveAmount = 300;
if (!armor->TryPickup (Owner))
if (!armor->CallTryPickup (Owner))
{
armor->Destroy ();
return false;

View file

@ -27,12 +27,12 @@ class AClericWeaponPiece : public AWeaponPiece
{
DECLARE_CLASS (AClericWeaponPiece, AWeaponPiece)
protected:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
IMPLEMENT_CLASS (AClericWeaponPiece)
bool AClericWeaponPiece::TryPickup (AActor *toucher)
bool AClericWeaponPiece::TryPickup (AActor *&toucher)
{
if (!toucher->IsKindOf (PClass::FindClass(NAME_MagePlayer)) &&
!toucher->IsKindOf (PClass::FindClass(NAME_FighterPlayer)))

View file

@ -17,7 +17,7 @@ IMPLEMENT_CLASS (AFighterWeapon)
IMPLEMENT_CLASS (AClericWeapon)
IMPLEMENT_CLASS (AMageWeapon)
bool AFighterWeapon::TryPickup (AActor *toucher)
bool AFighterWeapon::TryPickup (AActor *&toucher)
{
// The Doom and Hexen players are not excluded from pickup in case
// somebody wants to use these weapons with either of those games.
@ -42,7 +42,7 @@ bool AFighterWeapon::TryPickup (AActor *toucher)
// Cleric Weapon Base Class -------------------------------------------------
bool AClericWeapon::TryPickup (AActor *toucher)
bool AClericWeapon::TryPickup (AActor *&toucher)
{
// The Doom and Hexen players are not excluded from pickup in case
// somebody wants to use these weapons with either of those games.
@ -67,7 +67,7 @@ bool AClericWeapon::TryPickup (AActor *toucher)
// Mage Weapon Base Class ---------------------------------------------------
bool AMageWeapon::TryPickup (AActor *toucher)
bool AMageWeapon::TryPickup (AActor *&toucher)
{
// The Doom and Hexen players are not excluded from pickup in case
// somebody wants to use these weapons with either of those games.

View file

@ -21,12 +21,12 @@ class AFighterWeaponPiece : public AWeaponPiece
{
DECLARE_CLASS (AFighterWeaponPiece, AWeaponPiece)
protected:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
IMPLEMENT_CLASS (AFighterWeaponPiece)
bool AFighterWeaponPiece::TryPickup (AActor *toucher)
bool AFighterWeaponPiece::TryPickup (AActor *&toucher)
{
if (!toucher->IsKindOf (PClass::FindClass(NAME_ClericPlayer)) &&
!toucher->IsKindOf (PClass::FindClass(NAME_MagePlayer)))

View file

@ -48,7 +48,7 @@ bool AArtiHealingRadius::Use (bool pickup)
AHexenArmor *armor = Spawn<AHexenArmor> (0,0,0, NO_REPLACE);
armor->health = j;
armor->Amount = 1;
if (!armor->TryPickup (players[i].mo))
if (!armor->CallTryPickup (players[i].mo))
{
armor->Destroy ();
}

View file

@ -16,21 +16,21 @@ class AFighterWeapon : public AWeapon
{
DECLARE_CLASS (AFighterWeapon, AWeapon);
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
class AClericWeapon : public AWeapon
{
DECLARE_CLASS (AClericWeapon, AWeapon);
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
class AMageWeapon : public AWeapon
{
DECLARE_CLASS (AMageWeapon, AWeapon);
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
#endif //__A_HEXENGLOBAL_H__

View file

@ -26,12 +26,12 @@ class AMageWeaponPiece : public AWeaponPiece
{
DECLARE_CLASS (AMageWeaponPiece, AWeaponPiece)
protected:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
IMPLEMENT_CLASS (AMageWeaponPiece)
bool AMageWeaponPiece::TryPickup (AActor *toucher)
bool AMageWeaponPiece::TryPickup (AActor *&toucher)
{
if (!toucher->IsKindOf (PClass::FindClass(NAME_ClericPlayer)) &&
!toucher->IsKindOf (PClass::FindClass(NAME_FighterPlayer)))

View file

@ -69,7 +69,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Summon)
{
mo->tracer = self->tracer; // Pointer to master
AInventory *power = Spawn<APowerMinotaur> (0, 0, 0, NO_REPLACE);
power->TryPickup (self->tracer);
power->CallTryPickup (self->tracer);
if (self->tracer->player != NULL)
{
mo->FriendPlayer = int(self->tracer->player - players + 1);

View file

@ -60,7 +60,7 @@ bool APowerupGiver::Use (bool pickup)
}
power->ItemFlags |= ItemFlags & (IF_ALWAYSPICKUP|IF_ADDITIVETIME);
if (power->TryPickup (Owner))
if (power->CallTryPickup (Owner))
{
return true;
}

View file

@ -891,7 +891,7 @@ void AInventory::Touch (AActor *toucher)
toucher = toucher->player->mo;
}
if (!TryPickup (toucher))
if (!CallTryPickup (toucher))
return;
if (!(ItemFlags & IF_QUIET))
@ -1163,13 +1163,14 @@ void AInventory::GiveQuest (AActor *toucher)
toucher->GiveInventoryType (QuestItemClasses[quest-1]);
}
}
//===========================================================================
//
// AInventory :: TryPickup
//
//===========================================================================
bool AInventory::TryPickup (AActor *toucher)
bool AInventory::TryPickup (AActor *&toucher)
{
AActor *newtoucher = toucher; // in case changed by the powerup
@ -1201,7 +1202,7 @@ bool AInventory::TryPickup (AActor *toucher)
bool usegood = Use (true);
toucher->RemoveInventory (this);
if (usegood || (ItemFlags & IF_ALWAYSPICKUP))
if (usegood)
{
GoAwayAndDie ();
}
@ -1248,11 +1249,30 @@ bool AInventory::TryPickup (AActor *toucher)
}
}
}
GiveQuest(newtoucher);
return true;
}
//===========================================================================
//
// AInventory :: TryPickup
//
//===========================================================================
bool AInventory::CallTryPickup (AActor *toucher)
{
bool res = TryPickup(toucher);
if (!res && (ItemFlags & IF_ALWAYSPICKUP))
{
res = true;
GoAwayAndDie();
}
if (res) GiveQuest(toucher);
return res;
}
//===========================================================================
//
// CCMD printinv
@ -1344,7 +1364,7 @@ bool ACustomInventory::Use (bool pickup)
//
//===========================================================================
bool ACustomInventory::TryPickup (AActor *toucher)
bool ACustomInventory::TryPickup (AActor *&toucher)
{
FState *pickupstate = FindState(NAME_Pickup);
bool useok = CallStateChain (toucher, pickupstate);
@ -1352,9 +1372,8 @@ bool ACustomInventory::TryPickup (AActor *toucher)
{
useok = Super::TryPickup (toucher);
}
else if (useok || ItemFlags & IF_ALWAYSPICKUP)
else if (useok)
{
GiveQuest (toucher);
GoAwayAndDie();
}
return useok;
@ -1389,7 +1408,7 @@ const char *AHealth::PickupMessage ()
//
//===========================================================================
bool AHealth::TryPickup (AActor *other)
bool AHealth::TryPickup (AActor *&other)
{
player_t *player = other->player;
int max = MaxAmount;
@ -1422,13 +1441,6 @@ bool AHealth::TryPickup (AActor *other)
}
if (player->health >= max)
{
// You should be able to pick up the Doom health bonus even if
// you are already full on health.
if (ItemFlags & IF_ALWAYSPICKUP)
{
GoAwayAndDie ();
return true;
}
return false;
}
player->health += Amount;
@ -1441,7 +1453,7 @@ bool AHealth::TryPickup (AActor *other)
else
{
PrevHealth = INT_MAX;
if (P_GiveBody(other, Amount) || ItemFlags & IF_ALWAYSPICKUP)
if (P_GiveBody(other, Amount))
{
GoAwayAndDie ();
return true;
@ -1693,10 +1705,9 @@ IMPLEMENT_CLASS (AMapRevealer)
//
//===========================================================================
bool AMapRevealer::TryPickup (AActor *toucher)
bool AMapRevealer::TryPickup (AActor *&toucher)
{
level.flags |= LEVEL_ALLMAP;
GiveQuest (toucher);
GoAwayAndDie ();
return true;
}

View file

@ -118,7 +118,7 @@ public:
virtual bool ShouldRespawn ();
virtual bool ShouldStay ();
virtual void Hide ();
virtual bool TryPickup (AActor *toucher);
bool CallTryPickup (AActor *toucher);
virtual void DoPickupSpecial (AActor *toucher);
virtual bool SpecialDropAction (AActor *dropper);
virtual bool DrawPowerup (int x, int y);
@ -166,6 +166,7 @@ public:
virtual PalEntry GetBlend ();
protected:
virtual bool TryPickup (AActor *&toucher);
void GiveQuest(AActor * toucher);
private:
@ -182,7 +183,7 @@ public:
// This is used when an inventory item's use state sequence is executed.
bool CallStateChain (AActor *actor, FState *state);
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
bool Use (bool pickup);
bool SpecialDropAction (AActor *dropper);
};
@ -235,7 +236,7 @@ public:
virtual bool HandlePickup (AInventory *item);
virtual AInventory *CreateCopy (AActor *other);
virtual AInventory *CreateTossable ();
virtual bool TryPickup (AActor *toucher);
virtual bool TryPickup (AActor *&toucher);
virtual bool PickupForAmmo (AWeapon *ownedWeapon);
virtual bool Use (bool pickup);
virtual void Destroy();
@ -300,7 +301,7 @@ class AHealth : public AInventory
int PrevHealth;
public:
virtual bool TryPickup (AActor *other);
virtual bool TryPickup (AActor *&other);
virtual const char *PickupMessage ();
};
@ -404,7 +405,7 @@ class AMapRevealer : public AInventory
{
DECLARE_CLASS (AMapRevealer, AInventory)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
// A backpack gives you one clip of each ammo and doubles your

View file

@ -21,7 +21,7 @@ void AWeaponPiece::Serialize (FArchive &arc)
//
//==========================================================================
bool AWeaponPiece::TryPickup (AActor *toucher)
bool AWeaponPiece::TryPickup (AActor *&toucher)
{
AInventory * inv;
AWeaponHolder * hold=NULL;
@ -70,7 +70,6 @@ bool AWeaponPiece::TryPickup (AActor *toucher)
{
// Already has the piece, check if mana needed
if (!gaveAmmo) return false;
GiveQuest (toucher);
GoAwayAndDie();
return true;
}
@ -93,7 +92,6 @@ bool AWeaponPiece::TryPickup (AActor *toucher)
FullWeapon->AmmoGive2=Defaults->AmmoGive2;
}
}
GiveQuest (toucher);
GoAwayAndDie();
return true;
}

View file

@ -7,7 +7,7 @@ protected:
bool PrivateShouldStay ();
public:
void Serialize (FArchive &arc);
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
bool ShouldStay ();
virtual const char *PickupMessage ();
virtual void PlayPickupSound (AActor *toucher);

View file

@ -57,7 +57,7 @@ void AWeapon::Serialize (FArchive &arc)
//
//===========================================================================
bool AWeapon::TryPickup (AActor *toucher)
bool AWeapon::TryPickup (AActor *&toucher)
{
FState * ReadyState = FindState(NAME_Ready);
if (ReadyState != NULL &&
@ -578,12 +578,12 @@ class AWeaponGiver : public AWeapon
DECLARE_CLASS(AWeaponGiver, AWeapon)
public:
bool TryPickup(AActor *toucher);
bool TryPickup(AActor *&toucher);
};
IMPLEMENT_CLASS(AWeaponGiver)
bool AWeaponGiver::TryPickup(AActor *toucher)
bool AWeaponGiver::TryPickup(AActor *&toucher)
{
FDropItem *di = GetDropItems(GetClass());
@ -595,7 +595,8 @@ bool AWeaponGiver::TryPickup(AActor *toucher)
AWeapon *weap = static_cast<AWeapon*>(Spawn(di->Name, 0, 0, 0, NO_REPLACE));
if (weap != NULL)
{
bool res = weap->TryPickup(toucher);
weap->ItemFlags &= ~IF_ALWAYSPICKUP; // use the flag of this item only.
bool res = weap->CallTryPickup(toucher);
if (!res) weap->Destroy();
else GoAwayAndDie();
return res;

View file

@ -33,21 +33,21 @@ class AUpgradeStamina : public ADummyStrifeItem
{
DECLARE_CLASS (AUpgradeStamina, ADummyStrifeItem)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
class AUpgradeAccuracy : public ADummyStrifeItem
{
DECLARE_CLASS (AUpgradeAccuracy, ADummyStrifeItem)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
class ASlideshowStarter : public ADummyStrifeItem
{
DECLARE_CLASS (ASlideshowStarter, ADummyStrifeItem)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
class ASigil : public AWeapon

View file

@ -66,12 +66,12 @@ class AHealthTraining : public AInventory
{
DECLARE_CLASS (AHealthTraining, AInventory)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
IMPLEMENT_CLASS (AHealthTraining)
bool AHealthTraining::TryPickup (AActor *toucher)
bool AHealthTraining::TryPickup (AActor *&toucher)
{
if (Super::TryPickup (toucher))
{
@ -80,7 +80,7 @@ bool AHealthTraining::TryPickup (AActor *toucher)
if (coin != NULL)
{
coin->Amount = toucher->player->accuracy*5 + 300;
if (!coin->TryPickup (toucher))
if (!coin->CallTryPickup (toucher))
{
coin->Destroy ();
}
@ -120,13 +120,13 @@ class APrisonPass : public AKey
{
DECLARE_CLASS (APrisonPass, AKey)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
bool SpecialDropAction (AActor *dropper);
};
IMPLEMENT_CLASS (APrisonPass)
bool APrisonPass::TryPickup (AActor *toucher)
bool APrisonPass::TryPickup (AActor *&toucher)
{
Super::TryPickup (toucher);
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 223, 2*FRACUNIT, 0, 0, 0);
@ -165,13 +165,13 @@ class ARaiseAlarm : public ADummyStrifeItem
{
DECLARE_CLASS (ARaiseAlarm, ADummyStrifeItem)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
bool SpecialDropAction (AActor *dropper);
};
IMPLEMENT_CLASS (ARaiseAlarm)
bool ARaiseAlarm::TryPickup (AActor *toucher)
bool ARaiseAlarm::TryPickup (AActor *&toucher)
{
P_NoiseAlert (toucher, toucher);
// A_WakeOracleSpectre (dword312F4);
@ -196,12 +196,12 @@ class AOpenDoor222 : public ADummyStrifeItem
{
DECLARE_CLASS (AOpenDoor222, ADummyStrifeItem)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
IMPLEMENT_CLASS (AOpenDoor222)
bool AOpenDoor222::TryPickup (AActor *toucher)
bool AOpenDoor222::TryPickup (AActor *&toucher)
{
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 222, 2*FRACUNIT, 0, 0, 0);
GoAwayAndDie ();
@ -214,13 +214,13 @@ class ACloseDoor222 : public ADummyStrifeItem
{
DECLARE_CLASS (ACloseDoor222, ADummyStrifeItem)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
bool SpecialDropAction (AActor *dropper);
};
IMPLEMENT_CLASS (ACloseDoor222)
bool ACloseDoor222::TryPickup (AActor *toucher)
bool ACloseDoor222::TryPickup (AActor *&toucher)
{
EV_DoDoor (DDoor::doorClose, NULL, toucher, 222, 2*FRACUNIT, 0, 0, 0);
GoAwayAndDie ();
@ -245,13 +245,13 @@ class AOpenDoor224 : public ADummyStrifeItem
{
DECLARE_CLASS (AOpenDoor224, ADummyStrifeItem)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
bool SpecialDropAction (AActor *dropper);
};
IMPLEMENT_CLASS (AOpenDoor224)
bool AOpenDoor224::TryPickup (AActor *toucher)
bool AOpenDoor224::TryPickup (AActor *&toucher)
{
EV_DoDoor (DDoor::doorOpen, NULL, toucher, 224, 2*FRACUNIT, 0, 0, 0);
GoAwayAndDie ();
@ -271,12 +271,12 @@ class AAmmoFillup : public ADummyStrifeItem
{
DECLARE_CLASS (AAmmoFillup, ADummyStrifeItem)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
IMPLEMENT_CLASS (AAmmoFillup)
bool AAmmoFillup::TryPickup (AActor *toucher)
bool AAmmoFillup::TryPickup (AActor *&toucher)
{
const PClass * clip = PClass::FindClass(NAME_ClipOfBullets);
if (clip != NULL)
@ -309,12 +309,12 @@ class AHealthFillup : public ADummyStrifeItem
{
DECLARE_CLASS (AHealthFillup, ADummyStrifeItem)
public:
bool TryPickup (AActor *toucher);
bool TryPickup (AActor *&toucher);
};
IMPLEMENT_CLASS (AHealthFillup)
bool AHealthFillup::TryPickup (AActor *toucher)
bool AHealthFillup::TryPickup (AActor *&toucher)
{
static const int skillhealths[5] = { -100, -75, -50, -50, -100 };
@ -331,7 +331,7 @@ bool AHealthFillup::TryPickup (AActor *toucher)
IMPLEMENT_CLASS (AUpgradeStamina)
bool AUpgradeStamina::TryPickup (AActor *toucher)
bool AUpgradeStamina::TryPickup (AActor *&toucher)
{
if (toucher->player == NULL)
return false;
@ -349,7 +349,7 @@ bool AUpgradeStamina::TryPickup (AActor *toucher)
IMPLEMENT_CLASS (AUpgradeAccuracy)
bool AUpgradeAccuracy::TryPickup (AActor *toucher)
bool AUpgradeAccuracy::TryPickup (AActor *&toucher)
{
if (toucher->player == NULL || toucher->player->accuracy >= 100)
return false;
@ -362,7 +362,7 @@ bool AUpgradeAccuracy::TryPickup (AActor *toucher)
IMPLEMENT_CLASS (ASlideshowStarter)
bool ASlideshowStarter::TryPickup (AActor *toucher)
bool ASlideshowStarter::TryPickup (AActor *&toucher)
{
gameaction = ga_slideshow;
if (level.levelnum == 10)

View file

@ -1071,7 +1071,7 @@ int ASigil::GiveSigilPiece (AActor *receiver)
if (sigil == NULL)
{
sigil = static_cast<ASigil*>(Spawn("Sigil1", 0,0,0, NO_REPLACE));
if (!sigil->TryPickup (receiver))
if (!sigil->CallTryPickup (receiver))
{
sigil->Destroy ();
}

View file

@ -36,7 +36,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_GiveQuestItem)
if (playeringame[i])
{
AInventory *item = static_cast<AInventory *>(Spawn (QuestItemClasses[questitem-1], 0,0,0, NO_REPLACE));
if (!item->TryPickup (players[i].mo))
if (!item->CallTryPickup (players[i].mo))
{
item->Destroy ();
}

View file

@ -577,7 +577,7 @@ void GiveSpawner (player_t *player, const PClass *type, int amount)
level.total_items--;
item->flags &= ~MF_COUNTITEM;
}
if (!item->TryPickup (player->mo))
if (!item->CallTryPickup (player->mo))
{
item->Destroy ();
}
@ -693,7 +693,7 @@ void cht_Give (player_t *player, const char *name, int amount)
ABasicArmorPickup *armor = Spawn<ABasicArmorPickup> (0,0,0, NO_REPLACE);
armor->SaveAmount = 100*deh.BlueAC;
armor->SavePercent = gameinfo.gametype != GAME_Heretic ? FRACUNIT/2 : FRACUNIT*3/4;
if (!armor->TryPickup (player->mo))
if (!armor->CallTryPickup (player->mo))
{
armor->Destroy ();
}
@ -705,7 +705,7 @@ void cht_Give (player_t *player, const char *name, int amount)
AHexenArmor *armor = Spawn<AHexenArmor> (0,0,0, NO_REPLACE);
armor->health = i;
armor->Amount = 0;
if (!armor->TryPickup (player->mo))
if (!armor->CallTryPickup (player->mo))
{
armor->Destroy ();
}
@ -726,7 +726,7 @@ void cht_Give (player_t *player, const char *name, int amount)
if (key->KeyNumber != 0)
{
key = static_cast<AKey *>(Spawn (PClass::m_Types[i], 0,0,0, NO_REPLACE));
if (!key->TryPickup (player->mo))
if (!key->CallTryPickup (player->mo))
{
key->Destroy ();
}

View file

@ -226,7 +226,7 @@ static void DoGiveInv (AActor *actor, const PClass *info, int amount)
{
item->Amount = amount;
}
if (!item->TryPickup (actor))
if (!item->CallTryPickup (actor))
{
item->Destroy ();
}

View file

@ -1154,7 +1154,7 @@ void P_ConversationCommand (int player, BYTE **stream)
static_cast<AWeapon*>(item)->AmmoGive1 = 40;
}
item->flags |= MF_DROPPED;
if (!item->TryPickup (players[player].mo))
if (!item->CallTryPickup (players[player].mo))
{
item->Destroy ();
Conversation_TakeStuff = false;

View file

@ -790,7 +790,7 @@ AInventory *AActor::GiveInventoryType (const PClass *type)
if (type != NULL)
{
item = static_cast<AInventory *>(Spawn (type, 0,0,0, NO_REPLACE));
if (!item->TryPickup (this))
if (!item->CallTryPickup (this))
{
item->Destroy ();
return NULL;
@ -816,7 +816,7 @@ bool AActor::GiveAmmo (const PClass *type, int amount)
{
item->Amount = amount;
item->flags |= MF_DROPPED;
if (!item->TryPickup (this))
if (!item->CallTryPickup (this))
{
item->Destroy ();
return false;

View file

@ -698,7 +698,7 @@ void APlayerPawn::GiveDeathmatchInventory()
if (key->KeyNumber != 0)
{
key = static_cast<AKey *>(Spawn (PClass::m_Types[i], 0,0,0, NO_REPLACE));
if (!key->TryPickup (this))
if (!key->CallTryPickup (this))
{
key->Destroy ();
}
@ -1007,7 +1007,7 @@ void APlayerPawn::GiveDefaultInventory ()
static_cast<AWeapon*>(item)->AmmoGive1 =
static_cast<AWeapon*>(item)->AmmoGive2 = 0;
}
if (!item->TryPickup(this))
if (!item->CallTryPickup(this))
{
item->Destroy ();
item = NULL;

View file

@ -78,7 +78,7 @@ public:
return Respawnable && Super::ShouldRespawn();
}
bool TryPickup (AActor *toucher)
bool TryPickup (AActor *&toucher)
{
INTBOOL success = LineSpecials[special] (NULL, toucher, false,
args[0], args[1], args[2], args[3], args[4]);

View file

@ -1213,7 +1213,7 @@ static void DoGiveInventory(AActor * self, AActor * receiver, DECLARE_PARAMINFO)
item->flags&=~MF_COUNTITEM;
level.total_items--;
}
if (!item->TryPickup (receiver))
if (!item->CallTryPickup (receiver))
{
item->Destroy ();
res = false;