UFO: Alien Invasion
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Edict Class Reference

#include <g_edict.h>

Inherited by Actor.

Public Member Functions

void init (int idx)
 
void setPlayerNum (int num)
 
void setTeam (int team_)
 
void setChild (Edict *child)
 
void nativeReset ()
 
void setActive ()
 
void toggleActive ()
 
void resetContainer (const containerIndex_t idx)
 
void setFloor (const Edict *other)
 
void resetFloor ()
 
void calcOrigin ()
 Calculate the edict's origin vector from it's grid position. More...
 
void setOrigin (const pos3_t newPos)
 Set the edict's pos and origin vector to the given grid position. More...
 
int getIdNum () const
 
int getPlayerNum () const
 
Edictchild ()
 
Edictowner ()
 
ItemgetContainer (const containerIndex_t idx) const
 
ItemgetArmour () const
 
ItemgetRightHandItem () const
 
ItemgetLeftHandItem () const
 
ItemgetHandItem (actorHands_t hand) const
 
ItemgetFloor () const
 
Player & getPlayer () const
 
int getTeam () const
 
bool isSameAs (const Edict *other) const
 
bool isSameTeamAs (const Edict *other) const
 
bool isSamePosAs (const pos3_t cmpPos)
 Check whether the edict is on the given position. More...
 
bool isOpponent (const Actor *actor) const
 Check if given actor is an enemy. More...
 
void setStun (int stu)
 
void addStun (int stu)
 
int getStun () const
 
void setMorale (int mor)
 
void setTus (int tus)
 
int getTus () const
 
void setTouch (bool(*touch_)(Edict *self, Edict *activator))
 
bool hasTouch () const
 
bool callTouch (Edict *activator)
 
int getReservedTUs () const
 Calculates the amount of all currently reserved TUs. More...
 

Data Fields

bool inuse
 
int linkcount
 
int number
 
vec3_t origin
 
vec3_t angles
 
pos3_t pos
 
solid_t solid
 
AABB entBox
 
AABB absBox
 
vec3_t size
 
Edict_child
 
Edict_owner
 
int modelindex
 
const char * classname
 
int mapNum
 
const char * model
 
EdictparticleLink
 
const Edictlink
 
entity_type_t type
 
teammask_t visflags
 
int contentFlags
 
byte dir
 
int TU
 
int HP
 
int _STUN
 
int morale
 
int state
 
int frame
 
char * group
 
EdictclientAction
 
character_t chr
 
int spawnflags
 
float angle
 
int radius
 
int speed
 
const char * target
 
const char * targetname
 
const char * item
 
const char * particle
 
const char * nextmap
 
const char * message
 
const char * description
 
const char * noise
 
edictMaterial_t material
 
camera_edict_data_t camera
 
int count
 
int time
 
int sounds
 
int dmg
 
byte dmgtype
 
actorSizeEnum_t fieldSize
 
bool hiding
 
bool(* _touch )(Edict *self, Edict *activator)
 
void(* reset )(Edict *self, Edict *activator)
 
float nextthink
 
void(* think )(Edict *self)
 
bool(* use )(Edict *self, Edict *activator)
 
bool(* destroy )(Edict *self)
 
linkedList_ttouchedList
 
int doorState
 
moveinfo_t moveinfo
 
EdictgroupChain
 
EdictgroupMaster
 
int flags
 
AI_t AI
 
pos3_tforbiddenListPos
 
int forbiddenListSize
 
bool active
 

Protected Attributes

int team
 
int pnum
 
unsigned int body
 
unsigned int head
 
bool inRescueZone
 

Detailed Description

Definition at line 45 of file g_edict.h.

Member Function Documentation

void Edict::addStun ( int  stu)
inline

Definition at line 305 of file g_edict.h.

Referenced by G_Damage(), G_UpdateStunState(), and Touch_HurtTrigger().

void Edict::calcOrigin ( )
inline
bool Edict::callTouch ( Edict activator)
inline

Definition at line 329 of file g_edict.h.

References _touch.

Referenced by G_TouchEdicts(), G_TouchSolids(), and G_TouchTriggers().

Edict* Edict::child ( )
inline

Definition at line 237 of file g_edict.h.

References _child.

