37 #define ACTOR_SPEED_NORMAL 100
38 #define ACTOR_SPEED_CROUCHED (ACTOR_SPEED_NORMAL / 2)
61 forbiddenList.
reset();
104 gi.GridCalcPathing(movingActor->
fieldSize, pt, from, distance, &forbiddenList);
124 if (oldZ == ent->
pos[2])
129 const int diff = oldZ - ent->
pos[2];
180 const char* snd =
nullptr;
186 snd =
"footsteps/water_under";
189 snd =
"footsteps/water_in";
193 snd =
"footsteps/water_out";
205 if (snd !=
nullptr) {
232 gi.WriteShort(contentFlags);
249 const int oldZ = pos[2];
252 PosSubDV(pos, crouchingState, dvec);
254 dvtab[numdv++] =
setDVz(dvec, oldZ);
255 if (numdv >= dvtabSize)
273 const pos_t length =
gi.MoveLength(path, to, crouchingState, stored);
280 int dvec, numSteps = 0;
283 PosSubDV(pos, crouchingState, dvec);
286 const bool useAutostand = crouchingState && (
G_IsAI(actor) || actor->
getPlayer().autostand)
287 &&
gi.GridShouldUseAutostand(path, to);
288 const int autostandTU = useAutostand ? 2 *
TU_CROUCH : 0;
316 bool autoCrouchRequired =
false;
323 if (crouchingState && (
G_IsAI(actor) || player.autostand)) {
334 autoCrouchRequired =
true;
364 const int initTU = actor->
TU;
369 const byte oldDir = actor->
dir;
373 const int dvec = dvtab[numdv];
379 if ((status &
VIS_STOP) && visTeam != 0) {
380 autoCrouchRequired =
false;
389 autoCrouchRequired =
false;
392 if (oldDir != actor->
dir && step == 0) {
400 const float div =
gi.GetTUsForDirection(dir, actor->
isCrouched());
401 const int stepTUs = div + movingModifier;
402 if (usedTUs + stepTUs > actor->
TU)
420 const int oldState = actor->
state;
421 const int oldHP = actor->
HP;
422 const int oldSTUN = actor->
getStun();
423 if (crouchFlag == 0) {
432 const float truediv =
gi.GetTUsForDirection(dir, 0);
463 if (oldState != actor->
state || oldHP != actor->
HP || oldSTUN != actor->
getStun())
465 }
else if (crouchFlag == 1) {
468 }
else if (crouchFlag == -1) {
477 autoCrouchRequired =
false;
481 if (oldHP != actor->
HP || oldSTUN != actor->
getStun() || oldState != actor->
state) {
488 autoCrouchRequired =
false;
494 autoCrouchRequired =
false;
512 if (autoCrouchRequired) {
void G_EventActorFall(const Edict &ent)
Edict * G_EdictsGetNextInUse(Edict *lastEnt)
Iterate through the entities that are in use.
int G_TouchTriggers(Edict *ent, const entity_type_t type)
Check the world against triggers for the current entity.
#define VectorCopy(src, dest)
void G_ReactionFireNotifyClientEndMove(const Actor *target)
const char *IMPORT * GetFootstepSound(const char *texture)
trace_t G_Trace(const Line &trLine, const Edict *passent, int contentmask)
collision detection - this version is more accurate and includes entity tests
void calcOrigin()
Calculate the edict's origin vector from it's grid position.
void G_CheckVis(Edict *check, const vischeckflags_t visFlags)
Check if the edict appears/perishes for the other teams. If they appear for other teams...
void G_EventActorTurn(const Edict &ent)
Send the turn event for the given entity.
int G_ActorDoTurn(Edict *ent, byte dir)
Turns an actor around.
const teamDef_t * teamDef
Edict * G_GetEdictFromPos(const pos3_t pos, const entity_type_t type)
Searches an edict of the given type at the given grid location.
static void G_WriteStep(Actor *ent, const int dvec, const int contentFlags)
Writes a step of the move event to the net.
Misc utility functions for game module.
void G_ClientStateChange(const Player &player, Actor *actor, int reqState, bool checkaction)
Changes the state of a player/soldier.
Actor * G_EdictsGetLivingActorFromPos(const pos3_t pos)
Searches an actor at the given grid location.
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.
static const float FALLING_DAMAGE_FACTOR
static forbiddenList_t forbiddenList
The forbidden list is a list of entity positions that are occupied by an entity. This list is checked...
chrScoreMission_t * scoreMission
void G_CheckDeathOrKnockout(Actor *target, Actor *attacker, const fireDef_t *fd, int damage)
Player & getPlayer() const
#define Q_strvalid(string)
int G_FillDirectionTable(dvec_t *dvtab, size_t dvtabSize, byte crouchingState, pos3_t pos)
void G_EventMoveCameraTo(playermask_t playerMask, const pos3_t pos)
Centers the view for all clients that are seeing the given edict on the world position of the edict...
#define ACTOR_SPEED_NORMAL
static void G_SendFootstepSound(Edict *ent, const int contentFlags)
#define PosSubDV(p, crouch, dv)
static void G_BuildForbiddenList(int team, const Edict *movingActor)
Build the forbidden list for the pathfinding (server side).
QGL_EXTERN GLuint GLsizei GLsizei * length
#define G_IsCivilian(ent)
All parts of the main game logic that are combat related.
int G_ActorGetContentFlags(const vec3_t origin)
Get the content flags from where the actor is currently standing.
void G_ReactionFireNotifyClientStartMove(const Actor *target)
#define ACTOR_SPEED_CROUCHED
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.
playermask_t G_VisToPM(teammask_t teamMask)
Converts vis mask to player mask.
void G_EventAdd(playermask_t playerMask, int eType, int entnum)
char footstepSound[MAX_VAR]
#define PosAddDV(p, crouch, dv)
actorSizeEnum_t fieldSize
#define G_IsBlockingMovementActor(ent)
void G_TakeDamage(Edict *ent, int damage)
Applies the given damage value to an edict that is either an actor or has the FL_DESTROYABLE flag set...
#define VectorCompare(a, b)
bool G_ReactionFireOnMovement(Actor *target, int step)
Called when 'target' moves, possibly triggering or resolving reaction fire.
#define G_TeamToVisMask(team)
int G_CheckVisTeamAll(const int team, const vischeckflags_t visFlags, const Edict *ent)
Do G_CheckVisTeam for all entities ent is the one that is looking at the others.
bool G_FindPath(int team, const Edict *movingActor, const pos3_t from, const pos3_t targetPos, bool crouched, int maxTUs)
bool G_ActionCheckForCurrentTeam(const Player &player, Actor *ent, int TU)
Checks whether the requested action is possible for the current active team.
void G_ActorSetTU(Edict *ent, int tus)
functions to handle the storage and lifecycle of all edicts in the game module.
void G_EventSpawnFootstepSound(const Edict &ent, const char *sound)
void add(pos3_t pos, byte *entSize)
void G_MatchEndCheck(void)
Checks whether there are still actors to fight with left. If none are the match end will be triggered...
#define G_IsVisibleForTeam(ent, team)
Edict * G_GetFloorItems(Edict *ent)
Prepares a list of items on the floor at given entity position.
#define ROUTING_UNREACHABLE
short dvec_t
The direction vector tells us where the actor came from (in his previous step). The pathing table hol...
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 rout...
int G_TouchSolids(Edict *ent, float extend)
Call after making a step to a new grid tile to immediately touch edicts whose bbox intersects with th...
A list of locations that cannot be moved to.
void G_SendStats(Edict &ent)
Send stats to network buffer.
static bool G_ActorShouldStopInMidMove(const Edict *ent, int visState, dvec_t *dvtab, int max)
Checks whether the actor should stop movement.
#define ROUTING_NOT_REACHABLE
float G_ActorGetInjuryPenalty(const Edict *const ent, const modifier_types_t type)
Returns the penalty to the given stat caused by the actor wounds.
Interface for g_client.cpp.
pos3_t * forbiddenListPos
void G_ActorFall(Edict *ent)
Let an actor fall down if e.g. the func_breakable the actor was standing on was destroyed.
#define G_IsBreakable(ent)
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.