|
UFO: Alien Invasion
|
#include "g_move.h"#include "g_actor.h"#include "g_client.h"#include "g_combat.h"#include "g_edicts.h"#include "g_health.h"#include "g_inventory.h"#include "g_reaction.h"#include "g_utils.h"#include "g_vis.h"#include "g_match.h"
Go to the source code of this file.
Macros | |
| #define | ACTOR_SPEED_NORMAL 100 |
| #define | ACTOR_SPEED_CROUCHED (ACTOR_SPEED_NORMAL / 2) |
Functions | |
| static void | G_BuildForbiddenList (int team, const Edict *movingActor) |
| Build the forbidden list for the pathfinding (server side). | |
| 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. | |
| 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. | |
| bool | G_FindPath (int team, const Edict *movingActor, const pos3_t from, const pos3_t targetPos, bool crouched, int maxTUs) |
| void | G_ActorFall (Edict *ent) |
| Let an actor fall down if e.g. the func_breakable the actor was standing on was destroyed. | |
| static bool | G_ActorShouldStopInMidMove (const Edict *ent, int visState, dvec_t *dvtab, int max) |
| Checks whether the actor should stop movement. | |
| static void | G_SendFootstepSound (Edict *ent, const int contentFlags) |
| static void | G_WriteStep (Actor *ent, const int dvec, const int contentFlags) |
| Writes a step of the move event to the net. | |
| 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. | |
| 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. | |
Variables | |
| static const float | FALLING_DAMAGE_FACTOR = 10.0f |
| static forbiddenList_t | 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. | |
| #define ACTOR_SPEED_CROUCHED (ACTOR_SPEED_NORMAL / 2) |
Definition at line 38 of file g_move.cpp.
Referenced by G_ClientMove().
| #define ACTOR_SPEED_NORMAL 100 |
Definition at line 37 of file g_move.cpp.
Referenced by G_ClientMove().
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 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.
| actor | Edict to calculate move length for |
| path | Pointer to pathing table |
| to | Position to walk to |
| stored | Use the stored mask (the cached move) of the routing data |
Definition at line 270 of file g_move.cpp.
References G_ActorGetInjuryPenalty(), G_IsAI, Edict::getPlayer(), gi, Actor::isCrouched(), length, level, MODIFIER_MOVEMENT, 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().
Checks whether the actor should stop movement.
| ent | The actors edict |
| visState | The visibility check state VIS_PERISH, VIS_APPEAR |
| dvtab | The direction vectors |
| max | The index of the next step in dvtab |
true if the actor should stop movement, false otherwise Definition at line 151 of file g_move.cpp.
References G_EdictsGetLivingActorFromPos(), G_IsBlockingMovementActor, G_IsVisibleForTeam, Edict::getTeam(), Edict::pos, PosAddDV, VectorCopy, VIS_APPEAR, and VIS_STOP.
Referenced by G_ClientMove().
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 59 of file g_move.cpp.
References ET_SOLID, Edict::fieldSize, forbiddenList, Edict::forbiddenListPos, Edict::forbiddenListSize, G_EdictsGetNextInUse(), G_IsAI, G_IsBlockingMovementActor, G_TeamToVisMask, Edict::pos, TEAM_ALL, Edict::type, and Edict::visflags.
Referenced by G_FindPath(), and 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] | actor | Edict to move |
| [in] | to | The grid position to walk to |
Definition at line 307 of file g_move.cpp.
References ACTOR_SPEED_CROUCHED, ACTOR_SPEED_NORMAL, Edict::calcOrigin(), Edict::chr, Edict::clientAction, Edict::dir, 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_t::movedCrouched, chrScoreMission_t::movedNormal, Edict::moveinfo, Edict::origin, Edict::pos, PosAddDV, Edict::resetFloor(), ROUTING_NOT_REACHABLE, character_t::scoreMission, Edict::speed, Edict::state, STATE_CROUCHED, moveinfo_t::steps, Edict::TU, TU_CROUCH, TU_MOVE_STRAIGHT, TU_TURN, VectorCompare, VectorCopy, VIS_STOP, and Edict::visflags.
Referenced by AI_ActorThink(), AI_PrepBestAction(), G_ClientAction(), pos3L_goto(), TEST_F(), and TEST_F().
Definition at line 244 of file g_move.cpp.
References gi, level, 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, | ||
| int | maxTUs ) |
Definition at line 107 of file g_move.cpp.
References Edict::fieldSize, forbiddenList, G_BuildForbiddenList(), gi, and level.
Referenced by AIL_findweapons(), AIL_missiontargets(), AIL_positionapproach(), AIL_see(), AIL_waypoints(), and pos3L_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] | distance | The distance in TUs to calculate the move for. |
| [in] | movingActor | The actor to calculate the move for |
Definition at line 88 of file g_move.cpp.
References G_MoveCalcLocal(), and level.
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.
| [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] | distance | The distance in TUs to calculate the move for. |
| [in] | movingActor | The actor to calculate the move for |
Definition at line 101 of file g_move.cpp.
References Edict::fieldSize, forbiddenList, G_BuildForbiddenList(), and gi.
Referenced by AI_FindHerdLocation(), AI_FindHidingLocation(), and G_MoveCalc().
Definition at line 178 of file g_move.cpp.
References Edict::chr, Edict::contentFlags, CONTENTS_WATER, teamDef_t::footstepSound, G_EventSpawnFootstepSound(), G_Trace(), gi, MASK_SOLID, cBspSurface_t::name, Edict::origin, Q_strvalid, trace_t::surface, character_t::teamDef, and UNIT_HEIGHT.
Referenced by G_WriteStep().
Writes a step of the move event to the net.
| [in] | ent | Actor (entity) to move |
| [in] | dvec | The direction vector for the step to be added |
| [in] | contentFlags | The material we are walking over |
Definition at line 216 of file g_move.cpp.
References Edict::contentFlags, EV_ACTOR_MOVE, G_EventAdd(), G_SendFootstepSound(), Edict::getIdNum(), gi, Actor::isCrouched(), MAX_ROUTE, Edict::moveinfo, PM_ALL, Edict::speed, and moveinfo_t::steps.
Referenced by G_ClientMove().
|
static |
Definition at line 39 of file g_move.cpp.
Referenced by G_ActorFall().
|
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 45 of file g_move.cpp.