Referenced by Destroy_Breakable(), and setChild().

Item* Edict::getArmour ( ) const
inline

Definition at line 246 of file g_edict.h.

References Inventory::getArmour(), and character_s::inv.

Referenced by G_ApplyProtection().

Item* Edict::getFloor ( ) const
inline
int Edict::getPlayerNum ( ) const
inline
int Edict::getReservedTUs ( ) const
inline

Calculates the amount of all currently reserved TUs.

Returns
The amount of reserved TUs for reaction, shooting and crouching

Definition at line 336 of file g_edict.h.

References chrReservations_s::crouch, chrReservations_s::reaction, character_s::reservedTus, and chrReservations_s::shot.

Referenced by G_ActorInvMove(), G_ActorUsableTUs(), and Actor::getUsableTUs().

int Edict::getTeam ( ) const
inline

Definition at line 269 of file g_edict.h.

References team.

Referenced by actorL_team(), AI_ActorThink(), AI_CheckFF(), AI_CheckForMissionTargets(), AI_CheckUsingDoor(), AI_CivilianCalcActionScore(), AI_FighterCalcActionScore(), AI_FindHerdLocation(), AI_GetHidingTeam(), AI_IsExposed(), AI_PlayerRun(), AI_TurnIntoDirection(), AIL_InitActor(), AIL_missiontargets(), AIL_positionshoot(), AIL_see(), AIL_waypoints(), ReactionFire::canSee(), Door_Use(), G_ActionCheck(), G_Actor2x2Spawn(), G_ActorDieOrStun(), G_ActorDoTurn(), G_ActorInvMove(), G_ActorModifyCounters(), G_ActorRevitalise(), G_ActorShouldStopInMidMove(), G_ActorSpawn(), G_ClientGetFreeSpawnPoint(), G_ClientGetFreeSpawnPointForActorSize(), G_ClientMove(), G_ClientShoot(), G_ClientStateChangeUpdate(), G_ClientTeamInfo(), G_Damage(), G_EdictsGetActorByUCN(), G_EdictsGetNextLivingActorOfTeam(), G_EventActorAdd(), G_EventActorAppear(), G_EventCameraAppear(), G_EventSendState(), G_EventSetClientAction(), G_GetClosePlayerMask(), G_MatchEndTrigger(), G_MatchSendResults(), G_MissionReset(), G_MissionThink(), G_MissionTouch(), G_Morale(), G_PrintActorStats(), G_ReactionFireCanBeEnabled(), G_SendInvisible(), G_SendPlayerStats(), G_SendStats(), G_ShootSingle(), G_SpawnAIPlayer(), G_SplashDamage(), G_TreatActor(), G_UpdateCharacterBodycount(), G_UpdateHitScore(), G_UpdateShotMock(), G_Vis(), G_VisMakeEverythingVisible(), ReactionFire::isEnemy(), isOpponent(), isSameTeamAs(), SP_2x2_start(), SP_misc_mission(), SP_player_start(), and TEST_F().

bool Edict::hasTouch ( ) const
inline

Definition at line 324 of file g_edict.h.

References _touch.

Referenced by G_TouchEdicts(), G_TouchSolids(), and G_TouchTriggers().

bool Edict::isOpponent ( const Actor actor) const

Check if given actor is an enemy.

Parameters
[in]actorThe actor that makes the check.
Returns
true if enemies. false otherwise
Todo:
Should we really know if the other actor is controlled by the other team (STATE_XVI)? aliens would of course know if an actor is infected (becomes part of the hive mind), but humans?

Definition at line 383 of file g_edicts.cpp.

References G_IsAlien, G_IsCivilian, G_IsState, getTeam(), isSameTeamAs(), Actor::isState(), STATE_XVI, TEAM_ALIEN, and TEAM_CIVILIAN.

Referenced by AI_IsHostile().

bool Edict::isSameAs ( const Edict other) const
inline

Definition at line 275 of file g_edict.h.

References getIdNum().

Referenced by AI_CheckFF(), and G_UpdateShotMock().

bool Edict::isSamePosAs ( const pos3_t  cmpPos)
inline

Check whether the edict is on the given position.

Parameters
cmpPosThe grid position to compare to
Returns
true if positions are equal

