mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2026-04-27 12:31:54 +00:00
Merge branch 'basic-frame-skip' into 'master'
Frame skipping See merge request KartKrew/Kart!1566
This commit is contained in:
commit
2d83bdbc7c
1 changed files with 31 additions and 5 deletions
|
|
@ -330,8 +330,9 @@ gamestate_t wipegamestate = GS_LEVEL;
|
||||||
INT16 wipetypepre = -1;
|
INT16 wipetypepre = -1;
|
||||||
INT16 wipetypepost = -1;
|
INT16 wipetypepost = -1;
|
||||||
|
|
||||||
static void D_Display(void)
|
static bool D_Display(void)
|
||||||
{
|
{
|
||||||
|
bool ranwipe = false;
|
||||||
boolean forcerefresh = false;
|
boolean forcerefresh = false;
|
||||||
static boolean wipe = false;
|
static boolean wipe = false;
|
||||||
INT32 wipedefindex = 0;
|
INT32 wipedefindex = 0;
|
||||||
|
|
@ -342,7 +343,7 @@ static void D_Display(void)
|
||||||
if (!dedicated)
|
if (!dedicated)
|
||||||
{
|
{
|
||||||
if (nodrawers)
|
if (nodrawers)
|
||||||
return; // for comparative timing/profiling
|
return false; // for comparative timing/profiling
|
||||||
|
|
||||||
// Lactozilla: Switching renderers works by checking
|
// Lactozilla: Switching renderers works by checking
|
||||||
// if the game has to do it right when the frame
|
// if the game has to do it right when the frame
|
||||||
|
|
@ -411,6 +412,7 @@ static void D_Display(void)
|
||||||
F_WipeColorFill(31);
|
F_WipeColorFill(31);
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
F_RunWipe(wipedefindex, wipetypepre, gamestate != GS_MENU, "FADEMAP0", false, false);
|
F_RunWipe(wipedefindex, wipetypepre, gamestate != GS_MENU, "FADEMAP0", false, false);
|
||||||
|
ranwipe = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G_GamestateUsesLevel() == false && rendermode != render_none)
|
if (G_GamestateUsesLevel() == false && rendermode != render_none)
|
||||||
|
|
@ -424,6 +426,7 @@ static void D_Display(void)
|
||||||
else //dedicated servers
|
else //dedicated servers
|
||||||
{
|
{
|
||||||
F_RunWipe(wipedefindex, wipedefs[wipedefindex], gamestate != GS_MENU, "FADEMAP0", false, false);
|
F_RunWipe(wipedefindex, wipedefs[wipedefindex], gamestate != GS_MENU, "FADEMAP0", false, false);
|
||||||
|
ranwipe = true;
|
||||||
wipegamestate = gamestate;
|
wipegamestate = gamestate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -433,7 +436,7 @@ static void D_Display(void)
|
||||||
wipetypepre = -1;
|
wipetypepre = -1;
|
||||||
|
|
||||||
if (dedicated) //bail out after wipe logic
|
if (dedicated) //bail out after wipe logic
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
// Catch runaway clipping rectangles.
|
// Catch runaway clipping rectangles.
|
||||||
V_ClearClipRect();
|
V_ClearClipRect();
|
||||||
|
|
@ -710,6 +713,7 @@ static void D_Display(void)
|
||||||
F_WipeEndScreen();
|
F_WipeEndScreen();
|
||||||
|
|
||||||
F_RunWipe(wipedefindex, wipedefs[wipedefindex], gamestate != GS_MENU && gamestate != GS_TITLESCREEN, "FADEMAP0", true, false);
|
F_RunWipe(wipedefindex, wipedefs[wipedefindex], gamestate != GS_MENU && gamestate != GS_TITLESCREEN, "FADEMAP0", true, false);
|
||||||
|
ranwipe = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// reset counters so timedemo doesn't count the wipe duration
|
// reset counters so timedemo doesn't count the wipe duration
|
||||||
|
|
@ -765,6 +769,8 @@ static void D_Display(void)
|
||||||
I_FinishUpdate(); // page flip or blit buffer
|
I_FinishUpdate(); // page flip or blit buffer
|
||||||
ps_swaptime = I_GetPreciseTime() - ps_swaptime;
|
ps_swaptime = I_GetPreciseTime() - ps_swaptime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return ranwipe;
|
||||||
}
|
}
|
||||||
|
|
||||||
// =========================================================================
|
// =========================================================================
|
||||||
|
|
@ -781,6 +787,7 @@ void D_SRB2Loop(void)
|
||||||
|
|
||||||
boolean interp = false;
|
boolean interp = false;
|
||||||
boolean doDisplay = false;
|
boolean doDisplay = false;
|
||||||
|
int frameskip = 0;
|
||||||
|
|
||||||
if (dedicated)
|
if (dedicated)
|
||||||
server = true;
|
server = true;
|
||||||
|
|
@ -831,6 +838,8 @@ void D_SRB2Loop(void)
|
||||||
capbudget = (precise_t) budget;
|
capbudget = (precise_t) budget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ranwipe = false;
|
||||||
|
|
||||||
I_UpdateTime(cv_timescale.value);
|
I_UpdateTime(cv_timescale.value);
|
||||||
|
|
||||||
if (lastwipetic)
|
if (lastwipetic)
|
||||||
|
|
@ -927,9 +936,9 @@ void D_SRB2Loop(void)
|
||||||
rendertimefrac_unpaused = FRACUNIT;
|
rendertimefrac_unpaused = FRACUNIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (interp || doDisplay)
|
if ((interp || doDisplay) && !frameskip)
|
||||||
{
|
{
|
||||||
D_Display();
|
ranwipe = D_Display();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
|
|
@ -980,6 +989,23 @@ void D_SRB2Loop(void)
|
||||||
finishprecise = I_GetPreciseTime();
|
finishprecise = I_GetPreciseTime();
|
||||||
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
|
deltasecs = (double)((INT64)(finishprecise - enterprecise)) / I_GetPrecisePrecision();
|
||||||
deltatics = deltasecs * NEWTICRATE;
|
deltatics = deltasecs * NEWTICRATE;
|
||||||
|
|
||||||
|
// If time spent this game loop exceeds a single tic,
|
||||||
|
// it's probably because of rendering.
|
||||||
|
//
|
||||||
|
// Skip rendering the next frame, up to a limit of 3
|
||||||
|
// frames before a frame is rendered no matter what.
|
||||||
|
//
|
||||||
|
// Wipes run an inner loop and artificially increase
|
||||||
|
// the measured time.
|
||||||
|
if (!ranwipe && frameskip < 3 && deltatics > 1.0)
|
||||||
|
{
|
||||||
|
frameskip++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
frameskip = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue