86 gi.DPrintf(
"Invalid edict num %i\n", num);
90 return g_edicts + num;
116 assert(lastEnt >= g_edicts);
117 assert(lastEnt < endOfEnts);
119 Edict* ent = lastEnt;
122 if (ent >= endOfEnts)
131 if (duplicate ==
nullptr)
133 memcpy(duplicate, edict,
sizeof(*edict));
143 Edict* ent =
nullptr;
168 Edict* ent = lastEnt;
183 Edict* ent = lastEnt;
198 Edict* ent = lastEnt;
205 Sys_Error(
"dynamic_cast to Actor failed.");
218 Actor* actor = lastEnt;
233 Edict* ent = lastEnt;
242 Sys_Error(
"dynamic_cast to Actor failed.");
256 Actor* actor =
nullptr;
272 Actor* actor =
nullptr;
292 Edict* ent =
nullptr;
310 Edict* ent =
nullptr;
335 Sys_Error(
"Unexpected non-Actor Edict found.");
388 return selfControlled ? !actControlled : actControlled;
390 bool opponent =
true;
394 opponent = !actControlled;
398 opponent =
G_IsAlien(actor) || actControlled;
407 return selfControlled ? !opponent : opponent;
Edict * G_EdictsGetFirst(void)
Returns the first entity.
Edict * G_EdictsGetNextInUse(Edict *lastEnt)
Iterate through the entities that are in use.
bool isSameTeamAs(const Edict *other) const
void Sys_Error(const char *error,...)
#define G_IsState(ent, s)
Actor * G_EdictsGetActorByUCN(const int ucn, const int team)
Searches an actor by a unique character number.
Actor * G_EdictsGetNextLivingActor(Actor *lastEnt)
Iterate through the living actor entities.
linkedList_t * touchedList
int G_EdictsGetNumber(const Edict *ent)
Get an entity's ID number.
Actor * G_EdictsGetLivingActorFromPos(const pos3_t pos)
Searches an actor at the given grid location.
bool(* use)(Edict *self, Edict *activator)
Actor * makeActor(Edict *ent)
Convert an Edict pointer into an Actor pointer.
Edict * G_EdictDuplicate(const Edict *edict)
bool G_IsLivingActor(const Edict *ent)
Checks whether the given edict is a living actor.
Edict * G_EdictsFindTargetEntity(const char *target)
Searches the edict that has the given target as targetname set.
camera_edict_data_t camera
Edict * G_EdictsGetNewEdict(void)
Find an entity that is not in use.
void(* think)(Edict *self)
#define G_IsCivilian(ent)
bool isOpponent(const Actor *actor) const
Check if given actor is an enemy.
#define G_TagMalloc(size, tag)
void(* reset)(Edict *self, Edict *activator)
#define G_IsTriggerNextMap(ent)
actorSizeEnum_t fieldSize
#define VectorCompare(a, b)
Edict * G_EdictsGetTriggerNextMaps(Edict *lastEnt)
Iterator through all the trigger_nextmap edicts.
bool G_EdictsIsValidNum(const int num)
Check if the given number could point to an existing entity.
Actor * G_EdictsGetNextLivingActorOfTeam(Actor *lastEnt, const int team)
Iterate through the living actor entities of the given team.
Actor * G_EdictsGetNextActor(Actor *lastEnt)
Iterate through the actor entities (even the dead!)
functions to handle the storage and lifecycle of all edicts in the game module.
bool(* destroy)(Edict *self)
void G_EdictsInit(void)
Reset the entity pointers for eg. a new game.
#define SERVER_FRAME_SECONDS
Edict * G_EdictsGetByNum(const int num)
Get an entity by it's number.
Edict * G_EdictsConstruct(void)
Allocate space for the entity pointers.
void G_EdictsThink(void)
Called every frame to let the edicts tick.
#define ACTOR_SIZE_INVALID
bool isState(int flag) const
Edict * G_EdictsGetNext(Edict *lastEnt)
Iterate through the list of entities.
pos3_t * forbiddenListPos
bool(* _touch)(Edict *self, Edict *activator)