aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Špalek2009-10-30 02:15:41 +0000
committerRobert Špalek2009-10-30 02:15:41 +0000
commitf3700a23e9ff404d0ed9e670a168c70dfb91f50a (patch)
tree4c9ed9fa7b8d128a2d0e6119bfcd4c4a29d250b6
parentebe5db4be28ad71b0b41c67697cfe8fef68e0405 (diff)
downloadscummvm-rg350-f3700a23e9ff404d0ed9e670a168c70dfb91f50a.tar.gz
scummvm-rg350-f3700a23e9ff404d0ed9e670a168c70dfb91f50a.tar.bz2
scummvm-rg350-f3700a23e9ff404d0ed9e670a168c70dfb91f50a.zip
Move WalkingMap instance to Game, and clean up parameters
svn-id: r45516
-rw-r--r--engines/draci/game.cpp17
-rw-r--r--engines/draci/game.h5
-rw-r--r--engines/draci/script.cpp2
3 files changed, 13 insertions, 11 deletions
diff --git a/engines/draci/game.cpp b/engines/draci/game.cpp
index b6d8e08486..caa83cf6d1 100644
--- a/engines/draci/game.cpp
+++ b/engines/draci/game.cpp
@@ -982,7 +982,7 @@ void Game::walkHero(int x, int y, SightDirection dir) {
return;
Surface *surface = _vm->_screen->getSurface();
- _hero = _currentRoom._walkingMap.findNearestWalkable(x, y, surface->getDimensions());
+ _hero = _walkingMap.findNearestWalkable(x, y, surface->getDimensions());
debugC(3, kDraciLogicDebugLevel, "Walk to x: %d y: %d", _hero.x, _hero.y);
// FIXME: Need to add proper walking (this only warps the dragon to position)
@@ -1076,7 +1076,7 @@ void Game::loadRoom(int roomNum) {
_currentRoom._numGates = roomReader.readByte();
debugC(4, kDraciLogicDebugLevel, "Music: %d", getMusicTrack());
- debugC(4, kDraciLogicDebugLevel, "Map: %d", _currentRoom._mapID);
+ debugC(4, kDraciLogicDebugLevel, "Map: %d", getMapID());
debugC(4, kDraciLogicDebugLevel, "Palette: %d", _currentRoom._palette);
debugC(4, kDraciLogicDebugLevel, "Overlays: %d", _currentRoom._numOverlays);
debugC(4, kDraciLogicDebugLevel, "Init: %d", _currentRoom._init);
@@ -1100,7 +1100,7 @@ void Game::loadRoom(int roomNum) {
}
// Load the walking map
- loadWalkingMap(_currentRoom._mapID);
+ loadWalkingMap(getMapID());
// Load the room's objects
for (uint i = 0; i < _info._numObjects; ++i) {
@@ -1144,7 +1144,7 @@ void Game::loadRoom(int roomNum) {
for (uint i = 0; i < kScreenWidth; ++i) {
for (uint j = 0; j < kScreenHeight; ++j) {
- if (_currentRoom._walkingMap.isWalkable(i, j)) {
+ if (_walkingMap.isWalkable(i, j)) {
wlk[j * kScreenWidth + i] = 2;
}
}
@@ -1257,12 +1257,9 @@ void Game::loadObject(uint objNum) {
}
void Game::loadWalkingMap(int mapID) {
- if (mapID < 0) {
- mapID = _currentRoom._mapID;
- }
const BAFile *f;
f = _vm->_walkingMapsArchive->getFile(mapID);
- _currentRoom._walkingMap.load(f->_data, f->_length);
+ _walkingMap.load(f->_data, f->_length);
}
GameObject *Game::getObject(uint objNum) {
@@ -1564,6 +1561,10 @@ int Game::getMapRoom() const {
return _info._mapRoom;
}
+int Game::getMapID() const {
+ return _currentRoom._mapID;
+}
+
void Game::schedulePalette(int paletteID) {
_scheduledPalette = paletteID;
}
diff --git a/engines/draci/game.h b/engines/draci/game.h
index 04a1f28d3d..c8ec693dbd 100644
--- a/engines/draci/game.h
+++ b/engines/draci/game.h
@@ -150,7 +150,6 @@ struct Dialogue {
struct Room {
int _roomNum;
byte _music;
- WalkingMap _walkingMap;
int _mapID;
int _palette;
int _numOverlays;
@@ -220,7 +219,7 @@ public:
int loadAnimation(uint animNum, uint z);
void loadOverlays();
void loadObject(uint numObj);
- void loadWalkingMap(int mapID); // <0 means the room's default walking map
+ void loadWalkingMap(int mapID); // but leaves _currentRoom._mapID untouched
void loadItem(int itemID);
uint getNumObjects() const;
@@ -259,6 +258,7 @@ public:
int getEscRoom() const;
int getMapRoom() const;
+ int getMapID() const;
int getMarkedAnimationIndex() const;
void setMarkedAnimationIndex(int index);
@@ -339,6 +339,7 @@ private:
bool _inventoryExit;
Room _currentRoom;
+ WalkingMap _walkingMap;
int _newRoom;
int _newGate;
int _previousRoom;
diff --git a/engines/draci/script.cpp b/engines/draci/script.cpp
index 608dac598b..f7ec7578fb 100644
--- a/engines/draci/script.cpp
+++ b/engines/draci/script.cpp
@@ -837,7 +837,7 @@ void Script::exitDialogue(Common::Queue<int> &params) {
void Script::roomMap(Common::Queue<int> &params) {
// Load the default walking map for the room
- _vm->_game->loadWalkingMap(-1);
+ _vm->_game->loadWalkingMap(_vm->_game->getMapID());
}
void Script::disableQuickHero(Common::Queue<int> &params) {