00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #if defined(COMPILE_MAP)
00032 #define RT_COMPLETEBOXTRACE_SIZE(mapTiles,s,e,b,list) TR_SingleTileBoxTrace((mapTiles), (s),(e),(b),TRACING_ALL_VISIBLE_LEVELS, MASK_ALL, 0)
00033 #define RT_COMPLETEBOXTRACE_PASSAGE(mapTiles,s,e,b,list) TR_SingleTileBoxTrace((mapTiles), (s),(e),(b),TRACING_ALL_VISIBLE_LEVELS, MASK_IMPASSABLE, MASK_PASSABLE)
00034
00035 #elif defined(COMPILE_UFO)
00036 #define RT_COMPLETEBOXTRACE_SIZE(mapTiles,s,e,b,list) CM_EntCompleteBoxTrace((mapTiles), (s),(e),(b),TRACING_ALL_VISIBLE_LEVELS, MASK_ALL, 0, (list))
00037 #define RT_COMPLETEBOXTRACE_PASSAGE(mapTiles,s,e,b,list) CM_EntCompleteBoxTrace((mapTiles), (s),(e),(b),TRACING_ALL_VISIBLE_LEVELS, MASK_IMPASSABLE, MASK_PASSABLE, (list))
00038
00039 #else
00040 #error Either COMPILE_MAP or COMPILE_UFO must be defined in order for tracing.c to work.
00041 #endif
00042
00043
00044
00045
00046 #define RT_IS_BIDIRECTIONAL 0
00047
00048
00049
00050
00055
00057 #define RT_CONN(map, actorSize, x, y, z, dir) map[(actorSize) - 1].route[(z)][(y)][(x)][(dir)]
00058 #define RT_CONN_TEST(map, actorSize, x, y, z, dir) assert((actorSize) > ACTOR_SIZE_INVALID); assert((actorSize) <= ACTOR_MAX_SIZE); \
00059 assert((z) >= 0); assert((z) < PATHFINDING_HEIGHT);\
00060 assert((y) >= 0); assert((y) < PATHFINDING_WIDTH);\
00061 assert((x) >= 0); assert((x) < PATHFINDING_WIDTH);\
00062 assert((dir) >= 0); assert((dir) < CORE_DIRECTIONS);
00063
00064 #define RT_CONN_PX(map, actorSize, x, y, z) (RT_CONN(map, actorSize, x, y, z, 0))
00065 #define RT_CONN_NX(map, actorSize, x, y, z) (RT_CONN(map, actorSize, x, y, z, 1))
00066 #define RT_CONN_PY(map, actorSize, x, y, z) (RT_CONN(map, actorSize, x, y, z, 2))
00067 #define RT_CONN_NY(map, actorSize, x, y, z) (RT_CONN(map, actorSize, x, y, z, 3))
00068
00069 #define RT_CONN_PX_PY(map, actorSize, x, y, z) (RT_CONN(map, actorSize, x, y, z, 4))
00070 #define RT_CONN_PX_NY(map, actorSize, x, y, z) (RT_CONN(map, actorSize, x, y, z, 7))
00071 #define RT_CONN_NX_PY(map, actorSize, x, y, z) (RT_CONN(map, actorSize, x, y, z, 6))
00072 #define RT_CONN_NX_NY(map, actorSize, x, y, z) (RT_CONN(map, actorSize, x, y, z, 5))
00073
00074 #define RT_STEPUP(map, actorSize, x, y, z, dir) map[(actorSize) - 1].stepup[(z)][(y)][(x)][(dir)]
00075
00076 #define RT_STEPUP_PX(map, actorSize, x, y, z) (RT_STEPUP(map, actorSize, x, y, z, 0))
00077 #define RT_STEPUP_NX(map, actorSize, x, y, z) (RT_STEPUP(map, actorSize, x, y, z, 1))
00078 #define RT_STEPUP_PY(map, actorSize, x, y, z) (RT_STEPUP(map, actorSize, x, y, z, 2))
00079 #define RT_STEPUP_NY(map, actorSize, x, y, z) (RT_STEPUP(map, actorSize, x, y, z, 3))
00080
00081 #define RT_STEPUP_PX_PY(map, actorSize, x, y, z) (RT_STEPUP(map, actorSize, x, y, z, 4))
00082 #define RT_STEPUP_PX_NY(map, actorSize, x, y, z) (RT_STEPUP(map, actorSize, x, y, z, 7))
00083 #define RT_STEPUP_NX_PY(map, actorSize, x, y, z) (RT_STEPUP(map, actorSize, x, y, z, 6))
00084 #define RT_STEPUP_NX_NY(map, actorSize, x, y, z) (RT_STEPUP(map, actorSize, x, y, z, 5))
00085
00086 #define RT_FLOOR(map, actorSize, x, y, z) map[(actorSize) - 1].floor[(z)][(y)][(x)]
00087 #define RT_CEILING(map, actorSize, x, y, z) map[(actorSize) - 1].ceil[(z)][(y)][(x)]
00088 #define RT_FILLED(map, actorSize, x, y, z) (RT_CEILING(map, actorSize, x, y, z) - RT_FLOOR(map, actorSize, x, y, z) < PATHFINDING_MIN_OPENING)
00089
00090
00091 #define RT_AREA(path, x, y, z, state) ((path)->area[(state)][(z)][(y)][(x)])
00092 #define RT_AREA_FROM(path, x, y, z, state) ((path)->areaFrom[(state)][(z)][(y)][(x)])
00093 #define RT_SAREA(path, x, y, z, state) ((path)->areaStored[(state)][(z)][(y)][(x)])
00094 #define RT_AREA_TEST(path, x, y, z, state) assert((z) >= 0); assert((z) < PATHFINDING_HEIGHT);\
00095 assert((y) >= 0); assert((y) < PATHFINDING_WIDTH);\
00096 assert((x) >= 0); assert((x) < PATHFINDING_WIDTH);\
00097 assert((state) == 0 || (state) == 1);
00098
00099
00101
00102 #define ModelFloorToQuant(x) (ceil((x) / QUANT))
00103
00104 #define ModelCeilingToQuant(x) (floor((x) / QUANT))
00105
00106 #define QuantToModel(x) ((x) * QUANT)
00107
00111 #define SizedPosToVec(p, actorSize, v) { \
00112 assert(actorSize > ACTOR_SIZE_INVALID); \
00113 assert(actorSize <= ACTOR_MAX_SIZE); \
00114 v[0] = ((int)p[0] - 128) * UNIT_SIZE + (UNIT_SIZE * actorSize) / 2; \
00115 v[1] = ((int)p[1] - 128) * UNIT_SIZE + (UNIT_SIZE * actorSize) / 2; \
00116 v[2] = (int)p[2] * UNIT_HEIGHT + UNIT_HEIGHT / 2; \
00117 }
00118
00119
00120
00121
00122
00123
00124
00125
00126 extern qboolean debugTrace;
00127
00128
00129
00130
00131
00132
00133
00134
00135 int RT_CheckCell(mapTiles_t *mapTiles, routing_t * map, const int actorSize, const int x, const int y, const int z, const char **list);
00136 void RT_UpdateConnectionColumn(mapTiles_t *mapTiles, routing_t * map, const int actorSize, const int x, const int y, const int dir, const char **list);
00137 qboolean RT_AllCellsBelowAreFilled(const routing_t * map, const int actorSize, const pos3_t pos);
00138 void RT_GetMapSize(mapTiles_t *mapTiles, vec3_t map_min, vec3_t map_max);
00139
00140
00141
00142
00143
00144
00145
00146
00147 #ifdef DEBUG
00148 void RT_DumpWholeMap(mapTiles_t *mapTiles, const routing_t *map);
00149 #endif
00150 void RT_WriteCSVFiles(const routing_t *map, const char* baseFilename, const ipos3_t mins, const ipos3_t maxs);