- moved I_StartFrame to the top of the loop and cleaned up baselayer.hj

This commit is contained in:
Christoph Oelckers 2020-08-28 08:44:44 +02:00
parent d73bf62465
commit 536e7455f2
9 changed files with 16 additions and 57 deletions

View file

@ -823,8 +823,9 @@ static void gameTicker()
else else
{ {
netCheckSync(); netCheckSync();
auto beforeSwapTime = I_msTimeF();
viewDrawScreen(); viewDrawScreen();
g_gameUpdateAndDrawTime = g_beforeSwapTime/* I_msTimeF()*/ - gameUpdateStartTime; g_gameUpdateAndDrawTime = beforeSwapTime/* I_msTimeF()*/ - gameUpdateStartTime;
} }
} }

View file

@ -15,27 +15,12 @@
#include "zstring.h" #include "zstring.h"
#include "vectors.h" #include "vectors.h"
extern int32_t swapcomplete;
EXTERN_CVAR(Bool, r_usenewaspect) EXTERN_CVAR(Bool, r_usenewaspect)
// video // video
extern int32_t newaspect_enable; extern int32_t newaspect_enable;
extern int32_t r_fpgrouscan;
extern int32_t setaspect_new_use_dimen;
extern int32_t xres, yres, bpp;
int32_t videoCheckMode(int32_t *x, int32_t *y, int32_t c, int32_t fs, int32_t forced);
int32_t videoSetMode(int32_t x, int32_t y, int32_t c, int32_t fs);
void videoGetModes(void);
void videoShowFrame(int32_t); void videoShowFrame(int32_t);
int32_t videoUpdatePalette(int32_t start, int32_t num);
extern int32_t qsetmode;
#define in3dmode() (qsetmode==200)
extern int32_t g_logFlushWindow;
#include "gamestruct.h" #include "gamestruct.h"
#endif // baselayer_h_ #endif // baselayer_h_

View file

@ -646,7 +646,6 @@ void vox_undefine(int32_t const);
void vox_deinit(); void vox_deinit();
int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daupscaledydim, int32_t dabpp, int32_t daupscalefactor); int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daupscaledydim, int32_t dabpp, int32_t daupscalefactor);
void videoNextPage(void);
void videoSetCorrectedAspect(); void videoSetCorrectedAspect();
void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2); void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2);
void renderSetAspect(int32_t daxrange, int32_t daaspect); void renderSetAspect(int32_t daxrange, int32_t daaspect);

View file

@ -83,7 +83,6 @@ static int32_t oxdimen = -1, oviewingrange = -1, oxyaspect = -1;
CVAR(Bool, r_usenewaspect, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG); CVAR(Bool, r_usenewaspect, true, CVAR_ARCHIVE | CVAR_GLOBALCONFIG);
int32_t newaspect_enable=0; int32_t newaspect_enable=0;
int32_t r_fpgrouscan = 1;
int32_t globalflags; int32_t globalflags;
static int8_t tempbuf[MAXWALLS]; static int8_t tempbuf[MAXWALLS];
@ -350,7 +349,6 @@ int16_t globalpicnum;
static int32_t globaly1, globalx2; static int32_t globaly1, globalx2;
int16_t sectorborder[256]; int16_t sectorborder[256];
int32_t ydim16, qsetmode = 0;
int16_t pointhighlight=-1, linehighlight=-1, highlightcnt=0; int16_t pointhighlight=-1, linehighlight=-1, highlightcnt=0;
int32_t halfxdim16, midydim16; int32_t halfxdim16, midydim16;
@ -2681,15 +2679,9 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
daupscaledxdim = max(320, daupscaledxdim); daupscaledxdim = max(320, daupscaledxdim);
daupscaledydim = max(200, daupscaledydim); daupscaledydim = max(200, daupscaledydim);
if (in3dmode() &&
(xres == daupscaledxdim) && (yres == daupscaledydim) && (bpp == dabpp))
return 0;
Bstrcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI." Bstrcpy(kensmessage,"!!!! BUILD engine&tools programmed by Ken Silverman of E.G. RI."
" (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!"); " (c) Copyright 1995 Ken Silverman. Summary: BUILD = Ken. !!!!");
j = bpp;
rendmode = REND_POLYMOST; rendmode = REND_POLYMOST;
upscalefactor = 1; upscalefactor = 1;
@ -2713,26 +2705,9 @@ int32_t videoSetGameMode(char davidoption, int32_t daupscaledxdim, int32_t daups
if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); } if (searchx < 0) { searchx = halfxdimen; searchy = (ydimen>>1); }
qsetmode = 200;
return 0; return 0;
} }
//
// nextpage
//
void videoNextPage(void)
{
g_beforeSwapTime = I_msTimeF();
videoShowFrame(0);
omdtims = mdtims;
mdtims = I_msTime();
for (native_t i = 0; i < MAXSPRITES + MAXUNIQHUDID; ++i)
if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM))
spriteext[i].mdanimtims += mdtims - omdtims;
}
// //
// qloadkvx // qloadkvx
// //
@ -3718,8 +3693,6 @@ void rotatepoint(vec2_t const pivot, vec2_t p, int16_t const daang, vec2_t * con
p2->y = dmulscale14(p.y, dacos, p.x, dasin) + pivot.y; p2->y = dmulscale14(p.y, dacos, p.x, dasin) + pivot.y;
} }
int32_t setaspect_new_use_dimen = 0;
void videoSetCorrectedAspect() void videoSetCorrectedAspect()
{ {
if (/*r_usenewaspect &&*/ newaspect_enable && videoGetRenderMode() != REND_POLYMER) if (/*r_usenewaspect &&*/ newaspect_enable && videoGetRenderMode() != REND_POLYMER)
@ -3730,11 +3703,8 @@ void videoSetCorrectedAspect()
int32_t yx = (65536 * 5) / 4; int32_t yx = (65536 * 5) / 4;
int32_t vr, y, x; int32_t vr, y, x;
const int32_t xd = setaspect_new_use_dimen ? xdimen : xdim; x = xdim;
const int32_t yd = setaspect_new_use_dimen ? ydimen : ydim; y = ydim;
x = xd;
y = yd;
vr = divscale16(x*3, y*4); vr = divscale16(x*3, y*4);

View file

@ -109,7 +109,6 @@ extern int16_t searchbottomwall, searchisbottom;
extern char inpreparemirror; extern char inpreparemirror;
extern int16_t sectorborder[256]; extern int16_t sectorborder[256];
extern int32_t qsetmode;
extern int32_t hitallsprites; extern int32_t hitallsprites;
extern int32_t xb1[MAXWALLSB]; extern int32_t xb1[MAXWALLSB];

View file

@ -1677,6 +1677,16 @@ static void mdfree(mdmodel_t *vm)
if (vm->mdnum == 2 || vm->mdnum == 3) { md3free((md3model_t *)vm); return; } if (vm->mdnum == 2 || vm->mdnum == 3) { md3free((md3model_t *)vm); return; }
} }
static void updateModelInterpolation()
{
// sigh...
omdtims = mdtims;
mdtims = I_msTime();
for (native_t i = 0; i < MAXSPRITES + MAXUNIQHUDID; ++i)
if ((mdpause && spriteext[i].mdanimtims) || (spriteext[i].flags & SPREXT_NOMDANIM))
spriteext[i].mdanimtims += mdtims - omdtims;
}
#endif #endif
//---------------------------------------- MD LIBRARY ENDS ---------------------------------------- //---------------------------------------- MD LIBRARY ENDS ----------------------------------------

