diff options
author | Johannes Schickel | 2011-02-16 00:14:37 +0100 |
---|---|---|
committer | Johannes Schickel | 2011-02-16 00:14:37 +0100 |
commit | 7d0f5c9f1cb089c0d1f89989655a640b3e837840 (patch) | |
tree | 5cd3f94eb723cc65912cdde633c0dd10738908af /engines/sky | |
parent | 46c5732ba54be263019f59a98d3ea7a2118e60a4 (diff) | |
parent | 12fd50929533a5ba1ea26ccc1e5de0b5c3f83f50 (diff) | |
download | scummvm-rg350-7d0f5c9f1cb089c0d1f89989655a640b3e837840.tar.gz scummvm-rg350-7d0f5c9f1cb089c0d1f89989655a640b3e837840.tar.bz2 scummvm-rg350-7d0f5c9f1cb089c0d1f89989655a640b3e837840.zip |
Merge branch 'master' into osystem-palette
Conflicts:
engines/sky/screen.h
Diffstat (limited to 'engines/sky')
-rw-r--r-- | engines/sky/debug.cpp | 4 | ||||
-rw-r--r-- | engines/sky/intro.cpp | 9 | ||||
-rw-r--r-- | engines/sky/screen.cpp | 125 | ||||
-rw-r--r-- | engines/sky/screen.h | 4 |
4 files changed, 69 insertions, 73 deletions
diff --git a/engines/sky/debug.cpp b/engines/sky/debug.cpp index b43ec917fe..2839665ff8 100644 --- a/engines/sky/debug.cpp +++ b/engines/sky/debug.cpp @@ -1071,11 +1071,11 @@ void Debug::logic(uint32 logic) { void Debug::script(uint32 command, uint16 *scriptData) { debug(6, "SCRIPT: %s", opcodes[command]); if (command == 0 || command == 6) - debug(6, " %s", scriptVars[READ_LE_UINT16(scriptData)/4]); + debug(6, " %s", scriptVars[(*scriptData)/4]); else { int i; for (i = 0; i < opcode_par[command]; i++) { - debug(6, " %d", READ_LE_UINT16(scriptData + i)); + debug(6, " %d", *(scriptData + i)); } } debug(6, " "); // Print an empty line as separator diff --git a/engines/sky/intro.cpp b/engines/sky/intro.cpp index 6455f3b15b..cf1910c5b1 100644 --- a/engines/sky/intro.cpp +++ b/engines/sky/intro.cpp @@ -647,6 +647,7 @@ Intro::~Intro() { free(_textBuf); free(_saveBuf); + _mixer->stopID(SOUND_BG); free(_bgBuf); } @@ -917,12 +918,14 @@ bool Intro::escDelay(uint32 msecs) { nDelay = _relDelay - _system->getMillis(); if (nDelay < 0) nDelay = 0; - else if (nDelay > 10) - nDelay = 10; + else if (nDelay > 20) + nDelay = 20; + _system->delayMillis(nDelay); + _skyScreen->processSequence(); _system->updateScreen(); - } while (nDelay == 10); + } while (nDelay == 20); return true; } diff --git a/engines/sky/screen.cpp b/engines/sky/screen.cpp index 78925b8a8e..a77017de38 100644 --- a/engines/sky/screen.cpp +++ b/engines/sky/screen.cpp @@ -386,14 +386,14 @@ void Screen::waitForTick() { Common::Event event; while (true) { + while (eventMan->pollEvent(event)) + ; + start = _system->getMillis(); if (start >= end) return; - while (eventMan->pollEvent(event)) - ; - remain = end - start; if (remain < 10) { _system->delayMillis(remain); @@ -411,7 +411,7 @@ void Screen::waitForSequence() { while (_seqInfo.running) { processSequence(); - _system->delayMillis(10); + _system->delayMillis(20); while (eventMan->pollEvent(event)) ; } @@ -419,20 +419,18 @@ void Screen::waitForSequence() { void Screen::startSequence(uint16 fileNum) { _seqInfo.seqData = _skyDisk->loadFile(fileNum); - _seqInfo.nextFrame = _system->getMillis(); + _seqInfo.nextFrame = _system->getMillis() + 60; _seqInfo.framesLeft = _seqInfo.seqData[0]; _seqInfo.seqDataPos = _seqInfo.seqData + 1; - _seqInfo.delay = SEQ_DELAY; _seqInfo.running = true; _seqInfo.runningItem = false; } void Screen::startSequenceItem(uint16 itemNum) { _seqInfo.seqData = (uint8 *)SkyEngine::fetchItem(itemNum); - _seqInfo.nextFrame = _system->getMillis(); + _seqInfo.nextFrame = _system->getMillis() + 60; _seqInfo.framesLeft = _seqInfo.seqData[0] - 1; _seqInfo.seqDataPos = _seqInfo.seqData + 1; - _seqInfo.delay = SEQ_DELAY; _seqInfo.running = true; _seqInfo.runningItem = true; } @@ -453,75 +451,72 @@ void Screen::processSequence() { if (_system->getMillis() < _seqInfo.nextFrame) return; - _seqInfo.delay--; - if (_seqInfo.delay == 0) { - _seqInfo.delay = SEQ_DELAY; - _seqInfo.nextFrame += 20 * SEQ_DELAY; + _seqInfo.nextFrame += 60; - memset(_seqGrid, 0, 12 * 20); + memset(_seqGrid, 0, 12 * 20); - uint32 screenPos = 0; + uint32 screenPos = 0; - uint8 nrToSkip, nrToDo, cnt; + uint8 nrToSkip, nrToDo, cnt; + do { do { - do { - nrToSkip = _seqInfo.seqDataPos[0]; - _seqInfo.seqDataPos++; - screenPos += nrToSkip; - } while (nrToSkip == 0xFF); + nrToSkip = _seqInfo.seqDataPos[0]; + _seqInfo.seqDataPos++; + screenPos += nrToSkip; + } while (nrToSkip == 0xFF); - do { - nrToDo = _seqInfo.seqDataPos[0]; - _seqInfo.seqDataPos++; - - uint8 gridSta = (uint8)((screenPos / (GAME_SCREEN_WIDTH * 16))*20 + ((screenPos % GAME_SCREEN_WIDTH) >> 4)); - uint8 gridEnd = (uint8)(((screenPos+nrToDo) / (GAME_SCREEN_WIDTH * 16))*20 + (((screenPos+nrToDo) % GAME_SCREEN_WIDTH) >> 4)); - gridSta = MIN(gridSta, (uint8)(12 * 20 - 1)); - gridEnd = MIN(gridEnd, (uint8)(12 * 20 - 1)); - if (gridEnd >= gridSta) - for (cnt = gridSta; cnt <= gridEnd; cnt++) - _seqGrid[cnt] = 1; - else { - for (cnt = gridSta; cnt < (gridSta / 20 + 1) * 20; cnt++) - _seqGrid[cnt] = 1; - for (cnt = (gridEnd / 20) * 20; cnt <= gridEnd; cnt++) - _seqGrid[cnt] = 1; - } + do { + nrToDo = _seqInfo.seqDataPos[0]; + _seqInfo.seqDataPos++; + + uint8 gridSta = (uint8)((screenPos / (GAME_SCREEN_WIDTH * 16))*20 + ((screenPos % GAME_SCREEN_WIDTH) >> 4)); + uint8 gridEnd = (uint8)(((screenPos+nrToDo) / (GAME_SCREEN_WIDTH * 16))*20 + (((screenPos+nrToDo) % GAME_SCREEN_WIDTH) >> 4)); + gridSta = MIN(gridSta, (uint8)(12 * 20 - 1)); + gridEnd = MIN(gridEnd, (uint8)(12 * 20 - 1)); + if (gridEnd >= gridSta) + for (cnt = gridSta; cnt <= gridEnd; cnt++) + _seqGrid[cnt] = 1; + else { + for (cnt = gridSta; cnt < (gridSta / 20 + 1) * 20; cnt++) + _seqGrid[cnt] = 1; + for (cnt = (gridEnd / 20) * 20; cnt <= gridEnd; cnt++) + _seqGrid[cnt] = 1; + } - for (cnt = 0; cnt < nrToDo; cnt++) { - _currentScreen[screenPos] = _seqInfo.seqDataPos[0]; - _seqInfo.seqDataPos++; - screenPos++; - } - } while (nrToDo == 0xFF); - } while (screenPos < (GAME_SCREEN_WIDTH * GAME_SCREEN_HEIGHT)); - uint8 *gridPtr = _seqGrid; uint8 *scrPtr = _currentScreen; uint8 *rectPtr = NULL; - uint8 rectWid = 0, rectX = 0, rectY = 0; - for (uint8 cnty = 0; cnty < 12; cnty++) { - for (uint8 cntx = 0; cntx < 20; cntx++) { - if (*gridPtr) { - if (!rectWid) { - rectX = cntx; - rectY = cnty; - rectPtr = scrPtr; - } - rectWid++; - } else if (rectWid) { - _system->copyRectToScreen(rectPtr, GAME_SCREEN_WIDTH, rectX << 4, rectY << 4, rectWid << 4, 16); - rectWid = 0; - } - scrPtr += 16; - gridPtr++; + for (cnt = 0; cnt < nrToDo; cnt++) { + _currentScreen[screenPos] = _seqInfo.seqDataPos[0]; + _seqInfo.seqDataPos++; + screenPos++; } - if (rectWid) { + } while (nrToDo == 0xFF); + } while (screenPos < (GAME_SCREEN_WIDTH * GAME_SCREEN_HEIGHT)); + uint8 *gridPtr = _seqGrid; uint8 *scrPtr = _currentScreen; uint8 *rectPtr = NULL; + uint8 rectWid = 0, rectX = 0, rectY = 0; + for (uint8 cnty = 0; cnty < 12; cnty++) { + for (uint8 cntx = 0; cntx < 20; cntx++) { + if (*gridPtr) { + if (!rectWid) { + rectX = cntx; + rectY = cnty; + rectPtr = scrPtr; + } + rectWid++; + } else if (rectWid) { _system->copyRectToScreen(rectPtr, GAME_SCREEN_WIDTH, rectX << 4, rectY << 4, rectWid << 4, 16); rectWid = 0; } - scrPtr += 15 * GAME_SCREEN_WIDTH; + scrPtr += 16; + gridPtr++; } - _system->updateScreen(); - _seqInfo.framesLeft--; + if (rectWid) { + _system->copyRectToScreen(rectPtr, GAME_SCREEN_WIDTH, rectX << 4, rectY << 4, rectWid << 4, 16); + rectWid = 0; + } + scrPtr += 15 * GAME_SCREEN_WIDTH; } + _system->updateScreen(); + _seqInfo.framesLeft--; + if (_seqInfo.framesLeft == 0) { _seqInfo.running = false; if (!_seqInfo.runningItem) diff --git a/engines/sky/screen.h b/engines/sky/screen.h index bf5eeacf24..69a9a2fc8f 100644 --- a/engines/sky/screen.h +++ b/engines/sky/screen.h @@ -45,8 +45,7 @@ struct DataFileHeader; #define SCROLL_JUMP 16 #define VGA_COLOURS 256 -#define GAME_COLOURS 240 -#define SEQ_DELAY 3 +#define GAME_COLOURS 240 #define FORE 1 #define BACK 0 @@ -114,7 +113,6 @@ private: struct { uint32 nextFrame; uint32 framesLeft; - uint32 delay; uint8 *seqData; uint8 *seqDataPos; volatile bool running; |