UFO: Alien Invasion
ReactionFire Class Reference
Collaboration diagram for ReactionFire:
Collaboration graph

Public Member Functions

void notifyClientOnStep (const Edict *target, int step)
 
bool checkExecution (const Edict *target, int step)
 Check all entities to see whether target has caused reaction fire to resolve. More...
 
void updateAllTargets (const Edict *target)
 Check whether 'target' has just triggered any new reaction fire. More...
 
bool tryToShoot (Actor *shooter, const Edict *target)
 Resolve the reaction fire for an entity, this checks that the entity can fire and then takes the shot. More...
 
bool isInWeaponRange (const Actor *shooter, const Edict *target, const fireDef_t *fd) const
 
const fireDef_tgetFireDef (const Actor *shooter) const
 Get the fireDef for the RF settings of the shooter. More...
 
void resetTargets (const Edict *shooter)
 
void notifyClientOnShot (const Edict *target, int tusTarget)
 

Private Member Functions

bool isEnemy (const Actor *shooter, const Edict *target) const
 Check whether we want to shoot at the target. More...
 
bool canReact (Actor *shooter, const Edict *target) const
 Check whether shooter can reaction fire at target at all. More...
 
bool canSee (const Actor *shooter, const Edict *target) const
 Check whether shooter can see his target well enough. More...
 
bool shoot (Actor *shooter, const pos3_t at, shoot_types_t type, fireDefIndex_t firemode)
 Perform the reaction fire shot. More...
 
bool isPossible (Actor *shooter, const Edict *target) const
 

Detailed Description

Definition at line 450 of file g_reaction.cpp.

Member Function Documentation

◆ canReact()

bool ReactionFire::canReact ( Actor shooter,
const Edict target 
) const
private

Check whether shooter can reaction fire at target at all.

Parameters
[in]shooterThe entity that might be firing
[in]targetThe entity that might be fired at

Definition at line 716 of file g_reaction.cpp.

References Edict::chr, FiremodeSettings::getFmIdx(), FiremodeSettings::getHand(), Edict::getHandItem(), Edict::getIdNum(), gi, Actor::isDazed(), Actor::isReaction(), character_t::name, Actor::removeReaction(), and character_t::RFmode.

Referenced by isPossible().

◆ canSee()

bool ReactionFire::canSee ( const Actor shooter,
const Edict target 
) const
private

Check whether shooter can see his target well enough.

Parameters
[in]shooterThe entity that might be firing
[in]targetThe entity that might be fired at

Definition at line 742 of file g_reaction.cpp.

References ACTOR_VIS_10, G_ActorVis(), G_FrustumVis(), G_IsVisibleForTeam, G_VisCheckDist(), Edict::getTeam(), Edict::origin, and VectorDistSqr.

Referenced by isPossible().

◆ checkExecution()

bool ReactionFire::checkExecution ( const Edict target,
int  step 
)

Check all entities to see whether target has caused reaction fire to resolve.

Parameters
[in]targetThe entity that might be resolving reaction fire
[in]stepThe number of the step in the move we are checking reactions for
Returns
whether any entity fired (or would fire) upon target
See also
G_ReactionFireOnMovement
G_ReactionFirePostShot

Definition at line 900 of file g_reaction.cpp.

References ReactionFireTargets::advance(), G_EdictsGetNextLivingActor(), G_ReactionFireGetTUsForItem(), G_ReactionFireNotifyClientRFAborted(), ReactionFireTargets::hasExpired(), rf, rft, and tryToShoot().

Referenced by G_ReactionFireOnMovement(), and G_ReactionFirePostShot().

◆ getFireDef()

const fireDef_t * ReactionFire::getFireDef ( const Actor shooter) const

Get the fireDef for the RF settings of the shooter.

Parameters
[in]shooterThe reaction firing actor
Returns
nullptr if something is wrong

Definition at line 475 of file g_reaction.cpp.

References Item::ammoDef(), Edict::chr, Item::getFiredefs(), FiremodeSettings::getFmIdx(), FiremodeSettings::getHand(), Edict::getHandItem(), FiremodeSettings::isSaneFiremode(), Item::isWeapon(), Item::mustReload(), and character_t::RFmode.

Referenced by G_ReactionFireGetTUsForItem().

◆ isEnemy()

bool ReactionFire::isEnemy ( const Actor shooter,
const Edict target 
) const
private

Check whether we want to shoot at the target.