Definition at line 286 of file g_edict.h.

References VectorCompare.

Referenced by AI_CheckPosition(), AI_FighterCalcActionScore(), AI_PrepBestAction(), AIL_positionapproach(), G_ClientShoot(), G_ShootSingle(), G_ShotMorale(), and pos3L_goto().

void Edict::nativeReset ( )
inline

Definition at line 195 of file g_edict.h.

References init().

Referenced by ED_ParseEdict(), and G_FreeEdict().

Edict* Edict::owner ( )
inline

Definition at line 240 of file g_edict.h.

References _owner.

Referenced by Reset_DoorTrigger(), Touch_DoorTrigger(), and Touch_TouchTrigger().

void Edict::resetContainer ( const containerIndex_t  idx)
inline

Definition at line 204 of file g_edict.h.

References character_s::inv, and Inventory::resetContainer().

Referenced by G_InventoryToFloor().

void Edict::resetFloor ( )
inline

Definition at line 210 of file g_edict.h.

References character_s::inv, and Inventory::setFloorContainer().

Referenced by G_ActorDieOrStun(), G_ClientMove(), and G_GetFloorItems().

void Edict::setActive ( )
inline

Definition at line 198 of file g_edict.h.

Referenced by G_Spawn().

void Edict::setChild ( Edict child)
inline

Definition at line 192 of file g_edict.h.

References child().

Referenced by SP_func_door(), SP_trigger_hurt(), SP_trigger_nextmap(), SP_trigger_rescue(), and SP_trigger_touch().

void Edict::setFloor ( const Edict other)
inline
void Edict::setMorale ( int  mor)
inline
void Edict::setOrigin ( const pos3_t  newPos)
inline

Set the edict's pos and origin vector to the given grid position.

Parameters
newPosThe new grid position

Definition at line 223 of file g_edict.h.

References calcOrigin(), and VectorCopy.

Referenced by AI_CheckForMissionTargets(), AI_CivilianCalcActionScore(), AI_FighterCalcActionScore(), AI_PanicCalcActionScore(), AIL_positionflee(), AIL_positionherd(), AIL_positionhide(), AIL_positionmission(), and AIL_positionshoot().

void Edict::setPlayerNum ( int  num)
inline

Definition at line 186 of file g_edict.h.

Referenced by G_ClientGetFreeSpawnPointForActorSize().

void Edict::setStun ( int  stu)
inline

Definition at line 302 of file g_edict.h.

Referenced by AI_SetStats(), G_SendStats(), G_TreatActor(), and G_UpdateStunState().

void Edict::setTeam ( int  team_)
inline
void Edict::setTouch ( bool(*)(Edict *self, Edict *activator)  touch_)
inline
void Edict::setTus ( int  tus)
inline

Definition at line 315 of file g_edict.h.

Referenced by G_ActorSetTU().

void Edict::toggleActive ( )
inline

Definition at line 201 of file g_edict.h.

Field Documentation

Edict* Edict::_child

e.g. the trigger for this edict

Definition at line 64 of file g_edict.h.

Referenced by child(), and init().

Edict* Edict::_owner

e.g. the door model in case of func_door

Definition at line 65 of file g_edict.h.

Referenced by G_TriggerSpawn(), init(), and owner().

int Edict::_STUN

The stun damage received in a mission.

Definition at line 90 of file g_edict.h.

Referenced by getStun(), and init().

bool(* Edict::_touch)(Edict *self, Edict *activator)

function to call when triggered - this function should only return true when there is a client action associated with it

Definition at line 146 of file g_edict.h.

Referenced by callTouch(), hasTouch(), init(), and setTouch().

AABB Edict::absBox
bool Edict::active

Definition at line 177 of file g_edict.h.

Referenced by ED_ParseField(), and init().

AI_t Edict::AI

The character's artificial intelligence

Definition at line 171 of file g_edict.h.

Referenced by AIL_ActorThink(), AIL_class(), AIL_InitActor(), and init().

float Edict::angle

entity yaw - (0-360 degree) set via mapeditor - sometimes used for movement direction, then -1=up; -2=down is used additionally

Definition at line 120 of file g_edict.h.

