Index: src/game/game.h =================================================================== --- src/game/game.h (Revision 10142) +++ src/game/game.h (Arbeitskopie) @@ -159,10 +159,10 @@ 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); - int (IMPORT *GridFall) (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 10143) +++ src/qcommon/cmodel.c (Arbeitskopie) @@ -2601,7 +2601,7 @@ * @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, int h, int ol, int actor_size) { int nx, ny, sh, l; int dx, dy; @@ -2733,8 +2733,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 x, y, h; int dv, l; + byte z; for (z = 0; z < HEIGHT; z++) for (y = yl; y <= yh; y++) @@ -2840,7 +2841,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 +2865,11 @@ * @param[in] l * @sa Grid_MoveNext */ -static int Grid_MoveCheck (struct routing_s *map, pos3_t pos, int sz, int l) +static int Grid_MoveCheck (struct routing_s *map, pos3_t pos, byte sz, int l) { int x, y, sh; int dv, dx, dy; - int z; + byte z; pos3_t dummy; for (dv = 0; dv < DIRECTIONS; dv++) { @@ -2933,9 +2934,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 l, x, y, dv; + byte z; l = R_AREA(map, from[0], from[1], from[2]); /**< Get TUs for this square */ @@ -2969,7 +2971,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) { @@ -2989,28 +2991,22 @@ * @param[in] pos Position in the map to start the fall (starting height is the z-value in this position) * @return New z (height) value. */ -int Grid_Fall (struct routing_s *map, pos3_t pos) +byte Grid_Fall (struct routing_s *map, pos3_t pos) { - int z = pos[2]; + byte z = pos[2]; /* is z off-map? */ if (z >= HEIGHT) - return -1; + return ROUTING_NOT_REACHABLE; /* Com_Printf("%i:%i:%i\n", pos[0], pos[1], pos[2]);*/ - /** - * This fixes a problem with height positions set to 255 in Grid_Height and Grid_PosToVec (->floating soldiers/aliens). - * I hope it does not break other things - I could not find any yet, but just in case there is this note ;) - * This could be done in the while loop as well, but I do not know the code well enough to decide if that works. - * --Hoehrer 2007-05-15 - */ - if (z == 0) - return 0; + if (z > 0) { + while (z > 0 && R_FALL(map, pos[0], pos[1], z)) + z--; + } else if (!R_FALL(map, pos[0], pos[1], z)) + return ROUTING_NOT_REACHABLE; - while (z >= 0 && R_FALL(map, pos[0], pos[1], z)) - z--; - return z; } Index: src/qcommon/cmodel.h =================================================================== --- src/qcommon/cmodel.h (Revision 10142) +++ src/qcommon/cmodel.h (Arbeitskopie) @@ -63,10 +63,10 @@ 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); -int Grid_Fall(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);