From 2c700cc6cd633b2a07ae5b10c803fb7b7321413c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 4 Nov 2014 23:57:51 +0100 Subject: ACCESS: Start implementing mWhileJWalk() --- engines/access/amazon/amazon_scripts.cpp | 112 ++++++++++++++++++++++++++++++- engines/access/amazon/amazon_scripts.h | 22 ++++++ engines/access/player.h | 7 +- 3 files changed, 137 insertions(+), 4 deletions(-) diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp index 688dbe0a30..d2370a2fd1 100644 --- a/engines/access/amazon/amazon_scripts.cpp +++ b/engines/access/amazon/amazon_scripts.cpp @@ -32,6 +32,27 @@ namespace Amazon { AmazonScripts::AmazonScripts(AccessEngine *vm) : Scripts(vm) { _game = (AmazonEngine *)_vm; + + _xTrack = 0; + _yTrack = 0; + _zTrack = 0; + _xCam = 0; + _yCam = 0; + _zCam = 0; + + _pNumObj = 0; + for (int i = 0; i < 32; i++) { + _pImgNum[i] = 0; + _pObject[i] = nullptr; + _pObjX[i] = 0; + _pObjY[i] = 0; + _pObjZ[i] = 0; + } + + for (int i = 0; i < 16; i++) { + _pObjXl[i] = 0; + _pObjYl[i] = 0; + } } void AmazonScripts::cLoop() { @@ -247,6 +268,10 @@ void AmazonScripts::doFallCell() { _game->_plane._planeCount += 6; } +void AmazonScripts::PAN() { + warning("TODO: PAN"); +} + void AmazonScripts::scrollFly() { _vm->copyBF1BF2(); _vm->_newRects.clear(); @@ -263,6 +288,14 @@ void AmazonScripts::scrollFall() { _vm->copyBF2Vid(); } +void AmazonScripts::scrollJWalk() { + _vm->copyBF1BF2(); + _vm->_newRects.clear(); + _game->plotList(); + _vm->copyRects(); + _vm->copyBF2Vid(); +} + void AmazonScripts::mWhileFly() { _vm->_events->hideCursor(); _vm->_screen->clearScreen(); @@ -369,6 +402,83 @@ void AmazonScripts::mWhileFall() { } } +void AmazonScripts::mWhileJWalk() { + const int jungleObj[7][4] = { + {2, 77, 0, 40}, + {0, 290, 0, 50}, + {1, 210, 0, 70}, + {0, 50, 0, 30}, + {1, 70, 0, 20}, + {0, -280, 0, 60}, + {1, -150, 0, 30}, + }; + + _vm->_screen->fadeOut(); + _vm->_events->hideCursor(); + _vm->_screen->clearScreen(); + _vm->_buffer2.clearBuffer(); + _vm->_screen->setBufferScan(); + _vm->_screen->_scrollX = 0; + + _vm->_room->buildScreen(); + _vm->copyBF2Vid(); + _vm->_screen->fadeIn(); + + // KEYFLG = 0; + _vm->_player->_xFlag = 1; + _vm->_player->_yFlag = 0; + _vm->_player->_moveTo.x = 160; + _vm->_player->_move = UP; + + _game->_plane._xCount = 2; + _xTrack = 10; + _yTrack = _zTrack = 0; + _xCam = 480; + _yCam = 0; + _zCam = 80; + + TimerEntry *te = &_vm->_timers[24]; + te->_initTm = te->_timer = 1; + te->_flag++; + + _pNumObj = 7; + for (int i = 0; i < _pNumObj; i++) { + _pObject[i] = _vm->_objectsTable[24]; + _pImgNum[i] = jungleObj[i][0]; + _pObjX[i] = jungleObj[i][1]; + _pObjY[i] = jungleObj[i][2]; + _pObjZ[i] = jungleObj[i][3]; + _pObjXl[i] = _pObjYl[i] = 0; + } + + while (true) { + _vm->_images.clear(); + int _vbCount = 6; + if (_vm->_player->_xFlag == 2) { + _vm->_events->showCursor(); + return; + } + + _pImgNum[0] = _game->_plane._xCount; + if (_game->_plane._xCount == 2) + ++_game->_plane._xCount; + else + --_game->_plane._xCount; + + _vm->_player->checkMove(); + _vm->_player->checkScroll(); + PAN(); + scrollJWalk(); + + g_system->delayMillis(10); + while(_vbCount > 0) { + // To be rewritten when NEWTIMER is done + _vm->_events->checkForNextFrameCounter(); + _vbCount--; + } + } +} + void AmazonScripts::mWhile(int param1) { switch(param1) { case 1: @@ -381,7 +491,7 @@ void AmazonScripts::mWhile(int param1) { mWhileFall(); break; case 4: - warning("TODO JWALK"); + mWhileJWalk(); break; case 5: warning("TODO DOOPEN"); diff --git a/engines/access/amazon/amazon_scripts.h b/engines/access/amazon/amazon_scripts.h index ca96de60d7..50fab5caaf 100644 --- a/engines/access/amazon/amazon_scripts.h +++ b/engines/access/amazon/amazon_scripts.h @@ -35,6 +35,26 @@ class AmazonEngine; class AmazonScripts: public Scripts { private: AmazonEngine *_game; + + int _xTrack; + int _yTrack; + int _zTrack; + int _xCam; + int _yCam; + int _zCam; + + int _pNumObj; + int _pImgNum[32]; + SpriteResource *_pObject[32]; + + int _pObjX[32]; + int _pObjY[32]; + int _pObjZ[32]; + int _pObjXl[16]; + int _pObjYl[16]; + + void PAN(); + protected: virtual void executeSpecial(int commandIndex, int param1, int param2); virtual void executeCommand(int commandIndex); @@ -43,11 +63,13 @@ protected: void doFallCell(); void scrollFly(); void scrollFall(); + void scrollJWalk(); void cLoop(); void mWhile1(); void mWhile2(); void mWhileFly(); void mWhileFall(); + void mWhileJWalk(); void mWhile(int param1); void guardSee(); void setGuardFrame(); diff --git a/engines/access/player.h b/engines/access/player.h index c5c9afa087..ed48af0932 100644 --- a/engines/access/player.h +++ b/engines/access/player.h @@ -49,14 +49,11 @@ private: int _diagUpWalkMin, _diagUpWalkMax; int _diagDownWalkMin, _diagDownWalkMax; Common::Point _guard; - Direction _move; - int _xFlag, _yFlag; SpriteResource *_playerSprites1; byte *_manPal1; int _scrollEnd; int _inactiveYOff; - void checkMove(); void plotCom(int v1); void plotCom1(); void plotCom2(); @@ -97,6 +94,8 @@ public: int _playerYLow; int _playerY; int _frame; + int _xFlag, _yFlag; + Direction _move; // Additional public globals we've added to new Player class bool _playerOff; @@ -129,6 +128,8 @@ public: void checkScroll(); + void checkMove(); + /** * Synchronize savegame data */ -- cgit v1.2.3