UFO: Alien Invasion
Loading...
Searching...
No Matches
g_health.cpp File Reference
#include "g_health.h"
#include "g_actor.h"
#include "g_client.h"
#include "g_combat.h"
#include "g_edicts.h"
#include "g_match.h"
#include "g_utils.h"
Include dependency graph for g_health.cpp:

Go to the source code of this file.

Functions

static byte G_GetImpactDirection (const Edict *const target, const vec3_t impact)
void G_DamageActor (Edict *target, const int damage, const vec3_t impact)
 Deals damage and causes wounds.
void G_TreatActor (Actor *target, const fireDef_t *const fd, const int heal, const int healerTeam)
 Heals a target and treats wounds.
void G_BleedWounds (const int team)
 Deal damage to each wounded team member.
void G_SendWoundStats (Edict *const ent)
 Send wound stats to network buffer.
float G_ActorGetInjuryPenalty (const Edict *const ent, const modifier_types_t type)
 Returns the penalty to the given stat caused by the actor wounds.
bool G_IsActorWounded (const Edict *ent, bool serious)

Function Documentation

◆ G_ActorGetInjuryPenalty()

float G_ActorGetInjuryPenalty ( const Edict *const ent,
const modifier_types_t type )

Returns the penalty to the given stat caused by the actor wounds.

Parameters
[in]entPointer to the actor we want to calculate the penalty for.
[in]typeThe stat we want to calculate the penalty for.
Returns
The given penalty for this actor.

Definition at line 177 of file g_health.cpp.

References teamDef_t::bodyTemplate, Edict::chr, G_ActorGetInjuryPenalty(), gi, character_t::maxHP, MODIFIER_ACCURACY, MODIFIER_MOVEMENT, MODIFIER_REACTION, MODIFIER_SHOOTING, MODIFIER_SIGHT, MODIFIER_TU, BodyData::numBodyParts(), BodyData::penalty(), character_t::teamDef, woundInfo_t::treatmentLevel, type, woundInfo_t::woundLevel, character_t::wounds, and BodyData::woundThreshold().

Referenced by G_ActorCalculateMaxTU(), G_ActorGetInjuryPenalty(), G_ActorGetModifiedTimeForFiredef(), G_ActorMoveLength(), G_CalcEffectiveSpread(), G_ClientMove(), and G_VisCheckDist().

◆ G_BleedWounds()

◆ G_DamageActor()

void G_DamageActor ( Edict * target,
const int damage,
const vec3_t impact )

Deals damage and causes wounds.

Parameters
[in,out]targetPointer to the actor we want to damage.
[in]damageThe value of the damage.
[in]impactImpact location nullptr for splash damage.

Definition at line 52 of file g_health.cpp.

References Edict::absBox, teamDef_t::bodyTemplate, Edict::chr, G_GetImpactDirection(), G_SendWoundStats(), G_TakeDamage(), BodyData::getArea(), BodyData::getHitBodyPart(), Edict::HP, AABB::maxs, AABB::mins, BodyData::numBodyParts(), character_t::teamDef, woundInfo_t::woundLevel, and character_t::wounds.

Referenced by G_Damage(), and Touch_HurtTrigger().

◆ G_GetImpactDirection()

byte G_GetImpactDirection ( const Edict *const target,
const vec3_t impact )
static

◆ G_IsActorWounded()

◆ G_SendWoundStats()

void G_SendWoundStats ( Edict *const ent)

◆ G_TreatActor()

void G_TreatActor ( Actor * target,
const fireDef_t *const fd,
const int heal,
const int healerTeam )

Heals a target and treats wounds.

Parameters
[in,out]targetPointer to the actor who we want to treat.
[in]fdPointer to the firedef used to heal the target.
[in]healThe value of the damage to heal.
[in]healerTeamThe index of the team of the healer.
Todo
According to specs it should only be possible to use the medikit to keep an alien sedated when 'live alien' is researched, is it possible to find if a tech is researched here?

Definition at line 81 of file g_health.cpp.

References ABILITY_MIND, BodyData::bleedingFactor(), teamDef_t::bodyTemplate, Edict::chr, CHRSH_IsTeamDefAlien(), fireDef_t::dmgweight, G_ActorCheckRevitalise(), G_SendWoundStats(), G_TakeDamage(), GET_MORALE, Edict::getStun(), Edict::getTeam(), gi, chrScoreMission_t::heal, Actor::isStunned(), Edict::morale, BodyData::numBodyParts(), character_t::score, character_t::scoreMission, Edict::setMorale(), Edict::setStun(), chrScoreGlobal_t::skills, character_t::teamDef, woundInfo_t::treatmentLevel, woundInfo_t::woundLevel, and character_t::wounds.

Referenced by G_Damage().