From 02d585ab5a2cd41e760f1e7af925fd4fd3ed103e Mon Sep 17 00:00:00 2001 From: Steam Deck User Date: Wed, 22 Mar 2023 12:22:30 -0400 Subject: [PATCH] SERVER: Implement hold fire frame for Flamethrower --- source/server/weapons/weapon_core.qc | 32 ++++++++++++++----- source/shared/defs/custom.qc | 47 ++++++++++++++-------------- source/shared/weapon_defines.qc | 4 +-- 3 files changed, 49 insertions(+), 34 deletions(-) diff --git a/source/server/weapons/weapon_core.qc b/source/server/weapons/weapon_core.qc index 8d65a52..41d8209 100644 --- a/source/server/weapons/weapon_core.qc +++ b/source/server/weapons/weapon_core.qc @@ -1204,8 +1204,8 @@ void(float side) W_Fire = return; } - float startframe; - float endframe; + float startframe = 0; + float endframe = 0; float firetype; float damage; float shotcount; @@ -1331,12 +1331,16 @@ void(float side) W_Fire = } // Play weapon animation and sound - if (self.zoom && GetFrame(self.weapon, AIM_FIRE_START) != 0) { - startframe = GetFrame(self.weapon, AIM_FIRE_START); - endframe = GetFrame(self.weapon, AIM_FIRE_END); + if (GetFrame(self.weapon, FIRE_HOLD) == 0) { + if (self.zoom && GetFrame(self.weapon, AIM_FIRE_START) != 0) { + startframe = GetFrame(self.weapon, AIM_FIRE_START); + endframe = GetFrame(self.weapon, AIM_FIRE_END); + } else { + startframe = GetFrame(self.weapon, FIRE_START); + endframe = GetFrame(self.weapon, FIRE_END); + } } else { - startframe = GetFrame(self.weapon, FIRE_START); - endframe = GetFrame(self.weapon, FIRE_END); + startframe = endframe = GetFrame(self.weapon, FIRE_HOLD); } // Increment the amount of shots fired while downed @@ -2168,7 +2172,14 @@ void() CheckPlayer = void () Weapon_Logic = { - W_Frame_Update (); + // HACK HACK: Don't let the frame updater take control of hold fire. + if (self.weaponframe == GetFrame(self.weapon, FIRE_HOLD) && GetFrame(self.weapon, FIRE_HOLD) != 0) { + + } else { + W_Frame_Update(); + } + + Impulse_Functions(); #ifndef FTE @@ -2213,6 +2224,11 @@ void () Weapon_Logic = if (IsDualWeapon(self.weapon)) { self.semi2 = false; } else { self.semi = false; } + // Hold fire weapons should get set back to base frame. + if (GetFrame(self.weapon, FIRE_HOLD) != 0 && self.weaponframe == GetFrame(self.weapon, FIRE_HOLD)) { + self.weaponframe = 0; + } + #else self.semi = false; diff --git a/source/shared/defs/custom.qc b/source/shared/defs/custom.qc index d80208e..b3eed8c 100644 --- a/source/shared/defs/custom.qc +++ b/source/shared/defs/custom.qc @@ -143,29 +143,30 @@ const float EVENT_WEAPONRECOIL = 40; #define BASE_FRAME 1 // The frame the Weapon idles at #define FIRE_START 2 // Start of firing animation -#define FIRE_END 3 // End of firing animation -#define RELOAD_START 4 // Start of normal (one-way) reloads -#define RELOAD_END 5 // End of normal (one-way) reloads -#define RELOAD_EMPTY_START 6 // Start of empty reloading -#define RELOAD_EMPTY_END 7 // End of empty reloading -#define RELOAD_PART_START 8 // Start of partial full reloading -#define RELOAD_PART_END 9 // End of partial full reloading -#define SPRINT_IN_START 12 // Start of preparation to sprint -#define SPRINT_IN_END 13 // End of preparation to sprint -#define SPRINT_START 10 // Start of sprint loop -#define SPRINT_END 11 // End of sprint loop -#define SPRINT_OUT_START 14 // Start of sprint stop -#define SPRINT_OUT_END 15 // End of sprint stop -#define TAKE_OUT_START 16 // Start of taking out weapon -#define TAKE_OUT_END 17 // End of taking out weapon -#define FIRST_TAKE_START 18 // The "first raise" (first time weapon is taken) -#define FIRST_TAKE_END 19 // End of "first raise" -#define PUT_OUT_START 20 // Start of putting away weapon -#define PUT_OUT_END 21 // End of putting away weapon -#define RELOAD_CANCEL 22 // Frame where mag variable is filled -#define AIM_IN 23 // Frame to snap to when in ADS (optional) -#define AIM_FIRE_START 24 // Start of firing while ADS (optional) -#define AIM_FIRE_END 25 // End of firing while ADS (optional) +#define FIRE_HOLD 3 // Stay on this frame while holding fire +#define FIRE_END 4 // End of firing animation +#define RELOAD_START 5 // Start of normal (one-way) reloads +#define RELOAD_END 6 // End of normal (one-way) reloads +#define RELOAD_EMPTY_START 7 // Start of empty reloading +#define RELOAD_EMPTY_END 8 // End of empty reloading +#define RELOAD_PART_START 9 // Start of partial full reloading +#define RELOAD_PART_END 10 // End of partial full reloading +#define SPRINT_IN_START 11 // Start of preparation to sprint +#define SPRINT_IN_END 12 // End of preparation to sprint +#define SPRINT_START 13 // Start of sprint loop +#define SPRINT_END 14 // End of sprint loop +#define SPRINT_OUT_START 15 // Start of sprint stop +#define SPRINT_OUT_END 16 // End of sprint stop +#define TAKE_OUT_START 17 // Start of taking out weapon +#define TAKE_OUT_END 18 // End of taking out weapon +#define FIRST_TAKE_START 19 // The "first raise" (first time weapon is taken) +#define FIRST_TAKE_END 20 // End of "first raise" +#define PUT_OUT_START 21 // Start of putting away weapon +#define PUT_OUT_END 22 // End of putting away weapon +#define RELOAD_CANCEL 23 // Frame where mag variable is filled +#define AIM_IN 24 // Frame to snap to when in ADS (optional) +#define AIM_FIRE_START 25 // Start of firing while ADS (optional) +#define AIM_FIRE_END 26 // End of firing while ADS (optional) //Animation types #define RELOAD 1 diff --git a/source/shared/weapon_defines.qc b/source/shared/weapon_defines.qc index fa87ad2..39bb9d0 100644 --- a/source/shared/weapon_defines.qc +++ b/source/shared/weapon_defines.qc @@ -2056,9 +2056,7 @@ float(float wep, float frametype, optional float z) GetFrame = case W_M2: switch (frametype) { - case FIRE_START: - return 1; - case FIRE_END: + case FIRE_HOLD: return 3; case SPRINT_IN_START: return 17;