diff options
author | Robert Göffringmann | 2004-10-25 00:27:53 +0000 |
---|---|---|
committer | Robert Göffringmann | 2004-10-25 00:27:53 +0000 |
commit | 376f51ba7954d5fe09c2887d4027a0f208c702e9 (patch) | |
tree | c5359da86510b3761e0d35f00086fd3bf013a1ce /sky/intro.cpp | |
parent | 6fd31192e1413e2a84c22a28379278e5ee8a9355 (diff) | |
download | scummvm-rg350-376f51ba7954d5fe09c2887d4027a0f208c702e9.tar.gz scummvm-rg350-376f51ba7954d5fe09c2887d4027a0f208c702e9.tar.bz2 scummvm-rg350-376f51ba7954d5fe09c2887d4027a0f208c702e9.zip |
use relative timing instead of constant values.
svn-id: r15684
Diffstat (limited to 'sky/intro.cpp')
-rw-r--r-- | sky/intro.cpp | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/sky/intro.cpp b/sky/intro.cpp index e2e338d1bf..8a7b0c1630 100644 --- a/sky/intro.cpp +++ b/sky/intro.cpp @@ -623,6 +623,7 @@ Intro::Intro(Disk *disk, Screen *screen, MusicBase *music, Sound *sound, Text *t _saveBuf = (uint8*)malloc(10000); _bgBuf = NULL; _quitProg = false; + _relDelay = 0; } Intro::~Intro(void) { @@ -681,9 +682,12 @@ bool Intro::nextPart(uint16 *&data) { return true; case FADEUP: _skyScreen->paletteFadeUp(*data++); + _relDelay += 32 * 20; // hack: the screen uses a seperate delay function for the + // blocking fadeups. So add 32*20 msecs to out delay counter. return true; case FADEDOWN: _skyScreen->fnFadeDown(0); + _relDelay += 32 * 20; // hack: see above. return true; case DELAY: if (!escDelay(*data++)) @@ -794,11 +798,7 @@ bool Intro::floppyScrollFlirt(void) { } _system->copyRectToScreen(scrollPos, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT); _system->updateScreen(); -#ifndef _WIN32_WCE - if (!escDelay(40)) -#else - if (!escDelay(15)) -#endif + if (!escDelay(60)) doContinue = false; } memcpy(_skyScreen->giveCurrent(), scrollPos, FRAME_SIZE); @@ -890,11 +890,13 @@ void Intro::restoreScreen(void) { bool Intro::escDelay(uint32 msecs) { OSystem::Event event; + if (_relDelay == 0) // first call, init with system time + _relDelay = (int32)_system->getMillis(); + + _relDelay += msecs; // now wait until _system->getMillis() >= _relDelay + + int32 nDelay = 0; do { -#ifdef _WIN32_WCE - uint32 startTimeLoop = _system->getMillis(); - uint32 delta; -#endif while (_system->pollEvent(event)) { if (event.event_code == OSystem::EVENT_KEYDOWN) { if (event.kbd.keycode == 27) @@ -904,22 +906,13 @@ bool Intro::escDelay(uint32 msecs) { return false; } } -#ifdef _WIN32_WCE - uint8 nDelay = (msecs > 15) ? (15) : ((uint8)msecs); -#else - uint8 nDelay = (msecs > 50) ? (50) : ((uint8)msecs); -#endif + nDelay = _relDelay - _system->getMillis(); + if (nDelay < 0) + nDelay = 0; + else if (nDelay > 15) + nDelay = 15; _system->delayMillis(nDelay); -#ifdef _WIN32_WCE - delta = _system->getMillis() - startTimeLoop; - if (delta > msecs) - break; - else - msecs -= delta; -#else - msecs -= nDelay; -#endif - } while (msecs > 0); + } while (nDelay == 15); return true; } |