aboutsummaryrefslogtreecommitdiff
path: root/engines/access
diff options
context:
space:
mode:
authorPaul Gilbert2014-08-07 09:23:31 -0400
committerPaul Gilbert2014-08-07 09:23:31 -0400
commitbea93f3441154197a8f599912a1102ac11688d7f (patch)
tree07e3c043c14a9e7f3317e3f237d3661c5632122c /engines/access
parent031cc32c847bf7387859e273069f8efd3b6d4ed0 (diff)
downloadscummvm-rg350-bea93f3441154197a8f599912a1102ac11688d7f.tar.gz
scummvm-rg350-bea93f3441154197a8f599912a1102ac11688d7f.tar.bz2
scummvm-rg350-bea93f3441154197a8f599912a1102ac11688d7f.zip
ACCESS: Implemented setupRoom method
Diffstat (limited to 'engines/access')
-rw-r--r--engines/access/access.cpp7
-rw-r--r--engines/access/access.h7
-rw-r--r--engines/access/amazon/amazon_game.cpp6
-rw-r--r--engines/access/amazon/amazon_room.cpp16
-rw-r--r--engines/access/asurface.cpp9
-rw-r--r--engines/access/asurface.h6
-rw-r--r--engines/access/player.cpp2
-rw-r--r--engines/access/player.h5
-rw-r--r--engines/access/room.cpp43
-rw-r--r--engines/access/room.h2
-rw-r--r--engines/access/screen.cpp3
-rw-r--r--engines/access/screen.h3
12 files changed, 85 insertions, 24 deletions
diff --git a/engines/access/access.cpp b/engines/access/access.cpp
index 98f5529863..c263ae88fa 100644
--- a/engines/access/access.cpp
+++ b/engines/access/access.cpp
@@ -71,18 +71,13 @@ AccessEngine::AccessEngine(OSystem *syst, const AccessGameDescription *gameDesc)
_currentCharFlag = false;
_boxSelect = false;
_charFlag = 0;
+ _scale = 0;
_scaleH1 = _scaleH2 = 0;
_scaleN1 = 0;
_scaleT1 = 0;
_scaleMaxY = 0;
_scaleI = 0;
- _playFieldHeight = 0;
- _roomNumber = 0;
- _rawPlayerXLow = 0;
- _rawPlayerX = 0;
- _rawPlayerYLow = 0;
- _rawPlayerY = 0;
_conversation = 0;
_currentMan = 0;
_newTime = 0;
diff --git a/engines/access/access.h b/engines/access/access.h
index 1451e21296..87de9ee4e6 100644
--- a/engines/access/access.h
+++ b/engines/access/access.h
@@ -136,6 +136,7 @@ public:
byte *_manPal1;
byte *_music;
byte *_playField;
+ Common::Point _playFieldSize;
byte *_tile;
byte *_anim;
byte *_title;
@@ -149,6 +150,7 @@ public:
bool _currentCharFlag;
bool _boxSelect;
int _charFlag;
+ int _scale;
int _scaleH1, _scaleH2;
int _scaleN1;
int _scaleT1;
@@ -157,11 +159,6 @@ public:
int _playFieldHeight;
// Fields that are included in savegames
- int _roomNumber;
- int _rawPlayerXLow;
- int _rawPlayerX;
- int _rawPlayerYLow;
- int _rawPlayerY;
int _conversation;
int _currentMan;
uint32 _newTime;
diff --git a/engines/access/amazon/amazon_game.cpp b/engines/access/amazon/amazon_game.cpp
index eccfc4dae7..7a16036ff3 100644
--- a/engines/access/amazon/amazon_game.cpp
+++ b/engines/access/amazon/amazon_game.cpp
@@ -164,9 +164,9 @@ void AmazonEngine::setupGame() {
}
// Set miscellaneous fields
- _roomNumber = 4;
- _player->_playerX = _rawPlayerX = TRAVEL_POS[_roomNumber][0];
- _player->_playerY = _rawPlayerY = TRAVEL_POS[_roomNumber][1];
+ _player->_roomNumber = 4;
+ _player->_playerX = _player->_rawPlayer.x = TRAVEL_POS[_player->_roomNumber][0];
+ _player->_playerY = _player->_rawPlayer.y = TRAVEL_POS[_player->_roomNumber][1];
_selectCommand = -1;
}
diff --git a/engines/access/amazon/amazon_room.cpp b/engines/access/amazon/amazon_room.cpp
index 21d9c6097e..c2a0332e17 100644
--- a/engines/access/amazon/amazon_room.cpp
+++ b/engines/access/amazon/amazon_room.cpp
@@ -38,7 +38,7 @@ void AmazonRoom::loadRoom(int roomNumber) {
}
void AmazonRoom::reloadRoom() {
- loadRoom(_vm->_roomNumber);
+ loadRoom(_vm->_player->_roomNumber);
if (_roomFlag != 1) {
_vm->_currentMan = _roomFlag;
@@ -68,8 +68,8 @@ void AmazonRoom::reloadRoom() {
}
void AmazonRoom::reloadRoom1() {
- if (_vm->_roomNumber == 22 || _vm->_roomNumber == 31
- || _vm->_roomNumber == 42 || _vm->_roomNumber == 44) {
+ if (_vm->_player->_roomNumber == 22 || _vm->_player->_roomNumber == 31
+ || _vm->_player->_roomNumber == 42 || _vm->_player->_roomNumber == 44) {
_vm->_inactive = _vm->_files->loadFile("MAYA.LZ");
_vm->_currentCharFlag = false;
}
@@ -84,13 +84,13 @@ void AmazonRoom::reloadRoom1() {
_vm->_screen->clearScreen();
roomSet();
- if (!_roomFlag && (_vm->_roomNumber != 61 || !_antOutFlag)) {
+ if (!_roomFlag && (_vm->_player->_roomNumber != 61 || !_antOutFlag)) {
_vm->_player->load();
_vm->_player->calcManScale();
}
- if (_vm->_roomNumber != 20 && _vm->_roomNumber != 24
- && _vm->_roomNumber != 33 && _vm->_roomNumber != 45) {
+ if (_vm->_player->_roomNumber != 20 && _vm->_player->_roomNumber != 24
+ && _vm->_player->_roomNumber != 33 && _vm->_player->_roomNumber != 45) {
roomMenu();
}
@@ -99,8 +99,8 @@ void AmazonRoom::reloadRoom1() {
setWallCodes();
buildScreen();
- if (_vm->_roomNumber != 20 && _vm->_roomNumber != 24
- && _vm->_roomNumber != 33) {
+ if (_vm->_player->_roomNumber != 20 && _vm->_player->_roomNumber != 24
+ && _vm->_player->_roomNumber != 33) {
_vm->_screen->setPalette();
_vm->_screen->copyBF2Vid();
}
diff --git a/engines/access/asurface.cpp b/engines/access/asurface.cpp
index a0a790dbdc..b791186e03 100644
--- a/engines/access/asurface.cpp
+++ b/engines/access/asurface.cpp
@@ -30,4 +30,13 @@ 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 830a493977..857067684f 100644
--- a/engines/access/asurface.h
+++ b/engines/access/asurface.h
@@ -23,16 +23,22 @@
#ifndef ACCESS_ASURFACE_H
#define ACCESS_ASURFACE_H
+#include "common/scummsys.h"
#include "common/rect.h"
#include "graphics/surface.h"
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 a85df0320b..e4ef0eb48e 100644
--- a/engines/access/player.cpp
+++ b/engines/access/player.cpp
@@ -44,6 +44,8 @@ Player::Player(AccessEngine *vm): _vm(vm) {
_frame = 0;
_playerOff = false;
+
+ _roomNumber = 0;
}
void Player::load() {
diff --git a/engines/access/player.h b/engines/access/player.h
index 4d19601230..ec6b53fc2a 100644
--- a/engines/access/player.h
+++ b/engines/access/player.h
@@ -60,6 +60,11 @@ public:
// Additional globals we've added to new Player class
bool _playerOff;
+
+ // Additional globals that need to be saved
+ int _roomNumber;
+ Common::Point _rawPlayerLow;
+ Common::Point _rawPlayer;
public:
Player(AccessEngine *vm);
diff --git a/engines/access/room.cpp b/engines/access/room.cpp
index 1e9eec79b0..9ead04b2ac 100644
--- a/engines/access/room.cpp
+++ b/engines/access/room.cpp
@@ -206,7 +206,9 @@ void Room::loadRoomData(const byte *roomData) {
}
void Room::roomLoop() {
- // TODO
+ _vm->_scripts->_sequence = 2000;
+ _vm->_scripts->searchForSeq();
+ _vm->_scripts->executeCommand();
}
@@ -215,7 +217,44 @@ void Room::doCommands() {
}
void Room::setupRoom() {
- // TODO
+ _vm->_screen->setScaleTable(_vm->_scale);
+ _vm->_screen->setBufferScan();
+
+ if (_roomFlag != 2)
+ setIconPalette();
+
+ if (_vm->_screen->_vWindowSize.x == _vm->_playFieldSize.x) {
+ _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) -
+ (_vm->_screen->_vWindowSize.x / 2), 0);
+ _vm->_screen->_scrollCol = xp;
+
+ xp = xp + _vm->_screen->_vWindowSize.x - _vm->_playFieldSize.x;
+ if (xp >= 0) {
+ _vm->_screen->_scrollCol = xp + 1;
+ }
+ }
+
+ if (_vm->_screen->_vWindowSize.y == _vm->_playFieldSize.y) {
+ _vm->_screen->_scrollY = 0;
+ _vm->_screen->_scrollRow = 0;
+ }
+ else {
+ _vm->_screen->_scrollY = _vm->_player->_rawPlayer.y -
+ (_vm->_player->_rawPlayer.y >> 4);
+ int yp = MAX((_vm->_player->_rawPlayer.y >> 4) -
+ (_vm->_screen->_vWindowSize.y / 2), 0);
+ _vm->_screen->_scrollRow = yp;
+
+ yp = yp + _vm->_screen->_vWindowSize.y - _vm->_playFieldSize.y;
+ if (yp >= 0) {
+ _vm->_screen->_scrollRow = yp + 1;
+ }
+ }
}
void Room::setWallCodes() {
diff --git a/engines/access/room.h b/engines/access/room.h
index 1b803667af..70803b4f70 100644
--- a/engines/access/room.h
+++ b/engines/access/room.h
@@ -45,6 +45,8 @@ protected:
virtual void reloadRoom() = 0;
virtual void reloadRoom1() = 0;
+
+ virtual void setIconPalette() {}
public:
int _function;
int _roomFlag;
diff --git a/engines/access/screen.cpp b/engines/access/screen.cpp
index 3823267bc0..1974b1a981 100644
--- a/engines/access/screen.cpp
+++ b/engines/access/screen.cpp
@@ -45,6 +45,9 @@ Screen::Screen(AccessEngine *vm) : _vm(vm) {
_scrollFlag = false;
_scrollThreshold = 0;
_startColor = _numColors = 0;
+ _scrollX = _scrollY = 0;
+ _scrollCol = _scrollRow = 0;
+
}
void Screen::setDisplayScan() {
diff --git a/engines/access/screen.h b/engines/access/screen.h
index 57d773504f..c32ae18e82 100644
--- a/engines/access/screen.h
+++ b/engines/access/screen.h
@@ -58,6 +58,9 @@ public:
bool _scrollFlag;
int _scrollThreshold;
int _startColor, _numColors;
+ Common::Point _vWindowSize;
+ int _scrollX, _scrollY;
+ int _scrollCol, _scrollRow;
public:
Screen(AccessEngine *vm);