From 62a2e011c68a7ef9ef9f1a93df0fb7012f3f8db1 Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 12 Apr 2026 15:02:23 +0200 Subject: [PATCH] Hack: fix intermission screen sometimes not displaying background in some cases does not fix whitescreen when switching resolutions while in intermission screen, but oh well lets hope there will be no issues with calling D_Renderview in intermission state, but it seems to work from quick testing lul --- src/d_main.c | 46 +++++++++++++++----- src/hardware/hw_main.cpp | 91 ++++++++++++++++++++-------------------- src/hardware/hw_main.h | 5 +++ 3 files changed, 87 insertions(+), 55 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 672bb8d51..0af2a6978 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -365,6 +365,40 @@ gamestate_t wipegamestate = GS_LEVEL; static void D_LimitFps(void); +static void D_MakeIntermissionBG(void) +{ + if (rendermode == render_none) + return; + + if (!lastdraw) + return; + + // no more valid map + // shouldnt happen at this point, but better safe than sorry! + if (!numsectors) + return; + + // need to render level again for this + // should be fine since at this point we did not unload it yet + if (cv_renderview.value) + { + D_Renderview(); + } + +#ifdef HWRENDER + if (rendermode == render_opengl) + { + HWR_MakeScreenTexture(); + } + else +#endif + { + VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.width, vid.width); + } + + lastdraw = false; +} + static boolean D_Display(void) { boolean ranwipe = false; @@ -525,6 +559,8 @@ static boolean D_Display(void) break; } + D_MakeIntermissionBG(); + if (gamestate == GS_LEVEL) { // draw the view directly @@ -535,16 +571,6 @@ static boolean D_Display(void) PS_STOP_TIMING(ps_rendercalltime); } - if (lastdraw) - { - if (rendermode == render_soft) - { - VID_BlitLinearScreen(vid.screens[0], vid.screens[1], vid.width, vid.height, vid.width, vid.width); - } - - lastdraw = false; - } - PS_START_TIMING(ps_uitime); ST_Drawer(); HU_Drawer(); diff --git a/src/hardware/hw_main.cpp b/src/hardware/hw_main.cpp index 7411d8cca..54cf9f9ab 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -5944,61 +5944,62 @@ static void HWR_DoPostProcessor(void) if (cv_glscreentextures.value != 2) // screen textures are needed for the rest of the effects return; - //UINT8 viewnum = R_GetViewNumber(); // see below + // Not supported in splitscreen - someone want to add support? + if (splitscreen || cv_reducevfx.value) + return; + + //UINT8 viewnum = R_GetViewNumber(); //camera_t *thiscam = &camera[viewnum]; const camera_t *thiscam = &camera[0]; - // Not supported in splitscreen - someone want to add support? - const boolean screenwave = (!splitscreen && !cv_reducevfx.value && (thiscam->postimg & POSTIMG_WATER || thiscam->postimg & POSTIMG_HEAT)); + if (!(thiscam->postimg & POSTIMG_WATER || thiscam->postimg & POSTIMG_HEAT)) + return; // Capture the screen for intermission and screen waving - if ((lastdraw || screenwave) && gamestate != GS_INTERMISSION) + if (gamestate != GS_INTERMISSION) GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1); // Drunken vision! WooOOooo~ - if (screenwave) + // 10 by 10 grid. 2 coordinates (xy) + float v[SCREENVERTS][SCREENVERTS][2]; + float disStart = (leveltime-1) + FixedToFloat(R_GetTimeFrac(RTF_LEVEL)); + + UINT8 x, y; + float WAVELENGTH; + float AMPLITUDE; + float FREQUENCY; + + // Modifies the wave. + if (thiscam->postimg & POSTIMG_WATER) { - // 10 by 10 grid. 2 coordinates (xy) - float v[SCREENVERTS][SCREENVERTS][2]; - float disStart = (leveltime-1) + FixedToFloat(R_GetTimeFrac(RTF_LEVEL)); - - UINT8 x, y; - float WAVELENGTH; - float AMPLITUDE; - float FREQUENCY; - - // Modifies the wave. - if (thiscam->postimg & POSTIMG_WATER) - { - WAVELENGTH = 5.0f; - AMPLITUDE = 40.0f; - FREQUENCY = 8.0f; - } - else - { - WAVELENGTH = 10.0f; - AMPLITUDE = 60.0f; - FREQUENCY = 4.0f; - } - - //static constexpr float scale = ((float)SCREENVERTS - 1.0f) / 9.0f; // well this evals to just 1.0f and what is x / 1? kek - - for (x = 0; x < SCREENVERTS; x++) - { - for (y = 0; y < SCREENVERTS; y++) - { - // Change X position based on its Y position. - v[x][y][0] = x-4.5f + sinf(((disStart+(static_cast(y) * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale) - v[x][y][1] = y-4.5f; // (y / scale) - } - } - - GL_PostImgRedraw(v); - - // Capture the screen again for screen waving on the intermission - if (gamestate != GS_INTERMISSION) - GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1); + WAVELENGTH = 5.0f; + AMPLITUDE = 40.0f; + FREQUENCY = 8.0f; } + else + { + WAVELENGTH = 10.0f; + AMPLITUDE = 60.0f; + FREQUENCY = 4.0f; + } + + //static constexpr float scale = ((float)SCREENVERTS - 1.0f) / 9.0f; // well this evals to just 1.0f and what is x / 1? kek + + for (x = 0; x < SCREENVERTS; x++) + { + for (y = 0; y < SCREENVERTS; y++) + { + // Change X position based on its Y position. + v[x][y][0] = x-4.5f + sinf(((disStart+(static_cast(y) * WAVELENGTH)) / FREQUENCY)) / AMPLITUDE; // (x / scale) + v[x][y][1] = y-4.5f; // (y / scale) + } + } + + GL_PostImgRedraw(v); + + // Capture the screen again for screen waving on the intermission + if (gamestate != GS_INTERMISSION) + GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1); // Flipping of the screen isn't done here anymore } diff --git a/src/hardware/hw_main.h b/src/hardware/hw_main.h index 5cf161aba..509eca8b1 100644 --- a/src/hardware/hw_main.h +++ b/src/hardware/hw_main.h @@ -151,6 +151,11 @@ FUNCINLINE static ATTRINLINE void HWR_RenderVhsEffect(fixed_t upbary, fixed_t do GL_RenderVhsEffect(upbary, downbary, updistort, downdistort, barsize); } +FUNCINLINE static ATTRINLINE void HWR_MakeScreenTexture(void) +{ + GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC1); +} + FUNCINLINE static ATTRINLINE void HWR_MakeScreenFinalTexture(void) { GL_MakeScreenTexture(HWD_SCREENTEXTURE_GENERIC2);