grid.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void Grid_RecalcBoxRouting (mapTiles_t *mapTiles, routing_t *map, const pos3_t min, const pos3_t max, const char **list)
 This function recalculates the routing in the box bounded by min and max.
void Grid_RecalcRouting (mapTiles_t *mapTiles, routing_t *map, const char *name, const char **list)
 This function recalculates the routing surrounding the entity name.
void Grid_MoveCalc (const routing_t *map, const actorSizeEnum_t actorSize, pathing_t *path, const pos3_t from, byte crouchingSstate, int distance, byte **fb_list, int fb_length)
 Recalculate the pathing table for the given actor(-position).
void Grid_MoveStore (pathing_t *path)
 Caches the calculated move.
pos_t Grid_MoveLength (const pathing_t *path, const pos3_t to, byte crouchingState, qboolean stored)
 Return the needed TUs to walk to a given position.
int Grid_MoveNext (const pathing_t *path, const pos3_t toPos, byte crouchingState)
 Get the direction to use to move to a position (used to reconstruct the path).
int Grid_Height (const routing_t *map, const actorSizeEnum_t actorSize, const pos3_t pos)
 Returns the height of the floor in a cell.
unsigned int Grid_Ceiling (const routing_t *map, const actorSizeEnum_t actorSize, const pos3_t pos)
 Returns the height of the floor in a cell.
int Grid_Floor (const routing_t *map, const actorSizeEnum_t actorSize, const pos3_t pos)
 Returns the height of the floor in a cell.
pos_t Grid_StepUp (const routing_t *map, const actorSizeEnum_t actorSize, const pos3_t pos, const int dir)
 Returns the maximum height of an obstruction that an actor can travel over.
int Grid_GetTUsForDirection (int dir)
 Returns the amounts of TUs that are needed to perform one step into the given direction.
int Grid_Filled (const routing_t *map, const actorSizeEnum_t actorSize, const pos3_t pos)
 Returns non-zero if the cell is filled (solid) and cannot be entered.
pos_t Grid_Fall (const routing_t *map, const actorSizeEnum_t actorSize, const pos3_t pos)
 Calculated the new height level when something falls down from a certain position.
void Grid_PosToVec (const routing_t *map, const actorSizeEnum_t actorSize, const pos3_t pos, vec3_t vec)
 Converts a grid position to world coordinates.

Function Documentation

unsigned int Grid_Ceiling ( const routing_t map,
const actorSizeEnum_t  actorSize,
const pos3_t  pos 
)

Returns the height of the floor in a cell.

Parameters:
[in] map Pointer to client or server side routing table (clMap, svMap)
[in] actorSize width of the actor in cells
[in] pos Position in the map to check the height
Returns:
The actual model height of the cell's ceiling.

Definition at line 641 of file grid.c.

References Com_Printf(), PATHFINDING_HEIGHT, QuantToModel, and RT_CEILING.

Referenced by HUD_MapDebugCursor().

pos_t Grid_Fall ( const routing_t map,
const actorSizeEnum_t  actorSize,
const pos3_t  pos 
)

Calculated the new height level when something falls down from a certain position.

Parameters:
[in] map Pointer to client or server side routing table (clMap, svMap)
[in] pos Position in the map to start the fall (starting height is the z-value in this position)
[in] actorSize Give the field size of the actor (e.g. for 2x2 units) to check linked fields as well.
Returns:
New z (height) value.
0xFF if an error occurred.

Todo:
if an actor can fly, then set this to true.

Definition at line 742 of file grid.c.

References CELL_HEIGHT, Com_DPrintf(), DEBUG_PATHING, PATHFINDING_HEIGHT, qfalse, and RT_FLOOR.

Referenced by CL_ActorMouseTrace(), and SV_InitGameProgs().

int Grid_Filled ( const routing_t map,
const actorSizeEnum_t  actorSize,
const pos3_t  pos 
)

Returns non-zero if the cell is filled (solid) and cannot be entered.

Parameters:
[in] map Pointer to client or server side routing table (clMap, svMap)
[in] actorSize width of the actor in cells
[in] pos Position in the map to check for filling
Returns:
0 if the cell is vacant (of the world model), non-zero otherwise.

Definition at line 726 of file grid.c.

References PATHFINDING_HEIGHT, and RT_FILLED.

int Grid_Floor ( const routing_t map,
const actorSizeEnum_t  actorSize,
const pos3_t  pos 
)

Returns the height of the floor in a cell.

Parameters:
[in] map Pointer to client or server side routing table (clMap, svMap)
[in] actorSize width of the actor in cells
[in] pos Position in the map to check the height
Returns:
The actual model height of the cell's floor.

Definition at line 678 of file grid.c.

References Com_Printf(), PATHFINDING_HEIGHT, QuantToModel, and RT_FLOOR.

Referenced by CL_AddPathingBox(), Grid_PosToVec(), HUD_MapDebugCursor(), and SV_InitGameProgs().

int Grid_GetTUsForDirection ( int  dir  ) 

Returns the amounts of TUs that are needed to perform one step into the given direction.

Parameters:
[in] dir the direction in which we are moving
Returns:
The TUs needed to move there.

Definition at line 712 of file grid.c.

References PATHFINDING_DIRECTIONS, and TUsUsed.

Referenced by Grid_MoveMark(), and SV_InitGameProgs().

int Grid_Height ( const routing_t map,
const actorSizeEnum_t  actorSize,
const pos3_t  pos 
)

Returns the height of the floor in a cell.

Parameters:
[in] map Pointer to client or server side routing table (clMap, svMap)
[in] actorSize width of the actor in cells
[in] pos Position in the map to check the height
Returns:
The actual model height of the cell's ceiling.

Definition at line 659 of file grid.c.

References Com_Printf(), PATHFINDING_HEIGHT, QuantToModel, RT_CEILING, and RT_FLOOR.

Referenced by Grid_MoveMark().

void Grid_MoveCalc ( const routing_t map,
const actorSizeEnum_t  actorSize,
pathing_t path,
const pos3_t  from,
byte  crouchingState,
int  distance,
byte **  fb_list,
int  fb_length 
)

Recalculate the pathing table for the given actor(-position).

Parameters:
[in] map Pointer to client or server side routing table (clMap, svMap)
[in] actorSize The size of thing to calc the move for (e.g. size=2 means 2x2). The plan is to have the 'origin' in 2x2 units in the bottom-left (towards the lower coordinates) corner of the 2x2 square.
[in,out] path Pointer to client or server side pathing table (clMap, svMap)
[in] from The position to start the calculation from.
[in] distance The maximum TUs away from 'from' to calculate move-information for
[in] crouchingState Whether the actor is currently crouching, 1 is yes, 0 is no.
[in] fb_list Forbidden list (entities are standing at those points)
[in] fb_length Length of forbidden list
See also:
Grid_MoveMark
G_MoveCalc
CL_ConditionalMoveCalc

< Extended position; includes crouching state

< if reaching that square already took too many TUs, don't bother to reach new squares *from* there.

Definition at line 513 of file grid.c.

References ACTOR_MAX_STATES, pathing_s::area, pathing_s::areaFrom, Com_DPrintf(), count, DEBUG_PATHING, pathing_s::fblength, pathing_s::fblist, Grid_MoveMark(), MAX_ROUTE, PATHFINDING_DIRECTIONS, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, pos, PQueueFree(), PQueueInitialise(), PQueueIsEmpty, PQueuePop(), PQueuePush(), ROUTING_NOT_REACHABLE, RT_AREA, Vector4Set, and VectorCopy.

Referenced by CL_ActorConditionalMoveCalc(), and SV_InitGameProgs().

pos_t Grid_MoveLength ( const pathing_t path,
const pos3_t  to,
byte  crouchingState,
qboolean  stored 
)

Return the needed TUs to walk to a given position.

Parameters:
[in] path Pointer to client or server side pathing table (clPathMap, svPathMap)
[in] to Position to walk to
[in] crouchingState Whether the actor is currently crouching, 1 is yes, 0 is no.
[in] stored Use the stored mask (the cached move) of the routing data
Returns:
ROUTING_NOT_REACHABLE if the move isn't possible
length of move otherwise (TUs)

Definition at line 592 of file grid.c.

References Com_DPrintf(), DEBUG_PATHING, PATHFINDING_HEIGHT, ROUTING_NOT_REACHABLE, RT_AREA, and RT_SAREA.

Referenced by CL_ActorMoveLength(), CL_AddPathingBox(), and SV_InitGameProgs().

int Grid_MoveNext ( const pathing_t path,
const pos3_t  toPos,
byte  crouchingState 
)

Get the direction to use to move to a position (used to reconstruct the path).

Parameters:
[in] path Pointer to client or server side pathing table (le->PathMap, svPathMap)
[in] toPos The desired location
[in] crouchingState Whether the actor is currently crouching, 1 is yes, 0 is no.
Returns:
a direction index (see dvecs and DIRECTIONS)
See also:
Grid_MoveCheck

< Get TUs for this square

Definition at line 619 of file grid.c.

References ROUTING_NOT_REACHABLE, ROUTING_UNREACHABLE, RT_AREA, and RT_AREA_FROM.

Referenced by CL_ActorMaximumMove(), CL_ActorTraceMove(), HUD_MapDebugCursor(), and SV_InitGameProgs().

void Grid_MoveStore ( pathing_t path  ) 

Caches the calculated move.

Parameters:
[in] path Pointer to client or server side pathing table (clPathMap, svPathMap)
See also:
AI_ActorThink

Definition at line 577 of file grid.c.

References pathing_s::area, and pathing_s::areaStored.

Referenced by SV_InitGameProgs().

void Grid_PosToVec ( const routing_t map,
const actorSizeEnum_t  actorSize,
const pos3_t  pos,
vec3_t  vec 
)

Converts a grid position to world coordinates.

See also:
Grid_Height
Parameters:
[in] map The routing map
[in] actorSize width of the actor in cells
[in] pos The grid position
[out] vec The world vector

Definition at line 781 of file grid.c.

References Com_Printf(), Grid_Floor(), PATHFINDING_HEIGHT, SizedPosToVec, and UNIT_HEIGHT.

Referenced by CL_ActorAdd(), CL_ActorAppear(), CL_ActorTraceMove(), CL_AddPathingBox(), CL_AddTargetingBox(), CL_DisplayFloorArrows(), CL_DisplayObstructionArrows(), CL_EntAppear(), CL_TargetingGrenade(), CL_TargetingStraight(), LE_ActorGetStepTime(), LE_PlaceItem(), LET_PathMove(), and SV_InitGameProgs().

void Grid_RecalcBoxRouting ( mapTiles_t mapTiles,
routing_t map,
const pos3_t  min,
const pos3_t  max,
const char **  list 
)

This function recalculates the routing in the box bounded by min and max.

See also:
CMod_LoadRouting
Grid_RecalcRouting
Parameters:
[in] map The routing map (either server or client map)
[in] min The lower extents of the box to recalc routing for
[in] max The upper extents of the box to recalc routing for

Note:
RT_CheckCell goes from top (7) to bottom (0)
The new version of RT_UpdateConnectionColumn can work bidirectional, so we can trace every other dir, unless we are on the edge.

Definition at line 801 of file grid.c.

References ACTOR_MAX_SIZE, Com_DPrintf(), CORE_DIRECTIONS, DEBUG_PATHING, PATHFINDING_WIDTH, RT_CheckCell(), and RT_UpdateConnectionColumn().

Referenced by Grid_RecalcRouting().

void Grid_RecalcRouting ( mapTiles_t mapTiles,
routing_t map,
const char *  name,
const char **  list 
)

This function recalculates the routing surrounding the entity name.

See also:
CM_InlineModel
CM_CheckUnit
CM_UpdateConnection
CMod_LoadSubmodels
Grid_RecalcBoxRouting
Parameters:
[in] map The routing map (either server or client map)
[in] name Name of the inline model to compute the mins/maxs for

Definition at line 861 of file grid.c.

References cBspModel_s::angles, CM_InlineModel(), Com_DPrintf(), Com_Printf(), DEBUG_PATHING, DEBUG_ROUTING, Grid_RecalcBoxRouting(), i, m, cBspModel_s::maxs, cBspModel_s::mins, cBspModel_s::origin, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, VecToPos, VectorAdd, VectorCenterFromMinsMaxs(), VectorCreateRotationMatrix(), VectorNotEmpty, VectorRotate(), and VectorSubtract.

Referenced by CL_CompleteRecalcRouting(), CL_RecalcRouting(), and SV_RecalcRouting().

pos_t Grid_StepUp ( const routing_t map,
const actorSizeEnum_t  actorSize,
const pos3_t  pos,
const int  dir 
)

Returns the maximum height of an obstruction that an actor can travel over.

Parameters:
[in] map Pointer to client or server side routing table (clMap, svMap)
[in] actorSize width of the actor in cells
[in] pos Position in the map to check the height
[in] dir the direction in which we are moving
Returns:
The actual model height increase needed to move into an adjacent cell.

Definition at line 697 of file grid.c.

References Com_Printf(), PATHFINDING_HEIGHT, QuantToModel, and RT_STEPUP.


Generated by  doxygen 1.6.2