From 8b951bf64cffab1855b7da68e45f08c1749b179b Mon Sep 17 00:00:00 2001 From: Arsinikk Date: Sat, 30 Nov 2024 19:19:34 -0600 Subject: [PATCH] Render `V_DrawRawScreen` with correct stretch aspect - Note that stbar in "Not Adjusted" aspect currently uses settings for "Doom Format" --- prboom2/src/dsda/stretch.c | 20 +++++++++++++++++--- prboom2/src/st_stuff.c | 5 +++++ prboom2/src/v_video.c | 28 +++++++++++++++++++++++----- 3 files changed, 45 insertions(+), 8 deletions(-) diff --git a/prboom2/src/dsda/stretch.c b/prboom2/src/dsda/stretch.c index 081ab79e5..3c70cbad6 100644 --- a/prboom2/src/dsda/stretch.c +++ b/prboom2/src/dsda/stretch.c @@ -183,6 +183,15 @@ static void InitStretchParam(stretch_param_t* offsets, int stretch, enum patch_t break; } + // Raven HUD breaks in "patch_stretch_not_adjusted", + // so let's use "patch_stretch_doom_format" settings + if (raven && stretch == 0) + { + offsets->video = &video_stretch; + offsets->deltax1 = (SCREENWIDTH - WIDE_SCREENWIDTH) / 2; + offsets->deltax2 = (SCREENWIDTH - WIDE_SCREENWIDTH) / 2; + } + if (flags == VPT_ALIGN_LEFT || flags == VPT_ALIGN_LEFT_BOTTOM || flags == VPT_ALIGN_LEFT_TOP) { offsets->deltax1 = 0; offsets->deltax2 = 0; @@ -271,9 +280,6 @@ void dsda_EvaluatePatchScale(void) { SCREENHEIGHT < 200 || WIDE_SCREENHEIGHT < 200) render_stretch_hud = patch_stretch_fit_to_width; - if (raven && render_stretch_hud == 0) - render_stretch_hud++; - switch (render_stretch_hud) { case patch_stretch_not_adjusted: wide_offset2x = SCREENWIDTH - patches_scalex * 320; @@ -293,6 +299,14 @@ void dsda_EvaluatePatchScale(void) { break; } + // Raven HUD breaks in "patch_stretch_not_adjusted", + // so let's use "patch_stretch_doom_format" settings + if (raven && render_stretch_hud == 0) { + ST_SCALED_HEIGHT = g_st_height * WIDE_SCREENHEIGHT / 200; + wide_offset2x = SCREENWIDTH - WIDE_SCREENWIDTH; + wide_offset2y = SCREENHEIGHT - WIDE_SCREENHEIGHT; + } + wide_offsetx = wide_offset2x / 2; wide_offsety = wide_offset2y / 2; } diff --git a/prboom2/src/st_stuff.c b/prboom2/src/st_stuff.c index da13d41df..a649d79cd 100644 --- a/prboom2/src/st_stuff.c +++ b/prboom2/src/st_stuff.c @@ -416,6 +416,11 @@ void ST_SetScaledWidth(void) break; } + // Raven HUD breaks in "patch_stretch_not_adjusted", + // so let's use "patch_stretch_doom_format" settings + if (raven && render_stretch_hud == 0) + ST_SCALED_WIDTH = width * WIDE_SCREENWIDTH / 320; + ST_SCALED_WIDTH = (ST_SCALED_WIDTH + 3) & (int)~3; if (ST_SCALED_WIDTH > SCREENWIDTH) diff --git a/prboom2/src/v_video.c b/prboom2/src/v_video.c index f05666357..beea093c1 100644 --- a/prboom2/src/v_video.c +++ b/prboom2/src/v_video.c @@ -1440,11 +1440,29 @@ void V_DrawRawScreenSection(const char *lump_name, int source_offset, int dest_y } } - x_factor = (float)SCREENWIDTH / 320; - y_factor = (float)SCREENHEIGHT / 200; - - if (y_factor < x_factor) - x_factor = y_factor; + switch (render_stretch_hud) { + case patch_stretch_not_adjusted: + x_factor = (float)SCREENWIDTH / 320; + y_factor = (float)SCREENHEIGHT / 200; + if (y_factor < x_factor) + x_factor = y_factor; + break; + case patch_stretch_doom_format: + x_factor = (float)WIDE_SCREENWIDTH / 320; + y_factor = (float)WIDE_SCREENHEIGHT / 200; + if (y_factor < x_factor) + x_factor = y_factor; + break; + case patch_stretch_fit_to_width: + x_factor = (float)SCREENWIDTH / 320; + y_factor = (float)SCREENHEIGHT / 200; + break; + default: + // This should never happen + x_factor = 0; + y_factor = 0; + break; + } x_offset = (int)((SCREENWIDTH - (x_factor * 320)) / 2); y_offset = (int)((dest_y_offset * y_factor) - (source_offset * y_factor / 320));