- Added customizable border textures. They will be defined with the

MAPINFO keyword 'bordertexture' and are settable per map.
- Fixed: When used in DECORATE A_Explode must use A_ExplodeParms.
- Added custom label support to A_Chase. To enable resurrection from the
  customizable version I also moved all A_VileChase stuff into p_enemy.cpp.


SVN r437 (trunk)
This commit is contained in:
Christoph Oelckers 2007-01-05 22:08:57 +00:00
parent 34719e8d58
commit ec2e63c6d3
15 changed files with 298 additions and 217 deletions

View file

@ -1,3 +1,10 @@
January 5, 2007 (Changes by Graf Zahl)
- Added customizable border textures. They will be defined with the
MAPINFO keyword 'bordertexture' and are settable per map.
- Fixed: When used in DECORATE A_Explode must use A_ExplodeParms.
- Added custom label support to A_Chase. To enable resurrection from the
customizable version I also moved all A_VileChase stuff into p_enemy.cpp.
January 4, 2007
- Added simulation of Hexen's startup screen (currently minus net notches).

View file

@ -33,7 +33,10 @@ WEAPON(BFGsound)
WEAPON(FireBFG)
ACTOR(BFGSpray)
#ifndef FROM_THINGDEF
// A_Explode needs to use A_ExplodeParams in DECORATE
ACTOR(Explode)
#endif
ACTOR(Pain)
ACTOR(PlayerScream)
ACTOR(NoBlocking)

View file

@ -13,165 +13,6 @@
//
void A_Fire (AActor *self);
static AActor *corpsehit;
static AActor *vileobj;
static fixed_t viletryx;
static fixed_t viletryy;
static FState *raisestate;
bool PIT_VileCheck (AActor *thing)
{
int maxdist;
bool check;
if (!(thing->flags & MF_CORPSE) )
return true; // not a monster
if (thing->tics != -1)
return true; // not lying still yet
raisestate = thing->FindState(NAME_Raise);
if (raisestate == NULL)
return true; // monster doesn't have a raise state
// This may be a potential problem if this is used by something other
// than an Arch Vile.
//maxdist = thing->GetDefault()->radius + GetDefault<AArchvile>()->radius;
// use the current actor's radius instead of the Arch Vile's default.
maxdist = thing->GetDefault()->radius + vileobj->radius;
if ( abs(thing->x - viletryx) > maxdist
|| abs(thing->y - viletryy) > maxdist )
return true; // not actually touching
corpsehit = thing;
corpsehit->momx = corpsehit->momy = 0;
// [RH] Check against real height and radius
fixed_t oldheight = corpsehit->height;
fixed_t oldradius = corpsehit->radius;
int oldflags = corpsehit->flags;
corpsehit->flags |= MF_SOLID;
corpsehit->height = corpsehit->GetDefault()->height;
check = P_CheckPosition (corpsehit, corpsehit->x, corpsehit->y);
corpsehit->flags = oldflags;
corpsehit->radius = oldradius;
corpsehit->height = oldheight;
return !check;
}
//
// A_VileChase
// Check for ressurecting a body
//
void A_VileChase (AActor *self)
{
static TArray<AActor *> vilebt;
int xl, xh, yl, yh;
int bx, by;
const AActor *info;
AActor *temp;
if (self->movedir != DI_NODIR)
{
const fixed_t absSpeed = abs (self->Speed);
// check for corpses to raise
viletryx = self->x + FixedMul (absSpeed, xspeed[self->movedir]);
viletryy = self->y + FixedMul (absSpeed, yspeed[self->movedir]);
xl = (viletryx - bmaporgx - MAXRADIUS*2)>>MAPBLOCKSHIFT;
xh = (viletryx - bmaporgx + MAXRADIUS*2)>>MAPBLOCKSHIFT;
yl = (viletryy - bmaporgy - MAXRADIUS*2)>>MAPBLOCKSHIFT;
yh = (viletryy - bmaporgy + MAXRADIUS*2)>>MAPBLOCKSHIFT;
vileobj = self;
validcount++;
vilebt.Clear();
for (bx = xl; bx <= xh; bx++)
{
for (by = yl; by <= yh; by++)
{
// Call PIT_VileCheck to check
// whether object is a corpse
// that can be raised.
if (!P_BlockThingsIterator (bx, by, PIT_VileCheck, vilebt))
{
// got one!
temp = self->target;
self->target = corpsehit;
A_FaceTarget (self);
if (self->flags & MF_FRIENDLY)
{
// If this is a friendly Arch-Vile (which is turning the resurrected monster into its friend)
// and the Arch-Vile is currently targetting the resurrected monster the target must be cleared.
if (self->lastenemy == temp) self->lastenemy = NULL;
if (temp == self->target) temp = NULL;
}
self->target = temp;
// Make the state the monster enters customizable.
FState * state = self->FindState(NAME_Heal);
if (state != NULL)
{
self->SetState (state);
}
else
{
// For Dehacked compatibility this has to use the Arch Vile's
// heal state as a default if the actor doesn't define one itself.
const PClass *archvile = PClass::FindClass("Archvile");
if (archvile != NULL)
{
self->SetState (archvile->ActorInfo->FindState(NAME_Heal));
}
}
S_Sound (corpsehit, CHAN_BODY, "vile/raise", 1, ATTN_IDLE);
info = corpsehit->GetDefault ();
corpsehit->SetState (raisestate);
corpsehit->height = info->height; // [RH] Use real mobj height
corpsehit->radius = info->radius; // [RH] Use real radius
/*
// Make raised corpses look ghostly
if (corpsehit->alpha > TRANSLUC50)
corpsehit->alpha /= 2;
*/
corpsehit->flags = info->flags;
corpsehit->flags2 = info->flags2;
corpsehit->flags3 = info->flags3;
corpsehit->flags4 = info->flags4;
corpsehit->health = info->health;
corpsehit->target = NULL;
corpsehit->lastenemy = NULL;
// [RH] If it's a monster, it gets to count as another kill
if (corpsehit->CountsAsKill())
{
level.total_monsters++;
}
// You are the Archvile's minion now, so hate what it hates
corpsehit->CopyFriendliness (self, false);
return;
}
}
}
}
// Return to normal attack.
A_Chase (self);
}
//

View file

@ -278,6 +278,7 @@ static const char *MapInfoMapLevel[] =
"compat_trace",
"compat_dropoff",
"compat_boomscroll",
"bordertexture",
NULL
};
@ -408,6 +409,7 @@ MapHandlers[] =
{ MITYPE_COMPATFLAG, COMPATF_TRACE},
{ MITYPE_COMPATFLAG, COMPATF_DROPOFF},
{ MITYPE_COMPATFLAG, COMPATF_BOOMSCROLL},
{ MITYPE_LUMPNAME, lioffset(bordertexture), 0 },
};
static const char *MapInfoClusterLevel[] =
@ -475,6 +477,7 @@ static void SetLevelDefaults (level_info_t *levelinfo)
strncpy (levelinfo->fadetable, "COLORMAP", 8);
strcpy (levelinfo->skypic1, "-NOFLAT-");
strcpy (levelinfo->skypic2, "-NOFLAT-");
strcpy (levelinfo->bordertexture, gameinfo.borderFlat);
if (gameinfo.gametype != GAME_Hexen)
{
// For maps without a BEHAVIOR, this will be cleared.

View file

@ -163,6 +163,7 @@ struct level_info_s
char soundinfo[9];
char sndseq[9];
char bordertexture[9];
FSpecialAction * specialactions;
};
typedef struct level_info_s level_info_t;

View file