Parameters
[in]shooterThe entity that might be firing
[in]targetThe entity that might be fired at

Definition at line 688 of file g_reaction.cpp.

References level_locals_t::activeTeam, frand(), G_IsCivilian, G_IsDead, Edict::getTeam(), Edict::isSameTeamAs(), Actor::isShaken(), level, mor_shaken, Edict::morale, and cvar_t::value.

Referenced by isPossible().

◆ isInWeaponRange()

bool ReactionFire::isInWeaponRange ( const Actor shooter,
const Edict target,
const fireDef_t fd 
) const

Definition at line 494 of file g_reaction.cpp.

References Edict::origin, fireDef_t::range, and VectorDist.

Referenced by G_ReactionFireGetTUsForItem().

◆ isPossible()

bool ReactionFire::isPossible ( Actor shooter,
const Edict target 
) const
inlineprivate

Definition at line 678 of file g_reaction.cpp.

References canReact(), canSee(), and isEnemy().

Referenced by tryToShoot(), and updateAllTargets().

◆ notifyClientOnShot()

void ReactionFire::notifyClientOnShot ( const Edict target,
int  tusTarget 
)

Definition at line 882 of file g_reaction.cpp.

References ReactionFireTargets::notifyClientOnShot(), and rft.

Referenced by G_ReactionFirePostShot(), and G_ReactionFirePreShot().

◆ notifyClientOnStep()

void ReactionFire::notifyClientOnStep ( const Edict target,
int  step 
)

Definition at line 887 of file g_reaction.cpp.

References ReactionFireTargets::notifyClientOnStep(), and rft.

Referenced by G_ReactionFireOnMovement().

◆ resetTargets()

void ReactionFire::resetTargets ( const Edict shooter)

Definition at line 785 of file g_reaction.cpp.

References ReactionFireTargets::resetTargetList(), and rft.

Referenced by G_ReactionFireOnDead().

◆ shoot()

bool ReactionFire::shoot ( Actor shooter,
const pos3_t  at,
shoot_types_t  type,
fireDefIndex_t  firemode 
)
private

Perform the reaction fire shot.

Parameters
[in]shooterThe actor that is trying to shoot
[in]atPosition to fire on.
[in]typeWhat type of shot this is (left, right reaction-left etc...).
[in]firemodeThe firemode index of the ammo for the used weapon (objDef.fd[][x]) .
Returns
true if everything went ok (i.e. the shot(s) where fired ok), otherwise false.
See also
G_ClientShoot

Definition at line 799 of file g_reaction.cpp.

References shot_mock_t::civilian, shot_mock_t::enemyCount, shot_mock_t::friendCount, G_ClientShoot(), G_IsAlien, Item::getFiredefs(), Edict::getLeftHandItem(), Edict::getPlayer(), Edict::getRightHandItem(), i, IS_SHOT_RIGHT, Actor::isInsane(), Actor::isPanicked(), Actor::isRaged(), Actor::isShaken(), fireDef_t::shots, and type.

Referenced by tryToShoot().

◆ tryToShoot()

bool ReactionFire::tryToShoot ( Actor shooter,
const Edict target 
)

Resolve the reaction fire for an entity, this checks that the entity can fire and then takes the shot.

Parameters
[in]shooterThe entity using reaction fire
[in]targetThe victim of the reaction fire
Returns
true if the entity fired, false otherwise

Definition at line 856 of file g_reaction.cpp.

References ACTOR_HAND_LEFT, ACTOR_HAND_RIGHT, Edict::chr, FiremodeSettings::getFmIdx(), FiremodeSettings::getHand(), isPossible(), Edict::pos, ReactionFireTargets::remove(), Actor::removeShaken(), rf, character_t::RFmode, rft, shoot(), ST_LEFT_REACTION, ST_NUM_SHOOT_TYPES, ST_RIGHT_REACTION, and type.

Referenced by checkExecution(), and G_ReactionFirePreShot().

◆ updateAllTargets()

void ReactionFire::updateAllTargets ( const Edict target)

Check whether 'target' has just triggered any new reaction fire.

Parameters
[in]targetThe entity triggering fire

Definition at line 767 of file g_reaction.cpp.

References ReactionFireTargets::add(), G_EdictsGetNextLivingActor(), G_ReactionFireGetTUsForItem(), isPossible(), ReactionFireTargets::remove(), and rft.

Referenced by G_ReactionFireOnDead(), G_ReactionFireOnMovement(), and G_ReactionFirePreShot().


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