From faa3c6af1ed6b3295b55ec4953f89cbe6acb56fb Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 21 Feb 2024 18:38:47 +0700 Subject: [PATCH] bring back old method --- src/i_video.c | 17 +++++++++++------ src/r_main.c | 3 ++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index 7eca9d038..75dd1fbcc 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1149,11 +1149,13 @@ static void ResetResolution(int height, boolean reset_pitch) video.unscaledw = (int)(unscaled_actualheight * aspect_ratio); - video.unscaledw &= ~1; + // Unscaled widescreen 16:9 resolution truncates to 426x240, which is not + // quite 16:9. To avoid visual instability, we calculate the scaled width + // without the actual aspect ratio. For example, at 1280x720 we get + // 1278x720. - video.width = (int)(actualheight * aspect_ratio); - - video.width &= ~1; + double vertscale = (double)actualheight / (double)unscaled_actualheight; + video.width = (int)ceil(video.unscaledw * vertscale); // [FG] For performance reasons, SDL2 insists that the screen pitch, i.e. // the *number of bytes* that one horizontal row of pixels occupy in @@ -1176,7 +1178,8 @@ static void ResetResolution(int height, boolean reset_pitch) if (automapactive) AM_ResetScreenSize(); - I_Printf(VB_DEBUG, "ResetResolution: %dx%d", video.width, video.height); + I_Printf(VB_DEBUG, "ResetResolution: %dx%d (%dx%d)", + video.width, video.height, video.unscaledw, SCREENHEIGHT); drs_skip_frame = true; } @@ -1703,7 +1706,7 @@ static struct { { 640, 480 }, { 800, 600 }, { 1024, 768 }, - //{ 1280, 1024 }, + { 1280, 1024 }, { 1280, 720 }, { 1280, 800 }, { 1366, 768 }, @@ -1717,6 +1720,7 @@ static struct { { 2304, 1440 }, { 2560, 1600 }, { 3200, 2400 }, + { 3440, 1440 }, { 3840, 2160 }, { 5120, 2160 } }; @@ -1750,6 +1754,7 @@ void I_CheckHOM(void) { printf("HOM %dx%d\n", native_res[curr_test_res - 1].w, native_res[curr_test_res - 1].h); + //run_test = false; break; } } diff --git a/src/r_main.c b/src/r_main.c index a8b10db25..fdaa52286 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -955,7 +955,8 @@ void R_RenderPlayerView (player_t* player) R_SetFuzzPosDraw(); R_DrawMasked (); - I_CheckHOM(); + if (run_test) + I_CheckHOM(); // Check for new console commands. NetUpdate ();