CLIENT/SERVER: Enable sprint bobbing for FTE

This commit is contained in:
Steam Deck User 2023-03-06 13:56:59 -05:00
parent ab0d4315ba
commit 6651566aad
3 changed files with 52 additions and 27 deletions

View file

@ -250,12 +250,29 @@ void() Update_Vmodel =
return; return;
} }
//Walk bob //
if (getstatf(STAT_WEAPONZOOM)) { //ADS bob // View Bobbing Factors.
//
// ADS
if (getstatf(STAT_WEAPONZOOM) && getstatf(STAT_WEAPONZOOM) != 3) {
weapon_bob_factor = '0 0 0'; weapon_bob_factor = '0 0 0';
dampening_factor = weapon_bob_factor; dampening_factor = weapon_bob_factor;
weapon_bob_factor_z_coef = 0; weapon_bob_factor_z_coef = 0;
} else if (K_FORWARDDOWN || K_BACKDOWN || K_LEFTDOWN || K_RIGHTDOWN && !getstatf(STAT_WEAPONZOOM)) { }
// SPRINT
else if (getstatf(STAT_WEAPONZOOM) == 3) {
weapon_bob_factor_x = 2;
weapon_bob_factor_y = 8;
weapon_bob_factor_z = 12;
weapon_bob_factor_z_coef = 1;
dampening_factor_x = sin(cltime*weapon_bob_factor_x);
dampening_factor_y = 9*cos(cltime*weapon_bob_factor_y);
dampening_factor_z = 0.1*sin(cltime*weapon_bob_factor_z);
}
// WALK
else if (K_FORWARDDOWN || K_BACKDOWN || K_LEFTDOWN || K_RIGHTDOWN && !getstatf(STAT_WEAPONZOOM)) {
weapon_bob_factor_x = 8; weapon_bob_factor_x = 8;
weapon_bob_factor_y = 8; weapon_bob_factor_y = 8;
weapon_bob_factor_z = 13.4; weapon_bob_factor_z = 13.4;
@ -264,7 +281,21 @@ void() Update_Vmodel =
dampening_factor_x = 0.2*sin(cltime*weapon_bob_factor_x); dampening_factor_x = 0.2*sin(cltime*weapon_bob_factor_x);
dampening_factor_y = 0.2*cos(cltime*weapon_bob_factor_y); dampening_factor_y = 0.2*cos(cltime*weapon_bob_factor_y);
dampening_factor_z = 0.2*sin(cltime*weapon_bob_factor_z); dampening_factor_z = 0.2*sin(cltime*weapon_bob_factor_z);
} else if (!getstatf(STAT_WEAPONZOOM)){ //Still bob }
// STILL
else if (!getstatf(STAT_WEAPONZOOM)) {
// HACK HACK
if (weapon_bob_factor_z == 12) {
weapon_bob_factor_x = 8;
weapon_bob_factor_y = 8;
weapon_bob_factor_z = 13.4;
weapon_bob_factor_z_coef = 0.2;
dampening_factor_x = 0.2*sin(cltime*weapon_bob_factor_x);
dampening_factor_y = 0.2*cos(cltime*weapon_bob_factor_y);
dampening_factor_z = 0.2*sin(cltime*weapon_bob_factor_z);
}
// Naievil -- stupid ass calcs... // Naievil -- stupid ass calcs...
// Basically we have a dampening factor per offset and we have to decrease it back down to zero // Basically we have a dampening factor per offset and we have to decrease it back down to zero
@ -411,10 +442,18 @@ void() Update_Vmodel =
//black ops -0.01 till -0.6 (looks better) //black ops -0.01 till -0.6 (looks better)
if (K_BACKDOWN || K_FORWARDDOWN) { if (K_BACKDOWN || K_FORWARDDOWN) {
vzaccel -= 0.01; if (ads == 3) {
vzaccel -= 0.1;
if (vzaccel < -1.2)
vzaccel = -1.2;
} else {
vzaccel -= 0.01;
if (vzaccel < -0.6)
vzaccel = -0.6;
}
if (vzaccel < -0.6)
vzaccel = -0.6;
} else if (vzaccel != 0) { } else if (vzaccel != 0) {
if (vzaccel > 0) if (vzaccel > 0)
vzaccel -= 0.02; vzaccel -= 0.02;

View file

@ -223,10 +223,10 @@ void() PlayerPreThink =
#ifdef FTE #ifdef FTE
if (self.viewzoom > 0.98) if (self.viewzoom > 0.97)
self.viewzoom -= 0.015; self.viewzoom -= 0.015;
else if (self.viewzoom < 0.98) else if (self.viewzoom < 0.97)
self.viewzoom = 0.98; self.viewzoom = 0.97;
// viewbob when running // viewbob when running
self.punchangle_y = 0.25*sin(time*10); self.punchangle_y = 0.25*sin(time*10);

View file

@ -133,13 +133,8 @@ void() W_SprintStop =
if (self.isBuying || !self.sprinting) if (self.isBuying || !self.sprinting)
return; return;
#ifndef FTE
self.zoom = 0; self.zoom = 0;
#endif // FTE
Set_W_Frame (startframe, endframe, 0, 0, SPRINT, SUB_Null, modelname, false, S_BOTH); // BUG IS HERE Set_W_Frame (startframe, endframe, 0, 0, SPRINT, SUB_Null, modelname, false, S_BOTH); // BUG IS HERE
self.sprinting = 0; self.sprinting = 0;
@ -181,12 +176,8 @@ void W_SprintStart () {
float endframe = GetFrame(self.weapon,SPRINT_IN_END); float endframe = GetFrame(self.weapon,SPRINT_IN_END);
string modelname = GetWeaponModel(self.weapon, 0); string modelname = GetWeaponModel(self.weapon, 0);
#ifndef FTE
self.zoom = 3; self.zoom = 3;
#endif // FTE
if (startframe || endframe) { if (startframe || endframe) {
Set_W_Frame (startframe, endframe, 0, 0, SPRINT, ContinueRun, modelname, false, S_BOTH); Set_W_Frame (startframe, endframe, 0, 0, SPRINT, ContinueRun, modelname, false, S_BOTH);
} }
@ -486,13 +477,6 @@ void(float side) W_Reload =
return; return;
} }
//TEMPORARY
#ifdef FTE
self.viewzoom = 1;
#endif // FTE
self.zoom = false; self.zoom = false;
W_AimOut(); W_AimOut();
@ -2497,7 +2481,9 @@ void () Weapon_Logic =
// Don't stop aiming until the camera is restored // Don't stop aiming until the camera is restored
if (self.viewzoom >= 1) { if (self.viewzoom >= 1) {
self.viewzoom = 1; self.viewzoom = 1;
self.zoom = 0;
if (self.zoom != 3)
self.zoom = 0;
} }
#else #else