UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
g_move.h File Reference
#include "g_local.h"

Go to the source code of this file.

Functions

void G_MoveCalc (int team, const Actor *movingActor, const pos3_t from, int distance)
 Precalculates a move table for a given team and a given starting position. This will calculate a routing table for all reachable fields with the given distance from the given spot with the given actorsize. More...
 
void G_MoveCalcLocal (pathing_t *pt, int team, const Edict *movingActor, const pos3_t from, int distance)
 Same as G_MoveCalc, except that it uses the pathing table passed as the first param. More...
 
bool G_FindPath (int team, const Edict *movingActor, const pos3_t from, const pos3_t targetPos, bool crouched=false, int maxTUs=999999)
 
void G_ActorFall (Edict *ent)
 Let an actor fall down if e.g. the func_breakable the actor was standing on was destroyed. More...
 
int G_FillDirectionTable (dvec_t *dvtab, size_t dvtabSize, byte crouchingState, pos3_t pos)
 
pos_t G_ActorMoveLength (const Actor *actor, const pathing_t *path, const pos3_t to, bool stored)
 Return the needed TUs to walk to a given position. More...
 
void G_ClientMove (const Player &player, int visTeam, Actor *actor, const pos3_t to)
 Generates the client events that are send over the netchannel to move an actor. More...
 

Function Documentation

void G_ActorFall ( Edict ent)

Let an actor fall down if e.g. the func_breakable the actor was standing on was destroyed.

Parameters
[in,out]entThe actor that should fall down
Todo:
Handle cases where the grid position the actor would fall to is occupied by another actor already.

Definition at line 118 of file g_move.cpp.

References Edict::calcOrigin(), ET_NULL, FALLING_DAMAGE_FACTOR, Edict::fieldSize, G_CheckVis(), G_EventActorFall(), G_EventEnd(), G_GetEdictFromPos(), G_IsBlockingMovementActor, G_IsBreakable, G_TakeDamage(), gi, and Edict::pos.

Referenced by Destroy_Breakable().

pos_t G_ActorMoveLength ( const Actor actor,
const pathing_t path,
const pos3_t  to,
bool  stored 
)

Return the needed TUs to walk to a given position.

Parameters
actorEdict to calculate move length for
pathPointer to pathing table
toPosition to walk to
storedUse 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 270 of file g_move.cpp.

References G_ActorGetInjuryPenalty(), G_IsAI, Edict::getPlayer(), gi, Actor::isCrouched(), length, level, MODIFIER_MOVEMENT, level_locals_s::pathingMap, PosSubDV, ROUTING_NOT_REACHABLE, ROUTING_UNREACHABLE, TU_CROUCH, and VectorCopy.

Referenced by AI_CheckForMissionTargets(), AI_CivilianCalcActionScore(), AI_FighterCalcActionScore(), AI_FindHerdLocation(), AI_FindHidingLocation(), AI_FindMissionLocation(), AI_PanicCalcActionScore(), AI_PrepBestAction(), AIL_findweapons(), AIL_positionapproach(), AIL_positionflee(), AIL_positionshoot(), AIL_positionwander(), G_ClientMove(), pos3L_distance(), and pos3L_goto().

void G_ClientMove ( const Player &  player,
int  visTeam,
Actor actor,
const pos3_t  to 
)

Generates the client events that are send over the netchannel to move an actor.

Parameters
[in]playerPlayer who is moving an actor
[in]visTeamThe team to check the visibility for - if this is 0 we build the forbidden list above all edicts - for the human controlled actors this would mean that clicking to a grid position that is not reachable because an invisible actor is standing there would not result in a single step - as the movement is aborted before. For AI movement this is in general 0 - but not if they e.g. hide.
[in]actorEdict to move
[in]toThe grid position to walk to
See also
CL_ActorStartMove
PA_MOVE
Todo:
Handle dazed via trigger_hurt

Definition at line 307 of file g_move.cpp.

