UFO: Alien Invasion
Loading...
Searching...
No Matches
ReactionFireTargets Class Reference

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

Collaboration diagram for ReactionFireTargets:
Collaboration graph

Public Member Functions

void init ()
 Initialize the reaction fire table for all entities.
void add (const Edict *shooter, const Edict *target, const int tusForShot)
 Add a reaction fire target for the given shooter.
void remove (const Edict *shooter, const Edict *target)
 Remove a reaction fire target for the given shooter.
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.
int getTriggerTUs (const Edict *shooter, const Edict *target)
 Check if the given shooter is ready to reaction fire at the given target.
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).
void reset ()
 Reset the target count in the reaction fire table for all entities.
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.
void destroy (const Edict *shooter)
 Destroys the table of reaction fire targets for the given edict.
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.

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

◆ add()

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_t::steps, ReactionFireTarget::target, ReactionFireTargetList::targets, ReactionFireTarget::triggerTUs, and Edict::TU.

◆ advance()

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.

◆ create()

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 data, find(), Edict::getIdNum(), gi, i, MAX_RF_DATA, RF_NO_ENTNUM, and rfData.

◆ destroy()

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().

◆ find()

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().

◆ getTriggerTUs()

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.

◆ hasExpired()

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.

◆ init()

void ReactionFireTargets::init ( void )

Initialize the reaction fire table for all entities.

Definition at line 149 of file g_reaction.cpp.

References i, MAX_RF_DATA, and rfData.

◆ notifyClientMove()

◆ notifyClientOnShot()

◆ notifyClientOnStep()

◆ notifyClientRFAborted()

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

◆ remove()

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_t::steps, ReactionFireTarget::target, ReactionFireTargetList::targets, and ReactionFireTarget::triggerTUs.

Referenced by resetTargetList().

◆ reset()

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, and rfData.

◆ resetTargetList()

void ReactionFireTargets::resetTargetList ( const Edict * shooter)

Field Documentation

◆ rfData

ReactionFireTargetList ReactionFireTargets::rfData[MAX_RF_DATA]
private

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