mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 16:03:24 +00:00
GOB: Make Map::_passMap protected and group some vars
svn-id: r53948
This commit is contained in:
parent
1612a96285
commit
4c23f3e163
@ -32,33 +32,39 @@
|
||||
namespace Gob {
|
||||
|
||||
Map::Map(GobEngine *vm) : _vm(vm) {
|
||||
_widthByte = 0;
|
||||
_mapWidth = -1;
|
||||
_passWidth = 0;
|
||||
_mapWidth = -1;
|
||||
_mapHeight = -1;
|
||||
_screenWidth = 0;
|
||||
_screenHeight = 0;
|
||||
_tilesWidth = 0;
|
||||
_tilesHeight = 0;
|
||||
_passWidth = 0;
|
||||
_passMap = 0;
|
||||
|
||||
_widthByte = 0;
|
||||
|
||||
_screenWidth = 0;
|
||||
_screenHeight = 0;
|
||||
_tilesWidth = 0;
|
||||
_tilesHeight = 0;
|
||||
|
||||
_passMap = 0;
|
||||
_itemsMap = 0;
|
||||
_wayPointsCount = 0;
|
||||
_wayPoints = 0;
|
||||
_bigTiles = false;
|
||||
|
||||
_wayPointCount = 0;
|
||||
_wayPoints = 0;
|
||||
|
||||
_nearestWayPoint = 0;
|
||||
_nearestDest = 0;
|
||||
|
||||
_itemsMap = 0;
|
||||
|
||||
for (int i = 0; i < 40; i++) {
|
||||
_itemPoses[i].x = 0;
|
||||
_itemPoses[i].y = 0;
|
||||
_itemPoses[i].x = 0;
|
||||
_itemPoses[i].y = 0;
|
||||
_itemPoses[i].orient = 0;
|
||||
}
|
||||
|
||||
_nearestWayPoint = 0;
|
||||
_nearestDest = 0;
|
||||
_curGoblinX = 0;
|
||||
_curGoblinY = 0;
|
||||
_destX = 0;
|
||||
_destY = 0;
|
||||
|
||||
_sourceFile[0] = 0;
|
||||
|
||||
_loadFromAvo = false;
|
||||
@ -285,7 +291,7 @@ int16 Map::findNearestWayPoint(int16 x, int16 y) {
|
||||
|
||||
length = 30000;
|
||||
|
||||
for (int i = 0; i < _wayPointsCount; i++) {
|
||||
for (int i = 0; i < _wayPointCount; i++) {
|
||||
if ((_wayPoints[i].x < 0) || (_wayPoints[i].x >= _mapWidth) ||
|
||||
(_wayPoints[i].y < 0) || (_wayPoints[i].y >= _mapHeight))
|
||||
break;
|
||||
@ -419,7 +425,7 @@ int16 Map::checkDirectPath(Mult::Mult_Object *obj, int16 x0, int16 y0, int16 x1,
|
||||
// Check for a blocking waypoint
|
||||
|
||||
if (obj->nearestWayPoint < obj->nearestDest)
|
||||
if ((obj->nearestWayPoint + 1) < _wayPointsCount)
|
||||
if ((obj->nearestWayPoint + 1) < _wayPointCount)
|
||||
if (_wayPoints[obj->nearestWayPoint + 1].notWalkable == 1)
|
||||
return 3;
|
||||
|
||||
|
@ -77,24 +77,28 @@ public:
|
||||
|
||||
#include "common/pack-end.h" // END STRUCT PACKING
|
||||
|
||||
byte _widthByte;
|
||||
int16 _mapWidth;
|
||||
int16 _mapHeight;
|
||||
|
||||
byte _widthByte;
|
||||
|
||||
int16 _screenWidth;
|
||||
int16 _screenHeight;
|
||||
int16 _tilesWidth;
|
||||
int16 _tilesHeight;
|
||||
int16 _passWidth;
|
||||
|
||||
bool _bigTiles;
|
||||
|
||||
bool _mapUnknownBool;
|
||||
|
||||
int8 *_passMap; // [y * _mapWidth + x], getPass(x, y);
|
||||
int16 **_itemsMap; // [y][x]
|
||||
int16 _wayPointsCount;
|
||||
int16 _wayPointCount;
|
||||
Point *_wayPoints;
|
||||
|
||||
int16 _nearestWayPoint;
|
||||
int16 _nearestDest;
|
||||
|
||||
int16 **_itemsMap; // [y][x]
|
||||
|
||||
int16 _curGoblinX;
|
||||
int16 _curGoblinY;
|
||||
int16 _destX;
|
||||
@ -132,9 +136,12 @@ public:
|
||||
virtual void optimizePoints(Mult::Mult_Object *obj, int16 x, int16 y) = 0;
|
||||
|
||||
protected:
|
||||
GobEngine *_vm;
|
||||
|
||||
bool _loadFromAvo;
|
||||
|
||||
GobEngine *_vm;
|
||||
int16 _passWidth;
|
||||
int8 *_passMap; // [y * _mapWidth + x], getPass(x, y);
|
||||
|
||||
int16 findNearestWayPoint(int16 x, int16 y);
|
||||
|
||||
|
@ -57,7 +57,7 @@ void Map_v1::init() {
|
||||
memset(_itemsMap[i], 0, _mapWidth * sizeof(int16));
|
||||
}
|
||||
|
||||
_wayPointsCount = 40;
|
||||
_wayPointCount = 40;
|
||||
_wayPoints = new Point[40];
|
||||
memset(_wayPoints, 0, sizeof(Point));
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ void Map_v2::loadMapObjects(const char *avjFile) {
|
||||
_screenHeight = 200;
|
||||
}
|
||||
|
||||
_wayPointsCount = mapData.readByte();
|
||||
_wayPointCount = mapData.readByte();
|
||||
_tilesWidth = mapData.readSint16LE();
|
||||
_tilesHeight = mapData.readSint16LE();
|
||||
|
||||
@ -133,13 +133,13 @@ void Map_v2::loadMapObjects(const char *avjFile) {
|
||||
mapData.skip(_mapWidth * _mapHeight);
|
||||
|
||||
if (resource->getData()[0] == 1)
|
||||
wayPointsCount = _wayPointsCount = 40;
|
||||
wayPointsCount = _wayPointCount = 40;
|
||||
else
|
||||
wayPointsCount = _wayPointsCount == 0 ? 1 : _wayPointsCount;
|
||||
wayPointsCount = _wayPointCount == 0 ? 1 : _wayPointCount;
|
||||
|
||||
delete[] _wayPoints;
|
||||
_wayPoints = new Point[wayPointsCount];
|
||||
for (int i = 0; i < _wayPointsCount; i++) {
|
||||
for (int i = 0; i < _wayPointCount; i++) {
|
||||
_wayPoints[i].x = mapData.readSByte();
|
||||
_wayPoints[i].y = mapData.readSByte();
|
||||
_wayPoints[i].notWalkable = mapData.readSByte();
|
||||
|
Loading…
x
Reference in New Issue
Block a user