From 53318f4bdef9ce89a0495510b3cd44481319eafe Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 28 Nov 2016 15:51:07 +0100 Subject: [PATCH] - scriptified Reaver and Templar. --- src/CMakeLists.txt | 2 -- src/g_strife/a_reaver.cpp | 36 --------------------- src/g_strife/a_strifestuff.cpp | 2 -- src/g_strife/a_templar.cpp | 36 --------------------- wadsrc/static/zscript/strife/inquisitor.txt | 1 - wadsrc/static/zscript/strife/reaver.txt | 27 ++++++++++++++-- wadsrc/static/zscript/strife/sigil.txt | 2 +- wadsrc/static/zscript/strife/templar.txt | 18 ++++++++++- 8 files changed, 42 insertions(+), 82 deletions(-) delete mode 100644 src/g_strife/a_reaver.cpp delete mode 100644 src/g_strife/a_templar.cpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 211411f20..c5156cbf4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -867,13 +867,11 @@ set( NOT_COMPILED_SOURCE_FILES g_strife/a_loremaster.cpp g_strife/a_oracle.cpp g_strife/a_programmer.cpp - g_strife/a_reaver.cpp g_strife/a_rebels.cpp g_strife/a_sentinel.cpp g_strife/a_stalker.cpp g_strife/a_strifeitems.cpp g_strife/a_strifeweapons.cpp - g_strife/a_templar.cpp g_strife/a_thingstoblowup.cpp g_shared/sbarinfo_commands.cpp xlat/xlat_parser.y diff --git a/src/g_strife/a_reaver.cpp b/src/g_strife/a_reaver.cpp deleted file mode 100644 index 9c6e9f6b9..000000000 --- a/src/g_strife/a_reaver.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* -#include "actor.h" -#include "p_enemy.h" -#include "a_action.h" -#include "s_sound.h" -#include "m_random.h" -#include "p_local.h" -#include "a_strifeglobal.h" -#include "vm.h" -*/ - -static FRandom pr_reaverattack ("ReaverAttack"); - -DEFINE_ACTION_FUNCTION(AActor, A_ReaverRanged) -{ - PARAM_SELF_PROLOGUE(AActor); - - if (self->target != NULL) - { - DAngle bangle; - DAngle pitch; - - A_FaceTarget (self); - S_Sound (self, CHAN_WEAPON, "reaver/attack", 1, ATTN_NORM); - bangle = self->Angles.Yaw; - pitch = P_AimLineAttack (self, bangle, MISSILERANGE); - - for (int i = 0; i < 3; ++i) - { - DAngle angle = bangle + pr_reaverattack.Random2() * (22.5 / 256); - int damage = ((pr_reaverattack() & 7) + 1) * 3; - P_LineAttack (self, angle, MISSILERANGE, pitch, damage, NAME_Hitscan, NAME_StrifePuff); - } - } - return 0; -} diff --git a/src/g_strife/a_strifestuff.cpp b/src/g_strife/a_strifestuff.cpp index df89e614a..78ceaa097 100644 --- a/src/g_strife/a_strifestuff.cpp +++ b/src/g_strife/a_strifestuff.cpp @@ -31,13 +31,11 @@ //#include "a_macil.cpp" #include "a_oracle.cpp" #include "a_programmer.cpp" -#include "a_reaver.cpp" #include "a_rebels.cpp" #include "a_sentinel.cpp" #include "a_stalker.cpp" #include "a_strifeitems.cpp" #include "a_strifeweapons.cpp" -#include "a_templar.cpp" #include "a_thingstoblowup.cpp" // Notes so I don't forget them: diff --git a/src/g_strife/a_templar.cpp b/src/g_strife/a_templar.cpp deleted file mode 100644 index 0bfa00b24..000000000 --- a/src/g_strife/a_templar.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* -#include "actor.h" -#include "m_random.h" -#include "a_action.h" -#include "p_local.h" -#include "p_enemy.h" -#include "s_sound.h" -#include "a_strifeglobal.h" -#include "vm.h" -*/ - -static FRandom pr_templar ("Templar"); - -DEFINE_ACTION_FUNCTION(AActor, A_TemplarAttack) -{ - PARAM_SELF_PROLOGUE(AActor); - - int damage; - DAngle angle; - DAngle pitch; - - if (self->target == NULL) - return 0; - - S_Sound (self, CHAN_WEAPON, "templar/shoot", 1, ATTN_NORM); - A_FaceTarget (self); - pitch = P_AimLineAttack (self, self->Angles.Yaw, MISSILERANGE); - - for (int i = 0; i < 10; ++i) - { - damage = (pr_templar() & 4) * 2; - angle = self->Angles.Yaw + pr_templar.Random2() * (11.25 / 256); - P_LineAttack (self, angle, MISSILERANGE+64., pitch + pr_templar.Random2() * (7.097 / 256), damage, NAME_Hitscan, NAME_MaulerPuff); - } - return 0; -} diff --git a/wadsrc/static/zscript/strife/inquisitor.txt b/wadsrc/static/zscript/strife/inquisitor.txt index b27818a61..e7da303be 100644 --- a/wadsrc/static/zscript/strife/inquisitor.txt +++ b/wadsrc/static/zscript/strife/inquisitor.txt @@ -31,7 +31,6 @@ class Inquisitor : Actor native void A_InquisitorJump (); native void A_InquisitorCheckLand (); native void A_TossArm (); - native void A_ReaverRanged (); States { diff --git a/wadsrc/static/zscript/strife/reaver.txt b/wadsrc/static/zscript/strife/reaver.txt index 7656a37a9..d1c206b73 100644 --- a/wadsrc/static/zscript/strife/reaver.txt +++ b/wadsrc/static/zscript/strife/reaver.txt @@ -22,8 +22,6 @@ class Reaver : Actor Obituary "$OB_REAVER"; } - native void A_ReaverRanged (); - States { Spawn: @@ -64,4 +62,27 @@ class Reaver : Actor } } - \ No newline at end of file + +extend class Actor +{ + // The Inquisitor also uses this function + + void A_ReaverRanged () + { + if (target != null) + { + A_FaceTarget (); + A_PlaySound ("reaver/attack", CHAN_WEAPON); + double bangle = Angle; + double pitch = AimLineAttack (bangle, MISSILERANGE); + + for (int i = 0; i < 3; ++i) + { + double ang = bangle + Random2[ReaverAttack]() * (22.5 / 256); + int damage = ((random[ReaverAttack]() & 7) + 1) * 3; + LineAttack (ang, MISSILERANGE, pitch, damage, 'Hitscan', "StrifePuff"); + } + } + } + +} \ No newline at end of file diff --git a/wadsrc/static/zscript/strife/sigil.txt b/wadsrc/static/zscript/strife/sigil.txt index a9f802009..096915ccf 100644 --- a/wadsrc/static/zscript/strife/sigil.txt +++ b/wadsrc/static/zscript/strife/sigil.txt @@ -448,7 +448,7 @@ class Sigil : Weapon { "Sigil1", "Sigil2", "Sigil3", "Sigil4", "Sigil5" }; - sigl.Icon = GetDefaultByType(sigils[clamp(sigl.health, 1, 5)]).Icon; + sigl.Icon = GetDefaultByType(sigils[clamp(sigl.health, 1, 5)-1]).Icon; // If the player has the Sigil out, drop it and bring it back up. if (sigl.Owner.player != null && sigl.Owner.player.ReadyWeapon == sigl) { diff --git a/wadsrc/static/zscript/strife/templar.txt b/wadsrc/static/zscript/strife/templar.txt index 5b1605cf4..23290011c 100644 --- a/wadsrc/static/zscript/strife/templar.txt +++ b/wadsrc/static/zscript/strife/templar.txt @@ -25,7 +25,6 @@ class Templar : Actor Obituary "$OB_TEMPLAR"; DropItem "EnergyPod"; } - native void A_TemplarAttack(); States { @@ -64,5 +63,22 @@ class Templar : Actor PGRD \ -1; Stop; } + + void A_TemplarAttack() + { + if (target != null) + { + A_PlaySound ("templar/shoot", CHAN_WEAPON); + A_FaceTarget (); + double pitch = AimLineAttack (angle, MISSILERANGE); + + for (int i = 0; i < 10; ++i) + { + int damage = (random[Templar]() & 4) * 2; + double ang = angle + random2[Templar]() * (11.25 / 256); + LineAttack (ang, MISSILERANGE+64., pitch + random2[Templar]() * (7.097 / 256), damage, 'Hitscan', "MaulerPuff"); + } + } + } }