diff options
-rw-r--r-- | engines/access/data.h | 9 | ||||
-rw-r--r-- | engines/access/room.cpp | 38 | ||||
-rw-r--r-- | engines/access/room.h | 30 |
3 files changed, 72 insertions, 5 deletions
diff --git a/engines/access/data.h b/engines/access/data.h index 8b77e7c5b3..cf8394baf9 100644 --- a/engines/access/data.h +++ b/engines/access/data.h @@ -28,6 +28,15 @@ namespace Access { +class AccessEngine; + +class Manager { +protected: + AccessEngine *_vm; +public: + Manager(AccessEngine *vm) : _vm(vm) {} +}; + struct TimerEntry { int _initTm; int _timer; diff --git a/engines/access/room.cpp b/engines/access/room.cpp index afa42c82f0..7a07f58bcb 100644 --- a/engines/access/room.cpp +++ b/engines/access/room.cpp @@ -26,9 +26,12 @@ #include "access/resources.h" #include "access/room.h" +#define TILE_WIDTH 16 +#define TILE_HEIGHT 16 + namespace Access { -Room::Room(AccessEngine *vm) : _vm(vm) { +Room::Room(AccessEngine *vm) : Manager(vm) { _function = 0; _roomFlag = 0; } @@ -261,11 +264,40 @@ void Room::setupRoom() { } void Room::setWallCodes() { - // TODO + _jetFrame.clear(); + _jetFrame.resize(_plotter._walls.size()); + + _vm->_player->_rawXTemp = _vm->_player->_rawPlayer.x; + _vm->_player->_rawYTemp = _vm->_player->_rawPlayer.y; } void Room::buildScreen() { - // TODO + int scrollCol = _vm->_screen->_scrollCol; + int cnt = _vm->_screen->_vWindowSize.x + 1; + int offset = 0; + + for (int idx = 0; idx < cnt, offset += TILE_WIDTH; ++idx) { + buildColumn(_vm->_screen->_scrollCol, offset); + ++_vm->_screen->_scrollCol; + } + + _vm->_screen->_scrollCol = scrollCol; + _vm->_screen->copyBF1BF2(); +} + +void Room::buildColumn(int playX, int screenX) { + const byte *pSrc = _vm->_playField + _vm->_screen->_scrollRow * + _vm->_playFieldSize.x + playX; + byte *pDest = (byte *)_vm->_buffer1.getPixels(); + + for (int y = 0; y <= _vm->_screen->_vWindowSize.y; ++y) { + byte *pTile = _vm->_tile + (*pSrc << 8); + + for (int tileY = 0; tileY < TILE_HEIGHT; ++tileY) { + Common::copy(pTile, pTile + TILE_WIDTH, pDest); + pDest += _vm->_screen->_vWindowSize.x; + } + } } /*------------------------------------------------------------------------*/ diff --git a/engines/access/room.h b/engines/access/room.h index c42c3f1142..fa41d32552 100644 --- a/engines/access/room.h +++ b/engines/access/room.h @@ -24,12 +24,34 @@ #define ACCESS_ROOM_H #include "common/scummsys.h" +#include "common/array.h" +#include "common/rect.h" +#include "access/data.h" namespace Access { -class AccessEngine; +class Plotter { +public: + Common::Array<Common::Rect> _walls; + Common::Array<Common::Rect> _blocks; + int _blockIn; + int _delta; +}; + +class JetFrame { +public: + int _wallCode; + int _wallCodeOld; + int _wallCode1; + int _wallCode1Old; + + JetFrame() { + _wallCode = _wallCodeOld = 0; + _wallCode1 = _wallCode1Old = 0; + } +}; -class Room { +class Room: public Manager { private: void roomLoop(); protected: @@ -48,6 +70,8 @@ protected: virtual void setIconPalette() {} public: + Plotter _plotter; + Common::Array<JetFrame> _jetFrame; int _function; int _roomFlag; public: @@ -61,6 +85,8 @@ public: * Clear all the data used by the room */ void clearRoom(); + + void buildColumn(int playX, int screenX); }; |