aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/access/access.cpp16
-rw-r--r--engines/access/access.h4
-rw-r--r--engines/access/amazon/amazon_room.cpp6
-rw-r--r--engines/access/player.cpp2
-rw-r--r--engines/access/room.cpp46
-rw-r--r--engines/access/room.h5
-rw-r--r--engines/access/screen.cpp17
-rw-r--r--engines/access/screen.h9
8 files changed, 57 insertions, 48 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 75a3b8d47b..9c0df1ac30 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -315,4 +315,20 @@ void AccessEngine::copyRects() {
}
}
+void AccessEngine::copyBF1BF2() {
+ _buffer2.copyFrom(_buffer1);
+}
+
+void AccessEngine::copyBF2Vid() {
+ const byte *srcP = (const byte *)_buffer2.getPixels();
+ byte *destP = (byte *)_screen->getBasePtr(_screen->_windowXAdd,
+ _screen->_windowYAdd + _screen->_screenYOff);
+
+ for (int yp = 0; yp < _screen->_vWindowLinesTall; ++yp) {
+ Common::copy(srcP, srcP + _screen->_vWindowBytesWide, destP);
+ srcP += _buffer2.pitch;
+ destP += _screen->pitch;
+ }
+}
+
} // End of namespace Access
diff --git a/engines/access/access.h b/engines/access/access.h
index 4efe1b4349..770bd030ff 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -244,6 +244,10 @@ public:
void copyBlocks();
void copyRects();
+
+ void copyBF1BF2();
+
+ void copyBF2Vid();
};
} // End of namespace Access
diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp
index b8ed0d20de..db163977ca 100644
--- a/engines/access/amazon/amazon_room.cpp
+++ b/engines/access/amazon/amazon_room.cpp
@@ -103,10 +103,12 @@ void AmazonRoom::reloadRoom1() {
setWallCodes();
buildScreen();
- if (_vm->_player->_roomNumber != 20 && _vm->_player->_roomNumber != 24
+ if (!_vm->_screen->_vesaMode) {
+ _vm->copyBF2Vid();
+ } else if (_vm->_player->_roomNumber != 20 && _vm->_player->_roomNumber != 24
&& _vm->_player->_roomNumber != 33) {
_vm->_screen->setPalette();
- _vm->_screen->copyBF2Vid();
+ _vm->copyBF2Vid();
}
_vm->_player->_frame = 0;
diff --git a/engines/access/player.cpp b/engines/access/player.cpp
index 794fc08fa4..969df0025f 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -132,7 +132,7 @@ void Player::load() {
if (_vm->_manPal1) {
Common::copy(_vm->_manPal1 + 0x270, _vm->_manPal1 + 0x270 + 0x60, _vm->_screen->_manPal);
} else {
- Common::fill(_vm->_screen->_manPal + 0x270, _vm->_screen->_manPal + 0x270 + 0x60, 0);
+ Common::fill(_vm->_screen->_manPal, _vm->_screen->_manPal + 0x60, 0);
}
}
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index 22ced20f08..c258e076d8 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -38,10 +38,6 @@ Room::Room(AccessEngine *vm) : Manager(vm) {
_playFieldWidth = _playFieldHeight = 0;
_matrixSize = 0;
_tile = nullptr;
- _vWindowWidth = _vWindowHeight = 0;
- _vWindowBytesWide = 0;
- _bufferBytesWide = 0;
- _vWindowLinesTall = 0;
}
Room::~Room() {
@@ -113,7 +109,7 @@ void Room::doRoom() {
}
if (_vm->_screen->_scrollFlag) {
- _vm->_screen->copyBF1BF2();
+ _vm->copyBF1BF2();
_vm->_newRects.clear();
_function = 0;
roomLoop();
@@ -124,10 +120,10 @@ void Room::doRoom() {
} else {
_vm->plotList();
_vm->copyRects();
- _vm->_screen->copyBF2Vid();
+ _vm->copyBF2Vid();
}
} else {
- _vm->_screen->copyBF1BF2();
+ _vm->copyBF1BF2();
_vm->_newRects.clear();
_function = 0;
roomLoop();
@@ -255,34 +251,33 @@ void Room::setupRoom() {
if (_roomFlag != 2)
setIconPalette();
- if (_vWindowWidth == _playFieldWidth) {
+ if (_vm->_screen->_vWindowWidth == _playFieldWidth) {
_vm->_screen->_scrollX = 0;
_vm->_screen->_scrollCol = 0;
} else {
_vm->_screen->_scrollX = _vm->_player->_rawPlayer.x -
(_vm->_player->_rawPlayer.x >> 4);
int xp = MAX((_vm->_player->_rawPlayer.x >> 4) -
- (_vWindowWidth / 2), 0);
+ (_vm->_screen->_vWindowWidth / 2), 0);
_vm->_screen->_scrollCol = xp;
- xp = xp + _vWindowWidth - _playFieldWidth;
+ xp = xp + _vm->_screen->_vWindowWidth - _playFieldWidth;
if (xp >= 0) {
_vm->_screen->_scrollCol = xp + 1;
}
}
- if (_vWindowHeight == _playFieldHeight) {
+ if (_vm->_screen->_vWindowHeight == _playFieldHeight) {
_vm->_screen->_scrollY = 0;
_vm->_screen->_scrollRow = 0;
- }
- else {
+ } else {
_vm->_screen->_scrollY = _vm->_player->_rawPlayer.y -
(_vm->_player->_rawPlayer.y >> 4);
int yp = MAX((_vm->_player->_rawPlayer.y >> 4) -
- (_vWindowHeight / 2), 0);
+ (_vm->_screen->_vWindowHeight / 2), 0);
_vm->_screen->_scrollRow = yp;
- yp = yp + _vWindowHeight - _playFieldHeight;
+ yp = yp + _vm->_screen->_vWindowHeight - _playFieldHeight;
if (yp >= 0) {
_vm->_screen->_scrollRow = yp + 1;
}
@@ -299,7 +294,7 @@ void Room::setWallCodes() {
void Room::buildScreen() {
int scrollCol = _vm->_screen->_scrollCol;
- int cnt = _vWindowWidth + 1;
+ int cnt = _vm->_screen->_vWindowWidth + 1;
int offset = 0;
for (int idx = 0; idx < cnt; offset += TILE_WIDTH, ++idx) {
@@ -308,7 +303,7 @@ void Room::buildScreen() {
}
_vm->_screen->_scrollCol = scrollCol;
- _vm->_screen->copyBF1BF2();
+ _vm->copyBF1BF2();
}
void Room::buildColumn(int playX, int screenX) {
@@ -316,12 +311,12 @@ void Room::buildColumn(int playX, int screenX) {
_playFieldWidth + playX;
byte *pDest = (byte *)_vm->_buffer1.getPixels();
- for (int y = 0; y <= _vWindowHeight; ++y) {
+ for (int y = 0; y <= _vm->_screen->_vWindowHeight; ++y) {
byte *pTile = _tile + (*pSrc << 8);
for (int tileY = 0; tileY < TILE_HEIGHT; ++tileY) {
Common::copy(pTile, pTile + TILE_WIDTH, pDest);
- pDest += _vWindowWidth;
+ pDest += _vm->_screen->_vWindowWidth;
}
}
}
@@ -333,9 +328,10 @@ void Room::init4Quads() {
void Room::loadPlayField(int fileNum, int subfile) {
byte *playData = _vm->_files->loadFile(fileNum, subfile);
Common::MemoryReadStream stream(playData + 0x10, _vm->_files->_filesize - 0x10);
+ Screen &screen = *_vm->_screen;
// Copy the new palette
- _vm->_screen->loadRawPalette(&stream);
+ screen.loadRawPalette(&stream);
// Copy off the tile data
_tileSize = playData[2] << 8;
@@ -352,11 +348,11 @@ void Room::loadPlayField(int fileNum, int subfile) {
int numBlocks = playData[8];
_plotter.load(&stream, numWalls, numBlocks);
- _vWindowWidth = playData[3];
- _vWindowBytesWide = _vWindowWidth << 4;
- _bufferBytesWide = _vWindowBytesWide + 16;
- _vWindowHeight = playData[4];
- _vWindowLinesTall = _vWindowHeight << 4;
+ screen._vWindowWidth = playData[3];
+ screen._vWindowBytesWide = screen._vWindowWidth << 4;
+ screen._bufferBytesWide = screen._vWindowBytesWide + 16;
+ screen._vWindowHeight = playData[4];
+ screen._vWindowLinesTall = screen._vWindowHeight << 4;
_vm->_screen->setBufferScan();
delete[] playData;
diff --git a/engines/access/room.h b/engines/access/room.h
index 0c19308469..ce3c4dc36e 100644
--- a/engines/access/room.h
+++ b/engines/access/room.h
@@ -97,11 +97,6 @@ public:
int _playFieldHeight;
byte *_tile;
int _tileSize;
- int _vWindowWidth;
- int _vWindowHeight;
- int _vWindowBytesWide;
- int _bufferBytesWide;
- int _vWindowLinesTall;
public:
Room(AccessEngine *vm);
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index d450cc1067..6f9b53994d 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -52,7 +52,10 @@ Screen::Screen(AccessEngine *vm) : _vm(vm) {
_windowXAdd = _windowYAdd = 0;
_screenYOff = 0;
- setDisplayScan();
+ _bufferBytesWide = _vWindowBytesWide = this->w;
+ _vWindowLinesTall = this->h;
+ _clipWidth = _vWindowBytesWide - 1;
+ _clipHeight = _vWindowLinesTall - 1;
}
void Screen::setDisplayScan() {
@@ -164,18 +167,10 @@ void Screen::checkScroll() {
warning("TODO");
}
-void Screen::copyBF1BF2() {
- warning("TODO");
-}
-
-void Screen::copyBF2Vid() {
- warning("TODO");
-}
-
void Screen::setBufferScan() {
- _clipWidth = _vm->_room->_vWindowBytesWide - 1;
+ _clipWidth = _vWindowBytesWide - 1;
_windowXAdd = (320 - _clipWidth) >> 1;
- _clipHeight = _vm->_room->_vWindowLinesTall - 1;
+ _clipHeight = _vWindowLinesTall - 1;
_windowYAdd = (176 - _clipHeight) >> 1;
}
diff --git a/engines/access/screen.h b/engines/access/screen.h
index 875b665c18..6ede482e61 100644
--- a/engines/access/screen.h
+++ b/engines/access/screen.h
@@ -73,6 +73,11 @@ public:
byte _manPal[0x60];
byte _scaleTable1[256];
byte _scaleTable2[256];
+ int _vWindowWidth;
+ int _vWindowHeight;
+ int _vWindowBytesWide;
+ int _bufferBytesWide;
+ int _vWindowLinesTall;
public:
Screen(AccessEngine *vm);
@@ -119,10 +124,6 @@ public:
void checkScroll();
- void copyBF1BF2();
-
- void copyBF2Vid();
-
void setBufferScan();
void setScaleTable(int scale);