UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
g_trigger.cpp File Reference

Trigger functions. More...

#include "g_trigger.h"
#include "g_client.h"
#include "g_combat.h"
#include "g_actor.h"
#include "g_edicts.h"
#include "g_match.h"
#include "g_spawn.h"
#include "g_utils.h"
#include "g_health.h"

Go to the source code of this file.

Macros

#define TRIGGER_TOUCH_ONCE   (1 << 0)
 

Functions

bool G_TriggerIsInList (Edict *self, Edict *activator)
 Checks whether the activator of this trigger_touch was already recognized. More...
 
void G_TriggerAddToList (Edict *self, Edict *activator)
 Adds the activator to the list of recognized edicts for this trigger_touch edict. More...
 
bool G_TriggerRemoveFromList (Edict *self, Edict *activator)
 Removes an activator from the list of recognized edicts. More...
 
EdictG_TriggerSpawn (Edict *owner)
 
static bool Touch_NextMapTrigger (Edict *self, Edict *activator)
 Next map trigger that is going to get active once all opponents are killed. More...
 
void Think_NextMapTrigger (Edict *self)
 Register this think function once you would like to end the match This think function will register the touch callback and spawns the particles for the client to see the next map trigger. More...
 
void SP_trigger_nextmap (Edict *ent)
 
bool Touch_HurtTrigger (Edict *self, Edict *activator)
 Hurt trigger. More...
 
void SP_trigger_hurt (Edict *ent)
 Trigger for grid fields if they are under fire. More...
 
static bool Touch_TouchTrigger (Edict *self, Edict *activator)
 Touch trigger. More...
 
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. More...
 
static bool Touch_RescueTrigger (Edict *self, Edict *activator)
 Rescue trigger. More...
 
static void Reset_RescueTrigger (Edict *self, Edict *activator)
 
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 inside this trigger area. More...
 

Detailed Description

Trigger functions.

Definition in file g_trigger.cpp.

Macro Definition Documentation

#define TRIGGER_TOUCH_ONCE   (1 << 0)

Definition at line 274 of file g_trigger.cpp.

Referenced by Reset_TouchTrigger(), and Touch_TouchTrigger().

Function Documentation

void G_TriggerAddToList ( Edict self,
Edict activator 
)

Adds the activator to the list of recognized edicts for this trigger_touch edict.

Parameters
selfThe trigger self pointer
activatorThe activating edict (might be nullptr)

Definition at line 67 of file g_trigger.cpp.

References linkedList_t::data, G_TagMalloc, G_TriggerIsInList(), linkedList_t::next, and TAG_LEVEL.

Referenced by G_TouchTriggers(), and Touch_Breakable().

bool G_TriggerIsInList ( Edict self,
Edict activator 
)

Checks whether the activator of this trigger_touch was already recognized.

Parameters
selfThe trigger self pointer
activatorThe activating edict (might be nullptr)
Returns
true if the activator is already in the list of recognized edicts or no activator was given, false if the activator is not yet part of the list

Definition at line 47 of file g_trigger.cpp.

References linkedList_t::data, and linkedList_t::next.

Referenced by G_ResetTriggers(), and G_TriggerAddToList().

bool G_TriggerRemoveFromList ( Edict self,
Edict activator 
)

Removes an activator from the list of recognized edicts.

Parameters
selfThe trigger self pointer
activatorThe activating edict (might be nullptr)
Returns
true if removal was successful or not needed, false if the activator wasn't found in the list

Definition at line 87 of file g_trigger.cpp.

References linkedList_t::data, G_MemFree, and linkedList_t::next.

Referenced by Destroy_Breakable(), and G_ResetTriggers().

static void Reset_RescueTrigger ( Edict self,
Edict activator 
)
static

Definition at line 359 of file g_trigger.cpp.

References G_IsActor, makeActor(), and Actor::setInRescueZone().

Referenced by SP_trigger_rescue().

static void Reset_TouchTrigger ( Edict self,
Edict activator 
)
static

Definition at line 306 of file g_trigger.cpp.

References FL_CLIENTACTION, G_ActorSetClientAction(), G_UseEdict(), and TRIGGER_TOUCH_ONCE.

Referenced by SP_trigger_touch().

void SP_trigger_hurt ( Edict ent)

Trigger for grid fields if they are under fire.

Note
Called once for every step
See also
Touch_HurtTrigger

Definition at line 255 of file g_trigger.cpp.

References Edict::classname, game_import_s::csi, csi_s::damFire, Edict::dmg, Edict::dmgtype, ET_TRIGGER_HURT, gi, Edict::model, Edict::reset, Edict::setChild(), Edict::setTouch(), Edict::solid, SOLID_TRIGGER, Touch_HurtTrigger(), and Edict::type.

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 inside this trigger area.

Note
Called once for every step
See also
Touch_RescueTrigger

Definition at line 375 of file g_trigger.cpp.

References Edict::classname, ET_TRIGGER_RESCUE, G_FreeEdict(), G_IsMultiPlayer, gi, Edict::model, Edict::reset, Reset_RescueTrigger(), Edict::setChild(), Edict::setTouch(), Edict::solid, SOLID_TRIGGER, Edict::spawnflags, Touch_RescueTrigger(), and Edict::type.

void SP_trigger_touch ( Edict ent)

Touch trigger to call the use function of the attached target.

Note
Called once for every step
See also
Touch_TouchTrigger

Definition at line 320 of file g_trigger.cpp.

References Edict::classname, ET_TRIGGER_TOUCH, G_FreeEdict(), gi, Edict::model, Edict::reset, Reset_TouchTrigger(), Edict::setChild(), Edict::setTouch(), Edict::solid, SOLID_TRIGGER, Edict::target, Touch_TouchTrigger(), and Edict::type.

void Think_NextMapTrigger ( Edict self)

Register this think function once you would like to end the match This think function will register the touch callback and spawns the particles for the client to see the next map trigger.

Definition at line 153 of file g_trigger.cpp.

References _, G_EventCenterViewAt(), G_SpawnParticle(), gi, PM_ALL, PRINT_HUD, Touch_NextMapTrigger(), and VecToPos.

Referenced by G_MatchEndTrigger().

static bool Touch_NextMapTrigger ( Edict self,
Edict activator 
)
static
static bool Touch_RescueTrigger ( Edict self,
Edict activator 
)
static

Rescue trigger.

See also
SP_trigger_resuce

Definition at line 345 of file g_trigger.cpp.

References G_IsActor, G_IsDead, makeActor(), and Actor::setInRescueZone().

Referenced by SP_trigger_rescue().

static bool Touch_TouchTrigger ( Edict self,
Edict activator 
)
static