[Scummvm-cvs-logs] SF.net SVN: scummvm:[53948] scummvm/trunk/engines/gob

drmccoy at users.sourceforge.net drmccoy at users.sourceforge.net
Sat Oct 30 19:26:06 CEST 2010


Revision: 53948
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53948&view=rev
Author:   drmccoy
Date:     2010-10-30 17:26:06 +0000 (Sat, 30 Oct 2010)

Log Message:
-----------
GOB: Make Map::_passMap protected and group some vars

Modified Paths:
--------------
    scummvm/trunk/engines/gob/map.cpp
    scummvm/trunk/engines/gob/map.h
    scummvm/trunk/engines/gob/map_v1.cpp
    scummvm/trunk/engines/gob/map_v2.cpp

Modified: scummvm/trunk/engines/gob/map.cpp
===================================================================
--- scummvm/trunk/engines/gob/map.cpp	2010-10-30 17:25:29 UTC (rev 53947)
+++ scummvm/trunk/engines/gob/map.cpp	2010-10-30 17:26:06 UTC (rev 53948)
@@ -32,33 +32,39 @@
 namespace Gob {
 
 Map::Map(GobEngine *vm) : _vm(vm) {
+	_passWidth =  0;
+	_mapWidth  = -1;
+	_mapHeight = -1;
+	_passMap   =  0;
+
 	_widthByte = 0;
-	_mapWidth = -1;
-	_mapHeight = -1;
-	_screenWidth = 0;
+
+	_screenWidth  = 0;
 	_screenHeight = 0;
-	_tilesWidth = 0;
-	_tilesHeight = 0;
-	_passWidth = 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 @@
 
 	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 @@
 			// 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;
 

Modified: scummvm/trunk/engines/gob/map.h
===================================================================
--- scummvm/trunk/engines/gob/map.h	2010-10-30 17:25:29 UTC (rev 53947)
+++ scummvm/trunk/engines/gob/map.h	2010-10-30 17:26:06 UTC (rev 53948)
@@ -77,24 +77,28 @@
 
 #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 @@
 	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);
 

Modified: scummvm/trunk/engines/gob/map_v1.cpp
===================================================================
--- scummvm/trunk/engines/gob/map_v1.cpp	2010-10-30 17:25:29 UTC (rev 53947)
+++ scummvm/trunk/engines/gob/map_v1.cpp	2010-10-30 17:26:06 UTC (rev 53948)
@@ -57,7 +57,7 @@
 		memset(_itemsMap[i], 0, _mapWidth * sizeof(int16));
 	}
 
-	_wayPointsCount = 40;
+	_wayPointCount = 40;
 	_wayPoints = new Point[40];
 	memset(_wayPoints, 0, sizeof(Point));
 }

Modified: scummvm/trunk/engines/gob/map_v2.cpp
===================================================================
--- scummvm/trunk/engines/gob/map_v2.cpp	2010-10-30 17:25:29 UTC (rev 53947)
+++ scummvm/trunk/engines/gob/map_v2.cpp	2010-10-30 17:26:06 UTC (rev 53948)
@@ -114,7 +114,7 @@
 		_screenHeight = 200;
 	}
 
-	_wayPointsCount = mapData.readByte();
+	_wayPointCount = mapData.readByte();
 	_tilesWidth = mapData.readSint16LE();
 	_tilesHeight = mapData.readSint16LE();
 
@@ -133,13 +133,13 @@
 	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();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list