From a8e111fae4b492c8478dd4eab239a7fa622b8833 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Nov 2014 11:53:50 -0500 Subject: ACCESS: Refactor opening scenes logic into Opening class --- engines/access/access.cpp | 1 - engines/access/access.h | 1 - engines/access/amazon/amazon_game.cpp | 311 +---------------------------- engines/access/amazon/amazon_game.h | 18 -- engines/access/amazon/amazon_logic.cpp | 324 ++++++++++++++++++++++++++++++- engines/access/amazon/amazon_logic.h | 22 ++- engines/access/amazon/amazon_scripts.cpp | 2 +- engines/access/martian/martian_game.cpp | 8 +- engines/access/martian/martian_game.h | 5 - 9 files changed, 343 insertions(+), 349 deletions(-) (limited to 'engines') diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 6161336de7..bac1308b09 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -50,7 +50,6 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc) _destIn = nullptr; _current = nullptr; - _pCount = 0; _mouseMode = 0; _currentMan = 0; _currentManOld = -1; diff --git a/engines/access/access.h b/engines/access/access.h index 47f5b5ec06..af0d42302b 100644 --- a/engines/access/access.h +++ b/engines/access/access.h @@ -173,7 +173,6 @@ public: Common::Array _oldRects; Common::Array _extraCells; ImageEntryList _images; - int _pCount; int _mouseMode; int _currentManOld; diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index b05bb7bb82..dfaba977af 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -40,7 +40,6 @@ AccessEngine(syst, gameDesc), _ant(this), _cast(this), _guard(this), _jungle(this), _opening(this), _plane(this), _river(this) { - _skipStart = false; _charSegSwitch = false; _oldTitleChapter = _chapter = 0; @@ -92,7 +91,7 @@ void AmazonEngine::playGame() { if (_loadSaveSlot == -1) { // Do introduction - doIntroduction(); + _opening.doIntroduction(); if (shouldQuit()) return; } @@ -112,314 +111,6 @@ void AmazonEngine::playGame() { _room->doRoom(); } -void AmazonEngine::doIntroduction() { - _screen->setInitialPalettte(); - _events->setCursor(CURSOR_ARROW); - _events->showCursor(); - _screen->setPanel(0); - _screen->setPalette(); - - _events->setCursor(CURSOR_ARROW); - _events->showCursor(); - _screen->setPanel(3); - doTitle(); - - if (shouldQuit() || _skipStart) - return; - - _screen->setPanel(3); - _opening.mWhileDoOpen(); - - if (shouldQuit() || _skipStart) - return; - - doTent(); -} - -void AmazonEngine::doCredit() { - if (_pCount < 15) - return; - - if (_pCount <= 75) - _buffer2.plotImage(_objectsTable[0], 0, Common::Point(90, 35)); - else if (_pCount <= 210) - _buffer2.plotImage(_objectsTable[0], 1, Common::Point(65, 35)); - else if (_pCount <= 272) - _buffer2.plotImage(_objectsTable[0], 2, Common::Point(96, 45)); - else if (_pCount <= 334) - _buffer2.plotImage(_objectsTable[0], 3, Common::Point(68, 54)); - else if (_pCount <= 396) - _buffer2.plotImage(_objectsTable[0], 4, Common::Point(103, 54)); - else if (_pCount <= 458) { - _buffer2.plotImage(_objectsTable[0], 5, Common::Point(8, 5)); - _buffer2.plotImage(_objectsTable[0], 12, Common::Point(88, 55)); - _buffer2.plotImage(_objectsTable[0], 6, Common::Point(194, 98)); - } else if (_pCount <= 520) { - _buffer2.plotImage(_objectsTable[0], 7, Common::Point(32, 13)); - _buffer2.plotImage(_objectsTable[0], 8, Common::Point(162, 80)); - } else if (_pCount <= 580) { - _buffer2.plotImage(_objectsTable[0], 9, Common::Point(18, 15)); - _buffer2.plotImage(_objectsTable[0], 10, Common::Point(164, 81)); - } else - _buffer2.plotImage(_objectsTable[0], 11, Common::Point(106, 55)); -} - -void AmazonEngine::scrollTitle() { - copyBF1BF2(); - _newRects.clear(); - doCredit(); - copyRects(); - copyBF2Vid(); -} - -void AmazonEngine::doTitle() { - _screen->setDisplayScan(); - _destIn = &_buffer2; - - _screen->forceFadeOut(); - _events->hideCursor(); - - _sound->queueSound(0, 98, 30); - _sound->queueSound(1, 98, 8); - - _files->_setPaletteFlag = false; - _files->loadScreen(0, 3); - - _buffer2.copyFrom(*_screen); - _buffer1.copyFrom(*_screen); - _screen->forceFadeIn(); - _sound->playSound(1); - - // HACK: This delay has been added so that the very first screen is visible. - // The original was using disk loading time to display it, and it's too fast - // nowadays to be visible. - _events->_vbCount = 70; - while (!shouldQuit() && _events->_vbCount > 0) { - _events->pollEvents(); - g_system->delayMillis(10); - } - - Resource *spriteData = _files->loadFile(0, 2); - _objectsTable[0] = new SpriteResource(this, spriteData); - delete spriteData; - - _sound->playSound(1); - - _files->_setPaletteFlag = false; - _files->loadScreen(0, 4); - _sound->playSound(1); - - _buffer2.copyFrom(*_screen); - _buffer1.copyFrom(*_screen); - _sound->playSound(1); - - const int COUNTDOWN[6] = { 2, 0x80, 1, 0x7d, 0, 0x87 }; - for (_pCount = 0; _pCount < 3; ++_pCount) { - _buffer2.copyFrom(_buffer1); - int id = COUNTDOWN[_pCount * 2]; - int xp = COUNTDOWN[_pCount * 2 + 1]; - _buffer2.plotImage(_objectsTable[0], id, Common::Point(xp, 71)); - _screen->copyFrom(_buffer2); - - _events->_vbCount = 70; - while (!shouldQuit() && _events->_vbCount > 0) { - _events->pollEvents(); - g_system->delayMillis(10); - } - } - - _sound->playSound(0); - _screen->forceFadeOut(); - _events->_vbCount = 100; - while (!shouldQuit() && _events->_vbCount > 0) { - _events->pollEvents(); - g_system->delayMillis(10); - } - - _sound->freeSounds(); - delete _objectsTable[0]; - _objectsTable[0] = nullptr; - - _files->_setPaletteFlag = false; - _files->loadScreen(0, 5); - _buffer2.copyFrom(*_screen); - _buffer1.copyFrom(*_screen); - _screen->forceFadeIn(); - _sound->newMusic(1, 0); - _events->_vbCount = 700; - while (!shouldQuit() && (_events->_vbCount > 0) && !_events->isKeyMousePressed()) { - _events->pollEvents(); - g_system->delayMillis(10); - } - - if (_events->_rightButton) { - _skipStart = true; - _room->clearRoom(); - _events->showCursor(); - return; - } - - _sound->newMusic(1, 1); - _sound->_musicRepeat = false; - _events->zeroKeys(); - _room->loadRoom(0); - _screen->clearScreen(); - _screen->setBufferScan(); - _screen->_scrollRow = _screen->_scrollCol = 0; - _screen->_scrollX = _screen->_scrollY = 0; - _player->_rawPlayer = Common::Point(0, 0); - _screen->forceFadeOut(); - _screen->_scrollX = 0; - _room->buildScreen(); - copyBF2Vid(); - _screen->forceFadeIn(); - _oldRects.clear(); - _newRects.clear(); - // KEYFLG = 0; - _player->_scrollAmount = 1; - _pCount = 0; - - while (!shouldQuit()) { - if (!_events->isKeyMousePressed()) { - if (_events->_rightButton) - _skipStart = true; - _room->clearRoom(); - _events->showCursor(); - return; - } - - _events->_vbCount = 4; - if (_screen->_scrollCol + _screen->_vWindowWidth != _room->_playFieldWidth) { - _screen->_scrollX += _player->_scrollAmount; - - while (_screen->_scrollX >= TILE_WIDTH) { - _screen->_scrollX -= TILE_WIDTH; - ++_screen->_scrollCol; - - _buffer1.moveBufferLeft(); - _room->buildColumn(_screen->_scrollCol + _screen->_vWindowWidth, _screen->_vWindowBytesWide); - } - scrollTitle(); - ++_pCount; - - while (!shouldQuit() && (_events->_vbCount > 0)) { - _events->pollEvents(); - g_system->delayMillis(10); - } - continue; - } - - _events->_vbCount = 120; - while (!shouldQuit() && (_events->_vbCount > 0)) { - _events->pollEvents(); - g_system->delayMillis(10); - } - - while (!shouldQuit()) { - _pCount = 0; - _events->_vbCount = 3; - if (_screen->_scrollRow + _screen->_vWindowHeight >= _room->_playFieldHeight) { - _room->clearRoom(); - _events->showCursor(); - return; - } - - _screen->_scrollY = _screen->_scrollY + _player->_scrollAmount; - - while (_screen->_scrollY >= TILE_HEIGHT && !shouldQuit()) { - _screen->_scrollY -= TILE_HEIGHT; - ++_screen->_scrollRow; - _buffer1.moveBufferUp(); - - // WORKAROUND: the original was using _screen->_vWindowBytesWide * _screen->_vWindowLinesTall - _room->buildRow(_screen->_scrollRow + _screen->_vWindowHeight, _screen->_vWindowLinesTall); - - if (_screen->_scrollRow + _screen->_vWindowHeight >= _room->_playFieldHeight) { - _room->clearRoom(); - _events->showCursor(); - return; - } - } - scrollTitle(); - while (!shouldQuit() && (_events->_vbCount > 0)) { - _events->pollEvents(); - g_system->delayMillis(10); - } - } - } -} - -void AmazonEngine::doTent() { - int step = 0; - _screen->setDisplayScan(); - _screen->forceFadeOut(); - _events->hideCursor(); - _sound->_soundTable.push_back(SoundEntry(_sound->loadSound(98, 39), 1)); - _sound->_soundTable.push_back(SoundEntry(_sound->loadSound(98, 14), 1)); - _sound->_soundTable.push_back(SoundEntry(_sound->loadSound(98, 15), 1)); - _sound->_soundTable.push_back(SoundEntry(_sound->loadSound(98, 16), 1)); - _sound->_soundTable.push_back(SoundEntry(_sound->loadSound(98, 31), 2)); - _sound->_soundTable.push_back(SoundEntry(_sound->loadSound(98, 52), 2)); - _sound->playSound(0); - - _files->_setPaletteFlag = false; - _files->loadScreen(2, 0); - _buffer2.copyFrom(*_screen); - _buffer1.copyFrom(*_screen); - _screen->forceFadeIn(); - - _video->setVideo(_screen, Common::Point(126, 73), FileIdent(2, 1), 10); - while (!shouldQuit() && !_video->_videoEnd) { - _video->playVideo(); - if ((_video->_videoFrame == 32) || (_video->_videoFrame == 34)) - _sound->playSound(4); - else if (_video->_videoFrame == 36) { - if (step != 2) { - _sound->playSound(2); - step = 2; - } - } else if (_video->_videoFrame == 18) { - if (step != 1) { - _sound->newMusic(73, 1); - _sound->newMusic(11, 0); - step = 1; - _sound->playSound(1); - } - } - - g_system->delayMillis(10); - _events->pollEvents(); - } - - _sound->playSound(5); - _video->setVideo(_screen, Common::Point(43, 11), FileIdent(2, 2), 10); - while (!shouldQuit() && !_video->_videoEnd) { - _video->playVideo(); - if (_video->_videoFrame == 26) { - _sound->playSound(5); - } else if (_video->_videoFrame == 15) { - if (step !=3) { - _sound->playSound(3); - step = 3; - } - } - - g_system->delayMillis(10); - _events->pollEvents(); - } - - _events->_vbCount = 200; - while (!shouldQuit() && _events->_vbCount > 0) { - _events->pollEvents(); - g_system->delayMillis(10); - } - _events->showCursor(); - _sound->newMusic(11, 1); - _sound->_soundTable.clear(); - - establishCenter(0, 4); -} - void AmazonEngine::setupGame() { // Setup timers const int TIMER_DEFAULTS[] = { 3, 10, 8, 1, 1, 1, 1, 2 }; diff --git a/engines/access/amazon/amazon_game.h b/engines/access/amazon/amazon_game.h index 016ddf40f0..ca8287b87e 100644 --- a/engines/access/amazon/amazon_game.h +++ b/engines/access/amazon/amazon_game.h @@ -38,21 +38,6 @@ private: byte _tileData[1455]; Common::Array _chapterCells; - /** - * Do the game introduction - */ - void doIntroduction(); - - /** - * Do title sequence - */ - void doTitle(); - - /** - * Do tent scene of introduction - */ - void doTent(); - /** * Setup variables for the game */ @@ -67,8 +52,6 @@ private: void calcIQ(); void helpTitle(); void drawHelpText(const Common::String &msg); - void doCredit(); - void scrollTitle(); void loadEstablish(int estabIndex); void doEstablish(int screenId, int estabIndex); @@ -85,7 +68,6 @@ protected: public: InactivePlayer _inactive; bool _charSegSwitch; - bool _skipStart; byte _help1[366]; byte _help2[366]; byte _help3[366]; diff --git a/engines/access/amazon/amazon_logic.cpp b/engines/access/amazon/amazon_logic.cpp index 3ecb20d974..8db7e9f785 100644 --- a/engines/access/amazon/amazon_logic.cpp +++ b/engines/access/amazon/amazon_logic.cpp @@ -81,17 +81,18 @@ void PannedScene::pan() { /*------------------------------------------------------------------------*/ -Opening::Opening(AmazonEngine *vm) : PannedScene(vm) { +CampScene::CampScene(AmazonEngine *vm) : PannedScene(vm) { + _skipStart = false; } -void Opening::mWhileDoOpen() { +void CampScene::mWhileDoOpen() { Screen &screen = *_vm->_screen; EventsManager &events = *_vm->_events; screen.setBufferScan(); events.hideCursor(); screen.forceFadeOut(); - _vm->_skipStart = false; + _skipStart = false; if (_vm->_conversation != 2) { // Cutscene at start of chapter 1 screen.setPanel(3); @@ -159,7 +160,7 @@ void Opening::mWhileDoOpen() { events.pollEventsAndWait(); if (events._leftButton || events._rightButton || events._keypresses.size() > 0) { - _vm->_skipStart = true; + _skipStart = true; _vm->_sound->newMusic(10, 1); events.debounceLeft(); @@ -202,6 +203,319 @@ void Opening::mWhileDoOpen() { /*------------------------------------------------------------------------*/ +Opening::Opening(AmazonEngine *vm) : CampScene(vm) { + _pCount = 0; +} + +void Opening::doIntroduction() { + _vm->_screen->setInitialPalettte(); + _vm->_events->setCursor(CURSOR_ARROW); + _vm->_events->showCursor(); + _vm->_screen->setPanel(0); + _vm->_screen->setPalette(); + + _vm->_events->setCursor(CURSOR_ARROW); + _vm->_events->showCursor(); + _vm->_screen->setPanel(3); + doTitle(); + + if (_vm->shouldQuit() || _skipStart) + return; + + _vm->_screen->setPanel(3); + mWhileDoOpen(); + + if (_vm->shouldQuit() || _skipStart) + return; + + doTent(); +} + +void Opening::doCredit() { + if (_pCount < 15) + return; + + if (_pCount <= 75) + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 0, Common::Point(90, 35)); + else if (_pCount <= 210) + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 1, Common::Point(65, 35)); + else if (_pCount <= 272) + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 2, Common::Point(96, 45)); + else if (_pCount <= 334) + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 3, Common::Point(68, 54)); + else if (_pCount <= 396) + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 4, Common::Point(103, 54)); + else if (_pCount <= 458) { + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 5, Common::Point(8, 5)); + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 12, Common::Point(88, 55)); + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 6, Common::Point(194, 98)); + } else if (_pCount <= 520) { + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 7, Common::Point(32, 13)); + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 8, Common::Point(162, 80)); + } else if (_pCount <= 580) { + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 9, Common::Point(18, 15)); + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 10, Common::Point(164, 81)); + } else + _vm->_buffer2.plotImage(_vm->_objectsTable[0], 11, Common::Point(106, 55)); +} + +void Opening::scrollTitle() { + _vm->copyBF1BF2(); + _vm->_newRects.clear(); + doCredit(); + _vm->copyRects(); + _vm->copyBF2Vid(); +} + +void Opening::doTitle() { + _vm->_screen->setDisplayScan(); + + _vm->_screen->forceFadeOut(); + _vm->_events->hideCursor(); + + _vm->_sound->queueSound(0, 98, 30); + _vm->_sound->queueSound(1, 98, 8); + + _vm->_files->_setPaletteFlag = false; + _vm->_files->loadScreen(0, 3); + + _vm->_buffer2.copyFrom(*_vm->_screen); + _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_screen->forceFadeIn(); + _vm->_sound->playSound(1); + + // HACK: This delay has been added so that the very first screen is visible. + // The original was using disk loading time to display it, and it's too fast + // nowadays to be visible. + _vm->_events->_vbCount = 70; + while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0) { + _vm->_events->pollEvents(); + g_system->delayMillis(10); + } + + Resource *spriteData = _vm->_files->loadFile(0, 2); + _vm->_objectsTable[0] = new SpriteResource(_vm, spriteData); + delete spriteData; + + _vm->_sound->playSound(1); + + _vm->_files->_setPaletteFlag = false; + _vm->_files->loadScreen(0, 4); + _vm->_sound->playSound(1); + + _vm->_buffer2.copyFrom(*_vm->_screen); + _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_sound->playSound(1); + + const int COUNTDOWN[6] = { 2, 0x80, 1, 0x7d, 0, 0x87 }; + for (_pCount = 0; _pCount < 3; ++_pCount) { + _vm->_buffer2.copyFrom(_vm->_buffer1); + int id = COUNTDOWN[_pCount * 2]; + int xp = COUNTDOWN[_pCount * 2 + 1]; + _vm->_buffer2.plotImage(_vm->_objectsTable[0], id, Common::Point(xp, 71)); + _vm->_screen->copyFrom(_vm->_buffer2); + + _vm->_events->_vbCount = 70; + while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0) { + _vm->_events->pollEvents(); + g_system->delayMillis(10); + } + } + + _vm->_sound->playSound(0); + _vm->_screen->forceFadeOut(); + _vm->_events->_vbCount = 100; + while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0) { + _vm->_events->pollEvents(); + g_system->delayMillis(10); + } + + _vm->_sound->freeSounds(); + delete _vm->_objectsTable[0]; + _vm->_objectsTable[0] = nullptr; + + _vm->_files->_setPaletteFlag = false; + _vm->_files->loadScreen(0, 5); + _vm->_buffer2.copyFrom(*_vm->_screen); + _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_screen->forceFadeIn(); + _vm->_sound->newMusic(1, 0); + _vm->_events->_vbCount = 700; + while (!_vm->shouldQuit() && (_vm->_events->_vbCount > 0) && !_vm->_events->isKeyMousePressed()) { + _vm->_events->pollEvents(); + g_system->delayMillis(10); + } + + if (_vm->_events->_rightButton) { + _skipStart = true; + _vm->_room->clearRoom(); + _vm->_events->showCursor(); + return; + } + + _vm->_sound->newMusic(1, 1); + _vm->_sound->_musicRepeat = false; + _vm->_events->zeroKeys(); + _vm->_room->loadRoom(0); + _vm->_screen->clearScreen(); + _vm->_screen->setBufferScan(); + _vm->_screen->_scrollRow = _vm->_screen->_scrollCol = 0; + _vm->_screen->_scrollX = _vm->_screen->_scrollY = 0; + _vm->_player->_rawPlayer = Common::Point(0, 0); + _vm->_screen->forceFadeOut(); + _vm->_screen->_scrollX = 0; + _vm->_room->buildScreen(); + _vm->copyBF2Vid(); + _vm->_screen->forceFadeIn(); + _vm->_oldRects.clear(); + _vm->_newRects.clear(); + // KEYFLG = 0; + _vm->_player->_scrollAmount = 1; + _pCount = 0; + + while (!_vm->shouldQuit()) { + if (!_vm->_events->isKeyMousePressed()) { + if (_vm->_events->_rightButton) + _skipStart = true; + _vm->_room->clearRoom(); + _vm->_events->showCursor(); + return; + } + + _vm->_events->_vbCount = 4; + if (_vm->_screen->_scrollCol + _vm->_screen->_vWindowWidth != _vm->_room->_playFieldWidth) { + _vm->_screen->_scrollX += _vm->_player->_scrollAmount; + + while (_vm->_screen->_scrollX >= TILE_WIDTH) { + _vm->_screen->_scrollX -= TILE_WIDTH; + ++_vm->_screen->_scrollCol; + + _vm->_buffer1.moveBufferLeft(); + _vm->_room->buildColumn(_vm->_screen->_scrollCol + _vm->_screen->_vWindowWidth, _vm->_screen->_vWindowBytesWide); + } + scrollTitle(); + ++_pCount; + + while (!_vm->shouldQuit() && (_vm->_events->_vbCount > 0)) { + _vm->_events->pollEvents(); + g_system->delayMillis(10); + } + continue; + } + + _vm->_events->_vbCount = 120; + while (!_vm->shouldQuit() && (_vm->_events->_vbCount > 0)) { + _vm->_events->pollEvents(); + g_system->delayMillis(10); + } + + while (!_vm->shouldQuit()) { + _pCount = 0; + _vm->_events->_vbCount = 3; + if (_vm->_screen->_scrollRow + _vm->_screen->_vWindowHeight >= _vm->_room->_playFieldHeight) { + _vm->_room->clearRoom(); + _vm->_events->showCursor(); + return; + } + + _vm->_screen->_scrollY = _vm->_screen->_scrollY + _vm->_player->_scrollAmount; + + while (_vm->_screen->_scrollY >= TILE_HEIGHT && !_vm->shouldQuit()) { + _vm->_screen->_scrollY -= TILE_HEIGHT; + ++_vm->_screen->_scrollRow; + _vm->_buffer1.moveBufferUp(); + + // WORKAROUND: the original was using _vm->_screen->_vWindowBytesWide * _vm->_screen->_vWindowLinesTall + _vm->_room->buildRow(_vm->_screen->_scrollRow + _vm->_screen->_vWindowHeight, _vm->_screen->_vWindowLinesTall); + + if (_vm->_screen->_scrollRow + _vm->_screen->_vWindowHeight >= _vm->_room->_playFieldHeight) { + _vm->_room->clearRoom(); + _vm->_events->showCursor(); + return; + } + } + scrollTitle(); + while (!_vm->shouldQuit() && (_vm->_events->_vbCount > 0)) { + _vm->_events->pollEvents(); + g_system->delayMillis(10); + } + } + } +} + +void Opening::doTent() { + int step = 0; + _vm->_screen->setDisplayScan(); + _vm->_screen->forceFadeOut(); + _vm->_events->hideCursor(); + _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 39), 1)); + _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 14), 1)); + _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 15), 1)); + _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 16), 1)); + _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 31), 2)); + _vm->_sound->_soundTable.push_back(SoundEntry(_vm->_sound->loadSound(98, 52), 2)); + _vm->_sound->playSound(0); + + _vm->_files->_setPaletteFlag = false; + _vm->_files->loadScreen(2, 0); + _vm->_buffer2.copyFrom(*_vm->_screen); + _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_screen->forceFadeIn(); + + _vm->_video->setVideo(_vm->_screen, Common::Point(126, 73), FileIdent(2, 1), 10); + while (!_vm->shouldQuit() && !_vm->_video->_videoEnd) { + _vm->_video->playVideo(); + if ((_vm->_video->_videoFrame == 32) || (_vm->_video->_videoFrame == 34)) + _vm->_sound->playSound(4); + else if (_vm->_video->_videoFrame == 36) { + if (step != 2) { + _vm->_sound->playSound(2); + step = 2; + } + } else if (_vm->_video->_videoFrame == 18) { + if (step != 1) { + _vm->_sound->newMusic(73, 1); + _vm->_sound->newMusic(11, 0); + step = 1; + _vm->_sound->playSound(1); + } + } + + g_system->delayMillis(10); + _vm->_events->pollEvents(); + } + + _vm->_sound->playSound(5); + _vm->_video->setVideo(_vm->_screen, Common::Point(43, 11), FileIdent(2, 2), 10); + while (!_vm->shouldQuit() && !_vm->_video->_videoEnd) { + _vm->_video->playVideo(); + if (_vm->_video->_videoFrame == 26) { + _vm->_sound->playSound(5); + } else if (_vm->_video->_videoFrame == 15) { + if (step !=3) { + _vm->_sound->playSound(3); + step = 3; + } + } + + g_system->delayMillis(10); + _vm->_events->pollEvents(); + } + + _vm->_events->_vbCount = 200; + while (!_vm->shouldQuit() && _vm->_events->_vbCount > 0) { + _vm->_events->pollEvents(); + g_system->delayMillis(10); + } + _vm->_events->showCursor(); + _vm->_sound->newMusic(11, 1); + _vm->_sound->_soundTable.clear(); + + _vm->establishCenter(0, 4); +} + +/*------------------------------------------------------------------------*/ + Plane::Plane(AmazonEngine *vm): PannedScene(vm) { _pCount = 0; _planeCount = 0; @@ -400,7 +714,7 @@ void Plane::mWhileFall() { /*------------------------------------------------------------------------*/ -Jungle::Jungle(AmazonEngine *vm) : PannedScene(vm) { +Jungle::Jungle(AmazonEngine *vm) : CampScene(vm) { for (int i = 0; i < JUNGLE_SIZE; ++i) { _jCnt[i] = _jungleX[i] = -1; } diff --git a/engines/access/amazon/amazon_logic.h b/engines/access/amazon/amazon_logic.h index 46b3c7047c..c2752af77b 100644 --- a/engines/access/amazon/amazon_logic.h +++ b/engines/access/amazon/amazon_logic.h @@ -70,13 +70,29 @@ public: void pan(); }; -class Opening: public PannedScene { +class CampScene : public PannedScene { +protected: + bool _skipStart; public: - Opening(AmazonEngine *vm); + CampScene(AmazonEngine *vm); void mWhileDoOpen(); }; +class Opening: public CampScene { +private: + int _pCount; + + void doTitle(); + void doCredit(); + void scrollTitle(); + void doTent(); +public: + Opening(AmazonEngine *vm); + + void doIntroduction(); +}; + class Plane: public PannedScene { public: int _pCount; @@ -95,7 +111,7 @@ public: }; #define JUNGLE_SIZE 3 -class Jungle: public PannedScene { +class Jungle: public CampScene { private: void initJWalk2(); void jungleMove(); diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp index eadcbddd2b..f38c80c915 100644 --- a/engines/access/amazon/amazon_scripts.cpp +++ b/engines/access/amazon/amazon_scripts.cpp @@ -220,7 +220,7 @@ void AmazonScripts::mWhile(int param1) { _game->_jungle.mWhileJWalk(); break; case 5: - _game->_opening.mWhileDoOpen(); + _game->_jungle.mWhileDoOpen(); break; case 6: _game->_river.mWhileDownRiver(); diff --git a/engines/access/martian/martian_game.cpp b/engines/access/martian/martian_game.cpp index 81a8ffdf4d..e534b6cc03 100644 --- a/engines/access/martian/martian_game.cpp +++ b/engines/access/martian/martian_game.cpp @@ -79,7 +79,7 @@ void MartianEngine::doIntroduction() { return; if (!_skipStart) { - doTent(); + //doTent(); if (shouldQuit()) return; } @@ -89,6 +89,7 @@ void MartianEngine::doIntroduction() { } void MartianEngine::doTitle() { + /* _screen->setDisplayScan(); _destIn = &_buffer2; @@ -129,16 +130,13 @@ void MartianEngine::doTitle() { // TODO: More to do delete _objectsTable[0]; + */ } void MartianEngine::doOpening() { warning("TODO doOpening"); } -void MartianEngine::doTent() { - warning("TODO doTent"); -} - void MartianEngine::setupGame() { // Setup timers diff --git a/engines/access/martian/martian_game.h b/engines/access/martian/martian_game.h index e46b2bb0fd..a83b67a288 100644 --- a/engines/access/martian/martian_game.h +++ b/engines/access/martian/martian_game.h @@ -48,11 +48,6 @@ private: */ void doOpening(); - /** - * Do tent scene of introduction - */ - void doTent(); - /** * Setup variables for the game */ -- cgit v1.2.3