summaryrefslogtreecommitdiff
path: root/src/video/cocoa_v.m
diff options
context:
space:
mode:
Diffstat (limited to 'src/video/cocoa_v.m')
-rw-r--r--src/video/cocoa_v.m12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/video/cocoa_v.m b/src/video/cocoa_v.m
index 8ea16315a..46518445b 100644
--- a/src/video/cocoa_v.m
+++ b/src/video/cocoa_v.m
@@ -652,8 +652,8 @@ static bool QZ_PollEvent(void)
static void QZ_GameLoop(void)
{
- uint32 next_tick = GetTick() + 30;
- uint32 cur_ticks;
+ uint32 cur_ticks = GetTick();
+ uint32 next_tick = cur_ticks + 30;
uint32 pal_tick = 0;
#ifdef _DEBUG
uint32 et0, et, st0, st;
@@ -680,6 +680,7 @@ static void QZ_GameLoop(void)
CSleep(1);
for (;;) {
+ uint32 prev_cur_ticks; // to check for wrapping
InteractiveRandom(); // randomness
while (QZ_PollEvent()) {}
@@ -698,11 +699,8 @@ static void QZ_GameLoop(void)
}
cur_ticks = GetTick();
- if ((_fast_forward && !_pause) || cur_ticks > next_tick)
- next_tick = cur_ticks;
-
- if (cur_ticks == next_tick) {
- next_tick += 30;
+ if (cur_ticks >= next_tick || (_fast_forward && !_pause) || cur_ticks < prev_cur_ticks) {
+ next_tick = cur_ticks + 30;
_ctrl_pressed = !!(_cocoa_video_data.current_mods & NSControlKeyMask);
_shift_pressed = !!(_cocoa_video_data.current_mods & NSShiftKeyMask);