aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2009-07-24 21:36:59 +0000
committerSven Hesse2009-07-24 21:36:59 +0000
commitda747553d83a9c75d4678adb965bd15c7ac20b9d (patch)
treeeea24638324c102c807a123a0baada479ed09c74 /engines
parent3668895abce7445077350f88c55175ff1c66b05f (diff)
downloadscummvm-rg350-da747553d83a9c75d4678adb965bd15c7ac20b9d.tar.gz
scummvm-rg350-da747553d83a9c75d4678adb965bd15c7ac20b9d.tar.bz2
scummvm-rg350-da747553d83a9c75d4678adb965bd15c7ac20b9d.zip
Merging Map_v4 into Map_v2
svn-id: r42716
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/gob.cpp6
-rw-r--r--engines/gob/map.h8
-rw-r--r--engines/gob/map_v2.cpp26
-rw-r--r--engines/gob/map_v4.cpp159
-rw-r--r--engines/gob/module.mk1
5 files changed, 25 insertions, 175 deletions
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 6c8aceff33..8e8573515f 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -422,7 +422,7 @@ bool GobEngine::initGameParts() {
_inter = new Inter_v4(this);
_mult = new Mult_v2(this);
_draw = new Draw_v2(this);
- _map = new Map_v4(this);
+ _map = new Map_v2(this);
_goblin = new Goblin_v4(this);
_scenery = new Scenery_v2(this);
_saveLoad = new SaveLoad_v4(this, _targetName.c_str());
@@ -434,7 +434,7 @@ bool GobEngine::initGameParts() {
_inter = new Inter_v5(this);
_mult = new Mult_v2(this);
_draw = new Draw_v2(this);
- _map = new Map_v4(this);
+ _map = new Map_v2(this);
_goblin = new Goblin_v4(this);
_scenery = new Scenery_v2(this);
_saveLoad = new SaveLoad(this);
@@ -447,7 +447,7 @@ bool GobEngine::initGameParts() {
_inter = new Inter_v6(this);
_mult = new Mult_v2(this);
_draw = new Draw_v2(this);
- _map = new Map_v4(this);
+ _map = new Map_v2(this);
_goblin = new Goblin_v4(this);
_scenery = new Scenery_v2(this);
_saveLoad = new SaveLoad_v6(this, _targetName.c_str());
diff --git a/engines/gob/map.h b/engines/gob/map.h
index 4a211f205d..ba976ff7ac 100644
--- a/engines/gob/map.h
+++ b/engines/gob/map.h
@@ -204,14 +204,6 @@ protected:
void loadGoblinStates(Common::SeekableReadStream &data, int index);
};
-class Map_v4 : public Map_v2 {
-public:
- virtual void loadMapObjects(const char *avjFile);
-
- Map_v4(GobEngine *vm);
- virtual ~Map_v4();
-};
-
} // End of namespace Gob
#endif // GOB_MAP_H
diff --git a/engines/gob/map_v2.cpp b/engines/gob/map_v2.cpp
index 6ceda7ab44..a13cd96249 100644
--- a/engines/gob/map_v2.cpp
+++ b/engines/gob/map_v2.cpp
@@ -60,7 +60,10 @@ void Map_v2::loadMapObjects(const char *avjFile) {
id = _vm->_game->_script->readInt16();
- if (id == -1) {
+ if (((uint16) id) >= 65520) {
+ warning("Map_v2::loadMapObjects(): ID >= 65520");
+ return;
+ } else if (id == -1) {
_passMap = (int8 *) _vm->_inter->_variables->getAddressOff8(var);
return;
}
@@ -71,13 +74,18 @@ void Map_v2::loadMapObjects(const char *avjFile) {
Common::SeekableReadStream &mapData = *resource->stream();
- if (mapData.readByte() == 3) {
+ _widthByte = mapData.readByte();
+ if (_widthByte == 4) {
+ _screenWidth = 640;
+ _screenHeight = 400;
+ } else if (_widthByte == 3) {
_screenWidth = 640;
- _passWidth = 65;
+ _screenHeight = 200;
} else {
_screenWidth = 320;
- _passWidth = 40;
+ _screenHeight = 200;
}
+
_wayPointsCount = mapData.readByte();
_tilesWidth = mapData.readSint16LE();
_tilesHeight = mapData.readSint16LE();
@@ -85,6 +93,11 @@ void Map_v2::loadMapObjects(const char *avjFile) {
_bigTiles = !(_tilesHeight & 0xFF00);
_tilesHeight &= 0xFF;
+ if (_widthByte == 4) {
+ _screenWidth = mapData.readSint16LE();
+ _screenHeight = mapData.readSint16LE();
+ }
+
_mapWidth = _screenWidth / _tilesWidth;
_mapHeight = _screenHeight / _tilesHeight;
@@ -104,6 +117,11 @@ void Map_v2::loadMapObjects(const char *avjFile) {
_wayPoints[i].notWalkable = mapData.readSByte();
}
+ if (_widthByte == 4)
+ _mapWidth = VAR(17);
+
+ _passWidth = _mapWidth;
+
// In the original asm, this writes byte-wise into the variables-array
tmpPos = mapData.pos();
mapData.seek(passPos);
diff --git a/engines/gob/map_v4.cpp b/engines/gob/map_v4.cpp
deleted file mode 100644
index 1db3d6a3f8..0000000000
--- a/engines/gob/map_v4.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-#include "common/stream.h"
-
-#include "gob/gob.h"
-#include "gob/map.h"
-#include "gob/global.h"
-#include "gob/goblin.h"
-#include "gob/inter.h"
-#include "gob/game.h"
-#include "gob/script.h"
-#include "gob/resources.h"
-#include "gob/mult.h"
-
-namespace Gob {
-
-Map_v4::Map_v4(GobEngine *vm) : Map_v2(vm) {
-}
-
-Map_v4::~Map_v4() {
-}
-
-void Map_v4::loadMapObjects(const char *avjFile) {
- uint8 wayPointsCount;
- int16 var;
- int16 id;
- int16 mapWidth, mapHeight;
- int16 tmp;
- byte *variables;
- uint32 tmpPos;
- uint32 passPos;
-
- var = _vm->_game->_script->readVarIndex();
- variables = _vm->_inter->_variables->getAddressOff8(var);
-
- id = _vm->_game->_script->readInt16();
-
- if (((uint16) id) >= 65520) {
- warning("Woodruff Stub: loadMapObjects ID >= 65520");
- return;
- } else if (id == -1) {
- _passMap = (int8 *) _vm->_inter->_variables->getAddressOff8(var);
- return;
- }
-
- Resource *resource = _vm->_game->_resources->getResource(id);
- if (!resource)
- return;
-
- Common::SeekableReadStream &mapData = *resource->stream();
-
- _widthByte = mapData.readByte();
- if (_widthByte == 4) {
- _screenWidth = 640;
- _screenHeight = 400;
- } else if (_widthByte == 3) {
- _screenWidth = 640;
- _screenHeight = 200;
- } else {
- _screenWidth = 320;
- _screenHeight = 200;
- }
-
- _wayPointsCount = mapData.readByte();
- _tilesWidth = mapData.readSint16LE();
- _tilesHeight = mapData.readSint16LE();
-
- _bigTiles = !(_tilesHeight & 0xFF00);
- _tilesHeight &= 0xFF;
-
- if (_widthByte == 4) {
- _screenWidth = mapData.readSint16LE();
- _screenHeight = mapData.readSint16LE();
- }
-
- _mapWidth = _screenWidth / _tilesWidth;
- _mapHeight = _screenHeight / _tilesHeight;
-
- passPos = mapData.pos();
- mapData.skip(_mapWidth * _mapHeight);
-
- if (resource->getData()[0] == 1)
- wayPointsCount = _wayPointsCount = 40;
- else
- wayPointsCount = _wayPointsCount == 0 ? 1 : _wayPointsCount;
-
- delete[] _wayPoints;
- _wayPoints = new Point[wayPointsCount];
- for (int i = 0; i < _wayPointsCount; i++) {
- _wayPoints[i].x = mapData.readSByte();
- _wayPoints[i].y = mapData.readSByte();
- _wayPoints[i].notWalkable = mapData.readSByte();
- }
-
- if (_widthByte == 4)
- _mapWidth = VAR(17);
-
- _passWidth = _mapWidth;
-
- // In the original asm, this writes byte-wise into the variables-array
- tmpPos = mapData.pos();
- mapData.seek(passPos);
- if ((variables != 0) &&
- (variables != _vm->_inter->_variables->getAddressOff8(0))) {
-
- _passMap = (int8 *) variables;
- mapHeight = _screenHeight / _tilesHeight;
- mapWidth = _screenWidth / _tilesWidth;
-
- for (int i = 0; i < mapHeight; i++) {
- for (int j = 0; j < mapWidth; j++)
- setPass(j, i, mapData.readSByte());
- _vm->_inter->_variables->getAddressOff8(var + i * _passWidth);
- }
- }
- mapData.seek(tmpPos);
-
- tmp = mapData.readSint16LE();
- mapData.skip(tmp * 14);
- tmp = mapData.readSint16LE();
- mapData.skip(tmp * 14 + 28);
- tmp = mapData.readSint16LE();
- mapData.skip(tmp * 14);
-
- _vm->_goblin->_gobsCount = tmp;
- for (int i = 0; i < _vm->_goblin->_gobsCount; i++)
- loadGoblinStates(mapData, i);
-
- _vm->_goblin->_soundSlotsCount = _vm->_game->_script->readInt16();
- for (int i = 0; i < _vm->_goblin->_soundSlotsCount; i++)
- _vm->_goblin->_soundSlots[i] = _vm->_inter->loadSound(1);
-
- delete resource;
-}
-
-} // End of namespace Gob
diff --git a/engines/gob/module.mk b/engines/gob/module.mk
index 611abb6038..c3c2d2e0d0 100644
--- a/engines/gob/module.mk
+++ b/engines/gob/module.mk
@@ -36,7 +36,6 @@ MODULE_OBJS := \
map.o \
map_v1.o \
map_v2.o \
- map_v4.o \
mult.o \
mult_v1.o \
mult_v2.o \