fixed Sniper Rilfle zoom when using FOV higher than 60%

Removing the scaling entirely beraks Sniper Rifle zoom. So: we're switching back to FOV Scaling, but now it'll be based on `PLAYER_DEFAULT_FOV` instead of `60.0f`. This now ensures tha
This commit is contained in:
AL2009man committed 2025-05-16 19:26:46 -04:00
1 parent cdd116830d
commit d8aefc33fc
1 file changed
+88 -87
+88 -87
View File
@@ -328,113 +328,114 @@ void bmoveUpdateSpeedTheta(void)
f32 bmoveGetSpeedVertaLimit(f32 value)
{
if (value > 0) {
return(value * -0.7f);
}
if (value < 0) {
return(-value * 0.7f);
}
return 0;
if (value > 0) {
return (viGetFovY() * value * -0.7f) / PLAYER_DEFAULT_FOV;
}
if (value < 0) {
return (viGetFovY() * -value * 0.7f) / PLAYER_DEFAULT_FOV;
}
return 0;
}
void bmoveUpdateSpeedVerta(f32 value)
{
f32 mult = 1.0f;
f32 limit = bmoveGetSpeedVertaLimit(value);
f32 mult = viGetFovY() / PLAYER_DEFAULT_FOV;
f32 limit = bmoveGetSpeedVertaLimit(value);
if (value > 0) {
if (g_Vars.currentplayer->speedverta > 0) {
g_Vars.currentplayer->speedverta -= 0.05f * g_Vars.lvupdate60freal * mult;
}
else {
g_Vars.currentplayer->speedverta -= 0.0125f * g_Vars.lvupdate60freal * mult;
}
if (g_Vars.currentplayer->speedverta < limit) {
g_Vars.currentplayer->speedverta = limit;
}
if (value > 0) {
if (g_Vars.currentplayer->speedverta > 0) {
g_Vars.currentplayer->speedverta -= 0.05f * g_Vars.lvupdate60freal * mult;
} else {
g_Vars.currentplayer->speedverta -= 0.0125f * g_Vars.lvupdate60freal * mult;
}
else if (value < 0) {
if (g_Vars.currentplayer->speedverta < 0) {
g_Vars.currentplayer->speedverta += 0.05f * g_Vars.lvupdate60freal * mult;
}
else {
g_Vars.currentplayer->speedverta += 0.0125f * g_Vars.lvupdate60freal * mult;
}
if (g_Vars.currentplayer->speedverta > limit) {
g_Vars.currentplayer->speedverta = limit;
}
if (g_Vars.currentplayer->speedverta < limit) {
g_Vars.currentplayer->speedverta = limit;
}
else {
if (g_Vars.currentplayer->speedverta > limit) {
g_Vars.currentplayer->speedverta -= 0.05f * g_Vars.lvupdate60freal * mult;
if (g_Vars.currentplayer->speedverta < limit) {
g_Vars.currentplayer->speedverta = limit;
}
}
else {
g_Vars.currentplayer->speedverta += 0.05f * g_Vars.lvupdate60freal * mult;
if (g_Vars.currentplayer->speedverta > limit) {
g_Vars.currentplayer->speedverta = limit;
}
}
} else if (value < 0) {
if (g_Vars.currentplayer->speedverta < 0) {
g_Vars.currentplayer->speedverta += 0.05f * g_Vars.lvupdate60freal * mult;
} else {
g_Vars.currentplayer->speedverta += 0.0125f * g_Vars.lvupdate60freal * mult;
}
if (g_Vars.currentplayer->speedverta > limit) {
g_Vars.currentplayer->speedverta = limit;
}
} else {
if (g_Vars.currentplayer->speedverta > limit) {
g_Vars.currentplayer->speedverta -= 0.05f * g_Vars.lvupdate60freal * mult;
if (g_Vars.currentplayer->speedverta < limit) {
g_Vars.currentplayer->speedverta = limit;
}
} else {
g_Vars.currentplayer->speedverta += 0.05f * g_Vars.lvupdate60freal * mult;
if (g_Vars.currentplayer->speedverta > limit) {
g_Vars.currentplayer->speedverta = limit;
}
}
}
}
f32 bmoveGetSpeedThetaControlLimit(f32 value)
{
if (value > 0) {
return(value * -0.7f);
}
if (value < 0) {
return(-value * 0.7f);
}
return 0;
if (value > 0) {
return (viGetFovY() * value * -0.7f) / PLAYER_DEFAULT_FOV;
}
if (value < 0) {
return (viGetFovY() * -value * 0.7f) / PLAYER_DEFAULT_FOV;
}
return 0;
}
void bmoveUpdateSpeedThetaControl(f32 value)
{
f32 mult = 1.0f;
f32 limit = bmoveGetSpeedThetaControlLimit(value);
f32 mult = viGetFovY() / PLAYER_DEFAULT_FOV;
f32 limit = bmoveGetSpeedThetaControlLimit(value);
if (value > 0) {
if (g_Vars.currentplayer->speedthetacontrol > 0) {
g_Vars.currentplayer->speedthetacontrol -= 0.05f * g_Vars.lvupdate60freal * mult;
}
else {
g_Vars.currentplayer->speedthetacontrol -= 0.0125f * g_Vars.lvupdate60freal * mult;
}
if (g_Vars.currentplayer->speedthetacontrol < limit) {
g_Vars.currentplayer->speedthetacontrol = limit;
}
if (value > 0) {
if (g_Vars.currentplayer->speedthetacontrol > 0) {
g_Vars.currentplayer->speedthetacontrol -= 0.05f * g_Vars.lvupdate60freal * mult;
} else {
g_Vars.currentplayer->speedthetacontrol -= 0.0125f * g_Vars.lvupdate60freal * mult;
}
else if (value < 0) {
if (g_Vars.currentplayer->speedthetacontrol < 0.0f) {
g_Vars.currentplayer->speedthetacontrol += 0.05f * g_Vars.lvupdate60freal * mult;
}
else {
g_Vars.currentplayer->speedthetacontrol += 0.0125f * g_Vars.lvupdate60freal * mult;
}
if (g_Vars.currentplayer->speedthetacontrol > limit) {
g_Vars.currentplayer->speedthetacontrol = limit;
}
if (g_Vars.currentplayer->speedthetacontrol < limit) {
g_Vars.currentplayer->speedthetacontrol = limit;
}
else {
if (g_Vars.currentplayer->speedthetacontrol > limit) {
g_Vars.currentplayer->speedthetacontrol -= 0.05f * g_Vars.lvupdate60freal * mult;
if (g_Vars.currentplayer->speedthetacontrol < limit) {
g_Vars.currentplayer->speedthetacontrol = limit;
}
}
else {
g_Vars.currentplayer->speedthetacontrol += 0.05f * g_Vars.lvupdate60freal * mult;
if (g_Vars.currentplayer->speedthetacontrol > limit) {
g_Vars.currentplayer->speedthetacontrol = limit;
}
}
} else if (value < 0) {
if (g_Vars.currentplayer->speedthetacontrol < 0.0f) {
g_Vars.currentplayer->speedthetacontrol += 0.05f * g_Vars.lvupdate60freal * mult;
} else {
g_Vars.currentplayer->speedthetacontrol += 0.0125f * g_Vars.lvupdate60freal * mult;
}
if (g_Vars.currentplayer->speedthetacontrol > limit) {
g_Vars.currentplayer->speedthetacontrol = limit;
}
} else {
if (g_Vars.currentplayer->speedthetacontrol > limit) {
g_Vars.currentplayer->speedthetacontrol -= 0.05f * g_Vars.lvupdate60freal * mult;
if (g_Vars.currentplayer->speedthetacontrol < limit) {
g_Vars.currentplayer->speedthetacontrol = limit;
}
} else {
g_Vars.currentplayer->speedthetacontrol += 0.05f * g_Vars.lvupdate60freal * mult;
if (g_Vars.currentplayer->speedthetacontrol > limit) {
g_Vars.currentplayer->speedthetacontrol = limit;
}
}
}
}
/**
* Calculate the lookahead angle.
*
@@ -2031,7 +2032,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
}
} else {
if (movedata.cannaturalpitch) {
tmp = 1.0f;
tmp = viGetFovY() / PLAYER_DEFAULT_FOV;
fVar25 = movedata.analogpitch / 70.0f;
if (fVar25 > 1) {
@@ -2072,7 +2073,7 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i
}
if (movedata.cannaturalturn) {
tmp = 1.0f;
tmp = viGetFovY() / PLAYER_DEFAULT_FOV;
fVar25 = movedata.analogturn / 70.0f;
if (fVar25 > 1) {