Referenced by ED_ParseField(), G_Actor2x2Spawn(), G_ActorSpawn(), G_EventAddBrushModel(), init(), and SP_misc_camera().

vec3_t Edict::angles

the rotation in the world (pitch, yaw, roll)

Definition at line 54 of file g_edict.h.

Referenced by Door_Use(), ED_ParseField(), G_EventAddBrushModel(), and init().

unsigned int Edict::body
protected

the model indices

Definition at line 99 of file g_edict.h.

Referenced by Actor::getBody(), and init().

camera_edict_data_t Edict::camera

Definition at line 134 of file g_edict.h.

Referenced by G_EventCameraAppear(), G_FrustumVis(), G_InitCamera(), and init().

character_t Edict::chr

here are the character values

Definition at line 116 of file g_edict.h.

Referenced by actorL_isinjured(), actorL_tostring(), AI_CivilianCalcActionScore(), AI_FindBestFiredef(), AI_InitPlayer(), AI_SearchGrenade(), AI_SetCharacterValues(), AI_SetEquipment(), AI_SetStats(), AI_TryToReloadWeapon(), AIL_InitActor(), AIL_isfighter(), ReactionFire::canReact(), G_ActorCalculateMaxTU(), G_ActorGetInjuryPenalty(), G_ActorGetTUForReactionFire(), G_ActorHasEnoughTUsReactionFire(), G_ActorHasWorkingFireModeSet(), G_ActorInvMove(), G_ActorReload(), G_ActorReserveTUs(), G_ActorRevitalise(), G_ActorSetMaxs(), G_AddItemToFloor(), G_ApplyProtection(), G_BleedWounds(), G_CalcEffectiveSpread(), G_CheckDeathOrKnockout(), G_ClientAction(), G_ClientAssignDefaultActorValues(), G_ClientCanReload(), G_ClientGetFreeSpawnPointForActorSize(), G_ClientGetWeaponFromInventory(), G_ClientMove(), G_ClientReadCharacter(), G_ClientReadInventory(), G_ClientShoot(), G_ClientStateChange(), G_Damage(), G_DamageActor(), G_EdictsGetActorByUCN(), G_EventActorAdd(), G_EventActorAppear(), G_EventActorSendReservations(), G_EventActorWound(), G_EventReactionFireChange(), G_GetEarnedExperience(), G_InventoryDropToFloorCheck(), G_InventoryRemoveItemByID(), G_InventoryToFloor(), G_IsActorWounded(), G_MissionTouch(), G_Morale(), G_MoraleBehaviour(), G_MoralePanic(), G_MoraleRage(), G_MoraleStopPanic(), G_MoraleStopRage(), G_PrepareShot(), G_PrintActorStats(), G_ReactionFireCanBeEnabled(), G_ReactionFireSettingsReserveTUs(), G_ReactionFireSettingsSetDefault(), G_ReactionFireSettingsUpdate(), G_SendCharacterData(), G_SendFootstepSound(), G_SendInventory(), G_SendWoundStats(), G_SpawnAIPlayer(), G_SpawnItemOnFloor(), G_SplashDamage(), G_TouchEdicts(), G_TreatActor(), G_UpdateCarriedWeight(), G_UpdateCharacterBodycount(), G_UpdateCharacterExperience(), G_UpdateHitScore(), ReactionFire::getFireDef(), init(), TEST_F(), Touch_HurtTrigger(), and ReactionFire::tryToShoot().

Edict* Edict::clientAction

client actions - interact with the world

Definition at line 113 of file g_edict.h.

Referenced by G_ActorSetClientAction(), G_ClientAction(), G_ClientMove(), G_EventSetClientAction(), init(), and Reset_DoorTrigger().

int Edict::contentFlags

contents flags of the brush the actor is walking in

Definition at line 84 of file g_edict.h.

Referenced by G_ClientTeamInfo(), G_SendFootstepSound(), G_WriteStep(), and init().

int Edict::count

general purpose 'amount' variable - set via mapeditor often

Definition at line 135 of file g_edict.h.

Referenced by AI_CheckForMissionTargets(), AIL_setwaypoint(), AIL_waypoints(), ED_ParseField(), G_MissionThink(), G_SpawnFieldPart(), init(), and SP_civilian_start().

const char* Edict::description

misc_mission

