This commit is contained in:
Jaime Passos 2019-09-09 19:27:08 -03:00
parent 6f4dadaa12
commit 0a973af5b8
8 changed files with 31 additions and 6 deletions

View File

@ -240,6 +240,22 @@ static void D_Display(void)
if (nodrawers)
return; // for comparative timing/profiling
// Jimita: Switching renderers works by checking
// if the game has to do it right when the frame
// needs to render. If so, five things will happen:
// 1. Interface functions will be called so
// that switching to OpenGL creates a
// GL context, and switching to Software
// allocates screen buffers.
// 2. Software will set drawer functions,
// and OpenGL will load textures and
// create plane polygons, if necessary.
// 3. Functions related to switching video
// modes (resolution) are called.
// 4. Patch data is freed from memory,
// and recached if necessary.
// 5. The frame is ready to be drawn!
// stop movie if needs to change renderer
if (setrenderneeded && (moviemode != MM_OFF))
M_StopMovie();
@ -265,6 +281,7 @@ static void D_Display(void)
forcerefresh = true; // force background redraw
}
// Jimita
D_CheckRendererState();
// draw buffered stuff to screen
@ -510,6 +527,8 @@ static void D_Display(void)
needpatchrecache = false;
}
// Jimita: Check the renderer's state
// after a possible renderer switch.
void D_CheckRendererState(void)
{
// flush all patches from memory
@ -1219,9 +1238,8 @@ void D_SRB2Main(void)
// set user default mode or mode set at cmdline
SCR_CheckDefaultMode();
// renderer needs to change?
// ok cool please just change it
// exactly right now please.
// Jimita: Does the render mode need to change?
if ((setrenderneeded != 0) && (setrenderneeded != rendermode))
{
needpatchflush = true;

View File

@ -1495,6 +1495,7 @@ void F_TitleScreenDrawer(void)
if (modeattacking)
return; // We likely came here from retrying. Don't do a damn thing.
// Jimita: Load title screen patches.
if (needpatchrecache)
F_CacheTitleScreen();

View File

@ -644,6 +644,7 @@ GLTexture_t *HWR_GetTexture(INT32 tex)
if ((unsigned)tex >= gr_numtextures)
I_Error("HWR_GetTexture: tex >= numtextures\n");
#endif
// Jimita
if (needpatchrecache && (!gr_textures))
HWR_PrepLevelCache(gr_numtextures);

View File

@ -4135,6 +4135,7 @@ static void M_DrawAddons(void)
return;
}
// Jimita: Load addons menu patches.
if (needpatchrecache)
M_LoadAddonsPatches();

View File

@ -2943,8 +2943,8 @@ boolean P_SetupLevel(boolean skipprecip)
globalweather = mapheaderinfo[gamemap-1]->weather;
#ifdef HWRENDER // not win32 only 19990829 by Kin
// gotta free this regardless of rendermode.
// maybe we're not in opengl anymore.......
// Jimita: Free extrasubsectors regardless of renderer.
// Maybe we're not in OpenGL anymore.
if (extrasubsectors)
free(extrasubsectors);
extrasubsectors = NULL;
@ -3162,7 +3162,7 @@ void HWR_SetupLevel(void)
#endif
// Correct missing sidedefs & deep water trick
HWR_CorrectSWTricks();
// don't do it twice...
// Jimita: Don't call this more than once!
if (!extrasubsectors)
HWR_CreatePlanePolygons((INT32)numnodes - 1);
}

View File

@ -1339,6 +1339,7 @@ void R_RenderPlayerView(player_t *player)
skyVisible1 = skyVisible;
}
// Jimita
#ifdef HWRENDER
void R_InitHardwareMode(void)
{

View File

@ -172,6 +172,7 @@ void SCR_SetMode(void)
if (!(setmodeneeded || setrenderneeded) || WipeInAction)
return; // should never happen and don't change it during a wipe, BAD!
// Jimita
if (setrenderneeded)
{
needpatchflush = true;
@ -417,6 +418,7 @@ void SCR_ActuallyChangeRenderer(void)
setrenderneeded = 0;
}
// Jimita
void SCR_ChangeRenderer(void)
{
setrenderneeded = 0;

View File

@ -189,6 +189,7 @@ void Y_IntermissionDrawer(void)
if (intertype == int_none || rendermode == render_none)
return;
// Jimita
if (needpatchrecache)
{
Y_CleanupData();