SERVER: Implement hold fire frame for Flamethrower

This commit is contained in:
Steam Deck User 2023-03-22 12:22:30 -04:00
parent 065c369600
commit 02d585ab5a
3 changed files with 49 additions and 34 deletions

View file

@ -1204,8 +1204,8 @@ void(float side) W_Fire =
return; return;
} }
float startframe; float startframe = 0;
float endframe; float endframe = 0;
float firetype; float firetype;
float damage; float damage;
float shotcount; float shotcount;
@ -1331,12 +1331,16 @@ void(float side) W_Fire =
} }
// Play weapon animation and sound // Play weapon animation and sound
if (self.zoom && GetFrame(self.weapon, AIM_FIRE_START) != 0) { if (GetFrame(self.weapon, FIRE_HOLD) == 0) {
startframe = GetFrame(self.weapon, AIM_FIRE_START); if (self.zoom && GetFrame(self.weapon, AIM_FIRE_START) != 0) {
endframe = GetFrame(self.weapon, AIM_FIRE_END); 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 { } else {
startframe = GetFrame(self.weapon, FIRE_START); startframe = endframe = GetFrame(self.weapon, FIRE_HOLD);
endframe = GetFrame(self.weapon, FIRE_END);
} }
// Increment the amount of shots fired while downed // Increment the amount of shots fired while downed
@ -2168,7 +2172,14 @@ void() CheckPlayer =
void () Weapon_Logic = 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(); Impulse_Functions();
#ifndef FTE #ifndef FTE
@ -2213,6 +2224,11 @@ void () Weapon_Logic =
if (IsDualWeapon(self.weapon)) { self.semi2 = false; } else { self.semi = false; } 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 #else
self.semi = false; self.semi = false;

View file

@ -143,29 +143,30 @@ const float EVENT_WEAPONRECOIL = 40;
#define BASE_FRAME 1 // The frame the Weapon idles at #define BASE_FRAME 1 // The frame the Weapon idles at
#define FIRE_START 2 // Start of firing animation #define FIRE_START 2 // Start of firing animation
#define FIRE_END 3 // End of firing animation #define FIRE_HOLD 3 // Stay on this frame while holding fire
#define RELOAD_START 4 // Start of normal (one-way) reloads #define FIRE_END 4 // End of firing animation
#define RELOAD_END 5 // End of normal (one-way) reloads #define RELOAD_START 5 // Start of normal (one-way) reloads
#define RELOAD_EMPTY_START 6 // Start of empty reloading #define RELOAD_END 6 // End of normal (one-way) reloads
#define RELOAD_EMPTY_END 7 // End of empty reloading #define RELOAD_EMPTY_START 7 // Start of empty reloading
#define RELOAD_PART_START 8 // Start of partial full reloading #define RELOAD_EMPTY_END 8 // End of empty reloading
#define RELOAD_PART_END 9 // End of partial full reloading #define RELOAD_PART_START 9 // Start of partial full reloading
#define SPRINT_IN_START 12 // Start of preparation to sprint #define RELOAD_PART_END 10 // End of partial full reloading
#define SPRINT_IN_END 13 // End of preparation to sprint #define SPRINT_IN_START 11 // Start of preparation to sprint
#define SPRINT_START 10 // Start of sprint loop #define SPRINT_IN_END 12 // End of preparation to sprint
#define SPRINT_END 11 // End of sprint loop #define SPRINT_START 13 // Start of sprint loop
#define SPRINT_OUT_START 14 // Start of sprint stop #define SPRINT_END 14 // End of sprint loop
#define SPRINT_OUT_END 15 // End of sprint stop #define SPRINT_OUT_START 15 // Start of sprint stop
#define TAKE_OUT_START 16 // Start of taking out weapon #define SPRINT_OUT_END 16 // End of sprint stop
#define TAKE_OUT_END 17 // End of taking out weapon #define TAKE_OUT_START 17 // Start of taking out weapon
#define FIRST_TAKE_START 18 // The "first raise" (first time weapon is taken) #define TAKE_OUT_END 18 // End of taking out weapon
#define FIRST_TAKE_END 19 // End of "first raise" #define FIRST_TAKE_START 19 // The "first raise" (first time weapon is taken)
#define PUT_OUT_START 20 // Start of putting away weapon #define FIRST_TAKE_END 20 // End of "first raise"
#define PUT_OUT_END 21 // End of putting away weapon #define PUT_OUT_START 21 // Start of putting away weapon
#define RELOAD_CANCEL 22 // Frame where mag variable is filled #define PUT_OUT_END 22 // End of putting away weapon
#define AIM_IN 23 // Frame to snap to when in ADS (optional) #define RELOAD_CANCEL 23 // Frame where mag variable is filled
#define AIM_FIRE_START 24 // Start of firing while ADS (optional) #define AIM_IN 24 // Frame to snap to when in ADS (optional)
#define AIM_FIRE_END 25 // End of firing while 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 //Animation types
#define RELOAD 1 #define RELOAD 1

View file

@ -2056,9 +2056,7 @@ float(float wep, float frametype, optional float z) GetFrame =
case W_M2: case W_M2:
switch (frametype) switch (frametype)
{ {
case FIRE_START: case FIRE_HOLD:
return 1;
case FIRE_END:
return 3; return 3;
case SPRINT_IN_START: case SPRINT_IN_START:
return 17; return 17;