diff --git a/port/src/main.c b/port/src/main.c index 2ae3ccc61..fa9e512bb 100644 --- a/port/src/main.c +++ b/port/src/main.c @@ -72,6 +72,7 @@ static void gameLoadConfig(void) g_PlayerMouseAimSpeedX = configGetFloatClamped("Game.MouseAimSpeedX", g_PlayerMouseAimSpeedX, 0.f, 10.f); g_PlayerMouseAimSpeedY = configGetFloatClamped("Game.MouseAimSpeedY", g_PlayerMouseAimSpeedY, 0.f, 10.f); g_PlayerFovAffectsZoom = configGetIntClamped("Game.FovAffectsZoom", g_PlayerFovAffectsZoom, 0, 1); + g_PlayerFovZoomMultiplier = g_PlayerFovAffectsZoom ? g_PlayerDefaultFovY / 60.0f : 1.0f; } int main(int argc, const char **argv) diff --git a/src/game/bondgunreset.c b/src/game/bondgunreset.c index f5ba9690c..ed301b20f 100644 --- a/src/game/bondgunreset.c +++ b/src/game/bondgunreset.c @@ -244,16 +244,9 @@ void bgunReset(void) g_Vars.currentplayer->gunzoomfovs[1] = 60; g_Vars.currentplayer->gunzoomfovs[2] = 30; #else - if (g_PlayerFovAffectsZoom) { - g_Vars.currentplayer->gunzoomfovs[0] = 15 * (g_PlayerDefaultFovY / 60.0f); - g_Vars.currentplayer->gunzoomfovs[1] = 60 * (g_PlayerDefaultFovY / 60.0f); - g_Vars.currentplayer->gunzoomfovs[2] = 30 * (g_PlayerDefaultFovY / 60.0f); - } - else { - g_Vars.currentplayer->gunzoomfovs[0] = 15; - g_Vars.currentplayer->gunzoomfovs[1] = 60; - g_Vars.currentplayer->gunzoomfovs[2] = 30; - } + g_Vars.currentplayer->gunzoomfovs[0] = 15 * g_PlayerFovZoomMultiplier; + g_Vars.currentplayer->gunzoomfovs[1] = 60 * g_PlayerFovZoomMultiplier; + g_Vars.currentplayer->gunzoomfovs[2] = 30 * g_PlayerFovZoomMultiplier; #endif if (stageGetIndex(g_Vars.stagenum) == STAGEINDEX_AIRBASE) { diff --git a/src/game/bondmove.c b/src/game/bondmove.c index 85465d78b..d01809f90 100644 --- a/src/game/bondmove.c +++ b/src/game/bondmove.c @@ -1710,15 +1710,8 @@ void bmoveProcessInput(bool allowc1x, bool allowc1y, bool allowc1buttons, bool i eraserfov = 2; } #else - if (g_PlayerFovAffectsZoom) { - if (eraserfov < 2 * (g_PlayerDefaultFovY / 60.0f)) { - eraserfov = 2 * (g_PlayerDefaultFovY / 60.0f); - } - } - else { - if (eraserfov < 2) { - eraserfov = 2; - } + if (eraserfov < 2 * g_PlayerFovZoomMultiplier) { + eraserfov = 2 * g_PlayerFovZoomMultiplier; } #endif diff --git a/src/game/game_0b0fd0.c b/src/game/game_0b0fd0.c index bb0937703..5840e0063 100644 --- a/src/game/game_0b0fd0.c +++ b/src/game/game_0b0fd0.c @@ -212,12 +212,7 @@ f32 currentPlayerGetGunZoomFov(void) #ifdef PLATFORM_N64 return fov; #else - if (g_PlayerFovAffectsZoom) { - return fov * (g_PlayerDefaultFovY / 60.0f); - } - else { - return fov; - } + return fov * g_PlayerFovZoomMultiplier; #endif } @@ -285,15 +280,8 @@ void currentPlayerZoomIn(f32 fovpersec) g_Vars.currentplayer->gunzoomfovs[index] = 2; } #else - if (g_PlayerFovAffectsZoom) { - if (g_Vars.currentplayer->gunzoomfovs[index] < 2 * (g_PlayerDefaultFovY / 60.0f)) { - g_Vars.currentplayer->gunzoomfovs[index] = 2 * (g_PlayerDefaultFovY / 60.0f); - } - } - else { - if (g_Vars.currentplayer->gunzoomfovs[index] < 2) { - g_Vars.currentplayer->gunzoomfovs[index] = 2; - } + if (g_Vars.currentplayer->gunzoomfovs[index] < 2 * g_PlayerFovZoomMultiplier) { + g_Vars.currentplayer->gunzoomfovs[index] = 2 * g_PlayerFovZoomMultiplier; } #endif } diff --git a/src/game/player.c b/src/game/player.c index 0cbb7789e..4f81bd2d9 100644 --- a/src/game/player.c +++ b/src/game/player.c @@ -209,6 +209,7 @@ s32 g_PlayerMouseAimMode = MOUSEAIM_CLASSIC; f32 g_PlayerMouseAimSpeedX = 0.75f; f32 g_PlayerMouseAimSpeedY = 0.75f; s32 g_PlayerFovAffectsZoom = 1; +f32 g_PlayerFovZoomMultiplier = 1.0f; #endif /** diff --git a/src/include/data.h b/src/include/data.h index 001a122c1..2848e34cb 100644 --- a/src/include/data.h +++ b/src/include/data.h @@ -535,6 +535,7 @@ extern s32 g_PlayerMouseAimMode; extern f32 g_PlayerMouseAimSpeedX; extern f32 g_PlayerMouseAimSpeedY; extern s32 g_PlayerFovAffectsZoom; +extern f32 g_PlayerFovZoomMultiplier; #endif #endif