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"
|
2008-08-10 20:48:55 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2008-09-15 14:11:05 +00:00
|
|
|
*/
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// Tome of power ------------------------------------------------------------
|
|
|
|
|
|
|
|
class AArtiTomeOfPower : public APowerupGiver
|
|
|
|
{
|
2008-07-21 17:03:30 +00:00
|
|
|
DECLARE_CLASS (AArtiTomeOfPower, APowerupGiver)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
bool Use (bool pickup);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-07-21 17:03:30 +00:00
|
|
|
IMPLEMENT_CLASS (AArtiTomeOfPower)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool AArtiTomeOfPower::Use (bool pickup)
|
|
|
|
{
|
2008-04-08 09:52:50 +00:00
|
|
|
if (Owner->player->morphTics && (Owner->player->MorphStyle & MORPH_UNDOBYTOMEOFPOWER))
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Attempt to undo chicken
|
2009-09-18 05:46:15 +00:00
|
|
|
if (!P_UndoPlayerMorph (Owner->player, Owner->player, MORPH_UNDOBYTOMEOFPOWER))
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Failed
|
2008-04-12 15:31:18 +00:00
|
|
|
if (!(Owner->player->MorphStyle & MORPH_FAILNOTELEFRAG))
|
|
|
|
{
|
2009-08-07 03:57:03 +00:00
|
|
|
P_DamageMobj (Owner, NULL, NULL, TELEFRAG_DAMAGE, NAME_Telefrag);
|
2008-04-12 15:31:18 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{ // Succeeded
|
|
|
|
S_Sound (Owner, CHAN_VOICE, "*evillaugh", 1, ATTN_IDLE);
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return Super::Use (pickup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Time bomb ----------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-07-21 17:03:30 +00:00
|
|
|
self->z += 32*FRACUNIT;
|
|
|
|
self->RenderStyle = STYLE_Add;
|
|
|
|
self->alpha = FRACUNIT;
|
2012-08-30 04:01:50 +00:00
|
|
|
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, RADF_HURTSOURCE);
|
2009-10-17 11:30:44 +00:00
|
|
|
P_CheckSplash(self, 128<<FRACBITS);
|
2008-07-21 17:03:30 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
class AArtiTimeBomb : public AInventory
|
|
|
|
{
|
2008-07-21 17:03:30 +00:00
|
|
|
DECLARE_CLASS (AArtiTimeBomb, AInventory)
|
2006-02-24 04:48:15 +00:00
|
|
|
public:
|
|
|
|
bool Use (bool pickup);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-07-21 17:03:30 +00:00
|
|
|
IMPLEMENT_CLASS (AArtiTimeBomb)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
bool AArtiTimeBomb::Use (bool pickup)
|
|
|
|
{
|
|
|
|
angle_t angle = Owner->angle >> ANGLETOFINESHIFT;
|
2008-07-21 17:03:30 +00:00
|
|
|
AActor *mo = Spawn("ActivatedTimeBomb",
|
2006-02-24 04:48:15 +00:00
|
|
|
Owner->x + 24*finecosine[angle],
|
|
|
|
Owner->y + 24*finesine[angle],
|
2006-07-16 09:10:45 +00:00
|
|
|
Owner->z - Owner->floorclip, ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
mo->target = Owner;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|