[Scummvm-cvs-logs] CVS: scummvm/sword2 interpreter.cpp,1.32,1.33 resman.cpp,1.77,1.78 router.cpp,1.32,1.33 router.h,1.13,1.14 walker.cpp,1.29,1.30

Torbj?rn Andersson eriktorbjorn at users.sourceforge.net
Wed Dec 17 00:03:03 CET 2003


Update of /cvsroot/scummvm/scummvm/sword2
In directory sc8-pr-cvs1:/tmp/cvs-serv20652

Modified Files:
	interpreter.cpp resman.cpp router.cpp router.h walker.cpp 
Log Message:
cleanup


Index: interpreter.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/interpreter.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- interpreter.cpp	14 Dec 2003 16:33:27 -0000	1.32
+++ interpreter.cpp	17 Dec 2003 08:01:59 -0000	1.33
@@ -189,7 +189,7 @@
 do { \
 	assert(stackPtr < ARRAYSIZE(stack)); \
 	stack[stackPtr++] = (value); \
-} while (false);
+} while (false)
 
 #define pop() (assert(stackPtr < ARRAYSIZE(stack)), stack[--stackPtr])
 

Index: resman.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/resman.cpp,v
retrieving revision 1.77
retrieving revision 1.78
diff -u -d -r1.77 -r1.78
--- resman.cpp	8 Dec 2003 07:30:22 -0000	1.77
+++ resman.cpp	17 Dec 2003 08:01:59 -0000	1.78
@@ -330,7 +330,7 @@
 		SWAP32(walkGridHeader->numBars);
 		SWAP32(walkGridHeader->numNodes);
 
-		_barData *barData = (_barData *) (file + sizeof(_walkGridHeader));
+		BarData *barData = (BarData *) (file + sizeof(_walkGridHeader));
 		for (i = 0; i < walkGridHeader->numBars; i++) {
 			SWAP16(barData->x1);
 			SWAP16(barData->y1);
@@ -346,7 +346,7 @@
 			barData++;
 		}
 
