Index: src/qcommon/cmodel.c =================================================================== --- src/qcommon/cmodel.c (Revision 10007) +++ src/qcommon/cmodel.c (Arbeitskopie) @@ -207,7 +207,7 @@ static tnode_t *tnode_p; static byte stf; static byte tfList[HEIGHT][WIDTH][WIDTH]; -static byte tf; +static byte tf; /**< test flag */ static void CM_MakeTnodes(void); static void CM_InitBoxHull(void); @@ -2500,10 +2500,29 @@ { byte **p; int i; + byte size; - for (i = 0, p = map->fblist; i < map->fblength; i++, p++) - if (x == (*p)[0] && y == (*p)[1] && z == (*p)[2]) - return qtrue; + for (i = 0, p = map->fblist; i < map->fblength / 2; i++, p += 2) { + size = (*p)[3]; /* the list is pos3_t + byte - so the fourth byte is the size */ + if (x == (*p)[0] && y == (*p)[1] && z == (*p)[2]) { + switch (size) { + case 0: + case ACTOR_SIZE_NORMAL: + return qtrue; + case ACTOR_SIZE_UGV: + if (Grid_CheckForbidden(map, x - 1, y, z)) + return qtrue; + if (Grid_CheckForbidden(map, x - 1, y - 1, z)) + return qtrue; + if (Grid_CheckForbidden(map, x, y - 1, z)) + return qtrue; + break; + default: + Com_Printf("Grid_CheckForbidden: unknown size: %i\n", size); + return qfalse; + } + } + } return qfalse; } @@ -2610,12 +2629,13 @@ * @param[in] fb_length Length of forbidden list * @sa Grid_MoveMarkRoute * @sa G_MoveCalc - * @todo size is unused right now - this needs to change (2x2 units) */ -void Grid_MoveCalc (struct routing_s *map, pos3_t from, int size, int distance, byte ** fb_list, int fb_length) +void Grid_MoveCalc (struct routing_s *map, pos3_t from, int distance, byte ** fb_list, int fb_length) { int xl, xh, yl, yh; int i; + byte **p; + byte size = 0xFF; /* reset move data */ /* ROUTING_NOT_REACHABLE means, not reachable */ @@ -2627,6 +2647,13 @@ xl = xh = from[0]; yl = yh = from[1]; + for (i = 0, p = map->fblist; i < map->fblength; i++, p += 2) { + if (VectorCompare(from, *p)) + size = (*p)[3]; + } + if (size == 0xFF) + Com_Printf("Fuck\n"); + if (distance > MAX_ROUTE) distance = MAX_ROUTE; Index: src/qcommon/cmodel.h =================================================================== --- src/qcommon/cmodel.h (Revision 10006) +++ src/qcommon/cmodel.h (Arbeitskopie) @@ -61,7 +61,7 @@ extern struct routing_s svMap, clMap; 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_MoveCalc(struct routing_s *map, pos3_t from, 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); Index: src/game/g_ai.c =================================================================== --- src/game/g_ai.c (Revision 10006) +++ src/game/g_ai.c (Arbeitskopie) @@ -284,7 +284,7 @@ guete += GUETE_CLOSE_IN - move < 0 ? 0 : GUETE_CLOSE_IN - move; /* search hiding spot */ - G_MoveCalc(0, to, (ent->type == ET_UGV)?2:1, HIDE_DIST); + G_MoveCalc(0, to, HIDE_DIST); ent->pos[2] = to[2]; minX = to[0] - HIDE_DIST > 0 ? to[0] - HIDE_DIST : 0; minY = to[1] - HIDE_DIST > 0 ? to[1] - HIDE_DIST : 0; @@ -409,7 +409,7 @@ float guete, best; /* calculate move table */ - G_MoveCalc(0, ent->pos, (ent->type == ET_UGV)?2:1, MAX_ROUTE); + G_MoveCalc(0, ent->pos, MAX_ROUTE); gi.MoveStore(gi.map); /* set borders */ Index: src/game/g_local.h =================================================================== --- src/game/g_local.h (Revision 10006) +++ src/game/g_local.h (Arbeitskopie) @@ -323,7 +323,7 @@ qboolean G_ClientCanReload(player_t *player, int entnum, shoot_types_t st); void G_ClientGetWeaponFromInventory(player_t *player, int entnum, qboolean quiet); void G_ClientMove(player_t * player, int team, int num, pos3_t to, qboolean stop, qboolean quiet); -void G_MoveCalc(int team, pos3_t from, int size, int distance); +void G_MoveCalc(int team, pos3_t from, int distance); void G_ClientInvMove(player_t * player, int num, int from, int fx, int fy, int to, int tx, int ty, qboolean checkaction, qboolean quiet); qboolean G_FrustumVis(edict_t * from, vec3_t point); Index: src/game/game.h =================================================================== --- src/game/game.h (Revision 10006) +++ src/game/game.h (Arbeitskopie) @@ -157,7 +157,7 @@ int (IMPORT *TestLine) (vec3_t start, vec3_t stop); float (IMPORT *GrenadeTarget) (vec3_t from, vec3_t at, float speed, qboolean launched, qboolean rolled, vec3_t v0); - void (IMPORT *MoveCalc) (struct routing_s * map, pos3_t from, int size, int distance, byte ** fb_list, int fb_length); + void (IMPORT *MoveCalc) (struct routing_s * map, pos3_t from, 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); Index: src/game/g_client.c =================================================================== --- src/game/g_client.c (Revision 10006) +++ src/game/g_client.c (Arbeitskopie) @@ -1174,8 +1174,10 @@ if (!ent->inuse) continue; /* dead ugv will stop walking, too */ - if (((ent->type == ET_ACTOR && !(ent->state & STATE_DEAD)) || ent->type == ET_UGV) && (ent->visflags & vis_mask)) + if (((ent->type == ET_ACTOR && !(ent->state & STATE_DEAD)) || ent->type == ET_UGV) && (ent->visflags & vis_mask)) { fb_list[fb_length++] = ent->pos; + fb_list[fb_length++] = (byte*)&ent->fieldSize; + } } if (fb_length > MAX_EDICTS) @@ -1189,10 +1191,10 @@ * @param[in] distance The distance to calculate the move for. * @sa G_BuildForbiddenList */ -void G_MoveCalc (int team, pos3_t from, int size, int distance) +void G_MoveCalc (int team, pos3_t from, int distance) { G_BuildForbiddenList(team); - gi.MoveCalc(gi.map, from, size, distance, fb_list, fb_length); + gi.MoveCalc(gi.map, from, distance, fb_list, fb_length); } @@ -1242,7 +1244,7 @@ return; /* calculate move table */ - G_MoveCalc(visTeam, ent->pos, (ent->type == ET_UGV)?2:1, MAX_ROUTE); + G_MoveCalc(visTeam, ent->pos, MAX_ROUTE); length = gi.MoveLength(gi.map, to, qfalse); /* length of ROUTING_NOT_REACHABLE means not reachable */ Index: src/client/client.h =================================================================== --- src/client/client.h (Revision 10006) +++ src/client/client.h (Arbeitskopie) @@ -682,7 +682,7 @@ extern int actorMoveLength; extern invList_t invList[MAX_INVLIST]; -extern byte *fb_list[MAX_EDICTS]; +extern byte *fb_list[MAX_EDICTS * 2]; extern int fb_length; void MSG_Write_PA(player_action_t player_action, int num, ...); Index: src/client/cl_actor.c =================================================================== --- src/client/cl_actor.c (Revision 10007) +++ src/client/cl_actor.c (Arbeitskopie) @@ -1905,13 +1905,13 @@ /** * @brief A list of locations that cannot be moved to. - * + * @note Pointer to le->pos or edict->pos followed by le->fieldSize or edict->fieldSize * @see CL_BuildForbiddenList */ -byte *fb_list[MAX_EDICTS]; +byte *fb_list[MAX_EDICTS * 2]; /** * @brief Current length of fb_list. - * + * @note all byte pointers in the fb_list list (pos + fieldSize) * @see fb_list */ int fb_length; @@ -1936,12 +1936,14 @@ if (!le->inuse || le->invis) continue; /* dead ugv will stop walking, too */ - if ((!(le->state & STATE_DEAD) && le->type == ET_ACTOR) || le->type == ET_UGV) + if ((!(le->state & STATE_DEAD) && le->type == ET_ACTOR) || le->type == ET_UGV) { fb_list[fb_length++] = le->pos; + fb_list[fb_length++] = (byte*)&le->fieldSize; + } } #ifdef PARANOID - if (fb_length > MAX_EDICTS) + if (fb_length / 2 > MAX_EDICTS) Com_Error(ERR_DROP, "CL_BuildForbiddenList: list too long"); #endif } @@ -1991,7 +1993,7 @@ { if (selActor && selActor == le) { CL_BuildForbiddenList(); - Grid_MoveCalc(map, le->pos, (le->type == ET_UGV)?2:1, distance, fb_list, fb_length); + Grid_MoveCalc(map, le->pos, distance, fb_list, fb_length); CL_ResetActorMoveLength(); } }