Definition at line 131 of file g_edict.h.

Referenced by ED_ParseField(), init(), and SP_misc_mission().

bool(* Edict::destroy)(Edict *self)
int Edict::dmg

damage done by entity

Definition at line 138 of file g_edict.h.

Referenced by AI_CheckPosition(), ED_ParseField(), G_SpawnFieldPart(), G_TouchTriggers(), init(), and SP_trigger_hurt().

byte Edict::dmgtype

damage type done by the entity

Definition at line 139 of file g_edict.h.

Referenced by AI_CheckPosition(), init(), SP_misc_fire(), SP_misc_smoke(), SP_misc_smokestun(), SP_trigger_hurt(), and Touch_HurtTrigger().

int Edict::doorState

open or closed

Definition at line 158 of file g_edict.h.

Referenced by AI_CheckUsingDoor(), Door_SlidingUse(), Door_Use(), init(), SP_func_door(), SP_func_door_sliding(), and TEST_F().

AABB Edict::entBox
pos3_t* Edict::forbiddenListPos

this is used for e.g. misc_models with the solid flag set - this will hold a list of grid positions that are blocked by the aabb of the model

Definition at line 173 of file g_edict.h.

Referenced by G_BuildForbiddenList(), G_BuildForbiddenListForEntity(), init(), and TEST_F().

int Edict::forbiddenListSize

amount of entries in the forbiddenListPos

Definition at line 175 of file g_edict.h.

Referenced by G_BuildForbiddenList(), G_BuildForbiddenListForEntity(), init(), and TEST_F().

int Edict::frame

frame of the model to show

Definition at line 102 of file g_edict.h.

Referenced by ED_ParseField(), init(), and SP_misc_model().

char* Edict::group

this can be used to trigger a group of entities e.g. for two-part-doors - set the group to the same string for each door part and they will open both if you open one

Definition at line 104 of file g_edict.h.

Referenced by ED_ParseField(), G_FindEdictGroups(), init(), and SP_misc_mission().

Edict* Edict::groupChain

flags will have FL_GROUPSLAVE set when the edict is part of a chain, but not the master - you can use the groupChain pointer to get all the edicts in the particular chain - and start out for the one that doesn't have the above mentioned flag set.

See also
G_FindEdictGroups

Definition at line 167 of file g_edict.h.

Referenced by AI_CheckForMissionTargets(), AIL_waypoints(), G_AddToWayPointList(), G_FindEdictGroups(), G_MissionThink(), G_UseEdict(), and init().

Edict* Edict::groupMaster

first entry in the list

Definition at line 168 of file g_edict.h.

Referenced by G_ActorUseDoor(), G_FindEdictGroups(), G_MissionThink(), G_UseEdict(), and init().

unsigned int Edict::head
protected

Definition at line 100 of file g_edict.h.

Referenced by Actor::getHead(), and init().

bool Edict::hiding

for ai actors - when they try to hide after they performed their action

Definition at line 142 of file g_edict.h.

Referenced by AI_ActorThink(), AI_CheckUsingDoor(), and init().

bool Edict::inRescueZone
protected

the actor is standing in a rescue zone if this is true - this means that when the mission is aborted the actor will not die

Definition at line 109 of file g_edict.h.

Referenced by init(), and Actor::isInRescueZone().

const char* Edict::item

the item id that must be placed to e.g. the func_mission to activate the use function

Definition at line 127 of file g_edict.h.

Referenced by ED_ParseField(), G_MissionThink(), init(), SP_misc_item(), and SP_misc_mission().

const Edict* Edict::link

can be used to store another edict that e.g. interacts with the current one

Definition at line 80 of file g_edict.h.

Referenced by G_ActorDie(), G_ActorRevitalise(), G_ActorStun(), G_MissionThink(), and init().

int Edict::linkcount

count the amount of server side links - if a link was called, something on the position or the size of the entity was changed

Definition at line 48 of file g_edict.h.

Referenced by init().

int Edict::mapNum

entity number in the map file

Definition at line 73 of file g_edict.h.

Referenced by G_SpawnEntities(), init(), and SP_func_breakable().

edictMaterial_t Edict::material

material value (e.g. for func_breakable)

Definition at line 133 of file g_edict.h.

