mirror of
https://github.com/nzp-team/quakec.git
synced 2024-11-25 21:31:28 +00:00
SERVER: Adds support for ADS framing, use it for Panzerschreck
This commit is contained in:
parent
63c759e217
commit
92b464b424
3 changed files with 27 additions and 22 deletions
|
@ -66,15 +66,21 @@ void() W_AimIn =
|
|||
{
|
||||
if (self.weapon == W_TESLA || self.weapon == W_DG3)
|
||||
return;
|
||||
|
||||
|
||||
if (IsDualWeapon(self.weapon) ||
|
||||
self.zoom ||
|
||||
self.reload_delay > time ||
|
||||
self.sprinting ||
|
||||
self.new_anim_stop ||
|
||||
self.weapon == W_BK) {
|
||||
return;
|
||||
}
|
||||
|
||||
float ads_frame = GetFrame(self.weapon, AIM_IN);
|
||||
if (ads_frame != 0 && self.fire_delay < time) {
|
||||
self.weaponframe_end = self.weaponframe = ads_frame;
|
||||
} else if (self.zoom) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef FTE
|
||||
|
||||
|
@ -1506,9 +1512,14 @@ void(float side) W_Fire =
|
|||
default: break;
|
||||
}
|
||||
|
||||
//Play weapon animation and sound
|
||||
startframe = GetFrame(self.weapon,FIRE_START);
|
||||
endframe = GetFrame(self.weapon,FIRE_END);
|
||||
// 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);
|
||||
} else {
|
||||
startframe = GetFrame(self.weapon, FIRE_START);
|
||||
endframe = GetFrame(self.weapon, FIRE_END);
|
||||
}
|
||||
|
||||
// Increment the amount of shots fired while downed
|
||||
if (self.downed == true)
|
||||
|
@ -2440,13 +2451,11 @@ void () Weapon_Logic =
|
|||
|
||||
}
|
||||
} else {
|
||||
if (!self.zoom) {
|
||||
W_AimIn();
|
||||
}
|
||||
W_AimIn();
|
||||
|
||||
#ifdef FTE
|
||||
|
||||
else {
|
||||
if (self.zoom) {
|
||||
if (self.weapon == W_KAR_SCOPE || self.weapon == W_PTRS ||
|
||||
self.weapon == W_HEADCRACKER || self.weapon == W_PENETRATOR) {
|
||||
if (self.scopetime >= time)
|
||||
|
@ -2493,7 +2502,7 @@ void () Weapon_Logic =
|
|||
float zoom_factor2 = 1 + (0.018 * GetWeaponZoomAmount(self.weapon)); // increase zoom factor
|
||||
float sigmoid_input2 = (zoom_factor2 - self.viewzoom) * 10; // adjust sigmoid input
|
||||
float sigmoid_output2 = 1 / (1 + exp(-sigmoid_input2)); // apply the sigmoid function
|
||||
float zoom_speed2 = 0.06 * (sigmoid_output2 + 0.5) * (frametime * 40); // adjust the zoom speed based on the sigmoid output
|
||||
float zoom_speed2 = 0.06 * (sigmoid_output2 + 0.5) * (frametime * 80); // adjust the zoom speed based on the sigmoid output
|
||||
|
||||
if (self.viewzoom < zoom_factor2) {
|
||||
self.viewzoom += zoom_speed2;
|
||||
|
|
|
@ -158,13 +158,9 @@ const float EVENT_WEAPONRECOIL = 40;
|
|||
#define PUT_OUT_START 18 // Start of putting away weapon
|
||||
#define PUT_OUT_END 19 // End of putting away weapon
|
||||
#define RELOAD_CANCEL 20 // Frame where mag variable is filled
|
||||
#define AIM_IN_START 30 // Start of animation-based ADS
|
||||
#define AIM_IN_END 31 // End of animation-based ADS
|
||||
#define AIM_LOOP 33 // ADS stuck loop frame
|
||||
#define AIM_OUT_START 34 // Start of ADS end
|
||||
#define AIM_OUT_END 35 // End of ADS end
|
||||
#define AIM_FIRE_START 36 // Start of firing while ADS
|
||||
#define AIM_FIRE_END 37 // End of firing while ADS
|
||||
#define AIM_IN 30 // Frame to snap to when in ADS (optional)
|
||||
#define AIM_FIRE_START 31 // Start of firing while ADS (optional)
|
||||
#define AIM_FIRE_END 32 // End of firing while ADS (optional)
|
||||
|
||||
//Animation types
|
||||
#define RELOAD 1
|
||||
|
|
|
@ -2114,8 +2114,12 @@ float(float wep, float frametype, optional float z) GetFrame =
|
|||
return 33;
|
||||
case RELOAD_CANCEL:
|
||||
return 18;
|
||||
case AIM_IN_END:
|
||||
case AIM_IN:
|
||||
return 2;
|
||||
case AIM_FIRE_START:
|
||||
return 3;
|
||||
case AIM_FIRE_END:
|
||||
return 5;
|
||||
}
|
||||
break;
|
||||
case W_PPSH:
|
||||
|
@ -2308,10 +2312,6 @@ float(float wep, float frametype, optional float z) GetFrame =
|
|||
return 38;
|
||||
case RELOAD_CANCEL:
|
||||
return 16;
|
||||
case AIM_IN_END:
|
||||
return 28;
|
||||
case AIM_IN_START:
|
||||
return 27;
|
||||
}
|
||||
break;
|
||||
case W_TESLA:
|
||||
|
|
Loading…
Reference in a new issue