mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-11 13:45:25 +00:00
use relative timing instead of constant values.
svn-id: r15684
This commit is contained in:
parent
6fd31192e1
commit
376f51ba79
@ -623,6 +623,7 @@ Intro::Intro(Disk *disk, Screen *screen, MusicBase *music, Sound *sound, Text *t
|
|||||||
_saveBuf = (uint8*)malloc(10000);
|
_saveBuf = (uint8*)malloc(10000);
|
||||||
_bgBuf = NULL;
|
_bgBuf = NULL;
|
||||||
_quitProg = false;
|
_quitProg = false;
|
||||||
|
_relDelay = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Intro::~Intro(void) {
|
Intro::~Intro(void) {
|
||||||
@ -681,9 +682,12 @@ bool Intro::nextPart(uint16 *&data) {
|
|||||||
return true;
|
return true;
|
||||||
case FADEUP:
|
case FADEUP:
|
||||||
_skyScreen->paletteFadeUp(*data++);
|
_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;
|
return true;
|
||||||
case FADEDOWN:
|
case FADEDOWN:
|
||||||
_skyScreen->fnFadeDown(0);
|
_skyScreen->fnFadeDown(0);
|
||||||
|
_relDelay += 32 * 20; // hack: see above.
|
||||||
return true;
|
return true;
|
||||||
case DELAY:
|
case DELAY:
|
||||||
if (!escDelay(*data++))
|
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->copyRectToScreen(scrollPos, GAME_SCREEN_WIDTH, 0, 0, GAME_SCREEN_WIDTH, GAME_SCREEN_HEIGHT);
|
||||||
_system->updateScreen();
|
_system->updateScreen();
|
||||||
#ifndef _WIN32_WCE
|
if (!escDelay(60))
|
||||||
if (!escDelay(40))
|
|
||||||
#else
|
|
||||||
if (!escDelay(15))
|
|
||||||
#endif
|
|
||||||
doContinue = false;
|
doContinue = false;
|
||||||
}
|
}
|
||||||
memcpy(_skyScreen->giveCurrent(), scrollPos, FRAME_SIZE);
|
memcpy(_skyScreen->giveCurrent(), scrollPos, FRAME_SIZE);
|
||||||
@ -890,11 +890,13 @@ void Intro::restoreScreen(void) {
|
|||||||
bool Intro::escDelay(uint32 msecs) {
|
bool Intro::escDelay(uint32 msecs) {
|
||||||
|
|
||||||
OSystem::Event event;
|
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 {
|
do {
|
||||||
#ifdef _WIN32_WCE
|
|
||||||
uint32 startTimeLoop = _system->getMillis();
|
|
||||||
uint32 delta;
|
|
||||||
#endif
|
|
||||||
while (_system->pollEvent(event)) {
|
while (_system->pollEvent(event)) {
|
||||||
if (event.event_code == OSystem::EVENT_KEYDOWN) {
|
if (event.event_code == OSystem::EVENT_KEYDOWN) {
|
||||||
if (event.kbd.keycode == 27)
|
if (event.kbd.keycode == 27)
|
||||||
@ -904,22 +906,13 @@ bool Intro::escDelay(uint32 msecs) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef _WIN32_WCE
|
nDelay = _relDelay - _system->getMillis();
|
||||||
uint8 nDelay = (msecs > 15) ? (15) : ((uint8)msecs);
|
if (nDelay < 0)
|
||||||
#else
|
nDelay = 0;
|
||||||
uint8 nDelay = (msecs > 50) ? (50) : ((uint8)msecs);
|
else if (nDelay > 15)
|
||||||
#endif
|
nDelay = 15;
|
||||||
_system->delayMillis(nDelay);
|
_system->delayMillis(nDelay);
|
||||||
#ifdef _WIN32_WCE
|
} while (nDelay == 15);
|
||||||
delta = _system->getMillis() - startTimeLoop;
|
|
||||||
if (delta > msecs)
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
msecs -= delta;
|
|
||||||
#else
|
|
||||||
msecs -= nDelay;
|
|
||||||
#endif
|
|
||||||
} while (msecs > 0);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ private:
|
|||||||
uint32 _bgSize;
|
uint32 _bgSize;
|
||||||
PlayingSoundHandle _voice, _bgSfx;
|
PlayingSoundHandle _voice, _bgSfx;
|
||||||
|
|
||||||
|
int32 _relDelay;
|
||||||
|
|
||||||
bool escDelay(uint32 msecs);
|
bool escDelay(uint32 msecs);
|
||||||
bool nextPart(uint16 *&data);
|
bool nextPart(uint16 *&data);
|
||||||
bool floppyScrollFlirt(void);
|
bool floppyScrollFlirt(void);
|
||||||
|
@ -245,11 +245,16 @@ void Screen::fnFadeDown(uint32 scroll) {
|
|||||||
// will be scrolled into the visible screen by fnFadeUp
|
// will be scrolled into the visible screen by fnFadeUp
|
||||||
// fnFadeUp also frees the _scrollScreen
|
// fnFadeUp also frees the _scrollScreen
|
||||||
} else {
|
} else {
|
||||||
|
uint32 delayTime = _system->getMillis();
|
||||||
for (uint8 cnt = 0; cnt < 32; cnt++) {
|
for (uint8 cnt = 0; cnt < 32; cnt++) {
|
||||||
|
delayTime += 20;
|
||||||
palette_fadedown_helper((uint32 *)_palette, GAME_COLOURS);
|
palette_fadedown_helper((uint32 *)_palette, GAME_COLOURS);
|
||||||
_system->setPalette(_palette, 0, GAME_COLOURS);
|
_system->setPalette(_palette, 0, GAME_COLOURS);
|
||||||
_system->updateScreen();
|
_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);
|
convertPalette(pal, tmpPal);
|
||||||
|
|
||||||
|
uint32 delayTime = _system->getMillis();
|
||||||
for (uint8 cnt = 1; cnt <= 32; cnt++) {
|
for (uint8 cnt = 1; cnt <= 32; cnt++) {
|
||||||
|
delayTime += 20;
|
||||||
for (uint8 colCnt = 0; colCnt < GAME_COLOURS; colCnt++) {
|
for (uint8 colCnt = 0; colCnt < GAME_COLOURS; colCnt++) {
|
||||||
_palette[(colCnt << 2) | 0] = (tmpPal[(colCnt << 2) | 0] * cnt) >> 5;
|
_palette[(colCnt << 2) | 0] = (tmpPal[(colCnt << 2) | 0] * cnt) >> 5;
|
||||||
_palette[(colCnt << 2) | 1] = (tmpPal[(colCnt << 2) | 1] * 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->setPalette(_palette, 0, GAME_COLOURS);
|
||||||
_system->updateScreen();
|
_system->updateScreen();
|
||||||
_system->delayMillis(20);
|
int32 waitTime = (int32)delayTime - _system->getMillis();
|
||||||
|
if (waitTime < 0)
|
||||||
|
waitTime = 0;
|
||||||
|
_system->delayMillis((uint)waitTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user