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

Reaction fire system. More...

#include "g_local.h"

Go to the source code of this file.

Functions

void G_ReactionFirePreShot (const Actor *target, const int fdTime)
 Called when 'target' is about to shoot, this forces a 'draw' to decide who gets the first shot. More...
 
void G_ReactionFirePostShot (Actor *target)
 Called after 'target' has fired, this might trigger more reaction fire or resolve outstanding reaction fire (because target is out of time) More...
 
void G_ReactionFireReset (int team)
 Guess! Reset all "shaken" states on end of turn? More...
 
void G_ReactionFireNotifyClientStartMove (const Actor *target)
 
void G_ReactionFireNotifyClientEndMove (const Actor *target)
 
void G_ReactionFireSettingsUpdate (Actor *actor, fireDefIndex_t fmIdx, actorHands_t hand, const objDef_t *od)
 Updates the reaction fire settings in case something was moved into a hand or from a hand that would make the current settings invalid. More...
 
void G_ReactionFireNotifyClientRFAborted (const Actor *shooter, const Edict *target, int step)
 
bool G_ReactionFireSettingsReserveTUs (Actor *ent)
 Set the reaction fire TU reservation for an actor. More...
 
bool G_ReactionFireOnMovement (Actor *target, int step)
 Called when 'target' moves, possibly triggering or resolving reaction fire. More...
 
void G_ReactionFireOnEndTurn (void)
 Called at the end of turn, all outstanding reaction fire is resolved. More...
 
void G_ReactionFireOnDead (const Actor *target)
 Removes the given target from the reaction fire lists. More...
 
void G_ReactionFireTargetsInit (void)
 free function to initialize the reaction fire table for all entities. More...
 
void G_ReactionFireTargetsCreate (const Edict *shooter)
 free function to create a table of reaction fire targets for the given edict. More...
 
void G_ReactionFireTargetsDestroy (const Edict *shooter)
 free function to destroy the table of reaction fire targets for the given edict. More...
 

Detailed Description

Reaction fire system.

Definition in file g_reaction.h.

Function Documentation

void G_ReactionFireNotifyClientEndMove ( const Actor target)
void G_ReactionFireNotifyClientRFAborted ( const Actor shooter,
const Edict target,
int  step 
)
void G_ReactionFireNotifyClientStartMove ( const Actor target)

Definition at line 1075 of file g_reaction.cpp.

References MAX_ROUTE, and ReactionFireTargets::notifyClientMove().

Referenced by G_ClientMove().

void G_ReactionFireOnDead ( const Actor target)

Removes the given target from the reaction fire lists.

Parameters
[in]targetThe target to remove from the lists

Definition at line 1030 of file g_reaction.cpp.

References G_IsDead, ReactionFire::resetTargets(), and ReactionFire::updateAllTargets().

Referenced by G_ActorDieOrStun().

void G_ReactionFireOnEndTurn ( void  )

Called at the end of turn, all outstanding reaction fire is resolved.

See also
G_ClientEndRound

Definition at line 1054 of file g_reaction.cpp.

References ReactionFireTargets::reset().

Referenced by G_ClientEndRound().

bool G_ReactionFireOnMovement ( Actor target,
int  step 
)

Called when 'target' moves, possibly triggering or resolving reaction fire.

Parameters
[in]targetThe target entity
[in]stepThe number of the step in the move we are checking reactions for
Returns
true If any shots were (or would be) taken
See also
G_ClientMove

Definition at line 962 of file g_reaction.cpp.

References ReactionFire::checkExecution(), ReactionFire::notifyClientOnStep(), and ReactionFire::updateAllTargets().

Referenced by G_ClientMove().

void G_ReactionFirePostShot ( Actor target)

Called after 'target' has fired, this might trigger more reaction fire or resolve outstanding reaction fire (because target is out of time)

Parameters
[in]targetThe entity that has just fired
See also
G_ClientShoot

Definition at line 1042 of file g_reaction.cpp.

