cli: fix a freeze when turning FPS limiting back on after some boost mode
(regression in r3944)
This commit is contained in:
parent
a99026df03
commit
e1c70f0ac6
|
@ -755,11 +755,11 @@ int main(int argc, char ** argv) {
|
||||||
now = SDL_GetTicks();
|
now = SDL_GetTicks();
|
||||||
#endif
|
#endif
|
||||||
int delay = (limiter_tick0 + limiter_frame_counter*1000/FPS_LIMITER_FPS) - now;
|
int delay = (limiter_tick0 + limiter_frame_counter*1000/FPS_LIMITER_FPS) - now;
|
||||||
if (delay > 0) {
|
if (delay < -500 || delay > 100) { // reset if we fall too far behind don't want to run super fast until we catch up
|
||||||
SDL_Delay(delay);
|
|
||||||
} else if (delay < -500) { // reset if we fall too far behind don't want to run super fast until we catch up
|
|
||||||
limiter_tick0 = now;
|
limiter_tick0 = now;
|
||||||
limiter_frame_counter = 0;
|
limiter_frame_counter = 0;
|
||||||
|
} else if (delay > 0) {
|
||||||
|
SDL_Delay(delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// always count frames, we'll mess up if the limiter gets turned on later otherwise
|
// always count frames, we'll mess up if the limiter gets turned on later otherwise
|
||||||
|
|
Loading…
Reference in New Issue