GOB: Rename Map::_widthByte to _mapVersion

svn-id: r53950
This commit is contained in:
Sven Hesse 2010-10-30 17:27:23 +00:00
parent bfa88a05a1
commit 0f536e28f9
4 changed files with 16 additions and 10 deletions

View file

@ -135,7 +135,7 @@ void Goblin_v4::movePathFind(Mult::Mult_Object *obj, Gob_Object *gobDesc, int16
obj->destX = destX; obj->destX = destX;
obj->destY = destY; obj->destY = destY;
if (_vm->_map->_widthByte == 4) { if (_vm->_map->getVersion() == 4) {
switch (dir) { switch (dir) {
case kDirNW: case kDirNW:
animData->nextState = turnState(animData->state, kDirNW); animData->nextState = turnState(animData->state, kDirNW);

View file

@ -32,13 +32,13 @@
namespace Gob { namespace Gob {
Map::Map(GobEngine *vm) : _vm(vm) { Map::Map(GobEngine *vm) : _vm(vm) {
_mapVersion = 0;
_passWidth = 0; _passWidth = 0;
_mapWidth = -1; _mapWidth = -1;
_mapHeight = -1; _mapHeight = -1;
_passMap = 0; _passMap = 0;
_widthByte = 0;
_screenWidth = 0; _screenWidth = 0;
_screenHeight = 0; _screenHeight = 0;
_tilesWidth = 0; _tilesWidth = 0;
@ -82,6 +82,10 @@ Map::~Map() {
delete[] _wayPoints; delete[] _wayPoints;
} }
uint8 Map::getVersion() const {
return _mapVersion;
}
int8 Map::getPass(int x, int y, int width) const { int8 Map::getPass(int x, int y, int width) const {
if (!_passMap) if (!_passMap)
return 0; return 0;

View file

@ -80,8 +80,6 @@ public:
int16 _mapWidth; int16 _mapWidth;
int16 _mapHeight; int16 _mapHeight;
byte _widthByte;
int16 _screenWidth; int16 _screenWidth;
int16 _screenHeight; int16 _screenHeight;
int16 _tilesWidth; int16 _tilesWidth;
@ -107,6 +105,8 @@ public:
Map(GobEngine *vm); Map(GobEngine *vm);
virtual ~Map(); virtual ~Map();
uint8 getVersion() const;
int8 getPass(int x, int y, int width = -1) const; int8 getPass(int x, int y, int width = -1) const;
void setPass(int x, int y, int8 pass, int width = -1); void setPass(int x, int y, int8 pass, int width = -1);
@ -139,6 +139,8 @@ protected:
bool _loadFromAvo; bool _loadFromAvo;
uint8 _mapVersion;
int16 _passWidth; int16 _passWidth;
int8 *_passMap; // [y * _mapWidth + x], getPass(x, y); int8 *_passMap; // [y * _mapWidth + x], getPass(x, y);

View file

@ -100,11 +100,11 @@ void Map_v2::loadMapObjects(const char *avjFile) {
Common::SeekableReadStream &mapData = *resource->stream(); Common::SeekableReadStream &mapData = *resource->stream();
_widthByte = mapData.readByte(); _mapVersion = mapData.readByte();
if (_widthByte == 4) { if (_mapVersion == 4) {
_screenWidth = 640; _screenWidth = 640;
_screenHeight = 400; _screenHeight = 400;
} else if (_widthByte == 3) { } else if (_mapVersion == 3) {
_passWidth = 65; _passWidth = 65;
_screenWidth = 640; _screenWidth = 640;
_screenHeight = 200; _screenHeight = 200;
@ -121,7 +121,7 @@ void Map_v2::loadMapObjects(const char *avjFile) {
_bigTiles = !(_tilesHeight & 0xFF00); _bigTiles = !(_tilesHeight & 0xFF00);
_tilesHeight &= 0xFF; _tilesHeight &= 0xFF;
if (_widthByte == 4) { if (_mapVersion == 4) {
_screenWidth = mapData.readSint16LE(); _screenWidth = mapData.readSint16LE();
_screenHeight = mapData.readSint16LE(); _screenHeight = mapData.readSint16LE();
} }
@ -145,7 +145,7 @@ void Map_v2::loadMapObjects(const char *avjFile) {
_wayPoints[i].notWalkable = mapData.readSByte(); _wayPoints[i].notWalkable = mapData.readSByte();
} }
if (_widthByte == 4) { if (_mapVersion == 4) {
_mapWidth = VAR(17); _mapWidth = VAR(17);
_passWidth = _mapWidth; _passWidth = _mapWidth;
} }