From 0d943e31b17f484a5b0dbdb07b314b5cfcb48315 Mon Sep 17 00:00:00 2001 From: Lactozilla Date: Mon, 24 Jul 2023 16:57:30 -0300 Subject: [PATCH] Adjust field of view to the aspect ratio --- src/r_main.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/r_main.c b/src/r_main.c index 39231981c..dea402eec 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -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);