References ReactionFire::checkExecution(), G_ReactionFireNotifyClientEndShot(), MAX_ROUTE, and ReactionFire::notifyClientOnShot().

Referenced by G_ClientShoot().

void G_ReactionFirePreShot ( const Actor target,
const int  fdTime 
)

Called when 'target' is about to shoot, this forces a 'draw' to decide who gets the first shot.

Parameters
[in]targetThe entity about to shoot
[in]fdTimeThe TU of the shot
See also
G_ClientShoot

Definition at line 994 of file g_reaction.cpp.

References ReactionFireTargets::advance(), G_EdictsGetNextLivingActor(), G_ReactionFireGetTUsForItem(), G_ReactionFireNotifyClientRFAborted(), G_ReactionFireNotifyClientStartShot(), ReactionFireTargets::hasExpired(), MAX_ROUTE, ReactionFire::notifyClientOnShot(), ReactionFire::tryToShoot(), and ReactionFire::updateAllTargets().

Referenced by G_ClientShoot().

void G_ReactionFireReset ( int  team)

Guess! Reset all "shaken" states on end of turn?

Note
Normally called on end of turn.
See also
G_ClientStateChange
Parameters
[in]teamIndex of team to loop through.

Definition at line 1066 of file g_reaction.cpp.

References G_EdictsGetNextLivingActorOfTeam(), and Actor::removeShaken().

Referenced by G_ClientEndRound().

bool G_ReactionFireSettingsReserveTUs ( Actor ent)

Set the reaction fire TU reservation for an actor.

Parameters
[in,out]entThe actor edict to set the TUs for
Returns
true if TUs for reaction fire were reserved, false if the reservation was set back to 0

Definition at line 665 of file g_reaction.cpp.

References Edict::chr, chrReservations_s::crouch, G_ActorGetTUForReactionFire(), G_ActorReserveTUs(), G_ReactionFireCanBeEnabled(), G_ReactionFireSettingsSetDefault(), character_s::reservedTus, and chrReservations_s::shot.

Referenced by G_ClientInitActorStates(), G_ClientStateChange(), and G_ReactionFireSettingsUpdate().

void G_ReactionFireSettingsUpdate ( Actor actor,
fireDefIndex_t  fmIdx,
actorHands_t  hand,
const objDef_t od 
)

Updates the reaction fire settings in case something was moved into a hand or from a hand that would make the current settings invalid.

Parameters
[in,out]actorThe actor edict to check the settings for
[in]fmIdxThe fire mode index that should be used for reaction fire
[in]handThe hand that should be used for reaction fire
[in]odThe object/weapon for the reaction fire

Definition at line 555 of file g_reaction.cpp.

References Edict::chr, G_ActorHasWorkingFireModeSet(), G_ClientStateChange(), G_EventReactionFireChange(), G_EventSendState(), G_ReactionFireSettingsReserveTUs(), G_VisToPM(), Edict::getPlayer(), Actor::isReaction(), character_s::RFmode, FiremodeSettings::set(), STATE_REACTION, and Edict::visflags.

Referenced by AI_TryToReloadWeapon(), G_ActorInvMove(), G_ClientAction(), G_ClientInitActorStates(), and G_ClientShoot().

void G_ReactionFireTargetsCreate ( const Edict shooter)

free function to create a table of reaction fire targets for the given edict.

Parameters
[in]shooterThe reaction firing actor

Definition at line 436 of file g_reaction.cpp.

References ReactionFireTargets::create().

Referenced by G_ClientGetFreeSpawnPointForActorSize().

void G_ReactionFireTargetsDestroy ( const Edict shooter)

free function to destroy the table of reaction fire targets for the given edict.

Parameters
[in]shooterThe reaction firing actor

Definition at line 445 of file g_reaction.cpp.

References ReactionFireTargets::destroy().

Referenced by G_ActorDieOrStun().

void G_ReactionFireTargetsInit ( void  )

free function to initialize the reaction fire table for all entities.

Definition at line 427 of file g_reaction.cpp.

References ReactionFireTargets::init().

Referenced by G_SpawnEntities().