diff options
author | Paul Gilbert | 2014-08-09 22:07:28 -0400 |
---|---|---|
committer | Paul Gilbert | 2014-08-09 22:07:28 -0400 |
commit | c1613178c3c89d6a088814eeeeffc6935852140f (patch) | |
tree | 7d3fd5aaebe41a70c127dc9a1318b9a08e81a7fa /engines/access | |
parent | f495d390993a8a0d1e785c71fa36553fab17f90b (diff) | |
download | scummvm-rg350-c1613178c3c89d6a088814eeeeffc6935852140f.tar.gz scummvm-rg350-c1613178c3c89d6a088814eeeeffc6935852140f.tar.bz2 scummvm-rg350-c1613178c3c89d6a088814eeeeffc6935852140f.zip |
ACCESS: Implemented player loading
Diffstat (limited to 'engines/access')
-rw-r--r-- | engines/access/access.cpp | 1 | ||||
-rw-r--r-- | engines/access/asurface.cpp | 9 | ||||
-rw-r--r-- | engines/access/asurface.h | 5 | ||||
-rw-r--r-- | engines/access/player.cpp | 103 | ||||
-rw-r--r-- | engines/access/player.h | 13 | ||||
-rw-r--r-- | engines/access/resources.cpp | 25 | ||||
-rw-r--r-- | engines/access/resources.h | 25 | ||||
-rw-r--r-- | engines/access/screen.cpp | 12 | ||||
-rw-r--r-- | engines/access/screen.h | 5 |
9 files changed, 173 insertions, 25 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp index 122a8a0882..d0bc1a8846 100644 --- a/engines/access/access.cpp +++ b/engines/access/access.cpp @@ -118,7 +118,6 @@ AccessEngine::~AccessEngine() { _buffer2.free(); freeCells(); - delete[] _man; delete[] _man1; delete[] _inactive; delete[] _manPal1; diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp index b791186e03..a0a790dbdc 100644 --- a/engines/access/asurface.cpp +++ b/engines/access/asurface.cpp @@ -30,13 +30,4 @@ void ASurface::clearBuffer() { Common::fill(pSrc, pSrc + w * h, 0); } -void ASurface::setScaleTable(int scale) { - int total = 0; - for (int idx = 0; idx < 256; ++idx) { - _scaleTable1[idx] = total >> 8; - _scaleTable2[idx] = total & 0xff; - total += scale; - } -} - } // End of namespace Access diff --git a/engines/access/asurface.h b/engines/access/asurface.h index 857067684f..ace1b2382c 100644 --- a/engines/access/asurface.h +++ b/engines/access/asurface.h @@ -30,15 +30,10 @@ namespace Access { class ASurface : public Graphics::Surface { -private: - byte _scaleTable1[256]; - byte _scaleTable2[256]; public: void clearBuffer(); void copyBuffer(Graphics::Surface *src) { copyFrom(*src); } - - void setScaleTable(int scale); }; } // End of namespace Access diff --git a/engines/access/player.cpp b/engines/access/player.cpp index e4ef0eb48e..f0cceb7180 100644 --- a/engines/access/player.cpp +++ b/engines/access/player.cpp @@ -20,19 +20,22 @@ * */ -#include "access/player.h" #include "common/algorithm.h" #include "common/textconsole.h" +#include "access/player.h" +#include "access/access.h" +#include "access/resources.h" namespace Access { -Player::Player(AccessEngine *vm): _vm(vm) { - _field0 = 0; - _monData = nullptr; +Player::Player(AccessEngine *vm): Manager(vm) { Common::fill(&_walkOffRight[0], &_walkOffRight[PLAYER_DATA_COUNT], 0); Common::fill(&_walkOffLeft[0], &_walkOffLeft[PLAYER_DATA_COUNT], 0); Common::fill(&_walkOffUp[0], &_walkOffUp[PLAYER_DATA_COUNT], 0); Common::fill(&_walkOffDown[0], &_walkOffDown[PLAYER_DATA_COUNT], 0); + + _field0 = 0; + _monData = nullptr; _rawTempL = 0; _rawXTemp = 0; _rawYTempL = 0; @@ -42,18 +45,102 @@ Player::Player(AccessEngine *vm): _vm(vm) { _playerYLow = 0; _playerY = 0; _frame = 0; - _playerOff = false; - + _leftDelta = _rightDelta = 0; + _upDelta = _downDelta = 0; + _scrollConst = 0; _roomNumber = 0; } void Player::load() { - // TODO + if (_vm->_room->_roomFlag == 3) { + _playerOffset.x = _vm->_screen->_scaleTable1[8]; + _playerOffset.y = _vm->_screen->_scaleTable1[11]; + _leftDelta = 0; + _rightDelta = 8; + _upDelta = 2; + _downDelta = -2; + _scrollConst = 2; + + for (int i = 0; i < PLAYER_DATA_COUNT; ++i) { + _walkOffRight[i] = OVEROFFR[i]; + _walkOffLeft[i] = OVEROFFL[i]; + _walkOffUp[i] = OVEROFFU[i]; + _walkOffDown[i] = OVEROFFD[i]; + _walkOffUR[i].x = OVEROFFURX[i]; + _walkOffUR[i].y = OVEROFFURY[i]; + _walkOffDR[i].x = OVEROFFDRX[i]; + _walkOffDR[i].y = OVEROFFDRY[i]; + _walkOffUL[i].x = OVEROFFULX[i]; + _walkOffUL[i].y = OVEROFFULY[i]; + _walkOffDL[i].x = OVEROFFDLX[i]; + _walkOffDL[i].y = OVEROFFDLY[i]; + } + + _vm->_timers[8]._initTm = 7; + _vm->_timers[8]._timer = 7; + _vm->_timers[8]._flag = true; + + _sideWalkMin = 0; + _sideWalkMax = 5; + _upWalkMin = 12; + _upWalkMax = 17; + _downWalkMin = 6; + _downWalkMax = 11; + _diagUpWalkMin = 0; + _diagUpWalkMax = 5; + _diagDownWalkMin = 0; + _diagDownWalkMax = 5; + _guard = Common::Point(56, 190); + } else { + _playerOffset.x = _vm->_screen->_scaleTable1[25]; + _playerOffset.y = _vm->_screen->_scaleTable1[67]; + _leftDelta = -3; + _rightDelta = 33; + _upDelta = 5; + _downDelta = -10; + _scrollConst = 5; + + for (int i = 0; i < PLAYER_DATA_COUNT; ++i) { + _walkOffRight[i] = SIDEOFFR[i]; + _walkOffLeft[i] = SIDEOFFL[i]; + _walkOffUp[i] = SIDEOFFU[i]; + _walkOffDown[i] = SIDEOFFD[i]; + _walkOffUR[i].x = DIAGOFFURX[i]; + _walkOffUR[i].y = DIAGOFFURY[i]; + _walkOffDR[i].x = DIAGOFFDRX[i]; + _walkOffDR[i].y = DIAGOFFDRY[i]; + _walkOffUL[i].x = DIAGOFFULX[i]; + _walkOffUL[i].y = DIAGOFFULY[i]; + _walkOffDL[i].x = DIAGOFFDLX[i]; + _walkOffDL[i].y = DIAGOFFDLY[i]; + } + + _sideWalkMin = 0; + _sideWalkMax = 7; + _upWalkMin = 16; + _upWalkMax = 23; + _downWalkMin = 8; + _downWalkMax = 15; + _diagUpWalkMin = 0; + _diagUpWalkMax = 7; + _diagDownWalkMin = 0; + _diagDownWalkMax = 7; + } + + _vm->_man = _vm->_man1; + Common::copy(_vm->_manPal1 + 0x270, _vm->_manPal1 + 0x270 + 0x60, _vm->_screen->_manPal); } void Player::calcManScale() { - // TODO + if (!_vm->_manScaleOff) { + _vm->_scale = (((_rawPlayer.y - _vm->_scaleMaxY + _vm->_scaleN1) * + _vm->_scaleT1 + (_vm->_scaleH2 << 8)) / _vm->_scaleH1 * _vm->_scaleI) >> 8; + _vm->_screen->setScaleTable(_vm->_scale); + + _playerOffset.x = _vm->_screen->_scaleTable1[20]; + _playerOffset.y = _vm->_screen->_scaleTable1[67]; + } } void Player::walk() { diff --git a/engines/access/player.h b/engines/access/player.h index ec6b53fc2a..7625fa2cc7 100644 --- a/engines/access/player.h +++ b/engines/access/player.h @@ -25,6 +25,7 @@ #include "common/scummsys.h" #include "common/rect.h" +#include "access/data.h" namespace Access { @@ -32,9 +33,17 @@ namespace Access { class AccessEngine; -class Player { +class Player: public Manager { private: - AccessEngine *_vm; + int _leftDelta, _rightDelta; + int _upDelta, _downDelta; + int _scrollConst; + int _sideWalkMin, _sideWalkMax; + int _upWalkMin, _upWalkMax; + int _downWalkMin, _downWalkMax; + int _diagUpWalkMin, _diagUpWalkMax; + int _diagDownWalkMin, _diagDownWalkMax; + Common::Point _guard; public: // Fields in original Player structure int _field0; diff --git a/engines/access/resources.cpp b/engines/access/resources.cpp index 8aa44b470b..841ab70f04 100644 --- a/engines/access/resources.cpp +++ b/engines/access/resources.cpp @@ -46,4 +46,29 @@ const byte INITIAL_PALETTE[18 * 3] = { 0x00, 0x00, 0x00 }; +const int SIDEOFFR[] = { 5, 5, 5, 5, 5, 5, 5, 5, 0 }; +const int SIDEOFFL[] = { 5, 5, 5, 5, 5, 5, 5, 5, 0 }; +const int SIDEOFFU[] = { 2, 2, 2, 2, 2, 2, 2, 2, 0 }; +const int SIDEOFFD[] = { 2, 2, 2, 2, 2, 2, 2, 2, 0 }; +const int DIAGOFFURX[] = { 4, 5, 2, 2, 3, 4, 2, 2, 0 }; +const int DIAGOFFURY[] = { 2, 3, 2, 2, 2, 3, 1, 1, 0 }; +const int DIAGOFFDRX[] = { 4, 5, 4, 3, 5, 4, 5, 1, 0 }; +const int DIAGOFFDRY[] = { 3, 2, 1, 2, 2, 1, 2, 1, 0 }; +const int DIAGOFFULX[] = { 4, 5, 4, 3, 3, 2, 2, 2, 0 }; +const int DIAGOFFULY[] = { 3, 3, 1, 2, 2, 1, 1, 1, 0 }; +const int DIAGOFFDLX[] = { 4, 5, 3, 3, 5, 4, 6, 1, 0 }; +const int DIAGOFFDLY[] = { 2, 2, 1, 2, 3, 1, 2, 1, 0 }; +const int OVEROFFR[] = { 2, 2, 1, 2, 2, 1, 0, 0, 0 }; +const int OVEROFFL[] = { 2, 2, 1, 2, 2, 1, 0, 0, 0 }; +const int OVEROFFU[] = { 1, 1, 1, 1, 1, 1, 0, 0, 0 }; +const int OVEROFFD[] = { 1, 1, 1, 1, 1, 1, 0, 0, 0 }; +const int OVEROFFURX[] = { 3, 1, 1, 2, 2, 1, 0, 0, 0 }; +const int OVEROFFURY[] = { 1, 0, 0, 1, 1, 0, 0, 0, 0 }; +const int OVEROFFDRX[] = { 1, 2, 1, 1, 2, 1, 0, 0, 0 }; +const int OVEROFFDRY[] = { 0, 1, 0, 0, 1, 1, 0, 0, 0 }; +const int OVEROFFULX[] = { 2, 1, 1, 1, 2, 1, 0, 0, 0 }; +const int OVEROFFULY[] = { 1, 0, 0, 2, 1, 0, 0, 0, 0 }; +const int OVEROFFDLX[] = { 1, 2, 1, 1, 2, 1, 0, 0, 0 }; +const int OVEROFFDLY[] = { 0, 1, 0, 0, 1, 1, 0, 0, 0 }; + } // End of namespace Access diff --git a/engines/access/resources.h b/engines/access/resources.h index 47d4e3ac8c..1b49b598ca 100644 --- a/engines/access/resources.h +++ b/engines/access/resources.h @@ -29,6 +29,31 @@ namespace Access { extern const byte INITIAL_PALETTE[18 * 3]; +extern const int SIDEOFFR[]; +extern const int SIDEOFFL[]; +extern const int SIDEOFFU[]; +extern const int SIDEOFFD[]; +extern const int DIAGOFFURX[]; +extern const int DIAGOFFURY[]; +extern const int DIAGOFFDRX[]; +extern const int DIAGOFFDRY[]; +extern const int DIAGOFFULX[]; +extern const int DIAGOFFULY[]; +extern const int DIAGOFFDLX[]; +extern const int DIAGOFFDLY[]; +extern const int OVEROFFR[]; +extern const int OVEROFFL[]; +extern const int OVEROFFU[]; +extern const int OVEROFFD[]; +extern const int OVEROFFURX[]; +extern const int OVEROFFURY[]; +extern const int OVEROFFDRX[]; +extern const int OVEROFFDRY[]; +extern const int OVEROFFULX[]; +extern const int OVEROFFULY[]; +extern const int OVEROFFDLX[]; +extern const int OVEROFFDLY[]; + } // End of namespace Access #endif /* ACCESS_RESOURCES_H */ diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp index 428c3d5df8..45379b6a51 100644 --- a/engines/access/screen.cpp +++ b/engines/access/screen.cpp @@ -35,6 +35,9 @@ namespace Access { Screen::Screen(AccessEngine *vm) : _vm(vm) { create(320, 200, Graphics::PixelFormat::createFormatCLUT8()); Common::fill(&_tempPalette[0], &_tempPalette[PALETTE_SIZE], 0); + Common::fill(&_manPal[0], &_manPal[0x60], 0); + Common::fill(&_scaleTable1[0], &_scaleTable1[256], 0); + Common::fill(&_scaleTable2[0], &_scaleTable2[256], 0); _vesaMode = 0; _vesaCurrentWin = 0; _currentPanel = 0; @@ -224,4 +227,13 @@ void Screen::setBufferScan() { // TODO } +void Screen::setScaleTable(int scale) { + int total = 0; + for (int idx = 0; idx < 256; ++idx) { + _scaleTable1[idx] = total >> 8; + _scaleTable2[idx] = total & 0xff; + total += scale; + } +} + } // End of namespace Access diff --git a/engines/access/screen.h b/engines/access/screen.h index c4beacf17c..69a28bdce1 100644 --- a/engines/access/screen.h +++ b/engines/access/screen.h @@ -62,6 +62,9 @@ public: Common::Point _vWindowSize; int _scrollX, _scrollY; int _scrollCol, _scrollRow; + byte _manPal[0x60]; + byte _scaleTable1[256]; + byte _scaleTable2[256]; public: Screen(AccessEngine *vm); @@ -119,6 +122,8 @@ public: void copyRects(); void setBufferScan(); + + void setScaleTable(int scale); }; } // End of namespace Access |