UFO: Alien Invasion
|
a struct holding the relevant data to check if we can move between two adjacent cells More...
Public Member Functions | |
Step (const Routing &r, const pos3_t fromPos, const actorSizeEnum_t actorSize, const byte crouchingState, const int dir) | |
Constructor. More... | |
bool | init () |
Initialize the other Step data. More... | |
bool | calcNewPos () |
Calculate the cell the we end up in if moving in the give dir. More... | |
void | calcNewTUs (const pathing_t *path) |
Calculate the TUs after we in the given dir. More... | |
bool | checkWalkingDirections (const pathing_t *path) |
Checks if we can walk in the given direction First test for opening height availability. Then test for stepup compatibility. Last test for fall. More... | |
bool | checkFlyingDirections () const |
Checks if we can move in the given flying direction. More... | |
bool | checkVerticalDirections () const |
Checks if we can move in the given vertical direction. More... | |
bool | isPossible (const pathing_t *path) |
Data Fields | |
const int | dir |
pos3_t | fromPos |
pos3_t | toPos |
actorSizeEnum_t | actorSize |
const byte | crouchingState |
byte | TUsAfter |
Private Attributes | |
bool | flier |
bool | hasLadderToClimb |
bool | hasLadderSupport |
int | actorHeight |
int | actorCrouchedHeight |
const Routing & | routing |
a struct holding the relevant data to check if we can move between two adjacent cells
Step::Step | ( | const Routing & | r, |
const pos3_t | _fromPos, | ||
const actorSizeEnum_t | _actorSize, | ||
const byte | _crouchingState, | ||
const int | _dir | ||
) |
Constructor.
[in] | r | Reference to client or server side routing table (clMap, svMap) |
[in] | _fromPos | Position where we start this step |
[in] | _actorSize | Give the field size of the actor (e.g. for 2x2 units) to check linked fields as well. |
[in] | _crouchingState | Whether the actor is currently crouching, 1 is yes, 0 is no. |
[in] | _dir | Direction vector index (see DIRECTIONS and dvecs) |
Definition at line 177 of file grid.cpp.
References fromPos, and VectorCopy.
bool Step::calcNewPos | ( | void | ) |
Calculate the cell the we end up in if moving in the give dir.
< "new" x value = starting x value + difference from chosen direction
< "new" y value = starting y value + difference from chosen direction
< "new" z value = starting z value + difference from chosen direction
Definition at line 217 of file grid.cpp.
References dir, dvecs, fromPos, PATHFINDING_HEIGHT, and toPos.
Referenced by isPossible().
Calculate the TUs after we in the given dir.
[in] | path | Pointer to client or server side pathing table (clPathMap, svPathMap) |
Definition at line 242 of file grid.cpp.
References crouchingState, dir, fromPos, Grid_GetTUsForDirection(), RT_AREA_POS, and TUsAfter.
Referenced by isPossible().
bool Step::checkFlyingDirections | ( | ) | const |
Checks if we can move in the given flying direction.
< The compass direction of this flying move
Definition at line 378 of file grid.cpp.
References actorHeight, actorSize, CELL_HEIGHT, CORE_DIRECTIONS, dir, fromPos, Routing::getConn(), Routing::getFloor(), routing, and toPos.
Referenced by isPossible().
bool Step::checkVerticalDirections | ( | ) | const |
Checks if we can move in the given vertical direction.
Definition at line 408 of file grid.cpp.
References actorSize, dir, DIRECTION_CLIMB_DOWN, DIRECTION_CLIMB_UP, DIRECTION_FALL, flier, fromPos, Routing::getCeiling(), Routing::getFloor(), hasLadderSupport, hasLadderToClimb, PLAYER_HEIGHT, QuantToModel, routing, and UNIT_HEIGHT.
Referenced by isPossible().
bool Step::checkWalkingDirections | ( | const pathing_t * | path | ) |
Checks if we can walk in the given direction First test for opening height availability. Then test for stepup compatibility. Last test for fall.
[in] | path | Pointer to client or server side pathing table (clPathMap, svPathMap) |
<This is the maximum height that an actor can fall.
< The actual stepup height without the level flags
OK, now some crazy tests: Because of the grid based nature of this game, each cell can have at most only ONE floor that can be stood upon. If an actor can walk down a slope that is in the same level, and actor should be able to walk on (and not fall into) the slope that decends a game level. BUT it is possible for an actor to be able to crawl under a floor that can be stood on, with this opening being in the same cell as the floor. SO to prevent any conflicts, we will move down a floor under the following conditions:
This will prevent actors from walking under a floor in the same cell in order to fall to the floor beneath. They will need to be able to step down into the cell or will not be able to use the opening.
Definition at line 259 of file grid.cpp.
References actorCrouchedHeight, actorHeight, actorSize, CELL_HEIGHT, crouchingState, dir, DV_FLAG_AUTOCROUCH, DV_FLAG_AUTOCROUCHED, DV_FLAG_AUTODIVE, fromPos, Routing::getCeiling(), Routing::getConn(), getDVflags, Routing::getFloor(), Routing::getStepupHeight(), Grid_GetTUsForDirection(), hasLadderSupport, Routing::isStepDownLevel(), Routing::isStepUpLevel(), PATHFINDING_HEIGHT, PATHFINDING_MAX_FALL, PATHFINDING_MAX_STEPUP, routing, RT_AREA_POS, toPos, and TU_CROUCH.
Referenced by isPossible().
bool Step::init | ( | ) |
Initialize the other Step data.
< The actor's height
Definition at line 188 of file grid.cpp.
References actorCrouchedHeight, actorHeight, crouchingState, dir, flier, FLYING_DIRECTIONS, ModelCeilingToQuant, PATHFINDING_DIRECTIONS, PLAYER_CROUCHING_HEIGHT, and PLAYER_STANDING_HEIGHT.
Referenced by Grid_CalcPathing(), and Grid_FindPath().
bool Step::isPossible | ( | const pathing_t * | path | ) |
[in] | path | Pointer to client or server side pathing table (clMap, svMap) |
note that this function may modify toPos !
Definition at line 443 of file grid.cpp.
References calcNewPos(), calcNewTUs(), checkFlyingDirections(), checkVerticalDirections(), checkWalkingDirections(), CORE_DIRECTIONS, dir, and FLYING_DIRECTIONS.
Referenced by Grid_CalcPathing(), and Grid_FindPath().
|
private |
Definition at line 149 of file grid.cpp.
Referenced by checkWalkingDirections(), and init().
|
private |
The actor's height in QUANT units.
Definition at line 148 of file grid.cpp.
Referenced by checkFlyingDirections(), checkWalkingDirections(), and init().
actorSizeEnum_t Step::actorSize |
Definition at line 155 of file grid.cpp.
Referenced by checkFlyingDirections(), checkVerticalDirections(), checkWalkingDirections(), Grid_CalcPathing(), and Grid_FindPath().
const byte Step::crouchingState |
Definition at line 156 of file grid.cpp.
Referenced by calcNewTUs(), checkWalkingDirections(), Grid_CalcPathing(), Grid_FindPath(), and init().
const int Step::dir |
Definition at line 152 of file grid.cpp.
Referenced by calcNewPos(), calcNewTUs(), checkFlyingDirections(), checkVerticalDirections(), checkWalkingDirections(), Grid_CalcPathing(), Grid_FindPath(), init(), and isPossible().
|
private |
This can be keyed into whether an actor can fly or not to allow flying
Definition at line 137 of file grid.cpp.
Referenced by checkVerticalDirections(), and init().
pos3_t Step::fromPos |
Definition at line 153 of file grid.cpp.
Referenced by calcNewPos(), calcNewTUs(), checkFlyingDirections(), checkVerticalDirections(), checkWalkingDirections(), Grid_CalcPathing(), Grid_FindPath(), and Step().
|
private |
Indicates if there is a ladder present providing support.
Definition at line 146 of file grid.cpp.
Referenced by checkVerticalDirections(), and checkWalkingDirections().
|
private |
Indicates if there is a ladder present providing ability to climb.
Definition at line 141 of file grid.cpp.
Referenced by checkVerticalDirections().
|
private |
Definition at line 150 of file grid.cpp.
Referenced by checkFlyingDirections(), checkVerticalDirections(), and checkWalkingDirections().
pos3_t Step::toPos |
Definition at line 154 of file grid.cpp.
Referenced by calcNewPos(), checkFlyingDirections(), checkWalkingDirections(), Grid_CalcPathing(), and Grid_FindPath().
byte Step::TUsAfter |
Definition at line 157 of file grid.cpp.
Referenced by calcNewTUs(), Grid_CalcPathing(), and Grid_FindPath().