Confirm FOV override when level is loaded

This commit is contained in:
James R 2024-04-01 19:07:24 -07:00
parent 01135e1940
commit f5477f0c4e
4 changed files with 21 additions and 4 deletions

View file

@ -1646,8 +1646,6 @@ void F_StartTitleScreen(void)
camera[0].height = 0; camera[0].height = 0;
wipegamestate = prevwipegamestate; wipegamestate = prevwipegamestate;
R_ExecuteSetViewSize(); // update FOV
} }
else else
{ {

View file

@ -8825,6 +8825,9 @@ boolean P_LoadLevel(boolean fromnetsave, boolean reloadinggamestate)
{ {
G_PreLevelTitleCard(); G_PreLevelTitleCard();
} }
// Apply FOV override.
R_CheckFOV();
} }
TracyCZoneEnd(__zone); TracyCZoneEnd(__zone);

View file

@ -69,6 +69,7 @@ fixed_t centerxfrac, centeryfrac;
fixed_t projection[MAXSPLITSCREENPLAYERS]; fixed_t projection[MAXSPLITSCREENPLAYERS];
fixed_t projectiony[MAXSPLITSCREENPLAYERS]; // aspect ratio fixed_t projectiony[MAXSPLITSCREENPLAYERS]; // aspect ratio
fixed_t fovtan[MAXSPLITSCREENPLAYERS]; // field of view fixed_t fovtan[MAXSPLITSCREENPLAYERS]; // field of view
fixed_t g_fovcache[MAXSPLITSCREENPLAYERS];
// just for profiling purposes // just for profiling purposes
size_t framecount; size_t framecount;
@ -188,7 +189,7 @@ void SplitScreen_OnChange(void)
extern "C" void Fov_OnChange(void); extern "C" void Fov_OnChange(void);
void Fov_OnChange(void) void Fov_OnChange(void)
{ {
R_SetViewSize(); R_CheckFOV();
} }
extern "C" void ChaseCam_OnChange(void); extern "C" void ChaseCam_OnChange(void);
@ -955,6 +956,18 @@ void R_SetViewSize(void)
setsizeneeded = true; setsizeneeded = true;
} }
void R_CheckFOV(void)
{
for (UINT8 s = 0; s <= r_splitscreen; ++s)
{
if (g_fovcache[s] != R_FOV(s))
{
R_SetViewSize();
break;
}
}
}
// //
// R_ExecuteSetViewSize // R_ExecuteSetViewSize
// //
@ -997,7 +1010,8 @@ void R_ExecuteSetViewSize(void)
for (s = 0; s <= r_splitscreen; ++s) for (s = 0; s <= r_splitscreen; ++s)
{ {
fov = FixedAngle(R_FOV(s)/2) + ANGLE_90; g_fovcache[s] = R_FOV(s);
fov = FixedAngle(g_fovcache[s]/2) + ANGLE_90;
fovtan[s] = FixedMul(FINETANGENT(fov >> ANGLETOFINESHIFT), viewmorph[s].zoomneeded); fovtan[s] = FixedMul(FINETANGENT(fov >> ANGLETOFINESHIFT), viewmorph[s].zoomneeded);
if (r_splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view if (r_splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view
fovtan[s] = 17*fovtan[s]/10; fovtan[s] = 17*fovtan[s]/10;

View file

@ -34,6 +34,7 @@ extern fixed_t centeryfrac;
extern fixed_t projection[MAXSPLITSCREENPLAYERS]; extern fixed_t projection[MAXSPLITSCREENPLAYERS];
extern fixed_t projectiony[MAXSPLITSCREENPLAYERS]; extern fixed_t projectiony[MAXSPLITSCREENPLAYERS];
extern fixed_t fovtan[MAXSPLITSCREENPLAYERS]; extern fixed_t fovtan[MAXSPLITSCREENPLAYERS];
extern fixed_t g_fovcache[MAXSPLITSCREENPLAYERS];
extern size_t validcount, linecount, loopcount, framecount; extern size_t validcount, linecount, loopcount, framecount;
@ -179,6 +180,7 @@ void R_SetViewSize(void);
void R_ExecuteSetViewSize(void); void R_ExecuteSetViewSize(void);
fixed_t R_FOV(int split); fixed_t R_FOV(int split);
void R_CheckFOV(void);
void R_SetupFrame(int split); void R_SetupFrame(int split);
void R_SkyboxFrame(int split); void R_SkyboxFrame(int split);