UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
g_move.cpp
Go to the documentation of this file.
1 
5 /*
6 Copyright (C) 2002-2020 UFO: Alien Invasion.
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
12 
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 See the GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 
23 */
24 
25 #include "g_move.h"
26 #include "g_actor.h"
27 #include "g_client.h"
28 #include "g_combat.h"
29 #include "g_edicts.h"
30 #include "g_health.h"
31 #include "g_inventory.h"
32 #include "g_reaction.h"
33 #include "g_utils.h"
34 #include "g_vis.h"
35 #include "g_match.h"
36 
37 #define ACTOR_SPEED_NORMAL 100
38 #define ACTOR_SPEED_CROUCHED (ACTOR_SPEED_NORMAL / 2)
39 static const float FALLING_DAMAGE_FACTOR = 10.0f;
40 
46 
59 static void G_BuildForbiddenList (int team, const Edict* movingActor)
60 {
61  forbiddenList.reset();
62 
63  /* team visibility */
64  const teammask_t teamMask = team ? G_TeamToVisMask(team) : TEAM_ALL;
65 
66  Edict* ent = nullptr;
67  while ((ent = G_EdictsGetNextInUse(ent))) {
68  /* Dead 2x2 unit will stop walking, too. */
69  if (G_IsBlockingMovementActor(ent) && (G_IsAI(movingActor) || (ent->visflags & teamMask))) {
70  forbiddenList.add(ent->pos, (byte*) &ent->fieldSize);
71  } else if (ent->type == ET_SOLID) {
72  for (int j = 0; j < ent->forbiddenListSize; j++) {
73  forbiddenList.add(ent->forbiddenListPos[j], (byte*) &ent->fieldSize);
74  }
75  }
76  }
77 }
78 
88 void G_MoveCalc (int team, const Actor* movingActor, const pos3_t from, int distance)
89 {
90  G_MoveCalcLocal(level.pathingMap, team, movingActor, from, distance);
91 }
92 
101 void G_MoveCalcLocal (pathing_t* pt, int team, const Edict* movingActor, const pos3_t from, int distance)
102 {
103  G_BuildForbiddenList(team, movingActor);
104  gi.GridCalcPathing(movingActor->fieldSize, pt, from, distance, &forbiddenList);
105 }
106 
107 bool G_FindPath (int team, const Edict* movingActor, const pos3_t from, const pos3_t targetPos, bool crouched, int maxTUs)
108 {
109  G_BuildForbiddenList(team, movingActor);
110  return gi.GridFindPath(movingActor->fieldSize, level.pathingMap, from, targetPos, crouched, maxTUs, &forbiddenList);
111 }
112 
118 void G_ActorFall (Edict* ent)
119 {
120  const pos_t oldZ = ent->pos[2];
121 
122  ent->pos[2] = gi.GridFall(ent->fieldSize, ent->pos);
123 
124  if (oldZ == ent->pos[2])
125  return;
126 
127  Edict* entAtPos = G_GetEdictFromPos(ent->pos, ET_NULL);
128  if (entAtPos != nullptr && (G_IsBreakable(entAtPos) || G_IsBlockingMovementActor(entAtPos))) {
129  const int diff = oldZ - ent->pos[2];
130  G_TakeDamage(entAtPos, (int)(FALLING_DAMAGE_FACTOR * (float)diff));
131  }
132 
133  ent->calcOrigin();
134  gi.LinkEdict(ent);
135 
136  G_CheckVis(ent);
137 
138  G_EventActorFall(*ent);
139 
140  G_EventEnd();
141 }
142 
151 static bool G_ActorShouldStopInMidMove (const Edict* ent, int visState, dvec_t* dvtab, int max)
152 {
153  if (visState & VIS_STOP)
154  return true;
155 
156  /* check that the appearing unit is not on a grid position the actor wanted to walk to.
157  * this might be the case if the edict got visible in mid mode */
158  if (visState & VIS_APPEAR) {
159  pos3_t pos;
160  VectorCopy(ent->pos, pos);
161  while (max >= 0) {
162  int tmp = 0;
163 
164  PosAddDV(pos, tmp, dvtab[max]);
165  max--;
166  const Actor* blockEdict = G_EdictsGetLivingActorFromPos(pos);
167 
168  if (blockEdict && G_IsBlockingMovementActor(blockEdict)) {
169  const bool visible = G_IsVisibleForTeam(blockEdict, ent->getTeam());
170  if (visible)
171  return true;
172  }
173  }
174  }
175  return false;
176 }
177 
178 static void G_SendFootstepSound (Edict* ent, const int contentFlags)
179 {
180  const char* snd = nullptr;
181 
182  if (contentFlags & CONTENTS_WATER) {
183  if (ent->contentFlags & CONTENTS_WATER) {
184  /* looks like we already are in the water */
185  /* send water moving sound */
186  snd = "footsteps/water_under";
187  } else {
188  /* send water entering sound */
189  snd = "footsteps/water_in";
190  }
191  } else if (ent->contentFlags & CONTENTS_WATER) {
192  /* send water leaving sound */
193  snd = "footsteps/water_out";
194  } else if (Q_strvalid(ent->chr.teamDef->footstepSound)) {
195  /* some teams have a fixed footstep or moving sound */
196  snd = ent->chr.teamDef->footstepSound;
197  } else {
198  /* we should really hit the ground with this */
199  const vec3_t to = {ent->origin[0], ent->origin[1], ent->origin[2] - UNIT_HEIGHT};
200  const trace_t trace = G_Trace(Line(ent->origin, to), nullptr, MASK_SOLID);
201  if (trace.surface) {
202  snd = gi.GetFootstepSound(trace.surface->name);
203  }
204  }
205  if (snd != nullptr) {
206  G_EventSpawnFootstepSound(*ent, snd);
207  }
208 }
209 
216 static void G_WriteStep (Actor* ent, const int dvec, const int contentFlags)
217 {
218  /* write move header if not yet done */
219  if (gi.GetEvent() != EV_ACTOR_MOVE) {
221  }
222 
223  if (ent->moveinfo.steps >= MAX_ROUTE) {
224  ent->moveinfo.steps = 0;
225  }
226  gi.WriteByte(ent->moveinfo.steps);
227 
228  /* write move header and always one step after another - because the next step
229  * might already be the last one due to some stop event */
230  gi.WriteShort(dvec);
231  gi.WriteShort(ent->speed);
232  gi.WriteShort(contentFlags);
233 
234  /* Send the sound effect to everyone who's not seeing the actor */
235  if (!ent->isCrouched()) {
236  G_SendFootstepSound(ent, contentFlags);
237  }
238 
239  ent->contentFlags = contentFlags;
240 
241  ent->moveinfo.steps++;
242 }
243 
244 int G_FillDirectionTable (dvec_t* dvtab, size_t dvtabSize, byte crouchingState, pos3_t pos)
245 {
246  int dvec;
247  int numdv = 0;
248  while ((dvec = gi.MoveNext(level.pathingMap, pos, crouchingState)) != ROUTING_UNREACHABLE) {
249  const int oldZ = pos[2];
250  /* dvec indicates the direction traveled to get to the new cell and the original cell height. */
251  /* We are going backwards to the origin. */
252  PosSubDV(pos, crouchingState, dvec);
253  /* Replace the z portion of the DV value so we can get back to where we were. */
254  dvtab[numdv++] = setDVz(dvec, oldZ);
255  if (numdv >= dvtabSize)
256  break;
257  }
258 
259  return numdv;
260 }
261 
270 pos_t G_ActorMoveLength (const Actor* actor, const pathing_t* path, const pos3_t to, bool stored)
271 {
272  byte crouchingState = actor->isCrouched() ? 1 : 0;
273  const pos_t length = gi.MoveLength(path, to, crouchingState, stored);
274 
275  if (!length || length == ROUTING_NOT_REACHABLE)
276  return length;
277 
278  pos3_t pos;
279  VectorCopy(to, pos);
280  int dvec, numSteps = 0;
281  while ((dvec = gi.MoveNext(level.pathingMap, pos, crouchingState)) != ROUTING_UNREACHABLE) {
282  ++numSteps;
283  PosSubDV(pos, crouchingState, dvec); /* We are going backwards to the origin. */
284  }
285 
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;
289 
290  return std::min(ROUTING_NOT_REACHABLE, length + static_cast<int>(numSteps *
291  G_ActorGetInjuryPenalty(actor, MODIFIER_MOVEMENT)) + autostandTU);
292 }
293 
307 void G_ClientMove (const Player& player, int visTeam, Actor* actor, const pos3_t to)
308 {
309  if (VectorCompare(actor->pos, to))
310  return;
311 
312  /* check if action is possible */
313  if (!G_ActionCheckForCurrentTeam(player, actor, TU_MOVE_STRAIGHT))
314  return;
315 
316  bool autoCrouchRequired = false;
317  byte crouchingState = actor->isCrouched() ? 1 : 0;
318 
319  /* calculate move table */
320  G_MoveCalc(visTeam, actor, actor->pos, actor->TU);
321 
322  /* Autostand: check if the actor is crouched and player wants autostanding...*/
323  if (crouchingState && (G_IsAI(actor) || player.autostand)) {
324  /* ...and if this is a long walk... */
325  if (gi.CanActorStandHere(actor->fieldSize, actor->pos)
326  && gi.GridShouldUseAutostand(level.pathingMap, to)) {
327  /* ...make them stand first. If the player really wants them to walk a long
328  * way crouched, he can move the actor in several stages.
329  * Uses the threshold at which standing, moving and crouching again takes
330  * fewer TU than just crawling while crouched. */
331  G_ClientStateChange(player, actor, STATE_CROUCHED, true); /* change to stand state */
332  crouchingState = actor->isCrouched() ? 1 : 0;
333  if (!crouchingState)
334  autoCrouchRequired = true;
335  }
336  }
337 
338  const pos_t length = std::min(G_ActorMoveLength(actor, level.pathingMap, to, false)
339  + (autoCrouchRequired ? TU_CROUCH : 0), ROUTING_NOT_REACHABLE);
340  /* length of ROUTING_NOT_REACHABLE means not reachable */
341  if (length && length >= ROUTING_NOT_REACHABLE)
342  return;
343 
344  /* assemble dvec-encoded move data */
345  pos3_t pos;
346  VectorCopy(to, pos);
347 
348  dvec_t dvtab[MAX_ROUTE];
349  byte numdv = G_FillDirectionTable(dvtab, lengthof(dvtab), crouchingState, pos);
350 
351  /* make sure to end any other pending events - we rely on EV_ACTOR_MOVE not being active anymore */
352  G_EventEnd();
353 
354  /* everything ok, found valid route? */
355  if (VectorCompare(pos, actor->pos)) {
356  /* no floor inventory at this point */
357  actor->resetFloor();
358 
359  if (!G_IsCivilian(actor))
360  G_EventMoveCameraTo(G_VisToPM(actor->visflags & ~G_TeamToVisMask(actor->getTeam())), actor->pos);
361 
362  actor->moveinfo.steps = 0;
364  const int initTU = actor->TU;
365  int usedTUs = 0;
366  const int movingModifier = G_ActorGetInjuryPenalty(actor, MODIFIER_MOVEMENT);
367  while (numdv > 0) {
368  const int step = actor->moveinfo.steps;
369  const byte oldDir = actor->dir;
370 
371  /* get next dvec */
372  numdv--;
373  const int dvec = dvtab[numdv];
374  /* This is the direction to make the step into */
375  const int dir = getDVdir(dvec);
376 
377  /* turn around first */
378  int status = G_ActorDoTurn(actor, dir);
379  if ((status & VIS_STOP) && visTeam != 0) {
380  autoCrouchRequired = false;
381  if (step == 0) {
382  usedTUs += TU_TURN;
383  }
384  break;
385  }
386 
387  if (visTeam != 0 && G_ActorShouldStopInMidMove(actor, status, dvtab, numdv)) {
388  /* don't autocrouch if new enemy becomes visible */
389  autoCrouchRequired = false;
390  /* if something appears on our route that didn't trigger a VIS_STOP, we have to
391  * send the turn event if this is our first step */
392  if (oldDir != actor->dir && step == 0) {
393  G_EventActorTurn(*actor);
394  usedTUs += TU_TURN;
395  }
396  break;
397  }
398 
399  /* decrease TUs */
400  const float div = gi.GetTUsForDirection(dir, actor->isCrouched());
401  const int stepTUs = div + movingModifier;
402  if (usedTUs + stepTUs > actor->TU)
403  break;
404  usedTUs += stepTUs;
405 
406  /* This is now a flag to indicate a change in crouching - we need this for
407  * the stop in mid move call(s), because we need the updated entity position */
408  int crouchFlag = 0;
409  /* Calculate the new position after the decrease in TUs, otherwise the game
410  * remembers the false position if the time runs out */
411  PosAddDV(actor->pos, crouchFlag, dvec);
412 
413  /* slower if crouched */
414  if (actor->isCrouched())
415  actor->speed = ACTOR_SPEED_CROUCHED;
416  else
417  actor->speed = ACTOR_SPEED_NORMAL;
418  actor->speed *= g_actorspeed->value;
419 
420  const int oldState = actor->state;
421  const int oldHP = actor->HP;
422  const int oldSTUN = actor->getStun();
423  if (crouchFlag == 0) { /* No change in crouch */
424  actor->calcOrigin();
425 
426  /* link it at new position - this must be done for every edict
427  * movement - to let the server know about it. */
428  gi.LinkEdict(actor);
429 
430  /* Only the PHALANX team has these stats right now. */
431  if (actor->chr.scoreMission) {
432  const float truediv = gi.GetTUsForDirection(dir, 0); /* regardless of crouching ! */
433  if (actor->isCrouched())
434  actor->chr.scoreMission->movedCrouched += truediv;
435  else
436  actor->chr.scoreMission->movedNormal += truediv;
437  }
438  /* write the step to the net */
439  const int contentFlags = G_ActorGetContentFlags(actor->origin);
440  G_WriteStep(actor, dvec, contentFlags);
441 
442  status = 0;
443 
444  /* Set actor->TU because the reaction code relies on actor->TU being accurate. */
445  G_ActorSetTU(actor, initTU - usedTUs);
446 
447  Edict* clientAction = actor->clientAction;
448  /* check triggers at new position */
449  if (G_TouchTriggers(actor)) {
450  if (!clientAction)
451  status |= VIS_STOP;
452  }
453 
454  /* check if player appears/perishes, seen from other teams */
455  G_CheckVis(actor);
456 
457  /* check for anything appearing, seen by "the moving one" */
458  status |= G_CheckVisTeamAll(actor->getTeam(), 0, actor);
459 
460  G_TouchSolids(actor, 10.0f);
461 
462  /* state has changed - maybe we walked on a trigger_hurt */
463  if (oldState != actor->state || oldHP != actor->HP || oldSTUN != actor->getStun())
464  status |= VIS_STOP;
465  } else if (crouchFlag == 1) {
466  /* Actor is standing */
467  G_ClientStateChange(player, actor, STATE_CROUCHED, true);
468  } else if (crouchFlag == -1) {
469  /* Actor is crouching and should stand up */
470  G_ClientStateChange(player, actor, STATE_CROUCHED, false);
471  }
472 
473  /* check for reaction fire */
474  if (G_ReactionFireOnMovement(actor, step)) {
475  status |= VIS_STOP;
476 
477  autoCrouchRequired = false;
478  }
479 
480  /* check for death */
481  if (oldHP != actor->HP || oldSTUN != actor->getStun() || oldState != actor->state) {
483  /* maybe this was due to rf - then the G_ActorDie was already called */
484  if (!actor->isDead()) {
485  G_CheckDeathOrKnockout(actor, nullptr, nullptr, (oldHP - actor->HP) + (actor->getStun() - oldSTUN));
486  }
487  G_MatchEndCheck();
488  autoCrouchRequired = false;
489  break;
490  }
491 
492  if (visTeam != 0 && G_ActorShouldStopInMidMove(actor, status, dvtab, numdv - 1)) {
493  /* don't autocrouch if new enemy becomes visible */
494  autoCrouchRequired = false;
495  break;
496  }
497 
498  /* Restore actor->TU because the movement code relies on it not being modified! */
499  G_ActorSetTU(actor, initTU);
500  }
501 
502  /* submit the TUs / round down */
503  G_ActorSetTU(actor, initTU - usedTUs);
504 
505  G_SendStats(*actor);
506 
507  /* end the move */
508  G_GetFloorItems(actor);
509  G_EventEnd();
510  }
511 
512  if (autoCrouchRequired) {
513  /* toggle back to crouched state */
514  G_ClientStateChange(player, actor, STATE_CROUCHED, true);
515  }
516 
518 }
void G_EventEnd(void)
Definition: g_events.cpp:711
void G_EventActorFall(const Edict &ent)
Definition: g_events.cpp:345
Edict * G_EdictsGetNextInUse(Edict *lastEnt)
Iterate through the entities that are in use.
Definition: g_edicts.cpp:166
int getIdNum() const
Definition: g_edict.h:231
int G_TouchTriggers(Edict *ent, const entity_type_t type)
Check the world against triggers for the current entity.
Definition: g_utils.cpp:547
Reaction fire system.
#define VectorCopy(src, dest)
Definition: vector.h:51
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
Definition: g_utils.cpp:265
void calcOrigin()
Calculate the edict's origin vector from it's grid position.
Definition: g_edict.h:216
int getStun() const
Definition: g_edict.h:308
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...
Definition: g_vis.cpp:409
void G_EventActorTurn(const Edict &ent)
Send the turn event for the given entity.
Definition: g_events.cpp:77
int G_ActorDoTurn(Edict *ent, byte dir)
Turns an actor around.
Definition: g_actor.cpp:154
const teamDef_t * teamDef
Definition: chr_shared.h:394
Edict * G_GetEdictFromPos(const pos3_t pos, const entity_type_t type)
Searches an edict of the given type at the given grid location.
Definition: g_utils.cpp:59
static void G_WriteStep(Actor *ent, const int dvec, const int contentFlags)
Writes a step of the move event to the net.
Definition: g_move.cpp:216
#define VIS_APPEAR
Definition: g_vis.h:36
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.
Definition: g_client.cpp:473
Actor * G_EdictsGetLivingActorFromPos(const pos3_t pos)
Searches an actor at the given grid location.
Definition: g_edicts.cpp:270
bool isDead() const
Definition: g_edict.h:362
character_t chr
Definition: g_edict.h:116
#define TU_CROUCH
Definition: defines.h:72
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.
Definition: g_move.cpp:307
float value
Definition: cvar.h:80
#define UNIT_HEIGHT
Definition: defines.h:122
#define PM_ALL
Definition: g_events.h:36
int forbiddenListSize
Definition: g_edict.h:175
moveinfo_t moveinfo
Definition: g_edict.h:160
byte dir
Definition: g_edict.h:86
#define TU_MOVE_STRAIGHT
Definition: defines.h:74
#define STATE_CROUCHED
Definition: q_shared.h:263
static const float FALLING_DAMAGE_FACTOR
Definition: g_move.cpp:39
static forbiddenList_t forbiddenList
The forbidden list is a list of entity positions that are occupied by an entity. This list is checked...
Definition: g_move.cpp:45
chrScoreMission_t * scoreMission
Definition: chr_shared.h:388
void G_CheckDeathOrKnockout(Actor *target, Actor *attacker, const fireDef_t *fd, int damage)
Definition: g_combat.cpp:499
Player & getPlayer() const
Definition: g_edict.h:265
int speed
Definition: g_edict.h:124
#define Q_strvalid(string)
Definition: shared.h:141
#define CONTENTS_WATER
Definition: defines.h:226
int G_FillDirectionTable(dvec_t *dvtab, size_t dvtabSize, byte crouchingState, pos3_t pos)
Definition: g_move.cpp:244
int getTeam() const
Definition: g_edict.h:269
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...
Definition: g_events.cpp:501
Match related functions.
#define ACTOR_SPEED_NORMAL
Definition: g_move.cpp:37
void reset()
Definition: grid.h:51
#define setDVz(dv, z)
Definition: mathlib.h:248
static void G_SendFootstepSound(Edict *ent, const int contentFlags)
Definition: g_move.cpp:178
game_import_t gi
Definition: g_main.cpp:39
#define PosSubDV(p, crouch, dv)
Definition: mathlib.h:254
static void G_BuildForbiddenList(int team, const Edict *movingActor)
Build the forbidden list for the pathfinding (server side).
Definition: g_move.cpp:59
QGL_EXTERN GLuint GLsizei GLsizei * length
Definition: r_gl.h:110
#define G_IsCivilian(ent)
Definition: g_local.h:148
int TU
Definition: g_edict.h:88
teammask_t visflags
Definition: g_edict.h:82
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.
Definition: g_actor.cpp:484
#define TEAM_ALL
Definition: g_vis.h:32
cvar_t * g_actorspeed
Definition: g_main.cpp:119
void G_ReactionFireNotifyClientStartMove(const Actor *target)
pos3_t pos
Definition: g_edict.h:55
#define MAX_ROUTE
Definition: defines.h:84
An Edict of type Actor.
Definition: g_edict.h:348
#define ACTOR_SPEED_CROUCHED
Definition: g_move.cpp:38
#define MASK_SOLID
Definition: defines.h:272
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.
Definition: g_move.cpp:270
Definition: line.h:31
#define TU_TURN
Definition: defines.h:73
playermask_t G_VisToPM(teammask_t teamMask)
Converts vis mask to player mask.
Definition: g_client.cpp:186
Definition: grid.h:83
Edict * clientAction
Definition: g_edict.h:113
void G_EventAdd(playermask_t playerMask, int eType, int entnum)
Definition: g_events.cpp:705
char footstepSound[MAX_VAR]
Definition: chr_shared.h:301
pos_t pos3_t[3]
Definition: ufotypes.h:58
int state
Definition: g_edict.h:93
#define PosAddDV(p, crouch, dv)
Definition: mathlib.h:253
actorSizeEnum_t fieldSize
Definition: g_edict.h:141
#define G_IsBlockingMovementActor(ent)
Definition: g_local.h:150
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...
Definition: g_utils.cpp:215
#define VectorCompare(a, b)
Definition: vector.h:63
QGL_EXTERN GLfloat f
Definition: r_gl.h:114
bool G_ReactionFireOnMovement(Actor *target, int step)
Called when 'target' moves, possibly triggering or resolving reaction fire.
Definition: g_reaction.cpp:962
#define G_TeamToVisMask(team)
Definition: g_local.h:143
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.
Definition: g_vis.cpp:376
bool G_FindPath(int team, const Edict *movingActor, const pos3_t from, const pos3_t targetPos, bool crouched, int maxTUs)
Definition: g_move.cpp:107
pathing_t * pathingMap
Definition: g_local.h:106
char name[MAX_QPATH]
Definition: typedefs.h:38
#define G_IsAI(ent)
Definition: g_local.h:141
int contentFlags
Definition: g_edict.h:84
bool G_ActionCheckForCurrentTeam(const Player &player, Actor *ent, int TU)
Checks whether the requested action is possible for the current active team.
Definition: g_client.cpp:380
bool isCrouched() const
Definition: g_edict.h:361
entity_type_t type
Definition: g_edict.h:81
void resetFloor()
Definition: g_edict.h:210
void G_ActorSetTU(Edict *ent, int tus)
Definition: g_actor.cpp:267
functions to handle the storage and lifecycle of all edicts in the game module.
vec3_t origin
Definition: g_edict.h:53
byte steps
Definition: g_local.h:278
void G_EventSpawnFootstepSound(const Edict &ent, const char *sound)
Definition: g_events.cpp:62
vec_t vec3_t[3]
Definition: ufotypes.h:39
unsigned int teammask_t
Definition: g_vis.h:30
void add(pos3_t pos, byte *entSize)
Definition: grid.h:44
#define getDVdir(dv)
Definition: mathlib.h:249
void G_MatchEndCheck(void)
Checks whether there are still actors to fight with left. If none are the match end will be triggered...
Definition: g_match.cpp:280
#define lengthof(x)
Definition: shared.h:105
#define G_IsVisibleForTeam(ent, team)
Definition: g_local.h:144
Edict * G_GetFloorItems(Edict *ent)
Prepares a list of items on the floor at given entity position.
Definition: g_inventory.cpp:59
#define ROUTING_UNREACHABLE
Definition: defines.h:284
short dvec_t
The direction vector tells us where the actor came from (in his previous step). The pathing table hol...
Definition: mathlib.h:236
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...
Definition: g_move.cpp:88
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...
Definition: g_utils.cpp:590
A list of locations that cannot be moved to.
Definition: grid.h:35
void G_SendStats(Edict &ent)
Send stats to network buffer.
Definition: g_stats.cpp:34
static bool G_ActorShouldStopInMidMove(const Edict *ent, int visState, dvec_t *dvtab, int max)
Checks whether the actor should stop movement.
Definition: g_move.cpp:151
Definition: g_edict.h:45
cBspSurface_t * surface
Definition: tracing.h:61
#define ROUTING_NOT_REACHABLE
Definition: defines.h:283
uint8_t byte
Definition: ufotypes.h:34
float G_ActorGetInjuryPenalty(const Edict *const ent, const modifier_types_t type)
Returns the penalty to the given stat caused by the actor wounds.
Definition: g_health.cpp:177
Interface for g_client.cpp.
pos3_t * forbiddenListPos
Definition: g_edict.h:173
byte pos_t
Definition: ufotypes.h:57
#define VIS_STOP
Definition: g_vis.h:40
void G_ActorFall(Edict *ent)
Let an actor fall down if e.g. the func_breakable the actor was standing on was destroyed.
Definition: g_move.cpp:118
#define G_IsBreakable(ent)
Definition: g_local.h:137
level_locals_t level
Definition: g_main.cpp:38
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.
Definition: g_move.cpp:101
int HP
Definition: g_edict.h:89