qzdoom/src/g_hexen/a_boostarmor.cpp
Christoph Oelckers 2cad1c2c19 - 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)
2008-09-13 22:08:41 +00:00

62 lines
1.1 KiB
C++

#include "info.h"
#include "a_pickups.h"
#include "a_artifacts.h"
#include "gstrings.h"
#include "p_local.h"
#include "gi.h"
#include "s_sound.h"
// Boost Armor Artifact (Dragonskin Bracers) --------------------------------
class AArtiBoostArmor : public AInventory
{
DECLARE_CLASS (AArtiBoostArmor, AInventory)
public:
bool Use (bool pickup);
};
IMPLEMENT_CLASS (AArtiBoostArmor)
bool AArtiBoostArmor::Use (bool pickup)
{
int count = 0;
if (gameinfo.gametype == GAME_Hexen)
{
AHexenArmor *armor;
for (int i = 0; i < 4; ++i)
{
armor = Spawn<AHexenArmor> (0,0,0, NO_REPLACE);
armor->flags |= MF_DROPPED;
armor->health = i;
armor->Amount = 1;
if (!armor->CallTryPickup (Owner))
{
armor->Destroy ();
}
else
{
count++;
}
}
return count != 0;
}
else
{
ABasicArmorBonus *armor = Spawn<ABasicArmorBonus> (0,0,0, NO_REPLACE);
armor->flags |= MF_DROPPED;
armor->SaveAmount = 50;
armor->MaxSaveAmount = 300;
if (!armor->CallTryPickup (Owner))
{
armor->Destroy ();
return false;
}
else
{
return true;
}
}
}