make maxgameticks working via surface unlock for atomic bomberman

This commit is contained in:
FunkyFr3sh 2018-11-09 20:39:45 +01:00
parent 0e3e7659cb
commit bdb5675459
4 changed files with 19 additions and 5 deletions

View file

@ -133,18 +133,26 @@ BOOL detect_cutscene()
return FALSE;
}
void LimitGameTicks()
void LimitGameTicks(BOOL isBltOrFlip)
{
static DWORD nextGameTick;
static DWORD lastBltOrFlipTick;
if (!nextGameTick)
{
nextGameTick = timeGetTime();
return;
}
nextGameTick += ddraw->ticklength;
DWORD tickCount = timeGetTime();
if (isBltOrFlip)
lastBltOrFlipTick = tickCount;
else if (lastBltOrFlipTick + ddraw->ticklength >= tickCount)
return;
nextGameTick += ddraw->ticklength;
int sleepTime = nextGameTick - tickCount;
if (sleepTime <= 0 || sleepTime > ddraw->ticklength)
nextGameTick = tickCount;
else