UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
routing_s Struct Reference

Pathfinding routing structure and tile layout. More...

#include <typedefs.h>

Public Member Functions

void setStepup (const int x, const int y, const int z, const int dir, const int val)
 
byte getStepup (const int x, const int y, const int z, const int dir) const
 
void setConn (const int x, const int y, const int z, const int dir, const int val)
 
byte getConn (const int x, const int y, const int z, const int dir) const
 
void setCeiling (const int x, const int y, const int z, const int val)
 
byte getCeiling (const int x, const int y, const int z) const
 
byte getCeiling (const pos3_t pos) const
 
void setFloor (const int x, const int y, const int z, const int val)
 
signed char getFloor (const int x, const int y, const int z) const
 
signed char getFloor (const pos3_t pos) const
 

Data Fields

byte _stepup [PATHFINDING_HEIGHT][PATHFINDING_WIDTH][PATHFINDING_WIDTH][CORE_DIRECTIONS]
 
byte _route [PATHFINDING_HEIGHT][PATHFINDING_WIDTH][PATHFINDING_WIDTH][CORE_DIRECTIONS]
 
signed char _floor [PATHFINDING_HEIGHT][PATHFINDING_WIDTH][PATHFINDING_WIDTH]
 
byte _ceil [PATHFINDING_HEIGHT][PATHFINDING_WIDTH][PATHFINDING_WIDTH]
 

Detailed Description

Pathfinding routing structure and tile layout.

Note
Comments strongly WIP!

ROUTE Information stored in "route"

connections (see Grid_MoveCheck) mask description 0x10 0001 0000 connection to +x (height ignored?) 0x20 0010 0000 connection to -x (height ignored?) 0x40 0100 0000 connection to +y (height ignored?) 0x80 1000 0000 connection to -y (height ignored?)

See "h = map->route[z][y][x] & 0x0F;" and "if (map->route[az][ay][ax] & 0x0F) > h)" in CM_UpdateConnection 0x0F 0000 1111 some height info?

FALL Information about how much you'll fall down from x,y position? I THINK as long as a bit is set you will fall down ... See "while (map->fall[ny][nx] & (1 << z)) z--;" in Grid_MoveMark

STEP

0000 0000 Access with "step[y][x] & (1 << z)" Guess: Each bit if set to 0 if a unit can step on it (e.g. ground or chair) or it's 1 if there is a wall or similar (i.e. it's blocked). GERD THINKS it shows stairs and step-on stuff Search for "sh = (map->step[y][x] & (1 << z)) ? sh_big : sh_low;" and similar. "sh" seems to mean "step height"

AREA The needed TUs to walk to a given position. (See Grid_MoveLength)

AREASTORED The stored mask (the cached move) of the routing data. (See Grid_MoveLength)

TILE LAYOUT AND PATHING Maps are comprised of tiles. Each tile has a number of levels corresponding to entities in game. All static entities in the tile are located in levels 0-255, with the main world located in 0. Levels 256-258 are reserved, see LEVEL_* constants in src/shared/shared.h. Non-static entities (ET_BREAKABLE and ET_ROTATING, ET_DOOR, etc.) are contained in levels 259 and above. These entities' models are named *##, beginning from 1, and each corresponds to level LEVEL_MAX - 1 + ##.

The code that handles the pathing has separate checks for the static and non-static levels in a tile. The static levels have their bounds precalculated by CM_MakeTracingNodes and stored in tile->theads. The other levels are checked in the fly when Grid_CheckUnit is called.

Definition at line 196 of file typedefs.h.

Member Function Documentation

byte routing_s::getCeiling ( const int  x,
const int  y,
const int  z 
) const
inline

Definition at line 219 of file typedefs.h.

Referenced by getCeiling(), and Routing::getCeiling().

byte routing_s::getCeiling ( const pos3_t  pos) const
inline

Definition at line 222 of file typedefs.h.

References getCeiling().

byte routing_s::getConn ( const int  x,
const int  y,
const int  z,
const int  dir 
) const
inline

Definition at line 212 of file typedefs.h.

Referenced by Routing::getConn().

signed char routing_s::getFloor ( const int  x,
const int  y,
const int  z 
) const
inline

Definition at line 229 of file typedefs.h.

Referenced by getFloor(), and Routing::getFloor().

signed char routing_s::getFloor ( const pos3_t  pos) const
inline

Definition at line 232 of file typedefs.h.

References getFloor().

byte routing_s::getStepup ( const int  x,
const int  y,
const int  z,
const int  dir 
) const
inline
void routing_s::setCeiling ( const int  x,
const int  y,
const int  z,
const int  val 
)
inline

Definition at line 216 of file typedefs.h.

Referenced by Routing::setCeiling(), and Routing::setFilled().

void routing_s::setConn ( const int  x,
const int  y,
const int  z,
const int  dir,
const int  val 
)
inline

Definition at line 209 of file typedefs.h.

Referenced by Routing::setConn().

void routing_s::setFloor ( const int  x,
const int  y,
const int  z,
const int  val 
)
inline

Definition at line 226 of file typedefs.h.

Referenced by Routing::setFilled(), and Routing::setFloor().

void routing_s::setStepup ( const int  x,
const int  y,
const int  z,
const int  dir,
const int  val 
)
inline

Definition at line 202 of file typedefs.h.

Referenced by Routing::setStepup().

Field Documentation

Definition at line 200 of file typedefs.h.

signed char routing_s::_floor[PATHFINDING_HEIGHT][PATHFINDING_WIDTH][PATHFINDING_WIDTH]

Definition at line 199 of file typedefs.h.

Definition at line 198 of file typedefs.h.

Definition at line 197 of file typedefs.h.


The documentation for this struct was generated from the following file: