diff options
Diffstat (limited to 'engines/kyra')
-rw-r--r-- | engines/kyra/lol.h | 3 | ||||
-rw-r--r-- | engines/kyra/scene_lol.cpp | 71 | ||||
-rw-r--r-- | engines/kyra/screen_lol.cpp | 8 | ||||
-rw-r--r-- | engines/kyra/screen_lol.h | 4 | ||||
-rw-r--r-- | engines/kyra/script_lol.cpp | 8 |
5 files changed, 76 insertions, 18 deletions
diff --git a/engines/kyra/lol.h b/engines/kyra/lol.h index e9a40cb79d..878ac9dd19 100644 --- a/engines/kyra/lol.h +++ b/engines/kyra/lol.h @@ -749,6 +749,7 @@ private: int olol_paletteFlash(EMCState *script); int olol_disableControls(EMCState *script); int olol_enableControls(EMCState *script); + int olol_gasExplosion(EMCState *script); int olol_characterSays(EMCState *script); int olol_queueSpeech(EMCState *script); int olol_getItemPrice(EMCState *script); @@ -982,7 +983,9 @@ private: void movePartySmoothScrollTurnRight(int speed); void pitDropScroll(int numSteps); + void shakeScene(int duration, int width, int height, int restore); + void processGasExplosion(int soundId); int smoothScrollDrawSpecialGuiShape(int pageNum); diff --git a/engines/kyra/scene_lol.cpp b/engines/kyra/scene_lol.cpp index 5e1fba7215..4917ce8b96 100644 --- a/engines/kyra/scene_lol.cpp +++ b/engines/kyra/scene_lol.cpp @@ -1021,7 +1021,7 @@ void LoLEngine::movePartySmoothScrollUp(int speed) { _screen->smoothScrollZoomStepBottom(6, 2, _scrollXBottom[i], _scrollYBottom[i]); if (d) - _screen->copyGuiShapeToSurface(_tempBuffer5120, 2); + _screen->copyGuiShapeToSurface(14, 2); _screen->restoreSceneWindow(2, 0); _screen->updateScreen(); @@ -1032,7 +1032,7 @@ void LoLEngine::movePartySmoothScrollUp(int speed) { } if (d) - _screen->copyGuiShapeToSurface(_tempBuffer5120, 12); + _screen->copyGuiShapeToSurface(14, 12); if (_sceneDefaultUpdate != 2) { _screen->restoreSceneWindow(12, 0); @@ -1056,7 +1056,7 @@ void LoLEngine::movePartySmoothScrollDown(int speed) { _screen->smoothScrollZoomStepBottom(6, 2, _scrollXBottom[i], _scrollYBottom[i]); if (d) - _screen->copyGuiShapeToSurface(_tempBuffer5120, 2); + _screen->copyGuiShapeToSurface(14, 2); _screen->restoreSceneWindow(2, 0); _screen->updateScreen(); @@ -1067,7 +1067,7 @@ void LoLEngine::movePartySmoothScrollDown(int speed) { } if (d) - _screen->copyGuiShapeToSurface(_tempBuffer5120, 12); + _screen->copyGuiShapeToSurface(14, 12); if (_sceneDefaultUpdate != 2) { _screen->restoreSceneWindow(6, 0); @@ -1155,7 +1155,7 @@ void LoLEngine::movePartySmoothScrollTurnLeft(int speed) { _smoothScrollTimer = _system->getMillis() + speed * _tickLength; _screen->smoothScrollTurnStep1(_sceneDrawPage1, _sceneDrawPage2, dp); if (d) - _screen->copyGuiShapeToSurface(_tempBuffer5120, dp); + _screen->copyGuiShapeToSurface(14, dp); _screen->restoreSceneWindow(dp, 0); _screen->updateScreen(); fadeText(); @@ -1164,7 +1164,7 @@ void LoLEngine::movePartySmoothScrollTurnLeft(int speed) { _smoothScrollTimer = _system->getMillis() + speed * _tickLength; _screen->smoothScrollTurnStep2(_sceneDrawPage1, _sceneDrawPage2, dp); if (d) - _screen->copyGuiShapeToSurface(_tempBuffer5120, dp); + _screen->copyGuiShapeToSurface(14, dp); _screen->restoreSceneWindow(dp, 0); _screen->updateScreen(); fadeText(); @@ -1173,7 +1173,7 @@ void LoLEngine::movePartySmoothScrollTurnLeft(int speed) { _smoothScrollTimer = _system->getMillis() + speed * _tickLength; _screen->smoothScrollTurnStep3(_sceneDrawPage1, _sceneDrawPage2, dp); if (d) - _screen->copyGuiShapeToSurface(_tempBuffer5120, dp); + _screen->copyGuiShapeToSurface(14, dp); _screen->restoreSceneWindow(dp, 0); _screen->updateScreen(); fadeText(); @@ -1199,7 +1199,7 @@ void LoLEngine::movePartySmoothScrollTurnRight(int speed) { _smoothScrollTimer = _system->getMillis() + speed * _tickLength; _screen->smoothScrollTurnStep3(_sceneDrawPage2, _sceneDrawPage1, dp); if (d) - _screen->copyGuiShapeToSurface(_tempBuffer5120, dp); + _screen->copyGuiShapeToSurface(14, dp); _screen->restoreSceneWindow(dp, 0); _screen->updateScreen(); fadeText(); @@ -1208,7 +1208,7 @@ void LoLEngine::movePartySmoothScrollTurnRight(int speed) { _smoothScrollTimer = _system->getMillis() + speed * _tickLength; _screen->smoothScrollTurnStep2(_sceneDrawPage2, _sceneDrawPage1, dp); if (d) - _screen->copyGuiShapeToSurface(_tempBuffer5120, dp); + _screen->copyGuiShapeToSurface(14, dp); _screen->restoreSceneWindow(dp, 0); _screen->updateScreen(); fadeText(); @@ -1217,7 +1217,7 @@ void LoLEngine::movePartySmoothScrollTurnRight(int speed) { _smoothScrollTimer = _system->getMillis() + speed * _tickLength; _screen->smoothScrollTurnStep1(_sceneDrawPage2, _sceneDrawPage1, dp); if (d) - _screen->copyGuiShapeToSurface(_tempBuffer5120, dp); + _screen->copyGuiShapeToSurface(14, dp); _screen->restoreSceneWindow(dp, 0); _screen->updateScreen(); fadeText(); @@ -1300,13 +1300,62 @@ void LoLEngine::shakeScene(int duration, int width, int height, int restore) { } } +void LoLEngine::processGasExplosion(int soundId) { + int cp = _screen->setCurPage(2); + _screen->copyPage(0, 12); + + static const uint8 sounds[] = { 0x62, 0xA7, 0xA7, 0xA8 }; + snd_playSoundEffect(sounds[soundId], -1); + + uint16 targetBlock = 0; + int dist = getSpellTargetBlock(_currentBlock, _currentDirection, 3, targetBlock); + + uint8 *p1 = _screen->getPalette(1); + uint8 *p2 = _screen->getPalette(3); + + if (dist) { + WSAMovie_v2 *mov = new WSAMovie_v2(this, _screen); + char file[13]; + snprintf(file, 13, "gasexp%0d.wsa", dist); + mov->open(file, 1, 0); + if (!mov->opened()) + error("Gas: Unable to load gasexp.wsa"); + + playSpellAnimation(mov, 0, 6, 1, (176 - mov->width()) / 2 + 112, (120 - mov->height()) / 2, 0, 0, 0, 0, false); + + mov->close(); + delete mov; + + } else { + memcpy(p2, p1, 768); + + for (int i = 1; i < 128; i++) + p2[i * 3] = 0x3f; + + uint32 ctime = _system->getMillis(); + while (_screen->fadePaletteStep(_screen->_currentPalette, p2, _system->getMillis() - ctime, 10)) + updateInput(); + + ctime = _system->getMillis(); + while (_screen->fadePaletteStep(p2, _screen->_currentPalette, _system->getMillis() - ctime, 50)) + updateInput(); + } + + _screen->copyPage(12, 2); + _screen->setCurPage(cp); + + updateDrawPage2(); + _sceneUpdateRequired = true; + gui_drawScene(0); +} + int LoLEngine::smoothScrollDrawSpecialGuiShape(int pageNum) { if(!_specialGuiShape) return 0; _screen->clearGuiShapeMemory(pageNum); _screen->drawShape(pageNum, _specialGuiShape, _specialGuiShapeX, _specialGuiShapeY, 2, 0); - _screen->copyGuiShapeFromSceneBackupBuffer(pageNum, _tempBuffer5120); + _screen->copyGuiShapeFromSceneBackupBuffer(pageNum, 14); return 1; } diff --git a/engines/kyra/screen_lol.cpp b/engines/kyra/screen_lol.cpp index b118f20404..dd3f81b7fa 100644 --- a/engines/kyra/screen_lol.cpp +++ b/engines/kyra/screen_lol.cpp @@ -327,9 +327,9 @@ void Screen_LoL::clearGuiShapeMemory(int pageNum) { } } -void Screen_LoL::copyGuiShapeFromSceneBackupBuffer(int srcPageNum, uint8 *dstBuffer) { +void Screen_LoL::copyGuiShapeFromSceneBackupBuffer(int srcPageNum, int dstPageNum) { uint8 *src = getPagePtr(srcPageNum) + 0x79c3; - uint8 *dst = dstBuffer; + uint8 *dst = getPagePtr(dstPageNum); for (int i = 0; i < 23; i++) { uint8 len = 0; @@ -349,8 +349,8 @@ void Screen_LoL::copyGuiShapeFromSceneBackupBuffer(int srcPageNum, uint8 *dstBu } } -void Screen_LoL::copyGuiShapeToSurface(uint8 *srcBuffer, int dstPageNum) { - uint8 *src = srcBuffer; +void Screen_LoL::copyGuiShapeToSurface(int srcPageNum, int dstPageNum) { + uint8 *src = getPagePtr(srcPageNum); uint8 *dst = getPagePtr(dstPageNum) + 0xe7c3; for (int i = 0; i < 23; i++) { diff --git a/engines/kyra/screen_lol.h b/engines/kyra/screen_lol.h index dbfe350466..3b9e370ccc 100644 --- a/engines/kyra/screen_lol.h +++ b/engines/kyra/screen_lol.h @@ -56,8 +56,8 @@ public: void backupSceneWindow(int srcPageNum, int dstPageNum); void restoreSceneWindow(int srcPageNum, int dstPageNum); void clearGuiShapeMemory(int pageNum); - void copyGuiShapeFromSceneBackupBuffer(int srcPageNum, uint8 *dstBuffer); - void copyGuiShapeToSurface(uint8 *srcBuffer, int dstPageNum); + void copyGuiShapeFromSceneBackupBuffer(int srcPageNum, int dstPageNum); + void copyGuiShapeToSurface(int srcPageNum, int dstPageNum); void smoothScrollZoomStepTop(int srcPageNum, int dstPageNum, int x, int y); void smoothScrollZoomStepBottom(int srcPageNum, int dstPageNum, int x, int y); void smoothScrollHorizontalStep(int pageNum, int x, int u2, int w); diff --git a/engines/kyra/script_lol.cpp b/engines/kyra/script_lol.cpp index 8633f15114..378ef0d874 100644 --- a/engines/kyra/script_lol.cpp +++ b/engines/kyra/script_lol.cpp @@ -2044,6 +2044,12 @@ int LoLEngine::olol_enableControls(EMCState *script) { return gui_enableControls(); } +int LoLEngine::olol_gasExplosion(EMCState *script) { + debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_gasExplosion(%p) (%d)", (const void *)script, stackPos(0)); + processGasExplosion(stackPos(0)); + return 1; +} + int LoLEngine::olol_characterSays(EMCState *script) { debugC(3, kDebugLevelScriptFuncs, "LoLEngine::olol_characterSays(%p) (%d, %d, %d)", (const void *)script, stackPos(0), stackPos(1), stackPos(2)); if (stackPos(0) == -1) { @@ -2599,7 +2605,7 @@ void LoLEngine::setupOpcodeTable() { // 0xB4 Opcode(olol_enableControls); OpcodeUnImpl(); - OpcodeUnImpl(); + Opcode(olol_gasExplosion); OpcodeUnImpl(); // 0xB8 |