Referenced by ED_ParseField(), G_InitCamera(), and init().

const char* Edict::message

misc_message

Definition at line 130 of file g_edict.h.

Referenced by ED_ParseField(), G_MissionThink(), init(), and SP_misc_message().

const char* Edict::model
int Edict::modelindex

inline model index

Definition at line 66 of file g_edict.h.

Referenced by G_EventAddBrushModel(), and init().

const char* Edict::nextmap

Definition at line 129 of file g_edict.h.

Referenced by ED_ParseField(), init(), and SP_trigger_nextmap().

float Edict::nextthink
const char* Edict::noise

sounds - e.g. for func_door

Definition at line 132 of file g_edict.h.

Referenced by Door_Use(), ED_ParseField(), init(), SP_func_door(), and SP_func_door_sliding().

int Edict::number

the number in the global edict array

Definition at line 51 of file g_edict.h.

Referenced by ReactionFireTargets::add(), G_EdictDuplicate(), G_Spawn(), getIdNum(), init(), and ReactionFireTargets::remove().

const char* Edict::particle
Edict* Edict::particleLink

only used locally in game, not by server

Definition at line 79 of file g_edict.h.

Referenced by G_SpawnField(), and init().

int Edict::pnum
protected

the actual player slot

Definition at line 97 of file g_edict.h.

Referenced by G_ClientDisconnect(), getPlayer(), getPlayerNum(), and init().

int Edict::radius

this is used to extend the bounding box of a trigger_touch for e.g. misc_mission

Definition at line 123 of file g_edict.h.

Referenced by AI_CheckForMissionTargets(), AIL_positionmission(), ED_ParseField(), init(), and SP_misc_mission().

void(* Edict::reset)(Edict *self, Edict *activator)

reset function that is called before the touch triggers are called

Definition at line 148 of file g_edict.h.

Referenced by Destroy_Breakable(), G_ResetTriggers(), G_TriggerSpawn(), init(), SP_func_door(), SP_misc_mission(), SP_trigger_hurt(), SP_trigger_nextmap(), SP_trigger_rescue(), and SP_trigger_touch().

vec3_t Edict::size

Definition at line 62 of file g_edict.h.

Referenced by Door_SlidingUse().

int Edict::sounds

type of sounds to play - e.g. doors

Definition at line 137 of file g_edict.h.

Referenced by ED_ParseField(), and init().

int Edict::speed

speed of entities - e.g. rotating or actors

Definition at line 124 of file g_edict.h.

Referenced by ED_ParseField(), G_ClientMove(), G_EventAddBrushModel(), G_WriteStep(), init(), SP_func_door(), SP_func_door_sliding(), and SP_func_rotating().

int Edict::state
const char* Edict::target

name of the entity to trigger or move towards - this name is stored in the target edicts targetname value

Definition at line 125 of file g_edict.h.

Referenced by ED_ParseField(), G_MissionThink(), init(), SP_misc_mission(), and SP_trigger_touch().

const char* Edict::targetname

name pointed to by target - see the target of the parent edict

Definition at line 126 of file g_edict.h.

Referenced by ED_ParseField(), G_EdictsFindTargetEntity(), init(), and TEST_F().

int Edict::team
protected

player of which team?

Definition at line 96 of file g_edict.h.

Referenced by G_ActorModifyCounters(), getTeam(), and init().

int Edict::time

general purpose 'rounds' variable - set via mapeditor often

Definition at line 136 of file g_edict.h.

Referenced by ED_ParseField(), G_MissionThink(), G_SpawnField(), init(), and SP_misc_mission().

linkedList_t* Edict::touchedList

entity list of edicts that are currently touching the trigger_touch

Definition at line 157 of file g_edict.h.

Referenced by Destroy_Breakable(), and init().

bool(* Edict::use)(Edict *self, Edict *activator)

general use function that is called when the triggered client action is executed or when the server has to 'use' the entity

Parameters
activatorMight be nullptr if there is no activator

Definition at line 154 of file g_edict.h.

Referenced by G_InitCamera(), G_MissionUse(), G_UseEdict(), init(), SP_func_breakable(), SP_func_door(), SP_func_door_sliding(), SP_misc_message(), and SP_misc_mission().


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