UFO: Alien Invasion
Loading...
Searching...
No Matches
g_reaction.h File Reference

Reaction fire system. More...

#include "g_local.h"
Include dependency graph for g_reaction.h:
This graph shows which files directly or indirectly include this file:

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.
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).
void G_ReactionFireReset (int team)
 Guess! Reset all "shaken" states on end of turn?
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.
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.
bool G_ReactionFireOnMovement (Actor *target, int step)
 Called when 'target' moves, possibly triggering or resolving reaction fire.
void G_ReactionFireOnEndTurn (void)
 Called at the end of turn, all outstanding reaction fire is resolved.
void G_ReactionFireOnDead (const Actor *target)
 Removes the given target from the reaction fire lists.
void G_ReactionFireTargetsInit (void)
 free function to initialize the reaction fire table for all entities.
void G_ReactionFireTargetsCreate (const Edict *shooter)
 free function to create a table of reaction fire targets for the given edict.
void G_ReactionFireTargetsDestroy (const Edict *shooter)
 free function to destroy the table of reaction fire targets for the given edict.

Detailed Description

Reaction fire system.

Definition in file g_reaction.h.

Function Documentation

◆ G_ReactionFireNotifyClientEndMove()

void G_ReactionFireNotifyClientEndMove ( const Actor * target)

Definition at line 1081 of file g_reaction.cpp.

References Edict::moveinfo, rft, and moveinfo_t::steps.

Referenced by G_ClientMove().

◆ G_ReactionFireNotifyClientRFAborted()

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

Definition at line 1086 of file g_reaction.cpp.

References rft.

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

◆ G_ReactionFireNotifyClientStartMove()

void G_ReactionFireNotifyClientStartMove ( const Actor * target)

Definition at line 1075 of file g_reaction.cpp.

References MAX_ROUTE, and rft.

Referenced by G_ClientMove().

◆ G_ReactionFireOnDead()

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

Referenced by G_ActorDieOrStun().

◆ G_ReactionFireOnEndTurn()

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 rft.

Referenced by G_ClientEndRound().

◆ G_ReactionFireOnMovement()

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 rf.

Referenced by G_ClientMove().

◆ G_ReactionFirePostShot()

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 G_ReactionFireNotifyClientEndShot(), MAX_ROUTE, and rf.

Referenced by G_ClientShoot().

◆ G_ReactionFirePreShot()

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 G_EdictsGetNextLivingActor(), G_ReactionFireGetTUsForItem(), G_ReactionFireNotifyClientRFAborted(), G_ReactionFireNotifyClientStartShot(), MAX_ROUTE, rf, and rft.

Referenced by G_ClientShoot().

◆ G_ReactionFireReset()

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

◆ G_ReactionFireSettingsReserveTUs()

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_t::crouch, G_ActorGetTUForReactionFire(), G_ActorReserveTUs(), G_ReactionFireCanBeEnabled(), G_ReactionFireSettingsSetDefault(), character_t::reservedTus, and chrReservations_t::shot.

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

◆ 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_t::RFmode, FiremodeSettings::set(), STATE_REACTION, and Edict::visflags.

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

◆ G_ReactionFireTargetsCreate()

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 rft.

Referenced by G_ClientGetFreeSpawnPointForActorSize().

◆ G_ReactionFireTargetsDestroy()

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 rft.

Referenced by G_ActorDieOrStun().

◆ G_ReactionFireTargetsInit()

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 rft.

Referenced by G_SpawnEntities().