diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a57ae9c3a..06028ecff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -855,7 +855,6 @@ set( NOT_COMPILED_SOURCE_FILES ${OTHER_SYSTEM_SOURCES} sc_man_scanner.h sc_man_scanner.re - g_hexen/a_fighterquietus.cpp g_hexen/a_flechette.cpp g_hexen/a_flies.cpp g_hexen/a_healingradius.cpp diff --git a/src/g_hexen/a_fighterquietus.cpp b/src/g_hexen/a_fighterquietus.cpp deleted file mode 100644 index 458d1415b..000000000 --- a/src/g_hexen/a_fighterquietus.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* -#include "actor.h" -#include "gi.h" -#include "m_random.h" -#include "s_sound.h" -#include "d_player.h" -#include "a_action.h" -#include "p_local.h" -#include "p_pspr.h" -#include "gstrings.h" -#include "a_hexenglobal.h" -#include "a_weaponpiece.h" -#include "vm.h" -*/ - -static FRandom pr_quietusdrop ("QuietusDrop"); -static FRandom pr_fswordflame ("FSwordFlame"); - -//========================================================================== - -//============================================================================ -// -// A_DropQuietusPieces -// -//============================================================================ - -DEFINE_ACTION_FUNCTION(AActor, A_DropWeaponPieces) -{ - PARAM_SELF_PROLOGUE(AActor); - PARAM_CLASS(p1, AActor); - PARAM_CLASS(p2, AActor); - PARAM_CLASS(p3, AActor); - - for (int i = 0, j = 0; i < 3; ++i) - { - PClassActor *cls = j == 0 ? p1 : j == 1 ? p2 : p3; - if (cls) - { - AActor *piece = Spawn (cls, self->Pos(), ALLOW_REPLACE); - if (piece != NULL) - { - piece->Vel = self->Vel + DAngle(i*120.).ToVector(1); - piece->flags |= MF_DROPPED; - j = (j == 0) ? (pr_quietusdrop() & 1) + 1 : 3-j; - } - } - } - return 0; -} - - - -// Fighter Sword Missile ---------------------------------------------------- - -class AFSwordMissile : public AActor -{ - DECLARE_CLASS (AFSwordMissile, AActor) -public: - int DoSpecialDamage(AActor *victim, int damage, FName damagetype); -}; - -IMPLEMENT_CLASS(AFSwordMissile, false, false) - -int AFSwordMissile::DoSpecialDamage(AActor *victim, int damage, FName damagetype) -{ - if (victim->player) - { - damage -= damage >> 2; - } - return damage; -} - -//============================================================================ -// -// A_FSwordAttack -// -//============================================================================ - -DEFINE_ACTION_FUNCTION(AActor, A_FSwordAttack) -{ - PARAM_ACTION_PROLOGUE(AActor); - - player_t *player; - - if (NULL == (player = self->player)) - { - return 0; - } - AWeapon *weapon = self->player->ReadyWeapon; - if (weapon != NULL) - { - if (!weapon->DepleteAmmo (weapon->bAltFire)) - return 0; - } - P_SpawnPlayerMissile (self, 0, 0, -10, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./4)); - P_SpawnPlayerMissile (self, 0, 0, -5, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45./8)); - P_SpawnPlayerMissile (self, 0, 0, 0, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw); - P_SpawnPlayerMissile (self, 0, 0, 5, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./8)); - P_SpawnPlayerMissile (self, 0, 0, 10, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45./4)); - S_Sound (self, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM); - return 0; -} - -//============================================================================ -// -// A_FSwordFlames -// -//============================================================================ - -DEFINE_ACTION_FUNCTION(AActor, A_FSwordFlames) -{ - PARAM_SELF_PROLOGUE(AActor); - - int i; - - for (i = 1+(pr_fswordflame()&3); i; i--) - { - double xo = (pr_fswordflame() - 128) / 16.; - double yo = (pr_fswordflame() - 128) / 16.; - double zo = (pr_fswordflame() - 128) / 8.; - Spawn ("FSwordFlame", self->Vec3Offset(xo, yo, zo), ALLOW_REPLACE); - } - return 0; -} - -//============================================================================ -// -// A_FighterAttack -// -//============================================================================ - -DEFINE_ACTION_FUNCTION(AActor, A_FighterAttack) -{ - PARAM_SELF_PROLOGUE(AActor); - - if (!self->target) return 0; - - P_SpawnMissileAngle(self, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45. / 4), 0); - P_SpawnMissileAngle(self, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw + (45. / 8), 0); - P_SpawnMissileAngle(self, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw, 0); - P_SpawnMissileAngle(self, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45. / 8), 0); - P_SpawnMissileAngle(self, RUNTIME_CLASS(AFSwordMissile), self->Angles.Yaw - (45. / 4), 0); - S_Sound (self, CHAN_WEAPON, "FighterSwordFire", 1, ATTN_NORM); - return 0; -} - diff --git a/src/g_hexen/a_hexenmisc.cpp b/src/g_hexen/a_hexenmisc.cpp index 49c1369b3..e00b72583 100644 --- a/src/g_hexen/a_hexenmisc.cpp +++ b/src/g_hexen/a_hexenmisc.cpp @@ -24,7 +24,6 @@ #include "serializer.h" // Include all the Hexen stuff here to reduce compile time -#include "a_fighterquietus.cpp" #include "a_flechette.cpp" #include "a_flies.cpp" #include "a_healingradius.cpp" diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 34d74760c..0adc0f1eb 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -688,7 +688,6 @@ class Actor : Thinker native native void A_DropFire(); native void A_GiveQuestItem(int itemno); native void A_RemoveForcefield(); - native void A_DropWeaponPieces(class p1, class p2, class p3); native void A_SetAngle(double angle = 0, int flags = 0, int ptr = AAPTR_DEFAULT); native void A_SetPitch(double pitch, int flags = 0, int ptr = AAPTR_DEFAULT); native void A_SetRoll(double roll, int flags = 0, int ptr = AAPTR_DEFAULT); diff --git a/wadsrc/static/zscript/hexen/baseweapons.txt b/wadsrc/static/zscript/hexen/baseweapons.txt index 4c84ed780..b7e2bd398 100644 --- a/wadsrc/static/zscript/hexen/baseweapons.txt +++ b/wadsrc/static/zscript/hexen/baseweapons.txt @@ -61,4 +61,24 @@ extend class Actor angle = t.angleFromSource; } } + + //============================================================================ + // + // A_DropQuietusPieces + // + //============================================================================ + + void A_DropWeaponPieces(class p1, class p2, class p3) + { + for (int i = 0, j = 0; i < 3; ++i) + { + Actor piece = Spawn (j == 0 ? p1 : j == 1 ? p2 : p3, Pos, ALLOW_REPLACE); + if (piece != null) + { + piece.Vel = self.Vel + AngleToVector(i * 120., 1); + piece.bDropped = true; + j = (j == 0) ? (random[PieceDrop]() & 1) + 1 : 3-j; + } + } + } } \ No newline at end of file diff --git a/wadsrc/static/zscript/hexen/fighterboss.txt b/wadsrc/static/zscript/hexen/fighterboss.txt index 8e862de30..9871cf571 100644 --- a/wadsrc/static/zscript/hexen/fighterboss.txt +++ b/wadsrc/static/zscript/hexen/fighterboss.txt @@ -19,8 +19,6 @@ class FighterBoss : Actor Obituary "$OB_FBOSS"; } - native void A_FighterAttack(); - States { Spawn: @@ -80,4 +78,22 @@ class FighterBoss : Actor FDTH V 4 Bright; Stop; } + + //============================================================================ + // + // A_FighterAttack + // + //============================================================================ + + void A_FighterAttack() + { + if (!target) return; + + SpawnMissileAngle("FSwordMissile", Angle + (45. / 4), 0); + SpawnMissileAngle("FSwordMissile", Angle + (45. / 8), 0); + SpawnMissileAngle("FSwordMissile", Angle, 0); + SpawnMissileAngle("FSwordMissile", Angle - (45. / 8), 0); + SpawnMissileAngle("FSwordMissile", Angle - (45. / 4), 0); + A_PlaySound ("FighterSwordFire", CHAN_WEAPON); + } } diff --git a/wadsrc/static/zscript/hexen/fighterquietus.txt b/wadsrc/static/zscript/hexen/fighterquietus.txt index 7c94f7901..53388eece 100644 --- a/wadsrc/static/zscript/hexen/fighterquietus.txt +++ b/wadsrc/static/zscript/hexen/fighterquietus.txt @@ -97,8 +97,6 @@ class FWeapQuietus : FighterWeapon Tag "$TAG_FWEAPQUIETUS"; } - action native void A_FSwordAttack(); - States { Spawn: @@ -127,11 +125,40 @@ class FWeapQuietus : FighterWeapon FSRD B 1 Bright Offset (5, 40); Goto Ready; } + + //============================================================================ + // + // A_FSwordAttack + // + //============================================================================ + + action void A_FSwordAttack() + { + if (player == null) + { + return; + } + + Weapon weapon = player.ReadyWeapon; + if (weapon != null) + { + if (!weapon.DepleteAmmo (weapon.bAltFire)) + return; + } + SpawnPlayerMissile ("FSwordMissile", Angle + (45./4),0, 0, -10); + SpawnPlayerMissile ("FSwordMissile", Angle + (45./8),0, 0, -5); + SpawnPlayerMissile ("FSwordMissile", Angle ,0, 0, 0); + SpawnPlayerMissile ("FSwordMissile", Angle - (45./8),0, 0, 5); + SpawnPlayerMissile ("FSwordMissile", Angle - (45./4),0, 0, 10); + A_PlaySound ("FighterSwordFire", CHAN_WEAPON); + } + + } // Fighter Sword Missile ---------------------------------------------------- -class FSwordMissile : Actor native +class FSwordMissile : Actor { Default { @@ -146,8 +173,6 @@ class FSwordMissile : Actor native Obituary "$OB_MPFWEAPQUIETUS"; } - native void A_FSwordFlames(); - States { Spawn: @@ -164,6 +189,32 @@ class FSwordMissile : Actor native FSFX KLM 3 Bright; Stop; } + + override int DoSpecialDamage(Actor victim, int damage, Name damagetype) + { + if (victim.player) + { + damage -= damage >> 2; + } + return damage; + } + + //============================================================================ + // + // A_FSwordFlames + // + //============================================================================ + + void A_FSwordFlames() + { + for (int i = 1+(random[FSwordFlame]()&3); i; i--) + { + double xo = (random[FSwordFlame]() - 128) / 16.; + double yo = (random[FSwordFlame]() - 128) / 16.; + double zo = (random[FSwordFlame]() - 128) / 8.; + Spawn ("FSwordFlame", Vec3Offset(xo, yo, zo), ALLOW_REPLACE); + } + } } // Fighter Sword Flame ------------------------------------------------------