|
UFO: Alien Invasion
|
#include "g_local.h"

Go to the source code of this file.
Macros | |
| #define | G_IsState(ent, s) |
| #define | G_IsStunned(ent) |
| #define | G_IsPanicked(ent) |
| #define | G_IsCrouched(ent) |
| #define | G_IsDead(ent) |
| #define | G_SetState(ent, s) |
| #define | G_SetStunned(ent) |
| #define | G_SetDead(ent) |
| #define | G_SetCrouched(ent) |
| #define | G_ToggleState(ent, s) |
| #define | G_ToggleCrouched(ent) |
Functions | |
| bool | G_IsLivingActor (const Edict *ent) __attribute__((nonnull)) |
| Checks whether the given edict is a living actor. | |
| void | G_ActorUseDoor (Actor *actor, Edict *door) |
| Make the actor use (as in open/close) a door edict. | |
| void | G_ActorSetClientAction (Edict *actor, Edict *ent) |
| Handles the client actions (interaction with the world). | |
| int | G_ActorUsableTUs (const Edict *ent) |
| Calculates the amount of usable TUs. This is without the reserved TUs. | |
| int | G_ActorGetTUForReactionFire (const Edict *ent) |
| Calculates the amount of TUs that are needed for the current selected reaction fire mode. | |
| void | G_ActorReserveTUs (Edict *ent, int resReaction, int resShot, int resCrouch) |
| Reserves TUs for different actor actions. | |
| int | G_ActorDoTurn (Edict *ent, byte dir) |
| Turns an actor around. | |
| void | G_ActorSetMaxs (Actor *actor) |
| Sets correct bounding box for actor (state dependent). | |
| int | G_ActorCalculateMaxTU (const Edict *ent) |
| void | G_ActorGiveTimeUnits (Actor *actor) |
| Set time units for the given edict. Based on speed skills. | |
| void | G_ActorSetTU (Edict *ent, int tus) |
| void | G_ActorUseTU (Edict *ent, int tus) |
| void | G_ActorModifyCounters (const Edict *attacker, const Edict *victim, int deltaAlive, int deltaKills, int deltaStuns) |
| void | G_ActorGetEyeVector (const Edict *actor, vec3_t eye) |
| Fills a vector with the eye position of a given actor. | |
| void | G_ActorCheckRevitalise (Actor *actor) |
| bool | G_ActorDieOrStun (Actor *actor, Edict *attacker) |
| Reports and handles death or stun of an actor. If the HP of an actor is zero the actor will die, otherwise the actor will get stunned. | |
| int | G_ActorGetContentFlags (const vec3_t origin) |
| Get the content flags from where the actor is currently standing. | |
| bool | G_ActorInvMove (Actor *actor, const invDef_t *from, Item *fItem, const invDef_t *to, int tx, int ty, bool checkaction) |
| Moves an item inside an inventory. Floors are handled special. | |
| bool | G_ActorReload (Actor *actor, const invDef_t *invDef) |
| Reload weapon with actor. | |
| int | G_ActorGetModifiedTimeForFiredef (const Edict *ent, const fireDef_t *const fd, bool reaction) |
| #define G_IsCrouched | ( | ent | ) |
Definition at line 32 of file g_actor.h.
Referenced by AI_CheckCrouch(), G_ActorGetEyeVector(), G_ActorVis(), G_ShootGrenade(), and G_ShootSingle().
| #define G_IsDead | ( | ent | ) |
Definition at line 34 of file g_actor.h.
Referenced by actorL_shoot(), AI_ActorThink(), G_ActionCheck(), G_ActorVis(), G_IsLivingActor(), G_MissionIsTouched(), G_MissionReset(), G_MissionTouch(), G_ReactionFireOnDead(), G_UpdateShotMock(), G_Vis(), ReactionFire::isEnemy(), Touch_RescueTrigger(), and Touch_TouchTrigger().
| #define G_IsPanicked | ( | ent | ) |
Definition at line 31 of file g_actor.h.
Referenced by G_ActorGetEyeVector().
| #define G_IsState | ( | ent, | |
| s ) |
Definition at line 29 of file g_actor.h.
Referenced by Edict::isOpponent().
| #define G_IsStunned | ( | ent | ) |
Definition at line 30 of file g_actor.h.
Referenced by G_ActionCheck(), and G_IsLivingActor().
| #define G_SetCrouched | ( | ent | ) |
| #define G_SetDead | ( | ent | ) |
| #define G_SetState | ( | ent, | |
| s ) |
Definition at line 36 of file g_actor.h.
Referenced by G_ActorDie(), and G_ClientStateChange().
| #define G_SetStunned | ( | ent | ) |
| #define G_ToggleCrouched | ( | ent | ) |
Definition at line 42 of file g_actor.h.
Referenced by G_ClientStateChange().
Definition at line 247 of file g_actor.cpp.
References ABILITY_POWER, ABILITY_SPEED, Edict::chr, G_ActorGetInjuryPenalty(), GET_ENCUMBRANCE_PENALTY, GET_TU, Inventory::getWeight(), character_t::inv, MAX_TU, MODIFIER_TU, character_t::score, and chrScoreGlobal_t::skills.
Referenced by G_ActorGiveTimeUnits(), G_ActorSetTU(), and G_EventActorAppear().
Definition at line 386 of file g_actor.cpp.
References G_ActorRevitalise(), G_EdictsGetNextInUse(), G_EventActorRevitalise(), G_EventActorStateChange(), G_IsBlockingMovementActor, G_SendStats(), G_VisToPM(), Edict::getStun(), Edict::HP, Actor::isStunned(), Edict::pos, VectorCompare, and Edict::visflags.
Referenced by G_TreatActor(), and G_UpdateStunState().
Reports and handles death or stun of an actor. If the HP of an actor is zero the actor will die, otherwise the actor will get stunned.
| [in] | actor | Pointer to an entity being killed or stunned actor. |
| [in] | attacker | Pointer to attacker - it must be notified about state of victim. |
Definition at line 435 of file g_actor.cpp.
References G_ActorDie(), G_ActorStun(), G_CheckVis(), G_CheckVisTeamAll(), G_ClientStateChange(), G_EventActorDie(), G_EventActorStateChange(), G_InventoryToFloor(), G_ReactionFireOnDead(), G_ReactionFireTargetsDestroy(), G_VisToPM(), Edict::getPlayer(), Edict::getTeam(), gi, Edict::HP, Actor::isStunned(), Edict::resetFloor(), Edict::solid, SOLID_NOT, STATE_REACTION, and Edict::visflags.
Referenced by G_CheckDeathOrKnockout(), G_MatchSendResults(), G_ThinkActorDieAfterSpawn(), TEST_F(), and TEST_F().
Turns an actor around.
| [in] | ent | the actor (edict) we are talking about |
| [in] | dir | the direction to turn the edict into, might be an action |
Definition at line 154 of file g_actor.cpp.
References CORE_DIRECTIONS, Edict::dir, directionAngles, dvleft, dvright, FLYING_DIRECTIONS, G_CheckVisTeamAll(), G_EventActorTurn(), Edict::getTeam(), i, PATHFINDING_DIRECTIONS, and VIS_STOP.
Referenced by AI_TurnIntoDirection(), G_ClientMove(), and G_ClientTurn().
Get the content flags from where the actor is currently standing.
Definition at line 484 of file g_actor.cpp.
References gi, PLAYER_MIN, and VectorCopy.
Referenced by G_ClientMove(), and G_ClientTeamInfo().
Fills a vector with the eye position of a given actor.
| [in] | actor | The actor edict to get the eye position in the world from |
| [out] | eye | The eye vector world position |
Definition at line 357 of file g_actor.cpp.
References EYE_CROUCH, EYE_STAND, G_IsCrouched, G_IsPanicked, Edict::origin, and VectorCopy.
Referenced by G_ActorVis(), G_SplashDamage(), G_TeamPointVis(), and G_Vis().
| int G_ActorGetModifiedTimeForFiredef | ( | const Edict * | ent, |
| const fireDef_t *const | fd, | ||
| bool | reaction ) |
Definition at line 764 of file g_actor.cpp.
References G_ActorGetInjuryPenalty(), MODIFIER_REACTION, MODIFIER_SHOOTING, and fireDef_t::time.
Referenced by actorL_throwgrenade(), AI_FindBestFiredef(), AIL_GetBestShot(), AIL_positionshoot(), G_ActorGetTUForReactionFire(), G_ClientShoot(), and G_ReactionFireGetTUsForItem().
Calculates the amount of TUs that are needed for the current selected reaction fire mode.
| [in] | ent | The actors edict |
Definition at line 116 of file g_actor.cpp.
References Edict::chr, Item::def(), G_ActorGetModifiedTimeForFiredef(), Item::getFiredefs(), FiremodeSettings::getFmIdx(), FiremodeSettings::getHand(), Edict::getHandItem(), and character_t::RFmode.
Referenced by G_ActorHasEnoughTUsReactionFire(), and G_ReactionFireSettingsReserveTUs().
Set time units for the given edict. Based on speed skills.
| actor | The actor edict |
Definition at line 260 of file g_actor.cpp.
References G_ActorCalculateMaxTU(), G_ActorSetTU(), Actor::isDazed(), and Actor::removeDazed().
Referenced by AI_SetStats(), G_ClientTeamInfo(), and G_GiveTimeUnits().
| bool G_ActorInvMove | ( | Actor * | actor, |
| const invDef_t * | fromContType, | ||
| Item * | fItem, | ||
| const invDef_t * | toContType, | ||
| int | tx, | ||
| int | ty, | ||
| bool | checkaction ) |
Moves an item inside an inventory. Floors are handled special.
| [in] | actor | The pointer to the selected/used edict/soldier. |
| [in] | fromContType | The container (-id) the item should be moved from. |
| [in] | fItem | The item you want to move. |
| [in] | toContType | The container (-def) the item should be moved to. |
| [in] | tx | x position where you want the item to go in the destination container |
| [in] | ty | y position where you want the item to go in the destination container |
| [in] | checkaction | Set this to true if you want to check for TUs, otherwise false. |
Definition at line 506 of file g_actor.cpp.
References _, ABILITY_POWER, Item::ammoDef(), Inventory::canHoldItemWeight(), Edict::chr, Item::def(), Inventory::findSpace(), G_ActionCheckForCurrentTeam(), G_ActorSetTU(), G_ActorUseTU(), G_CheckVis(), G_ClientPrintf(), G_EventEnd(), G_EventInventoryAdd(), G_EventInventoryDelete(), G_EventInventoryReload(), G_EventPerish(), G_FreeEdict(), G_GetFloorItems(), G_ReactionFireSettingsUpdate(), G_SendStats(), G_SpawnFloor(), G_TeamToPM(), G_VisToPM(), G_WriteItem(), game, Item::getAmount(), Item::getFirstShapePosition(), Edict::getFloor(), FiremodeSettings::getFmIdx(), FiremodeSettings::getHand(), Inventory::getItemAtPos(), Edict::getPlayer(), Edict::getReservedTUs(), Edict::getTeam(), Edict::getTus(), FiremodeSettings::getWeapon(), Item::getX(), Item::getY(), gi, IA_NONE, IA_NORELOAD, IA_NOTIME, IA_RELOAD, IA_RELOAD_SWAP, invDef_t::id, character_t::inv, invDef_t::isFloorDef(), invDef_t::isLeftDef(), invDef_t::isRightDef(), NONE, NONE_AMMO, Edict::pos, PRINT_HUD, character_t::RFmode, Item::rotated, character_t::score, Item::setAmmoDef(), Item::setAmmoLeft(), Item::setAmount(), Item::setDef(), Edict::setFloor(), Item::setX(), Item::setY(), chrScoreGlobal_t::skills, Edict::TU, and Edict::visflags.
Referenced by actorL_throwgrenade(), AI_PrepBestAction(), AI_TryToReloadWeapon(), G_ActorReload(), G_ClientAction(), G_ClientGetWeaponFromInventory(), G_MissionTouch(), G_MoralePanic(), TEST_F(), and TEST_F().
| void G_ActorModifyCounters | ( | const Edict * | attacker, |
| const Edict * | victim, | ||
| int | deltaAlive, | ||
| int | deltaKills, | ||
| int | deltaStuns ) |
Definition at line 299 of file g_actor.cpp.
References Com_Printf(), Edict::getTeam(), gi, i, level, MAX_TEAMS, and Edict::team.
Referenced by G_ActorDie(), G_ActorRevitalise(), G_ActorStun(), and G_ClientGetFreeSpawnPointForActorSize().
Reload weapon with actor.
| [in] | actor | Pointer to an actor reloading weapon. |
| [in] | invDef | Reloading weapon in right or left hand. |
Definition at line 714 of file g_actor.cpp.
References Edict::chr, CID_RIGHT, Container::def(), Item::def(), G_ActorInvMove(), Edict::getContainer(), Inventory::getNextCont(), Container::getNextItem(), Edict::getRightHandItem(), Container::id, invDef_t::id, character_t::inv, INVDEF, Item::isHeldTwoHanded(), invDef_t::isLeftDef(), objDef_t::isLoadableInWeapon(), and invDef_t::out.
Referenced by AI_TryToReloadWeapon().
Reserves TUs for different actor actions.
| [in,out] | ent | The actor to reserve TUs for. Might not be nullptr. |
| [in] | resReaction | TUs for reaction fire |
| [in] | resShot | TUs for shooting |
| [in] | resCrouch | TUs for going into crouch mode |
Definition at line 136 of file g_actor.cpp.
References Edict::chr, chrReservations_t::crouch, G_EventActorSendReservations(), Edict::getTus(), chrReservations_t::reaction, character_t::reservedTus, and chrReservations_t::shot.
Referenced by G_ClientAction(), G_ClientStateChange(), G_Damage(), and G_ReactionFireSettingsReserveTUs().
Handles the client actions (interaction with the world).
| actor | The actors' edict |
| ent | The edict that can be used by the actor |
Definition at line 82 of file g_actor.cpp.
References Edict::clientAction, FL_CLIENTACTION, Edict::flags, G_EventResetClientAction(), and G_EventSetClientAction().
Referenced by Reset_DoorTrigger(), Reset_TouchTrigger(), Touch_DoorTrigger(), and Touch_TouchTrigger().
Sets correct bounding box for actor (state dependent).
| [in] | actor | Pointer to entity for which bounding box is being set. |
Definition at line 226 of file g_actor.cpp.
References Edict::chr, CHRSH_IsTeamDefRobot(), Edict::entBox, ET_ACTOR, ET_ACTOR2x2, Edict::getIdNum(), gi, Actor::isCrouched(), Actor::isDead(), PLAYER2x2_WIDTH, PLAYER_CROUCH, PLAYER_DEAD, PLAYER_STAND, PLAYER_WIDTH, AABB::setMaxs(), AABB::setMaxZ(), character_t::teamDef, and Edict::type.
Referenced by G_ActorDie(), G_ActorRevitalise(), G_ActorStun(), G_ClientStateChange(), G_MoraleBehaviour(), and G_MoralePanic().
Definition at line 267 of file g_actor.cpp.
References G_ActorCalculateMaxTU(), g_notu, and Edict::setTus().
Referenced by G_ActorGiveTimeUnits(), G_ActorInvMove(), G_ActorUseTU(), G_ClientInitActorStates(), G_ClientMove(), G_ClientShoot(), G_Damage(), G_MoralePanic(), and SP_func_door().
Calculates the amount of usable TUs. This is without the reserved TUs.
| [in] | ent | The actor to calculate the amount of usable TUs for. If ent is nullptr, we return zero here |
Definition at line 102 of file g_actor.cpp.
References Edict::getReservedTUs(), and Edict::getTus().
Referenced by G_ActionCheckForCurrentTeam().
Make the actor use (as in open/close) a door edict.
| actor | The actor that is using the door |
| door | The door that should be opened/closed |
Definition at line 55 of file g_actor.cpp.
References FL_GROUPSLAVE, Edict::flags, G_ClientUseEdict(), G_FindRadius(), G_IsAI, G_TouchTriggers(), Edict::getPlayer(), Edict::groupMaster, Edict::origin, and UNIT_SIZE.
Referenced by G_ClientAction(), and Touch_DoorTrigger().
Definition at line 278 of file g_actor.cpp.
References G_ActorSetTU(), and Edict::getTus().
Referenced by G_ActorInvMove(), G_ClientStateChange(), G_ClientTurn(), and G_ClientUseEdict().
| bool G_IsLivingActor | ( | const Edict * | ent | ) |
Checks whether the given edict is a living actor.
| [in] | ent | The edict to perform the check for |
Definition at line 43 of file g_actor.cpp.
References G_IsActor, G_IsDead, and G_IsStunned.
Referenced by Door_Use(), G_Damage(), G_EdictsGetNextLivingActor(), G_GetClosePlayerMask(), G_IsActorWounded(), G_MissionTouch(), G_ReactionFireCanBeEnabled(), G_SplashDamage(), G_TouchSolids(), G_TouchTriggers(), G_Vis(), G_VisShouldStop(), and Touch_HurtTrigger().