diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 952072d2a..a431957af 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,7 @@ August 10, 2008 (Changes by Graf Zahl) +- 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. - Removed DECORATE's ParseClass because it was only used to add data to fully internal actor classes which no longer exist. - Changed the state structure so that the Tics value doesn't need to be hacked diff --git a/src/actor.h b/src/actor.h index c8e2286ec..f28ff7b16 100644 --- a/src/actor.h +++ b/src/actor.h @@ -482,9 +482,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); diff --git a/src/d_dehackedactions.h b/src/d_dehackedactions.h index dea57a7f7..f182a72a6 100644 --- a/src/d_dehackedactions.h +++ b/src/d_dehackedactions.h @@ -33,10 +33,7 @@ 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) diff --git a/src/g_doom/a_arachnotron.cpp b/src/g_doom/a_arachnotron.cpp index 09db62c07..e7b1962e9 100644 --- a/src/g_doom/a_arachnotron.cpp +++ b/src/g_doom/a_arachnotron.cpp @@ -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); diff --git a/src/g_doom/a_archvile.cpp b/src/g_doom/a_archvile.cpp index d199c3aa2..2264a0f41 100644 --- a/src/g_doom/a_archvile.cpp +++ b/src/g_doom/a_archvile.cpp @@ -6,6 +6,7 @@ #include "a_doomglobal.h" #include "gstrings.h" #include "a_action.h" +#include "thingdef/thingdef.h" // // PIT_VileCheck @@ -18,7 +19,7 @@ void A_Fire (AActor *self); // // 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); } -void A_FireCrackle (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_FireCrackle) { S_Sound (self, CHAN_BODY, "vile/firecrkl", 1, ATTN_NORM); A_Fire (self); } -void A_Fire (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_Fire) { AActor *dest; angle_t an; @@ -66,21 +67,21 @@ 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; + self->tracer = fog; + fog->target = self; + fog->tracer = self->target; 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); } diff --git a/src/g_doom/a_bossbrain.cpp b/src/g_doom/a_bossbrain.cpp index d9bb1d9f7..1b368ffbe 100644 --- a/src/g_doom/a_bossbrain.cpp +++ b/src/g_doom/a_bossbrain.cpp @@ -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,7 +246,7 @@ 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); diff --git a/src/g_doom/a_bruiser.cpp b/src/g_doom/a_bruiser.cpp index af2cb5768..948e6016e 100644 --- a/src/g_doom/a_bruiser.cpp +++ b/src/g_doom/a_bruiser.cpp @@ -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; diff --git a/src/g_doom/a_cacodemon.cpp b/src/g_doom/a_cacodemon.cpp index fc3b7a1a5..e594ec7ed 100644 --- a/src/g_doom/a_cacodemon.cpp +++ b/src/g_doom/a_cacodemon.cpp @@ -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; diff --git a/src/g_doom/a_cyberdemon.cpp b/src/g_doom/a_cyberdemon.cpp index 1712df9d9..c89b3e3d6 100644 --- a/src/g_doom/a_cyberdemon.cpp +++ b/src/g_doom/a_cyberdemon.cpp @@ -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); diff --git a/src/g_doom/a_demon.cpp b/src/g_doom/a_demon.cpp index 0db9c88ec..7f6bc0cdf 100644 --- a/src/g_doom/a_demon.cpp +++ b/src/g_doom/a_demon.cpp @@ -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; diff --git a/src/g_doom/a_doomimp.cpp b/src/g_doom/a_doomimp.cpp index 351b31c5a..bbbb2fe0f 100644 --- a/src/g_doom/a_doomimp.cpp +++ b/src/g_doom/a_doomimp.cpp @@ -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; diff --git a/src/g_doom/a_doommisc.cpp b/src/g_doom/a_doommisc.cpp index 46fe055d9..4c0d6b449 100644 --- a/src/g_doom/a_doommisc.cpp +++ b/src/g_doom/a_doommisc.cpp @@ -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 (); } } diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index 5780b05cb..1b9fe920e 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -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()) + if (self->FindInventory()) 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); + 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,7 +395,7 @@ void A_FirePlasma (AActor *actor) } } - P_SpawnPlayerMissile (actor, PClass::FindClass("PlasmaBall")); + P_SpawnPlayerMissile (self, PClass::FindClass("PlasmaBall")); } // @@ -403,17 +403,17 @@ void A_FirePlasma (AActor *actor) // static int RailOffset; -void A_FireRailgun (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireRailgun) { 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 +428,23 @@ void A_FireRailgun (AActor *actor) damage = deathmatch ? 100 : 150; - P_RailAttack (actor, damage, RailOffset); + P_RailAttack (self, damage, RailOffset); RailOffset = 0; } -void A_FireRailgunRight (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireRailgunRight) { RailOffset = 10; - A_FireRailgun (actor); + A_FireRailgun (self); } -void A_FireRailgunLeft (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireRailgunLeft) { RailOffset = -10; - A_FireRailgun (actor); + A_FireRailgun (self); } -void A_RailWait (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_RailWait) { // Okay, this was stupid. Just use a NULL function instead of this. } @@ -453,19 +453,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 +474,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 +486,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 +502,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 +515,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 +533,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 +541,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); } diff --git a/src/g_doom/a_fatso.cpp b/src/g_doom/a_fatso.cpp index f4f94f1bb..588030a64 100644 --- a/src/g_doom/a_fatso.cpp +++ b/src/g_doom/a_fatso.cpp @@ -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<target, 128, 128, self->DamageType, true); + if (self->z <= self->floorz + (128<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; diff --git a/src/g_doom/a_keen.cpp b/src/g_doom/a_keen.cpp index 18c02c52e..d579a0d9c 100644 --- a/src/g_doom/a_keen.cpp +++ b/src/g_doom/a_keen.cpp @@ -4,13 +4,14 @@ #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); diff --git a/src/g_doom/a_lostsoul.cpp b/src/g_doom/a_lostsoul.cpp index 2ccb882bb..83d200d71 100644 --- a/src/g_doom/a_lostsoul.cpp +++ b/src/g_doom/a_lostsoul.cpp @@ -19,7 +19,7 @@ // #define SKULLSPEED (20*FRACUNIT) -void A_SkullAttack (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_SkullAttack) { AActor *dest; angle_t an; diff --git a/src/g_doom/a_painelemental.cpp b/src/g_doom/a_painelemental.cpp index f84aca368..f3135a4f6 100644 --- a/src/g_doom/a_painelemental.cpp +++ b/src/g_doom/a_painelemental.cpp @@ -138,7 +138,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 +148,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,7 +159,7 @@ 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! diff --git a/src/g_doom/a_possessed.cpp b/src/g_doom/a_possessed.cpp index 020829d96..4854ea2d5 100644 --- a/src/g_doom/a_possessed.cpp +++ b/src/g_doom/a_possessed.cpp @@ -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); diff --git a/src/g_doom/a_revenant.cpp b/src/g_doom/a_revenant.cpp index 66792e5d4..74fdc511a 100644 --- a/src/g_doom/a_revenant.cpp +++ b/src/g_doom/a_revenant.cpp @@ -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; diff --git a/src/g_doom/a_scriptedmarine.cpp b/src/g_doom/a_scriptedmarine.cpp index d92cca166..5f981a39d 100644 --- a/src/g_doom/a_scriptedmarine.cpp +++ b/src/g_doom/a_scriptedmarine.cpp @@ -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(self)->CurrentWeapon == AScriptedMarine::WEAPON_Chainsaw) { @@ -220,7 +220,7 @@ void A_MarineNoise (AActor *self) // //============================================================================ -void A_MarineChase (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_MarineChase) { A_MarineNoise (self); A_Chase (self); @@ -232,7 +232,7 @@ void A_MarineChase (AActor *self) // //============================================================================ -void A_MarineLook (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_MarineLook) { A_MarineNoise (self); 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) +DEFINE_ACTION_FUNCTION(AActor, A_M_Punch) { angle_t angle; int damage; @@ -357,7 +357,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 +378,7 @@ void A_M_FirePistol (AActor *self) // //============================================================================ -void A_M_FireShotgun (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun) { int pitch; @@ -401,7 +401,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 +419,7 @@ void A_M_CheckAttack (AActor *self) // //============================================================================ -void A_M_FireShotgun2 (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_M_FireShotgun2) { int pitch; @@ -447,7 +447,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,7 +472,7 @@ void A_M_FireCGun (AActor *self) // //============================================================================ -void A_M_FireMissile (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_M_FireMissile) { if (self->target == NULL) return; @@ -494,7 +494,7 @@ void A_M_FireMissile (AActor *self) // //============================================================================ -void A_M_FireRailgun (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_M_FireRailgun) { if (self->target == NULL) return; @@ -509,7 +509,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 +525,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 +549,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; diff --git a/src/g_doom/a_spidermaster.cpp b/src/g_doom/a_spidermaster.cpp index b616ee1aa..cea5fdc04 100644 --- a/src/g_doom/a_spidermaster.cpp +++ b/src/g_doom/a_spidermaster.cpp @@ -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); diff --git a/src/g_heretic/a_chicken.cpp b/src/g_heretic/a_chicken.cpp index ef8827e08..287bd0820 100644 --- a/src/g_heretic/a_chicken.cpp +++ b/src/g_heretic/a_chicken.cpp @@ -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; } diff --git a/src/g_heretic/a_dsparil.cpp b/src/g_heretic/a_dsparil.cpp index 6171bf918..8405fe3e0 100644 --- a/src/g_heretic/a_dsparil.cpp +++ b/src/g_heretic/a_dsparil.cpp @@ -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 + 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 (actor->x, actor->y, actor->z, ALLOW_REPLACE); + Spawn (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")); } } diff --git a/src/g_heretic/a_hereticartifacts.cpp b/src/g_heretic/a_hereticartifacts.cpp index f52b5516d..db786d22f 100644 --- a/src/g_heretic/a_hereticartifacts.cpp +++ b/src/g_heretic/a_hereticartifacts.cpp @@ -5,6 +5,7 @@ #include "p_local.h" #include "p_enemy.h" #include "s_sound.h" +#include "thingdef/thingdef.h" // Tome of power ------------------------------------------------------------ @@ -43,7 +44,7 @@ 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; diff --git a/src/g_heretic/a_hereticimp.cpp b/src/g_heretic/a_hereticimp.cpp index 3640d9adc..a65d3dcc1 100644 --- a/src/g_heretic/a_hereticimp.cpp +++ b/src/g_heretic/a_hereticimp.cpp @@ -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; diff --git a/src/g_heretic/a_hereticmisc.cpp b/src/g_heretic/a_hereticmisc.cpp index 0ad250953..a19e2185f 100644 --- a/src/g_heretic/a_hereticmisc.cpp +++ b/src/g_heretic/a_hereticmisc.cpp @@ -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; diff --git a/src/g_heretic/a_hereticweaps.cpp b/src/g_heretic/a_hereticweaps.cpp index 7451aac04..0f3484f52 100644 --- a/src/g_heretic/a_hereticweaps.cpp +++ b/src/g_heretic/a_hereticweaps.cpp @@ -59,7 +59,7 @@ extern bool P_AutoUseChaosDevice (player_t *player); // //---------------------------------------------------------------------------- -void A_StaffAttack (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_StaffAttack) { angle_t angle; int damage; @@ -67,7 +67,7 @@ void A_StaffAttack (AActor *actor) player_t *player; AActor *linetarget; - if (NULL == (player = actor->player)) + if (NULL == (player = self->player)) { return; } @@ -75,7 +75,7 @@ void A_StaffAttack (AActor *actor) int index = CheckIndex (2, NULL); if (index < 0) return; - damage = EvalExpressionI (StateParameters[index], actor); + damage = EvalExpressionI (StateParameters[index], self); const PClass *puff = PClass::FindClass ((ENamedName)StateParameters[index+1]); @@ -85,16 +85,16 @@ void A_StaffAttack (AActor *actor) if (!weapon->DepleteAmmo (weapon->bAltFire)) return; } - angle = actor->angle; + angle = self->angle; angle += pr_sap.Random2() << 18; - slope = P_AimLineAttack (actor, angle, MELEERANGE, &linetarget); - P_LineAttack (actor, angle, MELEERANGE, slope, damage, NAME_Melee, puff, true); + slope = P_AimLineAttack (self, angle, MELEERANGE, &linetarget); + P_LineAttack (self, angle, MELEERANGE, slope, damage, NAME_Melee, puff, true); if (linetarget) { //S_StartSound(player->mo, sfx_stfhit); // turn to face target - actor->angle = R_PointToAngle2 (actor->x, - actor->y, linetarget->x, linetarget->y); + self->angle = R_PointToAngle2 (self->x, + self->y, linetarget->x, linetarget->y); } } @@ -105,13 +105,13 @@ void A_StaffAttack (AActor *actor) // //---------------------------------------------------------------------------- -void A_FireGoldWandPL1 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL1) { angle_t angle; int damage; player_t *player; - if (NULL == (player = actor->player)) + if (NULL == (player = self->player)) { return; } @@ -122,15 +122,15 @@ void A_FireGoldWandPL1 (AActor *actor) if (!weapon->DepleteAmmo (weapon->bAltFire)) return; } - angle_t pitch = P_BulletSlope(actor); + angle_t pitch = P_BulletSlope(self); damage = 7+(pr_fgw()&7); - angle = actor->angle; + angle = self->angle; if (player->refire) { angle += pr_fgw.Random2() << 18; } - P_LineAttack (actor, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, "GoldWandPuff1"); - S_Sound (actor, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM); + P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, "GoldWandPuff1"); + S_Sound (self, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM); } //---------------------------------------------------------------------------- @@ -139,7 +139,7 @@ void A_FireGoldWandPL1 (AActor *actor) // //---------------------------------------------------------------------------- -void A_FireGoldWandPL2 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireGoldWandPL2) { int i; angle_t angle; @@ -147,7 +147,7 @@ void A_FireGoldWandPL2 (AActor *actor) fixed_t momz; player_t *player; - if (NULL == (player = actor->player)) + if (NULL == (player = self->player)) { return; } @@ -158,19 +158,19 @@ void A_FireGoldWandPL2 (AActor *actor) if (!weapon->DepleteAmmo (weapon->bAltFire)) return; } - angle_t pitch = P_BulletSlope(actor); + angle_t pitch = P_BulletSlope(self); momz = FixedMul (GetDefaultByName("GoldWandFX2")->Speed, finetangent[FINEANGLES/4-((signed)pitch>>ANGLETOFINESHIFT)]); - P_SpawnMissileAngle (actor, PClass::FindClass("GoldWandFX2"), actor->angle-(ANG45/8), momz); - P_SpawnMissileAngle (actor, PClass::FindClass("GoldWandFX2"), actor->angle+(ANG45/8), momz); - angle = actor->angle-(ANG45/8); + P_SpawnMissileAngle (self, PClass::FindClass("GoldWandFX2"), self->angle-(ANG45/8), momz); + P_SpawnMissileAngle (self, PClass::FindClass("GoldWandFX2"), self->angle+(ANG45/8), momz); + angle = self->angle-(ANG45/8); for(i = 0; i < 5; i++) { damage = 1+(pr_fgw2()&7); - P_LineAttack (actor, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, "GoldWandPuff2"); + P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, "GoldWandPuff2"); angle += ((ANG45/8)*2)/4; } - S_Sound (actor, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM); + S_Sound (self, CHAN_WEAPON, "weapons/wandhit", 1, ATTN_NORM); } //---------------------------------------------------------------------------- @@ -179,11 +179,11 @@ void A_FireGoldWandPL2 (AActor *actor) // //---------------------------------------------------------------------------- -void A_FireCrossbowPL1 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL1) { player_t *player; - if (NULL == (player = actor->player)) + if (NULL == (player = self->player)) { return; } @@ -194,9 +194,9 @@ void A_FireCrossbowPL1 (AActor *actor) if (!weapon->DepleteAmmo (weapon->bAltFire)) return; } - P_SpawnPlayerMissile (actor, PClass::FindClass("CrossbowFX1")); - P_SpawnPlayerMissile (actor, PClass::FindClass("CrossbowFX3"), actor->angle-(ANG45/10)); - P_SpawnPlayerMissile (actor, PClass::FindClass("CrossbowFX3"), actor->angle+(ANG45/10)); + P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX1")); + P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX3"), self->angle-(ANG45/10)); + P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX3"), self->angle+(ANG45/10)); } //---------------------------------------------------------------------------- @@ -205,26 +205,26 @@ void A_FireCrossbowPL1 (AActor *actor) // //---------------------------------------------------------------------------- -void A_FireCrossbowPL2(AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireCrossbowPL2) { 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("CrossbowFX2")); - P_SpawnPlayerMissile (actor, PClass::FindClass("CrossbowFX2"), actor->angle-(ANG45/10)); - P_SpawnPlayerMissile (actor, PClass::FindClass("CrossbowFX2"), actor->angle+(ANG45/10)); - P_SpawnPlayerMissile (actor, PClass::FindClass("CrossbowFX3"), actor->angle-(ANG45/5)); - P_SpawnPlayerMissile (actor, PClass::FindClass("CrossbowFX3"), actor->angle+(ANG45/5)); + P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX2")); + P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX2"), self->angle-(ANG45/10)); + P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX2"), self->angle+(ANG45/10)); + P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX3"), self->angle-(ANG45/5)); + P_SpawnPlayerMissile (self, PClass::FindClass("CrossbowFX3"), self->angle+(ANG45/5)); } //--------------------------------------------------------------------------- @@ -233,7 +233,7 @@ void A_FireCrossbowPL2(AActor *actor) // //--------------------------------------------------------------------------- -void A_GauntletAttack (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_GauntletAttack) { angle_t angle; int damage; @@ -245,7 +245,7 @@ void A_GauntletAttack (AActor *actor) int power; AActor *linetarget; - if (NULL == (player = actor->player)) + if (NULL == (player = self->player)) { return; } @@ -253,7 +253,7 @@ void A_GauntletAttack (AActor *actor) int index = CheckIndex (1, NULL); if (index < 0) return; - power = EvalExpressionI (StateParameters[index], actor); + power = EvalExpressionI (StateParameters[index], self); AWeapon *weapon = player->ReadyWeapon; if (weapon != NULL) @@ -263,7 +263,7 @@ void A_GauntletAttack (AActor *actor) } player->psprites[ps_weapon].sx = ((pr_gatk()&3)-2) * FRACUNIT; player->psprites[ps_weapon].sy = WEAPONTOP + (pr_gatk()&3) * FRACUNIT; - angle = actor->angle; + angle = self->angle; if (power) { damage = pr_gatk.HitDice (2); @@ -278,15 +278,15 @@ void A_GauntletAttack (AActor *actor) angle += pr_gatk.Random2() << 18; pufftype = PClass::FindClass("GauntletPuff1"); } - slope = P_AimLineAttack (actor, angle, dist, &linetarget); - P_LineAttack (actor, angle, dist, slope, damage, NAME_Melee, pufftype); + slope = P_AimLineAttack (self, angle, dist, &linetarget); + P_LineAttack (self, angle, dist, slope, damage, NAME_Melee, pufftype); if (!linetarget) { if (pr_gatk() > 64) { player->extralight = !player->extralight; } - S_Sound (actor, CHAN_AUTO, "weapons/gauntletson", 1, ATTN_NORM); + S_Sound (self, CHAN_AUTO, "weapons/gauntletson", 1, ATTN_NORM); return; } randVal = pr_gatk(); @@ -304,31 +304,31 @@ void A_GauntletAttack (AActor *actor) } if (power) { - P_GiveBody (actor, damage>>1); - S_Sound (actor, CHAN_AUTO, "weapons/gauntletspowhit", 1, ATTN_NORM); + P_GiveBody (self, damage>>1); + S_Sound (self, CHAN_AUTO, "weapons/gauntletspowhit", 1, ATTN_NORM); } else { - S_Sound (actor, CHAN_AUTO, "weapons/gauntletshit", 1, ATTN_NORM); + S_Sound (self, CHAN_AUTO, "weapons/gauntletshit", 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 ((int)(angle-actor->angle) < -ANG90/20) - actor->angle = angle+ANG90/21; + if ((int)(angle-self->angle) < -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; } // --- Mace ----------------------------------------------------------------- @@ -372,7 +372,7 @@ int AMaceFX4::DoSpecialDamage (AActor *target, int damage) // //---------------------------------------------------------------------------- -void A_FireMacePL1B (AActor *actor) +void FireMacePL1B (AActor *actor) { AActor *ball; angle_t angle; @@ -410,19 +410,19 @@ void A_FireMacePL1B (AActor *actor) // //---------------------------------------------------------------------------- -void A_FireMacePL1 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL1) { AActor *ball; player_t *player; - if (NULL == (player = actor->player)) + if (NULL == (player = self->player)) { return; } if (pr_maceatk() < 28) { - A_FireMacePL1B (actor); + FireMacePL1B (self); return; } AWeapon *weapon = player->ReadyWeapon; @@ -433,8 +433,8 @@ void A_FireMacePL1 (AActor *actor) } player->psprites[ps_weapon].sx = ((pr_maceatk()&3)-2)*FRACUNIT; player->psprites[ps_weapon].sy = WEAPONTOP+(pr_maceatk()&3)*FRACUNIT; - ball = P_SpawnPlayerMissile (actor, PClass::FindClass("MaceFX1"), - actor->angle+(((pr_maceatk()&7)-4)<<24)); + ball = P_SpawnPlayerMissile (self, PClass::FindClass("MaceFX1"), + self->angle+(((pr_maceatk()&7)-4)<<24)); if (ball) { ball->special1 = 16; // tics till dropoff @@ -447,33 +447,33 @@ void A_FireMacePL1 (AActor *actor) // //---------------------------------------------------------------------------- -void A_MacePL1Check (AActor *ball) +DEFINE_ACTION_FUNCTION(AActor, A_MacePL1Check) { - if (ball->special1 == 0) + if (self->special1 == 0) { return; } - ball->special1 -= 4; - if (ball->special1 > 0) + self->special1 -= 4; + if (self->special1 > 0) { return; } - ball->special1 = 0; - ball->flags &= ~MF_NOGRAVITY; - ball->gravity = FRACUNIT/8; + self->special1 = 0; + self->flags &= ~MF_NOGRAVITY; + self->gravity = FRACUNIT/8; // [RH] Avoid some precision loss by scaling the momentum directly #if 0 - angle_t angle = ball->angle>>ANGLETOFINESHIFT; - ball->momx = FixedMul(7*FRACUNIT, finecosine[angle]); - ball->momy = FixedMul(7*FRACUNIT, finesine[angle]); + angle_t angle = self->angle>>ANGLETOFINESHIFT; + self->momx = FixedMul(7*FRACUNIT, finecosine[angle]); + self->momy = FixedMul(7*FRACUNIT, finesine[angle]); #else - float momscale = sqrtf ((float)ball->momx * (float)ball->momx + - (float)ball->momy * (float)ball->momy); + float momscale = sqrtf ((float)self->momx * (float)self->momx + + (float)self->momy * (float)self->momy); momscale = 458752.f / momscale; - ball->momx = (int)(ball->momx * momscale); - ball->momy = (int)(ball->momy * momscale); + self->momx = (int)(self->momx * momscale); + self->momy = (int)(self->momy * momscale); #endif - ball->momz -= ball->momz>>1; + self->momz -= self->momz>>1; } //---------------------------------------------------------------------------- @@ -482,22 +482,22 @@ void A_MacePL1Check (AActor *ball) // //---------------------------------------------------------------------------- -void A_MaceBallImpact (AActor *ball) +DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact) { - if ((ball->health != MAGIC_JUNK) && (ball->flags & MF_INBOUNCE)) + if ((self->health != MAGIC_JUNK) && (self->flags & MF_INBOUNCE)) { // Bounce - ball->health = MAGIC_JUNK; - ball->momz = (ball->momz * 192) >> 8; - ball->flags2 &= ~MF2_BOUNCETYPE; - ball->SetState (ball->SpawnState); - S_Sound (ball, CHAN_BODY, "weapons/macebounce", 1, ATTN_NORM); + self->health = MAGIC_JUNK; + self->momz = (self->momz * 192) >> 8; + self->flags2 &= ~MF2_BOUNCETYPE; + self->SetState (self->SpawnState); + S_Sound (self, CHAN_BODY, "weapons/macebounce", 1, ATTN_NORM); } else { // Explode - ball->momx = ball->momy = ball->momz = 0; - ball->flags |= MF_NOGRAVITY; - ball->gravity = FRACUNIT; - S_Sound (ball, CHAN_BODY, "weapons/macehit", 1, ATTN_NORM); + self->momx = self->momy = self->momz = 0; + self->flags |= MF_NOGRAVITY; + self->gravity = FRACUNIT; + S_Sound (self, CHAN_BODY, "weapons/macehit", 1, ATTN_NORM); } } @@ -507,24 +507,24 @@ void A_MaceBallImpact (AActor *ball) // //---------------------------------------------------------------------------- -void A_MaceBallImpact2 (AActor *ball) +DEFINE_ACTION_FUNCTION(AActor, A_MaceBallImpact2) { AActor *tiny; angle_t angle; - if (ball->flags & MF_INBOUNCE) + if (self->flags & MF_INBOUNCE) { - fixed_t floordist = ball->z - ball->floorz; - fixed_t ceildist = ball->ceilingz - ball->z; + fixed_t floordist = self->z - self->floorz; + fixed_t ceildist = self->ceilingz - self->z; fixed_t vel; if (floordist <= ceildist) { - vel = MulScale32 (ball->momz, ball->Sector->floorplane.c); + vel = MulScale32 (self->momz, self->Sector->floorplane.c); } else { - vel = MulScale32 (ball->momz, ball->Sector->ceilingplane.c); + vel = MulScale32 (self->momz, self->Sector->ceilingplane.c); } if (vel < 2) { @@ -532,40 +532,40 @@ void A_MaceBallImpact2 (AActor *ball) } // Bounce - ball->momz = (ball->momz * 192) >> 8; - ball->SetState (ball->SpawnState); + self->momz = (self->momz * 192) >> 8; + self->SetState (self->SpawnState); - tiny = Spawn("MaceFX3", ball->x, ball->y, ball->z, ALLOW_REPLACE); - angle = ball->angle+ANG90; - tiny->target = ball->target; + tiny = Spawn("MaceFX3", self->x, self->y, self->z, ALLOW_REPLACE); + angle = self->angle+ANG90; + tiny->target = self->target; tiny->angle = angle; angle >>= ANGLETOFINESHIFT; - tiny->momx = (ball->momx>>1)+FixedMul(ball->momz-FRACUNIT, + tiny->momx = (self->momx>>1)+FixedMul(self->momz-FRACUNIT, finecosine[angle]); - tiny->momy = (ball->momy>>1)+FixedMul(ball->momz-FRACUNIT, + tiny->momy = (self->momy>>1)+FixedMul(self->momz-FRACUNIT, finesine[angle]); - tiny->momz = ball->momz; + tiny->momz = self->momz; P_CheckMissileSpawn (tiny); - tiny = Spawn("MaceFX3", ball->x, ball->y, ball->z, ALLOW_REPLACE); - angle = ball->angle-ANG90; - tiny->target = ball->target; + tiny = Spawn("MaceFX3", self->x, self->y, self->z, ALLOW_REPLACE); + angle = self->angle-ANG90; + tiny->target = self->target; tiny->angle = angle; angle >>= ANGLETOFINESHIFT; - tiny->momx = (ball->momx>>1)+FixedMul(ball->momz-FRACUNIT, + tiny->momx = (self->momx>>1)+FixedMul(self->momz-FRACUNIT, finecosine[angle]); - tiny->momy = (ball->momy>>1)+FixedMul(ball->momz-FRACUNIT, + tiny->momy = (self->momy>>1)+FixedMul(self->momz-FRACUNIT, finesine[angle]); - tiny->momz = ball->momz; + tiny->momz = self->momz; P_CheckMissileSpawn (tiny); } else { // Explode boom: - ball->momx = ball->momy = ball->momz = 0; - ball->flags |= MF_NOGRAVITY; - ball->flags2 &= ~MF2_BOUNCETYPE; - ball->gravity = FRACUNIT; + self->momx = self->momy = self->momz = 0; + self->flags |= MF_NOGRAVITY; + self->flags2 &= ~MF2_BOUNCETYPE; + self->gravity = FRACUNIT; } } @@ -575,13 +575,13 @@ boom: // //---------------------------------------------------------------------------- -void A_FireMacePL2 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireMacePL2) { AActor *mo; player_t *player; AActor *linetarget; - if (NULL == (player = actor->player)) + if (NULL == (player = self->player)) { return; } @@ -592,19 +592,19 @@ void A_FireMacePL2 (AActor *actor) if (!weapon->DepleteAmmo (weapon->bAltFire)) return; } - mo = P_SpawnPlayerMissile (actor, 0,0,0, RUNTIME_CLASS(AMaceFX4), actor->angle, &linetarget); + mo = P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AMaceFX4), self->angle, &linetarget); if (mo) { - mo->momx += actor->momx; - mo->momy += actor->momy; + mo->momx += self->momx; + mo->momy += self->momy; mo->momz = 2*FRACUNIT+ - clamp(finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)], -5*FRACUNIT, 5*FRACUNIT); + clamp(finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)], -5*FRACUNIT, 5*FRACUNIT); if (linetarget) { mo->tracer = linetarget; } } - S_Sound (actor, CHAN_WEAPON, "weapons/maceshoot", 1, ATTN_NORM); + S_Sound (self, CHAN_WEAPON, "weapons/maceshoot", 1, ATTN_NORM); } //---------------------------------------------------------------------------- @@ -613,7 +613,7 @@ void A_FireMacePL2 (AActor *actor) // //---------------------------------------------------------------------------- -void A_DeathBallImpact (AActor *ball) +DEFINE_ACTION_FUNCTION(AActor, A_DeathBallImpact) { int i; AActor *target; @@ -621,24 +621,24 @@ void A_DeathBallImpact (AActor *ball) bool newAngle; AActor *linetarget; - if ((ball->z <= ball->floorz) && P_HitFloor (ball)) + if ((self->z <= self->floorz) && P_HitFloor (self)) { // Landed in some sort of liquid - ball->Destroy (); + self->Destroy (); return; } - if (ball->flags & MF_INBOUNCE) + if (self->flags & MF_INBOUNCE) { - fixed_t floordist = ball->z - ball->floorz; - fixed_t ceildist = ball->ceilingz - ball->z; + fixed_t floordist = self->z - self->floorz; + fixed_t ceildist = self->ceilingz - self->z; fixed_t vel; if (floordist <= ceildist) { - vel = MulScale32 (ball->momz, ball->Sector->floorplane.c); + vel = MulScale32 (self->momz, self->Sector->floorplane.c); } else { - vel = MulScale32 (ball->momz, ball->Sector->ceilingplane.c); + vel = MulScale32 (self->momz, self->Sector->ceilingplane.c); } if (vel < 2) { @@ -647,16 +647,16 @@ void A_DeathBallImpact (AActor *ball) // Bounce newAngle = false; - target = ball->tracer; + target = self->tracer; if (target) { if (!(target->flags&MF_SHOOTABLE)) { // Target died - ball->tracer = NULL; + self->tracer = NULL; } else { // Seek - angle = R_PointToAngle2(ball->x, ball->y, + angle = R_PointToAngle2(self->x, self->y, target->x, target->y); newAngle = true; } @@ -666,11 +666,11 @@ void A_DeathBallImpact (AActor *ball) angle = 0; for (i = 0; i < 16; i++) { - P_AimLineAttack (ball, angle, 10*64*FRACUNIT, &linetarget); - if (linetarget && ball->target != linetarget) + P_AimLineAttack (self, angle, 10*64*FRACUNIT, &linetarget); + if (linetarget && self->target != linetarget) { - ball->tracer = linetarget; - angle = R_PointToAngle2 (ball->x, ball->y, + self->tracer = linetarget; + angle = R_PointToAngle2 (self->x, self->y, linetarget->x, linetarget->y); newAngle = true; break; @@ -680,21 +680,21 @@ void A_DeathBallImpact (AActor *ball) } if (newAngle) { - ball->angle = angle; + self->angle = angle; angle >>= ANGLETOFINESHIFT; - ball->momx = FixedMul (ball->Speed, finecosine[angle]); - ball->momy = FixedMul (ball->Speed, finesine[angle]); + self->momx = FixedMul (self->Speed, finecosine[angle]); + self->momy = FixedMul (self->Speed, finesine[angle]); } - ball->SetState (ball->SpawnState); - S_Sound (ball, CHAN_BODY, "weapons/macestop", 1, ATTN_NORM); + self->SetState (self->SpawnState); + S_Sound (self, CHAN_BODY, "weapons/macestop", 1, ATTN_NORM); } else { // Explode boom: - ball->momx = ball->momy = ball->momz = 0; - ball->flags |= MF_NOGRAVITY; - ball->gravity = FRACUNIT; - S_Sound (ball, CHAN_BODY, "weapons/maceexplode", 1, ATTN_NORM); + self->momx = self->momy = self->momz = 0; + self->flags |= MF_NOGRAVITY; + self->gravity = FRACUNIT; + S_Sound (self, CHAN_BODY, "weapons/maceexplode", 1, ATTN_NORM); } } @@ -755,32 +755,32 @@ int ARipper::DoSpecialDamage (AActor *target, int damage) // //---------------------------------------------------------------------------- -void A_FireBlasterPL1 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireBlasterPL1) { angle_t angle; 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)) return; } - angle_t pitch = P_BulletSlope(actor); + angle_t pitch = P_BulletSlope(self); damage = pr_fb1.HitDice (4); - angle = actor->angle; + angle = self->angle; if (player->refire) { angle += pr_fb1.Random2() << 18; } - P_LineAttack (actor, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, "BlasterPuff"); - S_Sound (actor, CHAN_WEAPON, "weapons/blastershoot", 1, ATTN_NORM); + P_LineAttack (self, angle, PLAYERMISSILERANGE, pitch, damage, NAME_None, "BlasterPuff"); + S_Sound (self, CHAN_WEAPON, "weapons/blastershoot", 1, ATTN_NORM); } //---------------------------------------------------------------------------- @@ -789,7 +789,7 @@ void A_FireBlasterPL1 (AActor *actor) // //---------------------------------------------------------------------------- -void A_SpawnRippers (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_SpawnRippers) { int i; angle_t angle; @@ -797,9 +797,9 @@ void A_SpawnRippers (AActor *actor) for(i = 0; i < 8; i++) { - ripper = Spawn (actor->x, actor->y, actor->z, ALLOW_REPLACE); + ripper = Spawn (self->x, self->y, self->z, ALLOW_REPLACE); angle = i*ANG45; - ripper->target = actor->target; + ripper->target = self->target; ripper->angle = angle; angle >>= ANGLETOFINESHIFT; ripper->momx = FixedMul (ripper->Speed, finecosine[angle]); @@ -947,12 +947,12 @@ void ARainTracker::Serialize (FArchive &arc) // //---------------------------------------------------------------------------- -void A_FireSkullRodPL1 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireSkullRodPL1) { AActor *mo; player_t *player; - if (NULL == (player = actor->player)) + if (NULL == (player = self->player)) { return; } @@ -963,7 +963,7 @@ void A_FireSkullRodPL1 (AActor *actor) if (!weapon->DepleteAmmo (weapon->bAltFire)) return; } - mo = P_SpawnPlayerMissile (actor, PClass::FindClass("HornRodFX1")); + mo = P_SpawnPlayerMissile (self, PClass::FindClass("HornRodFX1")); // Randomize the first frame if (mo && pr_fsr1() > 128) { @@ -980,13 +980,13 @@ void A_FireSkullRodPL1 (AActor *actor) // //---------------------------------------------------------------------------- -void A_FireSkullRodPL2 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FireSkullRodPL2) { player_t *player; AActor *MissileActor; AActor *linetarget; - if (NULL == (player = actor->player)) + if (NULL == (player = self->player)) { return; } @@ -996,7 +996,7 @@ void A_FireSkullRodPL2 (AActor *actor) if (!weapon->DepleteAmmo (weapon->bAltFire)) return; } - P_SpawnPlayerMissile (actor, 0,0,0, RUNTIME_CLASS(AHornRodFX2), actor->angle, &linetarget, &MissileActor); + P_SpawnPlayerMissile (self, 0,0,0, RUNTIME_CLASS(AHornRodFX2), self->angle, &linetarget, &MissileActor); // Use MissileActor instead of the return value from // P_SpawnPlayerMissile because we need to give info to the mobj // even if it exploded immediately. @@ -1011,33 +1011,22 @@ void A_FireSkullRodPL2 (AActor *actor) } } -//---------------------------------------------------------------------------- -// -// PROC A_SkullRodPL2Seek -// -//---------------------------------------------------------------------------- - -void A_SkullRodPL2Seek (AActor *actor) -{ - P_SeekerMissile (actor, ANGLE_1*10, ANGLE_1*30); -} - //---------------------------------------------------------------------------- // // PROC A_AddPlayerRain // //---------------------------------------------------------------------------- -void A_AddPlayerRain (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_AddPlayerRain) { ARainTracker *tracker; - if (actor->target == NULL || actor->target->health <= 0) + if (self->target == NULL || self->target->health <= 0) { // Shooter is dead or nonexistant return; } - tracker = actor->target->FindInventory (); + tracker = self->target->FindInventory (); // They player is only allowed two rainstorms at a time. Shooting more // than that will cause the oldest one to terminate. @@ -1065,18 +1054,18 @@ void A_AddPlayerRain (AActor *actor) } else { - tracker = static_cast (actor->target->GiveInventoryType (RUNTIME_CLASS(ARainTracker))); + tracker = static_cast (self->target->GiveInventoryType (RUNTIME_CLASS(ARainTracker))); } // Add rain mobj to list if (tracker->Rain1) { - tracker->Rain2 = actor; + tracker->Rain2 = self; } else { - tracker->Rain1 = actor; + tracker->Rain1 = self; } - actor->special1 = S_FindSound ("misc/rain"); + self->special1 = S_FindSound ("misc/rain"); } //---------------------------------------------------------------------------- @@ -1085,53 +1074,53 @@ void A_AddPlayerRain (AActor *actor) // //---------------------------------------------------------------------------- -void A_SkullRodStorm (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_SkullRodStorm) { fixed_t x; fixed_t y; AActor *mo; ARainTracker *tracker; - if (actor->health-- == 0) + if (self->health-- == 0) { - S_StopSound (actor, CHAN_BODY); - if (actor->target == NULL) + S_StopSound (self, CHAN_BODY); + if (self->target == NULL) { // Player left the game - actor->Destroy (); + self->Destroy (); return; } - tracker = actor->target->FindInventory (); + tracker = self->target->FindInventory (); if (tracker != NULL) { - if (tracker->Rain1 == actor) + if (tracker->Rain1 == self) { tracker->Rain1 = NULL; } - else if (tracker->Rain2 == actor) + else if (tracker->Rain2 == self) { tracker->Rain2 = NULL; } } - actor->Destroy (); + self->Destroy (); return; } if (pr_storm() < 25) { // Fudge rain frequency return; } - x = actor->x + ((pr_storm()&127) - 64) * FRACUNIT; - y = actor->y + ((pr_storm()&127) - 64) * FRACUNIT; + x = self->x + ((pr_storm()&127) - 64) * FRACUNIT; + y = self->y + ((pr_storm()&127) - 64) * FRACUNIT; mo = Spawn (x, y, ONCEILINGZ, ALLOW_REPLACE); mo->Translation = multiplayer ? - TRANSLATION(TRANSLATION_PlayersExtra,actor->special2) : 0; - mo->target = actor->target; + TRANSLATION(TRANSLATION_PlayersExtra,self->special2) : 0; + mo->target = self->target; mo->momx = 1; // Force collision detection mo->momz = -mo->Speed; - mo->special2 = actor->special2; // Transfer player number + mo->special2 = self->special2; // Transfer player number P_CheckMissileSpawn (mo); - if (actor->special1 != -1 && !S_IsActorPlayingSomething (actor, CHAN_BODY, -1)) + if (self->special1 != -1 && !S_IsActorPlayingSomething (self, CHAN_BODY, -1)) { - S_Sound (actor, CHAN_BODY|CHAN_LOOP, actor->special1, 1, ATTN_NORM); + S_Sound (self, CHAN_BODY|CHAN_LOOP, self->special1, 1, ATTN_NORM); } } @@ -1141,15 +1130,15 @@ void A_SkullRodStorm (AActor *actor) // //---------------------------------------------------------------------------- -void A_RainImpact (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_RainImpact) { - if (actor->z > actor->floorz) + if (self->z > self->floorz) { - actor->SetState (actor->FindState("NotFloor")); + self->SetState (self->FindState("NotFloor")); } else if (pr_impact() < 40) { - P_HitFloor (actor); + P_HitFloor (self); } } @@ -1159,9 +1148,9 @@ void A_RainImpact (AActor *actor) // //---------------------------------------------------------------------------- -void A_HideInCeiling (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_HideInCeiling) { - actor->z = actor->ceilingz + 4*FRACUNIT; + self->z = self->ceilingz + 4*FRACUNIT; } // --- Phoenix Rod ---------------------------------------------------------- @@ -1243,27 +1232,27 @@ int APhoenixFX2::DoSpecialDamage (AActor *target, int damage) // //---------------------------------------------------------------------------- -void A_FirePhoenixPL1 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL1) { angle_t angle; 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(APhoenixFX1)); - angle = actor->angle + ANG180; + P_SpawnPlayerMissile (self, RUNTIME_CLASS(APhoenixFX1)); + angle = self->angle + ANG180; angle >>= ANGLETOFINESHIFT; - actor->momx += FixedMul (4*FRACUNIT, finecosine[angle]); - actor->momy += FixedMul (4*FRACUNIT, finesine[angle]); + self->momx += FixedMul (4*FRACUNIT, finecosine[angle]); + self->momy += FixedMul (4*FRACUNIT, finesine[angle]); } //---------------------------------------------------------------------------- @@ -1272,21 +1261,21 @@ void A_FirePhoenixPL1 (AActor *actor) // //---------------------------------------------------------------------------- -void A_PhoenixPuff (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_PhoenixPuff) { AActor *puff; angle_t angle; //[RH] Heretic never sets the target for seeking - //P_SeekerMissile (actor, ANGLE_1*5, ANGLE_1*10); - puff = Spawn("PhoenixPuff", actor->x, actor->y, actor->z, ALLOW_REPLACE); - angle = actor->angle + ANG90; + //P_SeekerMissile (self, ANGLE_1*5, ANGLE_1*10); + puff = Spawn("PhoenixPuff", self->x, self->y, self->z, ALLOW_REPLACE); + angle = self->angle + ANG90; angle >>= ANGLETOFINESHIFT; puff->momx = FixedMul (FRACUNIT*13/10, finecosine[angle]); puff->momy = FixedMul (FRACUNIT*13/10, finesine[angle]); puff->momz = 0; - puff = Spawn("PhoenixPuff", actor->x, actor->y, actor->z, ALLOW_REPLACE); - angle = actor->angle - ANG90; + puff = Spawn("PhoenixPuff", self->x, self->y, self->z, ALLOW_REPLACE); + angle = self->angle - ANG90; angle >>= ANGLETOFINESHIFT; puff->momx = FixedMul (FRACUNIT*13/10, finecosine[angle]); puff->momy = FixedMul (FRACUNIT*13/10, finesine[angle]); @@ -1299,11 +1288,11 @@ void A_PhoenixPuff (AActor *actor) // //---------------------------------------------------------------------------- -void A_InitPhoenixPL2 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_InitPhoenixPL2) { - if (actor->player != NULL) + if (self->player != NULL) { - APhoenixRod *flamethrower = static_cast (actor->player->ReadyWeapon); + APhoenixRod *flamethrower = static_cast (self->player->ReadyWeapon); if (flamethrower != NULL) { flamethrower->FlameCount = FLAME_THROWER_TICS; @@ -1319,7 +1308,7 @@ void A_InitPhoenixPL2 (AActor *actor) // //---------------------------------------------------------------------------- -void A_FirePhoenixPL2 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FirePhoenixPL2) { AActor *mo; angle_t angle; @@ -1329,7 +1318,7 @@ void A_FirePhoenixPL2 (AActor *actor) player_t *player; APhoenixRod *flamethrower; - if (NULL == (player = actor->player)) + if (NULL == (player = self->player)) { return; } @@ -1341,24 +1330,24 @@ void A_FirePhoenixPL2 (AActor *actor) { // Out of flame P_SetPsprite (player, ps_weapon, flamethrower->FindState("Powerdown")); player->refire = 0; - S_StopSound (actor, CHAN_WEAPON); + S_StopSound (self, CHAN_WEAPON); return; } - angle = actor->angle; - x = actor->x + (pr_fp2.Random2() << 9); - y = actor->y + (pr_fp2.Random2() << 9); - z = actor->z + 26*FRACUNIT + finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)]; - z -= actor->floorclip; - slope = finetangent[FINEANGLES/4-(actor->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10); + angle = self->angle; + x = self->x + (pr_fp2.Random2() << 9); + y = self->y + (pr_fp2.Random2() << 9); + z = self->z + 26*FRACUNIT + finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)]; + z -= self->floorclip; + slope = finetangent[FINEANGLES/4-(self->pitch>>ANGLETOFINESHIFT)] + (FRACUNIT/10); mo = Spawn("PhoenixFX2", x, y, z, ALLOW_REPLACE); - mo->target = actor; + mo->target = self; mo->angle = angle; - mo->momx = actor->momx + FixedMul (mo->Speed, finecosine[angle>>ANGLETOFINESHIFT]); - mo->momy = actor->momy + FixedMul (mo->Speed, finesine[angle>>ANGLETOFINESHIFT]); + mo->momx = self->momx + FixedMul (mo->Speed, finecosine[angle>>ANGLETOFINESHIFT]); + mo->momy = self->momy + FixedMul (mo->Speed, finesine[angle>>ANGLETOFINESHIFT]); mo->momz = FixedMul (mo->Speed, slope); - if (!player->refire || !S_IsActorPlayingSomething (actor, CHAN_WEAPON, -1)) + if (!player->refire || !S_IsActorPlayingSomething (self, CHAN_WEAPON, -1)) { - S_Sound (actor, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM); + S_Sound (self, CHAN_WEAPON|CHAN_LOOP, soundid, 1, ATTN_NORM); } P_CheckMissileSpawn (mo); } @@ -1369,15 +1358,15 @@ void A_FirePhoenixPL2 (AActor *actor) // //---------------------------------------------------------------------------- -void A_ShutdownPhoenixPL2 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_ShutdownPhoenixPL2) { player_t *player; - if (NULL == (player = actor->player)) + if (NULL == (player = self->player)) { return; } - S_StopSound (actor, CHAN_WEAPON); + S_StopSound (self, CHAN_WEAPON); AWeapon *weapon = player->ReadyWeapon; if (weapon != NULL) { @@ -1392,9 +1381,9 @@ void A_ShutdownPhoenixPL2 (AActor *actor) // //---------------------------------------------------------------------------- -void A_FlameEnd (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FlameEnd) { - actor->momz += FRACUNIT*3/2; + self->momz += FRACUNIT*3/2; } //---------------------------------------------------------------------------- @@ -1403,8 +1392,8 @@ void A_FlameEnd (AActor *actor) // //---------------------------------------------------------------------------- -void A_FloatPuff (AActor *puff) +DEFINE_ACTION_FUNCTION(AActor, A_FloatPuff) { - puff->momz += FRACUNIT*18/10; + self->momz += FRACUNIT*18/10; } diff --git a/src/g_heretic/a_ironlich.cpp b/src/g_heretic/a_ironlich.cpp index f6523d97e..ac0285090 100644 --- a/src/g_heretic/a_ironlich.cpp +++ b/src/g_heretic/a_ironlich.cpp @@ -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")); } } diff --git a/src/g_heretic/a_knight.cpp b/src/g_heretic/a_knight.cpp index c84da946f..41e95dd70 100644 --- a/src/g_heretic/a_knight.cpp +++ b/src/g_heretic/a_knight.cpp @@ -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")); } diff --git a/src/g_heretic/a_wizard.cpp b/src/g_heretic/a_wizard.cpp index 431fb99bb..7557b6658 100644 --- a/src/g_heretic/a_wizard.cpp +++ b/src/g_heretic/a_wizard.cpp @@ -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); + 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) + 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); } } diff --git a/src/g_hexen/a_bats.cpp b/src/g_hexen/a_bats.cpp index 3c0a9b5d9..ebb653227 100644 --- a/src/g_hexen/a_bats.cpp +++ b/src/g_hexen/a_bats.cpp @@ -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; } diff --git a/src/g_hexen/a_bishop.cpp b/src/g_hexen/a_bishop.cpp index 56c35dc64..73b158730 100644 --- a/src/g_hexen/a_bishop.cpp +++ b/src/g_hexen/a_bishop.cpp @@ -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; } } diff --git a/src/g_hexen/a_centaur.cpp b/src/g_hexen/a_centaur.cpp index 18f3311f9..6c6f870cf 100644 --- a/src/g_hexen/a_centaur.cpp +++ b/src/g_hexen/a_centaur.cpp @@ -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); + A_UnSetReflectiveInvulnerable (self); + self->SetState (self->MeleeState); } } diff --git a/src/g_hexen/a_clericflame.cpp b/src/g_hexen/a_clericflame.cpp index b328a3514..0fbf268e1 100644 --- a/src/g_hexen/a_clericflame.cpp +++ b/src/g_hexen/a_clericflame.cpp @@ -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); + A_UnHideThing (self); + 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; + A_UnHideThing (self); + 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<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<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; } diff --git a/src/g_hexen/a_clericholy.cpp b/src/g_hexen/a_clericholy.cpp index 1a0c185b7..ed952d392 100644 --- a/src/g_hexen/a_clericholy.cpp +++ b/src/g_hexen/a_clericholy.cpp @@ -7,6 +7,7 @@ #include "a_hexenglobal.h" #include "gstrings.h" #include "a_weaponpiece.h" +#include "thingdef/thingdef.h" #define BLAST_FULLSTRENGTH 255 @@ -180,20 +181,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 +188,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 +196,7 @@ void A_CHolyAttack2 (AActor *actor) for (j = 0; j < 4; j++) { - mo = Spawn (actor->x, actor->y, actor->z, ALLOW_REPLACE); + mo = Spawn (self->x, self->y, self->z, ALLOW_REPLACE); if (!mo) { continue; @@ -230,19 +217,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 +265,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 (actor->player->ReadyWeapon); + ACWeapWraithverge *weapon = static_cast (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 +293,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 (actor->player->ReadyWeapon); + ACWeapWraithverge *weapon = static_cast (self->player->ReadyWeapon); if (weapon != NULL && weapon->CHolyCount != 0) { weapon->CHolyCount--; @@ -389,26 +376,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 +533,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 +563,16 @@ void A_CHolySeek (AActor *actor) // //============================================================================ -void A_CHolyCheckScream (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_CHolyCheckScream) { - A_CHolySeek (actor); + 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 +583,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); } + diff --git a/src/g_hexen/a_clericmace.cpp b/src/g_hexen/a_clericmace.cpp index 2db97ca21..cfdf58829 100644 --- a/src/g_hexen/a_clericmace.cpp +++ b/src/g_hexen/a_clericmace.cpp @@ -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; } diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index 9dcaa0c61..41bf2a66c 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -10,6 +10,7 @@ #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"); @@ -48,7 +49,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 +60,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 +120,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 +155,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 +178,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 +189,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); + A_WeaponReady (self); } } diff --git a/src/g_hexen/a_dragon.cpp b/src/g_hexen/a_dragon.cpp index a81464fe6..a3306f638 100644 --- a/src/g_hexen/a_dragon.cpp +++ b/src/g_hexen/a_dragon.cpp @@ -5,6 +5,8 @@ #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"); @@ -165,20 +167,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 +189,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 +228,16 @@ void A_DragonFlight (AActor *actor) // //============================================================================ -void A_DragonFlap (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_DragonFlap) { - A_DragonFlight (actor); + 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 +247,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 +258,7 @@ void A_DragonAttack (AActor *actor) // //============================================================================ -void A_DragonFX2 (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_DragonFX2) { AActor *mo; int i; @@ -265,15 +267,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 +286,12 @@ void A_DragonFX2 (AActor *actor) // //============================================================================ -void A_DragonPain (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_DragonPain) { - A_Pain (actor); - if (!actor->tracer) + A_Pain (self); + if (!self->tracer) { // no destination spot yet - actor->SetState (actor->SeeState); + self->SetState (self->SeeState); } } @@ -299,10 +301,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")); } } diff --git a/src/g_hexen/a_fighteraxe.cpp b/src/g_hexen/a_fighteraxe.cpp index 5512c53d0..a25ace4ad 100644 --- a/src/g_hexen/a_fighteraxe.cpp +++ b/src/g_hexen/a_fighteraxe.cpp @@ -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); + 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); + 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); + 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); + 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; } diff --git a/src/g_hexen/a_fighterhammer.cpp b/src/g_hexen/a_fighterhammer.cpp index 367e204c0..649b5961b 100644 --- a/src/g_hexen/a_fighterhammer.cpp +++ b/src/g_hexen/a_fighterhammer.cpp @@ -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; } diff --git a/src/g_hexen/a_fighterplayer.cpp b/src/g_hexen/a_fighterplayer.cpp index 78a9abbdb..18f1843bd 100644 --- a/src/g_hexen/a_fighterplayer.cpp +++ b/src/g_hexen/a_fighterplayer.cpp @@ -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; } diff --git a/src/g_hexen/a_fighterquietus.cpp b/src/g_hexen/a_fighterquietus.cpp index 6eab3d13b..57aa1acd6 100644 --- a/src/g_hexen/a_fighterquietus.cpp +++ b/src/g_hexen/a_fighterquietus.cpp @@ -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); } diff --git a/src/g_hexen/a_firedemon.cpp b/src/g_hexen/a_firedemon.cpp index 87310f368..fa5b04a0d 100644 --- a/src/g_hexen/a_firedemon.cpp +++ b/src/g_hexen/a_firedemon.cpp @@ -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 @@ -33,13 +34,13 @@ void A_FiredSplotch (AActor *); // //============================================================================ -void A_FiredRocks (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FiredRocks) { - A_FiredSpawnRock (actor); - A_FiredSpawnRock (actor); - A_FiredSpawnRock (actor); - A_FiredSpawnRock (actor); - A_FiredSpawnRock (actor); + A_FiredSpawnRock (self); + A_FiredSpawnRock (self); + A_FiredSpawnRock (self); + A_FiredSpawnRock (self); + A_FiredSpawnRock (self); } //============================================================================ @@ -98,13 +99,13 @@ void A_FiredSpawnRock (AActor *actor) // //============================================================================ -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<momy = pr_smbounce()%3<z = self->floorz + FRACUNIT; + self->momz = (2*FRACUNIT) + (pr_smbounce() << 10); + self->momx = pr_smbounce()%3<momy = pr_smbounce()%3<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 +128,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 +220,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; diff --git a/src/g_hexen/a_flechette.cpp b/src/g_hexen/a_flechette.cpp index 55e7ec382..e2811c061 100644 --- a/src/g_hexen/a_flechette.cpp +++ b/src/g_hexen/a_flechette.cpp @@ -10,6 +10,7 @@ #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"); @@ -296,14 +297,14 @@ int APoisonCloud::DoSpecialDamage (AActor *victim, int damage) // //=========================================================================== -void A_PoisonBagInit (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_PoisonBagInit) { AActor *mo; - mo = Spawn (actor->x, actor->y, actor->z+28*FRACUNIT, ALLOW_REPLACE); + mo = Spawn (self->x, self->y, self->z+28*FRACUNIT, ALLOW_REPLACE); if (mo) { - mo->target = actor->target; + mo->target = self->target; } } @@ -313,11 +314,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 +332,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 +348,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 +362,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); + A_CheckThrowBomb (self); } diff --git a/src/g_hexen/a_fog.cpp b/src/g_hexen/a_fog.cpp index 8369273dd..5770a892d 100644 --- a/src/g_hexen/a_fog.cpp +++ b/src/g_hexen/a_fog.cpp @@ -1,5 +1,6 @@ #include "m_random.h" #include "p_local.h" +#include "thingdef/thingdef.h" static FRandom pr_fogspawn ("FogSpawn"); @@ -22,7 +23,7 @@ static FRandom pr_fogspawn ("FogSpawn"); // //========================================================================== -void A_FogSpawn (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FogSpawn) { static const PClass *fogs[3] = { @@ -34,21 +35,21 @@ void A_FogSpawn (AActor *actor) 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]<args[0]<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]); } diff --git a/src/g_hexen/a_heresiarch.cpp b/src/g_hexen/a_heresiarch.cpp index 27ed9c370..46961149f 100644 --- a/src/g_hexen/a_heresiarch.cpp +++ b/src/g_hexen/a_heresiarch.cpp @@ -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(ball->target); - int dist = parent->radius - (ball->radius<<1); - angle_t prevangle = ball->special1; + int mode = self->target->args[3]; + AHeresiarch *parent = barrier_cast(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 (ball); + actor = static_cast (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 } @@ -394,14 +395,14 @@ void A_SpeedBalls(AActor *actor) // // A_SlowBalls // -// Set balls to slow mode - actor is sorcerer +// Set balls to slow mode - self is sorcerer // //============================================================================ -void A_SlowBalls(AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_SlowBalls) { - actor->args[3] = SORC_DECELERATE; // slow mode - actor->args[2] = SORCBALL_INITIAL_SPEED; // target speed + self->args[3] = SORC_DECELERATE; // slow mode + self->args[2] = SORCBALL_INITIAL_SPEED; // target speed } //============================================================================ @@ -409,13 +410,13 @@ void A_SlowBalls(AActor *actor) // A_StopBalls // // Instant stop when rotation gets to ball in special2 -// actor is sorcerer +// self is sorcerer // //============================================================================ -void A_StopBalls(AActor *scary) +DEFINE_ACTION_FUNCTION(AActor, A_StopBalls) { - AHeresiarch *actor = static_cast (scary); + AHeresiarch *actor = static_cast (self); int chance = pr_heresiarch(); actor->args[3] = SORC_STOPPING; // stopping mode actor->args[1] = 0; // Reset rotation counter @@ -439,13 +440,13 @@ void A_StopBalls(AActor *scary) // // A_AccelBalls // -// Increase ball orbit speed - actor is ball +// Increase ball orbit speed - self is ball // //============================================================================ -void A_AccelBalls(AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_AccelBalls) { - AActor *sorc = actor->target; + AActor *sorc = self->target; if (sorc->args[4] < sorc->args[2]) { @@ -466,13 +467,13 @@ void A_AccelBalls(AActor *actor) // // A_DecelBalls // -// Decrease ball orbit speed - actor is ball +// Decrease ball orbit speed - self is ball // //============================================================================ -void A_DecelBalls(AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_DecelBalls) { - AActor *sorc = actor->target; + AActor *sorc = self->target; if (sorc->args[4] > sorc->args[2]) { @@ -639,12 +640,12 @@ void ASorcBall1::CastSorcererSpell () // //============================================================================ -void A_SorcOffense2(AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_SorcOffense2) { angle_t ang1; AActor *mo; int delta, index; - AActor *parent = actor->target; + AActor *parent = self->target; AActor *dest = parent->target; int dist; @@ -654,11 +655,11 @@ void A_SorcOffense2(AActor *actor) return; } - index = actor->args[4] << 5; - actor->args[4] += 15; + index = self->args[4] << 5; + self->args[4] += 15; delta = (finesine[index])*SORCFX4_SPREAD_ANGLE; delta = (delta>>FRACBITS)*ANGLE_1; - ang1 = actor->angle + delta; + ang1 = self->angle + delta; mo = P_SpawnMissileAngle(parent, PClass::FindClass("SorcFX4"), ang1, 0); if (mo) { @@ -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"); } diff --git a/src/g_hexen/a_hexenspecialdecs.cpp b/src/g_hexen/a_hexenspecialdecs.cpp index 6a745710f..57f5639cf 100644 --- a/src/g_hexen/a_hexenspecialdecs.cpp +++ b/src/g_hexen/a_hexenspecialdecs.cpp @@ -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; } diff --git a/src/g_hexen/a_iceguy.cpp b/src/g_hexen/a_iceguy.cpp index 552940b20..78f8e1cfc 100644 --- a/src/g_hexen/a_iceguy.cpp +++ b/src/g_hexen/a_iceguy.cpp @@ -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); + 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; + 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; } } } diff --git a/src/g_hexen/a_korax.cpp b/src/g_hexen/a_korax.cpp index cb8aeee10..3d6a51760 100644 --- a/src/g_hexen/a_korax.cpp +++ b/src/g_hexen/a_korax.cpp @@ -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); + 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; diff --git a/src/g_hexen/a_magecone.cpp b/src/g_hexen/a_magecone.cpp index 76d128999..36caa65d9 100644 --- a/src/g_hexen/a_magecone.cpp +++ b/src/g_hexen/a_magecone.cpp @@ -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)<target); + mo = P_SpawnMissileAngleZSpeed (self, self->z, RUNTIME_CLASS(AFrostMissile), self->angle+(ANG45/9), + 0, (20+2*spermcount)<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)<target); + mo = P_SpawnMissileAngleZSpeed (self, self->z, RUNTIME_CLASS(AFrostMissile), self->angle-(ANG45/9), + 0, (20+2*spermcount)<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)<target); + mo = P_SpawnMissileAngleZSpeed (self, self->z+8*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->angle, + 0, (15+2*spermcount)<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)<target); + mo = P_SpawnMissileAngleZSpeed (self, self->z-4*FRACUNIT, RUNTIME_CLASS(AFrostMissile), self->angle, + 0, (15+2*spermcount)<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; } } diff --git a/src/g_hexen/a_magelightning.cpp b/src/g_hexen/a_magelightning.cpp index e2ea25e93..5c9142319 100644 --- a/src/g_hexen/a_magelightning.cpp +++ b/src/g_hexen/a_magelightning.cpp @@ -10,6 +10,7 @@ #include "p_pspr.h" #include "gstrings.h" #include "a_hexenglobal.h" +#include "thingdef/thingdef.h" #define ZAGSPEED FRACUNIT @@ -26,7 +27,6 @@ void A_LightningClip (AActor *); void A_LightningZap (AActor *); void A_ZapMimic (AActor *); void A_LastZap (AActor *); -void A_LightningRemove (AActor *); // Lightning ---------------------------------------------------------------- @@ -127,12 +127,12 @@ int ALightningZap::SpecialMissileHit (AActor *thing) // //============================================================================ -void A_LightningReady (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_LightningReady) { - A_WeaponReady (actor); + 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 +142,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 +208,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); + 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 +229,16 @@ void A_LightningZap (AActor *actor) { deltaZ = -10*FRACUNIT; } - mo = Spawn (actor->x+((pr_zap()-128)*actor->radius/256), - actor->y+((pr_zap()-128)*actor->radius/256), - actor->z+deltaZ, ALLOW_REPLACE); + mo = Spawn (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 +247,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,12 +259,12 @@ 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; @@ -277,7 +277,7 @@ void A_MLightningAttack2 (AActor *actor) cmo->lastenemy = fmo; A_LightningZap (cmo); } - S_Sound (actor, CHAN_BODY, "MageLightningFire", 1, ATTN_NORM); + S_Sound (self, CHAN_BODY, "MageLightningFire", 1, ATTN_NORM); } //============================================================================ @@ -286,12 +286,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 +305,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,11 +330,11 @@ void A_ZapMimic (AActor *actor) // //============================================================================ -void A_LastZap (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_LastZap) { AActor *mo; - mo = Spawn (actor->x, actor->y, actor->z, ALLOW_REPLACE); + mo = Spawn (self->x, self->y, self->z, ALLOW_REPLACE); if (mo) { mo->SetState (mo->FindState ("Death")); @@ -349,11 +349,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; diff --git a/src/g_hexen/a_magestaff.cpp b/src/g_hexen/a_magestaff.cpp index 2c7ae563f..e3bfa356f 100644 --- a/src/g_hexen/a_magestaff.cpp +++ b/src/g_hexen/a_magestaff.cpp @@ -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 (actor->player->ReadyWeapon); + AMWeapBloodscourge *weapon = static_cast (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 (actor->player->ReadyWeapon); + AMWeapBloodscourge *weapon = static_cast (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); } diff --git a/src/g_hexen/a_magewand.cpp b/src/g_hexen/a_magewand.cpp index 468064a1c..82f7a0168 100644 --- a/src/g_hexen/a_magewand.cpp +++ b/src/g_hexen/a_magewand.cpp @@ -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); } diff --git a/src/g_hexen/a_pig.cpp b/src/g_hexen/a_pig.cpp index 9b5e9921a..805bf06c1 100644 --- a/src/g_hexen/a_pig.cpp +++ b/src/g_hexen/a_pig.cpp @@ -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"); @@ -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) + A_Pain (self); + if (self->z <= self->floorz) { - actor->momz = FRACUNIT*7/2; + self->momz = FRACUNIT*7/2; } } diff --git a/src/g_hexen/a_serpent.cpp b/src/g_hexen/a_serpent.cpp index 067573a2d..49ee20790 100644 --- a/src/g_hexen/a_serpent.cpp +++ b/src/g_hexen/a_serpent.cpp @@ -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); + 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)); } } } diff --git a/src/g_hexen/a_spike.cpp b/src/g_hexen/a_spike.cpp index 5c9bd042a..f8524be89 100644 --- a/src/g_hexen/a_spike.cpp +++ b/src/g_hexen/a_spike.cpp @@ -6,17 +6,12 @@ #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. @@ -76,30 +71,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(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(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(self); @@ -125,25 +120,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 +146,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 } } diff --git a/src/g_hexen/a_summon.cpp b/src/g_hexen/a_summon.cpp index bb289fefb..b7fcac6bf 100644 --- a/src/g_hexen/a_summon.cpp +++ b/src/g_hexen/a_summon.cpp @@ -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 (actor->x, actor->y, actor->z, ALLOW_REPLACE); + mo = Spawn (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 (actor->x, actor->y, actor->z, ALLOW_REPLACE); + AActor *arti = Spawn (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 (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); } } diff --git a/src/g_hexen/a_teleportother.cpp b/src/g_hexen/a_teleportother.cpp index 3bb12815e..6af109eea 100644 --- a/src/g_hexen/a_teleportother.cpp +++ b/src/g_hexen/a_teleportother.cpp @@ -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)); } } diff --git a/src/g_hexen/a_wraith.cpp b/src/g_hexen/a_wraith.cpp index cad794fdf..976f27ccb 100644 --- a/src/g_hexen/a_wraith.cpp +++ b/src/g_hexen/a_wraith.cpp @@ -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<z += 48<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); } diff --git a/src/g_raven/a_minotaur.cpp b/src/g_raven/a_minotaur.cpp index 3561584f8..3dca77792 100644 --- a/src/g_raven/a_minotaur.cpp +++ b/src/g_raven/a_minotaur.cpp @@ -8,6 +8,7 @@ #include "a_action.h" #include "gi.h" #include "w_wad.h" +#include "thingdef/thingdef.h" #define MAULATORTICS (25*35) @@ -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 ("Hammer")); + 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 (actor); + AMinotaurFriend *self1 = static_cast (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 + 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); + 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; - break; // Found actor to attack + self->target = mo; + break; // Found self 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 (actor); + AMinotaurFriend *self1 = static_cast (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 + 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 (); } } diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index 11bf433d9..da99df752 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -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) +{ + 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); + 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 (4, (actor->radius>>FRACBITS)*(actor->height>>FRACBITS)/32); + // An self with radius 20 and height 64 creates ~40 chunks. + numChunks = MAX (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; + 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(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); + A_BossDeath (self); } - A_NoBlocking (actor); + 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 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; } //=========================================================================== diff --git a/src/g_shared/a_bridge.cpp b/src/g_shared/a_bridge.cpp index cad4262ba..6f741f086 100644 --- a/src/g_shared/a_bridge.cpp +++ b/src/g_shared/a_bridge.cpp @@ -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; diff --git a/src/g_shared/a_pickups.cpp b/src/g_shared/a_pickups.cpp index dcf8f3838..14c7933c1 100644 --- a/src/g_shared/a_pickups.cpp +++ b/src/g_shared/a_pickups.cpp @@ -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(thing)->DoRespawn ()) + self->renderflags &= ~RF_INVISIBLE; + if (static_cast(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; diff --git a/src/g_shared/a_specialspot.cpp b/src/g_shared/a_specialspot.cpp index 65d08059f..13d70a0fe 100644 --- a/src/g_shared/a_specialspot.cpp +++ b/src/g_shared/a_specialspot.cpp @@ -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(); diff --git a/src/g_strife/a_acolyte.cpp b/src/g_strife/a_acolyte.cpp index fc3235311..224467f1f 100644 --- a/src/g_strife/a_acolyte.cpp +++ b/src/g_strife/a_acolyte.cpp @@ -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,7 +94,7 @@ void A_BeShadowyFoe (AActor *self) // //============================================================================ -void A_AcolyteBits (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_AcolyteBits) { if (self->SpawnFlags & MTF_SHADOW) { diff --git a/src/g_strife/a_alienspectres.cpp b/src/g_strife/a_alienspectres.cpp index 6a384f1c9..24deecbad 100644 --- a/src/g_strife/a_alienspectres.cpp +++ b/src/g_strife/a_alienspectres.cpp @@ -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,7 +75,7 @@ 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]; diff --git a/src/g_strife/a_crusader.cpp b/src/g_strife/a_crusader.cpp index 0de04b76a..bcab75493 100644 --- a/src/g_strife/a_crusader.cpp +++ b/src/g_strife/a_crusader.cpp @@ -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)) { diff --git a/src/g_strife/a_entityboss.cpp b/src/g_strife/a_entityboss.cpp index 4ae23cc7d..4e081eec0 100644 --- a/src/g_strife/a_entityboss.cpp +++ b/src/g_strife/a_entityboss.cpp @@ -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)) { @@ -35,7 +36,7 @@ void A_SpotLightning (AActor *); void A_Spectre3Attack (AActor *); -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. @@ -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; diff --git a/src/g_strife/a_inquisitor.cpp b/src/g_strife/a_inquisitor.cpp index ceff7abb8..c2beb7fcb 100644 --- a/src/g_strife/a_inquisitor.cpp +++ b/src/g_strife/a_inquisitor.cpp @@ -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); diff --git a/src/g_strife/a_loremaster.cpp b/src/g_strife/a_loremaster.cpp index d113baf4c..731a75dc0 100644 --- a/src/g_strife/a_loremaster.cpp +++ b/src/g_strife/a_loremaster.cpp @@ -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); diff --git a/src/g_strife/a_oracle.cpp b/src/g_strife/a_oracle.cpp index a17a06dd6..50cf78f8e 100644 --- a/src/g_strife/a_oracle.cpp +++ b/src/g_strife/a_oracle.cpp @@ -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 it(NAME_AlienSpectre3); AActor *spectre = it.Next(); diff --git a/src/g_strife/a_programmer.cpp b/src/g_strife/a_programmer.cpp index ea6dd7543..70c2d6411 100644 --- a/src/g_strife/a_programmer.cpp +++ b/src/g_strife/a_programmer.cpp @@ -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; diff --git a/src/g_strife/a_reaver.cpp b/src/g_strife/a_reaver.cpp index ddd2281a1..08042c653 100644 --- a/src/g_strife/a_reaver.cpp +++ b/src/g_strife/a_reaver.cpp @@ -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) { diff --git a/src/g_strife/a_rebels.cpp b/src/g_strife/a_rebels.cpp index 8d709166d..102f29a21 100644 --- a/src/g_strife/a_rebels.cpp +++ b/src/g_strife/a_rebels.cpp @@ -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; diff --git a/src/g_strife/a_sentinel.cpp b/src/g_strife/a_sentinel.cpp index d50883194..c957ac2c2 100644 --- a/src/g_strife/a_sentinel.cpp +++ b/src/g_strife/a_sentinel.cpp @@ -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); diff --git a/src/g_strife/a_spectral.cpp b/src/g_strife/a_spectral.cpp index 157dc1214..92c96b18c 100644 --- a/src/g_strife/a_spectral.cpp +++ b/src/g_strife/a_spectral.cpp @@ -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; diff --git a/src/g_strife/a_stalker.cpp b/src/g_strife/a_stalker.cpp index 43cf61392..f49bf42cd 100644 --- a/src/g_strife/a_stalker.cpp +++ b/src/g_strife/a_stalker.cpp @@ -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); diff --git a/src/g_strife/a_strifeitems.cpp b/src/g_strife/a_strifeitems.cpp index 725e924b8..f325bc5b2 100644 --- a/src/g_strife/a_strifeitems.cpp +++ b/src/g_strife/a_strifeitems.cpp @@ -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; diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index ccc5bf970..cc4b599f3 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -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) @@ -407,14 +408,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 +424,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 +440,7 @@ void A_GetHurt (AActor *self) // Klaxon Warning Light ----------------------------------------------------- -void A_TurretLook (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_TurretLook) { AActor *target; @@ -465,7 +466,7 @@ void A_TurretLook (AActor *self) } } -void A_KlaxonBlare (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_KlaxonBlare) { if (--self->reactiontime < 0) { @@ -551,7 +552,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 +574,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 +582,7 @@ void A_FLoopActiveSound (AActor *self) } } -void A_Countdown (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_Countdown) { if (--self->reactiontime <= 0) { @@ -590,7 +591,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 +599,7 @@ void A_LoopActiveSound (AActor *self) } } -void A_CheckTerrain (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_CheckTerrain) { sector_t *sec = self->Sector; @@ -626,7 +627,7 @@ void A_CheckTerrain (AActor *self) // //============================================================================ -void A_ClearSoundTarget (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_ClearSoundTarget) { AActor *actor; @@ -638,7 +639,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 +653,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 +671,7 @@ void A_CrispyPlayer (AActor *self) } } -void A_HandLower (AActor *self) +DEFINE_ACTION_FUNCTION(AActor, A_HandLower) { if (self->player != NULL) { diff --git a/src/g_strife/a_strifeweapons.cpp b/src/g_strife/a_strifeweapons.cpp index f06450b9e..02e0b0b30 100644 --- a/src/g_strife/a_strifeweapons.cpp +++ b/src/g_strife/a_strifeweapons.cpp @@ -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()) + if (self->FindInventory()) { 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(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")); } //============================================================================ diff --git a/src/g_strife/a_templar.cpp b/src/g_strife/a_templar.cpp index 66e429b9e..79ea9960b 100644 --- a/src/g_strife/a_templar.cpp +++ b/src/g_strife/a_templar.cpp @@ -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; diff --git a/src/g_strife/a_thingstoblowup.cpp b/src/g_strife/a_thingstoblowup.cpp index 21b70ac6c..335ee861a 100644 --- a/src/g_strife/a_thingstoblowup.cpp +++ b/src/g_strife/a_thingstoblowup.cpp @@ -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; diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 77012d571..8cf21b310 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -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); + 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; @@ -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); @@ -2280,24 +2280,24 @@ void A_ExtChase(AActor * self) // A_FaceTarget // //============================================================================= -void A_FaceTarget (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_FaceTarget) { - 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; } } @@ -2309,76 +2309,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 +2493,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 +2530,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 +2553,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 +2561,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<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 +2619,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 +2656,7 @@ void A_BossDeath (AActor *actor) else return; - if (!CheckBossDeath (actor)) + if (!CheckBossDeath (self)) { return; } @@ -2802,14 +2772,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 } } } diff --git a/src/p_enemy_a_lookex.cpp b/src/p_enemy_a_lookex.cpp index ea5936c71..379ca76fc 100644 --- a/src/p_enemy_a_lookex.cpp +++ b/src/p_enemy_a_lookex.cpp @@ -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); + 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); } } } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 5012fa5bd..68c9a9b7c 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2288,10 +2288,6 @@ angle_t AActor::AngleIncrements () return ANGLE_45; } -void AActor::GetExplodeParms (int &damage, int &dist, bool &hurtSource) -{ -} - //========================================================================== // // AActor :: GetMissileDamage @@ -3057,18 +3053,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 diff --git a/src/p_pspr.cpp b/src/p_pspr.cpp index 284db1055..0b7057d17 100644 --- a/src/p_pspr.cpp +++ b/src/p_pspr.cpp @@ -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(actor)->PlayIdle (); + static_cast(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(EvalExpressionI (StateParameters[index], actor), 0, 20); + self->player->extralight = clamp(EvalExpressionI (StateParameters[index], self), 0, 20); } } diff --git a/src/p_user.cpp b/src/p_user.cpp index 40753af71..d8373df96 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -1171,7 +1171,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; @@ -1237,7 +1237,7 @@ void A_PlayerScream (AActor *self) // //---------------------------------------------------------------------------- -void A_SkullPop (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_SkullPop) { APlayerPawn *mo; player_t *player; @@ -1253,23 +1253,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; } @@ -1283,11 +1283,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 (); } } diff --git a/src/thingdef/olddecorations.cpp b/src/thingdef/olddecorations.cpp index 4c52e8b58..0cf2dbb81 100644 --- a/src/thingdef/olddecorations.cpp +++ b/src/thingdef/olddecorations.cpp @@ -367,7 +367,7 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def) { if (extra.bExplosive) { - info->OwnedStates[extra.DeathStart].Action = A_ExplodeParms; + info->OwnedStates[extra.DeathStart].Action = A_Explode; } } else @@ -865,10 +865,10 @@ static void ParseSpriteFrames (FActorInfo *info, TArray &states, FScanne // //=========================================================================== -void A_ScreamAndUnblock (AActor *actor) +DEFINE_ACTION_FUNCTION(AActor, A_ScreamAndUnblock) { - A_Scream (actor); - A_NoBlocking (actor); + A_Scream (self); + 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); + A_ActiveSound (self); + 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); } } diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index 0da8d7e4f..8bef374cb 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -130,7 +130,7 @@ 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); +void A_Explode(AActor * self); enum { @@ -155,6 +155,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 + +/* +#define DEFINE_FUNCTION(cls, name) \ +void func_##cls##_##name (void *,stackvalue *&sp, FState *); \ + NativeFunction info_##cls##_##name = { func_##cls##_##name, #cls, #name }; \ +MSVC_FSEG NativeFunction *infoptr_##cls##_##name GCC_FSEG = &info_##cls##_##name; \ +void func_##cls##_##name (void * vself,stackvalue *&sp, FState *CallingState) +*/ + +#define DEFINE_ACTION_FUNCTION(cls, name) \ + void name (AActor *); \ + AFuncDesc info_##cls##_##name = { #name, name }; \ + MSVC_ASEG AFuncDesc *infoptr_##cls##_##name GCC_ASEG = &info_##cls##_##name; \ + void name (AActor *self) + +#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 diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 243b3e182..f0dc06464 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -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); } @@ -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(actor->FindInventory((ENamedName)StateParameters[index])); + AWeapon * weaponitem = static_cast(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 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 (4, (actor->radius>>FRACBITS)*(actor->height>>FRACBITS)/32); + // An self with radius 20 and height 64 creates ~40 chunks. + numChunks = MAX (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); + A_BossDeath (self); } - A_NoBlocking (actor); + 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 (x, y, actor->z + TELEFOGHEIGHT, ALLOW_REPLACE); + Spawn (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 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; diff --git a/src/thingdef/thingdef_properties.cpp b/src/thingdef/thingdef_properties.cpp index fe71a9ea1..e0be27801 100644 --- a/src/thingdef/thingdef_properties.cpp +++ b/src/thingdef/thingdef_properties.cpp @@ -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(); diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index 84c64aa51..f5feb674b 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -54,6 +54,7 @@ #include "a_sharedglobal.h" #include "s_sound.h" #include "i_system.h" +#include "autosegs.h" TArray StateParameters; TArray JumpParameters; @@ -64,25 +65,7 @@ TArray 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 AFTable; static TArray StateArray; @@ -103,11 +86,18 @@ AFuncDesc * FindFunction(const char * string) if (!funcsorted) { - qsort(AFTable, countof(AFTable), sizeof(AFTable[0]), funccmp); + TAutoSegIterator 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 +372,7 @@ int PrepareStateParameters(FState * state, int numparams) return paramindex; } +void A_CallSpecial(AActor * self); //========================================================================== // // DoActionSpecials diff --git a/zdoom.vcproj b/zdoom.vcproj index 1ff2f091b..1de2bfdaf 100644 --- a/zdoom.vcproj +++ b/zdoom.vcproj @@ -1039,10 +1039,6 @@ - -