View file

@ -91,11 +91,9 @@ CUSTOM_CVAR(Int, mouse_capturemode, 1, CVAR_GLOBALCONFIG | CVAR_ARCHIVE)
} }
// The last remains of sdlayer.cpp // The last remains of sdlayer.cpp
double g_beforeSwapTime;
GameInterface* gi; GameInterface* gi;
int myconnectindex, numplayers; int myconnectindex, numplayers;
int connecthead, connectpoint2[MAXMULTIPLAYERS]; int connecthead, connectpoint2[MAXMULTIPLAYERS];
int32_t xres = -1, yres = -1, bpp = 0;
auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries. auto vsnprintfptr = vsnprintf; // This is an inline in Visual Studio but we need an address for it to satisfy the MinGW compiled libraries.
int gameclock; int gameclock;
int lastTic; int lastTic;
@ -938,10 +936,10 @@ void app_loop()
{ {
try try
{ {
I_SetFrameTime();
TickSubsystems(); TickSubsystems();
twod->SetSize(screen->GetWidth(), screen->GetHeight()); twod->SetSize(screen->GetWidth(), screen->GetHeight());
twodpsp.SetSize(screen->GetWidth(), screen->GetHeight()); twodpsp.SetSize(screen->GetWidth(), screen->GetHeight());
I_SetFrameTime();
handleevents(); handleevents();
updatePauseStatus(); updatePauseStatus();
@ -962,7 +960,7 @@ void app_loop()
soundEngine->UpdateSounds(I_GetTime()); soundEngine->UpdateSounds(I_GetTime());
Mus_UpdateMusic(); // must be at the end. Mus_UpdateMusic(); // must be at the end.
videoNextPage(); videoShowFrame(0);
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.
} }
catch (CRecoverableError& err) catch (CRecoverableError& err)

View file

@ -96,7 +96,6 @@ struct GameInterface
}; };
extern GameInterface* gi; extern GameInterface* gi;
extern double g_beforeSwapTime;
void ImGui_Begin_Frame(); void ImGui_Begin_Frame();

View file

@ -222,9 +222,7 @@ static void analyzesprites()
void ResetView() void ResetView()
{ {
//videoSetGameMode(gSetup.fullscreen, gSetup.xdim, gSetup.ydim, gSetup.bpp, 0);
EraseScreen(overscanindex); EraseScreen(overscanindex);
//videoUpdatePalette(0, 256);
#ifdef USE_OPENGL #ifdef USE_OPENGL
videoTintBlood(0, 0, 0); videoTintBlood(0, 0, 0);
#endif #endif