2006-02-24 04:48:15 +00:00
|
|
|
#include "actor.h"
|
2007-05-28 14:46:49 +00:00
|
|
|
#include "thingdef/thingdef.h"
|
2006-07-13 10:17:56 +00:00
|
|
|
#include "p_conversation.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
#include "p_lnspec.h"
|
|
|
|
#include "a_action.h"
|
|
|
|
#include "m_random.h"
|
|
|
|
#include "s_sound.h"
|
|
|
|
#include "d_player.h"
|
|
|
|
#include "p_local.h"
|
|
|
|
#include "p_terrain.h"
|
|
|
|
#include "p_enemy.h"
|
|
|
|
#include "statnums.h"
|
|
|
|
#include "templates.h"
|
2008-08-10 20:48:55 +00:00
|
|
|
#include "r_translate.h"
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
static FRandom pr_freezedeath ("FreezeDeath");
|
|
|
|
static FRandom pr_icesettics ("IceSetTics");
|
|
|
|
static FRandom pr_freeze ("FreezeDeathChunks");
|
|
|
|
|
2008-08-08 15:18:23 +00:00
|
|
|
|
|
|
|
// SwitchableDecoration: Activate and Deactivate change state ---------------
|
|
|
|
|
|
|
|
class ASwitchableDecoration : public AActor
|
|
|
|
{
|
2008-08-08 22:52:04 +00:00
|
|
|
DECLARE_CLASS (ASwitchableDecoration, AActor)
|
2008-08-08 15:18:23 +00:00
|
|
|
public:
|
|
|
|
void Activate (AActor *activator);
|
|
|
|
void Deactivate (AActor *activator);
|
|
|
|
};
|
|
|
|
|
2008-08-08 22:52:04 +00:00
|
|
|
IMPLEMENT_CLASS (ASwitchableDecoration)
|
2008-08-08 15:18:23 +00:00
|
|
|
|
|
|
|
void ASwitchableDecoration::Activate (AActor *activator)
|
|
|
|
{
|
|
|
|
SetState (FindState(NAME_Active));
|
|
|
|
}
|
|
|
|
|
|
|
|
void ASwitchableDecoration::Deactivate (AActor *activator)
|
|
|
|
{
|
|
|
|
SetState (FindState(NAME_Inactive));
|
|
|
|
}
|
|
|
|
|
|
|
|
// SwitchingDecoration: Only Activate changes state -------------------------
|
|
|
|
|
|
|
|
class ASwitchingDecoration : public ASwitchableDecoration
|
|
|
|
{
|
2008-08-08 22:52:04 +00:00
|
|
|
DECLARE_CLASS (ASwitchingDecoration, ASwitchableDecoration)
|
2008-08-08 15:18:23 +00:00
|
|
|
public:
|
|
|
|
void Deactivate (AActor *activator) {}
|
|
|
|
};
|
|
|
|
|
2008-08-08 22:52:04 +00:00
|
|
|
IMPLEMENT_CLASS (ASwitchingDecoration)
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-07-13 10:17:56 +00:00
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// PROC A_NoBlocking
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_NoBlocking)
|
2006-07-13 10:17:56 +00:00
|
|
|
{
|
|
|
|
// [RH] Andy Baker's stealth monsters
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->flags & MF_STEALTH)
|
2006-07-13 10:17:56 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->alpha = OPAQUE;
|
|
|
|
self->visdir = 0;
|
2006-07-13 10:17:56 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags &= ~MF_SOLID;
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
// If the self has a conversation that sets an item to drop, drop that.
|
|
|
|
if (self->Conversation != NULL && self->Conversation->DropType != NULL)
|
2006-07-13 10:17:56 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
P_DropItem (self, self->Conversation->DropType, -1, 256);
|
|
|
|
self->Conversation = NULL;
|
2006-07-13 10:17:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
self->Conversation = NULL;
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
// If the self has attached metadata for items to drop, drop those.
|
|
|
|
if (!self->IsKindOf (RUNTIME_CLASS (APlayerPawn))) // [GRB]
|
2006-07-13 10:17:56 +00:00
|
|
|
{
|
2008-09-21 18:02:38 +00:00
|
|
|
FDropItem *di = self->GetDropItems();
|
2006-07-13 10:17:56 +00:00
|
|
|
|
2006-07-16 09:10:45 +00:00
|
|
|
if (di != NULL)
|
2006-07-13 10:17:56 +00:00
|
|
|
{
|
2006-07-16 09:10:45 +00:00
|
|
|
while (di != NULL)
|
2006-07-13 10:17:56 +00:00
|
|
|
{
|
2006-07-16 09:10:45 +00:00
|
|
|
if (di->Name != NAME_None)
|
|
|
|
{
|
|
|
|
const PClass *ti = PClass::FindClass(di->Name);
|
2008-08-10 20:48:55 +00:00
|
|
|
if (ti) P_DropItem (self, ti, di->amount, di->probability);
|
2006-07-16 09:10:45 +00:00
|
|
|
}
|
|
|
|
di = di->Next;
|
2006-07-13 10:17:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_Fall)
|
|
|
|
{
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_NoBlocking, self);
|
2008-08-10 20:48:55 +00:00
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A_SetFloorClip
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SetFloorClip)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags2 |= MF2_FLOORCLIP;
|
|
|
|
self->AdjustFloorClip ();
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A_UnSetFloorClip
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_UnSetFloorClip)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags2 &= ~MF2_FLOORCLIP;
|
|
|
|
self->floorclip = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A_HideThing
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_HideThing)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->renderflags |= RF_INVISIBLE;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A_UnHideThing
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_UnHideThing)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->renderflags &= ~RF_INVISIBLE;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FreezeDeath
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeath)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int t = pr_freezedeath();
|
2008-08-10 20:48:55 +00:00
|
|
|
self->tics = 75+t+pr_freezedeath();
|
|
|
|
self->flags |= MF_SOLID|MF_SHOOTABLE|MF_NOBLOOD|MF_ICECORPSE;
|
|
|
|
self->flags2 |= MF2_PUSHABLE|MF2_TELESTOMP|MF2_PASSMOBJ|MF2_SLIDE;
|
|
|
|
self->flags3 |= MF3_CRASHED;
|
|
|
|
self->height = self->GetDefault()->height;
|
|
|
|
S_Sound (self, CHAN_BODY, "misc/freeze", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2006-07-30 08:31:26 +00:00
|
|
|
// [RH] Andy Baker's stealth monsters
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->flags & MF_STEALTH)
|
2006-07-30 08:31:26 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->alpha = OPAQUE;
|
|
|
|
self->visdir = 0;
|
2006-07-30 08:31:26 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->player)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->player->damagecount = 0;
|
|
|
|
self->player->poisoncount = 0;
|
|
|
|
self->player->bonuscount = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
else if (self->flags3&MF3_ISMONSTER && self->special)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // Initiate monster death actions
|
2008-08-10 20:48:55 +00:00
|
|
|
LineSpecials [self->special] (NULL, self, false, self->args[0],
|
|
|
|
self->args[1], self->args[2], self->args[3], self->args[4]);
|
|
|
|
self->special = 0;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A_GenericFreezeDeath
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_GenericFreezeDeath)
|
|
|
|
{
|
|
|
|
self->Translation = TRANSLATION(TRANSLATION_Standard, 7);
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_FreezeDeath, self);
|
2008-08-10 20:48:55 +00:00
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_IceSetTics
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_IceSetTics)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
int floor;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
self->tics = 70+(pr_icesettics()&63);
|
|
|
|
floor = P_GetThingFloorType (self);
|
2006-10-31 14:53:21 +00:00
|
|
|
if (Terrains[floor].DamageMOD == NAME_Fire)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->tics >>= 2;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2006-10-31 14:53:21 +00:00
|
|
|
else if (Terrains[floor].DamageMOD == NAME_Ice)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->tics <<= 1;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_FreezeDeathChunks
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
int i;
|
|
|
|
int numChunks;
|
|
|
|
AActor *mo;
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->momx || self->momy || self->momz)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->tics = 3*TICRATE;
|
2006-02-24 04:48:15 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
S_Sound (self, CHAN_BODY, "misc/icebreak", 1, ATTN_NORM);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
// [RH] In Hexen, this creates a random number of shards (range [24,56])
|
2008-08-10 20:48:55 +00:00
|
|
|
// with no relation to the size of the self shattering. I think it should
|
2006-02-24 04:48:15 +00:00
|
|
|
// base the number of shards on the size of the dead thing, so bigger
|
|
|
|
// things break up into more shards than smaller things.
|
2008-08-10 20:48:55 +00:00
|
|
|
// An self with radius 20 and height 64 creates ~40 chunks.
|
|
|
|
numChunks = MAX<int> (4, (self->radius>>FRACBITS)*(self->height>>FRACBITS)/32);
|
2006-02-24 04:48:15 +00:00
|
|
|
i = (pr_freeze.Random2()) % (numChunks/4);
|
|
|
|
for (i = MAX (24, numChunks + i); i >= 0; i--)
|
|
|
|
{
|
2008-08-08 22:52:04 +00:00
|
|
|
mo = Spawn("IceChunk",
|
2008-08-10 20:48:55 +00:00
|
|
|
self->x + (((pr_freeze()-128)*self->radius)>>7),
|
|
|
|
self->y + (((pr_freeze()-128)*self->radius)>>7),
|
|
|
|
self->z + (pr_freeze()*self->height/255), ALLOW_REPLACE);
|
2006-02-24 04:48:15 +00:00
|
|
|
mo->SetState (mo->SpawnState + (pr_freeze()%3));
|
|
|
|
if (mo)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->momz = FixedDiv(mo->z-self->z, self->height)<<2;
|
2006-02-24 04:48:15 +00:00
|
|
|
mo->momx = pr_freeze.Random2 () << (FRACBITS-7);
|
|
|
|
mo->momy = pr_freeze.Random2 () << (FRACBITS-7);
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_IceSetTics, mo); // set a random tic wait
|
2008-08-10 20:48:55 +00:00
|
|
|
mo->RenderStyle = self->RenderStyle;
|
|
|
|
mo->alpha = self->alpha;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
}
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->player)
|
2006-02-24 04:48:15 +00:00
|
|
|
{ // attach the player's view to a chunk of ice
|
2008-08-10 20:48:55 +00:00
|
|
|
AActor *head = Spawn("IceChunkHead", self->x, self->y,
|
|
|
|
self->z + self->player->mo->ViewHeight, ALLOW_REPLACE);
|
|
|
|
head->momz = FixedDiv(head->z-self->z, self->height)<<2;
|
2006-02-24 04:48:15 +00:00
|
|
|
head->momx = pr_freeze.Random2 () << (FRACBITS-7);
|
|
|
|
head->momy = pr_freeze.Random2 () << (FRACBITS-7);
|
2008-08-10 20:48:55 +00:00
|
|
|
head->health = self->health;
|
|
|
|
head->angle = self->angle;
|
2008-08-08 22:52:04 +00:00
|
|
|
if (head->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
head->player = self->player;
|
2008-08-13 22:54:24 +00:00
|
|
|
head->player->mo = static_cast<APlayerPawn*>(head);
|
2008-08-10 20:48:55 +00:00
|
|
|
self->player = NULL;
|
|
|
|
head->ObtainInventory (self);
|
2008-08-08 22:52:04 +00:00
|
|
|
}
|
2006-02-24 04:48:15 +00:00
|
|
|
head->pitch = 0;
|
2008-08-10 20:48:55 +00:00
|
|
|
head->RenderStyle = self->RenderStyle;
|
|
|
|
head->alpha = self->alpha;
|
|
|
|
if (head->player->camera == self)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
head->player->camera = head;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// [RH] Do some stuff to make this more useful outside Hexen
|
2008-08-10 20:48:55 +00:00
|
|
|
if (self->flags4 & MF4_BOSSDEATH)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 22:48:37 +00:00
|
|
|
CALL_ACTION(A_BossDeath, self);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
2009-04-10 04:04:17 +00:00
|
|
|
CALL_ACTION(A_NoBlocking, self);
|
2006-02-24 04:48:15 +00:00
|
|
|
|
2009-04-10 04:04:17 +00:00
|
|
|
self->SetState(self->FindState(NAME_Null));
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// CorpseQueue Routines (used by Hexen)
|
|
|
|
//
|
|
|
|
//----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Corpse queue for monsters - this should be saved out
|
|
|
|
|
|
|
|
class DCorpsePointer : public DThinker
|
|
|
|
{
|
|
|
|
DECLARE_CLASS (DCorpsePointer, DThinker)
|
|
|
|
HAS_OBJECT_POINTERS
|
|
|
|
public:
|
|
|
|
DCorpsePointer (AActor *ptr);
|
|
|
|
void Destroy ();
|
|
|
|
void Serialize (FArchive &arc);
|
2008-03-12 02:56:11 +00:00
|
|
|
TObjPtr<AActor> Corpse;
|
2006-02-24 04:48:15 +00:00
|
|
|
DWORD Count; // Only the first corpse pointer's count is valid.
|
|
|
|
private:
|
|
|
|
DCorpsePointer () {}
|
|
|
|
};
|
|
|
|
|
|
|
|
IMPLEMENT_POINTY_CLASS(DCorpsePointer)
|
|
|
|
DECLARE_POINTER(Corpse)
|
|
|
|
END_POINTERS
|
2006-11-27 00:01:30 +00:00
|
|
|
|
|
|
|
CUSTOM_CVAR(Int, sv_corpsequeuesize, 64, CVAR_ARCHIVE|CVAR_SERVERINFO)
|
|
|
|
{
|
|
|
|
if (self > 0)
|
|
|
|
{
|
|
|
|
TThinkerIterator<DCorpsePointer> iterator (STAT_CORPSEPOINTER);
|
|
|
|
DCorpsePointer *first = iterator.Next ();
|
|
|
|
while (first != NULL && first->Count > (DWORD)self)
|
|
|
|
{
|
|
|
|
DCorpsePointer *next = iterator.Next ();
|
|
|
|
next->Count = first->Count;
|
|
|
|
first->Destroy ();
|
|
|
|
first = next;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-24 04:48:15 +00:00
|
|
|
|
|
|
|
DCorpsePointer::DCorpsePointer (AActor *ptr)
|
|
|
|
: DThinker (STAT_CORPSEPOINTER), Corpse (ptr)
|
|
|
|
{
|
|
|
|
Count = 0;
|
|
|
|
|
|
|
|
// Thinkers are added to the end of their respective lists, so
|
|
|
|
// the first thinker in the list is the oldest one.
|
|
|
|
TThinkerIterator<DCorpsePointer> iterator (STAT_CORPSEPOINTER);
|
|
|
|
DCorpsePointer *first = iterator.Next ();
|
|
|
|
|
|
|
|
if (first != this)
|
|
|
|
{
|
2006-11-27 00:01:30 +00:00
|
|
|
if (first->Count >= (DWORD)sv_corpsequeuesize)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
DCorpsePointer *next = iterator.Next ();
|
|
|
|
next->Count = first->Count;
|
|
|
|
first->Destroy ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
++first->Count;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DCorpsePointer::Destroy ()
|
|
|
|
{
|
|
|
|
// Store the count of corpses in the first thinker in the list
|
|
|
|
TThinkerIterator<DCorpsePointer> iterator (STAT_CORPSEPOINTER);
|
|
|
|
DCorpsePointer *first = iterator.Next ();
|
|
|
|
|
|
|
|
int prevCount = first->Count;
|
|
|
|
|
|
|
|
if (first == this)
|
|
|
|
{
|
|
|
|
first = iterator.Next ();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (first != NULL)
|
|
|
|
{
|
|
|
|
first->Count = prevCount - 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Corpse != NULL)
|
|
|
|
{
|
|
|
|
Corpse->Destroy ();
|
|
|
|
}
|
|
|
|
Super::Destroy ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void DCorpsePointer::Serialize (FArchive &arc)
|
|
|
|
{
|
2008-02-22 21:37:28 +00:00
|
|
|
Super::Serialize(arc);
|
2006-02-24 04:48:15 +00:00
|
|
|
arc << Corpse << Count;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// throw another corpse on the queue
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_QueueCorpse)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2006-11-27 00:01:30 +00:00
|
|
|
if (sv_corpsequeuesize > 0)
|
2008-08-10 20:48:55 +00:00
|
|
|
new DCorpsePointer (self);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
// Remove an self from the queue (for resurrection)
|
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_DeQueueCorpse)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
TThinkerIterator<DCorpsePointer> iterator (STAT_CORPSEPOINTER);
|
|
|
|
DCorpsePointer *corpsePtr;
|
|
|
|
|
|
|
|
while ((corpsePtr = iterator.Next()) != NULL)
|
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
if (corpsePtr->Corpse == self)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
|
|
|
corpsePtr->Corpse = NULL;
|
|
|
|
corpsePtr->Destroy ();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_SetInvulnerable
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SetInvulnerable)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags2 |= MF2_INVULNERABLE;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_UnSetInvulnerable
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_UnSetInvulnerable)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags2 &= ~MF2_INVULNERABLE;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_SetReflective
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SetReflective)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags2 |= MF2_REFLECTIVE;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_UnSetReflective
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_UnSetReflective)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags2 &= ~MF2_REFLECTIVE;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_SetReflectiveInvulnerable
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SetReflectiveInvulnerable)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags2 |= MF2_REFLECTIVE|MF2_INVULNERABLE;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// A_UnSetReflectiveInvulnerable
|
|
|
|
//
|
|
|
|
//============================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_UnSetReflectiveInvulnerable)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags2 &= ~(MF2_REFLECTIVE|MF2_INVULNERABLE);
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A_SetShootable
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_SetShootable)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags2 &= ~MF2_NONSHOOTABLE;
|
|
|
|
self->flags |= MF_SHOOTABLE;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//==========================================================================
|
|
|
|
//
|
|
|
|
// A_UnSetShootable
|
|
|
|
//
|
|
|
|
//==========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_UnSetShootable)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags2 |= MF2_NONSHOOTABLE;
|
|
|
|
self->flags &= ~MF_SHOOTABLE;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_NoGravity
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_NoGravity)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags |= MF_NOGRAVITY;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_Gravity
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_Gravity)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags &= ~MF_NOGRAVITY;
|
|
|
|
self->gravity = FRACUNIT;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// A_LowGravity
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
2008-08-10 20:48:55 +00:00
|
|
|
DEFINE_ACTION_FUNCTION(AActor, A_LowGravity)
|
2006-02-24 04:48:15 +00:00
|
|
|
{
|
2008-08-10 20:48:55 +00:00
|
|
|
self->flags &= ~MF_NOGRAVITY;
|
|
|
|
self->gravity = FRACUNIT/8;
|
2006-02-24 04:48:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// FaceMovementDirection
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
void FaceMovementDirection (AActor *actor)
|
|
|
|
{
|
|
|
|
switch (actor->movedir)
|
|
|
|
{
|
|
|
|
case DI_EAST:
|
|
|
|
actor->angle = 0<<24;
|
|
|
|
break;
|
|
|
|
case DI_NORTHEAST:
|
|
|
|
actor->angle = 32<<24;
|
|
|
|
break;
|
|
|
|
case DI_NORTH:
|
|
|
|
actor->angle = 64<<24;
|
|
|
|
break;
|
|
|
|
case DI_NORTHWEST:
|
|
|
|
actor->angle = 96<<24;
|
|
|
|
break;
|
|
|
|
case DI_WEST:
|
|
|
|
actor->angle = 128<<24;
|
|
|
|
break;
|
|
|
|
case DI_SOUTHWEST:
|
|
|
|
actor->angle = 160<<24;
|
|
|
|
break;
|
|
|
|
case DI_SOUTH:
|
|
|
|
actor->angle = 192<<24;
|
|
|
|
break;
|
|
|
|
case DI_SOUTHEAST:
|
|
|
|
actor->angle = 224<<24;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|