diff --git a/src/d_main.c b/src/d_main.c index 84abb528d..5a5ecb510 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -362,6 +362,40 @@ static void D_Renderview(void) // added comment : there is a wipe eatch change of the gamestate gamestate_t wipegamestate = GS_LEVEL; +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; @@ -519,6 +553,8 @@ static boolean D_Display(void) break; } + D_MakeIntermissionBG(); + if (gamestate == GS_LEVEL) { // draw the view directly @@ -529,16 +565,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 9e0dd6ea6..f458015ae 100644 --- a/src/hardware/hw_main.cpp +++ b/src/hardware/hw_main.cpp @@ -6093,61 +6093,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 8a501f727..cbd8e11e7 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);