diff --git a/docs/rh-log.txt b/docs/rh-log.txt index a431957af..5ff1f8ee7 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,5 @@ August 10, 2008 (Changes by Graf Zahl) +- Macro-fied all access to action functions. - Changed action function definition so that they have to be defined with a DEFINE_ACTION_FUNCTION macro. This should make it easier to improve the whole system. diff --git a/src/codepointers.h b/src/codepointers.h deleted file mode 100644 index b583e3b99..000000000 --- a/src/codepointers.h +++ /dev/null @@ -1,444 +0,0 @@ -WEAPON(JumpIfNoAmmo) -WEAPON(CustomPunch) -WEAPON(FireBullets) -WEAPON(FireCustomMissile) -WEAPON(RailAttack) -WEAPON(LightInverse) -WEAPON(ThrowGrenade) -WEAPON(SelectWeapon) -WEAPON(Light) - -ACTOR(ChangeFlag) -ACTOR(MeleeAttack) -ACTOR(MissileAttack) -ACTOR(ComboAttack) -ACTOR(BulletAttack) -ACTOR(ScreamAndUnblock) -ACTOR(ActiveAndUnblock) -ACTOR(ActiveSound) -ACTOR(FastChase) -ACTOR(CentaurDefend) -ACTOR(FreezeDeath) -ACTOR(FreezeDeathChunks) -ACTOR(GenericFreezeDeath) -ACTOR(IceGuyDie) -ACTOR(M_Saw) -ACTOR(Wander) -ACTOR(Look2) -ACTOR(TossGib) -ACTOR(SentinelBob) -ACTOR(SentinelRefire) -ACTOR(Tracer2) -ACTOR(SetShadow) -ACTOR(ClearShadow) -ACTOR(GetHurt) -ACTOR(TurretLook) -ACTOR(KlaxonBlare) -ACTOR(CheckTerrain) -ACTOR(Countdown) -ACTOR(AlertMonsters) -ACTOR(ClearSoundTarget) -ACTOR(FireAssaultGun) -ACTOR(PlaySound) -ACTOR(PlayWeaponSound) -ACTOR(FLoopActiveSound) -ACTOR(LoopActiveSound) -ACTOR(StopSound) -ACTOR(PlaySoundEx) -ACTOR(StopSoundEx) -ACTOR(SeekerMissile) -ACTOR(Jump) -ACTOR(ExplodeParms) -ACTOR(CallSpecial) -ACTOR(CustomMissile) -ACTOR(CustomBulletAttack) -ACTOR(JumpIfHealthLower) -ACTOR(JumpIfCloser) -ACTOR(JumpIfInventory) -ACTOR(CustomRailgun) -ACTOR(GiveInventory) -ACTOR(TakeInventory) -ACTOR(SpawnItem) -ACTOR(SpawnItemEx) -ACTOR(Recoil) -ACTOR(Print) -ACTOR(SetTranslucent) -ACTOR(FadeIn) -ACTOR(FadeOut) -ACTOR(SpawnDebris) -ACTOR(SetSolid) -ACTOR(UnsetSolid) -ACTOR(SetFloat) -ACTOR(UnsetFloat) -ACTOR(BishopMissileWeave) -ACTOR(CStaffMissileSlither) -ACTOR(CheckSight) -ACTOR(ExtChase) -ACTOR(DropInventory) -ACTOR(SetBlend) -ACTOR(JumpIf) -ACTOR(KillMaster) -ACTOR(KillChildren) -ACTOR(DualPainAttack) -ACTOR(GiveToTarget) -ACTOR(TakeFromTarget) -ACTOR(JumpIfInTargetInventory) -ACTOR(CountdownArg) -ACTOR(CustomMeleeAttack) -ACTOR(CustomComboAttack) -ACTOR(Burst) -ACTOR(SkullPop) -ACTOR(CheckFloor) -ACTOR(CheckPlayerDone) -ACTOR(RadiusThrust) -ACTOR(Stop) -ACTOR(SPosAttackUseAtkSound) -ACTOR(Respawn) -ACTOR(BarrelDestroy) -ACTOR(PlayerSkinCheck) -ACTOR(QueueCorpse) -ACTOR(DeQueueCorpse) -ACTOR(SetGravity) -ACTOR(ClearTarget) -ACTOR(LookEx) -ACTOR(JumpIfTargetInLOS) -ACTOR(DamageMaster) -ACTOR(DamageChildren) -ACTOR(CheckForReload) -ACTOR(ResetReloadCounter) -ACTOR(ClearReFire) -ACTOR(SpawnSingleItem) -ACTOR(GiveQuestItem) -ACTOR(RemoveForceField) -ACTOR(RestoreSpecialPosition) -ACTOR(RestoreSpecialDoomThing) -ACTOR(RestoreSpecialThing1) -ACTOR(RestoreSpecialThing2) - -ACTOR(M_Refire) -ACTOR(M_CheckAttack) -ACTOR(MarineChase) -ACTOR(MarineLook) -ACTOR(MarineNoise) -ACTOR(M_Punch) -ACTOR(M_SawRefire) -ACTOR(M_FirePistol) -ACTOR(M_FireShotgun) -ACTOR(M_FireShotgun2) -ACTOR(M_FireCGun) -ACTOR(M_FireMissile) -ACTOR(M_FirePlasma) -ACTOR(M_FireRailgun) -ACTOR(M_BFGsound) -ACTOR(M_FireBFG) - -// Heretic stuff -ACTOR(Feathers) -ACTOR(BeakRaise) -ACTOR(BeakAttackPL1) -ACTOR(BeakAttackPL2) -ACTOR(Sor1Pain) -ACTOR(Sor1Chase) -ACTOR(Srcr1Attack) -ACTOR(SorcererRise) -ACTOR(Srcr2Decide) -ACTOR(Srcr2Attack) -ACTOR(Sor2DthInit) -ACTOR(Sor2DthLoop) -ACTOR(BlueSpark) -ACTOR(GenWizard) -ACTOR(TimeBomb) -ACTOR(ImpDeath) -ACTOR(ImpXDeath1) -ACTOR(ImpExplode) -ACTOR(PodPain) -ACTOR(RemovePod) -ACTOR(MakePod) -ACTOR(AccTeleGlitter) -ACTOR(VolcanoSet) -ACTOR(VolcanoBlast) -ACTOR(VolcBallImpact) -ACTOR(LichAttack) -ACTOR(LichIceImpact) -ACTOR(LichFireGrow) -ACTOR(WhirlwindSeek) -ACTOR(KnightAttack) -ACTOR(DripBlood) -ACTOR(GhostOff) -ACTOR(WizAtk1) -ACTOR(WizAtk2) -ACTOR(WizAtk3) - -ACTOR(StaffAttack) -ACTOR(FireGoldWandPL1) -ACTOR(FireGoldWandPL2) -ACTOR(FireCrossbowPL1) -ACTOR(FireCrossbowPL2) -ACTOR(GauntletAttack) -ACTOR(FireMacePL1) -ACTOR(FireMacePL2) -ACTOR(MacePL1Check) -ACTOR(MaceBallImpact) -ACTOR(MaceBallImpact2) -ACTOR(DeathBallImpact) -ACTOR(FireBlasterPL1) -ACTOR(SpawnRippers) -ACTOR(FireSkullRodPL1) -ACTOR(AddPlayerRain) -ACTOR(HideInCeiling) -ACTOR(SkullRodStorm) -ACTOR(RainImpact) -ACTOR(MntrFloorFire) -ACTOR(FirePhoenixPL1) -ACTOR(InitPhoenixPL2) -ACTOR(FirePhoenixPL2) -ACTOR(ShutdownPhoenixPL2) -ACTOR(PhoenixPuff) -ACTOR(FlameEnd) -ACTOR(FloatPuff) - -// Minotaur stuff -ACTOR(MinotaurDecide) -ACTOR(MinotaurAtk1) -ACTOR(MinotaurAtk2) -ACTOR(MinotaurAtk3) -ACTOR(MinotaurCharge) -ACTOR(MntrFloorFire) -ACTOR(MinotaurLook) -ACTOR(MinotaurRoam) -ACTOR(MinotaurChase) -ACTOR(MinotaurDeath) - -// Hexen stuff -ACTOR(KoraxChase) -ACTOR(KoraxDecide) -ACTOR(KoraxBonePop) -ACTOR(KoraxMissile) -ACTOR(KoraxCommand) -ACTOR(KSpiritRoam) -ACTOR(KBolt) -ACTOR(KBoltRaise) -ACTOR(BatSpawnInit) -ACTOR(BatSpawn) -ACTOR(BatMove) -ACTOR(BishopDecide) -ACTOR(BishopDoBlur) -ACTOR(BishopSpawnBlur) -ACTOR(BishopPainBlur) -ACTOR(BishopChase) -ACTOR(BishopAttack) -ACTOR(BishopAttack2) -ACTOR(BishopPuff) -WEAPON(CFlameAttack) -WEAPON(CFlameRotate) -ACTOR(CFlamePuff) -WEAPON(CFlameMissile) -WEAPON(CHolyAttack) -WEAPON(CHolyAttack2) -WEAPON(CHolyPalette) -ACTOR(CHolySeek) -ACTOR(CHolyCheckScream) -ACTOR(CHolyTail) -WEAPON(CMaceAttack) -WEAPON(CStaffInitBlink) -WEAPON(CStaffCheckBlink) -WEAPON(CStaffCheck) -WEAPON(CStaffAttack) -WEAPON(FireConePL1) -WEAPON(ShedShard) -WEAPON(LightningReady) -WEAPON(MLightningAttack) -ACTOR(LightningZap) -ACTOR(LightningClip) -ACTOR(LightningRemove) -ACTOR(LastZap) -ACTOR(ZapMimic) -WEAPON(MStaffAttack) -WEAPON(MStaffPalette) -ACTOR(MStaffTrack) -ACTOR(FiredRocks) -ACTOR(FiredChase) -ACTOR(FiredAttack) -ACTOR(FiredSplotch) -ACTOR(SmBounce) -ACTOR(FogSpawn) -ACTOR(FogMove) -WEAPON(FPunchAttack) -WEAPON(FAxeCheckUp) -WEAPON(FAxeCheckReady) -WEAPON(FAxeCheckAtk) -WEAPON(FAxeAttack) -WEAPON(FAxeCheckUpG) -WEAPON(FAxeCheckReadyG) -WEAPON(FHammerAttack) -WEAPON(FHammerThrow) -ACTOR(DropWeaponPieces) -WEAPON(FSwordAttack) -WEAPON(FSwordFlames) -ACTOR(DragonInitFlight) -ACTOR(DragonFlap) -ACTOR(DragonFlight) -ACTOR(DragonPain) -ACTOR(DragonAttack) -ACTOR(DragonCheckCrash) -ACTOR(DragonFX2) -ACTOR(PotteryExplode) -ACTOR(PotteryChooseBit) -ACTOR(PotteryCheck) -ACTOR(CorpseBloodDrip) -ACTOR(CorpseExplode) -ACTOR(LeafSpawn) -ACTOR(LeafThrust) -ACTOR(LeafCheck) -ACTOR(PoisonShroom) -ACTOR(SoAExplode) -ACTOR(BellReset1) -ACTOR(BellReset2) -ACTOR(Summon) -ACTOR(PoisonBagInit) -ACTOR(CheckThrowBomb) -ACTOR(CheckThrowBomb2) -ACTOR(PoisonBagDamage) -ACTOR(PoisonBagCheck) -ACTOR(ClassBossHealth) -ACTOR(ClericAttack) -ACTOR(FighterAttack) -ACTOR(MageAttack) -ACTOR(IceSetTics) -ACTOR(PigPain) -ACTOR(SnoutAttack) -ACTOR(TeloSpawnA) -ACTOR(TeloSpawnB) -ACTOR(TeloSpawnC) -ACTOR(TeloSpawnD) -ACTOR(CheckTeleRing) -ACTOR(IceGuyLook) -ACTOR(IceGuyChase) -ACTOR(IceGuyAttack) -ACTOR(IceGuyMissileExplode) -ACTOR(SerpentHumpDecide) -ACTOR(SerpentHide) -ACTOR(SerpentCheckForAttack) -ACTOR(SerpentSpawnGibs) -ACTOR(SerpentUnHide) -ACTOR(SerpentRaiseHump) -ACTOR(SerpentLowerHump) -ACTOR(SerpentChooseAttack) -ACTOR(SerpentMeleeAttack) -ACTOR(SerpentHeadCheck) -ACTOR(FloatGib) -ACTOR(DelayGib) -ACTOR(SinkGib) -ACTOR(ThrustRaise) -ACTOR(ThrustImpale) -ACTOR(ThrustLower) -ACTOR(ThrustInitDn) -ACTOR(ThrustInitUp) -ACTOR(WraithInit) -ACTOR(WraithRaiseInit) -ACTOR(WraithRaise) -ACTOR(WraithChase) -ACTOR(WraithFX3) -ACTOR(WraithMelee) -ACTOR(WraithFX2) - -ACTOR(SorcSpinBalls) -ACTOR(SpeedBalls) -ACTOR(SlowBalls) -ACTOR(StopBalls) -ACTOR(SorcBossAttack) -ACTOR(SpawnFizzle) -ACTOR(SorcBallOrbit) -ACTOR(AccelBalls) -ACTOR(DecelBalls) -ACTOR(SorcOffense2) -ACTOR(SorcBallPop) -ACTOR(BounceCheck) -ACTOR(SorcFX1Seek) -ACTOR(SorcFX2Split) -ACTOR(SorcFX2Orbit) -ACTOR(SpawnBishop) -ACTOR(SorcererBishopEntry) -ACTOR(SorcFX4Check) - -ACTOR(TemplarAttack) -ACTOR(SentinelAttack) -ACTOR(ReaverRanged) -ACTOR(BeShadowyFoe) -ACTOR(AcolyteBits) -ACTOR(AcolyteDie) -ACTOR(HideDecepticon) -ACTOR(Beacon) -ACTOR(ShootGun) -ACTOR(RocketInFlight) -ACTOR(CrusaderChoose) -ACTOR(CrusaderSweepLeft) -ACTOR(CrusaderSweepRight) -ACTOR(CrusaderRefire) -ACTOR(CrusaderDeath) -ACTOR(InquisitorWalk) -ACTOR(InquisitorDecide) -ACTOR(InquisitorAttack) -ACTOR(InquisitorJump) -ACTOR(InquisitorCheckLand) -ACTOR(TossArm) -ACTOR(SpectralLightningTail) -ACTOR(SpectralBigBallLightning) -ACTOR(SpectralLightning) -ACTOR(SpectreChunkSmall) -ACTOR(SpectreChunkLarge) -ACTOR(Spectre3Attack) -ACTOR(SpotLightning) -ACTOR(AlienSpectreDeath) -ACTOR(EntityDeath) -ACTOR(EntityAttack) -ACTOR(SubEntityDeath) -ACTOR(SpawnEntity) -ACTOR(ProgrammerMelee) -ACTOR(SpawnProgrammerBase) -ACTOR(ProgrammerDeath) -ACTOR(LoremasterChain) -ACTOR(ExtraLightOff) -ACTOR(Explode512) -ACTOR(LightGoesOut) -ACTOR(Bang4Cloud) -ACTOR(HandLower) -ACTOR(WakeOracleSpectre) -ACTOR(StalkerLookInit) -ACTOR(StalkerChaseDecide) -ACTOR(StalkerWalk) -ACTOR(StalkerAttack) -ACTOR(StalkerDrop) -ACTOR(JabDagger) -ACTOR(ClearFlash) -ACTOR(ShowElectricFlash) -ACTOR(FireArrow) -ACTOR(FireMiniMissile) -ACTOR(FireFlamer) -ACTOR(FlameDie) -ACTOR(FireMauler1) -ACTOR(FireMauler2Pre) -ACTOR(FireMauler2) -ACTOR(MaulerTorpedoWave) -ACTOR(BurnArea) -ACTOR(Burnination) -ACTOR(FireGrenade) -ACTOR(SelectPiece) -ACTOR(SelectSigilView) -ACTOR(SelectSigilDown) -ACTOR(SelectSigilAttack) -ACTOR(SigilCharge) -ACTOR(FireSigil1) -ACTOR(FireSigil2) -ACTOR(FireSigil3) -ACTOR(FireSigil4) -ACTOR(FireSigil5) - -// Special code pointers for Strife's player - not to be used elsewhere! -ACTOR(ItBurnsItBurns) -ACTOR(CrispyPlayer) -ACTOR(DropFire) - -// Special code pointers for bridge things -ACTOR(BridgeInit) -ACTOR(BridgeOrbit) diff --git a/src/g_doom/a_archvile.cpp b/src/g_doom/a_archvile.cpp index 2264a0f41..9602e413f 100644 --- a/src/g_doom/a_archvile.cpp +++ b/src/g_doom/a_archvile.cpp @@ -12,7 +12,7 @@ // PIT_VileCheck // Detect a corpse that could be raised. // -void A_Fire (AActor *self); +DECLARE_ACTION(A_Fire) @@ -32,13 +32,13 @@ DEFINE_ACTION_FUNCTION(AActor, A_VileStart) DEFINE_ACTION_FUNCTION(AActor, A_StartFire) { S_Sound (self, CHAN_BODY, "vile/firestrt", 1, ATTN_NORM); - A_Fire (self); + CALL_ACTION(A_Fire, self); } DEFINE_ACTION_FUNCTION(AActor, A_FireCrackle) { S_Sound (self, CHAN_BODY, "vile/firecrkl", 1, ATTN_NORM); - A_Fire (self); + CALL_ACTION(A_Fire, self); } DEFINE_ACTION_FUNCTION(AActor, A_Fire) @@ -82,7 +82,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_VileTarget) self->tracer = fog; fog->target = self; fog->tracer = self->target; - A_Fire (fog); + CALL_ACTION(A_Fire, fog); } diff --git a/src/g_doom/a_bossbrain.cpp b/src/g_doom/a_bossbrain.cpp index 1b368ffbe..aaed408e7 100644 --- a/src/g_doom/a_bossbrain.cpp +++ b/src/g_doom/a_bossbrain.cpp @@ -249,5 +249,5 @@ DEFINE_ACTION_FUNCTION(AActor, A_SpawnFly) DEFINE_ACTION_FUNCTION(AActor, A_SpawnSound) { S_Sound (self, CHAN_BODY, "brain/cube", 1, ATTN_IDLE); - A_SpawnFly (self); + CALL_ACTION(A_SpawnFly, self); } diff --git a/src/g_doom/a_doomweaps.cpp b/src/g_doom/a_doomweaps.cpp index 1b9fe920e..b28a5ce7c 100644 --- a/src/g_doom/a_doomweaps.cpp +++ b/src/g_doom/a_doomweaps.cpp @@ -261,7 +261,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LoadShotgun2) DEFINE_ACTION_FUNCTION(AActor, A_CloseShotgun2) { S_Sound (self, CHAN_WEAPON, "weapons/sshotc", 1, ATTN_NORM); - A_ReFire (self); + CALL_ACTION(A_ReFire, self); } @@ -401,9 +401,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FirePlasma) // // [RH] A_FireRailgun // -static int RailOffset; - -DEFINE_ACTION_FUNCTION(AActor, A_FireRailgun) +static void FireRailgun(AActor *self, int RailOffset) { int damage; player_t *player; @@ -429,19 +427,22 @@ DEFINE_ACTION_FUNCTION(AActor, A_FireRailgun) damage = deathmatch ? 100 : 150; P_RailAttack (self, damage, RailOffset); - RailOffset = 0; +} + + +DEFINE_ACTION_FUNCTION(AActor, A_FireRailgun) +{ + FireRailgun(self, 0); } DEFINE_ACTION_FUNCTION(AActor, A_FireRailgunRight) { - RailOffset = 10; - A_FireRailgun (self); + FireRailgun(self, 10); } DEFINE_ACTION_FUNCTION(AActor, A_FireRailgunLeft) { - RailOffset = -10; - A_FireRailgun (self); + FireRailgun(self, -10); } DEFINE_ACTION_FUNCTION(AActor, A_RailWait) diff --git a/src/g_doom/a_keen.cpp b/src/g_doom/a_keen.cpp index d579a0d9c..6cf495234 100644 --- a/src/g_doom/a_keen.cpp +++ b/src/g_doom/a_keen.cpp @@ -13,7 +13,7 @@ // DEFINE_ACTION_FUNCTION(AActor, A_KeenDie) { - A_NoBlocking (self); + CALL_ACTION(A_NoBlocking, self); // scan the remaining thinkers to see if all Keens are dead AActor *other; diff --git a/src/g_doom/a_painelemental.cpp b/src/g_doom/a_painelemental.cpp index f3135a4f6..14e1208ed 100644 --- a/src/g_doom/a_painelemental.cpp +++ b/src/g_doom/a_painelemental.cpp @@ -8,10 +8,7 @@ #include "m_bbox.h" #include "thingdef/thingdef.h" -void A_PainAttack (AActor *); -void A_PainDie (AActor *); - -void A_SkullAttack (AActor *self); +DECLARE_ACTION(A_SkullAttack) static const PClass *GetSpawnType() { @@ -130,7 +127,7 @@ void A_PainShootSkull (AActor *self, angle_t angle, const PClass *spawntype) // [RH] Lost souls hate the same things as their pain elementals other->CopyFriendliness (self, true); - A_SkullAttack (other); + CALL_ACTION(A_SkullAttack, other); } @@ -166,7 +163,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_PainDie) self->flags &= ~MF_FRIENDLY; } const PClass *spawntype = GetSpawnType(); - A_NoBlocking (self); + CALL_ACTION(A_NoBlocking, self); A_PainShootSkull (self, self->angle + ANG90, spawntype); A_PainShootSkull (self, self->angle + ANG180, spawntype); A_PainShootSkull (self, self->angle + ANG270, spawntype); diff --git a/src/g_doom/a_scriptedmarine.cpp b/src/g_doom/a_scriptedmarine.cpp index 5f981a39d..82f2802bf 100644 --- a/src/g_doom/a_scriptedmarine.cpp +++ b/src/g_doom/a_scriptedmarine.cpp @@ -222,7 +222,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MarineNoise) DEFINE_ACTION_FUNCTION(AActor, A_MarineChase) { - A_MarineNoise (self); + CALL_ACTION(A_MarineNoise, self); A_Chase (self); } @@ -234,8 +234,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_MarineChase) DEFINE_ACTION_FUNCTION(AActor, A_MarineLook) { - A_MarineNoise (self); - A_Look (self); + CALL_ACTION(A_MarineNoise, self); + CALL_ACTION(A_Look, self); } //============================================================================ @@ -300,7 +300,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_Saw) // //============================================================================ -DEFINE_ACTION_FUNCTION(AActor, A_M_Punch) +static void MarinePunch(AActor *self, int damagemul) { angle_t angle; int damage; @@ -310,11 +310,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_Punch) if (self->target == NULL) return; - int index=CheckIndex(1); - if (index<0) return; - - damage = (pr_m_punch()%10+1) << 1; - damage *= EvalExpressionI (StateParameters[index], self); + damage = ((pr_m_punch()%10+1) << 1) * damagemul; A_FaceTarget (self); angle = self->angle + (pr_m_punch.Random2() << 18); @@ -329,6 +325,14 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_Punch) } } +DEFINE_ACTION_FUNCTION(AActor, A_M_Punch) +{ + int index=CheckIndex(1); + if (index<0) return; + + MarinePunch(self, EvalExpressionI (StateParameters[index], self)); +} + //============================================================================ // // P_GunShot2 @@ -479,7 +483,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireMissile) if (self->CheckMeleeRange ()) { // If too close, punch it - A_M_Punch (self); + MarinePunch(self, 1); } else { @@ -499,7 +503,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_M_FireRailgun) if (self->target == NULL) return; - A_MonsterRail (self); + CALL_ACTION(A_MonsterRail, self); self->special1 = level.maptime + 50; } diff --git a/src/g_heretic/a_dsparil.cpp b/src/g_heretic/a_dsparil.cpp index 8405fe3e0..7fe12b5c1 100644 --- a/src/g_heretic/a_dsparil.cpp +++ b/src/g_heretic/a_dsparil.cpp @@ -26,7 +26,7 @@ static FRandom pr_bluespark ("BlueSpark"); DEFINE_ACTION_FUNCTION(AActor, A_Sor1Pain) { self->special1 = 20; // Number of steps to walk fast - A_Pain (self); + CALL_ACTION(A_Pain, self); } //---------------------------------------------------------------------------- diff --git a/src/g_heretic/a_hereticartifacts.cpp b/src/g_heretic/a_hereticartifacts.cpp index db786d22f..59b44b00a 100644 --- a/src/g_heretic/a_hereticartifacts.cpp +++ b/src/g_heretic/a_hereticartifacts.cpp @@ -49,7 +49,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_TimeBomb) self->z += 32*FRACUNIT; self->RenderStyle = STYLE_Add; self->alpha = FRACUNIT; - A_Explode(self); + CALL_ACTION(A_Explode, self); } class AArtiTimeBomb : public AInventory diff --git a/src/g_heretic/a_wizard.cpp b/src/g_heretic/a_wizard.cpp index 7557b6658..16cb8269f 100644 --- a/src/g_heretic/a_wizard.cpp +++ b/src/g_heretic/a_wizard.cpp @@ -31,7 +31,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_GhostOff) DEFINE_ACTION_FUNCTION(AActor, A_WizAtk1) { A_FaceTarget (self); - A_GhostOff (self); + CALL_ACTION(A_GhostOff, self); } //---------------------------------------------------------------------------- @@ -58,7 +58,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_WizAtk3) { AActor *mo; - A_GhostOff (self); + CALL_ACTION(A_GhostOff, self); if (!self->target) { return; diff --git a/src/g_hexen/a_centaur.cpp b/src/g_hexen/a_centaur.cpp index 6c6f870cf..e16ed2e06 100644 --- a/src/g_hexen/a_centaur.cpp +++ b/src/g_hexen/a_centaur.cpp @@ -19,7 +19,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CentaurDefend) { // This should unset REFLECTIVE as well // (unless you want the Centaur to reflect projectiles forever!) - A_UnSetReflectiveInvulnerable (self); + self->flags2&=~(MF2_REFLECTIVE|MF2_INVULNERABLE); self->SetState (self->MeleeState); } } diff --git a/src/g_hexen/a_clericflame.cpp b/src/g_hexen/a_clericflame.cpp index 0fbf268e1..d7975edea 100644 --- a/src/g_hexen/a_clericflame.cpp +++ b/src/g_hexen/a_clericflame.cpp @@ -150,7 +150,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameAttack) DEFINE_ACTION_FUNCTION(AActor, A_CFlamePuff) { - A_UnHideThing (self); + self->renderflags &= ~RF_INVISIBLE; self->momx = 0; self->momy = 0; self->momz = 0; @@ -170,7 +170,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CFlameMissile) fixed_t dist; AActor *mo; - A_UnHideThing (self); + self->renderflags &= ~RF_INVISIBLE; S_Sound (self, CHAN_BODY, "ClericFlameExplode", 1, ATTN_NORM); AActor *BlockingMobj = self->BlockingMobj; if (BlockingMobj && BlockingMobj->flags&MF_SHOOTABLE) diff --git a/src/g_hexen/a_clericholy.cpp b/src/g_hexen/a_clericholy.cpp index ed952d392..976bcac7e 100644 --- a/src/g_hexen/a_clericholy.cpp +++ b/src/g_hexen/a_clericholy.cpp @@ -19,15 +19,6 @@ static FRandom pr_checkscream ("CCheckScream"); static FRandom pr_spiritslam ("CHolySlam"); static FRandom pr_wraithvergedrop ("WraithvergeDrop"); -void A_CHolyAttack2 (AActor *); -void A_CHolyTail (AActor *); -void A_CHolySeek (AActor *); -void A_CHolyCheckScream (AActor *); -void A_DropWraithvergePieces (AActor *); - -void A_CHolyAttack (AActor *); -void A_CHolyPalette (AActor *); - void SpawnSpiritTail (AActor *spirit); //========================================================================== @@ -565,7 +556,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_CHolySeek) DEFINE_ACTION_FUNCTION(AActor, A_CHolyCheckScream) { - A_CHolySeek (self); + CALL_ACTION(A_CHolySeek, self); if (pr_checkscream() < 20) { S_Sound (self, CHAN_VOICE, "SpiritActive", 1, ATTN_NORM); diff --git a/src/g_hexen/a_clericstaff.cpp b/src/g_hexen/a_clericstaff.cpp index 41bf2a66c..f463200a4 100644 --- a/src/g_hexen/a_clericstaff.cpp +++ b/src/g_hexen/a_clericstaff.cpp @@ -198,6 +198,6 @@ DEFINE_ACTION_FUNCTION(AActor, A_CStaffCheckBlink) } else { - A_WeaponReady (self); + CALL_ACTION(A_WeaponReady, self); } } diff --git a/src/g_hexen/a_dragon.cpp b/src/g_hexen/a_dragon.cpp index a3306f638..7d9a37607 100644 --- a/src/g_hexen/a_dragon.cpp +++ b/src/g_hexen/a_dragon.cpp @@ -13,13 +13,7 @@ static FRandom pr_dragonflight ("DragonFlight"); static FRandom pr_dragonflap ("DragonFlap"); static FRandom pr_dragonfx2 ("DragonFX2"); -void A_DragonInitFlight (AActor *); -void A_DragonFlap (AActor *); -void A_DragonFlight (AActor *); -void A_DragonPain (AActor *); -void A_DragonAttack (AActor *); -void A_DragonCheckCrash (AActor *); -void A_DragonFX2 (AActor *); +DECLARE_ACTION(A_DragonFlight) //============================================================================ // @@ -230,7 +224,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFlight) DEFINE_ACTION_FUNCTION(AActor, A_DragonFlap) { - A_DragonFlight (self); + CALL_ACTION(A_DragonFlight, self); if (pr_dragonflap() < 240) { S_Sound (self, CHAN_BODY, "DragonWingflap", 1, ATTN_NORM); @@ -288,7 +282,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_DragonFX2) DEFINE_ACTION_FUNCTION(AActor, A_DragonPain) { - A_Pain (self); + CALL_ACTION(A_Pain, self); if (!self->tracer) { // no destination spot yet self->SetState (self->SeeState); diff --git a/src/g_hexen/a_fighteraxe.cpp b/src/g_hexen/a_fighteraxe.cpp index a25ace4ad..f6ac7e68f 100644 --- a/src/g_hexen/a_fighteraxe.cpp +++ b/src/g_hexen/a_fighteraxe.cpp @@ -82,7 +82,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReady) } else { - A_WeaponReady (self); + CALL_ACTION(A_WeaponReady, self); } } @@ -106,7 +106,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckReadyG) } else { - A_WeaponReady (self); + CALL_ACTION(A_WeaponReady, self); } } @@ -130,7 +130,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUp) } else { - A_Raise (self); + CALL_ACTION(A_Raise, self); } } @@ -154,7 +154,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FAxeCheckUpG) } else { - A_Raise (self); + CALL_ACTION(A_Raise, self); } } diff --git a/src/g_hexen/a_flechette.cpp b/src/g_hexen/a_flechette.cpp index e2811c061..8497f8b8b 100644 --- a/src/g_hexen/a_flechette.cpp +++ b/src/g_hexen/a_flechette.cpp @@ -16,12 +16,7 @@ static FRandom pr_poisonbag ("PoisonBag"); static FRandom pr_poisoncloud ("PoisonCloud"); static FRandom pr_poisoncloudd ("PoisonCloudDamage"); -void A_PoisonBagInit (AActor *); -void A_PoisonBagDamage (AActor *); -void A_PoisonBagCheck (AActor *); -void A_CheckThrowBomb (AActor *); -void A_CheckThrowBomb2 (AActor *); -void A_TimeBomb(AActor *self); +DECLARE_ACTION(A_CheckThrowBomb) // Poison Bag Artifact (Flechette) ------------------------------------------ @@ -377,5 +372,5 @@ DEFINE_ACTION_FUNCTION(AActor, A_CheckThrowBomb2) self->flags2 &= ~MF2_BOUNCETYPE; self->flags &= ~MF_MISSILE; } - A_CheckThrowBomb (self); + CALL_ACTION(A_CheckThrowBomb, self); } diff --git a/src/g_hexen/a_heresiarch.cpp b/src/g_hexen/a_heresiarch.cpp index 46961149f..53c2f1af9 100644 --- a/src/g_hexen/a_heresiarch.cpp +++ b/src/g_hexen/a_heresiarch.cpp @@ -48,11 +48,11 @@ #define BALL2_ANGLEOFFSET (ANGLE_MAX/3) #define BALL3_ANGLEOFFSET ((ANGLE_MAX/3)*2) -void A_SlowBalls (AActor *actor); -void A_StopBalls (AActor *actor); -void A_AccelBalls (AActor *actor); -void A_DecelBalls (AActor *actor); -void A_SorcOffense2 (AActor *actor); +DECLARE_ACTION(A_SlowBalls) +DECLARE_ACTION(A_StopBalls) +DECLARE_ACTION(A_AccelBalls) +DECLARE_ACTION(A_DecelBalls) +DECLARE_ACTION(A_SorcOffense2) void A_DoBounceCheck (AActor *actor, const char *sound); static FRandom pr_heresiarch ("Heresiarch"); @@ -234,7 +234,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcSpinBalls) fixed_t z; self->SpawnState += 2; // [RH] Don't spawn balls again - A_SlowBalls(self); + CALL_ACTION(A_SlowBalls, self); self->args[0] = 0; // Currently no defense self->args[3] = SORC_NORMAL; self->args[4] = SORCBALL_INITIAL_SPEED; // Initial orbit speed @@ -301,12 +301,12 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit) break; case SORC_DECELERATE: // Balls decelerating - A_DecelBalls(actor); + CALL_ACTION(A_DecelBalls, actor); actor->SorcUpdateBallAngle (); break; case SORC_ACCELERATE: // Balls accelerating - A_AccelBalls(actor); + CALL_ACTION(A_AccelBalls, actor); actor->SorcUpdateBallAngle (); break; @@ -352,7 +352,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SorcBallOrbit) else { // Do rapid fire spell - A_SorcOffense2(actor); + CALL_ACTION(A_SorcOffense2, actor); } } break; @@ -458,7 +458,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AccelBalls) if (sorc->args[4] >= SORCBALL_TERMINAL_SPEED) { // Reached terminal velocity - stop balls - A_StopBalls(sorc); + CALL_ACTION(A_StopBalls, sorc); } } } diff --git a/src/g_hexen/a_iceguy.cpp b/src/g_hexen/a_iceguy.cpp index 78f8e1cfc..e3c751a7a 100644 --- a/src/g_hexen/a_iceguy.cpp +++ b/src/g_hexen/a_iceguy.cpp @@ -27,7 +27,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyLook) fixed_t dist; fixed_t an; - A_Look (self); + CALL_ACTION(A_Look, self); if (pr_iceguylook() < 64) { dist = ((pr_iceguylook()-128)*self->radius)>>7; @@ -111,7 +111,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_IceGuyDie) self->momy = 0; self->momz = 0; self->height = self->GetDefault()->height; - A_FreezeDeathChunks (self); + CALL_ACTION(A_FreezeDeathChunks, self); } //============================================================================ diff --git a/src/g_hexen/a_korax.cpp b/src/g_hexen/a_korax.cpp index 3d6a51760..c1d70ab44 100644 --- a/src/g_hexen/a_korax.cpp +++ b/src/g_hexen/a_korax.cpp @@ -440,7 +440,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KSpiritRoam) A_KSpiritSeeker (self, self->args[0]*ANGLE_1, self->args[0]*ANGLE_1*2); } - A_KSpiritWeave (self); + CALL_ACTION(A_KSpiritWeave, self); if (pr_kspiritroam()<50) { S_Sound (self, CHAN_VOICE, "SpiritActive", 1, ATTN_NONE); diff --git a/src/g_hexen/a_magelightning.cpp b/src/g_hexen/a_magelightning.cpp index 5c9142319..5794e1e31 100644 --- a/src/g_hexen/a_magelightning.cpp +++ b/src/g_hexen/a_magelightning.cpp @@ -20,13 +20,8 @@ static FRandom pr_zap ("LightningZap"); static FRandom pr_zapf ("LightningZapF"); static FRandom pr_hit ("LightningHit"); -void A_LightningReady (AActor *actor); -void A_MLightningAttack (AActor *actor); - -void A_LightningClip (AActor *); -void A_LightningZap (AActor *); -void A_ZapMimic (AActor *); -void A_LastZap (AActor *); +DECLARE_ACTION(A_LightningClip) +DECLARE_ACTION(A_LightningZap) // Lightning ---------------------------------------------------------------- @@ -129,7 +124,7 @@ int ALightningZap::SpecialMissileHit (AActor *thing) DEFINE_ACTION_FUNCTION(AActor, A_LightningReady) { - A_WeaponReady (self); + CALL_ACTION(A_WeaponReady, self); if (pr_lightningready() < 160) { S_Sound (self, CHAN_WEAPON, "MageLightningReady", 1, ATTN_NORM); @@ -213,7 +208,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LightningZap) AActor *mo; fixed_t deltaZ; - A_LightningClip(self); + CALL_ACTION(A_LightningClip, self); self->health -= 8; if (self->health <= 0) @@ -269,13 +264,13 @@ static void MLightningAttack2 (AActor *self) { fmo->special1 = 0; fmo->lastenemy = cmo; - A_LightningZap (fmo); + CALL_ACTION(A_LightningZap, fmo); } if (cmo) { cmo->tracer = NULL; cmo->lastenemy = fmo; - A_LightningZap (cmo); + CALL_ACTION(A_LightningZap, cmo); } S_Sound (self, CHAN_BODY, "MageLightningFire", 1, ATTN_NORM); } diff --git a/src/g_hexen/a_pig.cpp b/src/g_hexen/a_pig.cpp index 805bf06c1..95f9c5ac1 100644 --- a/src/g_hexen/a_pig.cpp +++ b/src/g_hexen/a_pig.cpp @@ -93,7 +93,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SnoutAttack) DEFINE_ACTION_FUNCTION(AActor, A_PigPain) { - A_Pain (self); + CALL_ACTION(A_Pain, self); if (self->z <= self->floorz) { self->momz = FRACUNIT*7/2; diff --git a/src/g_hexen/a_serpent.cpp b/src/g_hexen/a_serpent.cpp index 49ee20790..9e2d6624d 100644 --- a/src/g_hexen/a_serpent.cpp +++ b/src/g_hexen/a_serpent.cpp @@ -178,7 +178,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_SerpentMeleeAttack) } if (pr_serpentmeattack() < 96) { - A_SerpentCheckForAttack (self); + CALL_ACTION(A_SerpentCheckForAttack, self); } } diff --git a/src/g_raven/a_minotaur.cpp b/src/g_raven/a_minotaur.cpp index 3dca77792..f774af899 100644 --- a/src/g_raven/a_minotaur.cpp +++ b/src/g_raven/a_minotaur.cpp @@ -21,10 +21,10 @@ static FRandom pr_minotaurslam ("MinotaurSlam"); static FRandom pr_minotaurroam ("MinotaurRoam"); static FRandom pr_minotaurchase ("MinotaurChase"); -void A_MinotaurLook (AActor *); - void P_MinotaurSlam (AActor *source, AActor *target); +DECLARE_ACTION(A_MinotaurLook) + IMPLEMENT_CLASS(AMinotaur) void AMinotaur::Tick () @@ -466,7 +466,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurRoam) } if (pr_minotaurroam() < 30) - A_MinotaurLook (self1); // adjust to closest target + CALL_ACTION(A_MinotaurLook, self1); // adjust to closest target if (pr_minotaurroam() < 6) { @@ -498,7 +498,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurLook) { if (!self->IsKindOf(RUNTIME_CLASS(AMinotaurFriend))) { - A_Look (self); + CALL_ACTION(A_Look, self); return; } @@ -582,7 +582,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_MinotaurChase) } if (pr_minotaurchase() < 30) - A_MinotaurLook (self1); // adjust to closest target + CALL_ACTION(A_MinotaurLook, self1); // adjust to closest target if (!self1->target || (self1->target->health <= 0) || !(self1->target->flags&MF_SHOOTABLE)) diff --git a/src/g_shared/a_action.cpp b/src/g_shared/a_action.cpp index da99df752..245548771 100644 --- a/src/g_shared/a_action.cpp +++ b/src/g_shared/a_action.cpp @@ -100,7 +100,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_NoBlocking) DEFINE_ACTION_FUNCTION(AActor, A_Fall) { - A_NoBlocking(self); + CALL_ACTION(A_NoBlocking, self); } //========================================================================== @@ -195,7 +195,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeath) DEFINE_ACTION_FUNCTION(AActor, A_GenericFreezeDeath) { self->Translation = TRANSLATION(TRANSLATION_Standard, 7); - A_FreezeDeath (self); + CALL_ACTION(A_FreezeDeath, self); } //============================================================================ @@ -259,7 +259,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks) 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 + CALL_ACTION(A_IceSetTics, mo); // set a random tic wait mo->RenderStyle = self->RenderStyle; mo->alpha = self->alpha; } @@ -292,9 +292,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_FreezeDeathChunks) // [RH] Do some stuff to make this more useful outside Hexen if (self->flags4 & MF4_BOSSDEATH) { - A_BossDeath (self); + CALL_ACTION(A_BossDeath, self); } - A_NoBlocking (self); + CALL_ACTION(A_NoBlocking, self); self->Destroy (); } diff --git a/src/g_shared/a_action.h b/src/g_shared/a_action.h index 13a3c0b2c..8a019be7e 100644 --- a/src/g_shared/a_action.h +++ b/src/g_shared/a_action.h @@ -1,5 +1,6 @@ class AActor; +/* void A_NoBlocking (AActor *); void A_HideThing (AActor *); void A_UnHideThing (AActor *); @@ -21,5 +22,8 @@ void A_UnSetShootable (AActor *); void A_SetFloorClip (AActor *); void A_UnSetFloorClip (AActor *); void A_NoGravity (AActor *); -void FaceMovementDirection (AActor *); void A_SkullPop (AActor *); +*/ + + +void FaceMovementDirection (AActor *); diff --git a/src/g_shared/a_bridge.cpp b/src/g_shared/a_bridge.cpp index 6f741f086..73293ac2b 100644 --- a/src/g_shared/a_bridge.cpp +++ b/src/g_shared/a_bridge.cpp @@ -134,7 +134,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_BridgeInit) ball = Spawn(balltype, cx, cy, cz, ALLOW_REPLACE); ball->angle = startangle + (ANGLE_45/32) * (256/ballcount) * i; ball->target = self; - A_BridgeOrbit(ball); + CALL_ACTION(A_BridgeOrbit, ball); } } diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index d197ce083..6d2e34f39 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -752,7 +752,7 @@ static bool FindMostRecentWeapon (player_t *player, int *slot, int *index) if (player->PendingWeapon != WP_NOCHANGE) { if (player->psprites[ps_weapon].state != NULL && - player->psprites[ps_weapon].state->GetAction() == A_Raise) + player->psprites[ps_weapon].state->GetAction() == GET_ACTION(A_Raise)) { if (LocalWeapons.LocateWeapon (player->PendingWeapon->GetClass(), slot, index)) { diff --git a/src/g_strife/a_acolyte.cpp b/src/g_strife/a_acolyte.cpp index 224467f1f..cd3ea4eb3 100644 --- a/src/g_strife/a_acolyte.cpp +++ b/src/g_strife/a_acolyte.cpp @@ -98,7 +98,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AcolyteBits) { if (self->SpawnFlags & MTF_SHADOW) { - A_BeShadowyFoe (self); + CALL_ACTION(A_BeShadowyFoe, self); } if (self->SpawnFlags & MTF_ALTSHADOW) { diff --git a/src/g_strife/a_alienspectres.cpp b/src/g_strife/a_alienspectres.cpp index 24deecbad..44aaa3d6f 100644 --- a/src/g_strife/a_alienspectres.cpp +++ b/src/g_strife/a_alienspectres.cpp @@ -82,7 +82,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_AlienSpectreDeath) int log; int i; - A_NoBlocking (self); // [RH] Need this for Sigil rewarding + CALL_ACTION(A_NoBlocking, self); // [RH] Need this for Sigil rewarding if (!CheckBossDeath (self)) { return; diff --git a/src/g_strife/a_entityboss.cpp b/src/g_strife/a_entityboss.cpp index 4e081eec0..fb3dfdfb5 100644 --- a/src/g_strife/a_entityboss.cpp +++ b/src/g_strife/a_entityboss.cpp @@ -32,8 +32,8 @@ void A_SpectralMissile (AActor *self, const char *missilename) } } -void A_SpotLightning (AActor *); -void A_Spectre3Attack (AActor *); +DECLARE_ACTION(A_SpotLightning) +DECLARE_ACTION(A_Spectre3Attack) DEFINE_ACTION_FUNCTION(AActor, A_EntityAttack) @@ -43,7 +43,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityAttack) switch (pr_entity() % 5) { case 0: - A_SpotLightning(self); + CALL_ACTION(A_SpotLightning, self); break; case 2: @@ -51,7 +51,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_EntityAttack) break; case 3: - A_Spectre3Attack (self); + CALL_ACTION(A_Spectre3Attack, self); break; case 4: diff --git a/src/g_strife/a_programmer.cpp b/src/g_strife/a_programmer.cpp index 70c2d6411..4f368fdbe 100644 --- a/src/g_strife/a_programmer.cpp +++ b/src/g_strife/a_programmer.cpp @@ -150,5 +150,5 @@ DEFINE_ACTION_FUNCTION(AActor, A_ProgrammerDeath) } } // the sky change scripts are now done as special actions in MAPINFO - A_BossDeath(self); + CALL_ACTION(A_BossDeath, self); } diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index cc4b599f3..890eb203b 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -377,13 +377,6 @@ static FRandom pr_gibtosser ("GibTosser"); -void A_TossGib (AActor *); -void A_LoopActiveSound (AActor *); -void A_FLoopActiveSound (AActor *); -void A_Countdown (AActor *); -void A_XXScream (AActor *); -void A_SentinelRefire (AActor *); - // Force Field Guard -------------------------------------------------------- void A_RemoveForceField (AActor *); @@ -472,7 +465,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_KlaxonBlare) { self->target = NULL; self->reactiontime = self->GetDefault()->reactiontime; - A_TurretLook (self); + CALL_ACTION(A_TurretLook, self); if (self->target == NULL) { self->SetIdle(); diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 8cf21b310..5b870dcd4 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -1599,7 +1599,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_Look) } else { - A_Wander (self); + CALL_ACTION(A_Wander, self); } } else @@ -1872,10 +1872,10 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi { if (actor->flags & MF_FRIENDLY) { - A_Look (actor); + CALL_ACTION(A_Look, actor); if (actor->target == NULL) { - if (!dontmove) A_Wander (actor); + if (!dontmove) CALL_ACTION(A_Wander, actor); actor->flags &= ~MF_INCHASE; return; } @@ -2275,12 +2275,18 @@ DEFINE_ACTION_FUNCTION(AActor, A_ExtChase) !!EvalExpressionI (StateParameters[index+3], self), false); } +// for internal use +void A_Chase(AActor *self) +{ + A_DoChase (self, false, self->MeleeState, self->MissileState, true, !!(gameinfo.gametype & GAME_Raven), false); +} + //============================================================================= // // A_FaceTarget // //============================================================================= -DEFINE_ACTION_FUNCTION(AActor, A_FaceTarget) +void A_FaceTarget(AActor *self) { if (!self->target) return; @@ -2301,6 +2307,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_FaceTarget) } } +DEFINE_ACTION_FUNCTION(AActor, A_FaceTarget) +{ + A_FaceTarget(self); +} //=========================================================================== // diff --git a/src/p_enemy.h b/src/p_enemy.h index 702097c3c..c6b3a6f38 100644 --- a/src/p_enemy.h +++ b/src/p_enemy.h @@ -2,6 +2,7 @@ #define __P_ENEMY_H__ #include "r_defs.h" +#include "thingdef/thingdef.h" enum dirtype_t { @@ -34,24 +35,19 @@ inline AInventory *P_DropItem (AActor *source, const char *type, int special, in } void P_TossItem (AActor *item); -void A_Look (AActor *actor); -void A_Wander (AActor *actor); -void A_Look2 (AActor *actor); -void A_Chase (AActor *actor); -void A_FastChase (AActor *actor); +DECLARE_ACTION(A_Look) +DECLARE_ACTION(A_Wander) +DECLARE_ACTION(A_BossDeath) +DECLARE_ACTION(A_Pain) +DECLARE_ACTION(A_MonsterRail) +DECLARE_ACTION(A_NoBlocking) +DECLARE_ACTION(A_Explode) +DECLARE_ACTION(A_Scream) +DECLARE_ACTION(A_FreezeDeath) +DECLARE_ACTION(A_FreezeDeathChunks) + +void A_Chase(AActor *self); void A_FaceTarget (AActor *actor); -void A_MonsterRail (AActor *actor); -void A_Scream (AActor *actor); -void A_XScream (AActor *actor); -void A_Pain (AActor *actor); -void A_Die (AActor *actor); -void A_Detonate (AActor *mo); -void A_Explode (AActor *thing); -void A_Mushroom (AActor *actor); -void A_BossDeath (AActor *actor); -void A_FireScream (AActor *mo); -void A_PlayerScream (AActor *mo); -void A_ClassBossHealth (AActor *); bool A_RaiseMobj (AActor *, fixed_t speed); bool A_SinkMobj (AActor *, fixed_t speed); @@ -59,6 +55,5 @@ bool A_SinkMobj (AActor *, fixed_t speed); bool CheckBossDeath (AActor *); int P_Massacre (); bool P_CheckMissileRange (AActor *actor); -void A_LookEx (AActor *actor); #endif //__P_ENEMY_H__ diff --git a/src/p_enemy_a_lookex.cpp b/src/p_enemy_a_lookex.cpp index 379ca76fc..645eb4f50 100644 --- a/src/p_enemy_a_lookex.cpp +++ b/src/p_enemy_a_lookex.cpp @@ -818,7 +818,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_LookEx) } else { - A_Wander (self); + CALL_ACTION(A_Wander, self); } } } diff --git a/src/p_pspr.h b/src/p_pspr.h index 8970556a3..af8deead1 100644 --- a/src/p_pspr.h +++ b/src/p_pspr.h @@ -27,6 +27,7 @@ // Needs fixed point, and BAM angles. #include "m_fixed.h" #include "tables.h" +#include "thingdef/thingdef.h" // @@ -93,14 +94,8 @@ void P_BobWeapon (player_t *player, pspdef_t *psp, fixed_t *x, fixed_t *y); angle_t P_BulletSlope (AActor *mo, AActor **pLineTarget = NULL); void P_GunShot (AActor *mo, bool accurate, const PClass *pufftype, angle_t pitch); -void A_WeaponReady (AActor *actor); -void A_ReFire (AActor *actor); -void A_CheckReload (AActor *actor); -void A_Lower (AActor *actor); -void A_Raise (AActor *actor); -void A_GunFlash (AActor *actor); -void A_Light0 (AActor *actor); -void A_Light1 (AActor *actor); -void A_Light2 (AActor *actor); +DECLARE_ACTION(A_WeaponReady) +DECLARE_ACTION(A_Raise) +DECLARE_ACTION(A_ReFire) #endif // __P_PSPR_H__ diff --git a/src/thingdef/olddecorations.cpp b/src/thingdef/olddecorations.cpp index 0cf2dbb81..3c40765c6 100644 --- a/src/thingdef/olddecorations.cpp +++ b/src/thingdef/olddecorations.cpp @@ -100,9 +100,9 @@ IMPLEMENT_CLASS (AFakeInventory) // PUBLIC FUNCTION PROTOTYPES ---------------------------------------------- -void A_ScreamAndUnblock (AActor *); -void A_ActiveAndUnblock (AActor *); -void A_ActiveSound (AActor *); +DECLARE_ACTION(A_ScreamAndUnblock) +DECLARE_ACTION(A_ActiveAndUnblock) +DECLARE_ACTION(A_ActiveSound) // PRIVATE FUNCTION PROTOTYPES --------------------------------------------- @@ -367,24 +367,24 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def) { if (extra.bExplosive) { - info->OwnedStates[extra.DeathStart].Action = A_Explode; + info->OwnedStates[extra.DeathStart].Action = GET_ACTION(A_Explode); } } else { // The first frame plays the death sound and // the second frame makes it nonsolid. - info->OwnedStates[extra.DeathStart].Action= A_Scream; + info->OwnedStates[extra.DeathStart].Action= GET_ACTION(A_Scream); if (extra.bSolidOnDeath) { } else if (extra.DeathStart + 1 < extra.DeathEnd) { - info->OwnedStates[extra.DeathStart+1].Action = A_NoBlocking; + info->OwnedStates[extra.DeathStart+1].Action = GET_ACTION(A_NoBlocking); } else { - info->OwnedStates[extra.DeathStart].Action = A_ScreamAndUnblock; + info->OwnedStates[extra.DeathStart].Action = GET_ACTION(A_ScreamAndUnblock); } if (extra.DeathHeight == 0) extra.DeathHeight = ((AActor*)(type->Defaults))->height; @@ -412,17 +412,17 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def) // The first frame plays the burn sound and // the second frame makes it nonsolid. - info->OwnedStates[extra.FireDeathStart].Action = A_ActiveSound; + info->OwnedStates[extra.FireDeathStart].Action = GET_ACTION(A_ActiveSound); if (extra.bSolidOnBurn) { } else if (extra.FireDeathStart + 1 < extra.FireDeathEnd) { - info->OwnedStates[extra.FireDeathStart+1].Action = A_NoBlocking; + info->OwnedStates[extra.FireDeathStart+1].Action = GET_ACTION(A_NoBlocking); } else { - info->OwnedStates[extra.FireDeathStart].Action = A_ActiveAndUnblock; + info->OwnedStates[extra.FireDeathStart].Action = GET_ACTION(A_ActiveAndUnblock); } if (extra.BurnHeight == 0) extra.BurnHeight = ((AActor*)(type->Defaults))->height; @@ -442,13 +442,13 @@ void ParseOldDecoration(FScanner &sc, EDefinitionType def) info->OwnedStates[i].NextState = &info->OwnedStates[info->NumOwnedStates-1]; info->OwnedStates[i].Tics = 5; info->OwnedStates[i].Misc1 = 0; - info->OwnedStates[i].Action = A_FreezeDeath; + info->OwnedStates[i].Action = GET_ACTION(A_FreezeDeath); i = info->NumOwnedStates - 1; info->OwnedStates[i].NextState = &info->OwnedStates[i]; info->OwnedStates[i].Tics = 1; info->OwnedStates[i].Misc1 = 0; - info->OwnedStates[i].Action = A_FreezeDeathChunks; + info->OwnedStates[i].Action = GET_ACTION(A_FreezeDeathChunks); AddState("Ice", &info->OwnedStates[extra.IceDeathStart]); } else if (extra.bGenericIceDeath) @@ -867,8 +867,8 @@ static void ParseSpriteFrames (FActorInfo *info, TArray &states, FScanne DEFINE_ACTION_FUNCTION(AActor, A_ScreamAndUnblock) { - A_Scream (self); - A_NoBlocking (self); + CALL_ACTION(A_Scream, self); + CALL_ACTION(A_NoBlocking, self); } //=========================================================================== @@ -879,8 +879,8 @@ DEFINE_ACTION_FUNCTION(AActor, A_ScreamAndUnblock) DEFINE_ACTION_FUNCTION(AActor, A_ActiveAndUnblock) { - A_ActiveSound (self); - A_NoBlocking (self); + CALL_ACTION(A_ActiveSound, self); + CALL_ACTION(A_NoBlocking, self); } //=========================================================================== diff --git a/src/thingdef/thingdef.h b/src/thingdef/thingdef.h index 8bef374cb..2ea1908a4 100644 --- a/src/thingdef/thingdef.h +++ b/src/thingdef/thingdef.h @@ -130,8 +130,6 @@ bool EvalExpressionN (int id, AActor *self, const PClass *cls=NULL); extern FState * CallingState; int CheckIndex(int paramsize, FState ** pcallstate=NULL); -void A_Explode(AActor * self); - enum { ACMETA_BASE = 0x83000, @@ -166,19 +164,19 @@ enum EDefinitionType #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) -*/ + +// Macros to handle action functions. These are here so that I don't have to +// change every single use in case the parameters change. +#define DECLARE_ACTION(name) void AF_##name(AActor *self); #define DEFINE_ACTION_FUNCTION(cls, name) \ - void name (AActor *); \ - AFuncDesc info_##cls##_##name = { #name, name }; \ + void AF_##name (AActor *); \ + AFuncDesc info_##cls##_##name = { #name, AF_##name }; \ MSVC_ASEG AFuncDesc *infoptr_##cls##_##name GCC_ASEG = &info_##cls##_##name; \ - void name (AActor *self) + void AF_##name (AActor *self) + +#define CALL_ACTION(name,self) AF_##name(self) +#define GET_ACTION(name) AF_##name #define ACTION_PARAM_START(count) \ int index = CheckIndex(count); \ diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index f0dc06464..13e7d00f0 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -2012,9 +2012,9 @@ DEFINE_ACTION_FUNCTION(AActor, A_Burst) // [RH] Do some stuff to make this more useful outside Hexen if (self->flags4 & MF4_BOSSDEATH) { - A_BossDeath (self); + CALL_ACTION(A_BossDeath, self); } - A_NoBlocking (self); + CALL_ACTION(A_NoBlocking, self); self->Destroy (); } diff --git a/src/thingdef/thingdef_states.cpp b/src/thingdef/thingdef_states.cpp index f5feb674b..43f57a1fa 100644 --- a/src/thingdef/thingdef_states.cpp +++ b/src/thingdef/thingdef_states.cpp @@ -58,6 +58,8 @@ TArray StateParameters; TArray JumpParameters; +static TArray AFTable; +static TArray StateArray; //========================================================================== // @@ -65,10 +67,7 @@ TArray JumpParameters; // //========================================================================== -static TArray AFTable; - - -static TArray StateArray; +DECLARE_ACTION(A_CallSpecial) //========================================================================== // @@ -415,7 +414,7 @@ bool DoActionSpecials(FScanner &sc, FState & state, bool multistate, int * state { sc.ScriptError ("Too many arguments to %s", specname.GetChars()); } - state.Action = A_CallSpecial; + state.Action = GET_ACTION(A_CallSpecial); return true; } return false;