From 1462e038398770bee6548021aa741a0856b54bf7 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 21 Feb 2024 09:15:50 +0700 Subject: [PATCH 01/16] calculate video.width using aspect_ratio Fix HOM at 3440x1440 resolution. This will make DRS resolution switching more noticeable. * More accurate `centery`/`centeryfrac` calculation in wR_SetupFreelook (for consistency) --- src/i_video.c | 8 +------- src/r_main.c | 6 +++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index 8b0f5754a..519b87c08 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1149,13 +1149,7 @@ static void ResetResolution(int height, boolean reset_pitch) video.unscaledw = (int)(unscaled_actualheight * aspect_ratio); - // 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. - - double vertscale = (double)actualheight / (double)unscaled_actualheight; - video.width = (int)ceil(video.unscaledw * vertscale); + video.width = (int)(actualheight * aspect_ratio); // [FG] For performance reasons, SDL2 insists that the screen pitch, i.e. // the *number of bytes* that one horizontal row of pixels occupy in diff --git a/src/r_main.c b/src/r_main.c index cfdea6236..29a56cc0f 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -507,8 +507,8 @@ static void R_SetupFreelook(void) dy = 0; } - centery = viewheight / 2 + (dy >> FRACBITS); - centeryfrac = centery << FRACBITS; + centeryfrac = (viewheight << FRACBITS) / 2 + dy; + centery = centeryfrac >> FRACBITS; for (i = 0; i < viewheight; i++) { @@ -593,7 +593,7 @@ void R_ExecuteSetViewSize (void) viewwidth_nonwide = V_ScaleX(scaledviewwidth_nonwide); centerxfrac = (viewwidth << FRACBITS) / 2; - centerx = (centerxfrac >> FRACBITS); + centerx = centerxfrac >> FRACBITS; centerxfrac_nonwide = (viewwidth_nonwide << FRACBITS) / 2; viewheightfrac = viewheight << (FRACBITS + 1); // [FG] sprite clipping optimizations From 8c846effe2168463a6dec3f2f637313329862886 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 21 Feb 2024 11:16:15 +0700 Subject: [PATCH 02/16] make width even --- src/i_video.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/i_video.c b/src/i_video.c index 519b87c08..3b20046ed 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1149,8 +1149,12 @@ static void ResetResolution(int height, boolean reset_pitch) video.unscaledw = (int)(unscaled_actualheight * aspect_ratio); + video.unscaledw = (video.unscaledw + 1) & ~1; + video.width = (int)(actualheight * aspect_ratio); + video.width = (video.width + 1) & ~1; + // [FG] For performance reasons, SDL2 insists that the screen pitch, i.e. // the *number of bytes* that one horizontal row of pixels occupy in // memory, must be a multiple of 4. From 1d3ee6f05bf33852fcd9b32b64475af3d70a5124 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 21 Feb 2024 12:41:53 +0700 Subject: [PATCH 03/16] apply Ceki's change --- src/i_video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index 3b20046ed..f7bef84db 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1149,11 +1149,11 @@ static void ResetResolution(int height, boolean reset_pitch) video.unscaledw = (int)(unscaled_actualheight * aspect_ratio); - video.unscaledw = (video.unscaledw + 1) & ~1; + video.unscaledw &= ~1; video.width = (int)(actualheight * aspect_ratio); - video.width = (video.width + 1) & ~1; + video.width &= ~1; // [FG] For performance reasons, SDL2 insists that the screen pitch, i.e. // the *number of bytes* that one horizontal row of pixels occupy in From b5a2dd3333fa8c71ff5d3c78a06a3f7165dccbe8 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 21 Feb 2024 16:41:29 +0700 Subject: [PATCH 04/16] initial version of HOM test --- src/d_main.c | 19 +++++++++++++++++ src/d_main.h | 2 ++ src/i_video.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++ src/i_video.h | 3 +++ src/r_main.c | 9 ++++++++ 5 files changed, 92 insertions(+) diff --git a/src/d_main.c b/src/d_main.c index 9ff1fd085..d49ac9c4b 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -133,6 +133,8 @@ char **wadfiles; boolean devparm; // started game with -devparm +boolean run_test; + // jff 1/24/98 add new versions of these variables to remember command line boolean clnomonsters; // checkparm of -nomonsters boolean clrespawnparm; // checkparm of -respawn @@ -2931,6 +2933,11 @@ void D_DoomMain(void) I_AtExitPrio(D_EndDoom, false, "D_EndDoom", exit_priority_last); } + if (M_ParmExists("-test")) + { + run_test = true; + } + TryRunTics(); D_StartGameLoop(); @@ -2940,6 +2947,18 @@ void D_DoomMain(void) // frame syncronous IO operations I_StartFrame (); + if (run_test) + { + static int oldgametic = 3; + + if (gametic >= oldgametic) + { + oldgametic = gametic + 3; + if (!I_ChangeRes()) + I_SafeExit(0); + } + } + TryRunTics (); // will run at least one tic // Update display, next frame, with current state. diff --git a/src/d_main.h b/src/d_main.h index 5ede94695..5afbdc264 100644 --- a/src/d_main.h +++ b/src/d_main.h @@ -59,6 +59,8 @@ void D_PageDrawer(void); void D_AdvanceDemo(void); void D_StartTitle(void); +extern boolean run_test; + #endif //---------------------------------------------------------------------------- diff --git a/src/i_video.c b/src/i_video.c index b02e48bc5..171db1b66 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1698,6 +1698,65 @@ void I_InitGraphics(void) ResetLogicalSize(); } +static struct { + int w, h; +} native_res[] = { + //{ 320, 240 }, + { 640, 480 }, + { 800, 600 }, + { 1024, 768 }, + //{ 1280, 1024 }, + { 1280, 720 }, + { 1280, 800 }, + { 1366, 768 }, + { 1440, 900 }, + { 1440, 1080 }, + { 1680, 1050 }, + { 1920, 1080 }, + { 1920, 1200 }, + { 2048, 1152 }, + { 2560, 1080 }, + { 2304, 1440 }, + { 2560, 1600 }, + { 3200, 2400 }, + { 3840, 2160 }, + { 5120, 2160 } +}; + +static int curr_test_res; + +boolean I_ChangeRes(void) +{ + native_width = native_res[curr_test_res].w; + native_height = native_res[curr_test_res].h; + + native_height_adjusted = (int)(native_height / 1.2); + + ResetResolution(native_height_adjusted, true); + CreateSurfaces(video.pitch, video.height); + ResetLogicalSize(); + + curr_test_res++; + + if (curr_test_res == arrlen(native_res)) + return false; + + return true; +} + +void I_CheckHOM(void) +{ + for (int i = 0; i < video.height; ++i) + { + if (I_VideoBuffer[video.width - 1] == v_lightest_color) + { + printf("HOM %dx%d\n", + native_res[curr_test_res].w, native_res[curr_test_res].h); + break; + } + } +} + //---------------------------------------------------------------------------- // // $Log: i_video.c,v $ diff --git a/src/i_video.h b/src/i_video.h index c79e5ec4a..0874d88d7 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -107,6 +107,9 @@ void I_InitWindowIcon(void); void I_ShowMouseCursor(boolean on); void I_ResetRelativeMouseState(void); +boolean I_ChangeRes(void); +void I_CheckHOM(void); + #endif //---------------------------------------------------------------------------- diff --git a/src/r_main.c b/src/r_main.c index cfdea6236..a6dc1af92 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -26,6 +26,7 @@ #include #include "d_loop.h" +#include "d_main.h" #include "d_player.h" #include "doomdata.h" #include "doomdef.h" @@ -853,6 +854,12 @@ void R_RenderPlayerView (player_t* player) R_ClearSprites (); VX_ClearVoxels (); + if (run_test) + { + V_FillRect(scaledviewx, scaledviewy, scaledviewwidth, scaledviewheight, + v_lightest_color); + } + if (autodetect_hom) { // killough 2/10/98: add flashing red HOM indicators pixel_t c[47*47]; @@ -948,6 +955,8 @@ void R_RenderPlayerView (player_t* player) R_SetFuzzPosDraw(); R_DrawMasked (); + I_CheckHOM(); + // Check for new console commands. NetUpdate (); } From 9865360ae9f2176205823251ae00a60d26473836 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 21 Feb 2024 17:00:47 +0700 Subject: [PATCH 05/16] Fix index --- src/i_video.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/i_video.c b/src/i_video.c index 9507f2061..7eca9d038 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1749,7 +1749,7 @@ void I_CheckHOM(void) if (I_VideoBuffer[video.width - 1] == v_lightest_color) { printf("HOM %dx%d\n", - native_res[curr_test_res].w, native_res[curr_test_res].h); + native_res[curr_test_res - 1].w, native_res[curr_test_res - 1].h); break; } } From fdf4035e09d72aa2cd018062ee81246a17559c36 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 21 Feb 2024 18:38:47 +0700 Subject: [PATCH 06/16] bring back old method --- src/i_video.c | 23 ++++++++++++++--------- src/r_main.c | 3 ++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index 7eca9d038..500b372a3 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; } @@ -1699,11 +1702,11 @@ void I_InitGraphics(void) static struct { int w, h; } native_res[] = { - //{ 320, 240 }, + { 320, 240 }, { 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 } }; @@ -1730,6 +1734,7 @@ boolean I_ChangeRes(void) native_height_adjusted = (int)(native_height / 1.2); + printf("I_ChangeRes: %dx%d\n", native_width, native_height); ResetResolution(native_height_adjusted, true); CreateSurfaces(video.pitch, video.height); ResetLogicalSize(); @@ -1748,8 +1753,8 @@ void I_CheckHOM(void) { if (I_VideoBuffer[video.width - 1] == v_lightest_color) { - printf("HOM %dx%d\n", - native_res[curr_test_res - 1].w, native_res[curr_test_res - 1].h); + printf("HOM\n"); + //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 (); From f93d4bda943045cbe6f9acc71254b3add2ce71b5 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Thu, 22 Feb 2024 08:15:05 +0700 Subject: [PATCH 07/16] restore previous approach --- src/i_video.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/i_video.c b/src/i_video.c index 519b87c08..8b0f5754a 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1149,7 +1149,13 @@ static void ResetResolution(int height, boolean reset_pitch) video.unscaledw = (int)(unscaled_actualheight * aspect_ratio); - video.width = (int)(actualheight * aspect_ratio); + // 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. + + 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 From f4fae7c27541ccd18161529f89db32b0cee76940 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Thu, 22 Feb 2024 08:16:55 +0700 Subject: [PATCH 08/16] add check for minimum aspect ratio --- src/i_video.c | 5 +---- src/i_video.h | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index 8b0f5754a..9eb63a165 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1132,10 +1132,7 @@ static double CurrentAspectRatio(void) double aspect_ratio = (double)w / (double)h; - if (aspect_ratio > ASPECT_RATIO_MAX) - { - aspect_ratio = ASPECT_RATIO_MAX; - } + aspect_ratio = BETWEEN(ASPECT_RATIO_MIN, ASPECT_RATIO_MAX, aspect_ratio); return aspect_ratio; } diff --git a/src/i_video.h b/src/i_video.h index c79e5ec4a..2d28549ac 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -27,6 +27,7 @@ #define FOV_MIN 60 #define FOV_MAX 120 #define ASPECT_RATIO_MAX 3.6 // Up to 32:9 ultrawide. +#define ASPECT_RATIO_MIN (4.0 / 3.0) typedef enum { From b536ab01b0326b96e94eb6f4a90ccb95459667e8 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Thu, 22 Feb 2024 08:18:54 +0700 Subject: [PATCH 09/16] apply patch from Ceski --- src/r_main.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/r_main.c b/src/r_main.c index 29a56cc0f..8310df37b 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -285,19 +285,13 @@ static void R_InitTextureMapping(void) // Calc focallength // so FIELDOFVIEW angles covers SCREENWIDTH. - if (custom_fov == FOV_DEFAULT) + if (custom_fov == FOV_DEFAULT && centerxfrac == centerxfrac_nonwide) { fov = FIELDOFVIEW; slopefrac = finetangent[FINEANGLES / 4 + fov / 2]; focallength = FixedDiv(centerxfrac_nonwide, slopefrac); lightfocallength = centerxfrac_nonwide; projection = centerxfrac_nonwide; - - if (centerxfrac != centerxfrac_nonwide) - { - fov = atan((double)centerxfrac / centerxfrac_nonwide) * FINEANGLES / M_PI; - slopefrac = finetangent[FINEANGLES / 4 + fov / 2]; - } } else { From 39b4e3054289cc7d99834db050ec7fe0fc5d0380 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 27 Mar 2024 14:13:52 +0700 Subject: [PATCH 10/16] fix am solid bg HOM --- src/am_map.c | 2 +- src/r_draw.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/am_map.c b/src/am_map.c index bae4a5f87..8b6a5ab73 100644 --- a/src/am_map.c +++ b/src/am_map.c @@ -599,7 +599,7 @@ static void AM_initScreenSize(void) if (automapoverlay && scaledviewheight == SCREENHEIGHT) f_h = video.height; else - f_h = video.height - V_ScaleY(ST_HEIGHT); + f_h = V_ScaleY(SCREENHEIGHT - ST_HEIGHT); } void AM_ResetScreenSize(void) diff --git a/src/r_draw.c b/src/r_draw.c index a74578033..5319e9e15 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -43,12 +43,11 @@ // and the total size == width*height*depth/8., // -byte *viewimage; -int viewwidth; int scaledviewwidth; int scaledviewheight; // killough 11/98 int scaledviewx; int scaledviewy; +int viewwidth; int viewheight; int viewwindowx; int viewwindowy; From 205d01ac8f143200de0cfb3f4ba37512836800ba Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Wed, 27 Mar 2024 14:33:15 +0700 Subject: [PATCH 11/16] fix scaled window HOM on some resolutions --- src/r_draw.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/r_draw.c b/src/r_draw.c index 5319e9e15..edae919cc 100644 --- a/src/r_draw.c +++ b/src/r_draw.c @@ -940,8 +940,6 @@ void R_VideoErase(int x, int y, int w, int h) void R_DrawViewBorder(void) { - int side; - if (scaledviewwidth == video.unscaledw || background_buffer == NULL) return; @@ -949,9 +947,9 @@ void R_DrawViewBorder(void) R_VideoErase(0, 0, video.unscaledw, scaledviewy); // copy sides - side = scaledviewx; - R_VideoErase(0, scaledviewy, side, scaledviewheight); - R_VideoErase(video.unscaledw - side, scaledviewy, side, scaledviewheight); + R_VideoErase(0, scaledviewy, scaledviewx, scaledviewheight); + R_VideoErase(scaledviewx + scaledviewwidth, scaledviewy, scaledviewx, + scaledviewheight); // copy bottom R_VideoErase(0, scaledviewy + scaledviewheight, video.unscaledw, scaledviewy); From 2556bd7ca3b2e5e9992ed752fd89473a8a3e6a22 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Thu, 28 Mar 2024 09:19:53 +0700 Subject: [PATCH 12/16] add Ceski's FOV test --- src/d_main.c | 36 ++++++++++++++++++++++++++++++++++-- src/i_video.c | 3 ++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index b429a1ef5..ac653d0c1 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -2948,9 +2948,41 @@ void D_DoomMain(void) if (gametic >= oldgametic) { + static boolean first_test = true; + static boolean cycle_fov = false; + oldgametic = gametic + 3; - if (!I_ChangeRes()) - I_SafeExit(0); + + if (first_test) + { + custom_fov = FOV_MIN; + setsizeneeded = true; + cycle_fov = false; + first_test = false; + } + else if (cycle_fov) + { + if (custom_fov == FOV_MAX) + { + custom_fov = FOV_MIN; + cycle_fov = false; + } + else + { + custom_fov++; + } + setsizeneeded = true; + } + else + { + cycle_fov = true; + if (!I_ChangeRes()) + { + custom_fov = FOV_DEFAULT; + default_widescreen = RATIO_AUTO; + I_SafeExit(0); + } + } } } diff --git a/src/i_video.c b/src/i_video.c index 07aaaa77f..e1fde3b3f 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1759,8 +1759,9 @@ static struct { { 2560, 1600 }, { 3200, 2400 }, { 3440, 1440 }, + { 3840, 1600 }, { 3840, 2160 }, - { 5120, 2160 } + { 5120, 2160 } }; static int curr_test_res; From 9d3ddbca084896ee99f65231fe3248af1aeb0e50 Mon Sep 17 00:00:00 2001 From: ceski <56656010+ceski-1@users.noreply.github.com> Date: Wed, 27 Mar 2024 20:05:46 -0700 Subject: [PATCH 13/16] Add 2560x1440 --- src/i_video.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/i_video.c b/src/i_video.c index e1fde3b3f..8218549ee 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1756,6 +1756,7 @@ static struct { { 2048, 1152 }, { 2560, 1080 }, { 2304, 1440 }, + { 2560, 1440 }, { 2560, 1600 }, { 3200, 2400 }, { 3440, 1440 }, From 716713b1ad2a9ef8583e89dd62260ed2c53ce5af Mon Sep 17 00:00:00 2001 From: ceski <56656010+ceski-1@users.noreply.github.com> Date: Wed, 27 Mar 2024 20:15:20 -0700 Subject: [PATCH 14/16] Print fov and resolution, remove unused for loop --- src/i_video.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index 8218549ee..b55217176 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1789,14 +1789,11 @@ boolean I_ChangeRes(void) void I_CheckHOM(void) { - for (int i = 0; i < video.height; ++i) + if (I_VideoBuffer[video.width - 1] == v_lightest_color) { - if (I_VideoBuffer[video.width - 1] == v_lightest_color) - { - printf("HOM\n"); - //run_test = false; - break; - } + I_Printf(VB_WARNING, "HOM: native %dx%d, video %dx%d, fov %d", + native_width, native_height, video.width, video.height, + custom_fov); } } From c0f18e6451dd99c1874aa59026321bec40ca2427 Mon Sep 17 00:00:00 2001 From: ceski <56656010+ceski-1@users.noreply.github.com> Date: Wed, 27 Mar 2024 20:17:45 -0700 Subject: [PATCH 15/16] Make HOM lines red --- src/i_video.c | 2 +- src/r_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index b55217176..a3b870a6f 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -1789,7 +1789,7 @@ boolean I_ChangeRes(void) void I_CheckHOM(void) { - if (I_VideoBuffer[video.width - 1] == v_lightest_color) + if (I_VideoBuffer[video.width - 1] == 0xb0) { I_Printf(VB_WARNING, "HOM: native %dx%d, video %dx%d, fov %d", native_width, native_height, video.width, video.height, diff --git a/src/r_main.c b/src/r_main.c index 5ec541357..e8827e801 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -858,7 +858,7 @@ void R_RenderPlayerView (player_t* player) if (run_test) { V_FillRect(scaledviewx, scaledviewy, scaledviewwidth, scaledviewheight, - v_lightest_color); + 0xb0); } if (autodetect_hom) From 7484595315cedf1f4682ce127737e9c13248f6af Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Sat, 13 Jul 2024 09:47:58 +0700 Subject: [PATCH 16/16] fix build and I_ChangeRes exit --- src/i_video.c | 21 +++++++++++---------- src/i_video.h | 1 + 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/i_video.c b/src/i_video.c index fcd43d7ea..0bee18955 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -88,7 +88,8 @@ static int fpslimit; // when uncapped, limit framerate to this value static boolean fullscreen; static boolean exclusive_fullscreen; static boolean change_display_resolution; -static int widescreen, default_widescreen; +static int widescreen; +int default_widescreen; static boolean vga_porch_flash; // emulate VGA "porch" behaviour static boolean smooth_scaling; static int video_display = 0; // display index @@ -1927,21 +1928,21 @@ static int curr_test_res; boolean I_ChangeRes(void) { - native_width = native_res[curr_test_res].w; - native_height = native_res[curr_test_res].h; + if (curr_test_res == arrlen(native_res)) + return false; + + max_width = native_res[curr_test_res].w; + max_height = native_res[curr_test_res].h; - native_height_adjusted = (int)(native_height / 1.2); + max_height_adjusted = (int)(max_height / 1.2); - printf("I_ChangeRes: %dx%d\n", native_width, native_height); - ResetResolution(native_height_adjusted, true); + printf("I_ChangeRes: %dx%d\n", max_width, max_height); + ResetResolution(max_height_adjusted, true); CreateSurfaces(video.pitch, video.height); ResetLogicalSize(); curr_test_res++; - if (curr_test_res == arrlen(native_res)) - return false; - return true; } @@ -1950,7 +1951,7 @@ void I_CheckHOM(void) if (I_VideoBuffer[video.width - 1] == 0xb0) { I_Printf(VB_WARNING, "HOM: native %dx%d, video %dx%d, fov %d", - native_width, native_height, video.width, video.height, + max_width, max_height, video.width, video.height, custom_fov); } } diff --git a/src/i_video.h b/src/i_video.h index 4e44a26f6..afeb960e2 100644 --- a/src/i_video.h +++ b/src/i_video.h @@ -98,6 +98,7 @@ void I_UpdatePriority(boolean active); void I_BindVideoVariables(void); +extern int default_widescreen; boolean I_ChangeRes(void); void I_CheckHOM(void);