UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ReactionFireTargets Class Reference

A table with all the relations between all shooters and all their targets. More...

Public Member Functions

void init ()
 Initialize the reaction fire table for all entities. More...
 
void add (const Edict *shooter, const Edict *target, const int tusForShot)
 Add a reaction fire target for the given shooter. More...
 
void remove (const Edict *shooter, const Edict *target)
 Remove a reaction fire target for the given shooter. More...
 
bool hasExpired (const Edict *shooter, const Edict *target, const int tusTarget)
 Check if the given shooter is ready to reaction fire at the given target. More...
 
int getTriggerTUs (const Edict *shooter, const Edict *target)
 Check if the given shooter is ready to reaction fire at the given target. More...
 
void advance (const Edict *shooter, const int tusShot)
 Increase the triggertime for the next RF shot for all targets of the shooter (after a reaction fire). More...
 
void reset ()
 Reset the target count in the reaction fire table for all entities. More...
 
void notifyClientMove (const Edict *target, int step, bool startMove)
 
void notifyClientOnStep (const Edict *target, int step)
 
void create (const Edict *shooter)
 Create a table of reaction fire targets for the given edict. More...
 
void destroy (const Edict *shooter)
 Destroys the table of reaction fire targets for the given edict. More...
 
void resetTargetList (const Edict *shooter)
 
void notifyClientOnShot (const Edict *target, int step)
 
void notifyClientRFAborted (const Edict *shooter, const Edict *target, int step)
 

Private Member Functions

ReactionFireTargetListfind (const Edict *shooter)
 Find the given edict's table of reaction fire targets. More...
 

Private Attributes

ReactionFireTargetList rfData [MAX_RF_DATA]
 

Detailed Description

A table with all the relations between all shooters and all their targets.

Definition at line 121 of file g_reaction.cpp.

Member Function Documentation

void ReactionFireTargets::add ( const Edict shooter,
const Edict target,
const int  tusForShot 
)

Add a reaction fire target for the given shooter.

Parameters
[in]shooterThe reaction firing actor
[in]targetThe potential reaction fire victim
[in]tusForShotThe TUs needed for the shot

Definition at line 293 of file g_reaction.cpp.

References Com_Printf(), ReactionFireTargetList::count, find(), G_EventReactionFireAddTarget(), G_IsAlien, G_IsCivilian, i, MAX_RF_TARGETS, Edict::moveinfo, Edict::number, moveinfo_s::steps, ReactionFireTarget::target, ReactionFireTargetList::targets, ReactionFireTarget::triggerTUs, and Edict::TU.

Referenced by ReactionFire::updateAllTargets().

void ReactionFireTargets::advance ( const Edict shooter,
const int  tusShot 
)

Increase the triggertime for the next RF shot for all targets of the shooter (after a reaction fire).

Parameters
[in]shooterThe reaction firing actor
[in]tusShotThe TUs the shooter will need for the next shot

Definition at line 413 of file g_reaction.cpp.

References ReactionFireTargetList::count, find(), i, ReactionFireTargetList::targets, and ReactionFireTarget::triggerTUs.

Referenced by ReactionFire::checkExecution(), and G_ReactionFirePreShot().

void ReactionFireTargets::create ( const Edict shooter)

Create a table of reaction fire targets for the given edict.

Parameters
[in]shooterThe reaction firing actor

Definition at line 253 of file g_reaction.cpp.

References ReactionFireTargetList::entnum, find(), Edict::getIdNum(), gi, i, MAX_RF_DATA, RF_NO_ENTNUM, and rfData.

Referenced by G_ReactionFireTargetsCreate().

void ReactionFireTargets::destroy ( const Edict shooter)

Destroys the table of reaction fire targets for the given edict.

Parameters
[in]shooterThe reaction firing actor

Definition at line 275 of file g_reaction.cpp.

References find(), gi, and ReactionFireTargetList::init().

Referenced by G_ReactionFireTargetsDestroy().

ReactionFireTargetList * ReactionFireTargets::find ( const Edict shooter)
private

Find the given edict's table of reaction fire targets.

Parameters
[in]shooterThe reaction firing actor

Definition at line 237 of file g_reaction.cpp.

References ReactionFireTargetList::entnum, Edict::getIdNum(), i, MAX_RF_DATA, and rfData.

Referenced by add(), advance(), create(), destroy(), getTriggerTUs(), hasExpired(), notifyClientRFAborted(), remove(), and resetTargetList().

int ReactionFireTargets::getTriggerTUs ( const Edict shooter,
const Edict target 
)

Check if the given shooter is ready to reaction fire at the given target.

Parameters
[in]shooterThe reaction firing actor
[in]targetThe potential reaction fire victim
Returns
The TUs the target will need to reach until the RF shot goes off.

Definition at line 364 of file g_reaction.cpp.

References ReactionFireTargetList::count, find(), i, ReactionFireTarget::target, ReactionFireTargetList::targets, and ReactionFireTarget::triggerTUs.

bool ReactionFireTargets::hasExpired ( const Edict shooter,
const Edict target,
const int  tusTarget 
)

Check if the given shooter is ready to reaction fire at the given target.

Parameters
[in]shooterThe reaction firing actor
[in]targetThe potential reaction fire victim
[in]tusTargetThe TUs the target will need for the shot, 0 for just moving

Definition at line 389 of file g_reaction.cpp.

References ReactionFireTargetList::count, find(), i, ReactionFireTarget::target, ReactionFireTargetList::targets, ReactionFireTarget::triggerTUs, and Edict::TU.

Referenced by ReactionFire::checkExecution(), and G_ReactionFirePreShot().

void ReactionFireTargets::init ( void  )

Initialize the reaction fire table for all entities.

Definition at line 149 of file g_reaction.cpp.

References i, ReactionFireTargetList::init(), MAX_RF_DATA, and rfData.

Referenced by G_ReactionFireTargetsInit().

void ReactionFireTargets::notifyClientRFAborted ( const Edict shooter,
const Edict target,
int  step 
)
void ReactionFireTargets::remove ( const Edict shooter,
const Edict target 
)

Remove a reaction fire target for the given shooter.

Parameters
[in]shooterThe reaction firing actor
[in]targetThe potential reaction fire victim

Definition at line 323 of file g_reaction.cpp.

References Com_Printf(), ReactionFireTargetList::count, find(), G_EventReactionFireRemoveTarget(), G_IsAlien, G_IsCivilian, i, Edict::moveinfo, Edict::number, moveinfo_s::steps, ReactionFireTarget::target, ReactionFireTargetList::targets, and ReactionFireTarget::triggerTUs.

Referenced by ReactionFire::tryToShoot(), and ReactionFire::updateAllTargets().

void ReactionFireTargets::reset ( void  )

Reset the target count in the reaction fire table for all entities.

Definition at line 159 of file g_reaction.cpp.

References i, MAX_RF_DATA, ReactionFireTargetList::reset(), and rfData.

Referenced by G_ReactionFireOnEndTurn().

void ReactionFireTargets::resetTargetList ( const Edict shooter)

Field Documentation

ReactionFireTargetList ReactionFireTargets::rfData[MAX_RF_DATA]
private

The documentation for this class was generated from the following file: