Update to ZDoom r1161:

- Ported asm_x86_64/tmap3.nas to AT&T syntax so it can be compiled with gas.
  After finding out that gas does have directives to describe the .eh_frame
  metadata, I figured that would be significantly easier and quicker than
  trying to locate all the scattered docs needed to construct it by hand.
  Unfortunately, this now means I have to maintain two versions of exactly
  the same code. :(
- Removed 'eval' modifier from DECORATE. All int, float and bool parameters are
  'eval' now by default.
- Did a thorough check of all DECORATE conversions and fixed the errors I found.
- Macro-fied all access to action functions.
- Changed action function definition so that they have to be defined with a
  DEFINE_ACTION_FUNCTION macro. This should make it easier to improve the
  whole system.


git-svn-id: http://mancubus.net/svn/hosted/gzdoom/trunk@152 b0f79afe-0144-0410-b225-9a4edf0717df
This commit is contained in:
Christoph Oelckers 2008-08-12 08:00:28 +00:00
parent cac80858f4
commit 6ef8145afc
135 changed files with 3280 additions and 2814 deletions

View file

@ -117,6 +117,12 @@ else( WIN32 )
if( NO_GTK )
add_definitions( -DNO_GTK=1 )
endif( NO_GTK )
find_path( FPU_CONTROL_DIR fpu_control.h )
if( FPU_CONTROL_DIR )
include_directories( ${FPU_CONTROL_DIR} )
add_definitions( -DHAVE_FPU_CONTROL )
endif( FPU_CONTROL_DIR )
endif( WIN32 )
if( X64 )
@ -179,6 +185,16 @@ endif( FMOD_LIBRARY )
# Search for NASM
if( NOT NO_ASM )
if( UNIX AND X64 )
find_program( GAS_PATH as )
if( GAS_PATH )
set( ASSEMBLER ${GAS_PATH} )
else( GAS_PATH )
message( STATUS "Could not find as. Disabling assembly code." )
set( NO_ASM ON )
endif( GAS_PATH )
else( UNIX AND X64 )
find_program( NASM_PATH NAMES ${NASM_NAMES} )
find_program( YASM_PATH yasm )
@ -197,6 +213,7 @@ if( NOT NO_ASM )
endif( NOT NASM_PATH )
endif( X64 )
endif( YASM_PATH )
endif( UNIX AND X64 )
# I think the only reason there was a version requirement was because the
# executable name for Windows changed from 0.x to 2.0, right? This is
@ -222,16 +239,19 @@ if( NOT NO_ASM )
if( UNIX )
set( ASM_OUTPUT_EXTENSION .o )
if( X64 )
set( ASM_FLAGS -f elf64 -DM_TARGET_LINUX )
set( ASM_FLAGS )
set( ASM_SOURCE_EXTENSION .s )
else( X64 )
set( ASM_FLAGS -f elf -DM_TARGET_LINUX )
set( ASM_FLAGS -f elf -DM_TARGET_LINUX -i${CMAKE_CURRENT_SOURCE_DIR}/ )
set( ASM_SOURCE_EXTENSION .asm )
endif( X64 )
else( UNIX )
set( ASM_OUTPUT_EXTENSION .obj )
set( ASM_SOURCE_EXTENSION .asm )
if( X64 )
set( ASM_FLAGS -f win64 -DWIN32 -DWIN64 )
else( X64 )
set( ASM_FLAGS -f win32 -DWIN32 )
set( ASM_FLAGS -f win32 -DWIN32 -i${CMAKE_CURRENT_SOURCE_DIR}/ )
endif( X64 )
endif( UNIX )
if( WIN32 )
@ -245,7 +265,7 @@ if( NOT NO_ASM )
endif( WIN32 )
add_custom_command( OUTPUT ${ASM_OUTPUT_${infile}}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/zdoom.dir/${indir}
COMMAND ${ASSEMBLER} ${ASM_FLAGS} -i${CMAKE_CURRENT_SOURCE_DIR}/ -o"${ASM_OUTPUT_${infile}}" "${CMAKE_CURRENT_SOURCE_DIR}/${indir}/${infile}.asm"
COMMAND ${ASSEMBLER} ${ASM_FLAGS} -o"${ASM_OUTPUT_${infile}}" "${CMAKE_CURRENT_SOURCE_DIR}/${indir}/${infile}${ASM_SOURCE_EXTENSION}"
${FIXRTEXT_${infile}}
DEPENDS ${indir}/${infile}.asm ${FIXRTEXT} )
set( ASM_SOURCES ${ASM_SOURCES} "${ASM_OUTPUT_${infile}}" )
@ -363,7 +383,9 @@ else( WIN32 )
sdl/st_start.cpp )
endif( WIN32 )
if( NOT NO_ASM )
if( NO_ASM )
add_definitions( -DNOASM )
else( NO_ASM )
if( X64 )
ADD_ASM_FILE( asm_x86_64 tmap3 )
else( X64 )
@ -378,7 +400,7 @@ if( NOT NO_ASM )
ADD_ASM_FILE( win32/wrappers.asm )
endif( NOT X64 )
endif( WIN32 )
endif( NOT NO_ASM )
endif( NO_ASM )
add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.c ${CMAKE_CURRENT_BINARY_DIR}/xlat_parser.h
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/xlat/xlat_parser.y .

View file

@ -485,9 +485,6 @@ public:
// Called when actor dies
virtual void Die (AActor *source, AActor *inflictor);
// Called by A_Explode to find out how much damage to do
virtual void GetExplodeParms (int &damage, int &dist, bool &hurtSource);
// Perform some special damage action. Returns the amount of damage to do.
// Returning -1 signals the damage routine to exit immediately
virtual int DoSpecialDamage (AActor *target, int damage);

View file

@ -1,111 +0,0 @@
// This file is included by d_dehacked.cpp twice.
// The first time is to prototype these functions, and the second
// time is to define them in the CodePtrs list. The macros are
// defined appropriately to get the desired effect each time.
ACTOR(MonsterRail)
WEAPON(FireRailgun)
WEAPON(FireRailgunLeft)
WEAPON(FireRailgunRight)
WEAPON(RailWait)
WEAPON(Light0)
WEAPON(WeaponReady)
WEAPON(Lower)
WEAPON(Raise)
WEAPON(Punch)
WEAPON(ReFire)
WEAPON(FirePistol)
WEAPON(Light1)
WEAPON(FireShotgun)
WEAPON(Light2)
WEAPON(FireShotgun2)
WEAPON(CheckReload)
WEAPON(OpenShotgun2)
WEAPON(LoadShotgun2)
WEAPON(CloseShotgun2)
WEAPON(FireCGun)
WEAPON(GunFlash)
WEAPON(FireMissile)
WEAPON(Saw)
WEAPON(FirePlasma)
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)
ACTOR(XScream)
ACTOR(Look)
ACTOR(Chase)
ACTOR(FaceTarget)
ACTOR(PosAttack)
ACTOR(Scream)
ACTOR(SPosAttack)
ACTOR(VileChase)
ACTOR(VileStart)
ACTOR(VileTarget)
ACTOR(VileAttack)
ACTOR(StartFire)
ACTOR(Fire)
ACTOR(FireCrackle)
ACTOR(Tracer)
ACTOR(SkelWhoosh)
ACTOR(SkelFist)
ACTOR(SkelMissile)
ACTOR(FatRaise)
ACTOR(FatAttack1)
ACTOR(FatAttack2)
ACTOR(FatAttack3)
ACTOR(BossDeath)
ACTOR(CPosAttack)
ACTOR(CPosRefire)
ACTOR(TroopAttack)
ACTOR(SargAttack)
ACTOR(HeadAttack)
ACTOR(BruisAttack)
ACTOR(SkullAttack)
ACTOR(Metal)
ACTOR(SpidRefire)
ACTOR(BabyMetal)
ACTOR(BspiAttack)
ACTOR(Hoof)
ACTOR(CyberAttack)
ACTOR(PainAttack)
ACTOR(PainDie)
ACTOR(KeenDie)
ACTOR(BrainPain)
ACTOR(BrainScream)
ACTOR(BrainDie)
ACTOR(BrainAwake)
ACTOR(BrainSpit)
ACTOR(SpawnSound)
ACTOR(SpawnFly)
ACTOR(BrainExplode)
ACTOR(Die)
ACTOR(Detonate)
ACTOR(Mushroom)
ACTOR(SetFloorClip)
ACTOR(UnSetFloorClip)
ACTOR(HideThing)
ACTOR(UnHideThing)
ACTOR(SetInvulnerable)
ACTOR(UnSetInvulnerable)
ACTOR(SetReflective)
ACTOR(UnSetReflective)
ACTOR(SetReflectiveInvulnerable)
ACTOR(UnSetReflectiveInvulnerable)
ACTOR(SetShootable)
ACTOR(UnSetShootable)
ACTOR(NoGravity)
ACTOR(Gravity)
ACTOR(LowGravity)
#undef WEAPON
#undef ACTOR

View file

@ -4,8 +4,9 @@
#include "p_enemy.h"
#include "a_doomglobal.h"
#include "a_action.h"
#include "thingdef/thingdef.h"
void A_BspiAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BspiAttack)
{
if (!self->target)
return;
@ -16,7 +17,7 @@ void A_BspiAttack (AActor *self)
P_SpawnMissile (self, self->target, PClass::FindClass("ArachnotronPlasma"));
}
void A_BabyMetal (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BabyMetal)
{
S_Sound (self, CHAN_BODY, "baby/walk", 1, ATTN_IDLE);
A_Chase (self);

View file

@ -6,19 +6,20 @@
#include "a_doomglobal.h"
#include "gstrings.h"
#include "a_action.h"
#include "thingdef/thingdef.h"
//
// PIT_VileCheck
// Detect a corpse that could be raised.
//
void A_Fire (AActor *self);
DECLARE_ACTION(A_Fire)
//
// A_VileStart
//
void A_VileStart (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_VileStart)
{
S_Sound (self, CHAN_VOICE, "vile/start", 1, ATTN_NORM);
}
@ -28,19 +29,19 @@ void A_VileStart (AActor *self)
// A_Fire
// Keep fire in front of player unless out of sight
//
void A_StartFire (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_StartFire)
{
S_Sound (self, CHAN_BODY, "vile/firestrt", 1, ATTN_NORM);
A_Fire (self);
CALL_ACTION(A_Fire, self);
}
void A_FireCrackle (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FireCrackle)
{
S_Sound (self, CHAN_BODY, "vile/firecrkl", 1, ATTN_NORM);
A_Fire (self);
CALL_ACTION(A_Fire, self);
}
void A_Fire (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Fire)
{
AActor *dest;
angle_t an;
@ -66,22 +67,22 @@ void A_Fire (AActor *self)
// A_VileTarget
// Spawn the hellfire
//
void A_VileTarget (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_VileTarget)
{
AActor *fog;
if (!actor->target)
if (!self->target)
return;
A_FaceTarget (actor);
A_FaceTarget (self);
fog = Spawn ("ArchvileFire", actor->target->x, actor->target->y,
actor->target->z, ALLOW_REPLACE);
fog = Spawn ("ArchvileFire", self->target->x, self->target->y,
self->target->z, ALLOW_REPLACE);
actor->tracer = fog;
fog->target = actor;
fog->tracer = actor->target;
A_Fire (fog);
self->tracer = fog;
fog->target = self;
fog->tracer = self->target;
CALL_ACTION(A_Fire, fog);
}
@ -90,35 +91,35 @@ void A_VileTarget (AActor *actor)
//
// A_VileAttack
//
void A_VileAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_VileAttack)
{
AActor *fire;
int an;
if (!actor->target)
if (!self->target)
return;
A_FaceTarget (actor);
A_FaceTarget (self);
if (!P_CheckSight (actor, actor->target, 0) )
if (!P_CheckSight (self, self->target, 0) )
return;
S_Sound (actor, CHAN_WEAPON, "vile/stop", 1, ATTN_NORM);
P_DamageMobj (actor->target, actor, actor, 20, NAME_None);
P_TraceBleed (20, actor->target);
actor->target->momz = 1000 * FRACUNIT / actor->target->Mass;
S_Sound (self, CHAN_WEAPON, "vile/stop", 1, ATTN_NORM);
P_DamageMobj (self->target, self, self, 20, NAME_None);
P_TraceBleed (20, self->target);
self->target->momz = 1000 * FRACUNIT / self->target->Mass;
an = actor->angle >> ANGLETOFINESHIFT;
an = self->angle >> ANGLETOFINESHIFT;
fire = actor->tracer;
fire = self->tracer;
if (!fire)
return;
// move the fire between the vile and the player
fire->SetOrigin (actor->target->x - FixedMul (24*FRACUNIT, finecosine[an]),
actor->target->y - FixedMul (24*FRACUNIT, finesine[an]),
actor->target->z);
fire->SetOrigin (self->target->x - FixedMul (24*FRACUNIT, finecosine[an]),
self->target->y - FixedMul (24*FRACUNIT, finesine[an]),
self->target->z);
P_RadiusAttack (fire, actor, 70, 70, NAME_Fire, false);
P_RadiusAttack (fire, self, 70, 70, NAME_Fire, false);
}

View file

@ -13,13 +13,13 @@ static FRandom pr_brainscream ("BrainScream");
static FRandom pr_brainexplode ("BrainExplode");
static FRandom pr_spawnfly ("SpawnFly");
void A_BrainAwake (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BrainAwake)
{
// killough 3/26/98: only generates sound now
S_Sound (self, CHAN_VOICE, "brain/sight", 1, ATTN_NONE);
}
void A_BrainPain (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BrainPain)
{
S_Sound (self, CHAN_VOICE, "brain/pain", 1, ATTN_NONE);
}
@ -48,7 +48,7 @@ static void BrainishExplosion (fixed_t x, fixed_t y, fixed_t z)
}
}
void A_BrainScream (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BrainScream)
{
fixed_t x;
@ -60,14 +60,14 @@ void A_BrainScream (AActor *self)
S_Sound (self, CHAN_VOICE, "brain/death", 1, ATTN_NONE);
}
void A_BrainExplode (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BrainExplode)
{
fixed_t x = self->x + pr_brainexplode.Random2()*2048;
fixed_t z = 128 + pr_brainexplode()*2*FRACUNIT;
BrainishExplosion (x, self->y, z);
}
void A_BrainDie (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BrainDie)
{
// [RH] If noexit, then don't end the level.
if ((deathmatch || alwaysapplydmflags) && (dmflags & DF_NO_EXIT))
@ -76,7 +76,7 @@ void A_BrainDie (AActor *self)
G_ExitLevel (0, false);
}
void A_BrainSpit (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BrainSpit)
{
DSpotState *state = DSpotState::GetSpotState();
AActor *targ;
@ -129,7 +129,7 @@ void A_BrainSpit (AActor *self)
}
}
void A_SpawnFly (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnFly)
{
AActor *newmobj;
AActor *fog;
@ -246,8 +246,8 @@ void A_SpawnFly (AActor *self)
}
// travelling cube sound
void A_SpawnSound (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnSound)
{
S_Sound (self, CHAN_BODY, "brain/cube", 1, ATTN_IDLE);
A_SpawnFly (self);
CALL_ACTION(A_SpawnFly, self);
}

View file

@ -7,11 +7,12 @@
#include "doomstat.h"
#include "gstrings.h"
#include "a_action.h"
#include "thingdef/thingdef.h"
static FRandom pr_bruisattack ("BruisAttack");
void A_BruisAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BruisAttack)
{
if (!self->target)
return;

View file

@ -6,10 +6,11 @@
#include "gstrings.h"
#include "a_action.h"
#include "s_sound.h"
#include "thingdef/thingdef.h"
static FRandom pr_headattack ("HeadAttack");
void A_HeadAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_HeadAttack)
{
if (!self->target)
return;

View file

@ -4,8 +4,9 @@
#include "p_enemy.h"
#include "a_doomglobal.h"
#include "a_action.h"
#include "thingdef/thingdef.h"
void A_CyberAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CyberAttack)
{
if (!self->target)
return;
@ -14,7 +15,7 @@ void A_CyberAttack (AActor *self)
P_SpawnMissile (self, self->target, PClass::FindClass("Rocket"));
}
void A_Hoof (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Hoof)
{
S_Sound (self, CHAN_BODY, "cyber/hoof", 1, ATTN_IDLE);
A_Chase (self);

View file

@ -5,10 +5,11 @@
#include "p_enemy.h"
#include "gstrings.h"
#include "a_action.h"
#include "thingdef/thingdef.h"
static FRandom pr_sargattack ("SargAttack");
void A_SargAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SargAttack)
{
if (!self->target)
return;

View file

@ -6,15 +6,14 @@
#include "p_enemy.h"
#include "gstrings.h"
#include "a_action.h"
#include "thingdef/thingdef.h"
static FRandom pr_troopattack ("TroopAttack");
void A_TroopAttack (AActor *);
//
// A_TroopAttack
//
void A_TroopAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_TroopAttack)
{
if (!self->target)
return;

View file

@ -8,21 +8,22 @@
#include "gi.h"
#include "doomstat.h"
#include "gstrings.h"
#include "thingdef/thingdef.h"
// The barrel of green goop ------------------------------------------------
void A_BarrelDestroy (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BarrelDestroy)
{
if ((dmflags2 & DF2_BARRELS_RESPAWN) &&
(deathmatch || alwaysapplydmflags))
{
actor->height = actor->GetDefault()->height;
actor->renderflags |= RF_INVISIBLE;
actor->flags &= ~MF_SOLID;
self->height = self->GetDefault()->height;
self->renderflags |= RF_INVISIBLE;
self->flags &= ~MF_SOLID;
}
else
{
actor->Destroy ();
self->Destroy ();
}
}

View file

@ -23,16 +23,16 @@ static FRandom pr_bfgspray ("BFGSpray");
//
// A_Punch
//
void A_Punch (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Punch)
{
angle_t angle;
int damage;
int pitch;
AActor *linetarget;
if (actor->player != NULL)
if (self->player != NULL)
{
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
@ -42,21 +42,21 @@ void A_Punch (AActor *actor)
damage = (pr_punch()%10+1)<<1;
if (actor->FindInventory<APowerStrength>())
if (self->FindInventory<APowerStrength>())
damage *= 10;
angle = actor->angle;
angle = self->angle;
angle += pr_punch.Random2() << 18;
pitch = P_AimLineAttack (actor, angle, MELEERANGE, &linetarget);
P_LineAttack (actor, angle, MELEERANGE, pitch, damage, NAME_Melee, NAME_BulletPuff, true);
pitch = P_AimLineAttack (self, angle, MELEERANGE, &linetarget);
P_LineAttack (self, angle, MELEERANGE, pitch, damage, NAME_Melee, NAME_BulletPuff, true);
// turn to face target
if (linetarget)
{
S_Sound (actor, CHAN_WEAPON, "*fist", 1, ATTN_NORM);
actor->angle = R_PointToAngle2 (actor->x,
actor->y,
S_Sound (self, CHAN_WEAPON, "*fist", 1, ATTN_NORM);
self->angle = R_PointToAngle2 (self->x,
self->y,
linetarget->x,
linetarget->y);
}
@ -65,38 +65,38 @@ void A_Punch (AActor *actor)
//
// A_FirePistol
//
void A_FirePistol (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FirePistol)
{
bool accurate;
if (actor->player != NULL)
if (self->player != NULL)
{
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
P_SetPsprite (actor->player, ps_flash, weapon->FindState(NAME_Flash));
P_SetPsprite (self->player, ps_flash, weapon->FindState(NAME_Flash));
}
actor->player->mo->PlayAttacking2 ();
self->player->mo->PlayAttacking2 ();
accurate = !actor->player->refire;
accurate = !self->player->refire;
}
else
{
accurate = true;
}
S_Sound (actor, CHAN_WEAPON, "weapons/pistol", 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, "weapons/pistol", 1, ATTN_NORM);
P_GunShot (actor, accurate, PClass::FindClass(NAME_BulletPuff), P_BulletSlope (actor));
P_GunShot (self, accurate, PClass::FindClass(NAME_BulletPuff), P_BulletSlope (self));
}
//
// A_Saw
//
void A_Saw (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Saw)
{
angle_t angle;
int damage=0;
@ -107,12 +107,12 @@ void A_Saw (AActor *actor)
FSoundID hitsound;
const PClass * pufftype = NULL;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
@ -124,7 +124,7 @@ void A_Saw (AActor *actor)
{
fullsound = FSoundID(StateParameters[index]);
hitsound = FSoundID(StateParameters[index+1]);
damage = EvalExpressionI (StateParameters[index+2], actor);
damage = EvalExpressionI (StateParameters[index+2], self);
pufftype = PClass::FindClass ((ENamedName)StateParameters[index+3]);
}
else
@ -136,56 +136,56 @@ void A_Saw (AActor *actor)
if (damage == 0) damage = 2;
damage *= (pr_saw()%10+1);
angle = actor->angle;
angle = self->angle;
angle += pr_saw.Random2() << 18;
// use meleerange + 1 so the puff doesn't skip the flash (i.e. plays all states)
P_LineAttack (actor, angle, MELEERANGE+1,
P_AimLineAttack (actor, angle, MELEERANGE+1, &linetarget), damage,
P_LineAttack (self, angle, MELEERANGE+1,
P_AimLineAttack (self, angle, MELEERANGE+1, &linetarget), damage,
GetDefaultByType(pufftype)->DamageType, pufftype);
if (!linetarget)
{
S_Sound (actor, CHAN_WEAPON, fullsound, 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, fullsound, 1, ATTN_NORM);
return;
}
S_Sound (actor, CHAN_WEAPON, hitsound, 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, hitsound, 1, ATTN_NORM);
// turn to face target
angle = R_PointToAngle2 (actor->x, actor->y,
angle = R_PointToAngle2 (self->x, self->y,
linetarget->x, linetarget->y);
if (angle - actor->angle > ANG180)
if (angle - self->angle > ANG180)
{
if (angle - actor->angle < (angle_t)(-ANG90/20))
actor->angle = angle + ANG90/21;
if (angle - self->angle < (angle_t)(-ANG90/20))
self->angle = angle + ANG90/21;
else
actor->angle -= ANG90/20;
self->angle -= ANG90/20;
}
else
{
if (angle - actor->angle > ANG90/20)
actor->angle = angle - ANG90/21;
if (angle - self->angle > ANG90/20)
self->angle = angle - ANG90/21;
else
actor->angle += ANG90/20;
self->angle += ANG90/20;
}
actor->flags |= MF_JUSTATTACKED;
self->flags |= MF_JUSTATTACKED;
}
//
// A_FireShotgun
//
void A_FireShotgun (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun)
{
int i;
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
S_Sound (actor, CHAN_WEAPON, "weapons/shotgf", 1, ATTN_NORM);
AWeapon *weapon = actor->player->ReadyWeapon;
S_Sound (self, CHAN_WEAPON, "weapons/shotgf", 1, ATTN_NORM);
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
@ -194,29 +194,29 @@ void A_FireShotgun (AActor *actor)
}
player->mo->PlayAttacking2 ();
angle_t pitch = P_BulletSlope (actor);
angle_t pitch = P_BulletSlope (self);
for (i=0 ; i<7 ; i++)
P_GunShot (actor, false, PClass::FindClass(NAME_BulletPuff), pitch);
P_GunShot (self, false, PClass::FindClass(NAME_BulletPuff), pitch);
}
//
// A_FireShotgun2
//
void A_FireShotgun2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireShotgun2)
{
int i;
angle_t angle;
int damage;
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
S_Sound (actor, CHAN_WEAPON, "weapons/sshotf", 1, ATTN_NORM);
AWeapon *weapon = actor->player->ReadyWeapon;
S_Sound (self, CHAN_WEAPON, "weapons/sshotf", 1, ATTN_NORM);
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
@ -226,12 +226,12 @@ void A_FireShotgun2 (AActor *actor)
player->mo->PlayAttacking2 ();
angle_t pitch = P_BulletSlope (actor);
angle_t pitch = P_BulletSlope (self);
for (i=0 ; i<20 ; i++)
{
damage = 5*(pr_fireshotgun2()%3+1);
angle = actor->angle;
angle = self->angle;
angle += pr_fireshotgun2.Random2() << 19;
// Doom adjusts the bullet slope by shifting a random number [-255,255]
@ -240,7 +240,7 @@ void A_FireShotgun2 (AActor *actor)
// some simple trigonometry, that means the vertical angle of the shot
// can deviate by as many as ~7.097 degrees or ~84676099 BAMs.
P_LineAttack (actor,
P_LineAttack (self,
angle,
PLAYERMISSILERANGE,
pitch + (pr_fireshotgun2.Random2() * 332063), damage,
@ -248,20 +248,20 @@ void A_FireShotgun2 (AActor *actor)
}
}
void A_OpenShotgun2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_OpenShotgun2)
{
S_Sound (actor, CHAN_WEAPON, "weapons/sshoto", 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, "weapons/sshoto", 1, ATTN_NORM);
}
void A_LoadShotgun2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LoadShotgun2)
{
S_Sound (actor, CHAN_WEAPON, "weapons/sshotl", 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, "weapons/sshotl", 1, ATTN_NORM);
}
void A_CloseShotgun2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CloseShotgun2)
{
S_Sound (actor, CHAN_WEAPON, "weapons/sshotc", 1, ATTN_NORM);
A_ReFire (actor);
S_Sound (self, CHAN_WEAPON, "weapons/sshotc", 1, ATTN_NORM);
CALL_ACTION(A_ReFire, self);
}
@ -312,11 +312,11 @@ void P_SetSafeFlash(AWeapon * weapon, player_t * player, FState * flashstate, in
//
// A_FireCGun
//
void A_FireCGun (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireCGun)
{
player_t *player;
if (actor == NULL || NULL == (player = actor->player))
if (self == NULL || NULL == (player = self->player))
{
return;
}
@ -327,7 +327,7 @@ void A_FireCGun (AActor *actor)
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
S_Sound (actor, CHAN_WEAPON, "weapons/chngun", 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, "weapons/chngun", 1, ATTN_NORM);
FState *flash = weapon->FindState(NAME_Flash);
if (flash != NULL)
@ -348,41 +348,41 @@ void A_FireCGun (AActor *actor)
}
player->mo->PlayAttacking2 ();
P_GunShot (actor, !player->refire, PClass::FindClass(NAME_BulletPuff), P_BulletSlope (actor));
P_GunShot (self, !player->refire, PClass::FindClass(NAME_BulletPuff), P_BulletSlope (self));
}
//
// A_FireMissile
//
void A_FireMissile (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireMissile)
{
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
}
P_SpawnPlayerMissile (actor, PClass::FindClass("Rocket"));
P_SpawnPlayerMissile (self, PClass::FindClass("Rocket"));
}
//
// A_FirePlasma
//
void A_FirePlasma (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FirePlasma)
{
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
@ -395,25 +395,23 @@ void A_FirePlasma (AActor *actor)
}
}
P_SpawnPlayerMissile (actor, PClass::FindClass("PlasmaBall"));
P_SpawnPlayerMissile (self, PClass::FindClass("PlasmaBall"));
}
//
// [RH] A_FireRailgun
//
static int RailOffset;
void A_FireRailgun (AActor *actor)
static void FireRailgun(AActor *self, int RailOffset)
{
int damage;
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
@ -428,23 +426,26 @@ void A_FireRailgun (AActor *actor)
damage = deathmatch ? 100 : 150;
P_RailAttack (actor, damage, RailOffset);
RailOffset = 0;
P_RailAttack (self, damage, RailOffset);
}
void A_FireRailgunRight (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireRailgun)
{
RailOffset = 10;
A_FireRailgun (actor);
FireRailgun(self, 0);
}
void A_FireRailgunLeft (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireRailgunRight)
{
RailOffset = -10;
A_FireRailgun (actor);
FireRailgun(self, 10);
}
void A_RailWait (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireRailgunLeft)
{
FireRailgun(self, -10);
}
DEFINE_ACTION_FUNCTION(AActor, A_RailWait)
{
// Okay, this was stupid. Just use a NULL function instead of this.
}
@ -453,19 +454,19 @@ void A_RailWait (AActor *actor)
// A_FireBFG
//
void A_FireBFG (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireBFG)
{
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
// [RH] bfg can be forced to not use freeaim
angle_t storedpitch = actor->pitch;
angle_t storedpitch = self->pitch;
int storedaimdist = player->userinfo.aimdist;
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
@ -474,11 +475,11 @@ void A_FireBFG (AActor *actor)
if (dmflags2 & DF2_NO_FREEAIMBFG)
{
actor->pitch = 0;
self->pitch = 0;
player->userinfo.aimdist = ANGLE_1*35;
}
P_SpawnPlayerMissile (actor, PClass::FindClass("BFGBall"));
actor->pitch = storedpitch;
P_SpawnPlayerMissile (self, PClass::FindClass("BFGBall"));
self->pitch = storedpitch;
player->userinfo.aimdist = storedaimdist;
}
@ -486,7 +487,7 @@ void A_FireBFG (AActor *actor)
// A_BFGSpray
// Spawn a BFG explosion on every monster in view
//
void A_BFGSpray (AActor *mo)
DEFINE_ACTION_FUNCTION(AActor, A_BFGSpray)
{
int i;
int j;
@ -502,10 +503,10 @@ void A_BFGSpray (AActor *mo)
if (index >= 0)
{
spraytype = PClass::FindClass ((ENamedName)StateParameters[index]);
numrays = EvalExpressionI (StateParameters[index+1], mo);
numrays = EvalExpressionI (StateParameters[index+1], self);
if (numrays <= 0)
numrays = 40;
damagecnt = EvalExpressionI (StateParameters[index+2], mo);
damagecnt = EvalExpressionI (StateParameters[index+2], self);
if (damagecnt <= 0)
damagecnt = 15;
}
@ -515,16 +516,16 @@ void A_BFGSpray (AActor *mo)
}
// [RH] Don't crash if no target
if (!mo->target)
if (!self->target)
return;
// offset angles from its attack angle
for (i = 0; i < numrays; i++)
{
an = mo->angle - ANG90/2 + ANG90/numrays*i;
an = self->angle - ANG90/2 + ANG90/numrays*i;
// mo->target is the originator (player) of the missile
P_AimLineAttack (mo->target, an, 16*64*FRACUNIT, &linetarget, ANGLE_1*32);
// self->target is the originator (player) of the missile
P_AimLineAttack (self->target, an, 16*64*FRACUNIT, &linetarget, ANGLE_1*32);
if (!linetarget)
continue;
@ -533,7 +534,7 @@ void A_BFGSpray (AActor *mo)
linetarget->z + (linetarget->height>>2), ALLOW_REPLACE);
if (spray && (spray->flags5 & MF5_PUFFGETSOWNER))
spray->target = mo->target;
spray->target = self->target;
damage = 0;
@ -541,16 +542,16 @@ void A_BFGSpray (AActor *mo)
damage += (pr_bfgspray() & 7) + 1;
thingToHit = linetarget;
P_DamageMobj (thingToHit, mo->target, mo->target, damage, NAME_BFGSplash);
P_TraceBleed (damage, thingToHit, mo->target);
P_DamageMobj (thingToHit, self->target, self->target, damage, NAME_BFGSplash);
P_TraceBleed (damage, thingToHit, self->target);
}
}
//
// A_BFGsound
//
void A_BFGsound (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BFGsound)
{
S_Sound (actor, CHAN_WEAPON, "weapons/bfgf", 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, "weapons/bfgf", 1, ATTN_NORM);
}

View file

@ -15,13 +15,13 @@
//
#define FATSPREAD (ANG90/8)
void A_FatRaise (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FatRaise)
{
A_FaceTarget (self);
S_Sound (self, CHAN_WEAPON, "fatso/raiseguns", 1, ATTN_NORM);
}
void A_FatAttack1 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FatAttack1)
{
AActor *missile;
angle_t an;
@ -49,7 +49,7 @@ void A_FatAttack1 (AActor *self)
}
}
void A_FatAttack2 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FatAttack2)
{
AActor *missile;
angle_t an;
@ -77,7 +77,7 @@ void A_FatAttack2 (AActor *self)
}
}
void A_FatAttack3 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FatAttack3)
{
AActor *missile;
angle_t an;
@ -116,39 +116,39 @@ void A_FatAttack3 (AActor *self)
// Original idea: Linguica
//
void A_Mushroom (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Mushroom)
{
int i, j, n = actor->GetMissileDamage (0, 1);
int i, j, n = self->GetMissileDamage (0, 1);
const PClass *spawntype = NULL;
int index = CheckIndex (2, NULL);
if (index >= 0)
{
spawntype = PClass::FindClass((ENamedName)StateParameters[index]);
n = EvalExpressionI (StateParameters[index+1], actor);
n = EvalExpressionI (StateParameters[index+1], self);
if (n == 0)
n = actor->GetMissileDamage (0, 1);
n = self->GetMissileDamage (0, 1);
}
if (spawntype == NULL) spawntype = PClass::FindClass("FatShot");
P_RadiusAttack (actor, actor->target, 128, 128, actor->DamageType, true);
if (actor->z <= actor->floorz + (128<<FRACBITS))
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, true);
if (self->z <= self->floorz + (128<<FRACBITS))
{
P_HitFloor (actor);
P_HitFloor (self);
}
// Now launch mushroom cloud
AActor *target = Spawn("Mapspot", 0, 0, 0, NO_REPLACE); // We need something to aim at.
target->height = actor->height;
target->height = self->height;
for (i = -n; i <= n; i += 8)
{
for (j = -n; j <= n; j += 8)
{
AActor *mo;
target->x = actor->x + (i << FRACBITS); // Aim in many directions from source
target->y = actor->y + (j << FRACBITS);
target->z = actor->z + (P_AproxDistance(i,j) << (FRACBITS+2)); // Aim up fairly high
mo = P_SpawnMissile (actor, target, spawntype); // Launch fireball
target->x = self->x + (i << FRACBITS); // Aim in many directions from source
target->y = self->y + (j << FRACBITS);
target->z = self->z + (P_AproxDistance(i,j) << (FRACBITS+2)); // Aim up fairly high
mo = P_SpawnMissile (self, target, spawntype); // Launch fireball
if (mo != NULL)
{
mo->momx >>= 1;

View file

@ -4,15 +4,16 @@
#include "p_spec.h"
#include "p_enemy.h"
#include "a_action.h"
#include "thingdef/thingdef.h"
//
// A_KeenDie
// DOOM II special, map 32.
// Uses special tag 666.
//
void A_KeenDie (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_KeenDie)
{
A_NoBlocking (self);
CALL_ACTION(A_NoBlocking, self);
// scan the remaining thinkers to see if all Keens are dead
AActor *other;

View file

@ -19,7 +19,7 @@
//
#define SKULLSPEED (20*FRACUNIT)
void A_SkullAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SkullAttack)
{
AActor *dest;
angle_t an;

View file

@ -8,10 +8,7 @@
#include "m_bbox.h"
#include "thingdef/thingdef.h"
void A_PainAttack (AActor *);
void A_PainDie (AActor *);
void A_SkullAttack (AActor *self);
DECLARE_ACTION(A_SkullAttack)
static const PClass *GetSpawnType()
{
@ -130,7 +127,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, const PClass *spawntype)
// [RH] Lost souls hate the same things as their pain elementals
other->CopyFriendliness (self, true);
A_SkullAttack (other);
CALL_ACTION(A_SkullAttack, other);
}
@ -138,7 +135,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, const PClass *spawntype)
// A_PainAttack
// Spawn a lost soul and launch it at the target
//
void A_PainAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_PainAttack)
{
if (!self->target)
return;
@ -148,7 +145,7 @@ void A_PainAttack (AActor *self)
A_PainShootSkull (self, self->angle, spawntype);
}
void A_DualPainAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_DualPainAttack)
{
if (!self->target)
return;
@ -159,14 +156,14 @@ void A_DualPainAttack (AActor *self)
A_PainShootSkull (self, self->angle - ANG45, spawntype);
}
void A_PainDie (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_PainDie)
{
if (self->target != NULL && self->IsFriend (self->target))
{ // And I thought you were my friend!
self->flags &= ~MF_FRIENDLY;
}
const PClass *spawntype = GetSpawnType();
A_NoBlocking (self);
CALL_ACTION(A_NoBlocking, self);
A_PainShootSkull (self, self->angle + ANG90, spawntype);
A_PainShootSkull (self, self->angle + ANG180, spawntype);
A_PainShootSkull (self, self->angle + ANG270, spawntype);

View file

@ -7,6 +7,7 @@
#include "gstrings.h"
#include "a_action.h"
#include "a_doomglobal.h"
#include "thingdef/thingdef.h"
static FRandom pr_posattack ("PosAttack");
static FRandom pr_sposattack ("SPosAttack");
@ -16,7 +17,7 @@ static FRandom pr_cposrefire ("CPosRefire");
//
// A_PosAttack
//
void A_PosAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_PosAttack)
{
int angle;
int damage;
@ -53,7 +54,7 @@ static void A_SPosAttack2 (AActor *self)
}
}
void A_SPosAttackUseAtkSound (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SPosAttackUseAtkSound)
{
if (!self->target)
return;
@ -64,7 +65,7 @@ void A_SPosAttackUseAtkSound (AActor *self)
// This version of the function, which uses a hard-coded sound, is
// meant for Dehacked only.
void A_SPosAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SPosAttack)
{
if (!self->target)
return;
@ -73,7 +74,7 @@ void A_SPosAttack (AActor *self)
A_SPosAttack2 (self);
}
void A_CPosAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CPosAttack)
{
int angle;
int bangle;
@ -99,7 +100,7 @@ void A_CPosAttack (AActor *self)
P_LineAttack (self, angle, MISSILERANGE, slope, damage, NAME_None, NAME_BulletPuff);
}
void A_CPosRefire (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CPosRefire)
{
// keep firing unless target got out of sight
A_FaceTarget (self);

View file

@ -8,6 +8,7 @@
#include "gstrings.h"
#include "a_action.h"
#include "a_doomglobal.h"
#include "thingdef/thingdef.h"
static FRandom pr_tracer ("Tracer");
static FRandom pr_skelfist ("SkelFist");
@ -15,7 +16,7 @@ static FRandom pr_skelfist ("SkelFist");
//
// A_SkelMissile
//
void A_SkelMissile (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SkelMissile)
{
AActor *missile;
@ -36,7 +37,7 @@ void A_SkelMissile (AActor *self)
#define TRACEANGLE (0xc000000)
void A_Tracer (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Tracer)
{
angle_t exact;
fixed_t dist;
@ -121,7 +122,7 @@ void A_Tracer (AActor *self)
}
void A_SkelWhoosh (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SkelWhoosh)
{
if (!self->target)
return;
@ -129,7 +130,7 @@ void A_SkelWhoosh (AActor *self)
S_Sound (self, CHAN_WEAPON, "skeleton/swing", 1, ATTN_NORM);
}
void A_SkelFist (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SkelFist)
{
if (!self->target)
return;

View file

@ -159,7 +159,7 @@ void AScriptedMarine::Tick ()
//
//============================================================================
void A_M_Refire (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_Refire)
{
if (self->target == NULL || self->target->health <= 0)
{
@ -187,7 +187,7 @@ void A_M_Refire (AActor *self)
//
//============================================================================
void A_M_SawRefire (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_SawRefire)
{
if (self->target == NULL || self->target->health <= 0)
{
@ -206,7 +206,7 @@ void A_M_SawRefire (AActor *self)
//
//============================================================================
void A_MarineNoise (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_MarineNoise)
{
if (static_cast<AScriptedMarine *>(self)->CurrentWeapon == AScriptedMarine::WEAPON_Chainsaw)
{
@ -220,9 +220,9 @@ void A_MarineNoise (AActor *self)
//
//============================================================================
void A_MarineChase (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_MarineChase)
{
A_MarineNoise (self);
CALL_ACTION(A_MarineNoise, self);
A_Chase (self);
}
@ -232,10 +232,10 @@ void A_MarineChase (AActor *self)
//
//============================================================================
void A_MarineLook (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_MarineLook)
{
A_MarineNoise (self);
A_Look (self);
CALL_ACTION(A_MarineNoise, self);
CALL_ACTION(A_Look, self);
}
//============================================================================
@ -244,7 +244,7 @@ void A_MarineLook (AActor *self)
//
//============================================================================
void A_M_Saw (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_Saw)
{
if (self->target == NULL)
return;
@ -300,7 +300,7 @@ void A_M_Saw (AActor *self)
//
//============================================================================
void A_M_Punch (AActor *self)
static void MarinePunch(AActor *self, int damagemul)
{
angle_t angle;
int damage;
@ -310,11 +310,7 @@ void A_M_Punch (AActor *self)
if (self->target == NULL)
return;
int index=CheckIndex(1);
if (index<0) return;
damage = (pr_m_punch()%10+1) << 1;
damage *= EvalExpressionI (StateParameters[index], self);
damage = ((pr_m_punch()%10+1) << 1) * damagemul;
A_FaceTarget (self);
angle = self->angle + (pr_m_punch.Random2() << 18);
@ -329,6 +325,14 @@ void A_M_Punch (AActor *self)
}
}
DEFINE_ACTION_FUNCTION(AActor, A_M_Punch)
{
int index=CheckIndex(1);
if (index<0) return;
MarinePunch(self, EvalExpressionI (StateParameters[index], self));
}
//============================================================================
//
// P_GunShot2
@ -357,7 +361,7 @@ void P_GunShot2 (AActor *mo, bool accurate, int pitch, const PClass *pufftype)
//
//============================================================================
void A_M_FirePistol (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_FirePistol)
{
if (self->target == NULL)
return;
@ -378,7 +382,7 @@ void A_M_FirePistol (AActor *self)
//
//============================================================================
void A_M_FireShotgun (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun)
{
int pitch;
@ -401,7 +405,7 @@ void A_M_FireShotgun (AActor *self)
//
//============================================================================
void A_M_CheckAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_CheckAttack)
{
if (self->special1 != 0 || self->target == NULL)
{
@ -419,7 +423,7 @@ void A_M_CheckAttack (AActor *self)
//
//============================================================================
void A_M_FireShotgun2 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun2)
{
int pitch;
@ -447,7 +451,7 @@ void A_M_FireShotgun2 (AActor *self)
//
//============================================================================
void A_M_FireCGun (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_FireCGun)
{
if (self->target == NULL)
return;
@ -472,14 +476,14 @@ void A_M_FireCGun (AActor *self)
//
//============================================================================
void A_M_FireMissile (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_FireMissile)
{
if (self->target == NULL)
return;
if (self->CheckMeleeRange ())
{ // If too close, punch it
A_M_Punch (self);
MarinePunch(self, 1);
}
else
{
@ -494,12 +498,12 @@ void A_M_FireMissile (AActor *self)
//
//============================================================================
void A_M_FireRailgun (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_FireRailgun)
{
if (self->target == NULL)
return;
A_MonsterRail (self);
CALL_ACTION(A_MonsterRail, self);
self->special1 = level.maptime + 50;
}
@ -509,7 +513,7 @@ void A_M_FireRailgun (AActor *self)
//
//============================================================================
void A_M_FirePlasma (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_FirePlasma)
{
if (self->target == NULL)
return;
@ -525,7 +529,7 @@ void A_M_FirePlasma (AActor *self)
//
//============================================================================
void A_M_BFGsound (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_BFGsound)
{
if (self->target == NULL)
return;
@ -549,7 +553,7 @@ void A_M_BFGsound (AActor *self)
//
//============================================================================
void A_M_FireBFG (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_M_FireBFG)
{
if (self->target == NULL)
return;

View file

@ -5,10 +5,11 @@
#include "p_local.h"
#include "p_enemy.h"
#include "a_action.h"
#include "thingdef/thingdef.h"
static FRandom pr_spidrefire ("SpidRefire");
void A_SpidRefire (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpidRefire)
{
// keep firing unless target got out of sight
A_FaceTarget (self);
@ -25,7 +26,7 @@ void A_SpidRefire (AActor *self)
}
}
void A_Metal (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Metal)
{
S_Sound (self, CHAN_BODY, "spider/walk", 1, ATTN_IDLE);
A_Chase (self);

View file

@ -10,6 +10,7 @@
#include "p_enemy.h"
#include "d_event.h"
#include "gstrings.h"
#include "thingdef/thingdef.h"
void P_UpdateBeak (AActor *actor);
@ -61,17 +62,17 @@ void AChickenPlayer::MorphPlayerThink ()
//
//----------------------------------------------------------------------------
void A_ChicAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ChicAttack)
{
if (!actor->target)
if (!self->target)
{
return;
}
if (actor->CheckMeleeRange())
if (self->CheckMeleeRange())
{
int damage = 1 + (pr_chicattack() & 1);
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, actor->target, actor);
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, self->target, self);
}
}
@ -81,13 +82,13 @@ void A_ChicAttack (AActor *actor)
//
//----------------------------------------------------------------------------
void A_Feathers (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Feathers)
{
int i;
int count;
AActor *mo;
if (actor->health > 0)
if (self->health > 0)
{ // Pain
count = pr_feathers() < 32 ? 2 : 1;
}
@ -97,8 +98,8 @@ void A_Feathers (AActor *actor)
}
for (i = 0; i < count; i++)
{
mo = Spawn("Feather", actor->x, actor->y, actor->z+20*FRACUNIT, NO_REPLACE);
mo->target = actor;
mo = Spawn("Feather", self->x, self->y, self->z+20*FRACUNIT, NO_REPLACE);
mo->target = self;
mo->momx = pr_feathers.Random2() << 8;
mo->momy = pr_feathers.Random2() << 8;
mo->momz = FRACUNIT + (pr_feathers() << 9);
@ -112,12 +113,12 @@ void A_Feathers (AActor *actor)
//
//---------------------------------------------------------------------------
void P_UpdateBeak (AActor *actor)
void P_UpdateBeak (AActor *self)
{
if (actor->player != NULL)
if (self->player != NULL)
{
actor->player->psprites[ps_weapon].sy = WEAPONTOP +
(actor->player->chickenPeck << (FRACBITS-1));
self->player->psprites[ps_weapon].sy = WEAPONTOP +
(self->player->chickenPeck << (FRACBITS-1));
}
}
@ -127,11 +128,11 @@ void P_UpdateBeak (AActor *actor)
//
//---------------------------------------------------------------------------
void A_BeakRaise (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BeakRaise)
{
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
@ -156,7 +157,7 @@ void P_PlayPeck (AActor *chicken)
//
//----------------------------------------------------------------------------
void A_BeakAttackPL1 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL1)
{
angle_t angle;
int damage;
@ -164,7 +165,7 @@ void A_BeakAttackPL1 (AActor *actor)
player_t *player;
AActor *linetarget;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
@ -189,7 +190,7 @@ void A_BeakAttackPL1 (AActor *actor)
//
//----------------------------------------------------------------------------
void A_BeakAttackPL2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BeakAttackPL2)
{
angle_t angle;
int damage;
@ -197,7 +198,7 @@ void A_BeakAttackPL2 (AActor *actor)
player_t *player;
AActor *linetarget;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}

View file

@ -8,6 +8,7 @@
#include "a_sharedglobal.h"
#include "gstrings.h"
#include "a_specialspot.h"
#include "thingdef/thingdef.h"
static FRandom pr_s2fx1 ("S2FX1");
static FRandom pr_scrc1atk ("Srcr1Attack");
@ -22,10 +23,10 @@ static FRandom pr_bluespark ("BlueSpark");
//
//----------------------------------------------------------------------------
void A_Sor1Pain (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Sor1Pain)
{
actor->special1 = 20; // Number of steps to walk fast
A_Pain (actor);
self->special1 = 20; // Number of steps to walk fast
CALL_ACTION(A_Pain, self);
}
//----------------------------------------------------------------------------
@ -34,14 +35,14 @@ void A_Sor1Pain (AActor *actor)
//
//----------------------------------------------------------------------------
void A_Sor1Chase (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Sor1Chase)
{
if (actor->special1)
if (self->special1)
{
actor->special1--;
actor->tics -= 3;
self->special1--;
self->tics -= 3;
}
A_Chase(actor);
A_Chase(self);
}
//----------------------------------------------------------------------------
@ -52,50 +53,50 @@ void A_Sor1Chase (AActor *actor)
//
//----------------------------------------------------------------------------
void A_Srcr1Attack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Srcr1Attack)
{
AActor *mo;
fixed_t momz;
angle_t angle;
if (!actor->target)
if (!self->target)
{
return;
}
S_Sound (actor, CHAN_BODY, actor->AttackSound, 1, ATTN_NORM);
if (actor->CheckMeleeRange ())
S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NORM);
if (self->CheckMeleeRange ())
{
int damage = pr_scrc1atk.HitDice (8);
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, actor->target, actor);
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, self->target, self);
return;
}
const PClass *fx = PClass::FindClass("SorcererFX1");
if (actor->health > (actor->GetDefault()->health/3)*2)
if (self->health > (self->GetDefault()->health/3)*2)
{ // Spit one fireball
P_SpawnMissileZ (actor, actor->z + 48*FRACUNIT, actor->target, fx );
P_SpawnMissileZ (self, self->z + 48*FRACUNIT, self->target, fx );
}
else
{ // Spit three fireballs
mo = P_SpawnMissileZ (actor, actor->z + 48*FRACUNIT, actor->target, fx);
mo = P_SpawnMissileZ (self, self->z + 48*FRACUNIT, self->target, fx);
if (mo != NULL)
{
momz = mo->momz;
angle = mo->angle;
P_SpawnMissileAngleZ (actor, actor->z + 48*FRACUNIT, fx, angle-ANGLE_1*3, momz);
P_SpawnMissileAngleZ (actor, actor->z + 48*FRACUNIT, fx, angle+ANGLE_1*3, momz);
P_SpawnMissileAngleZ (self, self->z + 48*FRACUNIT, fx, angle-ANGLE_1*3, momz);
P_SpawnMissileAngleZ (self, self->z + 48*FRACUNIT, fx, angle+ANGLE_1*3, momz);
}
if (actor->health < actor->GetDefault()->health/3)
if (self->health < self->GetDefault()->health/3)
{ // Maybe attack again
if (actor->special1)
if (self->special1)
{ // Just attacked, so don't attack again
actor->special1 = 0;
self->special1 = 0;
}
else
{ // Set state to attack again
actor->special1 = 1;
actor->SetState (actor->FindState("Missile2"));
self->special1 = 1;
self->SetState (self->FindState("Missile2"));
}
}
}
@ -107,15 +108,15 @@ void A_Srcr1Attack (AActor *actor)
//
//----------------------------------------------------------------------------
void A_SorcererRise (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SorcererRise)
{
AActor *mo;
actor->flags &= ~MF_SOLID;
mo = Spawn("Sorcerer2", actor->x, actor->y, actor->z, ALLOW_REPLACE);
self->flags &= ~MF_SOLID;
mo = Spawn("Sorcerer2", self->x, self->y, self->z, ALLOW_REPLACE);
mo->SetState (mo->FindState("Rise"));
mo->angle = actor->angle;
mo->CopyFriendliness (actor, true);
mo->angle = self->angle;
mo->CopyFriendliness (self, true);
}
//----------------------------------------------------------------------------
@ -159,7 +160,7 @@ void P_DSparilTeleport (AActor *actor)
//
//----------------------------------------------------------------------------
void A_Srcr2Decide (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Srcr2Decide)
{
static const int chance[] =
@ -167,7 +168,7 @@ void A_Srcr2Decide (AActor *actor)
192, 120, 120, 120, 64, 64, 32, 16, 0
};
unsigned int chanceindex = actor->health / (actor->GetDefault()->health/8);
unsigned int chanceindex = self->health / (self->GetDefault()->health/8);
if (chanceindex >= countof(chance))
{
chanceindex = countof(chance) - 1;
@ -175,7 +176,7 @@ void A_Srcr2Decide (AActor *actor)
if (pr_s2d() < chance[chanceindex])
{
P_DSparilTeleport (actor);
P_DSparilTeleport (self);
}
}
@ -185,36 +186,36 @@ void A_Srcr2Decide (AActor *actor)
//
//----------------------------------------------------------------------------
void A_Srcr2Attack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Srcr2Attack)
{
int chance;
if (!actor->target)
if (!self->target)
{
return;
}
S_Sound (actor, CHAN_BODY, actor->AttackSound, 1, ATTN_NONE);
if (actor->CheckMeleeRange())
S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NONE);
if (self->CheckMeleeRange())
{
int damage = pr_s2a.HitDice (20);
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, actor->target, actor);
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, self->target, self);
return;
}
chance = actor->health < actor->GetDefault()->health/2 ? 96 : 48;
chance = self->health < self->GetDefault()->health/2 ? 96 : 48;
if (pr_s2a() < chance)
{ // Wizard spawners
const PClass *fx = PClass::FindClass("Sorcerer2FX2");
if (fx)
{
P_SpawnMissileAngle (actor, fx, actor->angle-ANG45, FRACUNIT/2);
P_SpawnMissileAngle (actor, fx, actor->angle+ANG45, FRACUNIT/2);
P_SpawnMissileAngle (self, fx, self->angle-ANG45, FRACUNIT/2);
P_SpawnMissileAngle (self, fx, self->angle+ANG45, FRACUNIT/2);
}
}
else
{ // Blue bolt
P_SpawnMissile (actor, actor->target, PClass::FindClass("Sorcerer2FX1"));
P_SpawnMissile (self, self->target, PClass::FindClass("Sorcerer2FX1"));
}
}
@ -224,14 +225,14 @@ void A_Srcr2Attack (AActor *actor)
//
//----------------------------------------------------------------------------
void A_BlueSpark (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BlueSpark)
{
int i;
AActor *mo;
for (i = 0; i < 2; i++)
{
mo = Spawn("Sorcerer2FXSpark", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn("Sorcerer2FXSpark", self->x, self->y, self->z, ALLOW_REPLACE);
mo->momx = pr_bluespark.Random2() << 9;
mo->momy = pr_bluespark.Random2() << 9;
mo->momz = FRACUNIT + (pr_bluespark()<<8);
@ -244,11 +245,11 @@ void A_BlueSpark (AActor *actor)
//
//----------------------------------------------------------------------------
void A_GenWizard (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_GenWizard)
{
AActor *mo;
mo = Spawn("Wizard", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn("Wizard", self->x, self->y, self->z, ALLOW_REPLACE);
if (mo != NULL)
{
mo->z -= mo->GetDefault()->height/2;
@ -259,14 +260,14 @@ void A_GenWizard (AActor *actor)
}
else
{ // [RH] Make the new wizards inherit D'Sparil's target
mo->CopyFriendliness (actor->target, true);
mo->CopyFriendliness (self->target, true);
actor->momx = actor->momy = actor->momz = 0;
actor->SetState (actor->FindState(NAME_Death));
actor->flags &= ~MF_MISSILE;
mo->master = actor->target;
self->momx = self->momy = self->momz = 0;
self->SetState (self->FindState(NAME_Death));
self->flags &= ~MF_MISSILE;
mo->master = self->target;
// Heretic did not offset it by TELEFOGHEIGHT, so I won't either.
Spawn<ATeleportFog> (actor->x, actor->y, actor->z, ALLOW_REPLACE);
Spawn<ATeleportFog> (self->x, self->y, self->z, ALLOW_REPLACE);
}
}
}
@ -277,9 +278,9 @@ void A_GenWizard (AActor *actor)
//
//----------------------------------------------------------------------------
void A_Sor2DthInit (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Sor2DthInit)
{
actor->special1 = 7; // Animation loop counter
self->special1 = 7; // Animation loop counter
P_Massacre (); // Kill monsters early
}
@ -289,11 +290,11 @@ void A_Sor2DthInit (AActor *actor)
//
//----------------------------------------------------------------------------
void A_Sor2DthLoop (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Sor2DthLoop)
{
if (--actor->special1)
if (--self->special1)
{ // Need to loop
actor->SetState (actor->FindState("DeathLoop"));
self->SetState (self->FindState("DeathLoop"));
}
}

View file

@ -5,6 +5,7 @@
#include "p_local.h"
#include "p_enemy.h"
#include "s_sound.h"
#include "thingdef/thingdef.h"
// Tome of power ------------------------------------------------------------
@ -43,12 +44,12 @@ bool AArtiTomeOfPower::Use (bool pickup)
// Time bomb ----------------------------------------------------------------
void A_TimeBomb(AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb)
{
self->z += 32*FRACUNIT;
self->RenderStyle = STYLE_Add;
self->alpha = FRACUNIT;
A_Explode(self);
CALL_ACTION(A_Explode, self);
}
class AArtiTimeBomb : public AInventory

View file

@ -6,6 +6,7 @@
#include "p_local.h"
#include "p_enemy.h"
#include "gstrings.h"
#include "thingdef/thingdef.h"
static FRandom pr_imp ("ImpExplode");
@ -15,7 +16,7 @@ static FRandom pr_imp ("ImpExplode");
//
//----------------------------------------------------------------------------
void A_ImpExplode (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ImpExplode)
{
AActor *chunk;
@ -42,7 +43,7 @@ void A_ImpExplode (AActor *self)
//
//----------------------------------------------------------------------------
void A_ImpDeath (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ImpDeath)
{
self->flags &= ~MF_SOLID;
self->flags2 |= MF2_FLOORCLIP;
@ -54,7 +55,7 @@ void A_ImpDeath (AActor *self)
//
//----------------------------------------------------------------------------
void A_ImpXDeath1 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ImpXDeath1)
{
self->flags &= ~MF_SOLID;
self->flags |= MF_NOGRAVITY;

View file

@ -8,6 +8,7 @@
#include "p_local.h"
#include "s_sound.h"
#include "gstrings.h"
#include "thingdef/thingdef.h"
static FRandom pr_podpain ("PodPain");
static FRandom pr_makepod ("MakePod");
@ -23,7 +24,7 @@ static FRandom pr_impact ("VolcBallImpact");
//
//----------------------------------------------------------------------------
void A_PodPain (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_PodPain)
{
int count;
int chance;
@ -36,8 +37,8 @@ void A_PodPain (AActor *actor)
}
for (count = chance > 240 ? 2 : 1; count; count--)
{
goo = Spawn("PodGoo", actor->x, actor->y, actor->z + 48*FRACUNIT, ALLOW_REPLACE);
goo->target = actor;
goo = Spawn("PodGoo", self->x, self->y, self->z + 48*FRACUNIT, ALLOW_REPLACE);
goo->target = self;
goo->momx = pr_podpain.Random2() << 9;
goo->momy = pr_podpain.Random2() << 9;
goo->momz = FRACUNIT/2 + (pr_podpain() << 9);
@ -50,11 +51,11 @@ void A_PodPain (AActor *actor)
//
//----------------------------------------------------------------------------
void A_RemovePod (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_RemovePod)
{
AActor *mo;
if ( (mo = actor->master))
if ( (mo = self->master))
{
if (mo->special1 > 0)
{
@ -71,20 +72,20 @@ void A_RemovePod (AActor *actor)
#define MAX_GEN_PODS 16
void A_MakePod (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MakePod)
{
AActor *mo;
fixed_t x;
fixed_t y;
fixed_t z;
if (actor->special1 == MAX_GEN_PODS)
if (self->special1 == MAX_GEN_PODS)
{ // Too many generated pods
return;
}
x = actor->x;
y = actor->y;
z = actor->z;
x = self->x;
y = self->y;
z = self->z;
mo = Spawn("Pod", x, y, ONFLOORZ, ALLOW_REPLACE);
if (!P_CheckPosition (mo, x, y))
{ // Didn't fit
@ -94,8 +95,8 @@ void A_MakePod (AActor *actor)
mo->SetState (mo->FindState("Grow"));
P_ThrustMobj (mo, pr_makepod()<<24, (fixed_t)(4.5*FRACUNIT));
S_Sound (mo, CHAN_BODY, "world/podgrow", 1, ATTN_IDLE);
actor->special1++; // Increment generated pod count
mo->master = actor; // Link the generator to the pod
self->special1++; // Increment generated pod count
mo->master = self; // Link the generator to the pod
return;
}
@ -105,11 +106,11 @@ void A_MakePod (AActor *actor)
//
//----------------------------------------------------------------------------
void A_AccTeleGlitter (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_AccTeleGlitter)
{
if (++actor->health > 35)
if (++self->health > 35)
{
actor->momz += actor->momz/2;
self->momz += self->momz/2;
}
}
@ -120,9 +121,9 @@ void A_AccTeleGlitter (AActor *actor)
//
//----------------------------------------------------------------------------
void A_VolcanoSet (AActor *volcano)
DEFINE_ACTION_FUNCTION(AActor, A_VolcanoSet)
{
volcano->tics = 105 + (pr_volcano() & 127);
self->tics = 105 + (pr_volcano() & 127);
}
//----------------------------------------------------------------------------
@ -131,7 +132,7 @@ void A_VolcanoSet (AActor *volcano)
//
//----------------------------------------------------------------------------
void A_VolcanoBlast (AActor *volcano)
DEFINE_ACTION_FUNCTION(AActor, A_VolcanoBlast)
{
int i;
int count;
@ -141,16 +142,16 @@ void A_VolcanoBlast (AActor *volcano)
count = 1 + (pr_blast() % 3);
for (i = 0; i < count; i++)
{
blast = Spawn("VolcanoBlast", volcano->x, volcano->y,
volcano->z + 44*FRACUNIT, ALLOW_REPLACE);
blast->target = volcano;
blast = Spawn("VolcanoBlast", self->x, self->y,
self->z + 44*FRACUNIT, ALLOW_REPLACE);
blast->target = self;
angle = pr_blast () << 24;
blast->angle = angle;
angle >>= ANGLETOFINESHIFT;
blast->momx = FixedMul (1*FRACUNIT, finecosine[angle]);
blast->momy = FixedMul (1*FRACUNIT, finesine[angle]);
blast->momz = (FRACUNIT*5/2) + (pr_blast() << 10);
S_Sound (blast, CHAN_BODY, "world/volcano/shoot", 1, ATTN_NORM);
S_Sound (blast, CHAN_BODY, "world/self/shoot", 1, ATTN_NORM);
P_CheckMissileSpawn (blast);
}
}
@ -161,24 +162,24 @@ void A_VolcanoBlast (AActor *volcano)
//
//----------------------------------------------------------------------------
void A_VolcBallImpact (AActor *ball)
DEFINE_ACTION_FUNCTION(AActor, A_VolcBallImpact)
{
int i;
AActor *tiny;
angle_t angle;
if (ball->z <= ball->floorz)
if (self->z <= self->floorz)
{
ball->flags |= MF_NOGRAVITY;
ball->gravity = FRACUNIT;
ball->z += 28*FRACUNIT;
//ball->momz = 3*FRACUNIT;
self->flags |= MF_NOGRAVITY;
self->gravity = FRACUNIT;
self->z += 28*FRACUNIT;
//self->momz = 3*FRACUNIT;
}
P_RadiusAttack (ball, ball->target, 25, 25, NAME_Fire, true);
P_RadiusAttack (self, self->target, 25, 25, NAME_Fire, true);
for (i = 0; i < 4; i++)
{
tiny = Spawn("VolcanoTBlast", ball->x, ball->y, ball->z, ALLOW_REPLACE);
tiny->target = ball;
tiny = Spawn("VolcanoTBlast", self->x, self->y, self->z, ALLOW_REPLACE);
tiny->target = self;
angle = i*ANG90;
tiny->angle = angle;
angle >>= ANGLETOFINESHIFT;

File diff suppressed because it is too large Load diff

View file

@ -6,6 +6,7 @@
#include "p_enemy.h"
#include "a_action.h"
#include "gstrings.h"
#include "thingdef/thingdef.h"
static FRandom pr_foo ("WhirlwindDamage");
static FRandom pr_atk ("LichAttack");
@ -53,7 +54,7 @@ int AWhirlwind::DoSpecialDamage (AActor *target, int damage)
//
//----------------------------------------------------------------------------
void A_LichAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LichAttack)
{
int i;
AActor *fire;
@ -70,30 +71,30 @@ void A_LichAttack (AActor *actor)
// Whirlwind (close 40% : far 20%)
// Distance threshold = 8 cells
target = actor->target;
target = self->target;
if (target == NULL)
{
return;
}
A_FaceTarget (actor);
if (actor->CheckMeleeRange ())
A_FaceTarget (self);
if (self->CheckMeleeRange ())
{
int damage = pr_atk.HitDice (6);
P_DamageMobj (target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, target, actor);
P_DamageMobj (target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, target, self);
return;
}
dist = P_AproxDistance (actor->x-target->x, actor->y-target->y)
dist = P_AproxDistance (self->x-target->x, self->y-target->y)
> 8*64*FRACUNIT;
randAttack = pr_atk ();
if (randAttack < atkResolve1[dist])
{ // Ice ball
P_SpawnMissile (actor, target, PClass::FindClass("HeadFX1"));
S_Sound (actor, CHAN_BODY, "ironlich/attack2", 1, ATTN_NORM);
P_SpawnMissile (self, target, PClass::FindClass("HeadFX1"));
S_Sound (self, CHAN_BODY, "ironlich/attack2", 1, ATTN_NORM);
}
else if (randAttack < atkResolve2[dist])
{ // Fire column
baseFire = P_SpawnMissile (actor, target, PClass::FindClass("HeadFX3"));
baseFire = P_SpawnMissile (self, target, PClass::FindClass("HeadFX3"));
if (baseFire != NULL)
{
baseFire->SetState (baseFire->FindState("NoGrow"));
@ -103,7 +104,7 @@ void A_LichAttack (AActor *actor)
baseFire->z, ALLOW_REPLACE);
if (i == 0)
{
S_Sound (actor, CHAN_BODY, "ironlich/attack1", 1, ATTN_NORM);
S_Sound (self, CHAN_BODY, "ironlich/attack1", 1, ATTN_NORM);
}
fire->target = baseFire->target;
fire->angle = baseFire->angle;
@ -118,7 +119,7 @@ void A_LichAttack (AActor *actor)
}
else
{ // Whirlwind
mo = P_SpawnMissile (actor, target, RUNTIME_CLASS(AWhirlwind));
mo = P_SpawnMissile (self, target, RUNTIME_CLASS(AWhirlwind));
if (mo != NULL)
{
mo->z -= 32*FRACUNIT;
@ -126,7 +127,7 @@ void A_LichAttack (AActor *actor)
mo->special1 = 60;
mo->special2 = 50; // Timer for active sound
mo->health = 20*TICRATE; // Duration
S_Sound (actor, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM);
S_Sound (self, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM);
}
}
}
@ -137,26 +138,26 @@ void A_LichAttack (AActor *actor)
//
//----------------------------------------------------------------------------
void A_WhirlwindSeek (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_WhirlwindSeek)
{
actor->health -= 3;
if (actor->health < 0)
self->health -= 3;
if (self->health < 0)
{
actor->momx = actor->momy = actor->momz = 0;
actor->SetState (actor->FindState(NAME_Death));
actor->flags &= ~MF_MISSILE;
self->momx = self->momy = self->momz = 0;
self->SetState (self->FindState(NAME_Death));
self->flags &= ~MF_MISSILE;
return;
}
if ((actor->special2 -= 3) < 0)
if ((self->special2 -= 3) < 0)
{
actor->special2 = 58 + (pr_seek() & 31);
S_Sound (actor, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM);
self->special2 = 58 + (pr_seek() & 31);
S_Sound (self, CHAN_BODY, "ironlich/attack3", 1, ATTN_NORM);
}
if (actor->tracer && actor->tracer->flags&MF_SHADOW)
if (self->tracer && self->tracer->flags&MF_SHADOW)
{
return;
}
P_SeekerMissile (actor, ANGLE_1*10, ANGLE_1*30);
P_SeekerMissile (self, ANGLE_1*10, ANGLE_1*30);
}
//----------------------------------------------------------------------------
@ -165,7 +166,7 @@ void A_WhirlwindSeek (AActor *actor)
//
//----------------------------------------------------------------------------
void A_LichIceImpact (AActor *ice)
DEFINE_ACTION_FUNCTION(AActor, A_LichIceImpact)
{
int i;
angle_t angle;
@ -173,9 +174,9 @@ void A_LichIceImpact (AActor *ice)
for (i = 0; i < 8; i++)
{
shard = Spawn("HeadFX2", ice->x, ice->y, ice->z, ALLOW_REPLACE);
shard = Spawn("HeadFX2", self->x, self->y, self->z, ALLOW_REPLACE);
angle = i*ANG45;
shard->target = ice->target;
shard->target = self->target;
shard->angle = angle;
angle >>= ANGLETOFINESHIFT;
shard->momx = FixedMul (shard->Speed, finecosine[angle]);
@ -191,14 +192,14 @@ void A_LichIceImpact (AActor *ice)
//
//----------------------------------------------------------------------------
void A_LichFireGrow (AActor *fire)
DEFINE_ACTION_FUNCTION(AActor, A_LichFireGrow)
{
fire->health--;
fire->z += 9*FRACUNIT;
if (fire->health == 0)
self->health--;
self->z += 9*FRACUNIT;
if (self->health == 0)
{
fire->Damage = fire->GetDefault()->Damage;
fire->SetState (fire->FindState("NoGrow"));
self->Damage = self->GetDefault()->Damage;
self->SetState (self->FindState("NoGrow"));
}
}

View file

@ -7,6 +7,7 @@
#include "a_action.h"
#include "a_sharedglobal.h"
#include "gstrings.h"
#include "thingdef/thingdef.h"
static FRandom pr_dripblood ("DripBlood");
static FRandom pr_knightatk ("KnightAttack");
@ -17,14 +18,14 @@ static FRandom pr_knightatk ("KnightAttack");
//
//----------------------------------------------------------------------------
void A_DripBlood (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_DripBlood)
{
AActor *mo;
fixed_t x, y;
x = actor->x + (pr_dripblood.Random2 () << 11);
y = actor->y + (pr_dripblood.Random2 () << 11);
mo = Spawn ("Blood", x, y, actor->z, ALLOW_REPLACE);
x = self->x + (pr_dripblood.Random2 () << 11);
y = self->y + (pr_dripblood.Random2 () << 11);
mo = Spawn ("Blood", x, y, self->z, ALLOW_REPLACE);
mo->momx = pr_dripblood.Random2 () << 10;
mo->momy = pr_dripblood.Random2 () << 10;
mo->gravity = FRACUNIT/8;
@ -36,28 +37,28 @@ void A_DripBlood (AActor *actor)
//
//----------------------------------------------------------------------------
void A_KnightAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_KnightAttack)
{
if (!actor->target)
if (!self->target)
{
return;
}
if (actor->CheckMeleeRange ())
if (self->CheckMeleeRange ())
{
int damage = pr_knightatk.HitDice (3);
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, actor->target, actor);
S_Sound (actor, CHAN_BODY, "hknight/melee", 1, ATTN_NORM);
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, self->target, self);
S_Sound (self, CHAN_BODY, "hknight/melee", 1, ATTN_NORM);
return;
}
// Throw axe
S_Sound (actor, CHAN_BODY, actor->AttackSound, 1, ATTN_NORM);
if (actor->flags & MF_SHADOW || pr_knightatk () < 40)
S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NORM);
if (self->flags & MF_SHADOW || pr_knightatk () < 40)
{ // Red axe
P_SpawnMissileZ (actor, actor->z + 36*FRACUNIT, actor->target, PClass::FindClass("RedAxe"));
P_SpawnMissileZ (self, self->z + 36*FRACUNIT, self->target, PClass::FindClass("RedAxe"));
return;
}
// Green axe
P_SpawnMissileZ (actor, actor->z + 36*FRACUNIT, actor->target, PClass::FindClass("KnightAxe"));
P_SpawnMissileZ (self, self->z + 36*FRACUNIT, self->target, PClass::FindClass("KnightAxe"));
}

View file

@ -6,6 +6,7 @@
#include "p_enemy.h"
#include "a_action.h"
#include "gstrings.h"
#include "thingdef/thingdef.h"
static FRandom pr_wizatk3 ("WizAtk3");
@ -15,10 +16,10 @@ static FRandom pr_wizatk3 ("WizAtk3");
//
//----------------------------------------------------------------------------
void A_GhostOff (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_GhostOff)
{
actor->RenderStyle = STYLE_Normal;
actor->flags3 &= ~MF3_GHOST;
self->RenderStyle = STYLE_Normal;
self->flags3 &= ~MF3_GHOST;
}
//----------------------------------------------------------------------------
@ -27,10 +28,10 @@ void A_GhostOff (AActor *actor)
//
//----------------------------------------------------------------------------
void A_WizAtk1 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_WizAtk1)
{
A_FaceTarget (actor);
A_GhostOff (actor);
A_FaceTarget (self);
CALL_ACTION(A_GhostOff, self);
}
//----------------------------------------------------------------------------
@ -39,12 +40,12 @@ void A_WizAtk1 (AActor *actor)
//
//----------------------------------------------------------------------------
void A_WizAtk2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_WizAtk2)
{
A_FaceTarget (actor);
actor->alpha = HR_SHADOW;
actor->RenderStyle = STYLE_Translucent;
actor->flags3 |= MF3_GHOST;
A_FaceTarget (self);
self->alpha = HR_SHADOW;
self->RenderStyle = STYLE_Translucent;
self->flags3 |= MF3_GHOST;
}
//----------------------------------------------------------------------------
@ -53,28 +54,28 @@ void A_WizAtk2 (AActor *actor)
//
//----------------------------------------------------------------------------
void A_WizAtk3 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_WizAtk3)
{
AActor *mo;
A_GhostOff (actor);
if (!actor->target)
CALL_ACTION(A_GhostOff, self);
if (!self->target)
{
return;
}
S_Sound (actor, CHAN_WEAPON, actor->AttackSound, 1, ATTN_NORM);
if (actor->CheckMeleeRange())
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
if (self->CheckMeleeRange())
{
int damage = pr_wizatk3.HitDice (4);
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, actor->target, actor);
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, self->target, self);
return;
}
const PClass *fx = PClass::FindClass("WizardFX1");
mo = P_SpawnMissile (actor, actor->target, fx);
mo = P_SpawnMissile (self, self->target, fx);
if (mo != NULL)
{
P_SpawnMissileAngle(actor, fx, mo->angle-(ANG45/8), mo->momz);
P_SpawnMissileAngle(actor, fx, mo->angle+(ANG45/8), mo->momz);
P_SpawnMissileAngle(self, fx, mo->angle-(ANG45/8), mo->momz);
P_SpawnMissileAngle(self, fx, mo->angle+(ANG45/8), mo->momz);
}
}

View file

@ -3,6 +3,7 @@
#include "m_random.h"
#include "p_local.h"
#include "s_sound.h"
#include "thingdef/thingdef.h"
static FRandom pr_batspawn ("BatSpawn");
static FRandom pr_batmove ("BatMove");
@ -22,65 +23,65 @@ static FRandom pr_batmove ("BatMove");
// args[4] turn amount per move (in degrees)
//===========================================================================
void A_BatSpawnInit (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BatSpawnInit)
{
actor->special1 = 0; // Frequency count
self->special1 = 0; // Frequency count
}
void A_BatSpawn (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BatSpawn)
{
AActor *mo;
int delta;
angle_t angle;
// Countdown until next spawn
if (actor->special1-- > 0) return;
actor->special1 = actor->args[0]; // Reset frequency count
if (self->special1-- > 0) return;
self->special1 = self->args[0]; // Reset frequency count
delta = actor->args[1];
delta = self->args[1];
if (delta==0) delta=1;
angle = actor->angle + (((pr_batspawn()%delta)-(delta>>1))<<24);
mo = P_SpawnMissileAngle (actor, PClass::FindClass ("Bat"), angle, 0);
angle = self->angle + (((pr_batspawn()%delta)-(delta>>1))<<24);
mo = P_SpawnMissileAngle (self, PClass::FindClass ("Bat"), angle, 0);
if (mo)
{
mo->args[0] = pr_batspawn()&63; // floatbob index
mo->args[4] = actor->args[4]; // turn degrees
mo->special2 = actor->args[3]<<3; // Set lifetime
mo->target = actor;
mo->args[4] = self->args[4]; // turn degrees
mo->special2 = self->args[3]<<3; // Set lifetime
mo->target = self;
}
}
void A_BatMove (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BatMove)
{
angle_t newangle;
if (actor->special2 < 0)
if (self->special2 < 0)
{
actor->SetState (actor->FindState(NAME_Death));
self->SetState (self->FindState(NAME_Death));
}
actor->special2 -= 2; // Called every 2 tics
self->special2 -= 2; // Called every 2 tics
if (pr_batmove()<128)
{
newangle = actor->angle + ANGLE_1*actor->args[4];
newangle = self->angle + ANGLE_1*self->args[4];
}
else
{
newangle = actor->angle - ANGLE_1*actor->args[4];
newangle = self->angle - ANGLE_1*self->args[4];
}
// Adjust momentum vector to new direction
newangle >>= ANGLETOFINESHIFT;
actor->momx = FixedMul (actor->Speed, finecosine[newangle]);
actor->momy = FixedMul (actor->Speed, finesine[newangle]);
self->momx = FixedMul (self->Speed, finecosine[newangle]);
self->momy = FixedMul (self->Speed, finesine[newangle]);
if (pr_batmove()<15)
{
S_Sound (actor, CHAN_VOICE, "BatScream", 1, ATTN_IDLE);
S_Sound (self, CHAN_VOICE, "BatScream", 1, ATTN_IDLE);
}
// Handle Z movement
actor->z = actor->target->z + 2*FloatBobOffsets[actor->args[0]];
actor->args[0] = (actor->args[0]+3)&63;
self->z = self->target->z + 2*FloatBobOffsets[self->args[0]];
self->args[0] = (self->args[0]+3)&63;
}

View file

@ -6,6 +6,7 @@
#include "a_action.h"
#include "m_random.h"
#include "a_hexenglobal.h"
#include "thingdef/thingdef.h"
static FRandom pr_boom ("BishopBoom");
static FRandom pr_atk ("BishopAttack");
@ -20,21 +21,21 @@ static FRandom pr_pain ("BishopPainBlur");
//
//============================================================================
void A_BishopAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BishopAttack)
{
if (!actor->target)
if (!self->target)
{
return;
}
S_Sound (actor, CHAN_BODY, actor->AttackSound, 1, ATTN_NORM);
if (actor->CheckMeleeRange())
S_Sound (self, CHAN_BODY, self->AttackSound, 1, ATTN_NORM);
if (self->CheckMeleeRange())
{
int damage = pr_atk.HitDice (4);
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, actor->target, actor);
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, self->target, self);
return;
}
actor->special1 = (pr_atk() & 3) + 5;
self->special1 = (pr_atk() & 3) + 5;
}
//============================================================================
@ -44,23 +45,23 @@ void A_BishopAttack (AActor *actor)
// Spawns one of a string of bishop missiles
//============================================================================
void A_BishopAttack2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BishopAttack2)
{
AActor *mo;
if (!actor->target || !actor->special1)
if (!self->target || !self->special1)
{
actor->special1 = 0;
actor->SetState (actor->SeeState);
self->special1 = 0;
self->SetState (self->SeeState);
return;
}
mo = P_SpawnMissile (actor, actor->target, PClass::FindClass("BishopFX"));
mo = P_SpawnMissile (self, self->target, PClass::FindClass("BishopFX"));
if (mo != NULL)
{
mo->tracer = actor->target;
mo->tracer = self->target;
mo->special2 = 16; // High word == x/y, Low word == z
}
actor->special1--;
self->special1--;
}
//============================================================================
@ -69,27 +70,27 @@ void A_BishopAttack2 (AActor *actor)
//
//============================================================================
void A_BishopMissileWeave (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BishopMissileWeave)
{
fixed_t newX, newY;
int weaveXY, weaveZ;
int angle;
if (actor->special2 == 0) actor->special2 = 16;
if (self->special2 == 0) self->special2 = 16;
weaveXY = actor->special2 >> 16;
weaveZ = actor->special2 & 0xFFFF;
angle = (actor->angle + ANG90) >> ANGLETOFINESHIFT;
newX = actor->x - FixedMul (finecosine[angle], FloatBobOffsets[weaveXY]<<1);
newY = actor->y - FixedMul (finesine[angle], FloatBobOffsets[weaveXY]<<1);
weaveXY = self->special2 >> 16;
weaveZ = self->special2 & 0xFFFF;
angle = (self->angle + ANG90) >> ANGLETOFINESHIFT;
newX = self->x - FixedMul (finecosine[angle], FloatBobOffsets[weaveXY]<<1);
newY = self->y - FixedMul (finesine[angle], FloatBobOffsets[weaveXY]<<1);
weaveXY = (weaveXY + 2) & 63;
newX += FixedMul (finecosine[angle], FloatBobOffsets[weaveXY]<<1);
newY += FixedMul (finesine[angle], FloatBobOffsets[weaveXY]<<1);
P_TryMove (actor, newX, newY, true);
actor->z -= FloatBobOffsets[weaveZ];
P_TryMove (self, newX, newY, true);
self->z -= FloatBobOffsets[weaveZ];
weaveZ = (weaveZ + 2) & 63;
actor->z += FloatBobOffsets[weaveZ];
actor->special2 = weaveZ + (weaveXY<<16);
self->z += FloatBobOffsets[weaveZ];
self->special2 = weaveZ + (weaveXY<<16);
}
//============================================================================
@ -98,7 +99,7 @@ void A_BishopMissileWeave (AActor *actor)
//
//============================================================================
void A_BishopDecide (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BishopDecide)
{
if (pr_decide() < 220)
{
@ -106,7 +107,7 @@ void A_BishopDecide (AActor *actor)
}
else
{
actor->SetState (actor->FindState ("Blur"));
self->SetState (self->FindState ("Blur"));
}
}
@ -116,22 +117,22 @@ void A_BishopDecide (AActor *actor)
//
//============================================================================
void A_BishopDoBlur (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BishopDoBlur)
{
actor->special1 = (pr_doblur() & 3) + 3; // Random number of blurs
self->special1 = (pr_doblur() & 3) + 3; // Random number of blurs
if (pr_doblur() < 120)
{
P_ThrustMobj (actor, actor->angle + ANG90, 11*FRACUNIT);
P_ThrustMobj (self, self->angle + ANG90, 11*FRACUNIT);
}
else if (pr_doblur() > 125)
{
P_ThrustMobj (actor, actor->angle - ANG90, 11*FRACUNIT);
P_ThrustMobj (self, self->angle - ANG90, 11*FRACUNIT);
}
else
{ // Thrust forward
P_ThrustMobj (actor, actor->angle, 11*FRACUNIT);
P_ThrustMobj (self, self->angle, 11*FRACUNIT);
}
S_Sound (actor, CHAN_BODY, "BishopBlur", 1, ATTN_NORM);
S_Sound (self, CHAN_BODY, "BishopBlur", 1, ATTN_NORM);
}
//============================================================================
@ -140,27 +141,27 @@ void A_BishopDoBlur (AActor *actor)
//
//============================================================================
void A_BishopSpawnBlur (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BishopSpawnBlur)
{
AActor *mo;
if (!--actor->special1)
if (!--self->special1)
{
actor->momx = 0;
actor->momy = 0;
self->momx = 0;
self->momy = 0;
if (pr_sblur() > 96)
{
actor->SetState (actor->SeeState);
self->SetState (self->SeeState);
}
else
{
actor->SetState (actor->MissileState);
self->SetState (self->MissileState);
}
}
mo = Spawn ("BishopBlur", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn ("BishopBlur", self->x, self->y, self->z, ALLOW_REPLACE);
if (mo)
{
mo->angle = actor->angle;
mo->angle = self->angle;
}
}
@ -170,11 +171,11 @@ void A_BishopSpawnBlur (AActor *actor)
//
//============================================================================
void A_BishopChase (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BishopChase)
{
actor->z -= FloatBobOffsets[actor->special2] >> 1;
actor->special2 = (actor->special2 + 4) & 63;
actor->z += FloatBobOffsets[actor->special2] >> 1;
self->z -= FloatBobOffsets[self->special2] >> 1;
self->special2 = (self->special2 + 4) & 63;
self->z += FloatBobOffsets[self->special2] >> 1;
}
//============================================================================
@ -183,11 +184,11 @@ void A_BishopChase (AActor *actor)
//
//============================================================================
void A_BishopPuff (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BishopPuff)
{
AActor *mo;
mo = Spawn ("BishopPuff", actor->x, actor->y, actor->z + 40*FRACUNIT, ALLOW_REPLACE);
mo = Spawn ("BishopPuff", self->x, self->y, self->z + 40*FRACUNIT, ALLOW_REPLACE);
if (mo)
{
mo->momz = FRACUNIT/2;
@ -200,21 +201,21 @@ void A_BishopPuff (AActor *actor)
//
//============================================================================
void A_BishopPainBlur (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BishopPainBlur)
{
AActor *mo;
if (pr_pain() < 64)
{
actor->SetState (actor->FindState ("Blur"));
self->SetState (self->FindState ("Blur"));
return;
}
fixed_t x = actor->x + (pr_pain.Random2()<<12);
fixed_t y = actor->y + (pr_pain.Random2()<<12);
fixed_t z = actor->z + (pr_pain.Random2()<<11);
fixed_t x = self->x + (pr_pain.Random2()<<12);
fixed_t y = self->y + (pr_pain.Random2()<<12);
fixed_t z = self->z + (pr_pain.Random2()<<11);
mo = Spawn ("BishopPainBlur", x, y, z, ALLOW_REPLACE);
if (mo)
{
mo->angle = actor->angle;
mo->angle = self->angle;
}
}

View file

@ -2,6 +2,7 @@
#include "p_enemy.h"
#include "a_action.h"
#include "m_random.h"
#include "thingdef/thingdef.h"
static FRandom pr_centaurdefend ("CentaurDefend");
@ -11,14 +12,14 @@ static FRandom pr_centaurdefend ("CentaurDefend");
//
//============================================================================
void A_CentaurDefend (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CentaurDefend)
{
A_FaceTarget (actor);
if (actor->CheckMeleeRange() && pr_centaurdefend() < 32)
A_FaceTarget (self);
if (self->CheckMeleeRange() && pr_centaurdefend() < 32)
{
// This should unset REFLECTIVE as well
// (unless you want the Centaur to reflect projectiles forever!)
A_UnSetReflectiveInvulnerable (actor);
actor->SetState (actor->MeleeState);
self->flags2&=~(MF2_REFLECTIVE|MF2_INVULNERABLE);
self->SetState (self->MeleeState);
}
}

View file

@ -10,6 +10,7 @@
#include "p_pspr.h"
#include "gstrings.h"
#include "a_hexenglobal.h"
#include "thingdef/thingdef.h"
const fixed_t FLAMESPEED = fixed_t(0.45*FRACUNIT);
const fixed_t CFLAMERANGE = 12*64*FRACUNIT;
@ -123,22 +124,22 @@ void ACFlameMissile::Tick ()
//
//============================================================================
void A_CFlameAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CFlameAttack)
{
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
}
P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACFlameMissile));
S_Sound (actor, CHAN_WEAPON, "ClericFlameFire", 1, ATTN_NORM);
P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACFlameMissile));
S_Sound (self, CHAN_WEAPON, "ClericFlameFire", 1, ATTN_NORM);
}
//============================================================================
@ -147,13 +148,13 @@ void A_CFlameAttack (AActor *actor)
//
//============================================================================
void A_CFlamePuff (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CFlamePuff)
{
A_UnHideThing (actor);
actor->momx = 0;
actor->momy = 0;
actor->momz = 0;
S_Sound (actor, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM);
self->renderflags &= ~RF_INVISIBLE;
self->momx = 0;
self->momy = 0;
self->momz = 0;
S_Sound (self, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM);
}
//============================================================================
@ -162,16 +163,16 @@ void A_CFlamePuff (AActor *actor)
//
//============================================================================
void A_CFlameMissile (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile)
{
int i;
int an, an90;
fixed_t dist;
AActor *mo;
A_UnHideThing (actor);
S_Sound (actor, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM);
AActor *BlockingMobj = actor->BlockingMobj;
self->renderflags &= ~RF_INVISIBLE;
S_Sound (self, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM);
AActor *BlockingMobj = self->BlockingMobj;
if (BlockingMobj && BlockingMobj->flags&MF_SHOOTABLE)
{ // Hit something, so spawn the flame circle around the thing
dist = BlockingMobj->radius+18*FRACUNIT;
@ -185,7 +186,7 @@ void A_CFlameMissile (AActor *actor)
if (mo)
{
mo->angle = an<<ANGLETOFINESHIFT;
mo->target = actor->target;
mo->target = self->target;
mo->momx = mo->special1 = FixedMul(FLAMESPEED, finecosine[an]);
mo->momy = mo->special2 = FixedMul(FLAMESPEED, finesine[an]);
mo->tics -= pr_missile()&3;
@ -196,13 +197,13 @@ void A_CFlameMissile (AActor *actor)
if(mo)
{
mo->angle = ANG180+(an<<ANGLETOFINESHIFT);
mo->target = actor->target;
mo->target = self->target;
mo->momx = mo->special1 = FixedMul(-FLAMESPEED, finecosine[an]);
mo->momy = mo->special2 = FixedMul(-FLAMESPEED, finesine[an]);
mo->tics -= pr_missile()&3;
}
}
actor->SetState (actor->SpawnState);
self->SetState (self->SpawnState);
}
}
@ -212,12 +213,12 @@ void A_CFlameMissile (AActor *actor)
//
//============================================================================
void A_CFlameRotate (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CFlameRotate)
{
int an;
an = (actor->angle+ANG90)>>ANGLETOFINESHIFT;
actor->momx = actor->special1+FixedMul(FLAMEROTSPEED, finecosine[an]);
actor->momy = actor->special2+FixedMul(FLAMEROTSPEED, finesine[an]);
actor->angle += ANG90/15;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
self->momx = self->special1+FixedMul(FLAMEROTSPEED, finecosine[an]);
self->momy = self->special2+FixedMul(FLAMEROTSPEED, finesine[an]);
self->angle += ANG90/15;
}

View file

@ -7,6 +7,7 @@
#include "a_hexenglobal.h"
#include "gstrings.h"
#include "a_weaponpiece.h"
#include "thingdef/thingdef.h"
#define BLAST_FULLSTRENGTH 255
@ -18,15 +19,6 @@ static FRandom pr_checkscream ("CCheckScream");
static FRandom pr_spiritslam ("CHolySlam");
static FRandom pr_wraithvergedrop ("WraithvergeDrop");
void A_CHolyAttack2 (AActor *);
void A_CHolyTail (AActor *);
void A_CHolySeek (AActor *);
void A_CHolyCheckScream (AActor *);
void A_DropWraithvergePieces (AActor *);
void A_CHolyAttack (AActor *);
void A_CHolyPalette (AActor *);
void SpawnSpiritTail (AActor *spirit);
//==========================================================================
@ -180,20 +172,6 @@ bool AHolySpirit::IsOkayToAttack (AActor *link)
return false;
}
//============================================================================
//
// A_CHolyAttack3
//
// Spawns the spirits
//============================================================================
void A_CHolyAttack3 (AActor *actor)
{
AActor * missile = P_SpawnMissileZ (actor, actor->z + 40*FRACUNIT, actor->target, PClass::FindClass ("HolyMissile"));
if (missile != NULL) missile->tracer = NULL; // No initial target
S_Sound (actor, CHAN_WEAPON, "HolySymbolFire", 1, ATTN_NORM);
}
//============================================================================
//
// A_CHolyAttack2
@ -201,7 +179,7 @@ void A_CHolyAttack3 (AActor *actor)
// Spawns the spirits
//============================================================================
void A_CHolyAttack2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack2)
{
int j;
int i;
@ -209,7 +187,7 @@ void A_CHolyAttack2 (AActor *actor)
for (j = 0; j < 4; j++)
{
mo = Spawn<AHolySpirit> (actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn<AHolySpirit> (self->x, self->y, self->z, ALLOW_REPLACE);
if (!mo)
{
continue;
@ -230,19 +208,19 @@ void A_CHolyAttack2 (AActor *actor)
mo->special2 = ((32+(i&7))<<16)+32+(pr_holyatk2()&7);
break;
}
mo->z = actor->z;
mo->angle = actor->angle+(ANGLE_45+ANGLE_45/2)-ANGLE_45*j;
mo->z = self->z;
mo->angle = self->angle+(ANGLE_45+ANGLE_45/2)-ANGLE_45*j;
P_ThrustMobj(mo, mo->angle, mo->Speed);
mo->target = actor->target;
mo->target = self->target;
mo->args[0] = 10; // initial turn value
mo->args[1] = 0; // initial look angle
if (deathmatch)
{ // Ghosts last slightly less longer in DeathMatch
mo->health = 85;
}
if (actor->tracer)
if (self->tracer)
{
mo->tracer = actor->tracer;
mo->tracer = self->tracer;
mo->flags |= MF_NOCLIP|MF_SKULLFLY;
mo->flags &= ~MF_MISSILE;
}
@ -278,26 +256,26 @@ void SpawnSpiritTail (AActor *spirit)
//
//============================================================================
void A_CHolyAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CHolyAttack)
{
player_t *player;
AActor *linetarget;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
ACWeapWraithverge *weapon = static_cast<ACWeapWraithverge *> (actor->player->ReadyWeapon);
ACWeapWraithverge *weapon = static_cast<ACWeapWraithverge *> (self->player->ReadyWeapon);
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
}
AActor * missile = P_SpawnPlayerMissile (actor, 0,0,0, PClass::FindClass ("HolyMissile"), actor->angle, &linetarget);
AActor * missile = P_SpawnPlayerMissile (self, 0,0,0, PClass::FindClass ("HolyMissile"), self->angle, &linetarget);
if (missile != NULL) missile->tracer = linetarget;
weapon->CHolyCount = 3;
S_Sound (actor, CHAN_WEAPON, "HolySymbolFire", 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, "HolySymbolFire", 1, ATTN_NORM);
}
//============================================================================
@ -306,11 +284,11 @@ void A_CHolyAttack (AActor *actor)
//
//============================================================================
void A_CHolyPalette (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CHolyPalette)
{
if (actor->player != NULL)
if (self->player != NULL)
{
ACWeapWraithverge *weapon = static_cast<ACWeapWraithverge *> (actor->player->ReadyWeapon);
ACWeapWraithverge *weapon = static_cast<ACWeapWraithverge *> (self->player->ReadyWeapon);
if (weapon != NULL && weapon->CHolyCount != 0)
{
weapon->CHolyCount--;
@ -389,26 +367,26 @@ static void CHolyTailRemove (AActor *actor)
//
//============================================================================
void A_CHolyTail (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CHolyTail)
{
AActor *parent;
parent = actor->target;
parent = self->target;
if (parent == NULL || parent->health <= 0) // better check for health than current state - it's safer!
{ // Ghost removed, so remove all tail parts
CHolyTailRemove (actor);
CHolyTailRemove (self);
return;
}
else
{
if (P_TryMove (actor,
if (P_TryMove (self,
parent->x - 14*finecosine[parent->angle>>ANGLETOFINESHIFT],
parent->y - 14*finesine[parent->angle>>ANGLETOFINESHIFT], true))
{
actor->z = parent->z-5*FRACUNIT;
self->z = parent->z-5*FRACUNIT;
}
CHolyTailFollow (actor, 10*FRACUNIT);
CHolyTailFollow (self, 10*FRACUNIT);
}
}
@ -546,28 +524,28 @@ static void CHolyWeave (AActor *actor)
//
//============================================================================
void A_CHolySeek (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CHolySeek)
{
actor->health--;
if (actor->health <= 0)
self->health--;
if (self->health <= 0)
{
actor->momx >>= 2;
actor->momy >>= 2;
actor->momz = 0;
actor->SetState (actor->FindState(NAME_Death));
actor->tics -= pr_holyseek()&3;
self->momx >>= 2;
self->momy >>= 2;
self->momz = 0;
self->SetState (self->FindState(NAME_Death));
self->tics -= pr_holyseek()&3;
return;
}
if (actor->tracer)
if (self->tracer)
{
CHolySeekerMissile (actor, actor->args[0]*ANGLE_1,
actor->args[0]*ANGLE_1*2);
CHolySeekerMissile (self, self->args[0]*ANGLE_1,
self->args[0]*ANGLE_1*2);
if (!((level.time+7)&15))
{
actor->args[0] = 5+(pr_holyseek()/20);
self->args[0] = 5+(pr_holyseek()/20);
}
}
CHolyWeave (actor);
CHolyWeave (self);
}
//============================================================================
@ -576,16 +554,16 @@ void A_CHolySeek (AActor *actor)
//
//============================================================================
void A_CHolyCheckScream (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CHolyCheckScream)
{
A_CHolySeek (actor);
CALL_ACTION(A_CHolySeek, self);
if (pr_checkscream() < 20)
{
S_Sound (actor, CHAN_VOICE, "SpiritActive", 1, ATTN_NORM);
S_Sound (self, CHAN_VOICE, "SpiritActive", 1, ATTN_NORM);
}
if (!actor->tracer)
if (!self->tracer)
{
CHolyFindTarget(actor);
CHolyFindTarget(self);
}
}
@ -596,10 +574,12 @@ void A_CHolyCheckScream (AActor *actor)
//
//============================================================================
void A_ClericAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ClericAttack)
{
extern void A_CHolyAttack3 (AActor *actor);
if (!self->target) return;
if (!actor->target) return;
A_CHolyAttack3 (actor);
AActor * missile = P_SpawnMissileZ (self, self->z + 40*FRACUNIT, self->target, PClass::FindClass ("HolyMissile"));
if (missile != NULL) missile->tracer = NULL; // No initial target
S_Sound (self, CHAN_WEAPON, "HolySymbolFire", 1, ATTN_NORM);
}

View file

@ -1,6 +1,7 @@
#include "m_random.h"
#include "p_local.h"
#include "a_hexenglobal.h"
#include "thingdef/thingdef.h"
extern void AdjustPlayerAngle (AActor *pmo, AActor *linetarget);
@ -12,7 +13,7 @@ static FRandom pr_atk ("CMaceAttack");
//
//===========================================================================
void A_CMaceAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CMaceAttack)
{
angle_t angle;
int damage;
@ -21,7 +22,7 @@ void A_CMaceAttack (AActor *actor)
player_t *player;
AActor *linetarget;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}

View file

@ -10,16 +10,11 @@
#include "p_pspr.h"
#include "gstrings.h"
#include "a_hexenglobal.h"
#include "thingdef/thingdef.h"
static FRandom pr_staffcheck ("CStaffCheck");
static FRandom pr_blink ("CStaffBlink");
void A_CStaffInitBlink (AActor *actor);
void A_CStaffCheckBlink (AActor *actor);
void A_CStaffCheck (AActor *actor);
void A_CStaffAttack (AActor *actor);
void A_CStaffMissileSlither (AActor *);
// Serpent Staff Missile ----------------------------------------------------
class ACStaffMissile : public AActor
@ -48,7 +43,7 @@ int ACStaffMissile::DoSpecialDamage (AActor *target, int damage)
//
//============================================================================
void A_CStaffCheck (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheck)
{
AActor *pmo;
int damage;
@ -59,11 +54,11 @@ void A_CStaffCheck (AActor *actor)
player_t *player;
AActor *linetarget;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
pmo = player->mo;
damage = 20+(pr_staffcheck()&15);
@ -119,33 +114,33 @@ void A_CStaffCheck (AActor *actor)
//
//============================================================================
void A_CStaffAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CStaffAttack)
{
AActor *mo;
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
}
mo = P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACStaffMissile), actor->angle-(ANG45/15));
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->angle-(ANG45/15));
if (mo)
{
mo->special2 = 32;
}
mo = P_SpawnPlayerMissile (actor, RUNTIME_CLASS(ACStaffMissile), actor->angle+(ANG45/15));
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(ACStaffMissile), self->angle+(ANG45/15));
if (mo)
{
mo->special2 = 0;
}
S_Sound (actor, CHAN_WEAPON, "ClericCStaffFire", 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, "ClericCStaffFire", 1, ATTN_NORM);
}
//============================================================================
@ -154,21 +149,21 @@ void A_CStaffAttack (AActor *actor)
//
//============================================================================
void A_CStaffMissileSlither (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CStaffMissileSlither)
{
fixed_t newX, newY;
int weaveXY;
int angle;
weaveXY = actor->special2;
angle = (actor->angle+ANG90)>>ANGLETOFINESHIFT;
newX = actor->x-FixedMul(finecosine[angle], FloatBobOffsets[weaveXY]);
newY = actor->y-FixedMul(finesine[angle], FloatBobOffsets[weaveXY]);
weaveXY = self->special2;
angle = (self->angle+ANG90)>>ANGLETOFINESHIFT;
newX = self->x-FixedMul(finecosine[angle], FloatBobOffsets[weaveXY]);
newY = self->y-FixedMul(finesine[angle], FloatBobOffsets[weaveXY]);
weaveXY = (weaveXY+3)&63;
newX += FixedMul(finecosine[angle], FloatBobOffsets[weaveXY]);
newY += FixedMul(finesine[angle], FloatBobOffsets[weaveXY]);
P_TryMove (actor, newX, newY, true);
actor->special2 = weaveXY;
P_TryMove (self, newX, newY, true);
self->special2 = weaveXY;
}
//============================================================================
@ -177,9 +172,9 @@ void A_CStaffMissileSlither (AActor *actor)
//
//============================================================================
void A_CStaffInitBlink (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CStaffInitBlink)
{
actor->special1 = (pr_blink()>>1)+20;
self->special1 = (pr_blink()>>1)+20;
}
//============================================================================
@ -188,15 +183,15 @@ void A_CStaffInitBlink (AActor *actor)
//
//============================================================================
void A_CStaffCheckBlink (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheckBlink)
{
if (!--actor->special1)
if (!--self->special1)
{
P_SetPsprite (actor->player, ps_weapon, actor->FindState ("Blink"));
actor->special1 = (pr_blink()+50)>>2;
P_SetPsprite (self->player, ps_weapon, self->FindState ("Blink"));
self->special1 = (pr_blink()+50)>>2;
}
else
{
A_WeaponReady (actor);
CALL_ACTION(A_WeaponReady, self);
}
}

View file

@ -5,19 +5,15 @@
#include "a_action.h"
#include "m_random.h"
#include "s_sound.h"
#include "thingdef/thingdef.h"
static FRandom pr_dragonseek ("DragonSeek");
static FRandom pr_dragonflight ("DragonFlight");
static FRandom pr_dragonflap ("DragonFlap");
static FRandom pr_dragonfx2 ("DragonFX2");
void A_DragonInitFlight (AActor *);
void A_DragonFlap (AActor *);
void A_DragonFlight (AActor *);
void A_DragonPain (AActor *);
void A_DragonAttack (AActor *);
void A_DragonCheckCrash (AActor *);
void A_DragonFX2 (AActor *);
DECLARE_ACTION(A_DragonFlight)
//============================================================================
//
@ -165,20 +161,20 @@ static void DragonSeek (AActor *actor, angle_t thresh, angle_t turnMax)
//
//============================================================================
void A_DragonInitFlight (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_DragonInitFlight)
{
FActorIterator iterator (actor->tid);
FActorIterator iterator (self->tid);
do
{ // find the first tid identical to the dragon's tid
actor->tracer = iterator.Next ();
if (actor->tracer == NULL)
self->tracer = iterator.Next ();
if (self->tracer == NULL)
{
actor->SetState (actor->SpawnState);
self->SetState (self->SpawnState);
return;
}
} while (actor->tracer == actor);
actor->RemoveFromHash ();
} while (self->tracer == self);
self->RemoveFromHash ();
}
//============================================================================
@ -187,36 +183,36 @@ void A_DragonInitFlight (AActor *actor)
//
//============================================================================
void A_DragonFlight (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_DragonFlight)
{
angle_t angle;
DragonSeek (actor, 4*ANGLE_1, 8*ANGLE_1);
if (actor->target)
DragonSeek (self, 4*ANGLE_1, 8*ANGLE_1);
if (self->target)
{
if(!(actor->target->flags&MF_SHOOTABLE))
if(!(self->target->flags&MF_SHOOTABLE))
{ // target died
actor->target = NULL;
self->target = NULL;
return;
}
angle = R_PointToAngle2(actor->x, actor->y, actor->target->x,
actor->target->y);
if (abs(actor->angle-angle) < ANGLE_45/2 && actor->CheckMeleeRange())
angle = R_PointToAngle2(self->x, self->y, self->target->x,
self->target->y);
if (abs(self->angle-angle) < ANGLE_45/2 && self->CheckMeleeRange())
{
int damage = pr_dragonflight.HitDice (8);
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, actor->target, actor);
S_Sound (actor, CHAN_WEAPON, actor->AttackSound, 1, ATTN_NORM);
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, self->target, self);
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
}
else if (abs(actor->angle-angle) <= ANGLE_1*20)
else if (abs(self->angle-angle) <= ANGLE_1*20)
{
actor->SetState (actor->MissileState);
S_Sound (actor, CHAN_WEAPON, actor->AttackSound, 1, ATTN_NORM);
self->SetState (self->MissileState);
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
}
}
else
{
P_LookForPlayers (actor, true);
P_LookForPlayers (self, true);
}
}
@ -226,16 +222,16 @@ void A_DragonFlight (AActor *actor)
//
//============================================================================
void A_DragonFlap (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_DragonFlap)
{
A_DragonFlight (actor);
CALL_ACTION(A_DragonFlight, self);
if (pr_dragonflap() < 240)
{
S_Sound (actor, CHAN_BODY, "DragonWingflap", 1, ATTN_NORM);
S_Sound (self, CHAN_BODY, "DragonWingflap", 1, ATTN_NORM);
}
else
{
actor->PlayActiveSound ();
self->PlayActiveSound ();
}
}
@ -245,9 +241,9 @@ void A_DragonFlap (AActor *actor)
//
//============================================================================
void A_DragonAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_DragonAttack)
{
P_SpawnMissile (actor, actor->target, PClass::FindClass ("DragonFireball"));
P_SpawnMissile (self, self->target, PClass::FindClass ("DragonFireball"));
}
//============================================================================
@ -256,7 +252,7 @@ void A_DragonAttack (AActor *actor)
//
//============================================================================
void A_DragonFX2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_DragonFX2)
{
AActor *mo;
int i;
@ -265,15 +261,15 @@ void A_DragonFX2 (AActor *actor)
delay = 16+(pr_dragonfx2()>>3);
for (i = 1+(pr_dragonfx2()&3); i; i--)
{
fixed_t x = actor->x+((pr_dragonfx2()-128)<<14);
fixed_t y = actor->y+((pr_dragonfx2()-128)<<14);
fixed_t z = actor->z+((pr_dragonfx2()-128)<<12);
fixed_t x = self->x+((pr_dragonfx2()-128)<<14);
fixed_t y = self->y+((pr_dragonfx2()-128)<<14);
fixed_t z = self->z+((pr_dragonfx2()-128)<<12);
mo = Spawn ("DragonExplosion", x, y, z, ALLOW_REPLACE);
if (mo)
{
mo->tics = delay+(pr_dragonfx2()&3)*i*2;
mo->target = actor->target;
mo->target = self->target;
}
}
}
@ -284,12 +280,12 @@ void A_DragonFX2 (AActor *actor)
//
//============================================================================
void A_DragonPain (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_DragonPain)
{
A_Pain (actor);
if (!actor->tracer)
CALL_ACTION(A_Pain, self);
if (!self->tracer)
{ // no destination spot yet
actor->SetState (actor->SeeState);
self->SetState (self->SeeState);
}
}
@ -299,10 +295,10 @@ void A_DragonPain (AActor *actor)
//
//============================================================================
void A_DragonCheckCrash (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_DragonCheckCrash)
{
if (actor->z <= actor->floorz)
if (self->z <= self->floorz)
{
actor->SetState (actor->FindState ("Crash"));
self->SetState (self->FindState ("Crash"));
}
}

View file

@ -11,6 +11,7 @@
#include "gstrings.h"
#include "a_hexenglobal.h"
#include "p_effect.h"
#include "thingdef/thingdef.h"
#define AXERANGE ((fixed_t)(2.25*MELEERANGE))
@ -67,11 +68,11 @@ FState *AFWeapAxe::GetAtkState (bool hold)
//
//============================================================================
void A_FAxeCheckReady (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReady)
{
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
@ -81,7 +82,7 @@ void A_FAxeCheckReady (AActor *actor)
}
else
{
A_WeaponReady (actor);
CALL_ACTION(A_WeaponReady, self);
}
}
@ -91,11 +92,11 @@ void A_FAxeCheckReady (AActor *actor)
//
//============================================================================
void A_FAxeCheckReadyG (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReadyG)
{
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
@ -105,7 +106,7 @@ void A_FAxeCheckReadyG (AActor *actor)
}
else
{
A_WeaponReady (actor);
CALL_ACTION(A_WeaponReady, self);
}
}
@ -115,11 +116,11 @@ void A_FAxeCheckReadyG (AActor *actor)
//
//============================================================================
void A_FAxeCheckUp (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUp)
{
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
@ -129,7 +130,7 @@ void A_FAxeCheckUp (AActor *actor)
}
else
{
A_Raise (actor);
CALL_ACTION(A_Raise, self);
}
}
@ -139,11 +140,11 @@ void A_FAxeCheckUp (AActor *actor)
//
//============================================================================
void A_FAxeCheckUpG (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUpG)
{
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
@ -153,7 +154,7 @@ void A_FAxeCheckUpG (AActor *actor)
}
else
{
A_Raise (actor);
CALL_ACTION(A_Raise, self);
}
}
@ -163,11 +164,11 @@ void A_FAxeCheckUpG (AActor *actor)
//
//============================================================================
void A_FAxeCheckAtk (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckAtk)
{
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
@ -183,7 +184,7 @@ void A_FAxeCheckAtk (AActor *actor)
//
//============================================================================
void A_FAxeAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FAxeAttack)
{
angle_t angle;
fixed_t power;
@ -196,7 +197,7 @@ void A_FAxeAttack (AActor *actor)
const PClass *pufftype;
AActor *linetarget;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}

View file

@ -10,6 +10,7 @@
#include "p_pspr.h"
#include "gstrings.h"
#include "a_hexenglobal.h"
#include "thingdef/thingdef.h"
const fixed_t HAMMER_RANGE = MELEERANGE+MELEERANGE/2;
@ -23,7 +24,7 @@ extern void AdjustPlayerAngle (AActor *pmo, AActor *linetarget);
//
//============================================================================
void A_FHammerAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FHammerAttack)
{
angle_t angle;
int damage;
@ -33,7 +34,7 @@ void A_FHammerAttack (AActor *actor)
player_t *player;
AActor *linetarget;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
@ -98,12 +99,12 @@ hammerdone:
//
//============================================================================
void A_FHammerThrow (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FHammerThrow)
{
AActor *mo;
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}

View file

@ -8,6 +8,7 @@
#include "p_enemy.h"
#include "a_action.h"
#include "a_hexenglobal.h"
#include "thingdef/thingdef.h"
// Fighter Weapon Base Class ------------------------------------------------
@ -131,7 +132,7 @@ void AdjustPlayerAngle (AActor *pmo, AActor *linetarget)
//
//============================================================================
void A_FPunchAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FPunchAttack)
{
angle_t angle;
int damage;
@ -142,7 +143,7 @@ void A_FPunchAttack (AActor *actor)
const PClass *pufftype;
AActor *linetarget;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}

View file

@ -60,7 +60,7 @@ bool AFighterWeaponPiece::TryPickup (AActor *toucher)
//
//============================================================================
void A_DropWeaponPieces (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_DropWeaponPieces)
{
int index=CheckIndex(3);
if (index<0) return;
@ -70,12 +70,12 @@ void A_DropWeaponPieces (AActor *actor)
const PClass *cls = PClass::FindClass((ENamedName)StateParameters[index+j]);
if (cls)
{
AActor *piece = Spawn (cls, actor->x, actor->y, actor->z, ALLOW_REPLACE);
AActor *piece = Spawn (cls, self->x, self->y, self->z, ALLOW_REPLACE);
if (piece != NULL)
{
piece->momx = actor->momx + finecosine[fineang];
piece->momy = actor->momy + finesine[fineang];
piece->momz = actor->momz;
piece->momx = self->momx + finecosine[fineang];
piece->momy = self->momy + finesine[fineang];
piece->momz = self->momz;
piece->flags |= MF_DROPPED;
fineang += FINEANGLES/3;
j = (j == 0) ? (pr_quietusdrop() & 1) + 1 : 3-j;
@ -112,26 +112,26 @@ int AFSwordMissile::DoSpecialDamage(AActor *victim, AActor *source, int damage)
//
//============================================================================
void A_FSwordAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FSwordAttack)
{
player_t *player;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
}
P_SpawnPlayerMissile (actor, 0, 0, -10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), actor->angle+ANGLE_45/4);
P_SpawnPlayerMissile (actor, 0, 0, -5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), actor->angle+ANGLE_45/8);
P_SpawnPlayerMissile (actor, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), actor->angle);
P_SpawnPlayerMissile (actor, 0, 0, 5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), actor->angle-ANGLE_45/8);
P_SpawnPlayerMissile (actor, 0, 0, 10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), actor->angle-ANGLE_45/4);
S_Sound (actor, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM);
P_SpawnPlayerMissile (self, 0, 0, -10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->angle+ANGLE_45/4);
P_SpawnPlayerMissile (self, 0, 0, -5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->angle+ANGLE_45/8);
P_SpawnPlayerMissile (self, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), self->angle);
P_SpawnPlayerMissile (self, 0, 0, 5*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->angle-ANGLE_45/8);
P_SpawnPlayerMissile (self, 0, 0, 10*FRACUNIT, RUNTIME_CLASS(AFSwordMissile), self->angle-ANGLE_45/4);
S_Sound (self, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM);
}
//============================================================================
@ -140,15 +140,15 @@ void A_FSwordAttack (AActor *actor)
//
//============================================================================
void A_FSwordFlames (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FSwordFlames)
{
int i;
for (i = 1+(pr_fswordflame()&3); i; i--)
{
fixed_t x = actor->x+((pr_fswordflame()-128)<<12);
fixed_t y = actor->y+((pr_fswordflame()-128)<<12);
fixed_t z = actor->z+((pr_fswordflame()-128)<<11);
fixed_t x = self->x+((pr_fswordflame()-128)<<12);
fixed_t y = self->y+((pr_fswordflame()-128)<<12);
fixed_t z = self->z+((pr_fswordflame()-128)<<11);
Spawn ("FSwordFlame", x, y, z, ALLOW_REPLACE);
}
}
@ -159,17 +159,17 @@ void A_FSwordFlames (AActor *actor)
//
//============================================================================
void A_FighterAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FighterAttack)
{
if (!actor->target) return;
if (!self->target) return;
angle_t angle = actor->angle;
angle_t angle = self->angle;
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/4, 0);
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/8, 0);
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AFSwordMissile), angle, 0);
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AFSwordMissile), angle-ANG45/8, 0);
P_SpawnMissileAngle (actor, RUNTIME_CLASS(AFSwordMissile), angle-ANG45/4, 0);
S_Sound (actor, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM);
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/4, 0);
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle+ANG45/8, 0);
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle, 0);
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle-ANG45/8, 0);
P_SpawnMissileAngle (self, RUNTIME_CLASS(AFSwordMissile), angle-ANG45/4, 0);
S_Sound (self, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM);
}

View file

@ -5,6 +5,7 @@
#include "p_enemy.h"
#include "a_action.h"
#include "m_random.h"
#include "thingdef/thingdef.h"
#define FIREDEMON_ATTACK_RANGE 64*8*FRACUNIT
@ -20,28 +21,6 @@ static FRandom pr_firedemonsplotch ("FiredSplotch");
// special2 whether strafing or not
//============================================================================
void A_FiredRocks (AActor *);
void A_FiredSpawnRock (AActor *);
void A_SmBounce (AActor *);
void A_FiredChase (AActor *);
void A_FiredAttack (AActor *);
void A_FiredSplotch (AActor *);
//============================================================================
//
// A_FiredRocks
//
//============================================================================
void A_FiredRocks (AActor *actor)
{
A_FiredSpawnRock (actor);
A_FiredSpawnRock (actor);
A_FiredSpawnRock (actor);
A_FiredSpawnRock (actor);
A_FiredSpawnRock (actor);
}
//============================================================================
//
// A_FiredSpawnRock
@ -92,19 +71,34 @@ void A_FiredSpawnRock (AActor *actor)
actor->flags &= ~MF_JUSTATTACKED;
}
//============================================================================
//
// A_FiredRocks
//
//============================================================================
DEFINE_ACTION_FUNCTION(AActor, A_FiredRocks)
{
A_FiredSpawnRock (self);
A_FiredSpawnRock (self);
A_FiredSpawnRock (self);
A_FiredSpawnRock (self);
A_FiredSpawnRock (self);
}
//============================================================================
//
// A_SmBounce
//
//============================================================================
void A_SmBounce (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SmBounce)
{
// give some more momentum (x,y,&z)
actor->z = actor->floorz + FRACUNIT;
actor->momz = (2*FRACUNIT) + (pr_smbounce() << 10);
actor->momx = pr_smbounce()%3<<FRACBITS;
actor->momy = pr_smbounce()%3<<FRACBITS;
self->z = self->floorz + FRACUNIT;
self->momz = (2*FRACUNIT) + (pr_smbounce() << 10);
self->momx = pr_smbounce()%3<<FRACBITS;
self->momy = pr_smbounce()%3<<FRACBITS;
}
//============================================================================
@ -113,12 +107,12 @@ void A_SmBounce (AActor *actor)
//
//============================================================================
void A_FiredAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FiredAttack)
{
if (actor->target == NULL)
if (self->target == NULL)
return;
AActor *mo = P_SpawnMissile (actor, actor->target, PClass::FindClass ("FireDemonMissile"));
if (mo) S_Sound (actor, CHAN_BODY, "FireDemonAttack", 1, ATTN_NORM);
AActor *mo = P_SpawnMissile (self, self->target, PClass::FindClass ("FireDemonMissile"));
if (mo) S_Sound (self, CHAN_BODY, "FireDemonAttack", 1, ATTN_NORM);
}
//============================================================================
@ -127,89 +121,89 @@ void A_FiredAttack (AActor *actor)
//
//============================================================================
void A_FiredChase (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FiredChase)
{
int weaveindex = actor->special1;
AActor *target = actor->target;
int weaveindex = self->special1;
AActor *target = self->target;
angle_t ang;
fixed_t dist;
if (actor->reactiontime) actor->reactiontime--;
if (actor->threshold) actor->threshold--;
if (self->reactiontime) self->reactiontime--;
if (self->threshold) self->threshold--;
// Float up and down
actor->z += FloatBobOffsets[weaveindex];
actor->special1 = (weaveindex+2)&63;
self->z += FloatBobOffsets[weaveindex];
self->special1 = (weaveindex+2)&63;
// Ensure it stays above certain height
if (actor->z < actor->floorz + (64*FRACUNIT))
if (self->z < self->floorz + (64*FRACUNIT))
{
actor->z += 2*FRACUNIT;
self->z += 2*FRACUNIT;
}
if(!actor->target || !(actor->target->flags&MF_SHOOTABLE))
if(!self->target || !(self->target->flags&MF_SHOOTABLE))
{ // Invalid target
P_LookForPlayers (actor,true);
P_LookForPlayers (self,true);
return;
}
// Strafe
if (actor->special2 > 0)
if (self->special2 > 0)
{
actor->special2--;
self->special2--;
}
else
{
actor->special2 = 0;
actor->momx = actor->momy = 0;
dist = P_AproxDistance (actor->x - target->x, actor->y - target->y);
self->special2 = 0;
self->momx = self->momy = 0;
dist = P_AproxDistance (self->x - target->x, self->y - target->y);
if (dist < FIREDEMON_ATTACK_RANGE)
{
if (pr_firedemonchase() < 30)
{
ang = R_PointToAngle2 (actor->x, actor->y, target->x, target->y);
ang = R_PointToAngle2 (self->x, self->y, target->x, target->y);
if (pr_firedemonchase() < 128)
ang += ANGLE_90;
else
ang -= ANGLE_90;
ang >>= ANGLETOFINESHIFT;
actor->momx = finecosine[ang] << 3; //FixedMul (8*FRACUNIT, finecosine[ang]);
actor->momy = finesine[ang] << 3; //FixedMul (8*FRACUNIT, finesine[ang]);
actor->special2 = 3; // strafe time
self->momx = finecosine[ang] << 3; //FixedMul (8*FRACUNIT, finecosine[ang]);
self->momy = finesine[ang] << 3; //FixedMul (8*FRACUNIT, finesine[ang]);
self->special2 = 3; // strafe time
}
}
}
FaceMovementDirection (actor);
FaceMovementDirection (self);
// Normal movement
if (!actor->special2)
if (!self->special2)
{
if (--actor->movecount<0 || !P_Move (actor))
if (--self->movecount<0 || !P_Move (self))
{
P_NewChaseDir (actor);
P_NewChaseDir (self);
}
}
// Do missile attack
if (!(actor->flags & MF_JUSTATTACKED))
if (!(self->flags & MF_JUSTATTACKED))
{
if (P_CheckMissileRange (actor) && (pr_firedemonchase() < 20))
if (P_CheckMissileRange (self) && (pr_firedemonchase() < 20))
{
actor->SetState (actor->MissileState);
actor->flags |= MF_JUSTATTACKED;
self->SetState (self->MissileState);
self->flags |= MF_JUSTATTACKED;
return;
}
}
else
{
actor->flags &= ~MF_JUSTATTACKED;
self->flags &= ~MF_JUSTATTACKED;
}
// make active sound
if (pr_firedemonchase() < 3)
{
actor->PlayActiveSound ();
self->PlayActiveSound ();
}
}
@ -219,18 +213,18 @@ void A_FiredChase (AActor *actor)
//
//============================================================================
void A_FiredSplotch (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FiredSplotch)
{
AActor *mo;
mo = Spawn ("FireDemonSplotch1", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn ("FireDemonSplotch1", self->x, self->y, self->z, ALLOW_REPLACE);
if (mo)
{
mo->momx = (pr_firedemonsplotch() - 128) << 11;
mo->momy = (pr_firedemonsplotch() - 128) << 11;
mo->momz = (pr_firedemonsplotch() << 10) + FRACUNIT*3;
}
mo = Spawn ("FireDemonSplotch2", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn ("FireDemonSplotch2", self->x, self->y, self->z, ALLOW_REPLACE);
if (mo)
{
mo->momx = (pr_firedemonsplotch() - 128) << 11;

View file

@ -10,17 +10,13 @@
#include "a_action.h"
#include "a_hexenglobal.h"
#include "w_wad.h"
#include "thingdef/thingdef.h"
static FRandom pr_poisonbag ("PoisonBag");
static FRandom pr_poisoncloud ("PoisonCloud");
static FRandom pr_poisoncloudd ("PoisonCloudDamage");
void A_PoisonBagInit (AActor *);
void A_PoisonBagDamage (AActor *);
void A_PoisonBagCheck (AActor *);
void A_CheckThrowBomb (AActor *);
void A_CheckThrowBomb2 (AActor *);
void A_TimeBomb(AActor *self);
DECLARE_ACTION(A_CheckThrowBomb)
// Poison Bag Artifact (Flechette) ------------------------------------------
@ -296,14 +292,14 @@ int APoisonCloud::DoSpecialDamage (AActor *victim, int damage)
//
//===========================================================================
void A_PoisonBagInit (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagInit)
{
AActor *mo;
mo = Spawn<APoisonCloud> (actor->x, actor->y, actor->z+28*FRACUNIT, ALLOW_REPLACE);
mo = Spawn<APoisonCloud> (self->x, self->y, self->z+28*FRACUNIT, ALLOW_REPLACE);
if (mo)
{
mo->target = actor->target;
mo->target = self->target;
}
}
@ -313,11 +309,11 @@ void A_PoisonBagInit (AActor *actor)
//
//===========================================================================
void A_PoisonBagCheck (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagCheck)
{
if (--actor->special1 <= 0)
if (--self->special1 <= 0)
{
actor->SetState (actor->FindState ("Death"));
self->SetState (self->FindState ("Death"));
}
else
{
@ -331,14 +327,14 @@ void A_PoisonBagCheck (AActor *actor)
//
//===========================================================================
void A_PoisonBagDamage (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagDamage)
{
int bobIndex;
P_RadiusAttack (actor, actor->target, 4, 40, actor->DamageType, true);
bobIndex = actor->special2;
actor->z += FloatBobOffsets[bobIndex]>>4;
actor->special2 = (bobIndex+1)&63;
P_RadiusAttack (self, self->target, 4, 40, self->DamageType, true);
bobIndex = self->special2;
self->z += FloatBobOffsets[bobIndex]>>4;
self->special2 = (bobIndex+1)&63;
}
//===========================================================================
@ -347,11 +343,11 @@ void A_PoisonBagDamage (AActor *actor)
//
//===========================================================================
void A_CheckThrowBomb (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CheckThrowBomb)
{
if (--actor->health <= 0)
if (--self->health <= 0)
{
actor->SetState (actor->FindState(NAME_Death));
self->SetState (self->FindState(NAME_Death));
}
}
@ -361,20 +357,20 @@ void A_CheckThrowBomb (AActor *actor)
//
//===========================================================================
void A_CheckThrowBomb2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CheckThrowBomb2)
{
// [RH] Check using actual velocity, although the momz < 2 check still stands
//if (abs(actor->momx) < FRACUNIT*3/2 && abs(actor->momy) < FRACUNIT*3/2
// && actor->momz < 2*FRACUNIT)
if (actor->momz < 2*FRACUNIT &&
TMulScale32 (actor->momx, actor->momx, actor->momy, actor->momy, actor->momz, actor->momz)
//if (abs(self->momx) < FRACUNIT*3/2 && abs(self->momy) < FRACUNIT*3/2
// && self->momz < 2*FRACUNIT)
if (self->momz < 2*FRACUNIT &&
TMulScale32 (self->momx, self->momx, self->momy, self->momy, self->momz, self->momz)
< (3*3)/(2*2))
{
actor->SetState (actor->SpawnState + 6);
actor->z = actor->floorz;
actor->momz = 0;
actor->flags2 &= ~MF2_BOUNCETYPE;
actor->flags &= ~MF_MISSILE;
self->SetState (self->SpawnState + 6);
self->z = self->floorz;
self->momz = 0;
self->flags2 &= ~MF2_BOUNCETYPE;
self->flags &= ~MF_MISSILE;
}
A_CheckThrowBomb (actor);
CALL_ACTION(A_CheckThrowBomb, self);
}

View file

@ -1,5 +1,6 @@
#include "m_random.h"
#include "p_local.h"
#include "thingdef/thingdef.h"
static FRandom pr_fogspawn ("FogSpawn");
@ -22,33 +23,33 @@ static FRandom pr_fogspawn ("FogSpawn");
//
//==========================================================================
void A_FogSpawn (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FogSpawn)
{
static const PClass *fogs[3] =
static const char *fogs[3] =
{
PClass::FindClass ("FogPatchSmall"),
PClass::FindClass ("FogPatchMedium"),
PClass::FindClass ("FogPatchLarge")
"FogPatchSmall",
"FogPatchMedium",
"FogPatchLarge"
};
AActor *mo=NULL;
angle_t delta;
if (actor->special1-- > 0) return;
if (self->special1-- > 0) return;
actor->special1 = actor->args[2]; // Reset frequency count
self->special1 = self->args[2]; // Reset frequency count
mo = Spawn (fogs[pr_fogspawn()%3], actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn (fogs[pr_fogspawn()%3], self->x, self->y, self->z, ALLOW_REPLACE);
if (mo)
{
delta = actor->args[1];
delta = self->args[1];
if (delta==0) delta=1;
mo->angle = actor->angle + (((pr_fogspawn()%delta)-(delta>>1))<<24);
mo->target = actor;
if (actor->args[0] < 1) actor->args[0] = 1;
mo->args[0] = (pr_fogspawn() % (actor->args[0]))+1; // Random speed
mo->args[3] = actor->args[3]; // Set lifetime
mo->angle = self->angle + (((pr_fogspawn()%delta)-(delta>>1))<<24);
mo->target = self;
if (self->args[0] < 1) self->args[0] = 1;
mo->args[0] = (pr_fogspawn() % (self->args[0]))+1; // Random speed
mo->args[3] = self->args[3]; // Set lifetime
mo->args[4] = 1; // Set to moving
mo->special2 = pr_fogspawn()&63;
}
@ -60,29 +61,29 @@ void A_FogSpawn (AActor *actor)
//
//==========================================================================
void A_FogMove (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FogMove)
{
int speed = actor->args[0]<<FRACBITS;
int speed = self->args[0]<<FRACBITS;
angle_t angle;
int weaveindex;
if (!(actor->args[4])) return;
if (!(self->args[4])) return;
if (actor->args[3]-- <= 0)
if (self->args[3]-- <= 0)
{
actor->SetStateNF (actor->FindState(NAME_Death));
self->SetStateNF (self->FindState(NAME_Death));
return;
}
if ((actor->args[3] % 4) == 0)
if ((self->args[3] % 4) == 0)
{
weaveindex = actor->special2;
actor->z += FloatBobOffsets[weaveindex]>>1;
actor->special2 = (weaveindex+1)&63;
weaveindex = self->special2;
self->z += FloatBobOffsets[weaveindex]>>1;
self->special2 = (weaveindex+1)&63;
}
angle = actor->angle>>ANGLETOFINESHIFT;
actor->momx = FixedMul(speed, finecosine[angle]);
actor->momy = FixedMul(speed, finesine[angle]);
angle = self->angle>>ANGLETOFINESHIFT;
self->momx = FixedMul(speed, finecosine[angle]);
self->momy = FixedMul(speed, finesine[angle]);
}

View file

@ -8,6 +8,7 @@
#include "a_hexenglobal.h"
#include "i_system.h"
#include "p_acs.h"
#include "thingdef/thingdef.h"
//============================================================================
//
@ -227,29 +228,29 @@ void ASorcBall1::DoFireSpell ()
// Spawn spinning balls above head - actor is sorcerer
//============================================================================
void A_SorcSpinBalls(AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SorcSpinBalls)
{
AActor *mo;
fixed_t z;
actor->SpawnState += 2; // [RH] Don't spawn balls again
A_SlowBalls(actor);
actor->args[0] = 0; // Currently no defense
actor->args[3] = SORC_NORMAL;
actor->args[4] = SORCBALL_INITIAL_SPEED; // Initial orbit speed
actor->special1 = ANGLE_1;
z = actor->z - actor->floorclip + actor->height;
self->SpawnState += 2; // [RH] Don't spawn balls again
A_SlowBalls(self);
self->args[0] = 0; // Currently no defense
self->args[3] = SORC_NORMAL;
self->args[4] = SORCBALL_INITIAL_SPEED; // Initial orbit speed
self->special1 = ANGLE_1;
z = self->z - self->floorclip + self->height;
mo = Spawn("SorcBall1", actor->x, actor->y, z, NO_REPLACE);
mo = Spawn("SorcBall1", self->x, self->y, z, NO_REPLACE);
if (mo)
{
mo->target = actor;
mo->target = self;
mo->special2 = SORCFX4_RAPIDFIRE_TIME;
}
mo = Spawn("SorcBall2", actor->x, actor->y, z, NO_REPLACE);
if (mo) mo->target = actor;
mo = Spawn("SorcBall3", actor->x, actor->y, z, NO_REPLACE);
if (mo) mo->target = actor;
mo = Spawn("SorcBall2", self->x, self->y, z, NO_REPLACE);
if (mo) mo->target = self;
mo = Spawn("SorcBall3", self->x, self->y, z, NO_REPLACE);
if (mo) mo->target = self;
}
@ -259,28 +260,28 @@ void A_SorcSpinBalls(AActor *actor)
//
//============================================================================
void A_SorcBallOrbit(AActor *ball)
DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit)
{
// [RH] If no parent, then die instead of crashing
if (ball->target == NULL)
if (self->target == NULL)
{
ball->SetState (ball->FindState(NAME_Pain));
self->SetState (self->FindState(NAME_Pain));
return;
}
ASorcBall *actor;
int x,y;
angle_t angle, baseangle;
int mode = ball->target->args[3];
AHeresiarch *parent = barrier_cast<AHeresiarch *>(ball->target);
int dist = parent->radius - (ball->radius<<1);
angle_t prevangle = ball->special1;
int mode = self->target->args[3];
AHeresiarch *parent = barrier_cast<AHeresiarch *>(self->target);
int dist = parent->radius - (self->radius<<1);
angle_t prevangle = self->special1;
if (!ball->IsKindOf (RUNTIME_CLASS(ASorcBall)))
if (!self->IsKindOf (RUNTIME_CLASS(ASorcBall)))
{
I_Error ("Corrupted sorcerer:\nTried to use a %s", RUNTIME_TYPE(ball)->TypeName.GetChars());
I_Error ("Corrupted sorcerer:\nTried to use a %s", RUNTIME_TYPE(self)->TypeName.GetChars());
}
actor = static_cast<ASorcBall *> (ball);
actor = static_cast<ASorcBall *> (self);
if (actor->target->health <= 0)
{
@ -317,7 +318,7 @@ void A_SorcBallOrbit(AActor *ball)
// Can stop now
actor->target->args[3] = SORC_FIRESPELL;
actor->target->args[4] = 0;
// Set angle so ball angle == sorcerer angle
// Set angle so self angle == sorcerer angle
parent->special1 = (int)(parent->angle - actor->AngleOffset);
}
else
@ -379,14 +380,14 @@ void A_SorcBallOrbit(AActor *ball)
//
// A_SpeedBalls
//
// Set balls to speed mode - actor is sorcerer
// Set balls to speed mode - self is sorcerer
//
//============================================================================
void A_SpeedBalls(AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SpeedBalls)
{
actor->args[3] = SORC_ACCELERATE; // speed mode
actor->args[2] = SORCBALL_TERMINAL_SPEED; // target speed
self->args[3] = SORC_ACCELERATE; // speed mode
self->args[2] = SORCBALL_TERMINAL_SPEED; // target speed
}
@ -409,7 +410,7 @@ void A_SlowBalls(AActor *actor)
// A_StopBalls
//
// Instant stop when rotation gets to ball in special2
// actor is sorcerer
// self is sorcerer
//
//============================================================================
@ -678,10 +679,10 @@ void A_SorcOffense2(AActor *actor)
//
//============================================================================
void A_SorcBossAttack(AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SorcBossAttack)
{
actor->args[3] = SORC_ACCELERATE;
actor->args[2] = SORCBALL_INITIAL_SPEED;
self->args[3] = SORC_ACCELERATE;
self->args[2] = SORCBALL_INITIAL_SPEED;
}
//============================================================================
@ -692,19 +693,19 @@ void A_SorcBossAttack(AActor *actor)
//
//============================================================================
void A_SpawnFizzle(AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnFizzle)
{
fixed_t x,y,z;
fixed_t dist = 5*FRACUNIT;
angle_t angle = actor->angle >> ANGLETOFINESHIFT;
fixed_t speed = actor->Speed;
angle_t angle = self->angle >> ANGLETOFINESHIFT;
fixed_t speed = self->Speed;
angle_t rangle;
AActor *mo;
int ix;
x = actor->x + FixedMul(dist,finecosine[angle]);
y = actor->y + FixedMul(dist,finesine[angle]);
z = actor->z - actor->floorclip + (actor->height>>1);
x = self->x + FixedMul(dist,finecosine[angle]);
y = self->y + FixedMul(dist,finesine[angle]);
z = self->z - self->floorclip + (self->height>>1);
for (ix=0; ix<5; ix++)
{
mo = Spawn("SorcSpark1", x, y, z, ALLOW_REPLACE);
@ -727,10 +728,10 @@ void A_SpawnFizzle(AActor *actor)
//
//============================================================================
void A_SorcFX1Seek(AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SorcFX1Seek)
{
A_DoBounceCheck (actor, "SorcererHeadScream");
P_SeekerMissile (actor,ANGLE_1*2,ANGLE_1*6);
A_DoBounceCheck (self, "SorcererHeadScream");
P_SeekerMissile (self,ANGLE_1*2,ANGLE_1*6);
}
@ -750,27 +751,27 @@ void A_SorcFX1Seek(AActor *actor)
//============================================================================
// Split ball in two
void A_SorcFX2Split(AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Split)
{
AActor *mo;
mo = Spawn(actor->GetClass(), actor->x, actor->y, actor->z, NO_REPLACE);
mo = Spawn(self->GetClass(), self->x, self->y, self->z, NO_REPLACE);
if (mo)
{
mo->target = actor->target;
mo->target = self->target;
mo->args[0] = 0; // CW
mo->special1 = actor->angle; // Set angle
mo->special1 = self->angle; // Set angle
mo->SetState (mo->FindState("Orbit"));
}
mo = Spawn(actor->GetClass(), actor->x, actor->y, actor->z, NO_REPLACE);
mo = Spawn(self->GetClass(), self->x, self->y, self->z, NO_REPLACE);
if (mo)
{
mo->target = actor->target;
mo->target = self->target;
mo->args[0] = 1; // CCW
mo->special1 = actor->angle; // Set angle
mo->special1 = self->angle; // Set angle
mo->SetState (mo->FindState("Orbit"));
}
actor->Destroy ();
self->Destroy ();
}
//============================================================================
@ -781,16 +782,16 @@ void A_SorcFX2Split(AActor *actor)
//
//============================================================================
void A_SorcFX2Orbit (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SorcFX2Orbit)
{
angle_t angle;
fixed_t x,y,z;
AActor *parent = actor->target;
AActor *parent = self->target;
// [RH] If no parent, then disappear
if (parent == NULL)
{
actor->Destroy();
self->Destroy();
return;
}
@ -799,24 +800,24 @@ void A_SorcFX2Orbit (AActor *actor)
if ((parent->health <= 0) || // Sorcerer is dead
(!parent->args[0])) // Time expired
{
actor->SetState (actor->FindState(NAME_Death));
self->SetState (self->FindState(NAME_Death));
parent->args[0] = 0;
parent->flags2 &= ~MF2_REFLECTIVE;
parent->flags2 &= ~MF2_INVULNERABLE;
}
if (actor->args[0] && (parent->args[0]-- <= 0)) // Time expired
if (self->args[0] && (parent->args[0]-- <= 0)) // Time expired
{
actor->SetState (actor->FindState(NAME_Death));
self->SetState (self->FindState(NAME_Death));
parent->args[0] = 0;
parent->flags2 &= ~MF2_REFLECTIVE;
}
// Move to new position based on angle
if (actor->args[0]) // Counter clock-wise
if (self->args[0]) // Counter clock-wise
{
actor->special1 += ANGLE_1*10;
angle = ((angle_t)actor->special1) >> ANGLETOFINESHIFT;
self->special1 += ANGLE_1*10;
angle = ((angle_t)self->special1) >> ANGLETOFINESHIFT;
x = parent->x + FixedMul(dist, finecosine[angle]);
y = parent->y + FixedMul(dist, finesine[angle]);
z = parent->z - parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT;
@ -826,8 +827,8 @@ void A_SorcFX2Orbit (AActor *actor)
}
else // Clock wise
{
actor->special1 -= ANGLE_1*10;
angle = ((angle_t)actor->special1) >> ANGLETOFINESHIFT;
self->special1 -= ANGLE_1*10;
angle = ((angle_t)self->special1) >> ANGLETOFINESHIFT;
x = parent->x + FixedMul(dist, finecosine[angle]);
y = parent->y + FixedMul(dist, finesine[angle]);
z = parent->z - parent->floorclip + SORC_DEFENSE_HEIGHT*FRACUNIT;
@ -836,9 +837,9 @@ void A_SorcFX2Orbit (AActor *actor)
Spawn("SorcFX2T1", x, y, z, ALLOW_REPLACE);
}
actor->SetOrigin (x, y, z);
actor->floorz = parent->floorz;
actor->ceilingz = parent->ceilingz;
self->SetOrigin (x, y, z);
self->floorz = parent->floorz;
self->ceilingz = parent->ceilingz;
}
//============================================================================
@ -849,10 +850,10 @@ void A_SorcFX2Orbit (AActor *actor)
//
//============================================================================
void A_SpawnBishop(AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnBishop)
{
AActor *mo;
mo = Spawn("Bishop", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn("Bishop", self->x, self->y, self->z, ALLOW_REPLACE);
if (mo)
{
if (!P_TestMobjLocation(mo))
@ -860,13 +861,13 @@ void A_SpawnBishop(AActor *actor)
mo->Destroy ();
level.total_monsters--;
}
else if (actor->target != NULL)
else if (self->target != NULL)
{ // [RH] Make the new bishops inherit the Heriarch's target
mo->CopyFriendliness (actor->target, true);
mo->master = actor->target;
mo->CopyFriendliness (self->target, true);
mo->master = self->target;
}
}
actor->Destroy ();
self->Destroy ();
}
//============================================================================
@ -875,10 +876,10 @@ void A_SpawnBishop(AActor *actor)
//
//============================================================================
void A_SorcererBishopEntry(AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SorcererBishopEntry)
{
Spawn("SorcFX3Explosion", actor->x, actor->y, actor->z, ALLOW_REPLACE);
S_Sound (actor, CHAN_VOICE, actor->SeeSound, 1, ATTN_NORM);
Spawn("SorcFX3Explosion", self->x, self->y, self->z, ALLOW_REPLACE);
S_Sound (self, CHAN_VOICE, self->SeeSound, 1, ATTN_NORM);
}
//============================================================================
@ -889,11 +890,11 @@ void A_SorcererBishopEntry(AActor *actor)
//
//============================================================================
void A_SorcFX4Check(AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SorcFX4Check)
{
if (actor->special2-- <= 0)
if (self->special2-- <= 0)
{
actor->SetState (actor->FindState(NAME_Death));
self->SetState (self->FindState(NAME_Death));
}
}
@ -905,17 +906,17 @@ void A_SorcFX4Check(AActor *actor)
//
//============================================================================
void A_SorcBallPop(AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SorcBallPop)
{
S_Sound (actor, CHAN_BODY, "SorcererBallPop", 1, ATTN_NONE);
actor->flags &= ~MF_NOGRAVITY;
actor->gravity = FRACUNIT/8;
actor->momx = ((pr_heresiarch()%10)-5) << FRACBITS;
actor->momy = ((pr_heresiarch()%10)-5) << FRACBITS;
actor->momz = (2+(pr_heresiarch()%3)) << FRACBITS;
actor->special2 = 4*FRACUNIT; // Initial bounce factor
actor->args[4] = BOUNCE_TIME_UNIT; // Bounce time unit
actor->args[3] = 5; // Bounce time in seconds
S_Sound (self, CHAN_BODY, "SorcererBallPop", 1, ATTN_NONE);
self->flags &= ~MF_NOGRAVITY;
self->gravity = FRACUNIT/8;
self->momx = ((pr_heresiarch()%10)-5) << FRACBITS;
self->momy = ((pr_heresiarch()%10)-5) << FRACBITS;
self->momz = (2+(pr_heresiarch()%3)) << FRACBITS;
self->special2 = 4*FRACUNIT; // Initial bounce factor
self->args[4] = BOUNCE_TIME_UNIT; // Bounce time unit
self->args[3] = 5; // Bounce time in seconds
}
//============================================================================
@ -924,18 +925,18 @@ void A_SorcBallPop(AActor *actor)
//
//============================================================================
void A_DoBounceCheck (AActor *actor, const char *sound)
void A_DoBounceCheck (AActor *self, const char *sound)
{
if (actor->args[4]-- <= 0)
if (self->args[4]-- <= 0)
{
if (actor->args[3]-- <= 0)
if (self->args[3]-- <= 0)
{
actor->SetState (actor->FindState(NAME_Death));
S_Sound (actor, CHAN_BODY, sound, 1, ATTN_NONE);
self->SetState (self->FindState(NAME_Death));
S_Sound (self, CHAN_BODY, sound, 1, ATTN_NONE);
}
else
{
actor->args[4] = BOUNCE_TIME_UNIT;
self->args[4] = BOUNCE_TIME_UNIT;
}
}
}
@ -946,7 +947,7 @@ void A_DoBounceCheck (AActor *actor, const char *sound)
//
//============================================================================
void A_BounceCheck (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BounceCheck)
{
A_DoBounceCheck (actor, "SorcererBigBallExplode");
A_DoBounceCheck (self, "SorcererBigBallExplode");
}

View file

@ -11,6 +11,7 @@
#include "p_local.h"
#include "p_lnspec.h"
#include "a_hexenglobal.h"
#include "thingdef/thingdef.h"
static FRandom pr_pottery ("PotteryExplode");
static FRandom pr_bit ("PotteryChooseBit");
@ -49,14 +50,14 @@ void APottery1::HitFloor ()
//
//============================================================================
void A_PotteryExplode (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_PotteryExplode)
{
AActor *mo = NULL;
int i;
for(i = (pr_pottery()&3)+3; i; i--)
{
mo = Spawn ("PotteryBit", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn ("PotteryBit", self->x, self->y, self->z, ALLOW_REPLACE);
mo->SetState (mo->SpawnState + (pr_pottery()%5));
if (mo)
{
@ -66,13 +67,13 @@ void A_PotteryExplode (AActor *actor)
}
}
S_Sound (mo, CHAN_BODY, "PotteryExplode", 1, ATTN_NORM);
if (actor->args[0]>=0 && actor->args[0]<=255 && SpawnableThings[actor->args[0]])
if (self->args[0]>=0 && self->args[0]<=255 && SpawnableThings[self->args[0]])
{ // Spawn an item
if (!((level.flags & LEVEL_NOMONSTERS) || (dmflags & DF_NO_MONSTERS))
|| !(GetDefaultByType (SpawnableThings[actor->args[0]])->flags3 & MF3_ISMONSTER))
|| !(GetDefaultByType (SpawnableThings[self->args[0]])->flags3 & MF3_ISMONSTER))
{ // Only spawn monsters if not -nomonsters
Spawn (SpawnableThings[actor->args[0]],
actor->x, actor->y, actor->z, ALLOW_REPLACE);
Spawn (SpawnableThings[self->args[0]],
self->x, self->y, self->z, ALLOW_REPLACE);
}
}
}
@ -83,10 +84,10 @@ void A_PotteryExplode (AActor *actor)
//
//============================================================================
void A_PotteryChooseBit (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_PotteryChooseBit)
{
actor->SetState (actor->FindState(NAME_Death) + 1 + 2*(pr_bit()%5));
actor->tics = 256+(pr_bit()<<1);
self->SetState (self->FindState(NAME_Death) + 1 + 2*(pr_bit()%5));
self->tics = 256+(pr_bit()<<1);
}
//============================================================================
@ -95,7 +96,7 @@ void A_PotteryChooseBit (AActor *actor)
//
//============================================================================
void A_PotteryCheck (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_PotteryCheck)
{
int i;
@ -104,10 +105,10 @@ void A_PotteryCheck (AActor *actor)
if (playeringame[i])
{
AActor *pmo = players[i].mo;
if (P_CheckSight (actor, pmo) && (abs (R_PointToAngle2 (pmo->x,
pmo->y, actor->x, actor->y) - pmo->angle) <= ANGLE_45))
if (P_CheckSight (self, pmo) && (abs (R_PointToAngle2 (pmo->x,
pmo->y, self->x, self->y) - pmo->angle) <= ANGLE_45))
{ // Previous state (pottery bit waiting state)
actor->SetState (actor->state - 1);
self->SetState (self->state - 1);
return;
}
}
@ -116,8 +117,6 @@ void A_PotteryCheck (AActor *actor)
// Lynched corpse (no heart) ------------------------------------------------
void A_CorpseBloodDrip (AActor *);
class AZCorpseLynchedNoHeart : public AActor
{
DECLARE_CLASS (AZCorpseLynchedNoHeart, AActor)
@ -139,11 +138,11 @@ void AZCorpseLynchedNoHeart::PostBeginPlay ()
//
//============================================================================
void A_CorpseBloodDrip (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CorpseBloodDrip)
{
if (pr_drip() <= 128)
{
Spawn ("CorpseBloodDrip", actor->x, actor->y, actor->z + actor->height/2, ALLOW_REPLACE);
Spawn ("CorpseBloodDrip", self->x, self->y, self->z + self->height/2, ALLOW_REPLACE);
}
}
@ -153,14 +152,14 @@ void A_CorpseBloodDrip (AActor *actor)
//
//============================================================================
void A_CorpseExplode (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CorpseExplode)
{
AActor *mo;
int i;
for (i = (pr_foo()&3)+3; i; i--)
{
mo = Spawn ("CorpseBit", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn ("CorpseBit", self->x, self->y, self->z, ALLOW_REPLACE);
mo->SetState (mo->SpawnState + (pr_foo()%3));
if (mo)
{
@ -170,7 +169,7 @@ void A_CorpseExplode (AActor *actor)
}
}
// Spawn a skull
mo = Spawn ("CorpseBit", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn ("CorpseBit", self->x, self->y, self->z, ALLOW_REPLACE);
mo->SetState (mo->SpawnState + 3);
if (mo)
{
@ -178,8 +177,8 @@ void A_CorpseExplode (AActor *actor)
mo->momx = pr_foo.Random2()<<(FRACBITS-6);
mo->momy = pr_foo.Random2()<<(FRACBITS-6);
}
S_Sound (actor, CHAN_BODY, actor->DeathSound, 1, ATTN_IDLE);
actor->Destroy ();
S_Sound (self, CHAN_BODY, self->DeathSound, 1, ATTN_IDLE);
self->Destroy ();
}
//============================================================================
@ -188,7 +187,7 @@ void A_CorpseExplode (AActor *actor)
//
//============================================================================
void A_LeafSpawn (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LeafSpawn)
{
AActor *mo;
int i;
@ -196,13 +195,13 @@ void A_LeafSpawn (AActor *actor)
for (i = (pr_leaf()&3)+1; i; i--)
{
mo = Spawn (pr_leaf()&1 ? PClass::FindClass ("Leaf1") : PClass::FindClass ("Leaf2"),
actor->x + (pr_leaf.Random2()<<14),
actor->y + (pr_leaf.Random2()<<14),
actor->z + (pr_leaf()<<14), ALLOW_REPLACE);
self->x + (pr_leaf.Random2()<<14),
self->y + (pr_leaf.Random2()<<14),
self->z + (pr_leaf()<<14), ALLOW_REPLACE);
if (mo)
{
P_ThrustMobj (mo, actor->angle, (pr_leaf()<<9)+3*FRACUNIT);
mo->target = actor;
P_ThrustMobj (mo, self->angle, (pr_leaf()<<9)+3*FRACUNIT);
mo->target = self;
mo->special1 = 0;
}
}
@ -214,11 +213,11 @@ void A_LeafSpawn (AActor *actor)
//
//============================================================================
void A_LeafThrust (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LeafThrust)
{
if (pr_leafthrust() <= 96)
{
actor->momz += (pr_leafthrust()<<9)+FRACUNIT;
self->momz += (pr_leafthrust()<<9)+FRACUNIT;
}
}
@ -228,27 +227,27 @@ void A_LeafThrust (AActor *actor)
//
//============================================================================
void A_LeafCheck (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LeafCheck)
{
actor->special1++;
if (actor->special1 >= 20)
self->special1++;
if (self->special1 >= 20)
{
actor->SetState (NULL);
self->SetState (NULL);
return;
}
angle_t ang = actor->target ? actor->target->angle : actor->angle;
angle_t ang = self->target ? self->target->angle : self->angle;
if (pr_leafcheck() > 64)
{
if (!actor->momx && !actor->momy)
if (!self->momx && !self->momy)
{
P_ThrustMobj (actor, ang, (pr_leafcheck()<<9)+FRACUNIT);
P_ThrustMobj (self, ang, (pr_leafcheck()<<9)+FRACUNIT);
}
return;
}
actor->SetState (actor->SpawnState + 7);
actor->momz = (pr_leafcheck()<<9)+FRACUNIT;
P_ThrustMobj (actor, ang, (pr_leafcheck()<<9)+2*FRACUNIT);
actor->flags |= MF_MISSILE;
self->SetState (self->SpawnState + 7);
self->momz = (pr_leafcheck()<<9)+FRACUNIT;
P_ThrustMobj (self, ang, (pr_leafcheck()<<9)+2*FRACUNIT);
self->flags |= MF_MISSILE;
}
//===========================================================================
@ -257,9 +256,9 @@ void A_LeafCheck (AActor *actor)
//
//===========================================================================
void A_PoisonShroom (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_PoisonShroom)
{
actor->tics = 128+(pr_shroom()<<1);
self->tics = 128+(pr_shroom()<<1);
}
//===========================================================================
@ -268,16 +267,16 @@ void A_PoisonShroom (AActor *actor)
//
//===========================================================================
void A_SoAExplode (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SoAExplode)
{
AActor *mo;
int i;
for (i = 0; i < 10; i++)
{
mo = Spawn ("ZArmorChunk", actor->x+((pr_soaexplode()-128)<<12),
actor->y+((pr_soaexplode()-128)<<12),
actor->z+(pr_soaexplode()*actor->height/256), ALLOW_REPLACE);
mo = Spawn ("ZArmorChunk", self->x+((pr_soaexplode()-128)<<12),
self->y+((pr_soaexplode()-128)<<12),
self->z+(pr_soaexplode()*self->height/256), ALLOW_REPLACE);
mo->SetState (mo->SpawnState + i);
if (mo)
{
@ -286,24 +285,21 @@ void A_SoAExplode (AActor *actor)
mo->momy = pr_soaexplode.Random2()<<(FRACBITS-6);
}
}
if (actor->args[0]>=0 && actor->args[0]<=255 && SpawnableThings[actor->args[0]])
if (self->args[0]>=0 && self->args[0]<=255 && SpawnableThings[self->args[0]])
{ // Spawn an item
if (!((level.flags & LEVEL_NOMONSTERS) || (dmflags & DF_NO_MONSTERS))
|| !(GetDefaultByType (SpawnableThings[actor->args[0]])->flags3 & MF3_ISMONSTER))
|| !(GetDefaultByType (SpawnableThings[self->args[0]])->flags3 & MF3_ISMONSTER))
{ // Only spawn monsters if not -nomonsters
Spawn (SpawnableThings[actor->args[0]],
actor->x, actor->y, actor->z, ALLOW_REPLACE);
Spawn (SpawnableThings[self->args[0]],
self->x, self->y, self->z, ALLOW_REPLACE);
}
}
S_Sound (actor, CHAN_BODY, actor->DeathSound, 1, ATTN_NORM);
actor->Destroy ();
S_Sound (self, CHAN_BODY, self->DeathSound, 1, ATTN_NORM);
self->Destroy ();
}
// Bell ---------------------------------------------------------------------
void A_BellReset1 (AActor *);
void A_BellReset2 (AActor *);
class AZBell : public AActor
{
DECLARE_CLASS (AZBell, AActor)
@ -327,15 +323,15 @@ void AZBell::Activate (AActor *activator)
//
//===========================================================================
void A_BellReset1 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BellReset1)
{
actor->flags |= MF_NOGRAVITY;
actor->height <<= 2;
if (actor->special)
self->flags |= MF_NOGRAVITY;
self->height <<= 2;
if (self->special)
{ // Initiate death action
LineSpecials[actor->special] (NULL, NULL, false, actor->args[0],
actor->args[1], actor->args[2], actor->args[3], actor->args[4]);
actor->special = 0;
LineSpecials[self->special] (NULL, NULL, false, self->args[0],
self->args[1], self->args[2], self->args[3], self->args[4]);
self->special = 0;
}
}
@ -345,10 +341,10 @@ void A_BellReset1 (AActor *actor)
//
//===========================================================================
void A_BellReset2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BellReset2)
{
actor->flags |= MF_SHOOTABLE;
actor->flags &= ~MF_CORPSE;
actor->health = 5;
self->flags |= MF_SHOOTABLE;
self->flags &= ~MF_CORPSE;
self->health = 5;
}

View file

@ -5,6 +5,7 @@
#include "p_enemy.h"
#include "a_action.h"
#include "m_random.h"
#include "thingdef/thingdef.h"
static FRandom pr_iceguylook ("IceGuyLook");
static FRandom pr_iceguychase ("IceGuyChase");
@ -21,21 +22,21 @@ static const char *WispTypes[2] =
//
//============================================================================
void A_IceGuyLook (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyLook)
{
fixed_t dist;
fixed_t an;
A_Look (actor);
CALL_ACTION(A_Look, self);
if (pr_iceguylook() < 64)
{
dist = ((pr_iceguylook()-128)*actor->radius)>>7;
an = (actor->angle+ANG90)>>ANGLETOFINESHIFT;
dist = ((pr_iceguylook()-128)*self->radius)>>7;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
Spawn (WispTypes[pr_iceguylook()&1],
actor->x+FixedMul(dist, finecosine[an]),
actor->y+FixedMul(dist, finesine[an]),
actor->z+60*FRACUNIT, ALLOW_REPLACE);
self->x+FixedMul(dist, finecosine[an]),
self->y+FixedMul(dist, finesine[an]),
self->z+60*FRACUNIT, ALLOW_REPLACE);
}
}
@ -45,28 +46,28 @@ void A_IceGuyLook (AActor *actor)
//
//============================================================================
void A_IceGuyChase (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyChase)
{
fixed_t dist;
fixed_t an;
AActor *mo;
A_Chase (actor);
A_Chase (self);
if (pr_iceguychase() < 128)
{
dist = ((pr_iceguychase()-128)*actor->radius)>>7;
an = (actor->angle+ANG90)>>ANGLETOFINESHIFT;
dist = ((pr_iceguychase()-128)*self->radius)>>7;
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
mo = Spawn (WispTypes[pr_iceguychase()&1],
actor->x+FixedMul(dist, finecosine[an]),
actor->y+FixedMul(dist, finesine[an]),
actor->z+60*FRACUNIT, ALLOW_REPLACE);
self->x+FixedMul(dist, finecosine[an]),
self->y+FixedMul(dist, finesine[an]),
self->z+60*FRACUNIT, ALLOW_REPLACE);
if (mo)
{
mo->momx = actor->momx;
mo->momy = actor->momy;
mo->momz = actor->momz;
mo->target = actor;
mo->momx = self->momx;
mo->momy = self->momy;
mo->momz = self->momz;
mo->target = self;
}
}
}
@ -77,25 +78,25 @@ void A_IceGuyChase (AActor *actor)
//
//============================================================================
void A_IceGuyAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyAttack)
{
fixed_t an;
if(!actor->target)
if(!self->target)
{
return;
}
an = (actor->angle+ANG90)>>ANGLETOFINESHIFT;
P_SpawnMissileXYZ(actor->x+FixedMul(actor->radius>>1,
finecosine[an]), actor->y+FixedMul(actor->radius>>1,
finesine[an]), actor->z+40*FRACUNIT, actor, actor->target,
an = (self->angle+ANG90)>>ANGLETOFINESHIFT;
P_SpawnMissileXYZ(self->x+FixedMul(self->radius>>1,
finecosine[an]), self->y+FixedMul(self->radius>>1,
finesine[an]), self->z+40*FRACUNIT, self, self->target,
PClass::FindClass ("IceGuyFX"));
an = (actor->angle-ANG90)>>ANGLETOFINESHIFT;
P_SpawnMissileXYZ(actor->x+FixedMul(actor->radius>>1,
finecosine[an]), actor->y+FixedMul(actor->radius>>1,
finesine[an]), actor->z+40*FRACUNIT, actor, actor->target,
an = (self->angle-ANG90)>>ANGLETOFINESHIFT;
P_SpawnMissileXYZ(self->x+FixedMul(self->radius>>1,
finecosine[an]), self->y+FixedMul(self->radius>>1,
finesine[an]), self->z+40*FRACUNIT, self, self->target,
PClass::FindClass ("IceGuyFX"));
S_Sound (actor, CHAN_WEAPON, actor->AttackSound, 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, self->AttackSound, 1, ATTN_NORM);
}
//============================================================================
@ -104,13 +105,13 @@ void A_IceGuyAttack (AActor *actor)
//
//============================================================================
void A_IceGuyDie (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyDie)
{
actor->momx = 0;
actor->momy = 0;
actor->momz = 0;
actor->height = actor->GetDefault()->height;
A_FreezeDeathChunks (actor);
self->momx = 0;
self->momy = 0;
self->momz = 0;
self->height = self->GetDefault()->height;
CALL_ACTION(A_FreezeDeathChunks, self);
}
//============================================================================
@ -119,18 +120,18 @@ void A_IceGuyDie (AActor *actor)
//
//============================================================================
void A_IceGuyMissileExplode (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_IceGuyMissileExplode)
{
AActor *mo;
int i;
for (i = 0; i < 8; i++)
{
mo = P_SpawnMissileAngleZ (actor, actor->z+3*FRACUNIT,
mo = P_SpawnMissileAngleZ (self, self->z+3*FRACUNIT,
PClass::FindClass("IceGuyFX2"), i*ANG45, (fixed_t)(-0.3*FRACUNIT));
if (mo)
{
mo->target = actor->target;
mo->target = self->target;
}
}
}

View file

@ -25,6 +25,7 @@
#include "a_action.h"
#include "m_random.h"
#include "i_system.h"
#include "thingdef/thingdef.h"
const int KORAX_SPIRIT_LIFETIME = 5*TICRATE/5; // 5 seconds
const int KORAX_COMMAND_HEIGHT = 120;
@ -84,56 +85,56 @@ extern void SpawnSpiritTail (AActor *spirit);
//
//============================================================================
void A_KoraxChase (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_KoraxChase)
{
AActor *spot;
if ((!actor->special2) && (actor->health <= (actor->GetDefault()->health/2)))
if ((!self->special2) && (self->health <= (self->GetDefault()->health/2)))
{
FActorIterator iterator (KORAX_FIRST_TELEPORT_TID);
spot = iterator.Next ();
if (spot != NULL)
{
P_Teleport (actor, spot->x, spot->y, ONFLOORZ, spot->angle, true, true, false);
P_Teleport (self, spot->x, spot->y, ONFLOORZ, spot->angle, true, true, false);
}
P_StartScript (actor, NULL, 249, NULL, 0, 0, 0, 0, 0, false);
actor->special2 = 1; // Don't run again
P_StartScript (self, NULL, 249, NULL, 0, 0, 0, 0, 0, false);
self->special2 = 1; // Don't run again
return;
}
if (!actor->target) return;
if (!self->target) return;
if (pr_koraxchase()<30)
{
actor->SetState (actor->MissileState);
self->SetState (self->MissileState);
}
else if (pr_koraxchase()<30)
{
S_Sound (actor, CHAN_VOICE, "KoraxActive", 1, ATTN_NONE);
S_Sound (self, CHAN_VOICE, "KoraxActive", 1, ATTN_NONE);
}
// Teleport away
if (actor->health < (actor->GetDefault()->health>>1))
if (self->health < (self->GetDefault()->health>>1))
{
if (pr_koraxchase()<10)
{
FActorIterator iterator (KORAX_TELEPORT_TID);
if (actor->tracer != NULL)
if (self->tracer != NULL)
{ // Find the previous teleport destination
do
{
spot = iterator.Next ();
} while (spot != NULL && spot != actor->tracer);
} while (spot != NULL && spot != self->tracer);
}
// Go to the next teleport destination
spot = iterator.Next ();
actor->tracer = spot;
self->tracer = spot;
if (spot)
{
P_Teleport (actor, spot->x, spot->y, ONFLOORZ, spot->angle, true, true, false);
P_Teleport (self, spot->x, spot->y, ONFLOORZ, spot->angle, true, true, false);
}
}
}
@ -145,7 +146,7 @@ void A_KoraxChase (AActor *actor)
//
//============================================================================
void A_KoraxBonePop (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_KoraxBonePop)
{
AActor *mo;
int i;
@ -153,11 +154,11 @@ void A_KoraxBonePop (AActor *actor)
// Spawn 6 spirits equalangularly
for (i = 0; i < 6; ++i)
{
mo = P_SpawnMissileAngle (actor, PClass::FindClass("KoraxSpirit"), ANGLE_60*i, 5*FRACUNIT);
if (mo) KSpiritInit (mo, actor);
mo = P_SpawnMissileAngle (self, PClass::FindClass("KoraxSpirit"), ANGLE_60*i, 5*FRACUNIT);
if (mo) KSpiritInit (mo, self);
}
P_StartScript (actor, NULL, 255, NULL, 0, 0, 0, 0, false, false); // Death script
P_StartScript (self, NULL, 255, NULL, 0, 0, 0, 0, false, false); // Death script
}
//============================================================================
@ -185,15 +186,15 @@ void KSpiritInit (AActor *spirit, AActor *korax)
//
//============================================================================
void A_KoraxDecide (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_KoraxDecide)
{
if (pr_koraxdecide()<220)
{
actor->SetState (actor->FindState("Attack"));
self->SetState (self->FindState("Attack"));
}
else
{
actor->SetState (actor->FindState("Command"));
self->SetState (self->FindState("Command"));
}
}
@ -203,7 +204,7 @@ void A_KoraxDecide (AActor *actor)
//
//============================================================================
void A_KoraxMissile (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_KoraxMissile)
{
static const struct { const char *type, *sound; } choices[6] =
{
@ -219,7 +220,7 @@ void A_KoraxMissile (AActor *actor)
int i;
const PClass *info;
S_Sound (actor, CHAN_VOICE, "KoraxAttack", 1, ATTN_NORM);
S_Sound (self, CHAN_VOICE, "KoraxAttack", 1, ATTN_NORM);
info = PClass::FindClass (choices[type].type);
if (info == NULL)
@ -228,10 +229,10 @@ void A_KoraxMissile (AActor *actor)
}
// Fire all 6 missiles at once
S_Sound (actor, CHAN_WEAPON, choices[type].sound, 1, ATTN_NONE);
S_Sound (self, CHAN_WEAPON, choices[type].sound, 1, ATTN_NONE);
for (i = 0; i < 6; ++i)
{
KoraxFire (actor, info, i);
KoraxFire (self, info, i);
}
}
@ -243,22 +244,22 @@ void A_KoraxMissile (AActor *actor)
//
//============================================================================
void A_KoraxCommand (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_KoraxCommand)
{
fixed_t x,y,z;
angle_t ang;
int numcommands;
S_Sound (actor, CHAN_VOICE, "KoraxCommand", 1, ATTN_NORM);
S_Sound (self, CHAN_VOICE, "KoraxCommand", 1, ATTN_NORM);
// Shoot stream of lightning to ceiling
ang = (actor->angle - ANGLE_90) >> ANGLETOFINESHIFT;
x = actor->x + KORAX_COMMAND_OFFSET * finecosine[ang];
y = actor->y + KORAX_COMMAND_OFFSET * finesine[ang];
z = actor->z + KORAX_COMMAND_HEIGHT*FRACUNIT;
ang = (self->angle - ANGLE_90) >> ANGLETOFINESHIFT;
x = self->x + KORAX_COMMAND_OFFSET * finecosine[ang];
y = self->y + KORAX_COMMAND_OFFSET * finesine[ang];
z = self->z + KORAX_COMMAND_HEIGHT*FRACUNIT;
Spawn("KoraxBolt", x, y, z, ALLOW_REPLACE);
if (actor->health <= (actor->GetDefault()->health >> 1))
if (self->health <= (self->GetDefault()->health >> 1))
{
numcommands = 5;
}
@ -267,7 +268,7 @@ void A_KoraxCommand (AActor *actor)
numcommands = 4;
}
P_StartScript (actor, NULL, 250+(pr_koraxcommand()%numcommands),
P_StartScript (self, NULL, 250+(pr_koraxcommand()%numcommands),
NULL, 0, 0, 0, 0, false, false);
}
@ -324,29 +325,29 @@ void KoraxFire (AActor *actor, const PClass *type, int arm)
//
//============================================================================
void A_KSpiritWeave (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_KSpiritWeave)
{
fixed_t newX, newY;
int weaveXY, weaveZ;
int angle;
weaveXY = actor->special2>>16;
weaveZ = actor->special2&0xFFFF;
angle = (actor->angle+ANG90)>>ANGLETOFINESHIFT;
newX = actor->x-FixedMul(finecosine[angle],
weaveXY = self->special2>>16;
weaveZ = self->special2&0xFFFF;
angle = (self->angle+ANG90)>>ANGLETOFINESHIFT;
newX = self->x-FixedMul(finecosine[angle],
FloatBobOffsets[weaveXY]<<2);
newY = actor->y-FixedMul(finesine[angle],
newY = self->y-FixedMul(finesine[angle],
FloatBobOffsets[weaveXY]<<2);
weaveXY = (weaveXY+(pr_kspiritweave()%5))&63;
newX += FixedMul(finecosine[angle],
FloatBobOffsets[weaveXY]<<2);
newY += FixedMul(finesine[angle],
FloatBobOffsets[weaveXY]<<2);
P_TryMove(actor, newX, newY, true);
actor->z -= FloatBobOffsets[weaveZ]<<1;
P_TryMove(self, newX, newY, true);
self->z -= FloatBobOffsets[weaveZ]<<1;
weaveZ = (weaveZ+(pr_kspiritweave()%5))&63;
actor->z += FloatBobOffsets[weaveZ]<<1;
actor->special2 = weaveZ+(weaveXY<<16);
self->z += FloatBobOffsets[weaveZ]<<1;
self->special2 = weaveZ+(weaveXY<<16);
}
//============================================================================
@ -425,24 +426,24 @@ void A_KSpiritSeeker (AActor *actor, angle_t thresh, angle_t turnMax)
//
//============================================================================
void A_KSpiritRoam (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_KSpiritRoam)
{
if (actor->health-- <= 0)
if (self->health-- <= 0)
{
S_Sound (actor, CHAN_VOICE, "SpiritDie", 1, ATTN_NORM);
actor->SetState (actor->FindState("Death"));
S_Sound (self, CHAN_VOICE, "SpiritDie", 1, ATTN_NORM);
self->SetState (self->FindState("Death"));
}
else
{
if (actor->tracer)
if (self->tracer)
{
A_KSpiritSeeker (actor, actor->args[0]*ANGLE_1,
actor->args[0]*ANGLE_1*2);
A_KSpiritSeeker (self, self->args[0]*ANGLE_1,
self->args[0]*ANGLE_1*2);
}
A_KSpiritWeave (actor);
CALL_ACTION(A_KSpiritWeave, self);
if (pr_kspiritroam()<50)
{
S_Sound (actor, CHAN_VOICE, "SpiritActive", 1, ATTN_NONE);
S_Sound (self, CHAN_VOICE, "SpiritActive", 1, ATTN_NONE);
}
}
}
@ -453,12 +454,12 @@ void A_KSpiritRoam (AActor *actor)
//
//============================================================================
void A_KBolt (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_KBolt)
{
// Countdown lifetime
if (actor->special1-- <= 0)
if (self->special1-- <= 0)
{
actor->Destroy ();
self->Destroy ();
}
}
@ -468,17 +469,17 @@ void A_KBolt (AActor *actor)
//
//============================================================================
void A_KBoltRaise (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_KBoltRaise)
{
AActor *mo;
fixed_t z;
// Spawn a child upward
z = actor->z + KORAX_BOLT_HEIGHT;
z = self->z + KORAX_BOLT_HEIGHT;
if ((z + KORAX_BOLT_HEIGHT) < actor->ceilingz)
if ((z + KORAX_BOLT_HEIGHT) < self->ceilingz)
{
mo = Spawn("KoraxBolt", actor->x, actor->y, z, ALLOW_REPLACE);
mo = Spawn("KoraxBolt", self->x, self->y, z, ALLOW_REPLACE);
if (mo)
{
mo->special1 = KORAX_BOLT_LIFETIME;

View file

@ -10,6 +10,7 @@
#include "p_pspr.h"
#include "gstrings.h"
#include "a_hexenglobal.h"
#include "thingdef/thingdef.h"
const int SHARDSPAWN_LEFT = 1;
const int SHARDSPAWN_RIGHT = 2;
@ -47,7 +48,7 @@ int AFrostMissile::DoSpecialDamage (AActor *victim, int damage)
//
//============================================================================
void A_FireConePL1 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireConePL1)
{
angle_t angle;
int damage;
@ -58,27 +59,27 @@ void A_FireConePL1 (AActor *actor)
player_t *player;
AActor *linetarget;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
}
S_Sound (actor, CHAN_WEAPON, "MageShardsFire", 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, "MageShardsFire", 1, ATTN_NORM);
damage = 90+(pr_cone()&15);
for (i = 0; i < 16; i++)
{
angle = actor->angle+i*(ANG45/16);
slope = P_AimLineAttack (actor, angle, MELEERANGE, &linetarget);
angle = self->angle+i*(ANG45/16);
slope = P_AimLineAttack (self, angle, MELEERANGE, &linetarget);
if (linetarget)
{
P_DamageMobj (linetarget, actor, actor, damage, NAME_Ice);
P_DamageMobj (linetarget, self, self, damage, NAME_Ice);
conedone = true;
break;
}
@ -87,13 +88,13 @@ void A_FireConePL1 (AActor *actor)
// didn't find any creatures, so fire projectiles
if (!conedone)
{
mo = P_SpawnPlayerMissile (actor, RUNTIME_CLASS(AFrostMissile));
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(AFrostMissile));
if (mo)
{
mo->special1 = SHARDSPAWN_LEFT|SHARDSPAWN_DOWN|SHARDSPAWN_UP
|SHARDSPAWN_RIGHT;
mo->special2 = 3; // Set sperm count (levels of reproductivity)
mo->target = actor;
mo->target = self;
mo->args[0] = 3; // Mark Initial shard as super damage
}
}
@ -105,48 +106,48 @@ void A_FireConePL1 (AActor *actor)
//
//============================================================================
void A_ShedShard (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ShedShard)
{
AActor *mo;
int spawndir = actor->special1;
int spermcount = actor->special2;
int spawndir = self->special1;
int spermcount = self->special2;
if (spermcount <= 0) return; // No sperm left
actor->special2 = 0;
self->special2 = 0;
spermcount--;
// every so many calls, spawn a new missile in its set directions
if (spawndir & SHARDSPAWN_LEFT)
{
mo = P_SpawnMissileAngleZSpeed (actor, actor->z, RUNTIME_CLASS(AFrostMissile), actor->angle+(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, actor->target);
mo = P_SpawnMissileAngleZSpeed (self, self->z, RUNTIME_CLASS(AFrostMissile), self->angle+(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, self->target);
if (mo)
{
mo->special1 = SHARDSPAWN_LEFT;
mo->special2 = spermcount;
mo->momz = actor->momz;
mo->momz = self->momz;
mo->args[0] = (spermcount==3)?2:0;
}
}
if (spawndir & SHARDSPAWN_RIGHT)
{
mo = P_SpawnMissileAngleZSpeed (actor, actor->z, RUNTIME_CLASS(AFrostMissile), actor->angle-(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, actor->target);
mo = P_SpawnMissileAngleZSpeed (self, self->z, RUNTIME_CLASS(AFrostMissile), self->angle-(ANG45/9),
0, (20+2*spermcount)<<FRACBITS, self->target);
if (mo)
{
mo->special1 = SHARDSPAWN_RIGHT;
mo->special2 = spermcount;
mo->momz = actor->momz;
mo->momz = self->momz;
mo->args[0] = (spermcount==3)?2:0;
}
}
if (spawndir & SHARDSPAWN_UP)
{
mo = P_SpawnMissileAngleZSpeed (actor, actor->z+8*FRACUNIT, RUNTIME_CLASS(AFrostMissile), actor->angle,
0, (15+2*spermcount)<<FRACBITS, actor->target);
mo = P_SpawnMissileAngleZSpeed (self, self->z+8*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->angle,
0, (15+2*spermcount)<<FRACBITS, self->target);
if (mo)
{
mo->momz = actor->momz;
mo->momz = self->momz;
if (spermcount & 1) // Every other reproduction
mo->special1 = SHARDSPAWN_UP | SHARDSPAWN_LEFT | SHARDSPAWN_RIGHT;
else
@ -157,17 +158,17 @@ void A_ShedShard (AActor *actor)
}
if (spawndir & SHARDSPAWN_DOWN)
{
mo = P_SpawnMissileAngleZSpeed (actor, actor->z-4*FRACUNIT, RUNTIME_CLASS(AFrostMissile), actor->angle,
0, (15+2*spermcount)<<FRACBITS, actor->target);
mo = P_SpawnMissileAngleZSpeed (self, self->z-4*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->angle,
0, (15+2*spermcount)<<FRACBITS, self->target);
if (mo)
{
mo->momz = actor->momz;
mo->momz = self->momz;
if (spermcount & 1) // Every other reproduction
mo->special1 = SHARDSPAWN_DOWN | SHARDSPAWN_LEFT | SHARDSPAWN_RIGHT;
else
mo->special1 = SHARDSPAWN_DOWN;
mo->special2 = spermcount;
mo->target = actor->target;
mo->target = self->target;
mo->args[0] = (spermcount==3)?2:0;
}
}

View file

@ -10,6 +10,7 @@
#include "p_pspr.h"
#include "gstrings.h"
#include "a_hexenglobal.h"
#include "thingdef/thingdef.h"
#define ZAGSPEED FRACUNIT
@ -19,14 +20,8 @@ static FRandom pr_zap ("LightningZap");
static FRandom pr_zapf ("LightningZapF");
static FRandom pr_hit ("LightningHit");
void A_LightningReady (AActor *actor);
void A_MLightningAttack (AActor *actor);
void A_LightningClip (AActor *);
void A_LightningZap (AActor *);
void A_ZapMimic (AActor *);
void A_LastZap (AActor *);
void A_LightningRemove (AActor *);
DECLARE_ACTION(A_LightningClip)
DECLARE_ACTION(A_LightningZap)
// Lightning ----------------------------------------------------------------
@ -127,12 +122,12 @@ int ALightningZap::SpecialMissileHit (AActor *thing)
//
//============================================================================
void A_LightningReady (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LightningReady)
{
A_WeaponReady (actor);
CALL_ACTION(A_WeaponReady, self);
if (pr_lightningready() < 160)
{
S_Sound (actor, CHAN_WEAPON, "MageLightningReady", 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, "MageLightningReady", 1, ATTN_NORM);
}
}
@ -142,61 +137,61 @@ void A_LightningReady (AActor *actor)
//
//============================================================================
void A_LightningClip (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LightningClip)
{
AActor *cMo;
AActor *target = NULL;
int zigZag;
if (actor->flags3 & MF3_FLOORHUGGER)
if (self->flags3 & MF3_FLOORHUGGER)
{
if (actor->lastenemy == NULL)
if (self->lastenemy == NULL)
{
return;
}
actor->z = actor->floorz;
target = actor->lastenemy->tracer;
self->z = self->floorz;
target = self->lastenemy->tracer;
}
else if (actor->flags3 & MF3_CEILINGHUGGER)
else if (self->flags3 & MF3_CEILINGHUGGER)
{
actor->z = actor->ceilingz-actor->height;
target = actor->tracer;
self->z = self->ceilingz-self->height;
target = self->tracer;
}
if (actor->flags3 & MF3_FLOORHUGGER)
if (self->flags3 & MF3_FLOORHUGGER)
{ // floor lightning zig-zags, and forces the ceiling lightning to mimic
cMo = actor->lastenemy;
cMo = self->lastenemy;
zigZag = pr_lightningclip();
if((zigZag > 128 && actor->special1 < 2) || actor->special1 < -2)
if((zigZag > 128 && self->special1 < 2) || self->special1 < -2)
{
P_ThrustMobj(actor, actor->angle+ANG90, ZAGSPEED);
P_ThrustMobj(self, self->angle+ANG90, ZAGSPEED);
if(cMo)
{
P_ThrustMobj(cMo, actor->angle+ANG90, ZAGSPEED);
P_ThrustMobj(cMo, self->angle+ANG90, ZAGSPEED);
}
actor->special1++;
self->special1++;
}
else
{
P_ThrustMobj(actor, actor->angle-ANG90, ZAGSPEED);
P_ThrustMobj(self, self->angle-ANG90, ZAGSPEED);
if(cMo)
{
P_ThrustMobj(cMo, cMo->angle-ANG90, ZAGSPEED);
}
actor->special1--;
self->special1--;
}
}
if(target)
{
if(target->health <= 0)
{
P_ExplodeMissile(actor, NULL, NULL);
P_ExplodeMissile(self, NULL, NULL);
}
else
{
actor->angle = R_PointToAngle2(actor->x, actor->y, target->x, target->y);
actor->momx = 0;
actor->momy = 0;
P_ThrustMobj (actor, actor->angle, actor->Speed>>1);
self->angle = R_PointToAngle2(self->x, self->y, target->x, target->y);
self->momx = 0;
self->momy = 0;
P_ThrustMobj (self, self->angle, self->Speed>>1);
}
}
}
@ -208,20 +203,20 @@ void A_LightningClip (AActor *actor)
//
//============================================================================
void A_LightningZap (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LightningZap)
{
AActor *mo;
fixed_t deltaZ;
A_LightningClip(actor);
CALL_ACTION(A_LightningClip, self);
actor->health -= 8;
if (actor->health <= 0)
self->health -= 8;
if (self->health <= 0)
{
actor->SetState (actor->FindState(NAME_Death));
self->SetState (self->FindState(NAME_Death));
return;
}
if (actor->flags3 & MF3_FLOORHUGGER)
if (self->flags3 & MF3_FLOORHUGGER)
{
deltaZ = 10*FRACUNIT;
}
@ -229,16 +224,16 @@ void A_LightningZap (AActor *actor)
{
deltaZ = -10*FRACUNIT;
}
mo = Spawn<ALightningZap> (actor->x+((pr_zap()-128)*actor->radius/256),
actor->y+((pr_zap()-128)*actor->radius/256),
actor->z+deltaZ, ALLOW_REPLACE);
mo = Spawn<ALightningZap> (self->x+((pr_zap()-128)*self->radius/256),
self->y+((pr_zap()-128)*self->radius/256),
self->z+deltaZ, ALLOW_REPLACE);
if (mo)
{
mo->lastenemy = actor;
mo->momx = actor->momx;
mo->momy = actor->momy;
mo->target = actor->target;
if (actor->flags3 & MF3_FLOORHUGGER)
mo->lastenemy = self;
mo->momx = self->momx;
mo->momy = self->momy;
mo->target = self->target;
if (self->flags3 & MF3_FLOORHUGGER)
{
mo->momz = 20*FRACUNIT;
}
@ -247,9 +242,9 @@ void A_LightningZap (AActor *actor)
mo->momz = -20*FRACUNIT;
}
}
if ((actor->flags3 & MF3_FLOORHUGGER) && pr_zapf() < 160)
if ((self->flags3 & MF3_FLOORHUGGER) && pr_zapf() < 160)
{
S_Sound (actor, CHAN_BODY, "MageLightningContinuous", 1, ATTN_NORM);
S_Sound (self, CHAN_BODY, "MageLightningContinuous", 1, ATTN_NORM);
}
}
@ -259,25 +254,25 @@ void A_LightningZap (AActor *actor)
//
//============================================================================
void A_MLightningAttack2 (AActor *actor)
static void MLightningAttack2 (AActor *self)
{
AActor *fmo, *cmo;
fmo = P_SpawnPlayerMissile (actor, PClass::FindClass ("LightningFloor"));
cmo = P_SpawnPlayerMissile (actor, PClass::FindClass ("LightningCeiling"));
fmo = P_SpawnPlayerMissile (self, PClass::FindClass ("LightningFloor"));
cmo = P_SpawnPlayerMissile (self, PClass::FindClass ("LightningCeiling"));
if (fmo)
{
fmo->special1 = 0;
fmo->lastenemy = cmo;
A_LightningZap (fmo);
CALL_ACTION(A_LightningZap, fmo);
}
if (cmo)
{
cmo->tracer = NULL;
cmo->lastenemy = fmo;
A_LightningZap (cmo);
CALL_ACTION(A_LightningZap, cmo);
}
S_Sound (actor, CHAN_BODY, "MageLightningFire", 1, ATTN_NORM);
S_Sound (self, CHAN_BODY, "MageLightningFire", 1, ATTN_NORM);
}
//============================================================================
@ -286,12 +281,12 @@ void A_MLightningAttack2 (AActor *actor)
//
//============================================================================
void A_MLightningAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MLightningAttack)
{
A_MLightningAttack2(actor);
if (actor->player != NULL)
MLightningAttack2(self);
if (self->player != NULL)
{
AWeapon *weapon = actor->player->ReadyWeapon;
AWeapon *weapon = self->player->ReadyWeapon;
if (weapon != NULL)
{
weapon->DepleteAmmo (weapon->bAltFire);
@ -305,21 +300,21 @@ void A_MLightningAttack (AActor *actor)
//
//============================================================================
void A_ZapMimic (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ZapMimic)
{
AActor *mo;
mo = actor->lastenemy;
mo = self->lastenemy;
if (mo)
{
if (mo->state >= mo->FindState(NAME_Death))
{
P_ExplodeMissile (actor, NULL, NULL);
P_ExplodeMissile (self, NULL, NULL);
}
else
{
actor->momx = mo->momx;
actor->momy = mo->momy;
self->momx = mo->momx;
self->momy = mo->momy;
}
}
}
@ -330,14 +325,14 @@ void A_ZapMimic (AActor *actor)
//
//============================================================================
void A_LastZap (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LastZap)
{
AActor *mo;
mo = Spawn<ALightningZap> (actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn<ALightningZap> (self->x, self->y, self->z, ALLOW_REPLACE);
if (mo)
{
mo->SetState (mo->FindState ("Death"));
mo->SetState (mo->FindState (NAME_Death));
mo->momz = 40*FRACUNIT;
mo->Damage = 0;
}
@ -349,11 +344,11 @@ void A_LastZap (AActor *actor)
//
//============================================================================
void A_LightningRemove (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LightningRemove)
{
AActor *mo;
mo = actor->lastenemy;
mo = self->lastenemy;
if (mo)
{
mo->lastenemy = NULL;

View file

@ -7,6 +7,7 @@
#include "a_hexenglobal.h"
#include "gstrings.h"
#include "a_weaponpiece.h"
#include "thingdef/thingdef.h"
static FRandom pr_mstafftrack ("MStaffTrack");
static FRandom pr_bloodscourgedrop ("BloodScourgeDrop");
@ -171,39 +172,39 @@ void MStaffSpawn (AActor *pmo, angle_t angle)
//
//============================================================================
void A_MStaffAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MStaffAttack)
{
angle_t angle;
player_t *player;
AActor *linetarget;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
AMWeapBloodscourge *weapon = static_cast<AMWeapBloodscourge *> (actor->player->ReadyWeapon);
AMWeapBloodscourge *weapon = static_cast<AMWeapBloodscourge *> (self->player->ReadyWeapon);
if (weapon != NULL)
{
if (!weapon->DepleteAmmo (weapon->bAltFire))
return;
}
angle = actor->angle;
angle = self->angle;
// [RH] Let's try and actually track what the player aimed at
P_AimLineAttack (actor, angle, PLAYERMISSILERANGE, &linetarget, ANGLE_1*32);
P_AimLineAttack (self, angle, PLAYERMISSILERANGE, &linetarget, ANGLE_1*32);
if (linetarget == NULL)
{
BlockCheckLine.x = actor->x;
BlockCheckLine.y = actor->y;
BlockCheckLine.x = self->x;
BlockCheckLine.y = self->y;
BlockCheckLine.dx = -finesine[angle >> ANGLETOFINESHIFT];
BlockCheckLine.dy = -finecosine[angle >> ANGLETOFINESHIFT];
linetarget = P_BlockmapSearch (actor, 10, FrontBlockCheck);
linetarget = P_BlockmapSearch (self, 10, FrontBlockCheck);
}
MStaffSpawn (actor, angle);
MStaffSpawn (actor, angle-ANGLE_1*5);
MStaffSpawn (actor, angle+ANGLE_1*5);
S_Sound (actor, CHAN_WEAPON, "MageStaffFire", 1, ATTN_NORM);
MStaffSpawn (self, angle);
MStaffSpawn (self, angle-ANGLE_1*5);
MStaffSpawn (self, angle+ANGLE_1*5);
S_Sound (self, CHAN_WEAPON, "MageStaffFire", 1, ATTN_NORM);
weapon->MStaffCount = 3;
}
@ -213,11 +214,11 @@ void A_MStaffAttack (AActor *actor)
//
//============================================================================
void A_MStaffPalette (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MStaffPalette)
{
if (actor->player != NULL)
if (self->player != NULL)
{
AMWeapBloodscourge *weapon = static_cast<AMWeapBloodscourge *> (actor->player->ReadyWeapon);
AMWeapBloodscourge *weapon = static_cast<AMWeapBloodscourge *> (self->player->ReadyWeapon);
if (weapon != NULL && weapon->MStaffCount != 0)
{
weapon->MStaffCount--;
@ -231,13 +232,13 @@ void A_MStaffPalette (AActor *actor)
//
//============================================================================
void A_MStaffTrack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MStaffTrack)
{
if ((actor->tracer == 0) && (pr_mstafftrack()<50))
if ((self->tracer == 0) && (pr_mstafftrack()<50))
{
actor->tracer = P_RoughMonsterSearch (actor, 10);
self->tracer = P_RoughMonsterSearch (self, 10);
}
P_SeekerMissile (actor, ANGLE_1*2, ANGLE_1*10);
P_SeekerMissile (self, ANGLE_1*2, ANGLE_1*10);
}
//============================================================================
@ -291,15 +292,15 @@ void MStaffSpawn2 (AActor *actor, angle_t angle)
//
//============================================================================
void A_MageAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MageAttack)
{
if (!actor->target) return;
if (!self->target) return;
angle_t angle;
angle = actor->angle;
MStaffSpawn2 (actor, angle);
MStaffSpawn2 (actor, angle-ANGLE_1*5);
MStaffSpawn2 (actor, angle+ANGLE_1*5);
S_Sound (actor, CHAN_WEAPON, "MageStaffFire", 1, ATTN_NORM);
angle = self->angle;
MStaffSpawn2 (self, angle);
MStaffSpawn2 (self, angle-ANGLE_1*5);
MStaffSpawn2 (self, angle+ANGLE_1*5);
S_Sound (self, CHAN_WEAPON, "MageStaffFire", 1, ATTN_NORM);
}

View file

@ -10,6 +10,7 @@
#include "p_pspr.h"
#include "gstrings.h"
#include "a_hexenglobal.h"
#include "thingdef/thingdef.h"
static FRandom pr_smoke ("MWandSmoke");
@ -109,10 +110,10 @@ void AMageWandMissile::Tick ()
//
//============================================================================
void A_MWandAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MWandAttack)
{
AActor *mo;
mo = P_SpawnPlayerMissile (actor, RUNTIME_CLASS(AMageWandMissile));
S_Sound (actor, CHAN_WEAPON, "MageWandFire", 1, ATTN_NORM);
mo = P_SpawnPlayerMissile (self, RUNTIME_CLASS(AMageWandMissile));
S_Sound (self, CHAN_WEAPON, "MageWandFire", 1, ATTN_NORM);
}

View file

@ -10,6 +10,7 @@
#include "p_enemy.h"
#include "d_event.h"
#include "gstrings.h"
#include "thingdef/thingdef.h"
static FRandom pr_snoutattack ("SnoutAttack");
static FRandom pr_pigattack ("PigAttack");
@ -38,7 +39,7 @@ void APigPlayer::MorphPlayerThink ()
{ // Snout sniff
if (player->ReadyWeapon != NULL)
{
P_SetPspriteNF(player, ps_weapon, player->ReadyWeapon->FindState(NAME_Flash));
P_SetPsprite(player, ps_weapon, player->ReadyWeapon->FindState("Grunt"));
}
S_Sound (this, CHAN_VOICE, "PigActive1", 1, ATTN_NORM); // snort
return;
@ -55,7 +56,7 @@ void APigPlayer::MorphPlayerThink ()
//
//============================================================================
void A_SnoutAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SnoutAttack)
{
angle_t angle;
int damage;
@ -64,7 +65,7 @@ void A_SnoutAttack (AActor *actor)
AActor *puff;
AActor *linetarget;
if (NULL == (player = actor->player))
if (NULL == (player = self->player))
{
return;
}
@ -90,11 +91,11 @@ void A_SnoutAttack (AActor *actor)
//
//============================================================================
void A_PigPain (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_PigPain)
{
A_Pain (actor);
if (actor->z <= actor->floorz)
CALL_ACTION(A_Pain, self);
if (self->z <= self->floorz)
{
actor->momz = FRACUNIT*7/2;
self->momz = FRACUNIT*7/2;
}
}

View file

@ -6,6 +6,7 @@
#include "a_action.h"
#include "m_random.h"
#include "p_terrain.h"
#include "thingdef/thingdef.h"
static FRandom pr_serpentchase ("SerpentChase");
static FRandom pr_serpenthump ("SerpentHump");
@ -20,10 +21,10 @@ static FRandom pr_delaygib ("DelayGib");
//
//============================================================================
void A_SerpentUnHide (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SerpentUnHide)
{
actor->renderflags &= ~RF_INVISIBLE;
actor->floorclip = 24*FRACUNIT;
self->renderflags &= ~RF_INVISIBLE;
self->floorclip = 24*FRACUNIT;
}
//============================================================================
@ -32,10 +33,10 @@ void A_SerpentUnHide (AActor *actor)
//
//============================================================================
void A_SerpentHide (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SerpentHide)
{
actor->renderflags |= RF_INVISIBLE;
actor->floorclip = 0;
self->renderflags |= RF_INVISIBLE;
self->floorclip = 0;
}
//============================================================================
@ -45,9 +46,9 @@ void A_SerpentHide (AActor *actor)
// Raises the hump above the surface by raising the floorclip level
//============================================================================
void A_SerpentRaiseHump (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SerpentRaiseHump)
{
actor->floorclip -= 4*FRACUNIT;
self->floorclip -= 4*FRACUNIT;
}
//============================================================================
@ -56,9 +57,9 @@ void A_SerpentRaiseHump (AActor *actor)
//
//============================================================================
void A_SerpentLowerHump (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SerpentLowerHump)
{
actor->floorclip += 4*FRACUNIT;
self->floorclip += 4*FRACUNIT;
}
//============================================================================
@ -69,9 +70,9 @@ void A_SerpentLowerHump (AActor *actor)
// to missile attack
//============================================================================
void A_SerpentHumpDecide (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SerpentHumpDecide)
{
if (actor->MissileState != NULL)
if (self->MissileState != NULL)
{
if (pr_serpenthump() > 30)
{
@ -79,7 +80,7 @@ void A_SerpentHumpDecide (AActor *actor)
}
else if (pr_serpenthump() < 40)
{ // Missile attack
actor->SetState (actor->MeleeState);
self->SetState (self->MeleeState);
return;
}
}
@ -87,16 +88,16 @@ void A_SerpentHumpDecide (AActor *actor)
{
return;
}
if (!actor->CheckMeleeRange ())
if (!self->CheckMeleeRange ())
{ // The hump shouldn't occur when within melee range
if (actor->MissileState != NULL && pr_serpenthump() < 128)
if (self->MissileState != NULL && pr_serpenthump() < 128)
{
actor->SetState (actor->MeleeState);
self->SetState (self->MeleeState);
}
else
{
actor->SetState (actor->FindState ("Hump"));
S_Sound (actor, CHAN_BODY, "SerpentActive", 1, ATTN_NORM);
self->SetState (self->FindState ("Hump"));
S_Sound (self, CHAN_BODY, "SerpentActive", 1, ATTN_NORM);
}
}
}
@ -107,33 +108,33 @@ void A_SerpentHumpDecide (AActor *actor)
//
//============================================================================
void A_SerpentCheckForAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SerpentCheckForAttack)
{
if (!actor->target)
if (!self->target)
{
return;
}
if (actor->MissileState != NULL)
if (self->MissileState != NULL)
{
if (!actor->CheckMeleeRange ())
if (!self->CheckMeleeRange ())
{
actor->SetState (actor->FindState ("Attack"));
self->SetState (self->FindState ("Attack"));
return;
}
}
if (P_CheckMeleeRange2 (actor))
if (P_CheckMeleeRange2 (self))
{
actor->SetState (actor->FindState ("Walk"));
self->SetState (self->FindState ("Walk"));
}
else if (actor->CheckMeleeRange ())
else if (self->CheckMeleeRange ())
{
if (pr_serpentattack() < 32)
{
actor->SetState (actor->FindState ("Walk"));
self->SetState (self->FindState ("Walk"));
}
else
{
actor->SetState (actor->FindState ("Attack"));
self->SetState (self->FindState ("Attack"));
}
}
}
@ -144,15 +145,15 @@ void A_SerpentCheckForAttack (AActor *actor)
//
//============================================================================
void A_SerpentChooseAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SerpentChooseAttack)
{
if (!actor->target || actor->CheckMeleeRange())
if (!self->target || self->CheckMeleeRange())
{
return;
}
if (actor->MissileState != NULL)
if (self->MissileState != NULL)
{
actor->SetState (actor->MissileState);
self->SetState (self->MissileState);
}
}
@ -162,22 +163,22 @@ void A_SerpentChooseAttack (AActor *actor)
//
//============================================================================
void A_SerpentMeleeAttack (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SerpentMeleeAttack)
{
if (!actor->target)
if (!self->target)
{
return;
}
if (actor->CheckMeleeRange ())
if (self->CheckMeleeRange ())
{
int damage = pr_serpentmeattack.HitDice (5);
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, actor->target, actor);
S_Sound (actor, CHAN_BODY, "SerpentMeleeHit", 1, ATTN_NORM);
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, self->target, self);
S_Sound (self, CHAN_BODY, "SerpentMeleeHit", 1, ATTN_NORM);
}
if (pr_serpentmeattack() < 96)
{
A_SerpentCheckForAttack (actor);
CALL_ACTION(A_SerpentCheckForAttack, self);
}
}
@ -187,7 +188,7 @@ void A_SerpentMeleeAttack (AActor *actor)
//
//============================================================================
void A_SerpentSpawnGibs (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SerpentSpawnGibs)
{
AActor *mo;
static const char *GibTypes[] =
@ -200,9 +201,9 @@ void A_SerpentSpawnGibs (AActor *actor)
for (int i = countof(GibTypes)-1; i >= 0; --i)
{
mo = Spawn (GibTypes[i],
actor->x+((pr_serpentgibs()-128)<<12),
actor->y+((pr_serpentgibs()-128)<<12),
actor->floorz+FRACUNIT, ALLOW_REPLACE);
self->x+((pr_serpentgibs()-128)<<12),
self->y+((pr_serpentgibs()-128)<<12),
self->floorz+FRACUNIT, ALLOW_REPLACE);
if (mo)
{
mo->momx = (pr_serpentgibs()-128)<<6;
@ -218,9 +219,9 @@ void A_SerpentSpawnGibs (AActor *actor)
//
//============================================================================
void A_FloatGib (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FloatGib)
{
actor->floorclip -= FRACUNIT;
self->floorclip -= FRACUNIT;
}
//============================================================================
@ -229,9 +230,9 @@ void A_FloatGib (AActor *actor)
//
//============================================================================
void A_SinkGib (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SinkGib)
{
actor->floorclip += FRACUNIT;
self->floorclip += FRACUNIT;
}
//============================================================================
@ -240,9 +241,9 @@ void A_SinkGib (AActor *actor)
//
//============================================================================
void A_DelayGib (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_DelayGib)
{
actor->tics -= pr_delaygib()>>2;
self->tics -= pr_delaygib()>>2;
}
//============================================================================
@ -251,18 +252,18 @@ void A_DelayGib (AActor *actor)
//
//============================================================================
void A_SerpentHeadCheck (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SerpentHeadCheck)
{
if (actor->z <= actor->floorz)
if (self->z <= self->floorz)
{
if (Terrains[P_GetThingFloorType(actor)].IsLiquid)
if (Terrains[P_GetThingFloorType(self)].IsLiquid)
{
P_HitFloor (actor);
actor->SetState (NULL);
P_HitFloor (self);
self->SetState (NULL);
}
else
{
actor->SetState (actor->FindState(NAME_Death));
self->SetState (self->FindState(NAME_Death));
}
}
}

View file

@ -6,23 +6,19 @@
#include "a_sharedglobal.h"
#include "s_sound.h"
#include "m_bbox.h"
#include "thingdef/thingdef.h"
static FRandom pr_thrustraise ("ThrustRaise");
// Spike (thrust floor) -----------------------------------------------------
void A_ThrustInitUp (AActor *);
void A_ThrustInitDn (AActor *);
void A_ThrustRaise (AActor *);
void A_ThrustLower (AActor *);
void A_ThrustImpale (AActor *);
// AThrustFloor is just a container for all the spike states.
// All the real spikes subclass it.
class AThrustFloor : public AActor
{
DECLARE_CLASS (AThrustFloor, AActor)
HAS_OBJECT_POINTERS
public:
void Serialize (FArchive &arc);
@ -32,7 +28,9 @@ public:
TObjPtr<AActor> DirtClump;
};
IMPLEMENT_CLASS (AThrustFloor)
IMPLEMENT_POINTY_CLASS (AThrustFloor)
DECLARE_POINTER (DirtClump)
END_POINTERS
void AThrustFloor::Serialize (FArchive &arc)
{
@ -76,30 +74,30 @@ void AThrustFloor::Deactivate (AActor *activator)
// args[1] 0 = normal, 1 = bloody
//===========================================================================
void A_ThrustInitUp (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ThrustInitUp)
{
actor->special2 = 5; // Raise speed
actor->args[0] = 1; // Mark as up
actor->floorclip = 0;
actor->flags = MF_SOLID;
actor->flags2 = MF2_NOTELEPORT|MF2_FLOORCLIP;
actor->special1 = 0L;
self->special2 = 5; // Raise speed
self->args[0] = 1; // Mark as up
self->floorclip = 0;
self->flags = MF_SOLID;
self->flags2 = MF2_NOTELEPORT|MF2_FLOORCLIP;
self->special1 = 0L;
}
void A_ThrustInitDn (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ThrustInitDn)
{
actor->special2 = 5; // Raise speed
actor->args[0] = 0; // Mark as down
actor->floorclip = actor->GetDefault()->height;
actor->flags = 0;
actor->flags2 = MF2_NOTELEPORT|MF2_FLOORCLIP;
actor->renderflags = RF_INVISIBLE;
static_cast<AThrustFloor *>(actor)->DirtClump =
Spawn("DirtClump", actor->x, actor->y, actor->z, ALLOW_REPLACE);
self->special2 = 5; // Raise speed
self->args[0] = 0; // Mark as down
self->floorclip = self->GetDefault()->height;
self->flags = 0;
self->flags2 = MF2_NOTELEPORT|MF2_FLOORCLIP;
self->renderflags = RF_INVISIBLE;
static_cast<AThrustFloor *>(self)->DirtClump =
Spawn("DirtClump", self->x, self->y, self->z, ALLOW_REPLACE);
}
void A_ThrustRaise (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ThrustRaise)
{
AThrustFloor *actor = static_cast<AThrustFloor *>(self);
@ -125,25 +123,25 @@ void A_ThrustRaise (AActor *self)
actor->special2++; // Increase raise speed
}
void A_ThrustLower (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ThrustLower)
{
if (A_SinkMobj (actor, 6*FRACUNIT))
if (A_SinkMobj (self, 6*FRACUNIT))
{
actor->args[0] = 0;
if (actor->args[1])
actor->SetStateNF (actor->FindState ("BloodThrustInit1"));
self->args[0] = 0;
if (self->args[1])
self->SetStateNF (self->FindState ("BloodThrustInit1"));
else
actor->SetStateNF (actor->FindState ("ThrustInit1"));
self->SetStateNF (self->FindState ("ThrustInit1"));
}
}
void A_ThrustImpale (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ThrustImpale)
{
AActor *thing;
FBlockThingsIterator it(FBoundingBox(actor->x, actor->y, actor->radius));
FBlockThingsIterator it(FBoundingBox(self->x, self->y, self->radius));
while ((thing = it.Next()))
{
if (!thing->intersects(actor))
if (!thing->intersects(self))
{
continue;
}
@ -151,12 +149,12 @@ void A_ThrustImpale (AActor *actor)
if (!(thing->flags & MF_SHOOTABLE) )
continue;
if (thing == actor)
if (thing == self)
continue; // don't clip against self
P_DamageMobj (thing, actor, actor, 10001, NAME_Crush);
P_DamageMobj (thing, self, self, 10001, NAME_Crush);
P_TraceBleed (10001, thing);
actor->args[1] = 1; // Mark thrust thing as bloody
self->args[1] = 1; // Mark thrust thing as bloody
}
}

View file

@ -6,6 +6,7 @@
#include "p_enemy.h"
#include "s_sound.h"
#include "ravenshared.h"
#include "thingdef/thingdef.h"
void A_Summon (AActor *);
@ -44,39 +45,39 @@ bool AArtiDarkServant::Use (bool pickup)
//
//============================================================================
void A_Summon (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Summon)
{
AMinotaurFriend *mo;
mo = Spawn<AMinotaurFriend> (actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn<AMinotaurFriend> (self->x, self->y, self->z, ALLOW_REPLACE);
if (mo)
{
if (P_TestMobjLocation(mo) == false || !actor->tracer)
if (P_TestMobjLocation(mo) == false || !self->tracer)
{ // Didn't fit - change back to artifact
mo->Destroy ();
AActor *arti = Spawn<AArtiDarkServant> (actor->x, actor->y, actor->z, ALLOW_REPLACE);
AActor *arti = Spawn<AArtiDarkServant> (self->x, self->y, self->z, ALLOW_REPLACE);
if (arti) arti->flags |= MF_DROPPED;
return;
}
mo->StartTime = level.maptime;
if (actor->tracer->flags & MF_CORPSE)
if (self->tracer->flags & MF_CORPSE)
{ // Master dead
mo->tracer = NULL; // No master
}
else
{
mo->tracer = actor->tracer; // Pointer to master
mo->tracer = self->tracer; // Pointer to master
AInventory *power = Spawn<APowerMinotaur> (0, 0, 0, NO_REPLACE);
power->TryPickup (actor->tracer);
if (actor->tracer->player != NULL)
power->TryPickup (self->tracer);
if (self->tracer->player != NULL)
{
mo->FriendPlayer = int(actor->tracer->player - players + 1);
mo->FriendPlayer = int(self->tracer->player - players + 1);
}
}
// Make smoke puff
Spawn ("MinotaurSmoke", actor->x, actor->y, actor->z, ALLOW_REPLACE);
S_Sound (actor, CHAN_VOICE, mo->ActiveSound, 1, ATTN_NORM);
Spawn ("MinotaurSmoke", self->x, self->y, self->z, ALLOW_REPLACE);
S_Sound (self, CHAN_VOICE, mo->ActiveSound, 1, ATTN_NORM);
}
}

View file

@ -7,6 +7,7 @@
#include "s_sound.h"
#include "p_lnspec.h"
#include "m_random.h"
#include "thingdef/thingdef.h"
#define TELEPORT_LIFE 1
@ -59,31 +60,31 @@ static void TeloSpawn (AActor *source, const char *type)
}
}
void A_TeloSpawnA (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_TeloSpawnA)
{
TeloSpawn (actor, "TelOtherFX2");
TeloSpawn (self, "TelOtherFX2");
}
void A_TeloSpawnB (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_TeloSpawnB)
{
TeloSpawn (actor, "TelOtherFX3");
TeloSpawn (self, "TelOtherFX3");
}
void A_TeloSpawnC (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_TeloSpawnC)
{
TeloSpawn (actor, "TelOtherFX4");
TeloSpawn (self, "TelOtherFX4");
}
void A_TeloSpawnD (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_TeloSpawnD)
{
TeloSpawn (actor, "TelOtherFX5");
TeloSpawn (self, "TelOtherFX5");
}
void A_CheckTeleRing (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CheckTeleRing)
{
if (actor->special1-- <= 0)
if (self->special1-- <= 0)
{
actor->SetState (actor->FindState(NAME_Death));
self->SetState (self->FindState(NAME_Death));
}
}

View file

@ -6,6 +6,7 @@
#include "a_action.h"
#include "m_random.h"
#include "a_sharedglobal.h"
#include "thingdef/thingdef.h"
static FRandom pr_stealhealth ("StealHealth");
static FRandom pr_wraithfx2 ("WraithFX2");
@ -24,17 +25,17 @@ static FRandom pr_wraithfx4 ("WraithFX4");
//
//============================================================================
void A_WraithInit (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_WraithInit)
{
actor->z += 48<<FRACBITS;
self->z += 48<<FRACBITS;
// [RH] Make sure the wraith didn't go into the ceiling
if (actor->z + actor->height > actor->ceilingz)
if (self->z + self->height > self->ceilingz)
{
actor->z = actor->ceilingz - actor->height;
self->z = self->ceilingz - self->height;
}
actor->special1 = 0; // index into floatbob
self->special1 = 0; // index into floatbob
}
//============================================================================
@ -43,13 +44,13 @@ void A_WraithInit (AActor *actor)
//
//============================================================================
void A_WraithRaiseInit (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_WraithRaiseInit)
{
actor->renderflags &= ~RF_INVISIBLE;
actor->flags2 &= ~MF2_NONSHOOTABLE;
actor->flags3 &= ~MF3_DONTBLAST;
actor->flags |= MF_SHOOTABLE|MF_SOLID;
actor->floorclip = actor->height;
self->renderflags &= ~RF_INVISIBLE;
self->flags2 &= ~MF2_NONSHOOTABLE;
self->flags3 &= ~MF3_DONTBLAST;
self->flags |= MF_SHOOTABLE|MF_SOLID;
self->floorclip = self->height;
}
//============================================================================
@ -58,20 +59,20 @@ void A_WraithRaiseInit (AActor *actor)
//
//============================================================================
void A_WraithRaise (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_WraithRaise)
{
if (A_RaiseMobj (actor, 2*FRACUNIT))
if (A_RaiseMobj (self, 2*FRACUNIT))
{
// Reached it's target height
// [RH] Once a buried wraith is fully raised, it should be
// morphable, right?
actor->flags3 &= ~(MF3_DONTMORPH|MF3_SPECIALFLOORCLIP);
actor->SetState (actor->FindState("Chase"));
self->flags3 &= ~(MF3_DONTMORPH|MF3_SPECIALFLOORCLIP);
self->SetState (self->FindState("Chase"));
// [RH] Reset PainChance to a normal wraith's.
actor->PainChance = GetDefaultByName ("Wraith")->PainChance;
self->PainChance = GetDefaultByName ("Wraith")->PainChance;
}
P_SpawnDirt (actor, actor->radius);
P_SpawnDirt (self, self->radius);
}
//============================================================================
@ -80,16 +81,16 @@ void A_WraithRaise (AActor *actor)
//
//============================================================================
void A_WraithMelee (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_WraithMelee)
{
int amount;
// Steal health from target and give to self
if (actor->CheckMeleeRange() && (pr_stealhealth()<220))
if (self->CheckMeleeRange() && (pr_stealhealth()<220))
{
amount = pr_stealhealth.HitDice (2);
P_DamageMobj (actor->target, actor, actor, amount, NAME_Melee);
actor->health += amount;
P_DamageMobj (self->target, self, self, amount, NAME_Melee);
self->health += amount;
}
}
@ -99,7 +100,7 @@ void A_WraithMelee (AActor *actor)
//
//============================================================================
void A_WraithFX2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_WraithFX2)
{
AActor *mo;
angle_t angle;
@ -107,23 +108,23 @@ void A_WraithFX2 (AActor *actor)
for (i = 2; i; --i)
{
mo = Spawn ("WraithFX2", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn ("WraithFX2", self->x, self->y, self->z, ALLOW_REPLACE);
if(mo)
{
if (pr_wraithfx2 ()<128)
{
angle = actor->angle+(pr_wraithfx2()<<22);
angle = self->angle+(pr_wraithfx2()<<22);
}
else
{
angle = actor->angle-(pr_wraithfx2()<<22);
angle = self->angle-(pr_wraithfx2()<<22);
}
mo->momz = 0;
mo->momx = FixedMul((pr_wraithfx2()<<7)+FRACUNIT,
finecosine[angle>>ANGLETOFINESHIFT]);
mo->momy = FixedMul((pr_wraithfx2()<<7)+FRACUNIT,
finesine[angle>>ANGLETOFINESHIFT]);
mo->target = actor;
mo->target = self;
mo->floorclip = 10*FRACUNIT;
}
}
@ -133,24 +134,24 @@ void A_WraithFX2 (AActor *actor)
//
// A_WraithFX3
//
// Spawn an FX3 around the actor during attacks
// Spawn an FX3 around the self during attacks
//
//============================================================================
void A_WraithFX3 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_WraithFX3)
{
AActor *mo;
int numdropped = pr_wraithfx3()%15;
while (numdropped-- > 0)
{
mo = Spawn ("WraithFX3", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn ("WraithFX3", self->x, self->y, self->z, ALLOW_REPLACE);
if (mo)
{
mo->x += (pr_wraithfx3()-128)<<11;
mo->y += (pr_wraithfx3()-128)<<11;
mo->z += (pr_wraithfx3()<<10);
mo->target = actor;
mo->target = self;
}
}
}
@ -163,7 +164,7 @@ void A_WraithFX3 (AActor *actor)
//
//============================================================================
void A_WraithFX4 (AActor *actor)
void A_WraithFX4 (AActor *self)
{
AActor *mo;
int chance = pr_wraithfx4();
@ -192,24 +193,24 @@ void A_WraithFX4 (AActor *actor)
if (spawn4)
{
mo = Spawn ("WraithFX4", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn ("WraithFX4", self->x, self->y, self->z, ALLOW_REPLACE);
if (mo)
{
mo->x += (pr_wraithfx4()-128)<<12;
mo->y += (pr_wraithfx4()-128)<<12;
mo->z += (pr_wraithfx4()<<10);
mo->target = actor;
mo->target = self;
}
}
if (spawn5)
{
mo = Spawn ("WraithFX5", actor->x, actor->y, actor->z, ALLOW_REPLACE);
mo = Spawn ("WraithFX5", self->x, self->y, self->z, ALLOW_REPLACE);
if (mo)
{
mo->x += (pr_wraithfx4()-128)<<11;
mo->y += (pr_wraithfx4()-128)<<11;
mo->z += (pr_wraithfx4()<<10);
mo->target = actor;
mo->target = self;
}
}
}
@ -220,16 +221,16 @@ void A_WraithFX4 (AActor *actor)
//
//============================================================================
void A_WraithChase (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_WraithChase)
{
int weaveindex = actor->special1;
actor->z += FloatBobOffsets[weaveindex];
actor->special1 = (weaveindex+2)&63;
// if (actor->floorclip > 0)
int weaveindex = self->special1;
self->z += FloatBobOffsets[weaveindex];
self->special1 = (weaveindex+2)&63;
// if (self->floorclip > 0)
// {
// P_SetMobjState(actor, S_WRAITH_RAISE2);
// P_SetMobjState(self, S_WRAITH_RAISE2);
// return;
// }
A_Chase (actor);
A_WraithFX4 (actor);
A_Chase (self);
A_WraithFX4 (self);
}

View file

@ -8,6 +8,7 @@
#include "a_action.h"
#include "gi.h"
#include "w_wad.h"
#include "thingdef/thingdef.h"
#define MAULATORTICS (25*35)
@ -20,10 +21,10 @@ static FRandom pr_minotaurslam ("MinotaurSlam");
static FRandom pr_minotaurroam ("MinotaurRoam");
static FRandom pr_minotaurchase ("MinotaurChase");
void A_MinotaurLook (AActor *);
void P_MinotaurSlam (AActor *source, AActor *target);
DECLARE_ACTION(A_MinotaurLook)
IMPLEMENT_CLASS(AMinotaur)
void AMinotaur::Tick ()
@ -169,29 +170,29 @@ bool AMinotaurFriend::OkayToSwitchTarget (AActor *other)
//
//----------------------------------------------------------------------------
void A_MinotaurDeath (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDeath)
{
if (Wads.CheckNumForName ("MNTRF1", ns_sprites) < 0 &&
Wads.CheckNumForName ("MNTRF0", ns_sprites) < 0)
actor->SetState(actor->FindState ("FadeOut"));
self->SetState(self->FindState ("FadeOut"));
}
void A_MinotaurAtk1 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk1)
{
player_t *player;
if (!actor->target)
if (!self->target)
{
return;
}
S_Sound (actor, CHAN_WEAPON, "minotaur/melee", 1, ATTN_NORM);
if (actor->CheckMeleeRange())
S_Sound (self, CHAN_WEAPON, "minotaur/melee", 1, ATTN_NORM);
if (self->CheckMeleeRange())
{
int damage = pr_minotauratk1.HitDice (4);
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, actor->target, actor);
if ((player = actor->target->player) != NULL &&
player->mo == actor->target)
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, self->target, self);
if ((player = self->target->player) != NULL &&
player->mo == self->target)
{ // Squish the player
player->deltaviewheight = -16*FRACUNIT;
}
@ -208,52 +209,52 @@ void A_MinotaurAtk1 (AActor *actor)
#define MNTR_CHARGE_SPEED (13*FRACUNIT)
void A_MinotaurDecide (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurDecide)
{
bool friendly = !!(actor->flags5 & MF5_SUMMONEDMONSTER);
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
angle_t angle;
AActor *target;
int dist;
target = actor->target;
target = self->target;
if (!target)
{
return;
}
if (!friendly)
{
S_Sound (actor, CHAN_WEAPON, "minotaur/sight", 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, "minotaur/sight", 1, ATTN_NORM);
}
dist = P_AproxDistance (actor->x-target->x, actor->y-target->y);
if (target->z+target->height > actor->z
&& target->z+target->height < actor->z+actor->height
dist = P_AproxDistance (self->x-target->x, self->y-target->y);
if (target->z+target->height > self->z
&& target->z+target->height < self->z+self->height
&& dist < (friendly ? 16*64*FRACUNIT : 8*64*FRACUNIT)
&& dist > 1*64*FRACUNIT
&& pr_minotaurdecide() < 150)
{ // Charge attack
// Don't call the state function right away
actor->SetStateNF (actor->FindState ("Charge"));
actor->flags |= MF_SKULLFLY;
self->SetStateNF (self->FindState ("Charge"));
self->flags |= MF_SKULLFLY;
if (!friendly)
{ // Heretic's Minotaur is invulnerable during charge attack
actor->flags2 |= MF2_INVULNERABLE;
self->flags2 |= MF2_INVULNERABLE;
}
A_FaceTarget (actor);
angle = actor->angle>>ANGLETOFINESHIFT;
actor->momx = FixedMul (MNTR_CHARGE_SPEED, finecosine[angle]);
actor->momy = FixedMul (MNTR_CHARGE_SPEED, finesine[angle]);
actor->special1 = TICRATE/2; // Charge duration
A_FaceTarget (self);
angle = self->angle>>ANGLETOFINESHIFT;
self->momx = FixedMul (MNTR_CHARGE_SPEED, finecosine[angle]);
self->momy = FixedMul (MNTR_CHARGE_SPEED, finesine[angle]);
self->special1 = TICRATE/2; // Charge duration
}
else if (target->z == target->floorz
&& dist < 9*64*FRACUNIT
&& pr_minotaurdecide() < (friendly ? 100 : 220))
{ // Floor fire attack
actor->SetState (actor->FindState ("Hammer"));
actor->special2 = 0;
self->SetState (self->FindState ("Hammer"));
self->special2 = 0;
}
else
{ // Swing attack
A_FaceTarget (actor);
A_FaceTarget (self);
// Don't need to call P_SetMobjState because the current state
// falls through to the swing attack
}
@ -265,13 +266,13 @@ void A_MinotaurDecide (AActor *actor)
//
//----------------------------------------------------------------------------
void A_MinotaurCharge (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurCharge)
{
AActor *puff;
if (!actor->target) return;
if (!self->target) return;
if (actor->special1 > 0)
if (self->special1 > 0)
{
const PClass *type;
@ -283,15 +284,15 @@ void A_MinotaurCharge (AActor *actor)
{
type = PClass::FindClass ("PunchPuff");
}
puff = Spawn (type, actor->x, actor->y, actor->z, ALLOW_REPLACE);
puff = Spawn (type, self->x, self->y, self->z, ALLOW_REPLACE);
puff->momz = 2*FRACUNIT;
actor->special1--;
self->special1--;
}
else
{
actor->flags &= ~MF_SKULLFLY;
actor->flags2 &= ~MF2_INVULNERABLE;
actor->SetState (actor->SeeState);
self->flags &= ~MF_SKULLFLY;
self->flags2 &= ~MF2_INVULNERABLE;
self->SetState (self->SeeState);
}
}
@ -303,41 +304,41 @@ void A_MinotaurCharge (AActor *actor)
//
//----------------------------------------------------------------------------
void A_MinotaurAtk2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk2)
{
AActor *mo;
angle_t angle;
fixed_t momz;
fixed_t z;
bool friendly = !!(actor->flags5 & MF5_SUMMONEDMONSTER);
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
if (!actor->target)
if (!self->target)
{
return;
}
S_Sound (actor, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM);
if (actor->CheckMeleeRange())
S_Sound (self, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM);
if (self->CheckMeleeRange())
{
int damage;
damage = pr_atk.HitDice (friendly ? 3 : 5);
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, actor->target, actor);
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, self->target, self);
return;
}
z = actor->z + 40*FRACUNIT;
z = self->z + 40*FRACUNIT;
const PClass *fx = PClass::FindClass("MinotaurFX1");
if (fx)
{
mo = P_SpawnMissileZ (actor, z, actor->target, fx);
mo = P_SpawnMissileZ (self, z, self->target, fx);
if (mo != NULL)
{
// S_Sound (mo, CHAN_WEAPON, "minotaur/attack2", 1, ATTN_NORM);
momz = mo->momz;
angle = mo->angle;
P_SpawnMissileAngleZ (actor, z, fx, angle-(ANG45/8), momz);
P_SpawnMissileAngleZ (actor, z, fx, angle+(ANG45/8), momz);
P_SpawnMissileAngleZ (actor, z, fx, angle-(ANG45/16), momz);
P_SpawnMissileAngleZ (actor, z, fx, angle+(ANG45/16), momz);
P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/8), momz);
P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/8), momz);
P_SpawnMissileAngleZ (self, z, fx, angle-(ANG45/16), momz);
P_SpawnMissileAngleZ (self, z, fx, angle+(ANG45/16), momz);
}
}
}
@ -350,42 +351,42 @@ void A_MinotaurAtk2 (AActor *actor)
//
//----------------------------------------------------------------------------
void A_MinotaurAtk3 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurAtk3)
{
AActor *mo;
player_t *player;
bool friendly = !!(actor->flags5 & MF5_SUMMONEDMONSTER);
bool friendly = !!(self->flags5 & MF5_SUMMONEDMONSTER);
if (!actor->target)
if (!self->target)
{
return;
}
S_Sound (actor, CHAN_VOICE, "minotaur/attack3", 1, ATTN_NORM);
if (actor->CheckMeleeRange())
S_Sound (self, CHAN_VOICE, "minotaur/attack3", 1, ATTN_NORM);
if (self->CheckMeleeRange())
{
int damage;
damage = pr_minotauratk3.HitDice (friendly ? 3 : 5);
P_DamageMobj (actor->target, actor, actor, damage, NAME_Melee);
P_TraceBleed (damage, actor->target, actor);
if ((player = actor->target->player) != NULL &&
player->mo == actor->target)
P_DamageMobj (self->target, self, self, damage, NAME_Melee);
P_TraceBleed (damage, self->target, self);
if ((player = self->target->player) != NULL &&
player->mo == self->target)
{ // Squish the player
player->deltaviewheight = -16*FRACUNIT;
}
}
else
{
mo = P_SpawnMissile (actor, actor->target, PClass::FindClass("MinotaurFX2"));
mo = P_SpawnMissile (self, self->target, PClass::FindClass("MinotaurFX2"));
if (mo != NULL)
{
S_Sound (mo, CHAN_WEAPON, "minotaur/attack1", 1, ATTN_NORM);
}
}
if (pr_minotauratk3() < 192 && actor->special2 == 0)
if (pr_minotauratk3() < 192 && self->special2 == 0)
{
actor->SetState (actor->FindState ("Hammer"));
actor->special2 = 1;
self->SetState (self->FindState ("HammerLoop"));
self->special2 = 1;
}
}
@ -395,16 +396,16 @@ void A_MinotaurAtk3 (AActor *actor)
//
//----------------------------------------------------------------------------
void A_MntrFloorFire (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MntrFloorFire)
{
AActor *mo;
fixed_t x, y;
actor->z = actor->floorz;
x = actor->x + (pr_fire.Random2 () << 10);
y = actor->y + (pr_fire.Random2 () << 10);
self->z = self->floorz;
x = self->x + (pr_fire.Random2 () << 10);
y = self->y + (pr_fire.Random2 () << 10);
mo = Spawn("MinotaurFX3", x, y, ONFLOORZ, ALLOW_REPLACE);
mo->target = actor->target;
mo->target = self->target;
mo->momx = 1; // Force block checking
P_CheckMissileSpawn (mo);
}
@ -451,36 +452,36 @@ void P_MinotaurSlam (AActor *source, AActor *target)
//
//----------------------------------------------------------------------------
void A_MinotaurRoam (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurRoam)
{
AMinotaurFriend *self = static_cast<AMinotaurFriend *> (actor);
AMinotaurFriend *self1 = static_cast<AMinotaurFriend *> (self);
// In case pain caused him to skip his fade in.
actor->RenderStyle = STYLE_Normal;
self1->RenderStyle = STYLE_Normal;
if (self->StartTime >= 0 && (level.maptime - self->StartTime) >= MAULATORTICS)
if (self1->StartTime >= 0 && (level.maptime - self1->StartTime) >= MAULATORTICS)
{
P_DamageMobj (actor, NULL, NULL, 1000000, NAME_None);
P_DamageMobj (self1, NULL, NULL, 1000000, NAME_None);
return;
}
if (pr_minotaurroam() < 30)
A_MinotaurLook (actor); // adjust to closest target
CALL_ACTION(A_MinotaurLook, self1); // adjust to closest target
if (pr_minotaurroam() < 6)
{
//Choose new direction
actor->movedir = pr_minotaurroam() % 8;
FaceMovementDirection (actor);
self1->movedir = pr_minotaurroam() % 8;
FaceMovementDirection (self1);
}
if (!P_Move(actor))
if (!P_Move(self1))
{
// Turn
if (pr_minotaurroam() & 1)
actor->movedir = (++actor->movedir)%8;
self1->movedir = (++self1->movedir)%8;
else
actor->movedir = (actor->movedir+7)%8;
FaceMovementDirection (actor);
self1->movedir = (self1->movedir+7)%8;
FaceMovementDirection (self1);
}
}
@ -493,11 +494,11 @@ void A_MinotaurRoam (AActor *actor)
//----------------------------------------------------------------------------
#define MINOTAUR_LOOK_DIST (16*54*FRACUNIT)
void A_MinotaurLook (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook)
{
if (!actor->IsKindOf(RUNTIME_CLASS(AMinotaurFriend)))
if (!self->IsKindOf(RUNTIME_CLASS(AMinotaurFriend)))
{
A_Look (actor);
CALL_ACTION(A_Look, self);
return;
}
@ -505,9 +506,9 @@ void A_MinotaurLook (AActor *actor)
player_t *player;
fixed_t dist;
int i;
AActor *master = actor->tracer;
AActor *master = self->tracer;
actor->target = NULL;
self->target = NULL;
if (deathmatch) // Quick search for players
{
for (i = 0; i < MAXPLAYERS; i++)
@ -517,23 +518,23 @@ void A_MinotaurLook (AActor *actor)
mo = player->mo;
if (mo == master) continue;
if (mo->health <= 0) continue;
dist = P_AproxDistance(actor->x - mo->x, actor->y - mo->y);
dist = P_AproxDistance(self->x - mo->x, self->y - mo->y);
if (dist > MINOTAUR_LOOK_DIST) continue;
actor->target = mo;
self->target = mo;
break;
}
}
if (!actor->target) // Near player monster search
if (!self->target) // Near player monster search
{
if (master && (master->health>0) && (master->player))
mo = P_RoughMonsterSearch(master, 20);
else
mo = P_RoughMonsterSearch(actor, 20);
actor->target = mo;
mo = P_RoughMonsterSearch(self, 20);
self->target = mo;
}
if (!actor->target) // Normal monster search
if (!self->target) // Normal monster search
{
FActorIterator iterator (0);
@ -542,86 +543,86 @@ void A_MinotaurLook (AActor *actor)
if (!(mo->flags3&MF3_ISMONSTER)) continue;
if (mo->health <= 0) continue;
if (!(mo->flags&MF_SHOOTABLE)) continue;
dist = P_AproxDistance (actor->x - mo->x, actor->y - mo->y);
dist = P_AproxDistance (self->x - mo->x, self->y - mo->y);
if (dist > MINOTAUR_LOOK_DIST) continue;
if ((mo == master) || (mo == actor)) continue;
if ((mo == master) || (mo == self)) continue;
if ((mo->flags5 & MF5_SUMMONEDMONSTER) && (mo->tracer == master)) continue;
actor->target = mo;
self->target = mo;
break; // Found actor to attack
}
}
if (actor->target)
if (self->target)
{
actor->SetStateNF (actor->SeeState);
self->SetStateNF (self->SeeState);
}
else
{
actor->SetStateNF (actor->FindState ("Roam"));
self->SetStateNF (self->FindState ("Roam"));
}
}
void A_MinotaurChase (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MinotaurChase)
{
if (!actor->IsKindOf(RUNTIME_CLASS(AMinotaurFriend)))
if (!self->IsKindOf(RUNTIME_CLASS(AMinotaurFriend)))
{
A_Chase (actor);
A_Chase (self);
return;
}
AMinotaurFriend *self = static_cast<AMinotaurFriend *> (actor);
AMinotaurFriend *self1 = static_cast<AMinotaurFriend *> (self);
// In case pain caused him to skip his fade in.
actor->RenderStyle = STYLE_Normal;
self1->RenderStyle = STYLE_Normal;
if (self->StartTime >= 0 && (level.maptime - self->StartTime) >= MAULATORTICS)
if (self1->StartTime >= 0 && (level.maptime - self1->StartTime) >= MAULATORTICS)
{
P_DamageMobj (actor, NULL, NULL, 1000000, NAME_None);
P_DamageMobj (self1, NULL, NULL, 1000000, NAME_None);
return;
}
if (pr_minotaurchase() < 30)
A_MinotaurLook (actor); // adjust to closest target
CALL_ACTION(A_MinotaurLook, self1); // adjust to closest target
if (!actor->target || (actor->target->health <= 0) ||
!(actor->target->flags&MF_SHOOTABLE))
if (!self1->target || (self1->target->health <= 0) ||
!(self1->target->flags&MF_SHOOTABLE))
{ // look for a new target
actor->SetState (actor->FindState ("Spawn"));
self1->SetState (self1->FindState ("Spawn"));
return;
}
FaceMovementDirection (actor);
actor->reactiontime = 0;
FaceMovementDirection (self1);
self1->reactiontime = 0;
// Melee attack
if (actor->MeleeState && actor->CheckMeleeRange ())
if (self1->MeleeState && self1->CheckMeleeRange ())
{
if (actor->AttackSound)
if (self1->AttackSound)
{
S_Sound (actor, CHAN_WEAPON, actor->AttackSound, 1, ATTN_NORM);
S_Sound (self1, CHAN_WEAPON, self1->AttackSound, 1, ATTN_NORM);
}
actor->SetState (actor->MeleeState);
self1->SetState (self1->MeleeState);
return;
}
// Missile attack
if (actor->MissileState && P_CheckMissileRange(actor))
if (self1->MissileState && P_CheckMissileRange(self1))
{
actor->SetState (actor->MissileState);
self1->SetState (self1->MissileState);
return;
}
// chase towards target
if (!P_Move (actor))
if (!P_Move (self1))
{
P_NewChaseDir (actor);
FaceMovementDirection (actor);
P_NewChaseDir (self1);
FaceMovementDirection (self1);
}
// Active sound
if (pr_minotaurchase() < 6)
{
actor->PlayActiveSound ();
self1->PlayActiveSound ();
}
}

View file

@ -11,6 +11,7 @@
#include "p_enemy.h"
#include "statnums.h"
#include "templates.h"
#include "r_translate.h"
static FRandom pr_freezedeath ("FreezeDeath");
static FRandom pr_icesettics ("IceSetTics");
@ -56,31 +57,31 @@ IMPLEMENT_CLASS (ASwitchingDecoration)
//
//----------------------------------------------------------------------------
void A_NoBlocking (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_NoBlocking)
{
// [RH] Andy Baker's stealth monsters
if (actor->flags & MF_STEALTH)
if (self->flags & MF_STEALTH)
{
actor->alpha = OPAQUE;
actor->visdir = 0;
self->alpha = OPAQUE;
self->visdir = 0;
}
actor->flags &= ~MF_SOLID;
self->flags &= ~MF_SOLID;
// If the actor has a conversation that sets an item to drop, drop that.
if (actor->Conversation != NULL && actor->Conversation->DropType != NULL)
// If the self has a conversation that sets an item to drop, drop that.
if (self->Conversation != NULL && self->Conversation->DropType != NULL)
{
P_DropItem (actor, actor->Conversation->DropType, -1, 256);
actor->Conversation = NULL;
P_DropItem (self, self->Conversation->DropType, -1, 256);
self->Conversation = NULL;
return;
}
actor->Conversation = NULL;
self->Conversation = NULL;
// If the actor has attached metadata for items to drop, drop those.
if (!actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) // [GRB]
// If the self has attached metadata for items to drop, drop those.
if (!self->IsKindOf (RUNTIME_CLASS (APlayerPawn))) // [GRB]
{
FDropItem *di = GetDropItems(RUNTIME_TYPE(actor));
FDropItem *di = GetDropItems(RUNTIME_TYPE(self));
if (di != NULL)
{
@ -89,7 +90,7 @@ void A_NoBlocking (AActor *actor)
if (di->Name != NAME_None)
{
const PClass *ti = PClass::FindClass(di->Name);
if (ti) P_DropItem (actor, ti, di->amount, di->probability);
if (ti) P_DropItem (self, ti, di->amount, di->probability);
}
di = di->Next;
}
@ -97,16 +98,21 @@ void A_NoBlocking (AActor *actor)
}
}
DEFINE_ACTION_FUNCTION(AActor, A_Fall)
{
CALL_ACTION(A_NoBlocking, self);
}
//==========================================================================
//
// A_SetFloorClip
//
//==========================================================================
void A_SetFloorClip (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SetFloorClip)
{
actor->flags2 |= MF2_FLOORCLIP;
actor->AdjustFloorClip ();
self->flags2 |= MF2_FLOORCLIP;
self->AdjustFloorClip ();
}
//==========================================================================
@ -115,10 +121,10 @@ void A_SetFloorClip (AActor *actor)
//
//==========================================================================
void A_UnSetFloorClip (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_UnSetFloorClip)
{
actor->flags2 &= ~MF2_FLOORCLIP;
actor->floorclip = 0;
self->flags2 &= ~MF2_FLOORCLIP;
self->floorclip = 0;
}
//==========================================================================
@ -127,9 +133,9 @@ void A_UnSetFloorClip (AActor *actor)
//
//==========================================================================
void A_HideThing (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_HideThing)
{
actor->renderflags |= RF_INVISIBLE;
self->renderflags |= RF_INVISIBLE;
}
//==========================================================================
@ -138,9 +144,9 @@ void A_HideThing (AActor *actor)
//
//==========================================================================
void A_UnHideThing (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_UnHideThing)
{
actor->renderflags &= ~RF_INVISIBLE;
self->renderflags &= ~RF_INVISIBLE;
}
//============================================================================
@ -149,56 +155,68 @@ void A_UnHideThing (AActor *actor)
//
//============================================================================
void A_FreezeDeath (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeath)
{
int t = pr_freezedeath();
actor->tics = 75+t+pr_freezedeath();
actor->flags |= MF_SOLID|MF_SHOOTABLE|MF_NOBLOOD|MF_ICECORPSE;
actor->flags2 |= MF2_PUSHABLE|MF2_TELESTOMP|MF2_PASSMOBJ|MF2_SLIDE;
actor->flags3 |= MF3_CRASHED;
actor->height = actor->GetDefault()->height;
S_Sound (actor, CHAN_BODY, "misc/freeze", 1, ATTN_NORM);
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);
// [RH] Andy Baker's stealth monsters
if (actor->flags & MF_STEALTH)
if (self->flags & MF_STEALTH)
{
actor->alpha = OPAQUE;
actor->visdir = 0;
self->alpha = OPAQUE;
self->visdir = 0;
}
if (actor->player)
if (self->player)
{
actor->player->damagecount = 0;
actor->player->poisoncount = 0;
actor->player->bonuscount = 0;
self->player->damagecount = 0;
self->player->poisoncount = 0;
self->player->bonuscount = 0;
}
else if (actor->flags3&MF3_ISMONSTER && actor->special)
else if (self->flags3&MF3_ISMONSTER && self->special)
{ // Initiate monster death actions
LineSpecials [actor->special] (NULL, actor, false, actor->args[0],
actor->args[1], actor->args[2], actor->args[3], actor->args[4]);
actor->special = 0;
LineSpecials [self->special] (NULL, self, false, self->args[0],
self->args[1], self->args[2], self->args[3], self->args[4]);
self->special = 0;
}
}
//==========================================================================
//
// A_GenericFreezeDeath
//
//==========================================================================
DEFINE_ACTION_FUNCTION(AActor, A_GenericFreezeDeath)
{
self->Translation = TRANSLATION(TRANSLATION_Standard, 7);
CALL_ACTION(A_FreezeDeath, self);
}
//============================================================================
//
// A_IceSetTics
//
//============================================================================
void A_IceSetTics (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_IceSetTics)
{
int floor;
actor->tics = 70+(pr_icesettics()&63);
floor = P_GetThingFloorType (actor);
self->tics = 70+(pr_icesettics()&63);
floor = P_GetThingFloorType (self);
if (Terrains[floor].DamageMOD == NAME_Fire)
{
actor->tics >>= 2;
self->tics >>= 2;
}
else if (Terrains[floor].DamageMOD == NAME_Ice)
{
actor->tics <<= 1;
self->tics <<= 1;
}
}
@ -208,77 +226,77 @@ void A_IceSetTics (AActor *actor)
//
//============================================================================
void A_FreezeDeathChunks (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks)
{
int i;
int numChunks;
AActor *mo;
if (actor->momx || actor->momy || actor->momz)
if (self->momx || self->momy || self->momz)
{
actor->tics = 3*TICRATE;
self->tics = 3*TICRATE;
return;
}
S_Sound (actor, CHAN_BODY, "misc/icebreak", 1, ATTN_NORM);
S_Sound (self, CHAN_BODY, "misc/icebreak", 1, ATTN_NORM);
// [RH] In Hexen, this creates a random number of shards (range [24,56])
// with no relation to the size of the actor shattering. I think it should
// with no relation to the size of the self shattering. I think it should
// base the number of shards on the size of the dead thing, so bigger
// things break up into more shards than smaller things.
// An actor with radius 20 and height 64 creates ~40 chunks.
numChunks = MAX<int> (4, (actor->radius>>FRACBITS)*(actor->height>>FRACBITS)/32);
// An self with radius 20 and height 64 creates ~40 chunks.
numChunks = MAX<int> (4, (self->radius>>FRACBITS)*(self->height>>FRACBITS)/32);
i = (pr_freeze.Random2()) % (numChunks/4);
for (i = MAX (24, numChunks + i); i >= 0; i--)
{
mo = Spawn("IceChunk",
actor->x + (((pr_freeze()-128)*actor->radius)>>7),
actor->y + (((pr_freeze()-128)*actor->radius)>>7),
actor->z + (pr_freeze()*actor->height/255), ALLOW_REPLACE);
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);
mo->SetState (mo->SpawnState + (pr_freeze()%3));
if (mo)
{
mo->momz = FixedDiv(mo->z-actor->z, actor->height)<<2;
mo->momz = FixedDiv(mo->z-self->z, self->height)<<2;
mo->momx = pr_freeze.Random2 () << (FRACBITS-7);
mo->momy = pr_freeze.Random2 () << (FRACBITS-7);
A_IceSetTics (mo); // set a random tic wait
mo->RenderStyle = actor->RenderStyle;
mo->alpha = actor->alpha;
CALL_ACTION(A_IceSetTics, mo); // set a random tic wait
mo->RenderStyle = self->RenderStyle;
mo->alpha = self->alpha;
}
}
if (actor->player)
if (self->player)
{ // attach the player's view to a chunk of ice
AActor *head = Spawn("IceChunkHead", actor->x, actor->y,
actor->z + actor->player->mo->ViewHeight, ALLOW_REPLACE);
head->momz = FixedDiv(head->z-actor->z, actor->height)<<2;
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;
head->momx = pr_freeze.Random2 () << (FRACBITS-7);
head->momy = pr_freeze.Random2 () << (FRACBITS-7);
head->health = actor->health;
head->angle = actor->angle;
head->health = self->health;
head->angle = self->angle;
if (head->IsKindOf(RUNTIME_CLASS(APlayerPawn)))
{
head->player->mo = static_cast<APlayerPawn*>(head);
head->player = actor->player;
actor->player = NULL;
head->ObtainInventory (actor);
head->player = self->player;
self->player = NULL;
head->ObtainInventory (self);
}
head->pitch = 0;
head->RenderStyle = actor->RenderStyle;
head->alpha = actor->alpha;
if (head->player->camera == actor)
head->RenderStyle = self->RenderStyle;
head->alpha = self->alpha;
if (head->player->camera == self)
{
head->player->camera = head;
}
}
// [RH] Do some stuff to make this more useful outside Hexen
if (actor->flags4 & MF4_BOSSDEATH)
if (self->flags4 & MF4_BOSSDEATH)
{
A_BossDeath (actor);
CALL_ACTION(A_BossDeath, self);
}
A_NoBlocking (actor);
CALL_ACTION(A_NoBlocking, self);
actor->Destroy ();
self->Destroy ();
}
//----------------------------------------------------------------------------
@ -380,21 +398,21 @@ void DCorpsePointer::Serialize (FArchive &arc)
// throw another corpse on the queue
void A_QueueCorpse (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_QueueCorpse)
{
if (sv_corpsequeuesize > 0)
new DCorpsePointer (actor);
new DCorpsePointer (self);
}
// Remove an actor from the queue (for resurrection)
void A_DeQueueCorpse (AActor *actor)
// Remove an self from the queue (for resurrection)
DEFINE_ACTION_FUNCTION(AActor, A_DeQueueCorpse)
{
TThinkerIterator<DCorpsePointer> iterator (STAT_CORPSEPOINTER);
DCorpsePointer *corpsePtr;
while ((corpsePtr = iterator.Next()) != NULL)
{
if (corpsePtr->Corpse == actor)
if (corpsePtr->Corpse == self)
{
corpsePtr->Corpse = NULL;
corpsePtr->Destroy ();
@ -409,9 +427,9 @@ void A_DeQueueCorpse (AActor *actor)
//
//============================================================================
void A_SetInvulnerable (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SetInvulnerable)
{
actor->flags2 |= MF2_INVULNERABLE;
self->flags2 |= MF2_INVULNERABLE;
}
//============================================================================
@ -420,9 +438,9 @@ void A_SetInvulnerable (AActor *actor)
//
//============================================================================
void A_UnSetInvulnerable (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_UnSetInvulnerable)
{
actor->flags2 &= ~MF2_INVULNERABLE;
self->flags2 &= ~MF2_INVULNERABLE;
}
//============================================================================
@ -431,9 +449,9 @@ void A_UnSetInvulnerable (AActor *actor)
//
//============================================================================
void A_SetReflective (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SetReflective)
{
actor->flags2 |= MF2_REFLECTIVE;
self->flags2 |= MF2_REFLECTIVE;
}
//============================================================================
@ -442,9 +460,9 @@ void A_SetReflective (AActor *actor)
//
//============================================================================
void A_UnSetReflective (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_UnSetReflective)
{
actor->flags2 &= ~MF2_REFLECTIVE;
self->flags2 &= ~MF2_REFLECTIVE;
}
//============================================================================
@ -453,9 +471,9 @@ void A_UnSetReflective (AActor *actor)
//
//============================================================================
void A_SetReflectiveInvulnerable (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SetReflectiveInvulnerable)
{
actor->flags2 |= MF2_REFLECTIVE|MF2_INVULNERABLE;
self->flags2 |= MF2_REFLECTIVE|MF2_INVULNERABLE;
}
//============================================================================
@ -464,9 +482,9 @@ void A_SetReflectiveInvulnerable (AActor *actor)
//
//============================================================================
void A_UnSetReflectiveInvulnerable (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_UnSetReflectiveInvulnerable)
{
actor->flags2 &= ~(MF2_REFLECTIVE|MF2_INVULNERABLE);
self->flags2 &= ~(MF2_REFLECTIVE|MF2_INVULNERABLE);
}
//==========================================================================
@ -475,10 +493,10 @@ void A_UnSetReflectiveInvulnerable (AActor *actor)
//
//==========================================================================
void A_SetShootable (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SetShootable)
{
actor->flags2 &= ~MF2_NONSHOOTABLE;
actor->flags |= MF_SHOOTABLE;
self->flags2 &= ~MF2_NONSHOOTABLE;
self->flags |= MF_SHOOTABLE;
}
//==========================================================================
@ -487,10 +505,10 @@ void A_SetShootable (AActor *actor)
//
//==========================================================================
void A_UnSetShootable (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_UnSetShootable)
{
actor->flags2 |= MF2_NONSHOOTABLE;
actor->flags &= ~MF_SHOOTABLE;
self->flags2 |= MF2_NONSHOOTABLE;
self->flags &= ~MF_SHOOTABLE;
}
//===========================================================================
@ -499,9 +517,9 @@ void A_UnSetShootable (AActor *actor)
//
//===========================================================================
void A_NoGravity (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_NoGravity)
{
actor->flags |= MF_NOGRAVITY;
self->flags |= MF_NOGRAVITY;
}
//===========================================================================
@ -510,10 +528,10 @@ void A_NoGravity (AActor *actor)
//
//===========================================================================
void A_Gravity (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Gravity)
{
actor->flags &= ~MF_NOGRAVITY;
actor->gravity = FRACUNIT;
self->flags &= ~MF_NOGRAVITY;
self->gravity = FRACUNIT;
}
//===========================================================================
@ -522,10 +540,10 @@ void A_Gravity (AActor *actor)
//
//===========================================================================
void A_LowGravity (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LowGravity)
{
actor->flags &= ~MF_NOGRAVITY;
actor->gravity = FRACUNIT/8;
self->flags &= ~MF_NOGRAVITY;
self->gravity = FRACUNIT/8;
}
//===========================================================================

View file

@ -1,5 +1,6 @@
class AActor;
/*
void A_NoBlocking (AActor *);
void A_HideThing (AActor *);
void A_UnHideThing (AActor *);
@ -21,5 +22,8 @@ void A_UnSetShootable (AActor *);
void A_SetFloorClip (AActor *);
void A_UnSetFloorClip (AActor *);
void A_NoGravity (AActor *);
void FaceMovementDirection (AActor *);
void A_SkullPop (AActor *);
*/
void FaceMovementDirection (AActor *);

View file

@ -70,7 +70,7 @@ void ACustomBridge::BeginPlay ()
// target pointer to center mobj
// angle angle of ball
void A_BridgeOrbit (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BridgeOrbit)
{
if (self->target == NULL)
{ // Don't crash if somebody spawned this into the world
@ -114,7 +114,7 @@ static const PClass *GetBallType()
void A_BridgeInit (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BridgeInit)
{
angle_t startangle;
AActor *ball;
@ -134,7 +134,7 @@ void A_BridgeInit (AActor *self)
ball = Spawn(balltype, cx, cy, cz, ALLOW_REPLACE);
ball->angle = startangle + (ANGLE_45/32) * (256/ballcount) * i;
ball->target = self;
A_BridgeOrbit(ball);
CALL_ACTION(A_BridgeOrbit, ball);
}
}

View file

@ -14,6 +14,7 @@
#include "a_strifeglobal.h"
#include "a_morph.h"
#include "a_specialspot.h"
#include "thingdef/thingdef.h"
static FRandom pr_restore ("RestorePos");
@ -269,12 +270,12 @@ bool P_GiveBody (AActor *actor, int num)
//
//---------------------------------------------------------------------------
void A_RestoreSpecialThing1 (AActor *thing)
DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialThing1)
{
thing->renderflags &= ~RF_INVISIBLE;
if (static_cast<AInventory *>(thing)->DoRespawn ())
self->renderflags &= ~RF_INVISIBLE;
if (static_cast<AInventory *>(self)->DoRespawn ())
{
S_Sound (thing, CHAN_VOICE, "misc/spawn", 1, ATTN_IDLE);
S_Sound (self, CHAN_VOICE, "misc/spawn", 1, ATTN_IDLE);
}
}
@ -284,14 +285,14 @@ void A_RestoreSpecialThing1 (AActor *thing)
//
//---------------------------------------------------------------------------
void A_RestoreSpecialThing2 (AActor *thing)
DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialThing2)
{
thing->flags |= MF_SPECIAL;
if (!(thing->GetDefault()->flags & MF_NOGRAVITY))
self->flags |= MF_SPECIAL;
if (!(self->GetDefault()->flags & MF_NOGRAVITY))
{
thing->flags &= ~MF_NOGRAVITY;
self->flags &= ~MF_NOGRAVITY;
}
thing->SetState (thing->SpawnState);
self->SetState (self->SpawnState);
}
@ -301,7 +302,7 @@ void A_RestoreSpecialThing2 (AActor *thing)
//
//---------------------------------------------------------------------------
void A_RestoreSpecialDoomThing (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialDoomThing)
{
self->renderflags &= ~RF_INVISIBLE;
self->flags |= MF_SPECIAL;
@ -323,7 +324,7 @@ void A_RestoreSpecialDoomThing (AActor *self)
//
//---------------------------------------------------------------------------
void A_RestoreSpecialPosition (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_RestoreSpecialPosition)
{
// Move item back to its original location
fixed_t _x, _y;

View file

@ -381,7 +381,7 @@ void ASpecialSpot::Destroy()
// will build a list of all mace spots in the level and spawn a
// mace. The rest of the spots will do nothing.
void A_SpawnSingleItem (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnSingleItem)
{
AActor *spot = NULL;
DSpotState *state = DSpotState::GetSpotState();

View file

@ -752,7 +752,7 @@ static bool FindMostRecentWeapon (player_t *player, int *slot, int *index)
if (player->PendingWeapon != WP_NOCHANGE)
{
if (player->psprites[ps_weapon].state != NULL &&
player->psprites[ps_weapon].state->GetAction() == A_Raise)
player->psprites[ps_weapon].state->GetAction() == GET_ACTION(A_Raise))
{
if (LocalWeapons.LocateWeapon (player->PendingWeapon->GetClass(), slot, index))
{

View file

@ -900,6 +900,9 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
int x, y, w, h;
int cx, cy, cw, ch, cr, cb;
// These still need to be caclulated for the clear call.
if(bg == NULL)
{
if(!block.fullScreenOffsets)
{
// Calc real screen coordinates for bar
@ -921,28 +924,19 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
if(vid_fps && x < 0 && y >= 0)
y += 10;
}
}
if(cmd.special3 != 0)
{
//Draw the whole foreground
screen->DrawTexture(fg, x, y,
DTA_DestWidth, w,
DTA_DestHeight, h,
DTA_Alpha, alpha,
DTA_HUDRules, HUD_Normal,
TAG_DONE);
DrawGraphic(fg, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets);
}
else
{
// Draw background
if (bg != NULL && bg->GetScaledWidth() == fg->GetScaledWidth() && bg->GetScaledHeight() == fg->GetScaledHeight())
{
screen->DrawTexture(bg, x, y,
DTA_DestWidth, w,
DTA_DestHeight, h,
DTA_Alpha, alpha,
DTA_HUDRules, HUD_Normal,
TAG_DONE);
DrawGraphic(bg, cmd.x, cmd.y, xOffset, yOffset, alpha, block.fullScreenOffsets);
}
else
{
@ -1003,6 +997,20 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
if(cmd.special3 != 0)
{
if (bg != NULL && bg->GetScaledWidth() == fg->GetScaledWidth() && bg->GetScaledHeight() == fg->GetScaledHeight())
{
if(!block.fullScreenOffsets)
{
screen->DrawTexture(bg, x, y,
DTA_DestWidth, w,
DTA_DestHeight, h,
DTA_ClipLeft, cx,
DTA_ClipTop, cy,
DTA_ClipRight, cr,
DTA_ClipBottom, cb,
DTA_Alpha, alpha,
TAG_DONE);
}
else
{
screen->DrawTexture(bg, x, y,
DTA_DestWidth, w,
@ -1015,12 +1023,27 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
DTA_HUDRules, HUD_Normal,
TAG_DONE);
}
}
else
{
screen->Clear(cx, cy, cr, cb, GPalette.BlackIndex, 0);
}
}
else
{
if(!block.fullScreenOffsets)
{
screen->DrawTexture(fg, x, y,
DTA_DestWidth, w,
DTA_DestHeight, h,
DTA_ClipLeft, cx,
DTA_ClipTop, cy,
DTA_ClipRight, cr,
DTA_ClipBottom, cb,
DTA_Alpha, alpha,
TAG_DONE);
}
else
{
screen->DrawTexture(fg, x, y,
DTA_DestWidth, w,
@ -1033,6 +1056,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
DTA_HUDRules, HUD_Normal,
TAG_DONE);
}
}
break;
}
case SBARINFO_DRAWGEM:
@ -1084,6 +1108,18 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
if(vid_fps && x < 0 && y >= 0)
y += 10;
}
if(!block.fullScreenOffsets)
{
screen->DrawTexture (shaders[(vertical << 1) + reverse], x, y,
DTA_DestWidth, w,
DTA_DestHeight, h,
DTA_Alpha, alpha,
DTA_AlphaChannel, true,
DTA_FillColor, 0,
TAG_DONE);
}
else
{
screen->DrawTexture (shaders[(vertical << 1) + reverse], x, y,
DTA_DestWidth, w,
DTA_DestHeight, h,
@ -1092,6 +1128,7 @@ void DSBarInfo::doCommands(SBarInfoBlock &block, int xOffset, int yOffset, int a
DTA_FillColor, 0,
DTA_HUDRules, HUD_Normal,
TAG_DONE);
}
break;
}
case SBARINFO_DRAWSTRING:
@ -1335,6 +1372,14 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
// Round to nearest
w = (fw + (FRACUNIT>>1)) >> FRACBITS;
h = (fh + (FRACUNIT>>1)) >> FRACBITS;
screen->DrawTexture(texture, x, y,
DTA_DestWidth, w,
DTA_DestHeight, h,
DTA_Translation, translate ? getTranslation() : 0,
DTA_ColorOverlay, dim ? DIM_OVERLAY : 0,
DTA_CenterBottomOffset, (offsetflags & DRAWIMAGE_OFFSET_CENTERBOTTOM),
DTA_Alpha, alpha,
TAG_DONE);
}
else
{
@ -1342,7 +1387,6 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
h = texture->GetScaledHeight();
if(vid_fps && x < 0 && y >= 0)
y += 10;
}
screen->DrawTexture(texture, x, y,
DTA_DestWidth, w,
DTA_DestHeight, h,
@ -1353,6 +1397,7 @@ void DSBarInfo::DrawGraphic(FTexture* texture, int x, int y, int xOffset, int yO
DTA_Alpha, alpha,
TAG_DONE);
}
}
void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffset, int alpha, bool fullScreenOffsets, EColorRange translation, int spacing, bool drawshadow)
{
@ -1399,6 +1444,17 @@ void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffs
if(drawshadow)
{
int salpha = fixed_t(((double) alpha / (double) FRACUNIT) * ((double) HR_SHADOW / (double) FRACUNIT) * FRACUNIT);
if(!fullScreenOffsets)
{
screen->DrawTexture(character, rx+2, ry+2,
DTA_DestWidth, rw,
DTA_DestHeight, rh,
DTA_Alpha, salpha,
DTA_FillColor, 0,
TAG_DONE);
}
else
{
screen->DrawTexture(character, rx+2, ry+2,
DTA_DestWidth, rw,
DTA_DestHeight, rh,
@ -1407,6 +1463,18 @@ void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffs
DTA_FillColor, 0,
TAG_DONE);
}
}
if(!fullScreenOffsets)
{
screen->DrawTexture(character, rx, ry,
DTA_DestWidth, rw,
DTA_DestHeight, rh,
DTA_Translation, drawingFont->GetColorTranslation(translation),
DTA_Alpha, alpha,
TAG_DONE);
}
else
{
screen->DrawTexture(character, rx, ry,
DTA_DestWidth, rw,
DTA_DestHeight, rh,
@ -1414,6 +1482,7 @@ void DSBarInfo::DrawString(const char* str, int x, int y, int xOffset, int yOffs
DTA_Alpha, alpha,
DTA_HUDRules, HUD_Normal,
TAG_DONE);
}
if(SBarInfoScript->spacingCharacter == '\0')
x += width + spacing - (character->LeftOffset+1);
else //width gets changed at the call to GetChar()

View file

@ -6,6 +6,7 @@
#include "s_sound.h"
#include "a_strifeglobal.h"
#include "doomdata.h"
#include "thingdef/thingdef.h"
//============================================================================
//
@ -21,7 +22,7 @@
//
//============================================================================
void A_HideDecepticon (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_HideDecepticon)
{
EV_DoDoor (DDoor::doorClose, NULL, self, 999, 8*FRACUNIT, 0, 0, 0);
if (self->target != NULL && self->target->player != NULL)
@ -36,7 +37,7 @@ void A_HideDecepticon (AActor *self)
//
//============================================================================
void A_AcolyteDie (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_AcolyteDie)
{
int i;
@ -80,7 +81,7 @@ void A_AcolyteDie (AActor *self)
//
//============================================================================
void A_BeShadowyFoe (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BeShadowyFoe)
{
self->RenderStyle = STYLE_Translucent;
self->alpha = HR_SHADOW;
@ -93,11 +94,11 @@ void A_BeShadowyFoe (AActor *self)
//
//============================================================================
void A_AcolyteBits (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_AcolyteBits)
{
if (self->SpawnFlags & MTF_SHADOW)
{
A_BeShadowyFoe (self);
CALL_ACTION(A_BeShadowyFoe, self);
}
if (self->SpawnFlags & MTF_ALTSHADOW)
{

View file

@ -8,6 +8,7 @@
#include "a_strifeglobal.h"
#include "c_console.h"
#include "gstrings.h"
#include "thingdef/thingdef.h"
static FRandom pr_spectrespawn ("AlienSpectreSpawn");
static FRandom pr_spectrechunk ("212e4");
@ -16,21 +17,7 @@ AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target);
//============================================================================
static void GenericSpectreSpawn (AActor *actor, const char *type)
{
AActor *spectre = Spawn (type, actor->x, actor->y, actor->z, ALLOW_REPLACE);
if (spectre != NULL)
{
spectre->momz = pr_spectrespawn() << 9;
}
}
void A_SpawnSpectre4 (AActor *actor)
{
GenericSpectreSpawn (actor, "AlienSpectre4");
}
void A_SpectreChunkSmall (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkSmall)
{
AActor *foo = Spawn("AlienChunkSmall", self->x, self->y, self->z + 10*FRACUNIT, ALLOW_REPLACE);
@ -48,7 +35,7 @@ void A_SpectreChunkSmall (AActor *self)
}
}
void A_SpectreChunkLarge (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpectreChunkLarge)
{
AActor *foo = Spawn("AlienChunkLarge", self->x, self->y, self->z + 10*FRACUNIT, ALLOW_REPLACE);
@ -67,7 +54,7 @@ void A_SpectreChunkLarge (AActor *self)
}
void A_Spectre3Attack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Spectre3Attack)
{
if (self->target == NULL)
return;
@ -88,14 +75,14 @@ void A_Spectre3Attack (AActor *self)
self->angle -= ANGLE_180 / 20 * 10;
}
void A_AlienSpectreDeath (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath)
{
AActor *player;
char voc[32];
int log;
int i;
A_NoBlocking (self); // [RH] Need this for Sigil rewarding
CALL_ACTION(A_NoBlocking, self); // [RH] Need this for Sigil rewarding
if (!CheckBossDeath (self))
{
return;

View file

@ -5,6 +5,7 @@
#include "p_enemy.h"
#include "s_sound.h"
#include "a_strifeglobal.h"
#include "thingdef/thingdef.h"
bool Sys_1ed64 (AActor *self)
{
@ -15,7 +16,7 @@ bool Sys_1ed64 (AActor *self)
return false;
}
void A_CrusaderChoose (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderChoose)
{
if (self->target == NULL)
return;
@ -43,7 +44,7 @@ void A_CrusaderChoose (AActor *self)
}
}
void A_CrusaderSweepLeft (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepLeft)
{
self->angle += ANGLE_90/16;
AActor *misl = P_SpawnMissileZAimed (self, self->z + 48*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile"));
@ -53,7 +54,7 @@ void A_CrusaderSweepLeft (AActor *self)
}
}
void A_CrusaderSweepRight (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderSweepRight)
{
self->angle -= ANGLE_90/16;
AActor *misl = P_SpawnMissileZAimed (self, self->z + 48*FRACUNIT, self->target, PClass::FindClass("FastFlameMissile"));
@ -63,7 +64,7 @@ void A_CrusaderSweepRight (AActor *self)
}
}
void A_CrusaderRefire (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderRefire)
{
if (self->target == NULL ||
self->target->health <= 0 ||
@ -73,7 +74,7 @@ void A_CrusaderRefire (AActor *self)
}
}
void A_CrusaderDeath (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CrusaderDeath)
{
if (CheckBossDeath (self))
{

View file

@ -5,10 +5,11 @@
#include "p_enemy.h"
#include "s_sound.h"
#include "a_strifeglobal.h"
#include "thingdef/thingdef.h"
static FRandom pr_entity ("Entity");
void A_SubEntityDeath (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SubEntityDeath)
{
if (CheckBossDeath (self))
{
@ -31,18 +32,18 @@ void A_SpectralMissile (AActor *self, const char *missilename)
}
}
void A_SpotLightning (AActor *);
void A_Spectre3Attack (AActor *);
DECLARE_ACTION(A_SpotLightning)
DECLARE_ACTION(A_Spectre3Attack)
void A_EntityAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_EntityAttack)
{
// Apparent Strife bug: Case 5 was unreachable because they used % 5 instead of % 6.
// I've fixed that by making case 1 duplicate it, since case 1 did nothing.
switch (pr_entity() % 5)
{
case 0:
A_SpotLightning(self);
CALL_ACTION(A_SpotLightning, self);
break;
case 2:
@ -50,7 +51,7 @@ void A_EntityAttack (AActor *self)
break;
case 3:
A_Spectre3Attack (self);
CALL_ACTION(A_Spectre3Attack, self);
break;
case 4:
@ -65,7 +66,7 @@ void A_EntityAttack (AActor *self)
}
void A_SpawnEntity (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnEntity)
{
AActor *entity = Spawn("EntityBoss", self->x, self->y, self->z + 70*FRACUNIT, ALLOW_REPLACE);
if (entity != NULL)
@ -77,7 +78,7 @@ void A_SpawnEntity (AActor *self)
}
}
void A_EntityDeath (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_EntityDeath)
{
AActor *second;
fixed_t secondRadius = GetDefaultByName("EntitySecond")->radius * 2;

View file

@ -4,10 +4,11 @@
#include "p_local.h"
#include "p_enemy.h"
#include "s_sound.h"
#include "thingdef/thingdef.h"
static FRandom pr_inq ("Inquisitor");
void A_InquisitorWalk (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorWalk)
{
S_Sound (self, CHAN_BODY, "inquisitor/walk", 1, ATTN_NORM);
A_Chase (self);
@ -22,7 +23,7 @@ bool InquisitorCheckDistance (AActor *self)
return false;
}
void A_InquisitorDecide (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorDecide)
{
if (self->target == NULL)
return;
@ -41,7 +42,7 @@ void A_InquisitorDecide (AActor *self)
}
}
void A_InquisitorAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorAttack)
{
AActor *proj;
@ -66,7 +67,7 @@ void A_InquisitorAttack (AActor *self)
self->z -= 32*FRACBITS;
}
void A_InquisitorJump (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorJump)
{
fixed_t dist;
fixed_t speed;
@ -93,7 +94,7 @@ void A_InquisitorJump (AActor *self)
self->flags |= MF_NOGRAVITY;
}
void A_InquisitorCheckLand (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_InquisitorCheckLand)
{
self->reactiontime--;
if (self->reactiontime < 0 ||
@ -114,7 +115,7 @@ void A_InquisitorCheckLand (AActor *self)
}
void A_TossArm (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_TossArm)
{
AActor *foo = Spawn("InquisitorArm", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE);
foo->angle = self->angle - ANGLE_90 + (pr_inq.Random2() << 22);

View file

@ -5,6 +5,7 @@
#include "p_enemy.h"
#include "p_local.h"
#include "s_sound.h"
#include "thingdef/thingdef.h"
// Loremaster (aka Priest) --------------------------------------------------
@ -37,7 +38,7 @@ int ALoreShot::DoSpecialDamage (AActor *target, int damage)
return damage;
}
void A_LoremasterChain (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_LoremasterChain)
{
S_Sound (self, CHAN_BODY, "loremaster/active", 1, ATTN_NORM);
Spawn("LoreShot2", self->x, self->y, self->z, ALLOW_REPLACE);

View file

@ -2,6 +2,7 @@
#include "a_action.h"
#include "a_strifeglobal.h"
#include "p_enemy.h"
#include "thingdef/thingdef.h"
class AOracle : public AActor
{
@ -14,7 +15,7 @@ public:
IMPLEMENT_CLASS (AOracle)
void A_WakeOracleSpectre (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_WakeOracleSpectre)
{
TThinkerIterator<AActor> it(NAME_AlienSpectre3);
AActor *spectre = it.Next();

View file

@ -6,6 +6,7 @@
#include "s_sound.h"
#include "a_strifeglobal.h"
#include "f_finale.h"
#include "thingdef/thingdef.h"
static FRandom pr_prog ("Programmer");
@ -69,7 +70,7 @@ PalEntry AProgLevelEnder::GetBlend ()
//
//============================================================================
void A_ProgrammerMelee (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ProgrammerMelee)
{
int damage;
@ -94,7 +95,7 @@ void A_ProgrammerMelee (AActor *self)
//
//============================================================================
void A_SpotLightning (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpotLightning)
{
AActor *spot;
@ -117,7 +118,7 @@ void A_SpotLightning (AActor *self)
//
//============================================================================
void A_SpawnProgrammerBase (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnProgrammerBase)
{
AActor *foo = Spawn("ProgrammerBase", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE);
if (foo != NULL)
@ -135,7 +136,7 @@ void A_SpawnProgrammerBase (AActor *self)
//
//============================================================================
void A_ProgrammerDeath (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ProgrammerDeath)
{
if (!CheckBossDeath (self))
return;
@ -149,5 +150,5 @@ void A_ProgrammerDeath (AActor *self)
}
}
// the sky change scripts are now done as special actions in MAPINFO
A_BossDeath(self);
CALL_ACTION(A_BossDeath, self);
}

View file

@ -5,10 +5,11 @@
#include "m_random.h"
#include "p_local.h"
#include "a_strifeglobal.h"
#include "thingdef/thingdef.h"
static FRandom pr_reaverattack ("ReaverAttack");
void A_ReaverRanged (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ReaverRanged)
{
if (self->target != NULL)
{

View file

@ -7,6 +7,7 @@
#include "gi.h"
#include "a_sharedglobal.h"
#include "a_strifeglobal.h"
#include "thingdef/thingdef.h"
static FRandom pr_shootgun ("ShootGun");
@ -16,7 +17,7 @@ static FRandom pr_shootgun ("ShootGun");
//
//============================================================================
void A_ShootGun (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ShootGun)
{
int pitch;
@ -65,7 +66,7 @@ bool ATeleporterBeacon::Use (bool pickup)
}
}
void A_Beacon (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Beacon)
{
AActor *owner = self->target;
AActor *rebel;

View file

@ -3,10 +3,11 @@
#include "a_action.h"
#include "p_local.h"
#include "m_random.h"
#include "thingdef/thingdef.h"
static FRandom pr_sentinelrefire ("SentinelRefire");
void A_SentinelBob (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SentinelBob)
{
fixed_t minz, maxz;
@ -35,7 +36,7 @@ void A_SentinelBob (AActor *self)
self->reactiontime = (minz >= self->z) ? 4 : 0;
}
void A_SentinelAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SentinelAttack)
{
AActor *missile, *trail;
@ -62,7 +63,7 @@ void A_SentinelAttack (AActor *self)
}
}
void A_SentinelRefire (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SentinelRefire)
{
A_FaceTarget (self);

View file

@ -6,6 +6,7 @@
#include "s_sound.h"
#include "m_random.h"
#include "a_strifeglobal.h"
#include "thingdef/thingdef.h"
AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target);
@ -24,7 +25,7 @@ void ASpectralMonster::Touch (AActor *toucher)
}
void A_SpectralLightningTail (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightningTail)
{
AActor *foo = Spawn("SpectralLightningHTail", self->x - self->momx, self->y - self->momy, self->z, ALLOW_REPLACE);
@ -32,7 +33,7 @@ void A_SpectralLightningTail (AActor *self)
foo->health = self->health;
}
void A_SpectralBigBallLightning (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpectralBigBallLightning)
{
const PClass *cls = PClass::FindClass("SpectralLightningH3");
if (cls)
@ -48,7 +49,7 @@ void A_SpectralBigBallLightning (AActor *self)
static FRandom pr_zap5 ("Zap5");
void A_SpectralLightning (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SpectralLightning)
{
AActor *flash;
fixed_t x, y;
@ -80,7 +81,7 @@ void A_SpectralLightning (AActor *self)
// altered anywhere.
#define TRACEANGLE (0xe000000)
void A_Tracer2 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Tracer2)
{
AActor *dest;
angle_t exact;

View file

@ -4,11 +4,12 @@
#include "p_local.h"
#include "p_enemy.h"
#include "s_sound.h"
#include "thingdef/thingdef.h"
static FRandom pr_stalker ("Stalker");
void A_StalkerChaseDecide (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_StalkerChaseDecide)
{
if (!(self->flags & MF_NOGRAVITY))
{
@ -20,7 +21,7 @@ void A_StalkerChaseDecide (AActor *self)
}
}
void A_StalkerLookInit (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_StalkerLookInit)
{
FState *state;
if (self->flags & MF_NOGRAVITY)
@ -37,13 +38,13 @@ void A_StalkerLookInit (AActor *self)
}
}
void A_StalkerDrop (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_StalkerDrop)
{
self->flags5 &= ~MF5_NOVERTICALMELEERANGE;
self->flags &= ~MF_NOGRAVITY;
}
void A_StalkerAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_StalkerAttack)
{
if (self->flags & MF_NOGRAVITY)
{
@ -62,7 +63,7 @@ void A_StalkerAttack (AActor *self)
}
}
void A_StalkerWalk (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_StalkerWalk)
{
S_Sound (self, CHAN_BODY, "stalker/walk", 1, ATTN_NORM);
A_Chase (self);

View file

@ -12,12 +12,13 @@
#include "a_keys.h"
#include "c_console.h"
#include "templates.h"
#include "thingdef/thingdef.h"
// Degnin Ore ---------------------------------------------------------------
IMPLEMENT_CLASS(ADegninOre)
void A_RemoveForceField (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_RemoveForceField)
{
self->flags &= ~MF_SPECIAL;

View file

@ -10,6 +10,7 @@
#include "p_enemy.h"
#include "p_lnspec.h"
#include "c_console.h"
#include "thingdef/thingdef.h"
// Notes so I don't forget them:
// Strife does some extra stuff in A_Explode if a player caused the explosion. (probably NoiseAlert)
@ -376,13 +377,6 @@
static FRandom pr_gibtosser ("GibTosser");
void A_TossGib (AActor *);
void A_LoopActiveSound (AActor *);
void A_FLoopActiveSound (AActor *);
void A_Countdown (AActor *);
void A_XXScream (AActor *);
void A_SentinelRefire (AActor *);
// Force Field Guard --------------------------------------------------------
void A_RemoveForceField (AActor *);
@ -407,14 +401,14 @@ int AForceFieldGuard::TakeSpecialDamage (AActor *inflictor, AActor *source, int
// Kneeling Guy -------------------------------------------------------------
void A_SetShadow (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SetShadow)
{
self->flags |= MF_STRIFEx8000000|MF_SHADOW;
self->RenderStyle = STYLE_Translucent;
self->alpha = HR_SHADOW;
}
void A_ClearShadow (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ClearShadow)
{
self->flags &= ~(MF_STRIFEx8000000|MF_SHADOW);
self->RenderStyle = STYLE_Normal;
@ -423,7 +417,7 @@ void A_ClearShadow (AActor *self)
static FRandom pr_gethurt ("HurtMe!");
void A_GetHurt (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_GetHurt)
{
self->flags4 |= MF4_INCOMBAT;
if ((pr_gethurt() % 5) == 0)
@ -439,7 +433,7 @@ void A_GetHurt (AActor *self)
// Klaxon Warning Light -----------------------------------------------------
void A_TurretLook (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_TurretLook)
{
AActor *target;
@ -465,13 +459,13 @@ void A_TurretLook (AActor *self)
}
}
void A_KlaxonBlare (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_KlaxonBlare)
{
if (--self->reactiontime < 0)
{
self->target = NULL;
self->reactiontime = self->GetDefault()->reactiontime;
A_TurretLook (self);
CALL_ACTION(A_TurretLook, self);
if (self->target == NULL)
{
self->SetIdle();
@ -551,7 +545,7 @@ IMPLEMENT_CLASS (AMeat)
//
//==========================================================================
void A_TossGib (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_TossGib)
{
const char *gibtype = (self->flags & MF_NOBLOOD) ? "Junk" : "Meat";
AActor *gib = Spawn (gibtype, self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE);
@ -573,7 +567,7 @@ void A_TossGib (AActor *self)
//============================================================================
void A_FLoopActiveSound (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FLoopActiveSound)
{
if (self->ActiveSound != 0 && !(level.time & 7))
{
@ -581,7 +575,7 @@ void A_FLoopActiveSound (AActor *self)
}
}
void A_Countdown (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Countdown)
{
if (--self->reactiontime <= 0)
{
@ -590,7 +584,7 @@ void A_Countdown (AActor *self)
}
}
void A_LoopActiveSound (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_LoopActiveSound)
{
if (self->ActiveSound != 0 && !S_IsActorPlayingSomething (self, CHAN_VOICE, -1))
{
@ -598,7 +592,7 @@ void A_LoopActiveSound (AActor *self)
}
}
void A_CheckTerrain (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain)
{
sector_t *sec = self->Sector;
@ -626,7 +620,7 @@ void A_CheckTerrain (AActor *self)
//
//============================================================================
void A_ClearSoundTarget (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ClearSoundTarget)
{
AActor *actor;
@ -638,7 +632,7 @@ void A_ClearSoundTarget (AActor *self)
}
void A_ItBurnsItBurns (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ItBurnsItBurns)
{
S_Sound (self, CHAN_VOICE, "human/imonfire", 1, ATTN_NORM);
@ -652,14 +646,14 @@ void A_ItBurnsItBurns (AActor *self)
}
}
void A_DropFire (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_DropFire)
{
AActor *drop = Spawn("FireDroplet", self->x, self->y, self->z + 24*FRACUNIT, ALLOW_REPLACE);
drop->momz = -FRACUNIT;
P_RadiusAttack (self, self, 64, 64, NAME_Fire, false);
}
void A_CrispyPlayer (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CrispyPlayer)
{
if (self->player != NULL && self->player->mo == self)
{
@ -670,7 +664,7 @@ void A_CrispyPlayer (AActor *self)
}
}
void A_HandLower (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_HandLower)
{
if (self->player != NULL)
{

View file

@ -89,7 +89,7 @@ void P_DaggerAlert (AActor *target, AActor *emitter)
//
//============================================================================
void A_JabDagger (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_JabDagger)
{
angle_t angle;
int damage;
@ -97,34 +97,34 @@ void A_JabDagger (AActor *actor)
int power;
AActor *linetarget;
power = MIN(10, actor->player->stamina / 10);
power = MIN(10, self->player->stamina / 10);
damage = (pr_jabdagger() % (power + 8)) * (power + 2);
if (actor->FindInventory<APowerStrength>())
if (self->FindInventory<APowerStrength>())
{
damage *= 10;
}
angle = actor->angle + (pr_jabdagger.Random2() << 18);
pitch = P_AimLineAttack (actor, angle, 80*FRACUNIT, &linetarget);
P_LineAttack (actor, angle, 80*FRACUNIT, pitch, damage, NAME_Melee, "StrifeSpark", true);
angle = self->angle + (pr_jabdagger.Random2() << 18);
pitch = P_AimLineAttack (self, angle, 80*FRACUNIT, &linetarget);
P_LineAttack (self, angle, 80*FRACUNIT, pitch, damage, NAME_Melee, "StrifeSpark", true);
// turn to face target
if (linetarget)
{
S_Sound (actor, CHAN_WEAPON,
S_Sound (self, CHAN_WEAPON,
linetarget->flags & MF_NOBLOOD ? "misc/metalhit" : "misc/meathit",
1, ATTN_NORM);
actor->angle = R_PointToAngle2 (actor->x,
actor->y,
self->angle = R_PointToAngle2 (self->x,
self->y,
linetarget->x,
linetarget->y);
actor->flags |= MF_JUSTATTACKED;
P_DaggerAlert (actor, linetarget);
self->flags |= MF_JUSTATTACKED;
P_DaggerAlert (self, linetarget);
}
else
{
S_Sound (actor, CHAN_WEAPON, "misc/swish", 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, "misc/swish", 1, ATTN_NORM);
}
}
@ -134,7 +134,7 @@ void A_JabDagger (AActor *actor)
//
//============================================================================
void A_AlertMonsters (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_AlertMonsters)
{
if (self->player != NULL)
{
@ -181,7 +181,7 @@ int APoisonBolt::DoSpecialDamage (AActor *target, int damage)
//
//============================================================================
void A_ClearFlash (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ClearFlash)
{
player_t *player = self->player;
@ -197,7 +197,7 @@ void A_ClearFlash (AActor *self)
//
//============================================================================
void A_ShowElectricFlash (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ShowElectricFlash)
{
if (self->player != NULL)
{
@ -211,7 +211,7 @@ void A_ShowElectricFlash (AActor *self)
//
//============================================================================
void A_FireArrow (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FireArrow)
{
angle_t savedangle;
@ -272,7 +272,7 @@ void P_StrifeGunShot (AActor *mo, bool accurate, angle_t pitch)
//
//============================================================================
void A_FireAssaultGun (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FireAssaultGun)
{
bool accurate;
@ -305,7 +305,7 @@ void A_FireAssaultGun (AActor *self)
//
//============================================================================
void A_FireMiniMissile (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FireMiniMissile)
{
player_t *player = self->player;
angle_t savedangle;
@ -333,7 +333,7 @@ void A_FireMiniMissile (AActor *self)
//
//============================================================================
void A_RocketInFlight (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_RocketInFlight)
{
AActor *trail;
@ -354,7 +354,7 @@ void A_RocketInFlight (AActor *self)
//
//============================================================================
void A_FlameDie (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FlameDie)
{
self->flags |= MF_NOGRAVITY;
self->momz = (pr_flamedie() & 3) << FRACBITS;
@ -366,7 +366,7 @@ void A_FlameDie (AActor *self)
//
//============================================================================
void A_FireFlamer (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FireFlamer)
{
player_t *player = self->player;
@ -400,7 +400,7 @@ void A_FireFlamer (AActor *self)
//
//============================================================================
void A_FireMauler1 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FireMauler1)
{
if (self->player != NULL)
{
@ -441,7 +441,7 @@ void A_FireMauler1 (AActor *self)
//
//============================================================================
void A_FireMauler2Pre (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2Pre)
{
S_Sound (self, CHAN_WEAPON, "weapons/mauler2charge", 1, ATTN_NORM);
@ -460,7 +460,7 @@ void A_FireMauler2Pre (AActor *self)
//
//============================================================================
void A_FireMauler2 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FireMauler2)
{
if (self->player != NULL)
{
@ -487,7 +487,7 @@ void A_FireMauler2 (AActor *self)
AActor *P_SpawnSubMissile (AActor *source, const PClass *type, AActor *target);
void A_MaulerTorpedoWave (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_MaulerTorpedoWave)
{
AActor *wavedef = GetDefaultByName("MaulerTorpedoWave");
fixed_t savedz;
@ -566,12 +566,12 @@ int APhosphorousFire::DoSpecialDamage (AActor *target, int damage)
return Super::DoSpecialDamage (target, damage);
}
void A_BurnArea (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BurnArea)
{
P_RadiusAttack (self, self->target, 128, 128, self->DamageType, true);
}
void A_Burnination (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Burnination)
{
self->momz -= 8*FRACUNIT;
self->momx += (pr_phburn.Random2 (3)) << FRACBITS;
@ -632,7 +632,7 @@ void A_Burnination (AActor *self)
//
//============================================================================
void A_FireGrenade (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FireGrenade)
{
const PClass *grenadetype;
player_t *player = self->player;
@ -773,7 +773,7 @@ AInventory *ASigil::CreateCopy (AActor *other)
//
//============================================================================
void A_SelectPiece (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SelectPiece)
{
int pieces = MIN (static_cast<ASigil*>(self)->NumPieces, 5);
@ -796,7 +796,7 @@ void A_SelectPiece (AActor *self)
//
//============================================================================
void A_SelectSigilView (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilView)
{
int pieces;
@ -819,7 +819,7 @@ void A_SelectSigilView (AActor *self)
//
//============================================================================
void A_SelectSigilDown (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilDown)
{
int pieces;
@ -845,7 +845,7 @@ void A_SelectSigilDown (AActor *self)
//
//============================================================================
void A_SelectSigilAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SelectSigilAttack)
{
int pieces;
@ -864,7 +864,7 @@ void A_SelectSigilAttack (AActor *self)
//
//============================================================================
void A_SigilCharge (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_SigilCharge)
{
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
if (self->player != NULL)
@ -879,11 +879,11 @@ void A_SigilCharge (AActor *self)
//
//============================================================================
void A_LightInverse (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LightInverse)
{
if (actor->player != NULL)
if (self->player != NULL)
{
actor->player->extralight = INT_MIN;
self->player->extralight = INT_MIN;
}
}
@ -893,19 +893,19 @@ void A_LightInverse (AActor *actor)
//
//============================================================================
void A_FireSigil1 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireSigil1)
{
AActor *spot;
player_t *player = actor->player;
player_t *player = self->player;
AActor *linetarget;
if (player == NULL || player->ReadyWeapon == NULL)
return;
P_DamageMobj (actor, actor, NULL, 1*4, 0, DMG_NO_ARMOR);
S_Sound (actor, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
P_DamageMobj (self, self, NULL, 1*4, 0, DMG_NO_ARMOR);
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
P_BulletSlope (actor, &linetarget);
P_BulletSlope (self, &linetarget);
if (linetarget != NULL)
{
spot = Spawn("SpectralLightningSpot", linetarget->x, linetarget->y, ONFLOORZ, ALLOW_REPLACE);
@ -916,17 +916,17 @@ void A_FireSigil1 (AActor *actor)
}
else
{
spot = Spawn("SpectralLightningSpot", actor->x, actor->y, actor->z, ALLOW_REPLACE);
spot = Spawn("SpectralLightningSpot", self->x, self->y, self->z, ALLOW_REPLACE);
if (spot != NULL)
{
spot->momx += 28 * finecosine[actor->angle >> ANGLETOFINESHIFT];
spot->momy += 28 * finesine[actor->angle >> ANGLETOFINESHIFT];
spot->momx += 28 * finecosine[self->angle >> ANGLETOFINESHIFT];
spot->momy += 28 * finesine[self->angle >> ANGLETOFINESHIFT];
}
}
if (spot != NULL)
{
spot->health = -1;
spot->target = actor;
spot->target = self;
}
}
@ -936,17 +936,17 @@ void A_FireSigil1 (AActor *actor)
//
//============================================================================
void A_FireSigil2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireSigil2)
{
player_t *player = actor->player;
player_t *player = self->player;
if (player == NULL || player->ReadyWeapon == NULL)
return;
P_DamageMobj (actor, actor, NULL, 2*4, 0, DMG_NO_ARMOR);
S_Sound (actor, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
P_DamageMobj (self, self, NULL, 2*4, 0, DMG_NO_ARMOR);
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
P_SpawnPlayerMissile (actor, PClass::FindClass("SpectralLightningH1"));
P_SpawnPlayerMissile (self, PClass::FindClass("SpectralLightningH1"));
}
//============================================================================
@ -955,29 +955,29 @@ void A_FireSigil2 (AActor *actor)
//
//============================================================================
void A_FireSigil3 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireSigil3)
{
AActor *spot;
player_t *player = actor->player;
player_t *player = self->player;
int i;
if (player == NULL || player->ReadyWeapon == NULL)
return;
P_DamageMobj (actor, actor, NULL, 3*4, 0, DMG_NO_ARMOR);
S_Sound (actor, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
P_DamageMobj (self, self, NULL, 3*4, 0, DMG_NO_ARMOR);
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
actor->angle -= ANGLE_90;
self->angle -= ANGLE_90;
for (i = 0; i < 20; ++i)
{
actor->angle += ANGLE_180/20;
spot = P_SpawnSubMissile (actor, PClass::FindClass("SpectralLightningBall1"), actor);
self->angle += ANGLE_180/20;
spot = P_SpawnSubMissile (self, PClass::FindClass("SpectralLightningBall1"), self);
if (spot != NULL)
{
spot->z = actor->z + 32*FRACUNIT;
spot->z = self->z + 32*FRACUNIT;
}
}
actor->angle -= (ANGLE_180/20)*10;
self->angle -= (ANGLE_180/20)*10;
}
//============================================================================
@ -986,22 +986,22 @@ void A_FireSigil3 (AActor *actor)
//
//============================================================================
void A_FireSigil4 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireSigil4)
{
AActor *spot;
player_t *player = actor->player;
player_t *player = self->player;
AActor *linetarget;
if (player == NULL || player->ReadyWeapon == NULL)
return;
P_DamageMobj (actor, actor, NULL, 4*4, 0, DMG_NO_ARMOR);
S_Sound (actor, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
P_DamageMobj (self, self, NULL, 4*4, 0, DMG_NO_ARMOR);
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
P_BulletSlope (actor, &linetarget);
P_BulletSlope (self, &linetarget);
if (linetarget != NULL)
{
spot = P_SpawnPlayerMissile (actor, 0,0,0, PClass::FindClass("SpectralLightningBigV1"), actor->angle, &linetarget);
spot = P_SpawnPlayerMissile (self, 0,0,0, PClass::FindClass("SpectralLightningBigV1"), self->angle, &linetarget);
if (spot != NULL)
{
spot->tracer = linetarget;
@ -1009,11 +1009,11 @@ void A_FireSigil4 (AActor *actor)
}
else
{
spot = P_SpawnPlayerMissile (actor, PClass::FindClass("SpectralLightningBigV1"));
spot = P_SpawnPlayerMissile (self, PClass::FindClass("SpectralLightningBigV1"));
if (spot != NULL)
{
spot->momx += FixedMul (spot->Speed, finecosine[actor->angle >> ANGLETOFINESHIFT]);
spot->momy += FixedMul (spot->Speed, finesine[actor->angle >> ANGLETOFINESHIFT]);
spot->momx += FixedMul (spot->Speed, finecosine[self->angle >> ANGLETOFINESHIFT]);
spot->momy += FixedMul (spot->Speed, finesine[self->angle >> ANGLETOFINESHIFT]);
}
}
}
@ -1024,17 +1024,17 @@ void A_FireSigil4 (AActor *actor)
//
//============================================================================
void A_FireSigil5 (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FireSigil5)
{
player_t *player = actor->player;
player_t *player = self->player;
if (player == NULL || player->ReadyWeapon == NULL)
return;
P_DamageMobj (actor, actor, NULL, 5*4, 0, DMG_NO_ARMOR);
S_Sound (actor, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
P_DamageMobj (self, self, NULL, 5*4, 0, DMG_NO_ARMOR);
S_Sound (self, CHAN_WEAPON, "weapons/sigilcharge", 1, ATTN_NORM);
P_SpawnPlayerMissile (actor, PClass::FindClass("SpectralLightningBigBall1"));
P_SpawnPlayerMissile (self, PClass::FindClass("SpectralLightningBigBall1"));
}
//============================================================================

View file

@ -5,10 +5,11 @@
#include "p_enemy.h"
#include "s_sound.h"
#include "a_strifeglobal.h"
#include "thingdef/thingdef.h"
static FRandom pr_templar ("Templar");
void A_TemplarAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_TemplarAttack)
{
int damage;
angle_t angle;

View file

@ -6,13 +6,14 @@
#include "a_action.h"
#include "gstrings.h"
#include "thingdef/thingdef.h"
#include "thingdef/thingdef.h"
static FRandom pr_bang4cloud ("Bang4Cloud");
static FRandom pr_lightout ("LightOut");
extern const PClass *QuestItemClasses[31];
void A_Bang4Cloud (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Bang4Cloud)
{
fixed_t spawnx, spawny;
@ -24,7 +25,7 @@ void A_Bang4Cloud (AActor *self)
// -------------------------------------------------------------------
void A_GiveQuestItem (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_GiveQuestItem)
{
int index=CheckIndex(1);
if (index<0) return;
@ -57,7 +58,7 @@ void A_GiveQuestItem (AActor *self)
// PowerCrystal -------------------------------------------------------------------
void A_ExtraLightOff (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ExtraLightOff)
{
if (self->target != NULL && self->target->player != NULL)
{
@ -65,7 +66,7 @@ void A_ExtraLightOff (AActor *self)
}
}
void A_Explode512 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Explode512)
{
P_RadiusAttack (self, self->target, 512, 512, NAME_None, true);
if (self->target != NULL && self->target->player != NULL)
@ -81,7 +82,7 @@ void A_Explode512 (AActor *self)
self->RenderStyle = STYLE_Add;
}
void A_LightGoesOut (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_LightGoesOut)
{
AActor *foo;
sector_t *sec = self->Sector;

View file

@ -1536,31 +1536,31 @@ bool P_LookForPlayers (AActor *actor, INTBOOL allaround)
// Stay in state until a player is sighted.
// [RH] Will also leave state to move to goal.
//
void A_Look (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Look)
{
AActor *targ;
// [RH] Set goal now if appropriate
if (actor->special == Thing_SetGoal && actor->args[0] == 0)
if (self->special == Thing_SetGoal && self->args[0] == 0)
{
NActorIterator iterator (NAME_PatrolPoint, actor->args[1]);
actor->special = 0;
actor->goal = iterator.Next ();
actor->reactiontime = actor->args[2] * TICRATE + level.maptime;
if (actor->args[3] == 0) actor->flags5 &=~ MF5_CHASEGOAL;
else actor->flags5 |= MF5_CHASEGOAL;
NActorIterator iterator (NAME_PatrolPoint, self->args[1]);
self->special = 0;
self->goal = iterator.Next ();
self->reactiontime = self->args[2] * TICRATE + level.maptime;
if (self->args[3] == 0) self->flags5 &=~ MF5_CHASEGOAL;
else self->flags5 |= MF5_CHASEGOAL;
}
actor->threshold = 0; // any shot will wake up
self->threshold = 0; // any shot will wake up
if (actor->TIDtoHate != 0)
if (self->TIDtoHate != 0)
{
targ = actor->target;
targ = self->target;
}
else
{
targ = (i_compatflags & COMPATF_SOUNDTARGET || actor->flags & MF_NOSECTOR)?
actor->Sector->SoundTarget : actor->LastHeard;
targ = (i_compatflags & COMPATF_SOUNDTARGET || self->flags & MF_NOSECTOR)?
self->Sector->SoundTarget : self->LastHeard;
// [RH] If the soundtarget is dead, don't chase it
if (targ != NULL && targ->health <= 0)
@ -1575,40 +1575,40 @@ void A_Look (AActor *actor)
}
// [RH] Andy Baker's stealth monsters
if (actor->flags & MF_STEALTH)
if (self->flags & MF_STEALTH)
{
actor->visdir = -1;
self->visdir = -1;
}
if (targ && (targ->flags & MF_SHOOTABLE))
{
if (actor->IsFriend (targ)) // be a little more precise!
if (self->IsFriend (targ)) // be a little more precise!
{
// If we find a valid target here, the wandering logic should *not*
// be activated! If would cause the seestate to be set twice.
if (P_LookForPlayers (actor, actor->flags4 & MF4_LOOKALLAROUND))
if (P_LookForPlayers (self, self->flags4 & MF4_LOOKALLAROUND))
goto seeyou;
// Let the actor wander around aimlessly looking for a fight
if (actor->SeeState != NULL)
// Let the self wander around aimlessly looking for a fight
if (self->SeeState != NULL)
{
if (!(actor->flags & MF_INCHASE))
if (!(self->flags & MF_INCHASE))
{
actor->SetState (actor->SeeState);
self->SetState (self->SeeState);
}
}
else
{
A_Wander (actor);
CALL_ACTION(A_Wander, self);
}
}
else
{
actor->target = targ;
self->target = targ;
if (actor->flags & MF_AMBUSH)
if (self->flags & MF_AMBUSH)
{
if (P_CheckSight (actor, actor->target, 2))
if (P_CheckSight (self, self->target, 2))
goto seeyou;
}
else
@ -1617,32 +1617,32 @@ void A_Look (AActor *actor)
}
if (!P_LookForPlayers (actor, actor->flags4 & MF4_LOOKALLAROUND))
if (!P_LookForPlayers (self, self->flags4 & MF4_LOOKALLAROUND))
return;
// go into chase state
seeyou:
// [RH] Don't start chasing after a goal if it isn't time yet.
if (actor->target == actor->goal)
if (self->target == self->goal)
{
if (actor->reactiontime > level.maptime)
actor->target = NULL;
if (self->reactiontime > level.maptime)
self->target = NULL;
}
else if (actor->SeeSound)
else if (self->SeeSound)
{
if (actor->flags2 & MF2_BOSS)
if (self->flags2 & MF2_BOSS)
{ // full volume
S_Sound (actor, CHAN_VOICE, actor->SeeSound, 1, ATTN_NONE);
S_Sound (self, CHAN_VOICE, self->SeeSound, 1, ATTN_NONE);
}
else
{
S_Sound (actor, CHAN_VOICE, actor->SeeSound, 1, ATTN_NORM);
S_Sound (self, CHAN_VOICE, self->SeeSound, 1, ATTN_NORM);
}
}
if (actor->target && !(actor->flags & MF_INCHASE))
if (self->target && !(self->flags & MF_INCHASE))
{
actor->SetState (actor->SeeState);
self->SetState (self->SeeState);
}
}
@ -1652,7 +1652,7 @@ void A_Look (AActor *actor)
// A_Wander
//
//==========================================================================
void A_Wander (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Wander)
{
// [RH] Strife probably clears this flag somewhere, but I couldn't find where.
// This seems as good a place as any.
@ -1695,7 +1695,7 @@ void A_Wander (AActor *self)
// A_Look2
//
//==========================================================================
void A_Look2 (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Look2)
{
AActor *targ;
@ -1872,10 +1872,10 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi
{
if (actor->flags & MF_FRIENDLY)
{
A_Look (actor);
CALL_ACTION(A_Look, actor);
if (actor->target == NULL)
{
if (!dontmove) A_Wander (actor);
if (!dontmove) CALL_ACTION(A_Wander, actor);
actor->flags &= ~MF_INCHASE;
return;
}
@ -2231,38 +2231,38 @@ enum ChaseFlags
CHF_DONTMOVE = 16,
};
void A_Chase (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Chase)
{
int index=CheckIndex(3, &CallingState);
if (index>=0)
{
int flags = EvalExpressionI (StateParameters[index+2], actor);
if (flags & CHF_RESURRECT && P_CheckForResurrection(actor, false)) return;
int flags = EvalExpressionI (StateParameters[index+2], self);
if (flags & CHF_RESURRECT && P_CheckForResurrection(self, false)) return;
FState *melee = P_GetState(actor, CallingState, StateParameters[index]);
FState *missile = P_GetState(actor, CallingState, StateParameters[index+1]);
FState *melee = P_GetState(self, CallingState, StateParameters[index]);
FState *missile = P_GetState(self, CallingState, StateParameters[index+1]);
A_DoChase(actor, !!(flags&CHF_FASTCHASE), melee, missile, !(flags&CHF_NOPLAYACTIVE),
A_DoChase(self, !!(flags&CHF_FASTCHASE), melee, missile, !(flags&CHF_NOPLAYACTIVE),
!!(flags&CHF_NIGHTMAREFAST), !!(flags&CHF_DONTMOVE));
}
else // this is the old default A_Chase
{
A_DoChase (actor, false, actor->MeleeState, actor->MissileState, true, !!(gameinfo.gametype & GAME_Raven), false);
A_DoChase (self, false, self->MeleeState, self->MissileState, true, !!(gameinfo.gametype & GAME_Raven), false);
}
}
void A_FastChase (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_FastChase)
{
A_DoChase (actor, true, actor->MeleeState, actor->MissileState, true, true, false);
A_DoChase (self, true, self->MeleeState, self->MissileState, true, true, false);
}
void A_VileChase (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_VileChase)
{
if (!P_CheckForResurrection(actor, true))
A_DoChase (actor, false, actor->MeleeState, actor->MissileState, true, !!(gameinfo.gametype & GAME_Raven), false);
if (!P_CheckForResurrection(self, true))
A_DoChase (self, false, self->MeleeState, self->MissileState, true, !!(gameinfo.gametype & GAME_Raven), false);
}
void A_ExtChase(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_ExtChase)
{
// Now that A_Chase can handle state label parameters, this function has become rather useless...
int index=CheckIndex(4, &CallingState);
@ -2275,32 +2275,42 @@ void A_ExtChase(AActor * self)
!!EvalExpressionI (StateParameters[index+3], self), false);
}
// for internal use
void A_Chase(AActor *self)
{
A_DoChase (self, false, self->MeleeState, self->MissileState, true, !!(gameinfo.gametype & GAME_Raven), false);
}
//=============================================================================
//
// A_FaceTarget
//
//=============================================================================
void A_FaceTarget (AActor *actor)
void A_FaceTarget(AActor *self)
{
if (!actor->target)
if (!self->target)
return;
// [RH] Andy Baker's stealth monsters
if (actor->flags & MF_STEALTH)
if (self->flags & MF_STEALTH)
{
actor->visdir = 1;
self->visdir = 1;
}
actor->flags &= ~MF_AMBUSH;
actor->angle = R_PointToAngle2 (actor->x, actor->y,
actor->target->x, actor->target->y);
self->flags &= ~MF_AMBUSH;
self->angle = R_PointToAngle2 (self->x, self->y,
self->target->x, self->target->y);
if (actor->target->flags & MF_SHADOW)
if (self->target->flags & MF_SHADOW)
{
actor->angle += pr_facetarget.Random2() << 21;
self->angle += pr_facetarget.Random2() << 21;
}
}
DEFINE_ACTION_FUNCTION(AActor, A_FaceTarget)
{
A_FaceTarget(self);
}
//===========================================================================
//
@ -2309,76 +2319,63 @@ void A_FaceTarget (AActor *actor)
// New function to let monsters shoot a railgun
//
//===========================================================================
void A_MonsterRail (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail)
{
if (!actor->target)
if (!self->target)
return;
// [RH] Andy Baker's stealth monsters
if (actor->flags & MF_STEALTH)
if (self->flags & MF_STEALTH)
{
actor->visdir = 1;
self->visdir = 1;
}
actor->flags &= ~MF_AMBUSH;
self->flags &= ~MF_AMBUSH;
actor->angle = R_PointToAngle2 (actor->x,
actor->y,
actor->target->x,
actor->target->y);
self->angle = R_PointToAngle2 (self->x,
self->y,
self->target->x,
self->target->y);
actor->pitch = P_AimLineAttack (actor, actor->angle, MISSILERANGE);
self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE);
// Let the aim trail behind the player
actor->angle = R_PointToAngle2 (actor->x,
actor->y,
actor->target->x - actor->target->momx * 3,
actor->target->y - actor->target->momy * 3);
self->angle = R_PointToAngle2 (self->x,
self->y,
self->target->x - self->target->momx * 3,
self->target->y - self->target->momy * 3);
if (actor->target->flags & MF_SHADOW)
if (self->target->flags & MF_SHADOW)
{
actor->angle += pr_railface.Random2() << 21;
self->angle += pr_railface.Random2() << 21;
}
P_RailAttack (actor, actor->GetMissileDamage (0, 1), 0);
P_RailAttack (self, self->GetMissileDamage (0, 1), 0);
}
void A_Scream (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Scream)
{
if (actor->DeathSound)
if (self->DeathSound)
{
// Check for bosses.
if (actor->flags2 & MF2_BOSS)
if (self->flags2 & MF2_BOSS)
{
// full volume
S_Sound (actor, CHAN_VOICE, actor->DeathSound, 1, ATTN_NONE);
S_Sound (self, CHAN_VOICE, self->DeathSound, 1, ATTN_NONE);
}
else
{
S_Sound (actor, CHAN_VOICE, actor->DeathSound, 1, ATTN_NORM);
S_Sound (self, CHAN_VOICE, self->DeathSound, 1, ATTN_NORM);
}
}
}
void A_XScream (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_XScream)
{
if (actor->player)
S_Sound (actor, CHAN_VOICE, "*gibbed", 1, ATTN_NORM);
if (self->player)
S_Sound (self, CHAN_VOICE, "*gibbed", 1, ATTN_NORM);
else
S_Sound (actor, CHAN_VOICE, "misc/gibbed", 1, ATTN_NORM);
}
// Strife's version of A_XScrem
void A_XXScream (AActor *actor)
{
if (!(actor->flags & MF_NOBLOOD) || actor->DeathSound == 0)
{
A_XScream (actor);
}
else
{
S_Sound (actor, CHAN_VOICE, actor->DeathSound, 1, ATTN_NORM);
}
S_Sound (self, CHAN_VOICE, "misc/gibbed", 1, ATTN_NORM);
}
//---------------------------------------------------------------------------
@ -2506,35 +2503,35 @@ void P_TossItem (AActor *item)
}
}
void A_Pain (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Pain)
{
// [RH] Vary player pain sounds depending on health (ala Quake2)
if (actor->player && actor->player->morphTics == 0)
if (self->player && self->player->morphTics == 0)
{
const char *pain_amount;
FSoundID sfx_id;
if (actor->health < 25)
if (self->health < 25)
pain_amount = "*pain25";
else if (actor->health < 50)
else if (self->health < 50)
pain_amount = "*pain50";
else if (actor->health < 75)
else if (self->health < 75)
pain_amount = "*pain75";
else
pain_amount = "*pain100";
// Try for damage-specific sounds first.
if (actor->player->LastDamageType != NAME_None)
if (self->player->LastDamageType != NAME_None)
{
FString pain_sound = pain_amount;
pain_sound += '-';
pain_sound += actor->player->LastDamageType;
pain_sound += self->player->LastDamageType;
sfx_id = pain_sound;
if (sfx_id == 0)
{
// Try again without a specific pain amount.
pain_sound = "*pain-";
pain_sound += actor->player->LastDamageType;
pain_sound += self->player->LastDamageType;
sfx_id = pain_sound;
}
}
@ -2543,16 +2540,16 @@ void A_Pain (AActor *actor)
sfx_id = pain_amount;
}
S_Sound (actor, CHAN_VOICE, sfx_id, 1, ATTN_NORM);
S_Sound (self, CHAN_VOICE, sfx_id, 1, ATTN_NORM);
}
else if (actor->PainSound)
else if (self->PainSound)
{
S_Sound (actor, CHAN_VOICE, actor->PainSound, 1, ATTN_NORM);
S_Sound (self, CHAN_VOICE, self->PainSound, 1, ATTN_NORM);
}
}
// killough 11/98: kill an object
void A_Die (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Die)
{
ENamedName name;
@ -2566,7 +2563,7 @@ void A_Die (AActor *actor)
name = ENamedName(StateParameters[index]);
}
P_DamageMobj (actor, NULL, NULL, actor->health, name);
P_DamageMobj (self, NULL, NULL, self->health, name);
}
//
@ -2574,30 +2571,13 @@ void A_Die (AActor *actor)
// killough 8/9/98: same as A_Explode, except that the damage is variable
//
void A_Detonate (AActor *mo)
DEFINE_ACTION_FUNCTION(AActor, A_Detonate)
{
int damage = mo->GetMissileDamage (0, 1);
P_RadiusAttack (mo, mo->target, damage, damage, mo->DamageType, true);
if (mo->z <= mo->floorz + (damage << FRACBITS))
int damage = self->GetMissileDamage (0, 1);
P_RadiusAttack (self, self->target, damage, damage, self->DamageType, true);
if (self->z <= self->floorz + (damage << FRACBITS))
{
P_HitFloor (mo);
}
}
//
// A_Explode
//
void A_Explode (AActor *thing)
{
int damage = 128;
int distance = 128;
bool hurtSource = true;
thing->GetExplodeParms (damage, distance, hurtSource);
P_RadiusAttack (thing, thing->target, damage, distance, thing->DamageType, hurtSource);
if (thing->z <= thing->floorz + (distance<<FRACBITS))
{
P_HitFloor (thing);
P_HitFloor (self);
}
}
@ -2635,12 +2615,12 @@ bool CheckBossDeath (AActor *actor)
// A_BossDeath
// Possibly trigger special effects if on a boss level
//
void A_BossDeath (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_BossDeath)
{
FName mytype = actor->GetClass()->TypeName;
FName mytype = self->GetClass()->TypeName;
// Ugh...
FName type = actor->GetClass()->ActorInfo->GetReplacee()->Class->TypeName;
FName type = self->GetClass()->ActorInfo->GetReplacee()->Class->TypeName;
// Do generic special death actions first
bool checked = false;
@ -2649,13 +2629,13 @@ void A_BossDeath (AActor *actor)
{
if (type == sa->Type || mytype == sa->Type)
{
if (!checked && !CheckBossDeath(actor))
if (!checked && !CheckBossDeath(self))
{
return;
}
checked = true;
LineSpecials[sa->Action](NULL, actor, false,
LineSpecials[sa->Action](NULL, self, false,
sa->Args[0], sa->Args[1], sa->Args[2], sa->Args[3], sa->Args[4]);
}
sa = sa->Next;
@ -2686,7 +2666,7 @@ void A_BossDeath (AActor *actor)
else
return;
if (!CheckBossDeath (actor))
if (!CheckBossDeath (self))
{
return;
}
@ -2802,14 +2782,14 @@ bool A_RaiseMobj (AActor *actor, fixed_t speed)
return done; // Reached target height
}
void A_ClassBossHealth (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ClassBossHealth)
{
if (multiplayer && !deathmatch) // co-op only
{
if (!actor->special1)
if (!self->special1)
{
actor->health *= 5;
actor->special1 = true; // has been initialized
self->health *= 5;
self->special1 = true; // has been initialized
}
}
}

View file

@ -2,6 +2,7 @@
#define __P_ENEMY_H__
#include "r_defs.h"
#include "thingdef/thingdef.h"
enum dirtype_t
{
@ -34,24 +35,19 @@ inline AInventory *P_DropItem (AActor *source, const char *type, int special, in
}
void P_TossItem (AActor *item);
void A_Look (AActor *actor);
void A_Wander (AActor *actor);
void A_Look2 (AActor *actor);
void A_Chase (AActor *actor);
void A_FastChase (AActor *actor);
DECLARE_ACTION(A_Look)
DECLARE_ACTION(A_Wander)
DECLARE_ACTION(A_BossDeath)
DECLARE_ACTION(A_Pain)
DECLARE_ACTION(A_MonsterRail)
DECLARE_ACTION(A_NoBlocking)
DECLARE_ACTION(A_Explode)
DECLARE_ACTION(A_Scream)
DECLARE_ACTION(A_FreezeDeath)
DECLARE_ACTION(A_FreezeDeathChunks)
void A_Chase(AActor *self);
void A_FaceTarget (AActor *actor);
void A_MonsterRail (AActor *actor);
void A_Scream (AActor *actor);
void A_XScream (AActor *actor);
void A_Pain (AActor *actor);
void A_Die (AActor *actor);
void A_Detonate (AActor *mo);
void A_Explode (AActor *thing);
void A_Mushroom (AActor *actor);
void A_BossDeath (AActor *actor);
void A_FireScream (AActor *mo);
void A_PlayerScream (AActor *mo);
void A_ClassBossHealth (AActor *);
bool A_RaiseMobj (AActor *, fixed_t speed);
bool A_SinkMobj (AActor *, fixed_t speed);
@ -59,6 +55,5 @@ bool A_SinkMobj (AActor *, fixed_t speed);
bool CheckBossDeath (AActor *);
int P_Massacre ();
bool P_CheckMissileRange (AActor *actor);
void A_LookEx (AActor *actor);
#endif //__P_ENEMY_H__

View file

@ -713,46 +713,46 @@ enum LO_Flags
LOF_FULLVOLSEESOUND = 16,
};
void A_LookEx (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_LookEx)
{
int index=CheckIndex(6, &CallingState);
if (index<0) return;
int flags = EvalExpressionI (StateParameters[index], actor);
int flags = EvalExpressionI (StateParameters[index], self);
//if ((flags & LOF_NOSIGHTCHECK) && (flags & LOF_NOSOUNDCHECK)) return; // [KS] Can't see and can't hear so it'd be redundant to continue with a check we know would be false.
//But it can still be used to make an actor leave to a goal without waking up immediately under certain conditions.
//But it can still be used to make an self leave to a goal without waking up immediately under certain conditions.
fixed_t minseedist = fixed_t(EvalExpressionF (StateParameters[index+1], actor) * FRACUNIT);
fixed_t maxseedist = fixed_t(EvalExpressionF (StateParameters[index+2], actor) * FRACUNIT);
fixed_t maxheardist = fixed_t(EvalExpressionF (StateParameters[index+3], actor) * FRACUNIT);
angle_t fov = angle_t(EvalExpressionF (StateParameters[index+4], actor) * ANGLE_1);
FState *seestate = P_GetState(actor, CallingState, StateParameters[index+5]);
fixed_t minseedist = fixed_t(EvalExpressionF (StateParameters[index+1], self) * FRACUNIT);
fixed_t maxseedist = fixed_t(EvalExpressionF (StateParameters[index+2], self) * FRACUNIT);
fixed_t maxheardist = fixed_t(EvalExpressionF (StateParameters[index+3], self) * FRACUNIT);
angle_t fov = angle_t(EvalExpressionF (StateParameters[index+4], self) * ANGLE_1);
FState *seestate = P_GetState(self, CallingState, StateParameters[index+5]);
AActor *targ = NULL; // Shuts up gcc
fixed_t dist;
// [RH] Set goal now if appropriate
if (actor->special == Thing_SetGoal && actor->args[0] == 0)
if (self->special == Thing_SetGoal && self->args[0] == 0)
{
NActorIterator iterator (NAME_PatrolPoint, actor->args[1]);
actor->special = 0;
actor->goal = iterator.Next ();
actor->reactiontime = actor->args[2] * TICRATE + level.maptime;
if (actor->args[3] == 0) actor->flags5 &=~ MF5_CHASEGOAL;
else actor->flags5 |= MF5_CHASEGOAL;
NActorIterator iterator (NAME_PatrolPoint, self->args[1]);
self->special = 0;
self->goal = iterator.Next ();
self->reactiontime = self->args[2] * TICRATE + level.maptime;
if (self->args[3] == 0) self->flags5 &=~ MF5_CHASEGOAL;
else self->flags5 |= MF5_CHASEGOAL;
}
actor->threshold = 0; // any shot will wake up
self->threshold = 0; // any shot will wake up
if (actor->TIDtoHate != 0)
if (self->TIDtoHate != 0)
{
targ = actor->target;
targ = self->target;
}
else
{
if (!(flags & LOF_NOSOUNDCHECK))
{
targ = actor->LastHeard;
targ = self->LastHeard;
if (targ != NULL)
{
// [RH] If the soundtarget is dead, don't chase it
@ -762,14 +762,14 @@ void A_LookEx (AActor *actor)
}
else
{
dist = P_AproxDistance (targ->x - actor->x,
targ->y - actor->y);
dist = P_AproxDistance (targ->x - self->x,
targ->y - self->y);
// [KS] If the target is too far away, don't respond to the sound.
if (maxheardist && dist > maxheardist)
{
targ = NULL;
actor->LastHeard = NULL;
self->LastHeard = NULL;
}
}
}
@ -782,57 +782,57 @@ void A_LookEx (AActor *actor)
}
// [RH] Andy Baker's stealth monsters
if (actor->flags & MF_STEALTH)
if (self->flags & MF_STEALTH)
{
actor->visdir = -1;
self->visdir = -1;
}
if (targ && (targ->flags & MF_SHOOTABLE))
{
if (actor->IsFriend (targ)) // be a little more precise!
if (self->IsFriend (targ)) // be a little more precise!
{
if (!(actor->flags4 & MF4_STANDSTILL))
if (!(self->flags4 & MF4_STANDSTILL))
{
if (!(flags & LOF_NOSIGHTCHECK))
{
// If we find a valid target here, the wandering logic should *not*
// be activated! If would cause the seestate to be set twice.
if (P_NewLookPlayers(actor, fov, minseedist, maxseedist, !(flags & LOF_DONTCHASEGOAL)))
if (P_NewLookPlayers(self, fov, minseedist, maxseedist, !(flags & LOF_DONTCHASEGOAL)))
goto seeyou;
}
// Let the actor wander around aimlessly looking for a fight
if (actor->SeeState != NULL)
// Let the self wander around aimlessly looking for a fight
if (self->SeeState != NULL)
{
if (!(actor->flags & MF_INCHASE))
if (!(self->flags & MF_INCHASE))
{
if (seestate)
{
actor->SetState (seestate);
self->SetState (seestate);
}
else
{
actor->SetState (actor->SeeState);
self->SetState (self->SeeState);
}
}
}
else
{
A_Wander (actor);
CALL_ACTION(A_Wander, self);
}
}
}
else
{
actor->target = targ; //We already have a target?
self->target = targ; //We already have a target?
if (targ != NULL)
{
if (actor->flags & MF_AMBUSH)
if (self->flags & MF_AMBUSH)
{
dist = P_AproxDistance (targ->x - actor->x,
targ->y - actor->y);
if (P_CheckSight (actor, actor->target, 2) &&
dist = P_AproxDistance (targ->x - self->x,
targ->y - self->y);
if (P_CheckSight (self, self->target, 2) &&
(!minseedist || dist > minseedist) &&
(!maxseedist || dist < maxseedist))
{
@ -847,7 +847,7 @@ void A_LookEx (AActor *actor)
if (!(flags & LOF_NOSIGHTCHECK))
{
if (!P_NewLookPlayers(actor, fov, minseedist, maxseedist, !(flags & LOF_DONTCHASEGOAL)))
if (!P_NewLookPlayers(self, fov, minseedist, maxseedist, !(flags & LOF_DONTCHASEGOAL)))
return;
}
else
@ -858,32 +858,32 @@ void A_LookEx (AActor *actor)
// go into chase state
seeyou:
// [RH] Don't start chasing after a goal if it isn't time yet.
if (actor->target == actor->goal)
if (self->target == self->goal)
{
if (actor->reactiontime > level.maptime)
actor->target = NULL;
if (self->reactiontime > level.maptime)
self->target = NULL;
}
else if (actor->SeeSound && !(flags & LOF_NOSEESOUND))
else if (self->SeeSound && !(flags & LOF_NOSEESOUND))
{
if (flags & LOF_FULLVOLSEESOUND)
{ // full volume
S_Sound (actor, CHAN_VOICE, actor->SeeSound, 1, ATTN_NONE);
S_Sound (self, CHAN_VOICE, self->SeeSound, 1, ATTN_NONE);
}
else
{
S_Sound (actor, CHAN_VOICE, actor->SeeSound, 1, ATTN_NORM);
S_Sound (self, CHAN_VOICE, self->SeeSound, 1, ATTN_NORM);
}
}
if (actor->target && !(actor->flags & MF_INCHASE))
if (self->target && !(self->flags & MF_INCHASE))
{
if (seestate)
{
actor->SetState (seestate);
self->SetState (seestate);
}
else
{
actor->SetState (actor->SeeState);
self->SetState (self->SeeState);
}
}
}

View file

@ -2348,10 +2348,6 @@ angle_t AActor::AngleIncrements ()
return ANGLE_45;
}
void AActor::GetExplodeParms (int &damage, int &dist, bool &hurtSource)
{
}
//==========================================================================
//
// AActor :: GetMissileDamage
@ -3167,18 +3163,6 @@ bool AActor::UpdateWaterLevel (fixed_t oldz, bool dosplash)
return false; // we did the splash ourselves! ;)
}
//==========================================================================
//
// A_GenericFreezeDeath
//
//==========================================================================
void A_GenericFreezeDeath (AActor *actor)
{
actor->Translation = TRANSLATION(TRANSLATION_Standard, 7);
A_FreezeDeath (actor);
}
//==========================================================================
//
// P_SpawnMobj

View file

@ -362,9 +362,9 @@ void P_BobWeapon (player_t *player, pspdef_t *psp, fixed_t *x, fixed_t *y)
//
//---------------------------------------------------------------------------
void A_WeaponReady(AActor *actor)
DEFINE_ACTION_FUNCTION(AInventory, A_WeaponReady)
{
player_t *player = actor->player;
player_t *player = self->player;
AWeapon *weapon;
if (NULL == player)
@ -380,10 +380,10 @@ void A_WeaponReady(AActor *actor)
}
// Change player from attack state
if (actor->InStateSequence(actor->state, actor->MissileState) ||
actor->InStateSequence(actor->state, actor->MeleeState))
if (self->InStateSequence(self->state, self->MissileState) ||
self->InStateSequence(self->state, self->MeleeState))
{
static_cast<APlayerPawn *>(actor)->PlayIdle ();
static_cast<APlayerPawn *>(self)->PlayIdle ();
}
// Play ready sound, if any.
@ -391,7 +391,7 @@ void A_WeaponReady(AActor *actor)
{
if (!(weapon->WeaponFlags & WIF_READYSNDHALF) || pr_wpnreadysnd() < 128)
{
S_Sound (actor, CHAN_WEAPON, weapon->ReadySound, 1, ATTN_NORM);
S_Sound (self, CHAN_WEAPON, weapon->ReadySound, 1, ATTN_NORM);
}
}
@ -458,9 +458,9 @@ void P_CheckWeaponFire (player_t *player)
//
//---------------------------------------------------------------------------
void A_ReFire (AActor *actor)
DEFINE_ACTION_FUNCTION(AInventory, A_ReFire)
{
player_t *player = actor->player;
player_t *player = self->player;
if (NULL == player)
{
@ -488,9 +488,9 @@ void A_ReFire (AActor *actor)
}
}
void A_ClearReFire(AActor *actor)
DEFINE_ACTION_FUNCTION(AInventory, A_ClearReFire)
{
player_t *player = actor->player;
player_t *player = self->player;
if (NULL != player)
{
@ -508,12 +508,12 @@ void A_ClearReFire(AActor *actor)
//
//---------------------------------------------------------------------------
void A_CheckReload (AActor *actor)
DEFINE_ACTION_FUNCTION(AInventory, A_CheckReload)
{
if (actor->player != NULL)
if (self->player != NULL)
{
actor->player->ReadyWeapon->CheckAmmo (
actor->player->ReadyWeapon->bAltFire ? AWeapon::AltFire
self->player->ReadyWeapon->CheckAmmo (
self->player->ReadyWeapon->bAltFire ? AWeapon::AltFire
: AWeapon::PrimaryFire, true);
}
}
@ -524,9 +524,9 @@ void A_CheckReload (AActor *actor)
//
//---------------------------------------------------------------------------
void A_Lower (AActor *actor)
DEFINE_ACTION_FUNCTION(AInventory, A_Lower)
{
player_t *player = actor->player;
player_t *player = self->player;
pspdef_t *psp;
if (NULL == player)
@ -571,13 +571,13 @@ void A_Lower (AActor *actor)
//
//---------------------------------------------------------------------------
void A_Raise (AActor *actor)
DEFINE_ACTION_FUNCTION(AInventory, A_Raise)
{
if (actor == NULL)
if (self == NULL)
{
return;
}
player_t *player = actor->player;
player_t *player = self->player;
pspdef_t *psp;
if (NULL == player)
@ -612,9 +612,9 @@ void A_Raise (AActor *actor)
//
// A_GunFlash
//
void A_GunFlash (AActor *actor)
DEFINE_ACTION_FUNCTION(AInventory, A_GunFlash)
{
player_t *player = actor->player;
player_t *player = self->player;
if (NULL == player)
{
@ -689,37 +689,37 @@ void P_GunShot (AActor *mo, bool accurate, const PClass *pufftype, angle_t pitch
P_LineAttack (mo, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, pufftype);
}
void A_Light0 (AActor *actor)
DEFINE_ACTION_FUNCTION(AInventory, A_Light0)
{
if (actor->player != NULL)
if (self->player != NULL)
{
actor->player->extralight = 0;
self->player->extralight = 0;
}
}
void A_Light1 (AActor *actor)
DEFINE_ACTION_FUNCTION(AInventory, A_Light1)
{
if (actor->player != NULL)
if (self->player != NULL)
{
actor->player->extralight = 1;
self->player->extralight = 1;
}
}
void A_Light2 (AActor *actor)
DEFINE_ACTION_FUNCTION(AInventory, A_Light2)
{
if (actor->player != NULL)
if (self->player != NULL)
{
actor->player->extralight = 2;
self->player->extralight = 2;
}
}
void A_Light (AActor *actor)
DEFINE_ACTION_FUNCTION(AInventory, A_Light)
{
int index=CheckIndex(1, &CallingState);
if (actor->player != NULL && index > 0)
if (self->player != NULL && index > 0)
{
actor->player->extralight = clamp<int>(EvalExpressionI (StateParameters[index], actor), 0, 20);
self->player->extralight = clamp<int>(EvalExpressionI (StateParameters[index], self), 0, 20);
}
}

View file

@ -27,6 +27,7 @@
// Needs fixed point, and BAM angles.
#include "m_fixed.h"
#include "tables.h"
#include "thingdef/thingdef.h"
//
@ -93,14 +94,8 @@ void P_BobWeapon (player_t *player, pspdef_t *psp, fixed_t *x, fixed_t *y);
angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget = NULL);
void P_GunShot (AActor *mo, bool accurate, const PClass *pufftype, angle_t pitch);
void A_WeaponReady (AActor *actor);
void A_ReFire (AActor *actor);
void A_CheckReload (AActor *actor);
void A_Lower (AActor *actor);
void A_Raise (AActor *actor);
void A_GunFlash (AActor *actor);
void A_Light0 (AActor *actor);
void A_Light1 (AActor *actor);
void A_Light2 (AActor *actor);
DECLARE_ACTION(A_WeaponReady)
DECLARE_ACTION(A_Raise)
DECLARE_ACTION(A_ReFire)
#endif // __P_PSPR_H__

View file

@ -1177,7 +1177,7 @@ void APlayerPawn::TweakSpeeds (int &forward, int &side)
//
//===========================================================================
void A_PlayerScream (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_PlayerScream)
{
int sound = 0;
int chan = CHAN_VOICE;
@ -1243,7 +1243,7 @@ void A_PlayerScream (AActor *self)
//
//----------------------------------------------------------------------------
void A_SkullPop (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_SkullPop)
{
APlayerPawn *mo;
player_t *player;
@ -1259,23 +1259,23 @@ void A_SkullPop (AActor *actor)
if (spawntype == NULL) return;
}
actor->flags &= ~MF_SOLID;
mo = (APlayerPawn *)Spawn (spawntype, actor->x, actor->y, actor->z + 48*FRACUNIT, NO_REPLACE);
//mo->target = actor;
self->flags &= ~MF_SOLID;
mo = (APlayerPawn *)Spawn (spawntype, self->x, self->y, self->z + 48*FRACUNIT, NO_REPLACE);
//mo->target = self;
mo->momx = pr_skullpop.Random2() << 9;
mo->momy = pr_skullpop.Random2() << 9;
mo->momz = 2*FRACUNIT + (pr_skullpop() << 6);
// Attach player mobj to bloody skull
player = actor->player;
actor->player = NULL;
mo->ObtainInventory (actor);
player = self->player;
self->player = NULL;
mo->ObtainInventory (self);
mo->player = player;
mo->health = actor->health;
mo->angle = actor->angle;
mo->health = self->health;
mo->angle = self->angle;
if (player != NULL)
{
player->mo = mo;
if (player->camera == actor)
if (player->camera == self)
{
player->camera = mo;
}
@ -1289,11 +1289,11 @@ void A_SkullPop (AActor *actor)
//
//----------------------------------------------------------------------------
void A_CheckPlayerDone (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CheckPlayerDone)
{
if (actor->player == NULL)
if (self->player == NULL)
{
actor->Destroy ();
self->Destroy ();
}
}

View file

@ -3,5 +3,5 @@
// This file was automatically generated by the
// updaterevision tool. Do not edit by hand.
#define ZD_SVN_REVISION_STRING "1146"
#define ZD_SVN_REVISION_NUMBER 1146
#define ZD_SVN_REVISION_STRING "1161"
#define ZD_SVN_REVISION_NUMBER 1161

View file

@ -100,9 +100,9 @@ IMPLEMENT_CLASS (AFakeInventory)
// PUBLIC FUNCTION PROTOTYPES ----------------------------------------------
void A_ScreamAndUnblock (AActor *);
void A_ActiveAndUnblock (AActor *);
void A_ActiveSound (AActor *);
DECLARE_ACTION(A_ScreamAndUnblock)
DECLARE_ACTION(A_ActiveAndUnblock)
DECLARE_ACTION(A_ActiveSound)
// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------
@ -367,24 +367,24 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
{
if (extra.bExplosive)
{
info->OwnedStates[extra.DeathStart].Action = A_ExplodeParms;
info->OwnedStates[extra.DeathStart].Action = GET_ACTION(A_Explode);
}
}
else
{
// The first frame plays the death sound and
// the second frame makes it nonsolid.
info->OwnedStates[extra.DeathStart].Action= A_Scream;
info->OwnedStates[extra.DeathStart].Action= GET_ACTION(A_Scream);
if (extra.bSolidOnDeath)
{
}
else if (extra.DeathStart + 1 < extra.DeathEnd)
{
info->OwnedStates[extra.DeathStart+1].Action = A_NoBlocking;
info->OwnedStates[extra.DeathStart+1].Action = GET_ACTION(A_NoBlocking);
}
else
{
info->OwnedStates[extra.DeathStart].Action = A_ScreamAndUnblock;
info->OwnedStates[extra.DeathStart].Action = GET_ACTION(A_ScreamAndUnblock);
}
if (extra.DeathHeight == 0) extra.DeathHeight = ((AActor*)(type->Defaults))->height;
@ -412,17 +412,17 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
// The first frame plays the burn sound and
// the second frame makes it nonsolid.
info->OwnedStates[extra.FireDeathStart].Action = A_ActiveSound;
info->OwnedStates[extra.FireDeathStart].Action = GET_ACTION(A_ActiveSound);
if (extra.bSolidOnBurn)
{
}
else if (extra.FireDeathStart + 1 < extra.FireDeathEnd)
{
info->OwnedStates[extra.FireDeathStart+1].Action = A_NoBlocking;
info->OwnedStates[extra.FireDeathStart+1].Action = GET_ACTION(A_NoBlocking);
}
else
{
info->OwnedStates[extra.FireDeathStart].Action = A_ActiveAndUnblock;
info->OwnedStates[extra.FireDeathStart].Action = GET_ACTION(A_ActiveAndUnblock);
}
if (extra.BurnHeight == 0) extra.BurnHeight = ((AActor*)(type->Defaults))->height;
@ -442,13 +442,13 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def)
info->OwnedStates[i].NextState = &info->OwnedStates[info->NumOwnedStates-1];
info->OwnedStates[i].Tics = 5;
info->OwnedStates[i].Misc1 = 0;
info->OwnedStates[i].Action = A_FreezeDeath;
info->OwnedStates[i].Action = GET_ACTION(A_FreezeDeath);
i = info->NumOwnedStates - 1;
info->OwnedStates[i].NextState = &info->OwnedStates[i];
info->OwnedStates[i].Tics = 1;
info->OwnedStates[i].Misc1 = 0;
info->OwnedStates[i].Action = A_FreezeDeathChunks;
info->OwnedStates[i].Action = GET_ACTION(A_FreezeDeathChunks);
AddState("Ice", &info->OwnedStates[extra.IceDeathStart]);
}
else if (extra.bGenericIceDeath)
@ -865,10 +865,10 @@ static void ParseSpriteFrames (FActorInfo *info, TArray<FState> &states, FScanne
//
//===========================================================================
void A_ScreamAndUnblock (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ScreamAndUnblock)
{
A_Scream (actor);
A_NoBlocking (actor);
CALL_ACTION(A_Scream, self);
CALL_ACTION(A_NoBlocking, self);
}
//===========================================================================
@ -877,10 +877,10 @@ void A_ScreamAndUnblock (AActor *actor)
//
//===========================================================================
void A_ActiveAndUnblock (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ActiveAndUnblock)
{
A_ActiveSound (actor);
A_NoBlocking (actor);
CALL_ACTION(A_ActiveSound, self);
CALL_ACTION(A_NoBlocking, self);
}
//===========================================================================
@ -889,10 +889,10 @@ void A_ActiveAndUnblock (AActor *actor)
//
//===========================================================================
void A_ActiveSound (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_ActiveSound)
{
if (actor->ActiveSound)
if (self->ActiveSound)
{
S_Sound (actor, CHAN_VOICE, actor->ActiveSound, 1, ATTN_NORM);
S_Sound (self, CHAN_VOICE, self->ActiveSound, 1, ATTN_NORM);
}
}

View file

@ -159,7 +159,6 @@ void ParseEnum (FScanner &sc, PSymbolTable *symt, PClass *cls)
static void ParseActionDef (FScanner &sc, PClass *cls)
{
#define OPTIONAL 1
#define EVAL 2
#define EVALNOT 4
AFuncDesc *afd;
@ -194,10 +193,6 @@ static void ParseActionDef (FScanner &sc, PClass *cls)
{
flags |= OPTIONAL;
}
else if (sc.CheckToken(TK_Eval))
{
flags |= EVAL;
}
else if (sc.CheckToken(TK_EvalNot))
{
flags |= EVALNOT;
@ -214,9 +209,12 @@ static void ParseActionDef (FScanner &sc, PClass *cls)
sc.MustGetAnyToken();
switch (sc.TokenType)
{
case TK_Bool: type = 'i'; break;
case TK_Int: type = 'i'; break;
case TK_Float: type = 'f'; break;
case TK_Bool:
case TK_Int:
case TK_Float:
type = (flags & EVALNOT)? 'y' : 'x';
break;
case TK_Sound: type = 's'; break;
case TK_String: type = 't'; break;
case TK_Name: type = 't'; break;
@ -246,15 +244,6 @@ static void ParseActionDef (FScanner &sc, PClass *cls)
{
sc.UnGet();
}
// If eval or evalnot were a flag, hey the decorate parser doesn't actually care about the type.
if (flags & EVALNOT)
{
type = 'y';
}
else if (flags & EVAL)
{
type = 'x';
}
if (!(flags & OPTIONAL) && type != '+')
{
type -= 'a' - 'A';

View file

@ -130,8 +130,6 @@ bool EvalExpressionN (int id, AActor *self, const PClass *cls=NULL);
extern FState * CallingState;
int CheckIndex(int paramsize, FState ** pcallstate=NULL);
void A_ExplodeParms(AActor * self);
enum
{
ACMETA_BASE = 0x83000,
@ -155,6 +153,56 @@ enum EDefinitionType
DEF_Projectile,
};
#if defined(_MSC_VER)
#pragma data_seg(".areg$u")
#pragma data_seg()
#define MSVC_ASEG __declspec(allocate(".areg$u"))
#define GCC_ASEG
#else
#define MSVC_ASEG
#define GCC_ASEG __attribute__((section(AREG_SECTION)))
#endif
// Macros to handle action functions. These are here so that I don't have to
// change every single use in case the parameters change.
#define DECLARE_ACTION(name) void AF_##name(AActor *self);
#define DEFINE_ACTION_FUNCTION(cls, name) \
void AF_##name (AActor *); \
AFuncDesc info_##cls##_##name = { #name, AF_##name }; \
MSVC_ASEG AFuncDesc *infoptr_##cls##_##name GCC_ASEG = &info_##cls##_##name; \
void AF_##name (AActor *self)
#define CALL_ACTION(name,self) AF_##name(self)
#define GET_ACTION(name) AF_##name
#define ACTION_PARAM_START(count) \
int index = CheckIndex(count); \
if (index <= 0) return;
#define ACTION_PARAM_START_OPTIONAL(count) \
int index = CheckIndex(count);
#define ACTION_INT_PARAM(var) \
int var = EvalExpressionI(StateParameters[index++], self);
#define ACTION_BOOL_PARAM(var) \
bool var = !!EvalExpressionI(StateParameters[index++], self);
#define ACTION_NOT_BOOL_PARAM(var) \
bool var = EvalExpressionN(StateParameters[index++], self);
#define ACTION_FIXED_PARAM(var) \
fixed_t var = fixed_t(EvalExpressionF(StateParameters[index++], self)*65536.f);
#define ACTION_FLOAT_PARAM(var) \
float var = EvalExpressionF(StateParameters[index++], self);
#define ACTION_CLASS_PARAM(var) \
const PClass *var = PClass::FindClass(ENamedName(StateParameters[index++]));
#define ACTION_STATE_PARAM(var) \
int var = StateParameters[index++];
#define ACTION_SOUND_PARAM(var) \
FSoundID var = StateParameters[index++];
#define ACTION_STRING_PARAM(var) \
const char *var = FName(ENamedName(StateParameters[index++]));
#endif

View file

@ -172,22 +172,22 @@ int CheckIndex(int paramsize, FState ** pcallstate)
// Simple flag changers
//
//==========================================================================
void A_SetSolid(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_SetSolid)
{
self->flags |= MF_SOLID;
}
void A_UnsetSolid(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_UnsetSolid)
{
self->flags &= ~MF_SOLID;
}
void A_SetFloat(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_SetFloat)
{
self->flags |= MF_FLOAT;
}
void A_UnsetFloat(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_UnsetFloat)
{
self->flags &= ~(MF_FLOAT|MF_INFLOAT);
}
@ -210,10 +210,10 @@ static void DoAttack (AActor *self, bool domelee, bool domissile)
if (index > 0)
{
MeleeDamage=StateParameters[index];
MeleeDamage=EvalExpressionI(StateParameters[index], self);
MeleeSound=StateParameters[index+1];
MissileName=(ENamedName)StateParameters[index+2];
MissileHeight=StateParameters[index+3];
MissileHeight=fixed_t(EvalExpressionF(StateParameters[index+3], self)/65536.f);
}
else
{
@ -259,17 +259,22 @@ static void DoAttack (AActor *self, bool domelee, bool domissile)
}
}
void A_MeleeAttack(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_MeleeAttack)
{
DoAttack(self, true, false);
}
void A_MissileAttack(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_MissileAttack)
{
DoAttack(self, false, true);
}
void A_ComboAttack(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_ComboAttack)
{
DoAttack(self, true, true);
}
DEFINE_ACTION_FUNCTION(AActor, A_BasicAttack)
{
DoAttack(self, true, true);
}
@ -290,22 +295,22 @@ static void DoPlaySound(AActor * self, int channel)
S_Sound (self, channel, soundid, 1, ATTN_NORM);
}
void A_PlaySound(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_PlaySound)
{
DoPlaySound(self, CHAN_BODY);
}
void A_PlayWeaponSound(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_PlayWeaponSound)
{
DoPlaySound(self, CHAN_WEAPON);
}
void A_StopSound(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_StopSound)
{
S_StopSound(self, CHAN_VOICE);
}
void A_PlaySoundEx (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_PlaySoundEx)
{
int index = CheckIndex(4);
if (index < 0) return;
@ -343,7 +348,7 @@ void A_PlaySoundEx (AActor *self)
}
}
void A_StopSoundEx (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_StopSoundEx)
{
int index = CheckIndex (1);
if (index < 0) return;
@ -361,7 +366,7 @@ void A_StopSoundEx (AActor *self)
// Generic seeker missile function
//
//==========================================================================
void A_SeekerMissile(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_SeekerMissile)
{
int index=CheckIndex(2);
if (index<0) return;
@ -376,7 +381,7 @@ void A_SeekerMissile(AActor * self)
// Hitscan attack with a customizable amount of bullets (specified in damage)
//
//==========================================================================
void A_BulletAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_BulletAttack)
{
int i;
int bangle;
@ -483,7 +488,7 @@ static void DoJump(AActor * self, FState * CallingState, int offset)
// State jump function
//
//==========================================================================
void A_Jump(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_Jump)
{
FState * CallingState;
int index = CheckIndex(3, &CallingState);
@ -511,7 +516,7 @@ void A_Jump(AActor * self)
// State jump function
//
//==========================================================================
void A_JumpIfHealthLower(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_JumpIfHealthLower)
{
FState * CallingState;
int index=CheckIndex(2, &CallingState);
@ -527,7 +532,7 @@ void A_JumpIfHealthLower(AActor * self)
// State jump function
//
//==========================================================================
void A_JumpIfCloser(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_JumpIfCloser)
{
FState * CallingState = NULL;
int index = CheckIndex(2, &CallingState);
@ -586,12 +591,12 @@ void DoJumpIfInventory(AActor * self, AActor * owner)
}
}
void A_JumpIfInventory(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_JumpIfInventory)
{
DoJumpIfInventory(self, self);
}
void A_JumpIfInTargetInventory(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_JumpIfInTargetInventory)
{
DoJumpIfInventory(self, self->target);
}
@ -602,7 +607,7 @@ void A_JumpIfInTargetInventory(AActor * self)
//
//==========================================================================
void A_ExplodeParms (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Explode)
{
int damage;
int distance;
@ -645,7 +650,7 @@ void A_ExplodeParms (AActor *self)
//
//==========================================================================
void A_RadiusThrust (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_RadiusThrust)
{
int force = 0;
int distance = 0;
@ -673,7 +678,7 @@ void A_RadiusThrust (AActor *self)
// Execute a line special / script
//
//==========================================================================
void A_CallSpecial(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_CallSpecial)
{
int index=CheckIndex(6);
if (index<0) return;
@ -713,7 +718,7 @@ enum CM_Flags
CMF_CHECKTARGETDEAD = 8,
};
void A_CustomMissile(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_CustomMissile)
{
int index=CheckIndex(6);
if (index<0) return;
@ -835,7 +840,7 @@ void A_CustomMissile(AActor * self)
// An even more customizable hitscan attack
//
//==========================================================================
void A_CustomBulletAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CustomBulletAttack)
{
int index=CheckIndex(7);
if (index<0) return;
@ -882,7 +887,7 @@ void A_CustomBulletAttack (AActor *self)
// A fully customizable melee attack
//
//==========================================================================
void A_CustomMeleeAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CustomMeleeAttack)
{
int index=CheckIndex(5);
if (index<0) return;
@ -916,7 +921,7 @@ void A_CustomMeleeAttack (AActor *self)
// A fully customizable combo attack
//
//==========================================================================
void A_CustomComboAttack (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CustomComboAttack)
{
int index=CheckIndex(6);
if (index<0) return;
@ -973,7 +978,7 @@ void A_CustomComboAttack (AActor *self)
// State jump function
//
//==========================================================================
void A_JumpIfNoAmmo(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_JumpIfNoAmmo)
{
FState * CallingState = NULL;
int index=CheckIndex(1, &CallingState);
@ -992,7 +997,7 @@ void A_JumpIfNoAmmo(AActor * self)
// An even more customizable hitscan attack
//
//==========================================================================
void A_FireBullets (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_FireBullets)
{
int index=CheckIndex(7);
if (index<0 || !self->player) return;
@ -1055,7 +1060,7 @@ void A_FireBullets (AActor *self)
// A_FireProjectile
//
//==========================================================================
void A_FireCustomMissile (AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_FireCustomMissile)
{
int index=CheckIndex(6);
if (index<0 || !self->player) return;
@ -1115,7 +1120,7 @@ void A_FireCustomMissile (AActor * self)
// Berserk is not handled here. That can be done with A_CheckIfInventory
//
//==========================================================================
void A_CustomPunch (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CustomPunch)
{
int index=CheckIndex(5);
if (index<0 || !self->player) return;
@ -1172,7 +1177,7 @@ void A_CustomPunch (AActor *self)
// customizable railgun attack function
//
//==========================================================================
void A_RailAttack (AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_RailAttack)
{
int index=CheckIndex(7);
if (index<0 || !self->player) return;
@ -1203,57 +1208,57 @@ void A_RailAttack (AActor * self)
//
//==========================================================================
void A_CustomRailgun (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_CustomRailgun)
{
int index = CheckIndex(7);
if (index < 0) return;
int Damage = EvalExpressionI (StateParameters[index], actor);
int Spawnofs_XY = EvalExpressionI (StateParameters[index+1], actor);
int Damage = EvalExpressionI (StateParameters[index], self);
int Spawnofs_XY = EvalExpressionI (StateParameters[index+1], self);
int Color1 = StateParameters[index+2];
int Color2 = StateParameters[index+3];
bool Silent = !!EvalExpressionI (StateParameters[index+4], actor);
bool aim = !!EvalExpressionI (StateParameters[index+5], actor);
float MaxDiff = EvalExpressionF (StateParameters[index+6], actor);
bool Silent = !!EvalExpressionI (StateParameters[index+4], self);
bool aim = !!EvalExpressionI (StateParameters[index+5], self);
float MaxDiff = EvalExpressionF (StateParameters[index+6], self);
ENamedName PuffTypeName = (ENamedName)StateParameters[index+7];
if (aim && actor->target == NULL)
if (aim && self->target == NULL)
{
return;
}
// [RH] Andy Baker's stealth monsters
if (actor->flags & MF_STEALTH)
if (self->flags & MF_STEALTH)
{
actor->visdir = 1;
self->visdir = 1;
}
actor->flags &= ~MF_AMBUSH;
self->flags &= ~MF_AMBUSH;
if (aim)
{
actor->angle = R_PointToAngle2 (actor->x,
actor->y,
actor->target->x,
actor->target->y);
self->angle = R_PointToAngle2 (self->x,
self->y,
self->target->x,
self->target->y);
}
actor->pitch = P_AimLineAttack (actor, actor->angle, MISSILERANGE);
self->pitch = P_AimLineAttack (self, self->angle, MISSILERANGE);
// Let the aim trail behind the player
if (aim)
{
actor->angle = R_PointToAngle2 (actor->x,
actor->y,
actor->target->x - actor->target->momx * 3,
actor->target->y - actor->target->momy * 3);
self->angle = R_PointToAngle2 (self->x,
self->y,
self->target->x - self->target->momx * 3,
self->target->y - self->target->momy * 3);
if (actor->target->flags & MF_SHADOW)
if (self->target->flags & MF_SHADOW)
{
actor->angle += pr_crailgun.Random2() << 21;
self->angle += pr_crailgun.Random2() << 21;
}
}
P_RailAttack (actor, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, Silent, PuffTypeName);
P_RailAttack (self, Damage, Spawnofs_XY, Color1, Color2, MaxDiff, Silent, PuffTypeName);
}
//===========================================================================
@ -1302,12 +1307,12 @@ static void DoGiveInventory(AActor * self, AActor * receiver)
}
void A_GiveInventory(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_GiveInventory)
{
DoGiveInventory(self, self);
}
void A_GiveToTarget(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_GiveToTarget)
{
DoGiveInventory(self, self->target);
}
@ -1342,12 +1347,12 @@ void DoTakeInventory(AActor * self, AActor * receiver)
}
}
void A_TakeInventory(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_TakeInventory)
{
DoTakeInventory(self, self);
}
void A_TakeFromTarget(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_TakeFromTarget)
{
DoTakeInventory(self, self->target);
}
@ -1445,7 +1450,7 @@ static void InitSpawnedItem(AActor *self, AActor *mo, int flags)
//
//===========================================================================
void A_SpawnItem(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnItem)
{
FState * CallingState;
int index=CheckIndex(5, &CallingState);
@ -1497,7 +1502,7 @@ void A_SpawnItem(AActor * self)
// Enhanced spawning function
//
//===========================================================================
void A_SpawnItemEx(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnItemEx)
{
FState * CallingState;
int index=CheckIndex(9, &CallingState);
@ -1574,7 +1579,7 @@ void A_SpawnItemEx(AActor * self)
// Throws a grenade (like Hexen's fighter flechette)
//
//===========================================================================
void A_ThrowGrenade(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_ThrowGrenade)
{
FState * CallingState;
int index=CheckIndex(5, &CallingState);
@ -1630,16 +1635,16 @@ void A_ThrowGrenade(AActor * self)
// A_Recoil
//
//===========================================================================
void A_Recoil(AActor * actor)
DEFINE_ACTION_FUNCTION(AActor, A_Recoil)
{
int index=CheckIndex(1, NULL);
if (index<0) return;
fixed_t xymom = fixed_t(EvalExpressionF (StateParameters[index], actor) * FRACUNIT);
fixed_t xymom = fixed_t(EvalExpressionF (StateParameters[index], self) * FRACUNIT);
angle_t angle = actor->angle + ANG180;
angle_t angle = self->angle + ANG180;
angle >>= ANGLETOFINESHIFT;
actor->momx += FixedMul (xymom, finecosine[angle]);
actor->momy += FixedMul (xymom, finesine[angle]);
self->momx += FixedMul (xymom, finecosine[angle]);
self->momy += FixedMul (xymom, finesine[angle]);
}
@ -1648,18 +1653,18 @@ void A_Recoil(AActor * actor)
// A_SelectWeapon
//
//===========================================================================
void A_SelectWeapon(AActor * actor)
DEFINE_ACTION_FUNCTION(AActor, A_SelectWeapon)
{
int index=CheckIndex(1, NULL);
if (index<0 || actor->player == NULL) return;
if (index<0 || self->player == NULL) return;
AWeapon * weaponitem = static_cast<AWeapon*>(actor->FindInventory((ENamedName)StateParameters[index]));
AWeapon * weaponitem = static_cast<AWeapon*>(self->FindInventory((ENamedName)StateParameters[index]));
if (weaponitem != NULL && weaponitem->IsKindOf(RUNTIME_CLASS(AWeapon)))
{
if (actor->player->ReadyWeapon != weaponitem)
if (self->player->ReadyWeapon != weaponitem)
{
actor->player->PendingWeapon = weaponitem;
self->player->PendingWeapon = weaponitem;
}
}
else if (pStateCall != NULL) pStateCall->Result=false;
@ -1673,15 +1678,15 @@ void A_SelectWeapon(AActor * actor)
//===========================================================================
EXTERN_CVAR(Float, con_midtime)
void A_Print(AActor * actor)
DEFINE_ACTION_FUNCTION(AActor, A_Print)
{
int index=CheckIndex(3, NULL);
if (index<0) return;
if (actor->CheckLocalView (consoleplayer) ||
(actor->target!=NULL && actor->target->CheckLocalView (consoleplayer)))
if (self->CheckLocalView (consoleplayer) ||
(self->target!=NULL && self->target->CheckLocalView (consoleplayer)))
{
float time = EvalExpressionF (StateParameters[index+1], actor);
float time = EvalExpressionF (StateParameters[index+1], self);
FName fontname = (ENamedName)StateParameters[index+2];
FFont * oldfont = screen->Font;
float saved = con_midtime;
@ -1709,7 +1714,7 @@ void A_Print(AActor * actor)
// A_SetTranslucent
//
//===========================================================================
void A_SetTranslucent(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_SetTranslucent)
{
int index=CheckIndex(2, NULL);
if (index<0) return;
@ -1730,7 +1735,7 @@ void A_SetTranslucent(AActor * self)
// Fades the actor in
//
//===========================================================================
void A_FadeIn(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_FadeIn)
{
fixed_t reduce = 0;
@ -1754,7 +1759,7 @@ void A_FadeIn(AActor * self)
// fades the actor out and destroys it when done
//
//===========================================================================
void A_FadeOut(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_FadeOut)
{
fixed_t reduce = 0;
@ -1776,7 +1781,7 @@ void A_FadeOut(AActor * self)
// A_SpawnDebris
//
//===========================================================================
void A_SpawnDebris(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_SpawnDebris)
{
int i;
AActor * mo;
@ -1822,7 +1827,7 @@ void A_SpawnDebris(AActor * self)
// jumps if no player can see this actor
//
//===========================================================================
void A_CheckSight(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_CheckSight)
{
if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains!
@ -1844,7 +1849,7 @@ void A_CheckSight(AActor * self)
// Inventory drop
//
//===========================================================================
void A_DropInventory(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_DropInventory)
{
int index=CheckIndex(1, &CallingState);
if (index<0) return;
@ -1862,7 +1867,7 @@ void A_DropInventory(AActor * self)
// A_SetBlend
//
//===========================================================================
void A_SetBlend(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_SetBlend)
{
int index=CheckIndex(3);
if (index<0) return;
@ -1887,7 +1892,7 @@ void A_SetBlend(AActor * self)
// A_JumpIf
//
//===========================================================================
void A_JumpIf(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_JumpIf)
{
FState * CallingState;
int index=CheckIndex(2, &CallingState);
@ -1904,7 +1909,7 @@ void A_JumpIf(AActor * self)
// A_KillMaster
//
//===========================================================================
void A_KillMaster(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_KillMaster)
{
if (self->master != NULL)
{
@ -1917,7 +1922,7 @@ void A_KillMaster(AActor * self)
// A_KillChildren
//
//===========================================================================
void A_KillChildren(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_KillChildren)
{
TThinkerIterator<AActor> it;
AActor * mo;
@ -1936,7 +1941,7 @@ void A_KillChildren(AActor * self)
// A_CountdownArg
//
//===========================================================================
void A_CountdownArg(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_CountdownArg)
{
int index=CheckIndex(1);
if (index<0) return;
@ -1967,7 +1972,7 @@ void A_CountdownArg(AActor * self)
//
//============================================================================
void A_Burst (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Burst)
{
int i, numChunks;
AActor * mo;
@ -1976,42 +1981,42 @@ void A_Burst (AActor *actor)
const PClass * chunk = PClass::FindClass((ENamedName)StateParameters[index]);
if (chunk == NULL) return;
actor->momx = actor->momy = actor->momz = 0;
actor->height = actor->GetDefault()->height;
self->momx = self->momy = self->momz = 0;
self->height = self->GetDefault()->height;
// [RH] In Hexen, this creates a random number of shards (range [24,56])
// with no relation to the size of the actor shattering. I think it should
// with no relation to the size of the self shattering. I think it should
// base the number of shards on the size of the dead thing, so bigger
// things break up into more shards than smaller things.
// An actor with radius 20 and height 64 creates ~40 chunks.
numChunks = MAX<int> (4, (actor->radius>>FRACBITS)*(actor->height>>FRACBITS)/32);
// An self with radius 20 and height 64 creates ~40 chunks.
numChunks = MAX<int> (4, (self->radius>>FRACBITS)*(self->height>>FRACBITS)/32);
i = (pr_burst.Random2()) % (numChunks/4);
for (i = MAX (24, numChunks + i); i >= 0; i--)
{
mo = Spawn(chunk,
actor->x + (((pr_burst()-128)*actor->radius)>>7),
actor->y + (((pr_burst()-128)*actor->radius)>>7),
actor->z + (pr_burst()*actor->height/255), ALLOW_REPLACE);
self->x + (((pr_burst()-128)*self->radius)>>7),
self->y + (((pr_burst()-128)*self->radius)>>7),
self->z + (pr_burst()*self->height/255), ALLOW_REPLACE);
if (mo)
{
mo->momz = FixedDiv(mo->z-actor->z, actor->height)<<2;
mo->momz = FixedDiv(mo->z-self->z, self->height)<<2;
mo->momx = pr_burst.Random2 () << (FRACBITS-7);
mo->momy = pr_burst.Random2 () << (FRACBITS-7);
mo->RenderStyle = actor->RenderStyle;
mo->alpha = actor->alpha;
mo->CopyFriendliness(actor, true);
mo->RenderStyle = self->RenderStyle;
mo->alpha = self->alpha;
mo->CopyFriendliness(self, true);
}
}
// [RH] Do some stuff to make this more useful outside Hexen
if (actor->flags4 & MF4_BOSSDEATH)
if (self->flags4 & MF4_BOSSDEATH)
{
A_BossDeath (actor);
CALL_ACTION(A_BossDeath, self);
}
A_NoBlocking (actor);
CALL_ACTION(A_NoBlocking, self);
actor->Destroy ();
self->Destroy ();
}
//===========================================================================
@ -2020,7 +2025,7 @@ void A_Burst (AActor *actor)
// [GRB] Jumps if actor is standing on floor
//
//===========================================================================
void A_CheckFloor (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_CheckFloor)
{
FState *CallingState = NULL;
int index = CheckIndex (1, &CallingState);
@ -2039,7 +2044,7 @@ void A_CheckFloor (AActor *self)
// resets all momentum of the actor to 0
//
//===========================================================================
void A_Stop (AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_Stop)
{
self->momx = self->momy = self->momz = 0;
if (self->player && self->player->mo == self && !(self->player->cheats & CF_PREDICTING))
@ -2055,39 +2060,39 @@ void A_Stop (AActor *self)
// A_Respawn
//
//===========================================================================
void A_Respawn (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_Respawn)
{
fixed_t x = actor->SpawnPoint[0];
fixed_t y = actor->SpawnPoint[1];
fixed_t x = self->SpawnPoint[0];
fixed_t y = self->SpawnPoint[1];
sector_t *sec;
actor->flags |= MF_SOLID;
self->flags |= MF_SOLID;
sec = P_PointInSector (x, y);
actor->SetOrigin (x, y, sec->floorplane.ZatPoint (x, y));
actor->height = actor->GetDefault()->height;
if (P_TestMobjLocation (actor))
self->SetOrigin (x, y, sec->floorplane.ZatPoint (x, y));
self->height = self->GetDefault()->height;
if (P_TestMobjLocation (self))
{
AActor *defs = actor->GetDefault();
actor->health = defs->health;
AActor *defs = self->GetDefault();
self->health = defs->health;
actor->flags = (defs->flags & ~MF_FRIENDLY) | (actor->flags & MF_FRIENDLY);
actor->flags2 = defs->flags2;
actor->flags3 = (defs->flags3 & ~(MF3_NOSIGHTCHECK | MF3_HUNTPLAYERS)) | (actor->flags3 & (MF3_NOSIGHTCHECK | MF3_HUNTPLAYERS));
actor->flags4 = (defs->flags4 & ~MF4_NOHATEPLAYERS) | (actor->flags4 & MF4_NOHATEPLAYERS);
actor->flags5 = defs->flags5;
actor->SetState (actor->SpawnState);
actor->renderflags &= ~RF_INVISIBLE;
self->flags = (defs->flags & ~MF_FRIENDLY) | (self->flags & MF_FRIENDLY);
self->flags2 = defs->flags2;
self->flags3 = (defs->flags3 & ~(MF3_NOSIGHTCHECK | MF3_HUNTPLAYERS)) | (self->flags3 & (MF3_NOSIGHTCHECK | MF3_HUNTPLAYERS));
self->flags4 = (defs->flags4 & ~MF4_NOHATEPLAYERS) | (self->flags4 & MF4_NOHATEPLAYERS);
self->flags5 = defs->flags5;
self->SetState (self->SpawnState);
self->renderflags &= ~RF_INVISIBLE;
int index=CheckIndex(1, NULL);
if (index<0 || EvalExpressionN (StateParameters[index], actor))
if (index<0 || EvalExpressionN (StateParameters[index], self))
{
Spawn<ATeleportFog> (x, y, actor->z + TELEFOGHEIGHT, ALLOW_REPLACE);
Spawn<ATeleportFog> (x, y, self->z + TELEFOGHEIGHT, ALLOW_REPLACE);
}
if (actor->CountsAsKill()) level.total_monsters++;
if (self->CountsAsKill()) level.total_monsters++;
}
else
{
actor->flags &= ~MF_SOLID;
self->flags &= ~MF_SOLID;
}
}
@ -2098,17 +2103,17 @@ void A_Respawn (AActor *actor)
//
//==========================================================================
void A_PlayerSkinCheck (AActor *actor)
DEFINE_ACTION_FUNCTION(AActor, A_PlayerSkinCheck)
{
if (pStateCall != NULL) pStateCall->Result=false; // Jumps should never set the result for inventory state chains!
if (actor->player != NULL &&
skins[actor->player->userinfo.skin].othergame)
if (self->player != NULL &&
skins[self->player->userinfo.skin].othergame)
{
int index = CheckIndex(1, &CallingState);
if (index >= 0)
{
DoJump(actor, CallingState, StateParameters[index]);
DoJump(self, CallingState, StateParameters[index]);
}
}
}
@ -2118,7 +2123,7 @@ void A_PlayerSkinCheck (AActor *actor)
// A_SetGravity
//
//===========================================================================
void A_SetGravity(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_SetGravity)
{
int index=CheckIndex(1);
if (index<0) return;
@ -2135,7 +2140,7 @@ void A_SetGravity(AActor * self)
//
//===========================================================================
void A_ClearTarget(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_ClearTarget)
{
self->target = NULL;
self->LastHeard = NULL;
@ -2155,7 +2160,7 @@ void A_ClearTarget(AActor * self)
//
//==========================================================================
void A_JumpIfTargetInLOS(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_JumpIfTargetInLOS)
{
FState * CallingState = NULL;
int index = CheckIndex(3, &CallingState);
@ -2217,7 +2222,7 @@ void A_JumpIfTargetInLOS(AActor * self)
// Damages the master of this child by the specified amount. Negative values heal.
//
//===========================================================================
void A_DamageMaster(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_DamageMaster)
{
int index = CheckIndex(2);
if (index<0) return;
@ -2245,7 +2250,7 @@ void A_DamageMaster(AActor * self)
// Damages the children of this master by the specified amount. Negative values heal.
//
//===========================================================================
void A_DamageChildren(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_DamageChildren)
{
TThinkerIterator<AActor> it;
AActor * mo;
@ -2281,7 +2286,7 @@ void A_DamageChildren(AActor * self)
//
//===========================================================================
void A_CheckForReload( AActor *self )
DEFINE_ACTION_FUNCTION(AActor, A_CheckForReload)
{
if ( self->player == NULL || self->player->ReadyWeapon == NULL )
return;
@ -2313,7 +2318,7 @@ void A_CheckForReload( AActor *self )
//
//===========================================================================
void A_ResetReloadCounter(AActor *self)
DEFINE_ACTION_FUNCTION(AActor, A_ResetReloadCounter)
{
if ( self->player == NULL || self->player->ReadyWeapon == NULL )
return;

View file

@ -456,7 +456,7 @@ static void HandleDeprecatedFlags(AActor *defaults, bool set, int index)
// This cannot be placed in thingdef_codeptr because it needs the flag table
//
//===========================================================================
void A_ChangeFlag(AActor * self)
DEFINE_ACTION_FUNCTION(AActor, A_ChangeFlag)
{
int index=CheckIndex(2);
const char * flagname = FName((ENamedName)StateParameters[index]).GetChars();
@ -2173,6 +2173,7 @@ static void PowerupColor (FScanner &sc, APowerupGiver *defaults, Baggage &bag)
else
{
sc.ScriptError("\"%s\" requires an actor of type \"Powerup\"\n", sc.String);
return;
}
if (sc.CheckNumber())
@ -2231,6 +2232,7 @@ static void PowerupDuration (FScanner &sc, APowerupGiver *defaults, Baggage &bag
{
int *pEffectTics;
if (bag.Info->Class->IsDescendantOf(RUNTIME_CLASS(APowerup)))
{
pEffectTics = &((APowerup*)defaults)->EffectTics;
@ -2242,10 +2244,11 @@ static void PowerupDuration (FScanner &sc, APowerupGiver *defaults, Baggage &bag
else
{
sc.ScriptError("\"%s\" requires an actor of type \"Powerup\"\n", sc.String);
return;
}
sc.MustGetNumber();
*pEffectTics = sc.Number>=0? sc.Number : -sc.Number*TICRATE;
*pEffectTics = (sc.Number >= 0) ? sc.Number : -sc.Number * TICRATE;
}
//==========================================================================

View file

@ -54,9 +54,12 @@
#include "a_sharedglobal.h"
#include "s_sound.h"
#include "i_system.h"
#include "autosegs.h"
TArray<int> StateParameters;
TArray<FName> JumpParameters;
static TArray<AFuncDesc> AFTable;
static TArray<FState> StateArray;
//==========================================================================
//
@ -64,28 +67,7 @@ TArray<FName> JumpParameters;
//
//==========================================================================
#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"
AFuncDesc AFTable[] =
{
#define WEAPON(x) { "A_" #x, A_##x },
#define ACTOR(x) { "A_" #x, A_##x },
#include "codepointers.h"
#include "d_dehackedactions.h"
{ "A_Fall", A_NoBlocking },
{ "A_BasicAttack", A_ComboAttack },
{ "A_Explode", A_ExplodeParms }
};
static TArray<FState> StateArray;
DECLARE_ACTION(A_CallSpecial)
//==========================================================================
//
@ -103,11 +85,18 @@ AFuncDesc * FindFunction(const char * string)
if (!funcsorted)
{
qsort(AFTable, countof(AFTable), sizeof(AFTable[0]), funccmp);
TAutoSegIterator<AFuncDesc *, &ARegHead, &ARegTail> probe;
while (++probe != NULL)
{
AFTable.Push(*probe);
}
AFTable.ShrinkToFit();
qsort(&AFTable[0], AFTable.Size(), sizeof(AFTable[0]), funccmp);
funcsorted=true;
}
int min = 0, max = countof(AFTable)-1;
int min = 0, max = AFTable.Size()-1;
while (min <= max)
{
@ -382,6 +371,7 @@ int PrepareStateParameters(FState * state, int numparams)
return paramindex;
}
void A_CallSpecial(AActor * self);
//==========================================================================
//
// DoActionSpecials
@ -424,7 +414,7 @@ bool DoActionSpecials(FScanner &sc, FState & state, bool multistate, int * state
{
sc.ScriptError ("Too many arguments to %s", specname.GetChars());
}
state.Action = A_CallSpecial;
state.Action = GET_ACTION(A_CallSpecial);
return true;
}
return false;
@ -502,7 +492,7 @@ int ParseStates(FScanner &sc, FActorInfo * actor, AActor * defaults, Baggage &ba
FState * laststate = NULL;
intptr_t lastlabel = -1;
int minrequiredstate = -1;
int spriteindex;
int spriteindex = 0;
char lastsprite[5]="";
sc.MustGetStringName ("{");

39
src/win32/wrappers.asm Normal file
View file

@ -0,0 +1,39 @@
; The Visual C++ CRT unconditionally links to IsDebuggerPresent.
; This function is not available under Windows 95, so here is a
; lowlevel replacement for it.
extern __imp__GetModuleHandleA@4
extern __imp__GetProcAddress@8
SECTION .data
global __imp__IsDebuggerPresent@0
__imp__IsDebuggerPresent@0:
dd IsDebuggerPresent_Check
SECTION .rdata
StrKERNEL32:
db "KERNEL32",0
StrIsDebuggerPresent:
db "IsDebuggerPresent",0
SECTION .text
IsDebuggerPresent_No:
xor eax,eax
ret
IsDebuggerPresent_Check:
push StrKERNEL32
call [__imp__GetModuleHandleA@4]
push StrIsDebuggerPresent
push eax
call [__imp__GetProcAddress@8]
test eax,eax
jne near .itis
mov eax,IsDebuggerPresent_No
.itis:
mov [__imp__IsDebuggerPresent@0],eax
jmp eax

Some files were not shown because too many files have changed in this diff Show more