diff options
-rw-r--r-- | sky/intro.cpp | 41 | ||||
-rw-r--r-- | sky/intro.h | 2 | ||||
-rw-r--r-- | sky/screen.cpp | 14 |
3 files changed, 31 insertions, 26 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; } diff --git a/sky/intro.h b/sky/intro.h index ff6ce2528e..c95819437a 100644 --- a/sky/intro.h +++ b/sky/intro.h @@ -58,6 +58,8 @@ private: uint32 _bgSize; PlayingSoundHandle _voice, _bgSfx; + int32 _relDelay; + bool escDelay(uint32 msecs); bool nextPart(uint16 *&data); bool floppyScrollFlirt(void); diff --git a/sky/screen.cpp b/sky/screen.cpp index 6863fb16e2..cb1d2f9583 100644 --- a/sky/screen.cpp +++ b/sky/screen.cpp @@ -245,11 +245,16 @@ void Screen::fnFadeDown(uint32 scroll) { // will be scrolled into the visible screen by fnFadeUp // fnFadeUp also frees the _scrollScreen } else { + uint32 delayTime = _system->getMillis(); for (uint8 cnt = 0; cnt < 32; cnt++) { + delayTime += 20; palette_fadedown_helper((uint32 *)_palette, GAME_COLOURS); _system->setPalette(_palette, 0, GAME_COLOURS); _system->updateScreen(); - _system->delayMillis(20); + int32 waitTime = (int32)delayTime - _system->getMillis(); + if (waitTime < 0) + waitTime = 0; + _system->delayMillis((uint)waitTime); } } } @@ -289,7 +294,9 @@ void Screen::paletteFadeUp(uint8 *pal) { convertPalette(pal, tmpPal); + uint32 delayTime = _system->getMillis(); for (uint8 cnt = 1; cnt <= 32; cnt++) { + delayTime += 20; for (uint8 colCnt = 0; colCnt < GAME_COLOURS; colCnt++) { _palette[(colCnt << 2) | 0] = (tmpPal[(colCnt << 2) | 0] * cnt) >> 5; _palette[(colCnt << 2) | 1] = (tmpPal[(colCnt << 2) | 1] * cnt) >> 5; @@ -297,7 +304,10 @@ void Screen::paletteFadeUp(uint8 *pal) { } _system->setPalette(_palette, 0, GAME_COLOURS); _system->updateScreen(); - _system->delayMillis(20); + int32 waitTime = (int32)delayTime - _system->getMillis(); + if (waitTime < 0) + waitTime = 0; + _system->delayMillis((uint)waitTime); } } |