49 if (activator ==
nullptr)
54 if (entry->
data == activator)
69 if (activator ==
nullptr)
76 entry->
data = activator;
89 if (activator ==
nullptr)
95 if (entry->
data == activator) {
119 trigger->
reset =
nullptr;
122 gi.LinkEdict(trigger);
133 if (activator !=
nullptr && activator->
isSameTeamAs(self)) {
137 Com_sprintf(command,
sizeof(command),
"map %s %s\n",
142 level.nextMapSwitch =
true;
165 gi.BroadcastPrintf(
PRINT_HUD,
_(
"You are now ready to switch the map."));
168 self->
think =
nullptr;
180 gi.DPrintf(
"particle isn't set for %s\n", ent->
classname);
185 gi.DPrintf(
"nextmap isn't set for %s\n", ent->
classname);
191 gi.DPrintf(
"nextmap loop detected\n");
202 ent->
reset =
nullptr;
223 const bool stunEl = (self->
dmgtype ==
gi.csi->damStunElectro);
224 const bool stunGas = (self->
dmgtype ==
gi.csi->damStunGas);
225 const bool shock = (self->
dmgtype ==
gi.csi->damShock);
229 if (stunEl || (stunGas && !isRobot)) {
240 const int gender = activator->
chr.
gender;
268 ent->
reset =
nullptr;
274#define TRIGGER_TOUCH_ONCE (1 << 0)
286 if (!self->
owner()) {
296 gi.DPrintf(
"Owner of %s doesn't have a use function\n", self->
classname);
326 gi.DPrintf(
"No target given for %s\n", ent->
classname);
void expandXY(const float byVal)
expand the box in four directions, but clip them to the maximum boundaries
void getCenter(vec3_t center) const
Calculates the center of the bounding box.
void set(const AABB &other)
Copies the values from the given aabb.
void setInRescueZone(bool inRescueZone_)
Set the rescue zone flag.
bool isSameTeamAs(const Edict *other) const
void(* think)(Edict *self)
bool(* use)(Edict *self, Edict *activator)
void setTouch(bool(*touch_)(Edict *self, Edict *activator))
void setChild(Edict *child)
Player & getPlayer() const
void(* reset)(Edict *self, Edict *activator)
linkedList_t * touchedList
void G_ActorSetClientAction(Edict *actor, Edict *ent)
Handles the client actions (interaction with the world).
bool G_IsLivingActor(const Edict *ent)
Checks whether the given edict is a living actor.
void G_ClientPrintf(const Player &player, int printLevel, const char *fmt,...)
Interface for g_client.cpp.
int G_ApplyProtection(const Edict *target, const byte dmgWeight, int damage)
Reduces damage by armour and natural protection.
void G_CheckDeathOrKnockout(Actor *target, Actor *attacker, const fireDef_t *fd, int damage)
All parts of the main game logic that are combat related.
Actor * makeActor(Edict *ent)
Convert an Edict pointer into an Actor pointer.
Edict * G_EdictsFindTargetEntity(const char *target)
Searches the edict that has the given target as targetname set.
functions to handle the storage and lifecycle of all edicts in the game module.
void G_EventCenterViewAt(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.
void G_EventSpawnSound(playermask_t playerMask, const Edict &ent, const vec3_t origin, const char *sound)
Spawns a sound (that will be spatialized on the client side).
#define G_PlayerToPM(player)
void G_DamageActor(Edict *target, const int damage, const vec3_t impact)
Deals damage and causes wounds.
#define G_TagMalloc(size, tag)
#define G_IsMultiPlayer()
#define FL_CLIENTACTION
Edict flag to indicate, that the edict can be used in the context of a client action.
void G_MatchEndTrigger(int team, int timeGap)
Triggers the end of the game. Will be executed in the next server (or game) frame.
Edict * G_Spawn(const char *classname)
Either finds a free edict, or allocates a new one.
Edict * G_SpawnParticle(const vec3_t origin, int spawnflags, const char *particle)
Brings new objects into the world.
static void Reset_TouchTrigger(Edict *self, Edict *activator)
void SP_trigger_touch(Edict *ent)
Touch trigger to call the use function of the attached target.
void SP_trigger_nextmap(Edict *ent)
Edict * G_TriggerSpawn(Edict *owner)
void G_TriggerAddToList(Edict *self, Edict *activator)
Adds the activator to the list of recognized edicts for this trigger_touch edict.
static void Reset_RescueTrigger(Edict *self, Edict *activator)
static bool Touch_NextMapTrigger(Edict *self, Edict *activator)
Next map trigger that is going to get active once all opponents are killed.
#define TRIGGER_TOUCH_ONCE
static bool Touch_RescueTrigger(Edict *self, Edict *activator)
Rescue trigger.
void SP_trigger_hurt(Edict *ent)
Trigger for grid fields if they are under fire.
void Think_NextMapTrigger(Edict *self)
Register this think function once you would like to end the match This think function will register t...
bool G_TriggerIsInList(Edict *self, Edict *activator)
Checks whether the activator of this trigger_touch was already recognized.
static bool Touch_TouchTrigger(Edict *self, Edict *activator)
Touch trigger.
bool G_TriggerRemoveFromList(Edict *self, Edict *activator)
Removes an activator from the list of recognized edicts.
bool Touch_HurtTrigger(Edict *self, Edict *activator)
Hurt trigger.
void SP_trigger_rescue(Edict *ent)
Rescue trigger to mark an actor to be in the rescue zone. Aborting a game would not kill the actors i...
bool G_UseEdict(Edict *ent, Edict *activator)
Call the 'use' function for the given edict and all its group members.
void G_FreeEdict(Edict *ent)
Marks the edict as free.
Misc utility functions for game module.
#define VecToPos(v, p)
Map boundary is +/- MAX_WORLD_WIDTH - to get into the positive area we add the possible max negative ...
void Q_strncpyz(char *dest, const char *src, size_t destsize)
Safe strncpy that ensures a trailing zero.
bool Com_sprintf(char *dest, size_t size, const char *fmt,...)
copies formatted string with buffer-size checking
const teamDef_t * teamDef
const char * getActorSound(int gender, actorSound_t soundType) const