-		uint16 *node = (uint16 *) (file + sizeof(_walkGridHeader) + walkGridHeader->numBars * sizeof(_barData));
+		uint16 *node = (uint16 *) (file + sizeof(_walkGridHeader) + walkGridHeader->numBars * sizeof(barData));
 		for (i = 0; i < walkGridHeader->numNodes * 2; i++) {
 			SWAP16(*node);
 			node++;

Index: router.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/router.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- router.cpp	25 Nov 2003 15:18:47 -0000	1.32
+++ router.cpp	17 Dec 2003 08:01:59 -0000	1.33
@@ -106,12 +106,12 @@
 	if (_routeSlots[slotNo])
 		freeRouteMem();
 
-	_routeSlots[slotNo] = _vm->_memory->allocMemory(sizeof(_walkData) * O_WALKANIM_SIZE, MEM_locked, UID_walk_anim);
+	_routeSlots[slotNo] = _vm->_memory->allocMemory(sizeof(WalkData) * O_WALKANIM_SIZE, MEM_locked, UID_walk_anim);
 
 	// 12000 bytes were used for this in Sword1 mega compacts, based on
-	// 20 bytes per '_walkData' frame
+	// 20 bytes per 'WalkData' frame
 	// ie. allowing for 600 frames including end-marker
-	// Now '_walkData' is 8 bytes, so 8*600 = 4800 bytes.
[...1294 lines suppressed...]
 // called from fnAddWalkGrid
 
 void Router::addWalkGrid(int32 gridResource) {
-	int i;
-
 	// First, scan the list to see if this grid is already included
 
-	for (i = 0; i < MAX_WALKGRIDS; i++) {
+	for (int i = 0; i < MAX_WALKGRIDS; i++) {
 		if (_walkGridList[i] == gridResource)
 			return;
 	}
 
 	// Scan the list for a free slot
 
-	for (i = 0; i < MAX_WALKGRIDS; i++) {
+	for (int i = 0; i < MAX_WALKGRIDS; i++) {
 		if (_walkGridList[i] == 0) {
 			_walkGridList[i] = gridResource;
 			return;

Index: router.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/router.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- router.h	25 Nov 2003 15:18:47 -0000	1.13
+++ router.h	17 Dec 2003 08:01:59 -0000	1.14
@@ -36,7 +36,7 @@
 	#pragma START_PACK_STRUCTS
 #endif
 
-struct _walkData {
+struct WalkData {
 	uint16 frame;
 	int16 x;
 	int16 y;
@@ -44,7 +44,7 @@
 	uint8 dir;
 } GCC_PACK;
 
-struct _barData {
+struct BarData {
 	int16 x1;
   	int16 y1;
   	int16 x2;
@@ -59,7 +59,7 @@
 			// line y * dx = x * dy + co
 } GCC_PACK;
 
-struct _nodeData {
+struct NodeData {
 	int16 x;
 	int16 y;
 	int16 level;
@@ -85,19 +85,19 @@
 #define	O_GRID_SIZE		200	// max 200 lines & 200 points
 #define	O_ROUTE_SIZE		50	// max number of modules in a route
 
-typedef	struct {
+struct RouteData {
 	int32 x;
 	int32 y;
 	int32 dirS;
 	int32 dirD;
-} _routeData;
+};
 
-typedef	struct {
+struct PathData {
 	int32 x;
 	int32 y;
 	int32 dir;
 	int32 num;
-} _pathData;
+};
 
 class Router {
 private:
@@ -107,13 +107,13 @@
 	// megas (NULL if slot not in use)
 	mem *_routeSlots[TOTAL_ROUTE_SLOTS];
 
-	_barData _bars[O_GRID_SIZE];
-	_nodeData _node[O_GRID_SIZE];
+	BarData _bars[O_GRID_SIZE];
+	NodeData _node[O_GRID_SIZE];
 
 	int32 _walkGridList[MAX_WALKGRIDS];
 
-	int32 _nbars;
-	int32 _nnodes;
+	int32 _nBars;
+	int32 _nNodes;
 
 	int32 _startX;
 	int32 _startY;
@@ -123,9 +123,10 @@
 	int32 _targetDir;
 	int32 _scaleA;
 	int32 _scaleB;
-	_routeData _route[O_ROUTE_SIZE];
-	_pathData _smoothPath[O_ROUTE_SIZE];
-	_pathData _modularPath[O_ROUTE_SIZE];
+
+	RouteData _route[O_ROUTE_SIZE];
+	PathData _smoothPath[O_ROUTE_SIZE];
+	PathData _modularPath[O_ROUTE_SIZE];
 	int32 _routeLength;
 
 	int32 _framesPerStep;
@@ -179,27 +180,27 @@
 	void loadWalkGrid(void);
 	void setUpWalkGrid(Object_mega *ob_mega, int32 x, int32 y, int32 dir);
 	void loadWalkData(Object_walkdata *ob_walkdata);
-	int32 scan(int32 level);
+	bool scan(int32 level);
 
 	int32 newCheck(int32 status, int32 x1, int32 y1, int32 x2, int32 y2);
-	int32 lineCheck(int32 x1, int32 x2, int32 y1, int32 y2);
-	int32 vertCheck(int32 x, int32 y1, int32 y2);
-	int32 horizCheck(int32 x1, int32 y, int32 x2);
-	int32 check(int32 x1, int32 y1, int32 x2, int32 y2);
+	bool lineCheck(int32 x1, int32 x2, int32 y1, int32 y2);
+	bool vertCheck(int32 x, int32 y1, int32 y2);
+	bool horizCheck(int32 x1, int32 y, int32 x2);
+	bool check(int32 x1, int32 y1, int32 x2, int32 y2);
 	int32 checkTarget(int32 x, int32 y);
 
 	int32 smoothestPath(void);
-	int32 slidyPath(void);
+	void slidyPath(void);
 
 	int32 smoothCheck(int32 best, int32 p, int32 dirS, int32 dirD);
 
-	int32 addSlowInFrames(_walkData *walkAnim);
-	void addSlowOutFrames(_walkData *walkAnim);
-	void slidyWalkAnimator(_walkData *walkAnim);
+	bool addSlowInFrames(WalkData *walkAnim);
+	void addSlowOutFrames(WalkData *walkAnim);
+	void slidyWalkAnimator(WalkData *walkAnim);
 
 #ifndef FORCE_SLIDY
 	int32 solidPath(void);
-	int32 solidWalkAnimator(_walkData *walkAnim);
+	int32 solidWalkAnimator(WalkData *walkAnim);
 #endif
 
 	void plotCross(int16 x, int16 y, uint8 colour);
@@ -227,7 +228,7 @@
 	void earlySlowOut(Object_mega *ob_mega, Object_walkdata *ob_walkdata);
 
 	void allocateRouteMem(void);
-	_walkData* lockRouteMem(void);
+	WalkData *lockRouteMem(void);
 	void floatRouteMem(void);
 	void freeRouteMem(void);
 	void freeAllRouteMem(void);

Index: walker.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/walker.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- walker.cpp	16 Nov 2003 14:18:29 -0000	1.29
+++ walker.cpp	17 Dec 2003 08:01:59 -0000	1.30
@@ -51,7 +51,7 @@
 	uint8 target_dir;
 	int8 route;
 	int32 walk_pc;
-	_walkData *walkAnim;
+	WalkData *walkAnim;
 
 	// get the parameters
 





More information about the Scummvm-git-logs mailing list