Skip to content

Commit fdf4035

Browse files
committed
bring back old method
1 parent 2b79c7d commit fdf4035

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

src/i_video.c

+14-9
Original file line numberDiff line numberDiff line change
@@ -1149,11 +1149,13 @@ static void ResetResolution(int height, boolean reset_pitch)
11491149

11501150
video.unscaledw = (int)(unscaled_actualheight * aspect_ratio);
11511151

1152-
video.unscaledw &= ~1;
1152+
// Unscaled widescreen 16:9 resolution truncates to 426x240, which is not
1153+
// quite 16:9. To avoid visual instability, we calculate the scaled width
1154+
// without the actual aspect ratio. For example, at 1280x720 we get
1155+
// 1278x720.
11531156

1154-
video.width = (int)(actualheight * aspect_ratio);
1155-
1156-
video.width &= ~1;
1157+
double vertscale = (double)actualheight / (double)unscaled_actualheight;
1158+
video.width = (int)ceil(video.unscaledw * vertscale);
11571159

11581160
// [FG] For performance reasons, SDL2 insists that the screen pitch, i.e.
11591161
// the *number of bytes* that one horizontal row of pixels occupy in
@@ -1176,7 +1178,8 @@ static void ResetResolution(int height, boolean reset_pitch)
11761178
if (automapactive)
11771179
AM_ResetScreenSize();
11781180

1179-
I_Printf(VB_DEBUG, "ResetResolution: %dx%d", video.width, video.height);
1181+
I_Printf(VB_DEBUG, "ResetResolution: %dx%d (%dx%d)",
1182+
video.width, video.height, video.unscaledw, SCREENHEIGHT);
11801183

11811184
drs_skip_frame = true;
11821185
}
@@ -1699,11 +1702,11 @@ void I_InitGraphics(void)
16991702
static struct {
17001703
int w, h;
17011704
} native_res[] = {
1702-
//{ 320, 240 },
1705+
{ 320, 240 },
17031706
{ 640, 480 },
17041707
{ 800, 600 },
17051708
{ 1024, 768 },
1706-
//{ 1280, 1024 },
1709+
{ 1280, 1024 },
17071710
{ 1280, 720 },
17081711
{ 1280, 800 },
17091712
{ 1366, 768 },
@@ -1717,6 +1720,7 @@ static struct {
17171720
{ 2304, 1440 },
17181721
{ 2560, 1600 },
17191722
{ 3200, 2400 },
1723+
{ 3440, 1440 },
17201724
{ 3840, 2160 },
17211725
{ 5120, 2160 }
17221726
};
@@ -1730,6 +1734,7 @@ boolean I_ChangeRes(void)
17301734

17311735
native_height_adjusted = (int)(native_height / 1.2);
17321736

1737+
printf("I_ChangeRes: %dx%d\n", native_width, native_height);
17331738
ResetResolution(native_height_adjusted, true);
17341739
CreateSurfaces(video.pitch, video.height);
17351740
ResetLogicalSize();
@@ -1748,8 +1753,8 @@ void I_CheckHOM(void)
17481753
{
17491754
if (I_VideoBuffer[video.width - 1] == v_lightest_color)
17501755
{
1751-
printf("HOM %dx%d\n",
1752-
native_res[curr_test_res - 1].w, native_res[curr_test_res - 1].h);
1756+
printf("HOM\n");
1757+
//run_test = false;
17531758
break;
17541759
}
17551760
}

src/r_main.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,8 @@ void R_RenderPlayerView (player_t* player)
955955
R_SetFuzzPosDraw();
956956
R_DrawMasked ();
957957

958-
I_CheckHOM();
958+
if (run_test)
959+
I_CheckHOM();
959960

960961
// Check for new console commands.
961962
NetUpdate ();

0 commit comments

Comments
 (0)