From b704f5f7a03a3b42b41660f639e5237562ad4184 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Mon, 1 Feb 2021 03:19:48 +0700 Subject: [PATCH] Recalculate WIDESCREENDELTA before creation of hud widgets (#121) --- Source/hu_stuff.c | 3 +++ Source/i_video.c | 13 +++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/Source/hu_stuff.c b/Source/hu_stuff.c index 34293eee..d7ada663 100644 --- a/Source/hu_stuff.c +++ b/Source/hu_stuff.c @@ -451,6 +451,9 @@ void HU_Start(void) message_count = (message_timer * TICRATE) / 1000 + 1; chat_count = (chat_msg_timer * TICRATE) / 1000 + 1; + // [crispy] re-calculate WIDESCREENDELTA + I_GetScreenDimensions(); + // create the message widget // messages to player in upper-left of screen HUlib_initSText(&w_message, HU_MSGX, HU_MSGY, HU_MSGHEIGHT, hu_font, diff --git a/Source/i_video.c b/Source/i_video.c index e23483aa..e4eaee59 100644 --- a/Source/i_video.c +++ b/Source/i_video.c @@ -1079,12 +1079,21 @@ void I_GetScreenDimensions(void) SDL_DisplayMode mode; int w = 16, h = 10; int ah; + static boolean firsttime = true; SCREENWIDTH = ORIGWIDTH; SCREENHEIGHT = ORIGHEIGHT; NONWIDEWIDTH = SCREENWIDTH; + if (firsttime) + { + useaspect = cfg_aspectratio; + if(M_CheckParm("-aspect")) + useaspect = true; + firsttime = false; + } + ah = useaspect ? (6 * SCREENHEIGHT / 5) : SCREENHEIGHT; if (SDL_GetCurrentDisplayMode(video_display, &mode) == 0) @@ -1196,10 +1205,6 @@ static void I_InitGraphicsMode(void) else if(M_CheckParm("-5")) scalefactor = 5; - useaspect = cfg_aspectratio; - if(M_CheckParm("-aspect")) - useaspect = true; - I_GetWindowPosition(&v_x, &v_y, window_width, window_height); // [FG] create rendering window