From 38f010f96f3ba2ff1ff217912d196873ecc29877 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 3 Nov 2014 00:18:59 +0100 Subject: ACCESS: Implement mWhileFly --- engines/access/amazon/amazon_scripts.cpp | 87 +++++++++++++++++++++++++++++++- engines/access/amazon/amazon_scripts.h | 3 ++ engines/access/events.h | 5 +- 3 files changed, 91 insertions(+), 4 deletions(-) diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp index 9ecaadd6aa..a39b8ae6e2 100644 --- a/engines/access/amazon/amazon_scripts.cpp +++ b/engines/access/amazon/amazon_scripts.cpp @@ -205,13 +205,98 @@ void AmazonScripts::mWhile2() { } while (_vm->_flags[52] == 4); } +void AmazonScripts::doFlyCell() { + _game->_destIn = &_game->_buffer2; + if (_game->_plane._pCount <= 40) { + _vm->_screen->plotImage(_vm->_objectsTable[15], 3, Common::Point(70, 74)); + } else if (_game->_plane._pCount <= 80) { + _vm->_screen->plotImage(_vm->_objectsTable[15], 6, Common::Point(70, 74)); + } else if (_game->_plane._pCount <= 120) { + _vm->_screen->plotImage(_vm->_objectsTable[15], 2, Common::Point(50, 76)); + } else if (_game->_plane._pCount <= 160) { + _vm->_screen->plotImage(_vm->_objectsTable[15], 14, Common::Point(63, 78)); + } else if (_game->_plane._pCount <= 200) { + _vm->_screen->plotImage(_vm->_objectsTable[15], 5, Common::Point(86, 74)); + } else if (_game->_plane._pCount <= 240) { + _vm->_screen->plotImage(_vm->_objectsTable[15], 0, Common::Point(103, 76)); + } else if (_game->_plane._pCount <= 280) { + _vm->_screen->plotImage(_vm->_objectsTable[15], 4, Common::Point(119, 77)); + } else { + _vm->_screen->plotImage(_vm->_objectsTable[15], 1, Common::Point(111, 77)); + } +} + +void AmazonScripts::scrollFly() { + _vm->copyBF1BF2(); + _vm->_newRects.clear(); + doFlyCell(); + _vm->copyRects(); + _vm->copyBF2Vid(); +} + +void AmazonScripts::mWhileFly() { + _vm->_events->hideCursor(); + _vm->_screen->clearScreen(); + _vm->_screen->setBufferScan(); + _vm->_screen->fadeOut(); + _vm->_screen->_scrollX = 0; + + _vm->_room->buildScreen(); + _vm->copyBF2Vid(); + _vm->_screen->fadeIn(); + _vm->_oldRects.clear(); + _vm->_newRects.clear(); + + // KEYFLG = 0; + + _vm->_screen->_scrollRow = _vm->_screen->_scrollCol = 0; + _vm->_screen->_scrollX = _vm->_screen->_scrollY = 0; + _vm->_player->_rawPlayer = Common::Point(0, 0); + _vm->_player->_scrollAmount = 1; + + _game->_plane._pCount = 0; + _game->_plane._planeCount = 0; + _game->_plane._propCount = 0; + _game->_plane._xCount = 0; + _game->_plane._position = Common::Point(20, 29); + + warning("FIXME: _vbCount should be handled in NEWTIMER"); + while (true) { + int _vbCount = 4; + if (_vm->_screen->_scrollCol + _vm->_screen->_vWindowWidth == _vm->_room->_playFieldWidth) { + _vm->_events->showCursor(); + return; + } + + _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); + } + + scrollFly(); + ++_game->_plane._pCount; + g_system->delayMillis(10); + + while(_vbCount > 0) { + // To be rewritten when NEWTIMER is done + _vm->_events->checkForNextFrameCounter(); + _vbCount--; + _vm->_sound->playSound(0); + } + } +} + void AmazonScripts::mWhile(int param1) { switch(param1) { case 1: mWhile1(); break; case 2: - warning("TODO FLY"); + mWhileFly(); break; case 3: warning("TODO FALL"); diff --git a/engines/access/amazon/amazon_scripts.h b/engines/access/amazon/amazon_scripts.h index 694260ddcb..fb2c66f685 100644 --- a/engines/access/amazon/amazon_scripts.h +++ b/engines/access/amazon/amazon_scripts.h @@ -39,9 +39,12 @@ protected: virtual void executeSpecial(int commandIndex, int param1, int param2); virtual void executeCommand(int commandIndex); + void doFlyCell(); + void scrollFly(); void cLoop(); void mWhile1(); void mWhile2(); + void mWhileFly(); void mWhile(int param1); void guardSee(); void setGuardFrame(); diff --git a/engines/access/events.h b/engines/access/events.h index 6b46086d9a..313a039831 100644 --- a/engines/access/events.h +++ b/engines/access/events.h @@ -47,9 +47,6 @@ private: uint32 _frameCounter; uint32 _priorFrameTime; Graphics::Surface _invCursor; - - bool checkForNextFrameCounter(); - void nextFrame(); public: CursorType _cursorId; @@ -119,6 +116,8 @@ public: void waitKeyMouse(); + bool checkForNextFrameCounter(); + Common::Point &getMousePos() { return _mousePos; } Common::Point calcRawMouse(); -- cgit v1.2.3