Skip to content

Commit

Permalink
ACCESS: Implement buildScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Aug 8, 2014
1 parent 0183007 commit 0c38730
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 5 deletions.
9 changes: 9 additions & 0 deletions engines/access/data.h
Expand Up @@ -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;
Expand Down
38 changes: 35 additions & 3 deletions engines/access/room.cpp
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
}
}

/*------------------------------------------------------------------------*/
Expand Down
30 changes: 28 additions & 2 deletions engines/access/room.h
Expand Up @@ -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:
Expand All @@ -48,6 +70,8 @@ class Room {

virtual void setIconPalette() {}
public:
Plotter _plotter;
Common::Array<JetFrame> _jetFrame;
int _function;
int _roomFlag;
public:
Expand All @@ -61,6 +85,8 @@ class Room {
* Clear all the data used by the room
*/
void clearRoom();

void buildColumn(int playX, int screenX);
};


Expand Down

0 comments on commit 0c38730

Please sign in to comment.