UFO: Alien Invasion
|
All parts of the main game logic that are combat related. More...
#include "g_local.h"
Go to the source code of this file.
Data Structures | |
struct | shot_mock_s |
used in shot probability calculations (pseudo shots) More... | |
Typedefs | |
typedef struct shot_mock_s | shot_mock_t |
used in shot probability calculations (pseudo shots) More... | |
Functions | |
int | G_ApplyProtection (const Edict *target, const byte dmgWeight, int damage) |
Reduces damage by armour and natural protection. More... | |
void | G_CheckDeathOrKnockout (Actor *target, Actor *attacker, const fireDef_t *fd, int damage) |
bool | G_ClientShoot (const Player &player, Actor *actor, const pos3_t at, shoot_types_t shootType, fireDefIndex_t firemode, shot_mock_t *mock, bool allowReaction, int z_align) |
Setup for shooting, either real or mock. More... | |
void | G_CalcEffectiveSpread (const Actor *ent, const fireDef_t *fd, vec2_t effSpread) |
Calculate the effective spread for the given actor and firemode. More... | |
All parts of the main game logic that are combat related.
Definition in file g_combat.h.
typedef struct shot_mock_s shot_mock_t |
used in shot probability calculations (pseudo shots)
Reduces damage by armour and natural protection.
[in] | target | What we want to damage. |
[in] | dmgWeight | The type of damage is dealt. |
[in] | damage | The value of the damage. |
Definition at line 362 of file g_combat.cpp.
References Edict::chr, Item::def(), Edict::getArmour(), objDef_s::protection, teamDef_s::resistance, and character_s::teamDef.
Referenced by AI_CheckPosition(), G_Damage(), G_SplashDamage(), and Touch_HurtTrigger().
Calculate the effective spread for the given actor and firemode.
[in] | shooter | The shooting actor |
[in] | fd | The firedefinition the actor is shooting with |
[out] | effSpread | The adjusted spread |
Definition at line 671 of file g_combat.cpp.
References ABILITY_ACCURACY, Edict::chr, fireDef_s::crouch, f, G_ActorGetInjuryPenalty(), GET_ACC, Actor::isCrouched(), MODIFIER_ACCURACY, PITCH, character_s::score, SKILL_BALANCE, chrScoreGlobal_s::skills, fireDef_s::spread, WEAPON_BALANCE, fireDef_s::weaponSkill, and YAW.
Referenced by AI_FighterCheckShoot(), G_ShootGrenade(), and G_ShootSingle().
Definition at line 499 of file g_combat.cpp.
References Edict::chr, G_ActorDieOrStun(), G_Morale(), G_PrintActorStats(), G_SendStats(), G_UpdateCharacterBodycount(), Edict::getStun(), Edict::HP, cvar_s::integer, character_s::maxHP, character_s::minHP, ML_DEATH, ML_WOUND, and mor_panic.
Referenced by G_BleedWounds(), G_ClientMove(), G_Damage(), and Touch_HurtTrigger().
bool G_ClientShoot | ( | const Player & | player, |
Actor * | actor, | ||
const pos3_t | at, | ||
shoot_types_t | shootType, | ||
fireDefIndex_t | firemode, | ||
shot_mock_t * | mock, | ||
bool | allowReaction, | ||
int | z_align | ||
) |
Setup for shooting, either real or mock.
[in] | player | The player this action belongs to (i.e. either the ai or the player) |
[in] | actor | the edict that is doing the shot |
[in] | at | Position to fire on. |
[in] | shootType | What type of shot this is (left, right reaction-left etc...). |
[in] | firemode | The firemode index of the ammo for the used weapon. |
[in] | mock | pseudo shooting - only for calculating mock values - nullptr for real shots |
[in] | allowReaction | Set to true to check whether this has forced any reaction fire, otherwise false. |
[in] | z_align | This value may change the target z height - often GROUND_DELTA is used to calculate the alignment. This can be used for splash damage weapons. It's often useful to target the ground close to the victim. That way you don't need a 100 percent chance to hit your target. Even if you don't hit it, the splash damage might reduce the health of your target. |
Reset status.
Reset status.
If loaded ammo is less than needed ammo from firedef then reduce shot-number relative to the difference.
Definition at line 1183 of file g_combat.cpp.
References _, fireDef_s::ammo, Item::ammoDef(), AngleToDir(), Edict::chr, CORE_DIRECTIONS, crand(), game_import_s::csi, fireDef_s::damage, csi_s::damIncendiary, csi_s::damNormal, csi_s::damSmoke, csi_s::damStunGas, Item::def(), objDef_s::deplete, Edict::dir, objDef_s::dmgtype, fireDef_s::dmgweight, InventoryInterface::emptyContainer(), ET_ACTOR, ET_FIRE, ET_SMOKE, ET_SMOKESTUN, f, Edict::fieldSize, chrScoreMission_s::fired, chrScoreMission_s::firedHit, chrScoreMission_s::firedSplash, chrScoreMission_s::firedSplashHit, chrScoreMission_s::firedSplashTUs, chrScoreMission_s::firedTUs, FIRESH_IsMedikit, objDef_s::fireTwoHanded, G_ActionCheckForCurrentTeam(), G_ActionCheckForReaction(), G_ActorGetModifiedTimeForFiredef(), G_ActorSetTU(), G_CheckVisTeamAll(), G_ClientPrintf(), G_EdictsGetLivingActorFromPos(), G_EventActorTurn(), G_EventEnd(), G_EventEndShoot(), G_EventInventoryAmmo(), G_EventInventoryDelete(), G_EventShootHidden(), G_EventStartShoot(), G_FindRadius(), G_IsActorWounded(), G_IsAIPlayer, G_IsVisibleForTeam, G_MatchEndCheck(), G_PrepareShot(), G_ReactionFirePostShot(), G_ReactionFirePreShot(), G_ReactionFireSettingsUpdate(), G_SendStats(), G_ShootGrenade(), G_ShootSingle(), G_ShotMorale(), G_SpawnFireField(), G_SpawnSmokeField(), G_SpawnStunSmokeField(), G_TeamPointVis(), G_TeamToVisMask, G_TouchTriggers(), G_VisToPM(), game, Item::getAmmoLeft(), FiremodeSettings::getFmIdx(), FiremodeSettings::getHand(), Edict::getLeftHandItem(), fireDef_s::getShotOrigin(), Edict::getTeam(), Edict::getTus(), FiremodeSettings::getWeapon(), gi, fireDef_s::gravity, i, objDef_s::id, invDef_s::id, cvar_s::integer, Edict::inuse, character_s::inv, INVDEF, game_locals_s::invi, fireDef_s::irgoggles, Actor::isCrouched(), Actor::isDead(), Edict::isSamePosAs(), Actor::isStunned(), KILLED_NUM_TYPES, MAX_TEAMS, mor_panic, fireDef_s::obj, objDef_s::oneshot, Edict::origin, Edict::pos, PRINT_HUD, fireDef_s::range, character_s::RFmode, fireDef_s::rounds, character_s::scoreMission, Item::setAmmoLeft(), fireDef_s::shots, invDef_s::single, fireDef_s::splrad, objDef_s::thrown, todeg, type, VectorDist, VectorMA(), VectorSubtract, Edict::visflags, and fireDef_s::weaponSkill.
Referenced by actorL_shoot(), actorL_throwgrenade(), AI_ActorThink(), AI_CalcShotDamage(), G_ClientAction(), and ReactionFire::shoot().