@ -43,6 +43,7 @@
#include "a_sharedglobal.h"
#include "a_doomglobal.h"
#include "a_action.h"
#include "thingdef.h"
#include "gi.h"
@ -1753,14 +1754,12 @@ nosee:
}
}
/*
==============
=
= A_Chase
=
= Actor has a melee attack, so it tries to close as fast as possible
=
*/
//=============================================================================
//
// A_Chase
//
// Actor has a melee attack, so it tries to close as fast as possible
//
// [GrafZahl] integrated A_FastChase, A_SerpentChase and A_SerpentWalk into this
// to allow the monsters using those functions to take advantage of the
// enhancements.
@ -2097,9 +2096,206 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
actor->flags &= ~MF_INCHASE;
}
//==========================================================================
//
// PIT_VileCheck
//
//==========================================================================
static AActor *corpsehit;
static AActor *vileobj;
static fixed_t viletryx;
static fixed_t viletryy;
static FState *raisestate;
static bool PIT_VileCheck (AActor *thing)
{
int maxdist;
bool check;
if (!(thing->flags & MF_CORPSE) )
return true; // not a monster
if (thing->tics != -1)
return true; // not lying still yet
raisestate = thing->FindState(NAME_Raise);
if (raisestate == NULL)
return true; // monster doesn't have a raise state
// This may be a potential problem if this is used by something other
// than an Arch Vile.
//maxdist = thing->GetDefault()->radius + GetDefault<AArchvile>()->radius;
// use the current actor's radius instead of the Arch Vile's default.
maxdist = thing->GetDefault()->radius + vileobj->radius;
if ( abs(thing->x - viletryx) > maxdist
|| abs(thing->y - viletryy) > maxdist )
return true; // not actually touching
corpsehit = thing;
corpsehit->momx = corpsehit->momy = 0;
// [RH] Check against real height and radius
fixed_t oldheight = corpsehit->height;
fixed_t oldradius = corpsehit->radius;
int oldflags = corpsehit->flags;
corpsehit->flags |= MF_SOLID;
corpsehit->height = corpsehit->GetDefault()->height;
check = P_CheckPosition (corpsehit, corpsehit->x, corpsehit->y);
corpsehit->flags = oldflags;
corpsehit->radius = oldradius;
corpsehit->height = oldheight;
return !check;
}
//==========================================================================
//
// P_CheckForResurrection (formerly part of A_VileChase)
// Check for ressurecting a body
//
//==========================================================================
static bool P_CheckForResurrection(AActor *self, bool usevilestates)
{
static TArray<AActor *> vilebt;
int xl, xh, yl, yh;
int bx, by;
const AActor *info;
AActor *temp;
if (self->movedir != DI_NODIR)
{
const fixed_t absSpeed = abs (self->Speed);
// check for corpses to raise
viletryx = self->x + FixedMul (absSpeed, xspeed[self->movedir]);
viletryy = self->y + FixedMul (absSpeed, yspeed[self->movedir]);
xl = (viletryx - bmaporgx - MAXRADIUS*2)>>MAPBLOCKSHIFT;
xh = (viletryx - bmaporgx + MAXRADIUS*2)>>MAPBLOCKSHIFT;
yl = (viletryy - bmaporgy - MAXRADIUS*2)>>MAPBLOCKSHIFT;
yh = (viletryy - bmaporgy + MAXRADIUS*2)>>MAPBLOCKSHIFT;
vileobj = self;
validcount++;
vilebt.Clear();
for (bx = xl; bx <= xh; bx++)
{
for (by = yl; by <= yh; by++)
{
// Call PIT_VileCheck to check
// whether object is a corpse
// that can be raised.
if (!P_BlockThingsIterator (bx, by, PIT_VileCheck, vilebt))
{
// got one!
temp = self->target;
self->target = corpsehit;
A_FaceTarget (self);
if (self->flags & MF_FRIENDLY)
{
// If this is a friendly Arch-Vile (which is turning the resurrected monster into its friend)
// and the Arch-Vile is currently targetting the resurrected monster the target must be cleared.
if (self->lastenemy == temp) self->lastenemy = NULL;
if (temp == self->target) temp = NULL;
}
self->target = temp;
// Make the state the monster enters customizable.
FState * state = self->FindState(NAME_Heal);
if (state != NULL)
{
self->SetState (state);
}
else if (usevilestates)
{
// For Dehacked compatibility this has to use the Arch Vile's
// heal state as a default if the actor doesn't define one itself.
const PClass *archvile = PClass::FindClass("Archvile");
if (archvile != NULL)
{
self->SetState (archvile->ActorInfo->FindState(NAME_Heal));
}
}
S_Sound (corpsehit, CHAN_BODY, "vile/raise", 1, ATTN_IDLE);
info = corpsehit->GetDefault ();
corpsehit->SetState (raisestate);
corpsehit->height = info->height; // [RH] Use real mobj height
corpsehit->radius = info->radius; // [RH] Use real radius
/*
// Make raised corpses look ghostly
if (corpsehit->alpha > TRANSLUC50)
corpsehit->alpha /= 2;
*/
corpsehit->flags = info->flags;
corpsehit->flags2 = info->flags2;
corpsehit->flags3 = info->flags3;
corpsehit->flags4 = info->flags4;
corpsehit->health = info->health;
corpsehit->target = NULL;
corpsehit->lastenemy = NULL;
// [RH] If it's a monster, it gets to count as another kill
if (corpsehit->CountsAsKill())
{
level.total_monsters++;
}
// You are the Archvile's minion now, so hate what it hates
corpsehit->CopyFriendliness (self, false);
return true;
}
}
}
}
return false;
}
//==========================================================================
//
// A_Chase and variations
//
//==========================================================================
enum ChaseFlags
{
CHF_FASTCHASE = 1,
CHF_NOPLAYACTIVE = 2,
CHF_NIGHTMAREFAST = 4,
CHF_RESURRECT = 8
};
void A_Chase (AActor *actor)
{
A_DoChase (actor, false, actor->MeleeState, actor->MissileState, true, !!(gameinfo.gametype & GAME_Raven));
int index=CheckIndex(3, &CallingState);
if (index>=0)
{
int flags = EvalExpressionI (StateParameters[index+2], actor);
if (flags & CHF_RESURRECT && P_CheckForResurrection(actor, false)) return;
FState *melee = StateParameters[index]==0? NULL : P_GetState(actor, CallingState, StateParameters[index]);
FState *missile = StateParameters[index+1]==0? NULL : P_GetState(actor, CallingState, StateParameters[index+1]);
A_DoChase(actor, !!(flags&CHF_FASTCHASE), melee, missile, !(flags&CHF_NOPLAYACTIVE),
!!(flags&CHF_NIGHTMAREFAST));
}
else // this is the old default A_Chase
{
A_DoChase (actor, false, actor->MeleeState, actor->MissileState, true, !!(gameinfo.gametype & GAME_Raven));
}
}
void A_FastChase (AActor *actor)
@ -2107,6 +2303,25 @@ void A_FastChase (AActor *actor)
A_DoChase (actor, true, actor->MeleeState, actor->MissileState, true, true);
}
void A_VileChase (AActor *actor)
{
if (!P_CheckForResurrection(actor, true))
A_DoChase (actor, false, actor->MeleeState, actor->MissileState, true, !!(gameinfo.gametype & GAME_Raven));
}
void A_ExtChase(AActor * self)
{
// Now that A_Chase can handle state label parameters, this function has become rather useless...
int index=CheckIndex(4, &CallingState);
if (index<0) return;
A_DoChase(self, false,
EvalExpressionI (StateParameters[index], self) ? self->MeleeState:NULL,
EvalExpressionI (StateParameters[index+1], self) ? self->MissileState:NULL,
EvalExpressionN (StateParameters[index+2], self),
!!EvalExpressionI (StateParameters[index+3], self));
}
//=============================================================================
//
// A_FaceTarget

