#include "g_local.h"
Go to the source code of this file.
Defines | |
#define | ACTOR_SPEED_NORMAL 100 |
#define | ACTOR_SPEED_CROUCHED (ACTOR_SPEED_NORMAL / 2) |
Functions | |
static void | G_BuildForbiddenList (int team, const edict_t *movingActor) |
Build the forbidden list for the pathfinding (server side). | |
void | G_MoveCalc (int team, const edict_t *movingActor, const pos3_t from, byte crouchingState, 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. | |
void | G_MoveCalcLocal (pathing_t *pt, int team, const edict_t *movingActor, const pos3_t from, byte crouchingState, int distance) |
Same as G_MoveCalc , except that it uses the pathing table passed as the first param. | |
edict_t * | G_GetActorFromPos (const pos3_t pos) |
Searches an actor on the given grid position. | |
void | G_ActorFall (edict_t *ent) |
Let an actor fall down if e.g. the func_breakable the actor was standing on was destroyed. | |
static qboolean | G_ActorShouldStopInMidMove (const edict_t *ent, int visState, byte *dvtab, int max) |
Checks whether the actor should stop movement. | |
void | G_ClientMove (const player_t *player, int visTeam, edict_t *ent, const pos3_t to) |
Generates the client events that are send over the netchannel to move an actor. | |
Variables | |
static const float | FALLING_DAMAGE_FACTOR = 10.0f |
static pos_t * | forbiddenList [MAX_FORBIDDENLIST] |
The forbidden list is a list of entity positions that are occupied by an entity. This list is checked everytime an actor wants to walk there. | |
static int | forbiddenListLength |
Definition in file g_move.c.
#define ACTOR_SPEED_CROUCHED (ACTOR_SPEED_NORMAL / 2) |
Definition at line 28 of file g_move.c.
Referenced by G_ClientMove().
#define ACTOR_SPEED_NORMAL 100 |
Definition at line 27 of file g_move.c.
Referenced by G_ClientMove().
void G_ActorFall | ( | edict_t * | ent | ) |
Let an actor fall down if e.g. the func_breakable the actor was standing on was destroyed.
[in,out] | ent | The actor that should fall down |
Definition at line 137 of file g_move.c.
References ET_NULL, FALLING_DAMAGE_FACTOR, edict_s::fieldSize, G_CheckVis(), G_EdictCalcOrigin(), G_EventActorFall(), G_GetEdictFromPos(), G_IsBlockingMovementActor, G_IsBreakable, G_TakeDamage(), gi, edict_s::pos, qtrue, and game_import_t::routingMap.
Referenced by Touch_Breakable().
static qboolean G_ActorShouldStopInMidMove | ( | const edict_t * | ent, | |
int | visState, | |||
byte * | dvtab, | |||
int | max | |||
) | [static] |
Checks whether the actor should stop movement.
ent | The actors edict | |
visState | The visibility check state VIS_PERISH , VIS_APPEAR |
true
if the actor should stop movement, false
otherwise Definition at line 166 of file g_move.c.
References ET_NULL, G_GetEdictFromPos(), G_IsBlockingMovementActor, G_IsVisibleForTeam, edict_s::pos, pos, PosAddDV, qfalse, qtrue, edict_s::team, VectorCopy, VIS_APPEAR, and VIS_STOP.
Referenced by G_ClientMove().
static void G_BuildForbiddenList | ( | int | team, | |
const edict_t * | movingActor | |||
) | [static] |
Build the forbidden list for the pathfinding (server side).
[in] | team | The team number if the list should be calculated from the eyes of that team. Use 0 to ignore team. |
[in] | movingActor | The moving actor to build the forbidden list for. If this is an AI actor, everything other actor will be included in the forbidden list - even the invisible ones. This is needed to ensure that they are not walking into each other (civilians <=> aliens, aliens <=> civilians) |
Definition at line 50 of file g_move.c.
References byte, ET_SOLID, edict_s::fieldSize, forbiddenList, forbiddenListLength, edict_s::forbiddenListPos, edict_s::forbiddenListSize, G_EdictsGetNextInUse(), G_IsAI, G_IsBlockingMovementActor, G_TeamToVisMask, gi, MAX_FORBIDDENLIST, edict_s::pos, TEAM_ALL, edict_s::type, and edict_s::visflags.
Referenced by G_MoveCalcLocal().
Generates the client events that are send over the netchannel to move an actor.
[in] | player | Player who is moving an actor |
[in] | visTeam | The 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] | ent | Edict to move |
[in] | to | The grid position to walk to |
Definition at line 207 of file g_move.c.
References ACTOR_SPEED_CROUCHED, ACTOR_SPEED_NORMAL, player_s::autostand, byte, edict_s::chr, edict_s::clientAction, moveinfo_t::contentFlags, CORE_DIRECTIONS, moveinfo_t::currentStep, edict_s::dir, EV_ACTOR_MOVE, FLOOR, G_ActionCheckForCurrentTeam(), G_ActorDieOrStun(), G_ActorDoTurn(), G_ActorSetTU(), G_ActorShouldStopInMidMove(), g_actorspeed, G_CheckVis(), G_CheckVisTeamAll(), G_ClientStateChange(), G_EdictCalcOrigin(), G_EventActorTurn(), G_GetFloorItems(), G_IsCrouched, G_IsDazed, G_IsDead, G_MoveCalc(), g_notu, G_PhysicsStep(), G_PrintActorStats(), G_ReactionFireOnMovement(), G_SendStats(), G_TouchTriggers(), G_VisToPM(), getDVdir, gi, cvar_s::integer, lengthof, level, MAX_DVTAB, chrScoreMission_s::movedCrouched, chrScoreMission_s::movedNormal, edict_s::moveinfo, NewDVZ, edict_s::nextthink, edict_s::number, edict_s::origin, level_locals_t::pathingMap, PLAYER_MIN, edict_s::pos, pos, PosAddDV, PosSubDV, qfalse, qtrue, ROUTING_NOT_REACHABLE, ROUTING_UNREACHABLE, character_s::scoreMission, SHOULD_USE_AUTOSTAND, edict_s::speed, edict_s::state, STATE_CROUCHED, moveinfo_t::steps, edict_s::team, edict_s::think, level_locals_t::time, edict_s::TU, TU_CROUCH_MOVING_FACTOR, TU_MOVE_STRAIGHT, TU_TURN, cvar_s::value, VectorCompare, VectorCopy, VIS_STOP, moveinfo_t::visflags, edict_s::visflags, and game_import_t::WriteDummyByte().
Referenced by AI_ActorThink(), AI_PrepBestAction(), G_ClientAction(), and pos3L_goto().
Searches an actor on the given grid position.
pos | The position to search an actor on |
NULL
if no actor is standing on that grid position Definition at line 121 of file g_move.c.
References ET_ACTOR, ET_ACTOR2x2, ET_ACTORHIDDEN, and G_GetEdictFromPos().
Referenced by G_SpawnItemOnFloor().
void G_MoveCalc | ( | int | team, | |
const edict_t * | movingActor, | |||
const pos3_t | from, | |||
byte | crouchingState, | |||
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.
[in] | team | The current team (see G_BuildForbiddenList) |
[in] | from | Position in the map to start the move-calculation from. |
[in] | crouchingState | The crouching state of the actor. 0=stand, 1=crouch |
[in] | distance | The distance in TUs to calculate the move for. |
[in] | movingActor | The actor to calculate the move for |
Definition at line 93 of file g_move.c.
References G_MoveCalcLocal(), level, and level_locals_t::pathingMap.
Referenced by AI_PrepBestAction(), AI_TurnIntoDirection(), AIL_positionshoot(), G_ClientMove(), and pos3L_goto().
void G_MoveCalcLocal | ( | pathing_t * | pt, | |
int | team, | |||
const edict_t * | movingActor, | |||
const pos3_t | from, | |||
byte | crouchingState, | |||
int | distance | |||
) |
Same as G_MoveCalc
, except that it uses the pathing table passed as the first param.
[in] | pt | the pathfinding table |
[in] | team | The current team (see G_BuildForbiddenList) |
[in] | from | Position in the map to start the move-calculation from. |
[in] | crouchingState | The crouching state of the actor. 0=stand, 1=crouch |
[in] | distance | The distance in TUs to calculate the move for. |
[in] | movingActor | The actor to calculate the move for |
Definition at line 109 of file g_move.c.
References edict_s::fieldSize, forbiddenList, forbiddenListLength, G_BuildForbiddenList(), gi, and game_import_t::routingMap.
Referenced by AI_FindHerdLocation(), AI_FindHidingLocation(), and G_MoveCalc().
const float FALLING_DAMAGE_FACTOR = 10.0f [static] |
Definition at line 29 of file g_move.c.
Referenced by G_ActorFall().
pos_t* forbiddenList[MAX_FORBIDDENLIST] [static] |
The forbidden list is a list of entity positions that are occupied by an entity. This list is checked everytime an actor wants to walk there.
Definition at line 35 of file g_move.c.
Referenced by G_BuildForbiddenList(), and G_MoveCalcLocal().
int forbiddenListLength [static] |
Definition at line 36 of file g_move.c.
Referenced by G_BuildForbiddenList(), and G_MoveCalcLocal().