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 "p_enemy.h"
|
|
|
|
#include "s_sound.h"
|
2008-08-10 20:48:55 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
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
|
2008-05-22 19:35:38 +00:00
|
|
|
if (!P_UndoPlayerMorph (Owner->player, Owner->player))
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Failed
|
2008-04-12 15:31:18 +00:00
|
|
|
if (!(Owner->player->MorphStyle & MORPH_FAILNOTELEFRAG))
|
|
|
|
{
|
|
|
|
P_DamageMobj (Owner, NULL, NULL, 1000000, NAME_Telefrag);
|
|
|
|
}
|
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;
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_Explode, self);
|
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;
|
|
|
|
}
|
|
|
|
|