diff options
Diffstat (limited to 'engines/access/amazon')
-rw-r--r-- | engines/access/amazon/amazon_game.cpp | 22 | ||||
-rw-r--r-- | engines/access/amazon/amazon_logic.cpp | 119 | ||||
-rw-r--r-- | engines/access/amazon/amazon_logic.h | 2 | ||||
-rw-r--r-- | engines/access/amazon/amazon_scripts.cpp | 32 |
4 files changed, 98 insertions, 77 deletions
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp index 933a98aded..4c9df7b8ff 100644 --- a/engines/access/amazon/amazon_game.cpp +++ b/engines/access/amazon/amazon_game.cpp @@ -61,9 +61,16 @@ AmazonEngine::AmazonEngine(OSystem *syst, const AccessGameDescription *gameDesc) _helpTbl[1] = _help2; _helpTbl[2] = _help3; + _chapter = 0; + _rawInactiveX = _rawInactiveY = 0; + _inactiveYOff = 0; + _hintLevel = 0; + _updateChapter = 0; + _oldTitleChapter = 0; + _iqValue = 0; + _chapterCells.push_back(CellIdent(0, 96, 17)); _inactive._spritesPtr = nullptr; - _inactive._altSpritesPtr = nullptr; _inactive._flags = _inactive._frameNumber = _inactive._offsetY = 0; _inactive._position = Common::Point(0, 0); } @@ -261,7 +268,6 @@ void AmazonEngine::doEstablish(int screenId, int estabIndex) { _screen->_maxChars = 37; _screen->_printOrg = _screen->_printStart = Common::Point(48, 35); loadEstablish(estabIndex); - _et = estabIndex; uint16 msgOffset; if (!isCD()) msgOffset = READ_LE_UINT16(_establish->data() + (estabIndex * 2)); @@ -522,8 +528,8 @@ void AmazonEngine::startChapter(int chapter) { _sound->freeSounds(); if (isCD()) { - _sound->_soundTable.push_back(SoundEntry(_sound->loadSound(115, 0), 1)); - _sound->_soundTable.push_back(SoundEntry(_sound->loadSound(115, 1), 1)); + _sound->loadSoundTable(0, 115, 0); + _sound->loadSoundTable(1, 115, 1); _sound->playSound(0); _sound->playSound(1); @@ -552,7 +558,7 @@ void AmazonEngine::startChapter(int chapter) { // Show chapter screen _files->loadScreen(96, 15); - _buffer2.copyFrom(*_screen); + _buffer2.blitFrom(*_screen); const int *chapImg = &CHAPTER_TABLE[_chapter - 1][0]; _screen->plotImage(_objectsTable[0], _chapter - 1, @@ -583,14 +589,14 @@ void AmazonEngine::startChapter(int chapter) { _screen->clearBuffer(); _files->loadScreen(96, 16); - _buffer2.copyFrom(*_screen); + _buffer2.blitFrom(*_screen); _screen->plotImage(_objectsTable[0], chapImg[0], Common::Point(90, 7)); _midi->newMusic(7, 1); _midi->newMusic(34, 0); _screen->forceFadeIn(); - _buffer2.copyFrom(*_screen); + _buffer2.blitFrom(*_screen); _fonts._charSet._lo = 1; _fonts._charSet._hi = 10; @@ -670,7 +676,7 @@ void AmazonEngine::dead(int deathId) { _files->_setPaletteFlag = false; _files->loadScreen(94, 0); _files->_setPaletteFlag = true; - _buffer2.copyFrom(*_screen); + _buffer2.blitFrom(*_screen); if (!isDemo() || deathId != 10) { for (int i = 0; i < 3; ++i) { diff --git a/engines/access/amazon/amazon_logic.cpp b/engines/access/amazon/amazon_logic.cpp index 436a875688..6dffb85e5e 100644 --- a/engines/access/amazon/amazon_logic.cpp +++ b/engines/access/amazon/amazon_logic.cpp @@ -106,8 +106,8 @@ void CampScene::mWhileDoOpen() { _vm->_files->_setPaletteFlag = false; _vm->_files->loadScreen(1, 2); - _vm->_buffer2.copyFrom(*_vm->_screen); - _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); + _vm->_buffer1.blitFrom(*_vm->_screen); // Load animation data _vm->_animation->freeAnimationData(); @@ -317,8 +317,8 @@ void Opening::doTitle() { _vm->_events->hideCursor(); if (!_vm->isDemo()) { - _vm->_sound->queueSound(0, 98, 30); - _vm->_sound->queueSound(1, 98, 8); + _vm->_sound->loadSoundTable(0, 98, 30); + _vm->_sound->loadSoundTable(1, 98, 8); _vm->_files->_setPaletteFlag = false; _vm->_files->loadScreen(0, 3); @@ -341,19 +341,16 @@ void Opening::doTitle() { _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 && !_vm->shouldQuit(); ++_pCount) { - _vm->_buffer2.copyFrom(_vm->_buffer1); + _vm->_buffer2.blitFrom(_vm->_buffer1); int id = COUNTDOWN[_pCount * 2]; int xp = COUNTDOWN[_pCount * 2 + 1]; _vm->_buffer2.plotImage(_vm->_objectsTable[0], id, Common::Point(xp, 71)); @@ -385,8 +382,8 @@ void Opening::doTitle() { _vm->_files->_setPaletteFlag = false; _vm->_files->loadScreen(0, 5); - _vm->_buffer2.copyFrom(*_vm->_screen); - _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); + _vm->_buffer1.blitFrom(*_vm->_screen); screen.forceFadeIn(); _vm->_midi->newMusic(1, 0); _vm->_events->_vbCount = 700; @@ -493,55 +490,62 @@ void Opening::doTent() { _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->loadSoundTable(0, 98, 39); + _vm->_sound->loadSoundTable(1, 98, 14); + _vm->_sound->loadSoundTable(2, 98, 15); + _vm->_sound->loadSoundTable(3, 98, 16); + _vm->_sound->loadSoundTable(4, 98, 31, 2); + _vm->_sound->loadSoundTable(5, 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->_buffer2.blitFrom(*_vm->_screen); + _vm->_buffer1.blitFrom(*_vm->_screen); _vm->_screen->forceFadeIn(); _vm->_video->setVideo(_vm->_screen, Common::Point(126, 73), FileIdent(2, 1), 10); + int previousFrame = -1; 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->_midi->newMusic(73, 1); - _vm->_midi->newMusic(11, 0); - step = 1; - _vm->_sound->playSound(1); + if (previousFrame != _vm->_video->_videoFrame) { + previousFrame = _vm->_video->_videoFrame; + + 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->_midi->newMusic(73, 1); + _vm->_midi->newMusic(11, 0); + step = 1; + _vm->_sound->playSound(1); + } } } - _vm->_events->pollEventsAndWait(); } _vm->_sound->playSound(5); _vm->_video->setVideo(_vm->_screen, Common::Point(43, 11), FileIdent(2, 2), 10); + previousFrame = -1; 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; + if (previousFrame != _vm->_video->_videoFrame) { + previousFrame = _vm->_video->_videoFrame; + if (_vm->_video->_videoFrame == 26) { + _vm->_sound->playSound(5); + } else if (_vm->_video->_videoFrame == 15) { + if (step !=3) { + _vm->_sound->playSound(3); + step = 3; + } } } - _vm->_events->pollEventsAndWait(); } @@ -1035,7 +1039,7 @@ void Guard::setHorizontalCode() { if (_bottomRight.x < screen._orgX1) _gCode2 |= 8; - else if (_bottomRight.y > screen._orgX2) + else if (_bottomRight.x > screen._orgX2) _gCode2 |= 2; } @@ -1276,8 +1280,8 @@ void Cast::doCast(int param1) { _vm->_files->_setPaletteFlag = false; _vm->_files->loadScreen(58, 1); - _vm->_buffer2.copyFrom(*_vm->_screen); - _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); + _vm->_buffer1.blitFrom(*_vm->_screen); _xTrack = 0; _yTrack = -6; @@ -1319,7 +1323,7 @@ void Cast::doCast(int param1) { while (!_vm->shouldQuit()) { _vm->_images.clear(); pan(); - _vm->_buffer2.copyFrom(_vm->_buffer1); + _vm->_buffer2.blitFrom(_vm->_buffer1); _vm->_newRects.clear(); _vm->plotList(); _vm->copyBlocks(); @@ -1371,6 +1375,18 @@ River::River(AmazonEngine *vm) : PannedScene(vm) { _deathCount = 0; _oldScrollCol = 0; _maxHits = 0; + _mapPtr = nullptr; + _canoeMoveCount = 0; + _canoeVXPos = 0; + _canoeFrame = 0; + _canoeDir = 0; + _canoeLane = 0; + _canoeYPos = 0; + _hitCount = 0; + _riverIndex = 0; + _topList = _botList = nullptr; + _deathType = 0; + _hitSafe = 0; } void River::setRiverPan() { @@ -1410,7 +1426,7 @@ void River::initRiver() { _vm->_files->_setPaletteFlag = false; _vm->_files->loadScreen(95, 4); - _vm->_buffer2.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); screen.restorePalette(); screen.setBufferScan(); @@ -1480,11 +1496,11 @@ void River::initRiver() { _maxHits = 2 - _vm->_riverFlag; _saveRiver = false; - Font &font2 = _vm->_fonts._font2; - font2._fontColors[0] = 0; - font2._fontColors[1] = 33; - font2._fontColors[2] = 34; - font2._fontColors[3] = 35; + // Set font colors for drawing using font2 + Font::_fontColors[0] = 0; + Font::_fontColors[1] = 33; + Font::_fontColors[2] = 34; + Font::_fontColors[3] = 35; } void River::resetPositions() { @@ -1510,8 +1526,6 @@ void River::checkRiverPan() { } bool River::riverJumpTest() { - Screen &screen = *_vm->_screen; - if (_vm->_scrollCol == 120 || _vm->_scrollCol == 60 || _vm->_scrollCol == 0) { int val = *++_mapPtr; if (val == 0xFF) @@ -1744,7 +1758,7 @@ void River::mWhileDownRiver() { screen.savePalette(); if (!_vm->isDemo()) _vm->_files->loadScreen(95, 4); - _vm->_buffer2.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); screen.restorePalette(); screen.setPalette(); screen.setBufferScan(); @@ -1909,7 +1923,6 @@ void River::synchronize(Common::Serializer &s) { if (_vm->_player->_roomNumber == 45) { if (s.isSaving()) { // Set river properties to be saved out - Screen &screen = *_vm->_screen; _rScrollRow = _vm->_scrollRow; _rScrollCol = _vm->_scrollCol; _rScrollX = _vm->_scrollX; diff --git a/engines/access/amazon/amazon_logic.h b/engines/access/amazon/amazon_logic.h index a1fb4eef77..0d962483e6 100644 --- a/engines/access/amazon/amazon_logic.h +++ b/engines/access/amazon/amazon_logic.h @@ -242,6 +242,8 @@ public: class InactivePlayer : public ImageEntry { public: SpriteResource *_altSpritesPtr; + + InactivePlayer() { _altSpritesPtr = nullptr; } }; } // End of namespace Amazon diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp index 633188e4dd..92acb3686d 100644 --- a/engines/access/amazon/amazon_scripts.cpp +++ b/engines/access/amazon/amazon_scripts.cpp @@ -38,7 +38,7 @@ AmazonScripts::AmazonScripts(AccessEngine *vm) : Scripts(vm) { void AmazonScripts::cLoop() { searchForSequence(); _vm->_images.clear(); - _vm->_buffer2.copyFrom(_vm->_buffer1); + _vm->_buffer2.blitFrom(_vm->_buffer1); _vm->_oldRects.clear(); _vm->_scripts->executeScript(); _vm->plotList1(); @@ -51,8 +51,8 @@ void AmazonScripts::mWhile1() { _vm->_events->hideCursor(); _vm->_files->loadScreen(14, 0); - _vm->_buffer2.copyFrom(*_vm->_screen); - _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); + _vm->_buffer1.blitFrom(*_vm->_screen); _vm->_events->showCursor(); _vm->_screen->setIconPalette(); @@ -86,8 +86,8 @@ void AmazonScripts::mWhile1() { _vm->_files->loadScreen(14, 1); _vm->_screen->setPalette(); - _vm->_buffer2.copyFrom(*_vm->_screen); - _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); + _vm->_buffer1.blitFrom(*_vm->_screen); _vm->_events->showCursor(); _vm->_screen->setIconPalette(); @@ -95,7 +95,7 @@ void AmazonScripts::mWhile1() { _vm->_oldRects.clear(); _sequence = 2200; - _vm->_sound->queueSound(0, 14, 15); + _vm->_sound->loadSoundTable(0, 14, 15); do { cLoop(); @@ -107,8 +107,8 @@ void AmazonScripts::mWhile1() { _vm->_files->loadScreen(14, 2); _vm->_screen->setPalette(); - _vm->_buffer2.copyFrom(*_vm->_screen); - _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); + _vm->_buffer1.blitFrom(*_vm->_screen); _vm->_events->showCursor(); _vm->_screen->setIconPalette(); @@ -138,8 +138,8 @@ void AmazonScripts::mWhile1() { _vm->_files->loadScreen(14, 3); _vm->_screen->setPalette(); - _vm->_buffer2.copyFrom(*_vm->_screen); - _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); + _vm->_buffer1.blitFrom(*_vm->_screen); _vm->_events->showCursor(); _vm->_screen->setIconPalette(); @@ -159,8 +159,8 @@ void AmazonScripts::mWhile2() { _vm->_events->hideCursor(); _vm->_files->loadScreen(14, 0); - _vm->_buffer2.copyFrom(*_vm->_screen); - _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); + _vm->_buffer1.blitFrom(*_vm->_screen); _vm->_events->showCursor(); _vm->_screen->setIconPalette(); @@ -190,8 +190,8 @@ void AmazonScripts::mWhile2() { _vm->_files->loadScreen(14, 3); _vm->_screen->setPalette(); - _vm->_buffer2.copyFrom(*_vm->_screen); - _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); + _vm->_buffer1.blitFrom(*_vm->_screen); _vm->_events->showCursor(); _vm->_screen->setIconPalette(); @@ -240,8 +240,8 @@ void AmazonScripts::loadBackground(int param1, int param2) { _vm->_files->_setPaletteFlag = false; _vm->_files->loadScreen(param1, param2); - _vm->_buffer2.copyFrom(*_vm->_screen); - _vm->_buffer1.copyFrom(*_vm->_screen); + _vm->_buffer2.blitFrom(*_vm->_screen); + _vm->_buffer1.blitFrom(*_vm->_screen); _vm->_screen->forceFadeIn(); } |