- 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; EXTERN ClockTicks totalclock, totalclocklock;
static inline int32_t BGetTime(void) { return (int32_t) totalclock; } 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 sintable[2048];
EXTERN int16_t numshades; 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; int32_t i;
beforedrawrooms = 0;
set_globalpos(daposx, daposy, daposz); set_globalpos(daposx, daposy, daposz);
set_globalang(daang); 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)); renderSetAspect(65536, divscale16((320*5)/8, 200));
beforedrawrooms = 0;
Bmemset(gotsector, 0, sizeof(gotsector)); Bmemset(gotsector, 0, sizeof(gotsector));
vec2_t const c1 = { (windowxy1.x<<12), (windowxy1.y<<12) }; 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; return 0;
} }
void DrawFullscreenBlends();
// //
// nextpage // nextpage
// //
void videoNextPage(void) 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(); g_beforeSwapTime = timerGetHiTicks();
videoShowFrame(0); videoShowFrame(0);
}
omdtims = mdtims; omdtims = mdtims;
mdtims = timerGetTicks(); mdtims = timerGetTicks();
@ -2752,13 +2733,6 @@ void videoNextPage(void)
for (native_t i = 0; i < MAXSPRITES + MAXUNIQHUDID; ++i) for (native_t i = 0; i < MAXSPRITES + MAXUNIQHUDID; ++i)
if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM)) if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM))
spriteext[i].mdanimtims += mdtims - omdtims; 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 I_DetectOS(void);
void LoadScripts(); void LoadScripts();
void app_loop(); void app_loop();
void DrawFullscreenBlends();
bool AppActive; bool AppActive;
@ -847,6 +848,7 @@ int RunGame()
gamestate = GS_LEVEL; gamestate = GS_LEVEL;
gi->app_init(); gi->app_init();
app_loop(); app_loop();
return 0; // this is never reached. app_loop only exits via exception.
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
@ -863,7 +865,21 @@ void app_loop()
{ {
try try
{ {
twod->SetSize(screen->GetWidth(), screen->GetHeight());
twodpsp.SetSize(screen->GetWidth(), screen->GetHeight());
I_SetFrameTime();
gi->RunGameFrame(); 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(); videoNextPage();
videoSetBrightness(0); // immediately reset this so that the value doesn't stick around in the backend. 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(&myconnectindex, sizeof(myconnectindex));
fw->Write(&connecthead, sizeof(connecthead)); fw->Write(&connecthead, sizeof(connecthead));
fw->Write(connectpoint2, sizeof(connectpoint2)); fw->Write(connectpoint2, sizeof(connectpoint2));
fw->Write(&numframes, sizeof(numframes));
fw->Write(&randomseed, sizeof(randomseed)); fw->Write(&randomseed, sizeof(randomseed));
fw->Write(&numshades, sizeof(numshades)); fw->Write(&numshades, sizeof(numshades));
fw->Write(&automapping, sizeof(automapping)); fw->Write(&automapping, sizeof(automapping));
@ -536,7 +535,6 @@ void LoadEngineState()
fr.Read(&myconnectindex, sizeof(myconnectindex)); fr.Read(&myconnectindex, sizeof(myconnectindex));
fr.Read(&connecthead, sizeof(connecthead)); fr.Read(&connecthead, sizeof(connecthead));
fr.Read(connectpoint2, sizeof(connectpoint2)); fr.Read(connectpoint2, sizeof(connectpoint2));
fr.Read(&numframes, sizeof(numframes));
fr.Read(&randomseed, sizeof(randomseed)); fr.Read(&randomseed, sizeof(randomseed));
fr.Read(&numshades, sizeof(numshades)); fr.Read(&numshades, sizeof(numshades));
fr.Read(&automapping, sizeof(automapping)); fr.Read(&automapping, sizeof(automapping));

View file

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

View file

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