|
|
|
|
@ -212,7 +212,7 @@ void nthread_ignore_mutex(bool bStart)
|
|
|
|
|
sgbThreadIsRunning = bStart; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
bool nthread_has_500ms_passed() |
|
|
|
|
bool nthread_has_500ms_passed(bool *drawGame /*= nullptr*/) |
|
|
|
|
{ |
|
|
|
|
int currentTickCount = SDL_GetTicks(); |
|
|
|
|
int ticksElapsed = currentTickCount - last_tick; |
|
|
|
|
@ -234,6 +234,13 @@ bool nthread_has_500ms_passed()
|
|
|
|
|
ticksElapsed = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (drawGame != nullptr) { |
|
|
|
|
// Check if we missed a game tick.
|
|
|
|
|
// This can happen when we run a low-end device that can't render fast enough (typically 20fps).
|
|
|
|
|
// If this happens, try to speed-up the game by skipping the rendering.
|
|
|
|
|
// This avoids desyncs and hourglasses when running multiplayer and slowdowns in singleplayer.
|
|
|
|
|
*drawGame = ticksElapsed <= gnTickDelay; |
|
|
|
|
} |
|
|
|
|
return ticksElapsed >= 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|