References ACTOR_SPEED_CROUCHED, ACTOR_SPEED_NORMAL, Edict::calcOrigin(), Edict::chr, Edict::clientAction, Edict::dir, f, Edict::fieldSize, G_ActionCheckForCurrentTeam(), G_ActorDoTurn(), G_ActorGetContentFlags(), G_ActorGetInjuryPenalty(), G_ActorMoveLength(), G_ActorSetTU(), G_ActorShouldStopInMidMove(), g_actorspeed, G_CheckDeathOrKnockout(), G_CheckVis(), G_CheckVisTeamAll(), G_ClientStateChange(), G_EventActorTurn(), G_EventEnd(), G_EventMoveCameraTo(), G_FillDirectionTable(), G_GetFloorItems(), G_IsAI, G_IsCivilian, G_MatchEndCheck(), G_MoveCalc(), G_ReactionFireNotifyClientEndMove(), G_ReactionFireNotifyClientStartMove(), G_ReactionFireOnMovement(), G_SendStats(), G_TeamToVisMask, G_TouchSolids(), G_TouchTriggers(), G_VisToPM(), G_WriteStep(), getDVdir, Edict::getStun(), Edict::getTeam(), gi, Edict::HP, Actor::isCrouched(), Actor::isDead(), length, lengthof, level, MAX_ROUTE, MODIFIER_MOVEMENT, chrScoreMission_s::movedCrouched, chrScoreMission_s::movedNormal, Edict::moveinfo, Edict::origin, level_locals_s::pathingMap, Edict::pos, PosAddDV, Edict::resetFloor(), ROUTING_NOT_REACHABLE, character_s::scoreMission, Edict::speed, Edict::state, STATE_CROUCHED, moveinfo_s::steps, Edict::TU, TU_CROUCH, TU_MOVE_STRAIGHT, TU_TURN, cvar_s::value, VectorCompare, VectorCopy, VIS_STOP, and Edict::visflags.

Referenced by AI_ActorThink(), AI_PrepBestAction(), G_ClientAction(), pos3L_goto(), and TEST_F().

int G_FillDirectionTable ( dvec_t dvtab,
size_t  dvtabSize,
byte  crouchingState,
pos3_t  pos 
)

Definition at line 244 of file g_move.cpp.

References gi, level, level_locals_s::pathingMap, PosSubDV, ROUTING_UNREACHABLE, and setDVz.

Referenced by G_ClientMove().

bool G_FindPath ( int  team,
const Edict movingActor,
const pos3_t  from,
const pos3_t  targetPos,
bool  crouched = false,
int  maxTUs = 999999 
)
void G_MoveCalc ( int  team,
const Actor movingActor,
const pos3_t  from,
int  distance 
)

Precalculates a move table for a given team and a given starting position. This will calculate a routing table for all reachable fields with the given distance from the given spot with the given actorsize.

Parameters
[in]teamThe current team (see G_BuildForbiddenList)
[in]fromPosition in the map to start the move-calculation from.
[in]distanceThe distance in TUs to calculate the move for.
[in]movingActorThe actor to calculate the move for

Definition at line 88 of file g_move.cpp.

References G_MoveCalcLocal(), level, and level_locals_s::pathingMap.

Referenced by AI_PrepBestAction(), AI_TurnIntoDirection(), AIL_positionflee(), AIL_positionmission(), AIL_positionshoot(), AIL_positionwander(), G_ClientMove(), and pos3L_goto().

void G_MoveCalcLocal ( pathing_t pt,
int  team,
const Edict movingActor,
const pos3_t  from,
int  distance 
)

Same as G_MoveCalc, except that it uses the pathing table passed as the first param.

Parameters
[in]ptthe pathfinding table
[in]teamThe current team (see G_BuildForbiddenList)
[in]fromPosition in the map to start the move-calculation from.
[in]distanceThe distance in TUs to calculate the move for.
[in]movingActorThe actor to calculate the move for

Definition at line 101 of file g_move.cpp.

References Edict::fieldSize, G_BuildForbiddenList(), and gi.

Referenced by AI_FindHerdLocation(), AI_FindHidingLocation(), and G_MoveCalc().