UFO: Alien Invasion
|
#include "g_local.h"
Go to the source code of this file.
Macros | |
#define | TEAM_ALL 0xFFFFFFFF |
#define | VIS_APPEAR 1 |
#define | VIS_PERISH 2 |
#define | VIS_STOP 4 |
#define | VS_CHANGE 1 |
#define | VS_YES 2 |
#define | VT_PERISHCHK 1 |
#define | VT_NOFRUSTUM 2 |
#define | VT_NEW 4 |
#define | ACTOR_VIS_100 1.0f |
#define | ACTOR_VIS_50 0.5f |
#define | ACTOR_VIS_10 0.1f |
#define | ACTOR_VIS_0 0.0f |
Typedefs | |
typedef unsigned int | teammask_t |
typedef unsigned int | vischeckflags_t |
Functions | |
bool | G_FrustumVis (const Edict *from, const vec3_t point) |
Checks whether a point is "visible" from the edicts position. More... | |
bool | G_SmokeVis (const vec3_t from, const Edict *check) |
tests for smoke interference More... | |
float | G_ActorVis (const Edict *ent, const Edict *check, bool full) |
calculate how much check is "visible" by ent More... | |
void | G_VisFlagsClear (int team) |
Reset the visflags for all edicts in the global list for the given team - and only for the given team. More... | |
void | G_VisFlagsAdd (Edict &ent, teammask_t teamMask) |
void | G_VisFlagsSwap (Edict &ent, teammask_t teamMask) |
void | G_VisFlagsReset (Edict &ent) |
void | G_VisMakeEverythingVisible (void) |
Make everything visible to anyone who can't already see it. More... | |
void | G_CheckVis (Edict *check, const vischeckflags_t visFlags=VT_PERISHCHK) |
Check if the edict appears/perishes for the other teams. If they appear for other teams, the needed information for those clients are also send in G_CheckVisTeam resp. G_AppearPerishEvent . More... | |
void | G_CheckVisPlayer (Player &player, const vischeckflags_t visFlags) |
Sets visible edict on player spawn. More... | |
int | G_CheckVisTeamAll (const int team, const vischeckflags_t visFlags, const Edict *ent) |
Do G_CheckVisTeam for all entities ent is the one that is looking at the others. More... | |
int | G_TestVis (const int team, Edict *check, const vischeckflags_t flags) |
test if check is visible by team (or if visibility changed?) More... | |
bool | G_Vis (const int team, const Edict *from, const Edict *check, const vischeckflags_t flags) |
test if check is visible by from More... | |
int | G_VisCheckDist (const Edict *const ent) |
#define ACTOR_VIS_0 0.0f |
Definition at line 64 of file g_vis.h.
Referenced by AI_CheckUsingDoor(), AI_FindBestFiredef(), AI_SearchDestroyableObject(), G_ActorVis(), and G_Vis().
#define ACTOR_VIS_10 0.1f |
Definition at line 63 of file g_vis.h.
Referenced by AI_CivilianCalcActionScore(), AI_FighterCalcActionScore(), AI_PanicCalcActionScore(), AIL_positionshoot(), ReactionFire::canSee(), and G_ActorVis().
#define ACTOR_VIS_100 1.0f |
#define ACTOR_VIS_50 0.5f |
Definition at line 62 of file g_vis.h.
Referenced by AI_CheckCrouch(), and G_ActorVis().
#define TEAM_ALL 0xFFFFFFFF |
Definition at line 32 of file g_vis.h.
Referenced by AIL_Init(), AIL_missiontargets(), AIL_positionhide(), AIL_see(), and G_BuildForbiddenList().
#define VIS_APPEAR 1 |
Edict became visible
Definition at line 36 of file g_vis.h.
Referenced by G_ActorShouldStopInMidMove(), G_ClientEndRound(), and G_DoTestVis().
#define VIS_PERISH 2 |
#define VIS_STOP 4 |
stop the current action if actor appears
Definition at line 40 of file g_vis.h.
Referenced by G_ActorDoTurn(), G_ActorShouldStopInMidMove(), G_ClientMove(), and G_DoTestVis().
#define VS_CHANGE 1 |
the visibility changed - (invisible to visible or vice versa)
Definition at line 44 of file g_vis.h.
Referenced by G_DoTestVis(), and G_TestVis().
#define VS_YES 2 |
actor is visible
Definition at line 46 of file g_vis.h.
Referenced by AI_IsExposed(), AIL_positionapproach(), AIL_positionflee(), G_DoTestVis(), and G_TestVis().
#define VT_NEW 4 |
If the actor doesn't become visible add it as a hidden actor (sends the EV_ACTOR_ADD event)
Definition at line 58 of file g_vis.h.
Referenced by G_DoTestVis(), and G_SpawnAIPlayer().
#define VT_NOFRUSTUM 2 |
don't perform a frustum vis check via G_FrustumVis in G_Vis
Definition at line 55 of file g_vis.h.
Referenced by AI_HideNeeded(), AI_IsExposed(), AIL_positionapproach(), AIL_positionflee(), AIL_see(), and G_Vis().
#define VT_PERISHCHK 1 |
check whether edict is still visible - it maybe is currently visible but this might have changed due to some action
Definition at line 53 of file g_vis.h.
Referenced by AI_IsExposed(), AIL_positionapproach(), AIL_positionflee(), G_SpawnAIPlayer(), and G_TestVis().
typedef unsigned int teammask_t |
typedef unsigned int vischeckflags_t |
calculate how much check is "visible" by ent
[in] | ent | The source edict of the check |
[in] | check | The edict to check how good (or if at all) it is visible |
[in] | full | Perform a full check in different directions. If this is false the actor is fully visible if one vis check returned true . With true this function can also return a value != 0.0 and != 1.0. Try to only use true if you really need the full check. Full checks are of course more expensive. |
Definition at line 100 of file g_vis.cpp.
References ACTOR_VIS_0, ACTOR_VIS_10, ACTOR_VIS_100, ACTOR_VIS_50, G_ActorGetEyeVector(), G_IsCrouched, G_IsDead, G_LineVis(), G_SmokeVis(), i, Edict::origin, PLAYER_CROUCH, PLAYER_DEAD, PLAYER_MIN, PLAYER_STAND, VectorCopy, VectorMA(), and VectorNormalizeFast().
Referenced by AI_CheckCrouch(), AI_CheckUsingDoor(), AI_CivilianCalcActionScore(), AI_FighterCalcActionScore(), AI_FindBestFiredef(), AI_PanicCalcActionScore(), AI_SearchDestroyableObject(), AIL_positionshoot(), ReactionFire::canSee(), G_Morale(), and G_Vis().
void G_CheckVis | ( | Edict * | check, |
const vischeckflags_t | visFlags | ||
) |
Check if the edict appears/perishes for the other teams. If they appear for other teams, the needed information for those clients are also send in G_CheckVisTeam
resp. G_AppearPerishEvent
.
[in] | check | The edict that is maybe seen by others. If nullptr, all edicts are checked |
visFlags | Modifiers for the checks |
Definition at line 409 of file g_vis.cpp.
References G_CheckVisTeam(), G_CheckVisTeamAll(), level, MAX_TEAMS, and level_locals_s::num_alive.
Referenced by Door_Use(), G_ActorDieOrStun(), G_ActorFall(), G_ActorInvMove(), G_ActorRevitalise(), G_ClientMove(), G_ClientStateChangeUpdate(), G_Damage(), G_InventoryToFloor(), G_SpawnAIPlayer(), G_SpawnAIPlayers(), G_SpawnItemOnFloor(), G_SpawnParticle(), SP_misc_smoke(), and Think_SmokeAndFire().
void G_CheckVisPlayer | ( | Player & | player, |
const vischeckflags_t | visFlags | ||
) |
Sets visible edict on player spawn.
Definition at line 327 of file g_vis.cpp.
References G_DoTestVis(), G_EdictsGetNextInUse(), and G_PlayerToPM.
Referenced by G_ClientStartMatch().
int G_CheckVisTeamAll | ( | const int | team, |
const vischeckflags_t | visFlags, | ||
const Edict * | ent | ||
) |
Do G_CheckVisTeam
for all entities ent is the one that is looking at the others.
Definition at line 376 of file g_vis.cpp.
References G_CheckVisTeam(), and G_EdictsGetNextInUse().
Referenced by AIL_see(), Door_Use(), G_ActorDieOrStun(), G_ActorDoTurn(), G_ActorRevitalise(), G_CheckVis(), G_ClientEndRound(), G_ClientMove(), G_ClientShoot(), G_ClientStateChangeUpdate(), G_Damage(), and G_SpawnAIPlayer().
Checks whether a point is "visible" from the edicts position.
Definition at line 38 of file g_vis.cpp.
References Edict::camera, Edict::dir, FrustumVis(), G_IsActiveCamera, Edict::origin, and camera_edict_data_s::rotate.
Referenced by AI_CheckCrouch(), AI_CheckUsingDoor(), ReactionFire::canSee(), G_Morale(), G_SplashDamage(), G_TeamPointVis(), and G_Vis().
tests for smoke interference
[in] | from | The point to check visibility from |
[in] | check | The edict to check visibility to |
check
is invisible from from
(smoke is in the way), false otherwise. Definition at line 65 of file g_vis.cpp.
References Edict::absBox, f, G_EdictsGetNextInUse(), G_IsSmoke, AABB::maxs, AABB::mins, Edict::origin, RayIntersectAABB(), UNIT_SIZE, and VectorDist.
Referenced by G_ActorVis(), and G_SplashDamage().
int G_TestVis | ( | const int | team, |
Edict * | check, | ||
const vischeckflags_t | flags | ||
) |
test if check
is visible by team (or if visibility changed?)
[in] | team | the team the edict may become visible for or perish from their view |
[in] | check | the edict we are talking about - which may become visible or perish |
[in] | flags | if you want to check whether the edict may also perish from other players view, you should use the VT_PERISHCHK bits |
VT_PERISHCHK
, no further checks are performed - only the VS_YES
bits are returned Definition at line 255 of file g_vis.cpp.
References g_aidebug, G_EdictsGetNextInUse(), G_IsVisibleForTeam, G_Vis(), cvar_s::integer, VS_CHANGE, VS_YES, and VT_PERISHCHK.
Referenced by AI_IsExposed(), AIL_positionapproach(), AIL_positionflee(), and G_DoTestVis().
bool G_Vis | ( | const int | team, |
const Edict * | from, | ||
const Edict * | check, | ||
const vischeckflags_t | flags | ||
) |
test if check is visible by from
[in] | team | Living team members are always visible. If this is a negative number we inverse the team rules (see comments included). In combination with VT_NOFRUSTUM we can check whether there is any edict (that is no in our team) that can see check |
[in] | from | is from team team and must be a living actor |
[in] | check | The edict we want to get the visibility for |
[in] | flags | VT_NOFRUSTUM , ... |
Definition at line 183 of file g_vis.cpp.
References ACTOR_VIS_0, ET_ACTOR, ET_ACTOR2x2, ET_CAMERA, ET_ITEM, ET_PARTICLE, G_ActorGetEyeVector(), G_ActorVis(), G_FrustumVis(), G_IsActiveCamera, G_IsDead, G_IsLivingActor(), G_IsVisibleOnBattlefield, G_LineVis(), G_VisCheckDist(), Edict::getTeam(), Edict::inuse, Edict::origin, Edict::pos, Edict::type, VectorCompare, VectorDistSqr, and VT_NOFRUSTUM.
Referenced by AI_HideNeeded(), AIL_see(), and G_TestVis().
Definition at line 163 of file g_vis.cpp.
References G_ActorGetInjuryPenalty(), G_IsActiveCamera, G_IsActor, MAX_SPOT_DIST, MAX_SPOT_DIST_CAMERA, and MODIFIER_SIGHT.
Referenced by AI_CheckCrouch(), AI_CheckUsingDoor(), AIL_missiontargets(), AIL_see(), ReactionFire::canSee(), and G_Vis().
void G_VisFlagsAdd | ( | Edict & | ent, |
teammask_t | teamMask | ||
) |
Definition at line 433 of file g_vis.cpp.
References Edict::visflags.
Referenced by G_ClientSendEdictsAndBrushModels(), and G_SplashDamage().
Reset the visflags for all edicts in the global list for the given team - and only for the given team.
Definition at line 424 of file g_vis.cpp.
References G_EdictsGetNextInUse(), G_TeamToVisMask, and Edict::visflags.
Referenced by G_ClientStartMatch(), and G_SpawnAIPlayers().
Definition at line 438 of file g_vis.cpp.
References Edict::visflags.
Referenced by G_ClientGetFreeSpawnPointForActorSize(), G_InventoryToFloor(), and G_SpawnItemOnFloor().
void G_VisFlagsSwap | ( | Edict & | ent, |
teammask_t | teamMask | ||
) |
Definition at line 443 of file g_vis.cpp.
References Edict::visflags.
Referenced by G_AppearPerishEvent(), and G_DoTestVis().
Make everything visible to anyone who can't already see it.
Definition at line 390 of file g_vis.cpp.
References G_AppearPerishEvent(), G_EdictsGetNextInUse(), G_IsActor, G_SendInventory(), G_TeamToPM(), G_VisToPM(), Edict::getTeam(), and Edict::visflags.
Referenced by G_MatchSendResults().