All pastes #632891 Raw Edit

Anonymous

public c v1 · immutable
#632891 ·published 2007-07-25 08:39 UTC
rendered paste body
Index: src/game/game.h===================================================================--- src/game/game.h	(Revision 10146)+++ src/game/game.h	(Arbeitskopie)@@ -159,9 +159,9 @@ 	void (IMPORT *MoveCalc) (struct routing_s * map, pos3_t from, int size, int distance, byte ** fb_list, int fb_length); 	void (IMPORT *MoveStore) (struct routing_s * map);-	int (IMPORT *MoveLength) (struct routing_s * map, pos3_t to, qboolean stored);-	int (IMPORT *MoveNext) (struct routing_s * map, pos3_t from);-	int (IMPORT *GridHeight) (struct routing_s * map, pos3_t pos);+	byte (IMPORT *MoveLength) (struct routing_s * map, pos3_t to, qboolean stored);+	byte (IMPORT *MoveNext) (struct routing_s * map, pos3_t from);+	byte (IMPORT *GridHeight) (struct routing_s * map, pos3_t pos); 	byte (IMPORT *GridFall) (struct routing_s * map, pos3_t pos); 	void (IMPORT *GridPosToVec) (struct routing_s * map, pos3_t pos, vec3_t vec); 	void (IMPORT *GridRecalcRouting) (struct routing_s * map, const char *name, const char **list);Index: src/qcommon/cmodel.c===================================================================--- src/qcommon/cmodel.c	(Revision 10146)+++ src/qcommon/cmodel.c	(Arbeitskopie)@@ -273,7 +273,7 @@ 	in = (void *) (cmod_base + l->fileofs); 	if (l->filelen % sizeof(dmodel_t))-		Com_Error(ERR_DROP, "CMod_LoadSubmodels: funny lump size (%i => "UFO_SIZE_T"", l->filelen, sizeof(dmodel_t));+		Com_Error(ERR_DROP, "CMod_LoadSubmodels: funny lump size (%i => "UFO_SIZE_T, l->filelen, sizeof(dmodel_t)); 	count = l->filelen / sizeof(dmodel_t); 	Com_Printf("%c...submodels: %i\n", 1, count);@@ -785,16 +785,17 @@  * @param[in] dir  * @param[in] fill  */-static qboolean CM_TestConnection (routing_t * map, int x, int y, int z, unsigned int dir, qboolean fill)+static qboolean CM_TestConnection (routing_t * map, int x, int y, byte z, unsigned int dir, qboolean fill) { 	vec3_t start, end; 	pos3_t pos;-	int h, sh, ax, ay, az;+	int sh, ax, ay, az;+	byte h; 	assert(map); 	assert((x >= 0) && (x < WIDTH)); 	assert((y >= 0) && (y < WIDTH));-	assert((z >= 0) && (z < HEIGHT));+	assert((z < HEIGHT)); 	/* totally blocked unit */ 	if ((fill && (filled[y][x] & (1 << z))) || (map->fall[y][x] == ROUTING_NOT_REACHABLE))@@ -848,7 +849,7 @@  * @param[in] z  * @sa Grid_RecalcRouting  */-static void CM_CheckUnit (routing_t * map, int x, int y, int z)+static void CM_CheckUnit (routing_t * map, int x, int y, byte z) { 	vec3_t start, end; 	vec3_t tend, tvs, tve;@@ -859,7 +860,7 @@ 	assert(map); 	assert((x >= 0) && (x < WIDTH)); 	assert((y >= 0) && (y < WIDTH));-	assert((z >= 0) && (z < HEIGHT));+	assert((z < HEIGHT)); 	/* reset flags */ 	filled[y][x] &= ~(1 << z);@@ -2530,7 +2531,7 @@  * @sa Grid_MoveMark  * @return qtrue if one can't walk there (i.e. the field [and attached fields for e.g. 2x2 units] is/are blocked by entries in the forbidden list) otherwise false.  */-static qboolean Grid_CheckForbidden (struct routing_s * map, int x, int y, int z, int actor_size)+static qboolean Grid_CheckForbidden (struct routing_s * map, int x, int y, byte z, int actor_size) { 	byte **p; 	int i, j;@@ -2601,11 +2602,12 @@  * @todo Add diagonal-move checks for actor size (2x2).  * @todo Add height/fall checks for actor size (2x2).  */-static void Grid_MoveMark (struct routing_s *map, int x, int y, int z, int dv, int h, int ol, int actor_size)+static void Grid_MoveMark (struct routing_s *map, int x, int y, byte z, int dv, byte h, byte ol, int actor_size) {-	int nx, ny, sh, l;+	int nx, ny, sh; 	int dx, dy; 	pos3_t dummy;+	byte l; 	int poslist_n[4][3];  /* 3*int needed for range-check because pos3_t does not support negative values and has a smaller range. */ 	pos3_t poslist[4];@@ -2733,8 +2735,9 @@  */ static void Grid_MoveMarkRoute (struct routing_s *map, int xl, int yl, int xh, int yh, int actor_size) {-	int x, y, z, h;-	int dv, l;+	int x, y;+	int dv;+	byte l, z, h; 	for (z = 0; z < HEIGHT; z++) 		for (y = yl; y <= yh; y++)@@ -2751,8 +2754,8 @@ 					/* test the next connections */ 					for (dv = 0; dv < DIRECTIONS; dv++) { 						if ((actor_size != 0)-						&&  (actor_size != ACTOR_SIZE_NORMAL)-						&&  (dv > 3))+						 && (actor_size != ACTOR_SIZE_NORMAL)+						 && (dv > 3)) 							/* Ignore diagonal move for 2x2 and other units */ 							break; 						Grid_MoveMark(map, x, y, z, dv, h, l, actor_size);@@ -2840,7 +2843,7 @@  * @return ROUTING_NOT_REACHABLE if the move isn't possible  * @return length of move otherwise (TUs)  */-int Grid_MoveLength (struct routing_s *map, pos3_t to, qboolean stored)+byte Grid_MoveLength (struct routing_s *map, pos3_t to, qboolean stored) { #ifdef PARANOID 	if (to[2] >= HEIGHT) {@@ -2864,11 +2867,11 @@  * @param[in] l  * @sa Grid_MoveNext  */-static int Grid_MoveCheck (struct routing_s *map, pos3_t pos, int sz, int l)+static byte Grid_MoveCheck (struct routing_s *map, pos3_t pos, byte sz, byte l) { 	int x, y, sh; 	int dv, dx, dy;-	int z;+	byte z; 	pos3_t dummy; 	for (dv = 0; dv < DIRECTIONS; dv++) {@@ -2910,7 +2913,7 @@ 		/* height checks */ 		sh = R_STEP(map, x, y, z) ? sh_big : sh_low;-		z += (R_HEIGHT(map,x,y,z) + sh) / 0x10;+		z += (R_HEIGHT(map, x, y, z) + sh) / 0x10; 		VectorSet(dummy, pos[0], pos[1], z); 		z = Grid_Fall(map, dummy);@@ -2933,9 +2936,10 @@  * @param[in] from  * @sa Grid_MoveCheck  */-int Grid_MoveNext (struct routing_s *map, pos3_t from)+byte Grid_MoveNext (struct routing_s *map, pos3_t from) {-	int l, x, y, z, dv;+	int x, y, dv;+	byte l, z; 	l = R_AREA(map, from[0], from[1], from[2]); /**< Get TUs for this square */@@ -2969,7 +2973,7 @@  * @param  * @sa  */-int Grid_Height (struct routing_s *map, pos3_t pos)+byte Grid_Height (struct routing_s *map, pos3_t pos) { 	/* max 8 levels */ 	if (pos[2] >= HEIGHT) {@@ -3002,13 +3006,6 @@ /*	Com_Printf("%i:%i:%i\n", pos[0], pos[1], pos[2]); DEBUG */-	/**-	 * This fixes a problem with height positions-	 * set to 255 in Grid_Height and Grid_PosToVec (->floating soldiers/aliens)-	 */-	if (z == 0)-		return 0;- 	while (z > 0 && R_FALL(map, pos[0], pos[1], z)) 		z--;@@ -3041,7 +3038,8 @@ { 	cBspModel_t *model; 	pos3_t min, max;-	int x, y, z;+	int x, y;+	byte z; 	unsigned int i; 	/* get inline model, if it is one */Index: src/qcommon/cmodel.h===================================================================--- src/qcommon/cmodel.h	(Revision 10146)+++ src/qcommon/cmodel.h	(Arbeitskopie)@@ -63,9 +63,9 @@ void Grid_RecalcRouting(struct routing_s *map, const char *name, const char **list); void Grid_MoveCalc(struct routing_s *map, pos3_t from, int size, int distance, byte ** fb_list, int fb_length); void Grid_MoveStore(struct routing_s *map);-int Grid_MoveLength(struct routing_s *map, pos3_t to, qboolean stored);-int Grid_MoveNext(struct routing_s *map, pos3_t from);-int Grid_Height(struct routing_s *map, pos3_t pos);+byte Grid_MoveLength(struct routing_s *map, pos3_t to, qboolean stored);+byte Grid_MoveNext(struct routing_s *map, pos3_t from);+byte Grid_Height(struct routing_s *map, pos3_t pos); byte Grid_Fall(struct routing_s *map, pos3_t pos); void Grid_PosToVec(struct routing_s *map, pos3_t pos, vec3_t vec);