UFO: Alien Invasion
Loading...
Searching...
No Matches
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.
void updateAllTargets (const Edict *target)
 Check whether 'target' has just triggered any new reaction fire.
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.
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.
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.
bool canReact (Actor *shooter, const Edict *target) const
 Check whether shooter can reaction fire at target at all.
bool canSee (const Actor *shooter, const Edict *target) const
 Check whether shooter can see his target well enough.
bool shoot (Actor *shooter, const pos3_t at, shoot_types_t type, fireDefIndex_t firemode)
 Perform the reaction fire shot.
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 G_EdictsGetNextLivingActor(), G_ReactionFireGetTUsForItem(), G_ReactionFireNotifyClientRFAborted(), rf, and rft.

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

◆ 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 frand(), G_IsCivilian, G_IsDead, Edict::getTeam(), Edict::isSameTeamAs(), Actor::isShaken(), level, mor_shaken, and Edict::morale.

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.

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

◆ notifyClientOnStep()

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

Definition at line 887 of file g_reaction.cpp.

References rft.

◆ resetTargets()

void ReactionFire::resetTargets ( const Edict * shooter)

Definition at line 785 of file g_reaction.cpp.

References rft.

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

◆ 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, Actor::removeShaken(), rf, character_t::RFmode, rft, ST_LEFT_REACTION, ST_NUM_SHOOT_TYPES, ST_RIGHT_REACTION, and type.

◆ 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 G_EdictsGetNextLivingActor(), G_ReactionFireGetTUsForItem(), isPossible(), and rft.


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