cleanup: move repetitive zoom fov logic to single multiplier value

This commit is contained in:
Phnod committed 2023-08-31 20:39:30 -04:00
1 parent 349b502149
commit 2a5160c519
6 files changed
+11 -34

No files matched your search

+1
View File
@@ -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)
+3 -10
View File
@@ -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) {
+2 -9
View File
@@ -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
+3 -15
View File
@@ -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
}
+1
View File
@@ -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
/**
+1
View File
@@ -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