2008-09-15 14:11:05 +00:00
|
|
|
/*
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "info.h"
|
|
|
|
#include "a_pickups.h"
|
|
|
|
#include "a_artifacts.h"
|
|
|
|
#include "gstrings.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "a_hexenglobal.h"
|
|
|
|
#include "gi.h"
|
2008-09-14 23:54:38 +00:00
|
|
|
#include "doomstat.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
*/
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-06-17 20:29:41 +00:00
|
|
|
#define HEAL_RADIUS_DIST 255*FRACUNIT
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-11-07 10:20:09 +00:00
|
|
|
static FRandom pr_healradius ("HealRadius");
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
// Healing Radius Artifact --------------------------------------------------
|
|
|
|
|
|
|
|
class AArtiHealingRadius : public AInventory
|
|
|
|
{
|
2008-08-09 17:43:14 +00:00
|
|
|
DECLARE_CLASS (AArtiHealingRadius, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
bool Use (bool pickup);
|
|
|
|
};
|
|
|
|
|
2008-08-09 17:43:14 +00:00
|
|
|
IMPLEMENT_CLASS (AArtiHealingRadius)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool AArtiHealingRadius::Use (bool pickup)
|
|
|
|
{
|
|
|
|
bool effective = false;
|
2010-03-25 20:38:00 +00:00
|
|
|
FName mode;
|
|
|
|
|
|
|
|
if (Owner->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
|
|
|
|
{
|
|
|
|
mode = static_cast<PClassPlayerPawn *>(Owner->GetClass())->HealingRadiusType;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < MAXPLAYERS; ++i)
|
|
|
|
{
|
|
|
|
if (playeringame[i] &&
|
|
|
|
players[i].mo != NULL &&
|
|
|
|
players[i].mo->health > 0 &&
|
2016-01-10 16:52:41 +00:00
|
|
|
players[i].mo->AproxDistance (Owner) <= HEAL_RADIUS_DIST)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-11-07 10:20:09 +00:00
|
|
|
// Q: Is it worth it to make this selectable as a player property?
|
|
|
|
// A: Probably not - but it sure doesn't hurt.
|
|
|
|
bool gotsome=false;
|
|
|
|
switch (mode)
|
|
|
|
{
|
|
|
|
case NAME_Armor:
|
|
|
|
for (int j = 0; j < 4; ++j)
|
|
|
|
{
|
|
|
|
AHexenArmor *armor = Spawn<AHexenArmor> (0,0,0, NO_REPLACE);
|
|
|
|
armor->health = j;
|
|
|
|
armor->Amount = 1;
|
2008-09-13 22:08:41 +00:00
|
|
|
if (!armor->CallTryPickup (players[i].mo))
|
2006-11-07 10:20:09 +00:00
|
|
|
{
|
|
|
|
armor->Destroy ();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
gotsome = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NAME_Mana:
|
|
|
|
{
|
|
|
|
int amount = 50 + (pr_healradius() % 50);
|
|
|
|
|
2010-04-03 04:07:17 +00:00
|
|
|
if (players[i].mo->GiveAmmo (dyn_cast<PClassAmmo>(PClass::FindClass(NAME_Mana1)), amount) ||
|
|
|
|
players[i].mo->GiveAmmo (dyn_cast<PClassAmmo>(PClass::FindClass(NAME_Mana2)), amount))
|
2006-11-07 10:20:09 +00:00
|
|
|
{
|
|
|
|
gotsome = true;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
default:
|
|
|
|
//case NAME_Health:
|
|
|
|
gotsome = P_GiveBody (players[i].mo, 50 + (pr_healradius()%50));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (gotsome)
|
|
|
|
{
|
|
|
|
S_Sound (players[i].mo, CHAN_AUTO, "MysticIncant", 1, ATTN_NORM);
|
|
|
|
effective=true;
|
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return effective;
|
|
|
|
|
|
|
|
}
|