diff --git a/src/video/cocoa/event.mm b/src/video/cocoa/event.mm index 1298961dc..5b54e459f 100644 --- a/src/video/cocoa/event.mm +++ b/src/video/cocoa/event.mm @@ -90,6 +90,8 @@ static uint32 GetTick() return tim.tv_usec / 1000 + tim.tv_sec * 1000; } +extern uint32 _qz_last_frame; + static void QZ_WarpCursor(int x, int y) { assert(_cocoa_subdriver != NULL); @@ -683,6 +685,9 @@ void QZ_GameLoop() GameLoop(); + if (_fast_forward && GetTick() - _qz_last_frame <= MILLISECONDS_PER_TICK/2) + continue; + UpdateWindows(); QZ_CheckPaletteAnim(); _cocoa_subdriver->Draw(); diff --git a/src/video/cocoa/wnd_quartz.mm b/src/video/cocoa/wnd_quartz.mm index 795a311bc..59286e0b8 100644 --- a/src/video/cocoa/wnd_quartz.mm +++ b/src/video/cocoa/wnd_quartz.mm @@ -34,6 +34,8 @@ #include "../../core/math_func.hpp" #include "../../gfx_func.h" +#import /* gettimeofday */ + /* On some old versions of MAC OS this may not be defined. * Those versions generally only produce code for PPC. So it should be safe to * set this to 0. */ @@ -57,6 +59,17 @@ class WindowQuartzSubdriver; - (void)drawRect:(NSRect)invalidRect; @end + +static uint32 GetTick() +{ + struct timeval tim; + + gettimeofday(&tim, NULL); + return tim.tv_usec / 1000 + tim.tv_sec * 1000; +} + +uint32 _qz_last_frame; + class WindowQuartzSubdriver : public CocoaSubdriver { private: /** @@ -214,6 +227,7 @@ static CGColorSpaceRef QZ_GetCorrectColorSpace() } CGImageRelease(fullImage); + _qz_last_frame = GetTick(); } @end