summaryrefslogtreecommitdiff
path: root/src/video/win32_v.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/video/win32_v.c')
-rw-r--r--src/video/win32_v.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/video/win32_v.c b/src/video/win32_v.c
index 7588653f0..eab832ae5 100644
--- a/src/video/win32_v.c
+++ b/src/video/win32_v.c
@@ -786,11 +786,14 @@ static void CheckPaletteAnim(void)
static void Win32GdiMainLoop(void)
{
MSG mesg;
- uint32 next_tick = GetTickCount() + 30, cur_ticks;
+ uint32 cur_ticks = GetTickCount();
+ uint32 next_tick = cur_ticks + 30;
_wnd.running = true;
for (;;) {
+ uint32 prev_cur_ticks = cur_ticks; // to check for wrapping
+
while (PeekMessage(&mesg, NULL, 0, 0, PM_REMOVE)) {
InteractiveRandom(); // randomness
DispatchMessage(&mesg);
@@ -810,11 +813,8 @@ static void Win32GdiMainLoop(void)
}
cur_ticks = GetTickCount();
- 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 = _wnd.has_focus && GetAsyncKeyState(VK_CONTROL)<0;
_shift_pressed = _wnd.has_focus && GetAsyncKeyState(VK_SHIFT)<0;
#ifdef _DEBUG