From b8c95e653dab6a82926effe772b03eb6770e6083 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 5 Nov 2014 08:34:59 +0100 Subject: ACCESS: Implement pan() --- engines/access/amazon/amazon_scripts.cpp | 30 +++++++++++++++++++++++++++--- engines/access/amazon/amazon_scripts.h | 2 +- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/engines/access/amazon/amazon_scripts.cpp b/engines/access/amazon/amazon_scripts.cpp index d2370a2fd1..2b489d678e 100644 --- a/engines/access/amazon/amazon_scripts.cpp +++ b/engines/access/amazon/amazon_scripts.cpp @@ -268,8 +268,32 @@ void AmazonScripts::doFallCell() { _game->_plane._planeCount += 6; } -void AmazonScripts::PAN() { - warning("TODO: PAN"); +void AmazonScripts::pan() { + _zCam += _zTrack; + _xCam += _xTrack; + int tx = (_xCam << 8) / _zCam; + _yCam += _yTrack; + int ty = (_yCam << 8) / _zCam; + + if (_vm->_timers[24]._flag != 1) { + ++_vm->_timers[24]._flag; + for (int i = 0; i < _pNumObj; i++) { + _pObjZ[i] = _zTrack; + _pObjXl[i] += tx * _zTrack; + _pObjX[i] += _pObjXl[i]; + _pObjYl[i] += ty * _zTrack; + _pObjY[i] += _pObjYl[i]; + } + } + + for (int i = 0; i < _pNumObj; i++) { + ImageEntry ie; + ie._flags= 8; + ie._position = Common::Point(_pObjX[i], _pObjY[i]); + ie._offsetY = 0xFF; + ie._spritesPtr = _pObject[i]; + ie._frameNumber = _pImgNum[i]; + } } void AmazonScripts::scrollFly() { @@ -467,7 +491,7 @@ void AmazonScripts::mWhileJWalk() { _vm->_player->checkMove(); _vm->_player->checkScroll(); - PAN(); + pan(); scrollJWalk(); g_system->delayMillis(10); diff --git a/engines/access/amazon/amazon_scripts.h b/engines/access/amazon/amazon_scripts.h index 50fab5caaf..1ee8b98e05 100644 --- a/engines/access/amazon/amazon_scripts.h +++ b/engines/access/amazon/amazon_scripts.h @@ -53,7 +53,7 @@ private: int _pObjXl[16]; int _pObjYl[16]; - void PAN(); + void pan(); protected: virtual void executeSpecial(int commandIndex, int param1, int param2); -- cgit v1.2.3