- moved parts of videoNextPage to app_loop.

This commit is contained in:
Christoph Oelckers 2020-08-23 18:08:08 +02:00
parent adb98a47ba
commit 8b8f048393
6 changed files with 20 additions and 35 deletions

View file

@ -369,7 +369,7 @@ EXTERN int32_t display_mirror;
EXTERN ClockTicks totalclock, totalclocklock;
static inline int32_t BGetTime(void) { return (int32_t) totalclock; }
EXTERN int32_t numframes, randomseed;
EXTERN int32_t randomseed;
EXTERN int16_t sintable[2048];
EXTERN int16_t numshades;

View file

@ -1275,8 +1275,6 @@ int32_t renderDrawRoomsQ16(int32_t daposx, int32_t daposy, int32_t daposz,
{
int32_t i;
beforedrawrooms = 0;
set_globalpos(daposx, daposy, daposz);
set_globalang(daang);
@ -1922,8 +1920,6 @@ void renderDrawMapView(int32_t dax, int32_t day, int32_t zoome, int16_t ang)
renderSetAspect(65536, divscale16((320*5)/8, 200));
beforedrawrooms = 0;
Bmemset(gotsector, 0, sizeof(gotsector));
vec2_t const c1 = { (windowxy1.x<<12), (windowxy1.y<<12) };
@ -2723,28 +2719,13 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
return 0;
}
void DrawFullscreenBlends();
//
// nextpage
//
void videoNextPage(void)
{
// Draw overlay elements to the 2D drawer
FStat::PrintStat(twod);
C_DrawConsole();
M_Drawer();
// Handle the final 2D overlays.
if (gamestate == GS_LEVEL) DrawFullscreenBlends();
DrawRateStuff();
if (in3dmode())
{
g_beforeSwapTime = timerGetHiTicks();
videoShowFrame(0);
}
g_beforeSwapTime = timerGetHiTicks();
videoShowFrame(0);
omdtims = mdtims;
mdtims = timerGetTicks();
@ -2752,13 +2733,6 @@ void videoNextPage(void)
for (native_t i = 0; i < MAXSPRITES + MAXUNIQHUDID; ++i)
if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM))
spriteext[i].mdanimtims += mdtims - omdtims;
beforedrawrooms = 1;
numframes++;
// This should be in the main loop but with some of the games still having multiple render loops it cannot be moved out of here
twod->SetSize(screen->GetWidth(), screen->GetHeight());
twodpsp.SetSize(screen->GetWidth(), screen->GetHeight());
I_SetFrameTime();
}
//

View file

@ -118,6 +118,7 @@ void S_ParseSndInfo();
void I_DetectOS(void);
void LoadScripts();
void app_loop();
void DrawFullscreenBlends();
bool AppActive;
@ -847,6 +848,7 @@ int RunGame()
gamestate = GS_LEVEL;
gi->app_init();
app_loop();
return 0; // this is never reached. app_loop only exits via exception.
}
//---------------------------------------------------------------------------
@ -863,7 +865,21 @@ void app_loop()
{
try
{
twod->SetSize(screen->GetWidth(), screen->GetHeight());
twodpsp.SetSize(screen->GetWidth(), screen->GetHeight());
I_SetFrameTime();
gi->RunGameFrame();
// Draw overlay elements to the 2D drawer
FStat::PrintStat(twod);
C_DrawConsole();
M_Drawer();
// Handle the final 2D overlays.
if (gamestate == GS_LEVEL) DrawFullscreenBlends();
DrawRateStuff();
videoNextPage();
videoSetBrightness(0); // immediately reset this so that the value doesn't stick around in the backend.
}

View file

@ -472,7 +472,6 @@ void SaveEngineState()
fw->Write(&myconnectindex, sizeof(myconnectindex));
fw->Write(&connecthead, sizeof(connecthead));
fw->Write(connectpoint2, sizeof(connectpoint2));
fw->Write(&numframes, sizeof(numframes));
fw->Write(&randomseed, sizeof(randomseed));
fw->Write(&numshades, sizeof(numshades));
fw->Write(&automapping, sizeof(automapping));
@ -536,7 +535,6 @@ void LoadEngineState()
fr.Read(&myconnectindex, sizeof(myconnectindex));
fr.Read(&connecthead, sizeof(connecthead));
fr.Read(connectpoint2, sizeof(connectpoint2));
fr.Read(&numframes, sizeof(numframes));
fr.Read(&randomseed, sizeof(randomseed));
fr.Read(&numshades, sizeof(numshades));
fr.Read(&automapping, sizeof(automapping));

View file

@ -29,8 +29,7 @@ BEGIN_PS_NS
void resettiming()
{
numframes = 0L;
totalclock = 0L;
totalclock = 0;
// TODO totalclocklock = 0L;
}

View file

@ -77,8 +77,6 @@ void ResetEngine()
totalclock = 0;
ototalclock = totalclock;
localclock = (int)totalclock;
numframes = 0;
}
void InstallEngine()