Adjust field of view to the aspect ratio

This commit is contained in:
Lactozilla 2023-07-24 16:57:30 -03:00
parent 923e9c4a3b
commit 0d943e31b1

View file

@ -941,6 +941,11 @@ void R_ExecuteSetViewSize(void)
if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view
fovtan = 17*fovtan/10;
// Adjust field of view to the aspect ratio
fixed_t resmul = FixedDiv(vid.width * FRACUNIT, vid.height * FRACUNIT);
if (resmul > FRACUNIT)
fovtan = FixedMul(fovtan, resmul);
projection = projectiony = FixedDiv(centerxfrac, fovtan);
R_InitViewBuffer(scaledviewwidth, viewheight);