View file

@ -36,6 +36,7 @@
#include "st_stuff.h"
#include "a_hexenglobal.h"
#include "g_game.h"
#include "g_level.h"
#include "gi.h"
#include "stats.h"
@ -1773,7 +1774,15 @@ void R_DrawBorder (int x1, int y1, int x2, int y2)
{
int picnum;
picnum = TexMan.CheckForTexture (gameinfo.borderFlat, FTexture::TEX_Flat);
if (level.info != NULL)
{
picnum = TexMan.CheckForTexture (level.info->bordertexture, FTexture::TEX_Flat);
}
else
{
picnum = TexMan.CheckForTexture (gameinfo.borderFlat, FTexture::TEX_Flat);
}
if (picnum >= 0)
{
screen->FlatFill (x1, y1, x2, y2, TexMan(picnum));

View file

@ -418,12 +418,14 @@ struct AFuncDesc
};
#define FROM_THINGDEF
// Prototype the code pointers
#define WEAPON(x) void A_##x(AActor*);
#define ACTOR(x) void A_##x(AActor*);
#include "codepointers.h"
#include "d_dehackedactions.h"
void A_ComboAttack(AActor*);
void A_ExplodeParms(AActor*);
AFuncDesc AFTable[] =
{
@ -432,7 +434,8 @@ AFuncDesc AFTable[] =
#include "codepointers.h"
#include "d_dehackedactions.h"
{ "A_Fall", A_NoBlocking },
{ "A_BasicAttack", A_ComboAttack }
{ "A_BasicAttack", A_ComboAttack },
{ "A_Explode", A_ExplodeParms }
};

View file

@ -37,6 +37,7 @@ void AddState (const char * statename, FState * state);
FState * FindState(AActor * actor, const PClass * type, const char * name);
void InstallStates(FActorInfo *info, AActor *defaults);
void MakeStateDefines(const FStateLabels *list);
FState *P_GetState(AActor *self, FState *CallingState, int offset);
struct FDropItem
{

View file

@ -374,18 +374,18 @@ void A_BulletAttack (AActor *self)
}
}
//==========================================================================
//
// Do the state jump
//
//==========================================================================
static void DoJump(AActor * self, FState * CallingState, int offset)
{
FState *jumpto;
//==========================================================================
//
// Resolves a label parameter
//
//==========================================================================
FState *P_GetState(AActor *self, FState *CallingState, int offset)
{
if (offset>=0)
{
jumpto = CallingState + offset;
return CallingState + offset;
}
else
{
@ -394,10 +394,10 @@ static void DoJump(AActor * self, FState * CallingState, int offset)
FName classname = JumpParameters[offset];
const PClass *cls;
cls = classname==NAME_None? RUNTIME_TYPE(self) : PClass::FindClass(classname);
if (cls==NULL || cls->ActorInfo==NULL) return; // shouldn't happen
if (cls==NULL || cls->ActorInfo==NULL) return NULL; // shouldn't happen
int numnames = (int)JumpParameters[offset+1];
jumpto = cls->ActorInfo->FindState(numnames, &JumpParameters[offset+2]);
FState *jumpto = cls->ActorInfo->FindState(numnames, &JumpParameters[offset+2]);
if (jumpto == NULL)
{
const char *dot="";
@ -406,11 +406,24 @@ static void DoJump(AActor * self, FState * CallingState, int offset)
for (int i=0;i<numnames;i++)
{
Printf("%s%s", dot, JumpParameters[offset+2+i].GetChars());
dot = ".";
}
Printf("not found in %s\n", self->GetClass()->TypeName.GetChars());
return;
}
return jumpto;
}
}
//==========================================================================
//
// Do the state jump
//
//==========================================================================
static void DoJump(AActor * self, FState * CallingState, int offset)
{
FState *jumpto = P_GetState(self, CallingState, offset);
if (jumpto == NULL) return;
if (pStateCall != NULL && CallingState == pStateCall->State)
{
@ -1767,27 +1780,6 @@ void A_CheckSight(AActor * self)
}
//===========================================================================
//
// A_ExtChase
// A_Chase with optional parameters
//
//===========================================================================
void A_DoChase(AActor * actor, bool fastchase, FState * meleestate, FState * missilestate, bool playactive, bool nightmarefast);
void A_ExtChase(AActor * self)
{
int index=CheckIndex(4, &CallingState);
if (index<0) return;
A_DoChase(self, false,
EvalExpressionI (StateParameters[index], self) ? self->MeleeState:NULL,
EvalExpressionI (StateParameters[index+1], self) ? self->MissileState:NULL,
EvalExpressionN (StateParameters[index+2], self),
!!EvalExpressionI (StateParameters[index+3], self));
}
//===========================================================================
//
// Inventory drop

View file

@ -89,7 +89,7 @@
#endif
// MINSAVEVER is the minimum level snapshot version that can be loaded.
#define MINSAVEVER 235 // Used by 2.1.5
#define MINSAVEVER 236 // Used by 2.1.7
// The maximum length of one save game description for the menus.
#define SAVESTRINGSIZE 24

View file

@ -369,7 +369,7 @@ void WI_LoadBackground(bool isenterpic)
case GAME_Strife:
default:
// Strife doesn't have an intermission pic so choose something neutral!
// Strife doesn't have an intermission pic so choose something neutral.
if (isenterpic) return;
lumpname = gameinfo.borderFlat;
break;

View file

@ -53,17 +53,17 @@
// MACROS ------------------------------------------------------------------
#define ST_MAX_NOTCHES 32
#define ST_NOTCH_WIDTH 16
#define ST_NOTCH_HEIGHT 23
#define ST_PROGRESS_X 64 // Start of notches x screen pos.
#define ST_PROGRESS_Y 441 // Start of notches y screen pos.
#define ST_NETPROGRESS_X 288
#define ST_NETPROGRESS_Y 32
#define ST_NETNOTCH_WIDTH 4
#define ST_NETNOTCH_HEIGHT 16
#define ST_MAX_NETNOTCHES 8
#define ST_MAX_NOTCHES 32
#define ST_NOTCH_WIDTH 16
#define ST_NOTCH_HEIGHT 23
#define ST_PROGRESS_X 64 // Start of notches x screen pos.
#define ST_PROGRESS_Y 441 // Start of notches y screen pos.
#define ST_NETPROGRESS_X 288
#define ST_NETPROGRESS_Y 32
#define ST_NETNOTCH_WIDTH 4
#define ST_NETNOTCH_HEIGHT 16
#define ST_MAX_NETNOTCHES 8
// TYPES -------------------------------------------------------------------

View file

@ -13,3 +13,9 @@ const int SXF_ABSOLUTEMOMENTUM=8;
const int SXF_SETMASTER=16;
const int SXF_NOCHECKPOSITION = 32;
// Flags for A_Chase
const int CHF_FASTCHASE = 1;
const int CHF_NOPLAYACTIVE = 2;
const int CHF_NIGHTMAREFAST = 4;
const int CHF_RESURRECT = 8;

View file

@ -7,7 +7,7 @@ class Actor extends Thinker
action native A_NoBlocking();
action native A_XScream();
action native A_Look();
action native A_Chase();
action native A_Chase(optional state melee, optional state missile, optional eval int flags);
action native A_FaceTarget();
action native A_PosAttack();
action native A_Scream();