UFO: Alien Invasion
|
#include "g_local.h"
#include "g_actor.h"
#include "g_client.h"
#include "g_edicts.h"
#include "g_health.h"
#include "g_inventory.h"
#include "g_utils.h"
#include "g_vis.h"
Go to the source code of this file.
Functions | |
bool | G_FrustumVis (const Edict *from, const vec3_t point) |
Checks whether a point is "visible" from the edicts position. More... | |
static bool | G_LineVis (const vec3_t from, const vec3_t to) |
tests the visibility between two points 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... | |
int | G_VisCheckDist (const Edict *const ent) |
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_TestVis (const int team, Edict *check, const vischeckflags_t flags) |
test if check is visible by team (or if visibility changed?) More... | |
static bool | G_VisShouldStop (const Edict *ent) |
static int | G_DoTestVis (const int team, Edict *check, const vischeckflags_t visFlags, playermask_t playerMask, const Edict *ent) |
void | G_CheckVisPlayer (Player &player, const vischeckflags_t visFlags) |
Sets visible edict on player spawn. More... | |
static int | G_CheckVisTeam (const int team, Edict *check, const vischeckflags_t visFlags, const Edict *ent) |
Checks whether an edict appear/perishes for a specific team - also updates the visflags each edict carries. 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... | |
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) |
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_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_VisFlagsReset (Edict &ent) |
void | G_VisFlagsSwap (Edict &ent, teammask_t teamMask) |
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().
|
static |
Checks whether an edict appear/perishes for a specific team - also updates the visflags each edict carries.
[in] | team | Team to check the vis for |
[in] | check | The edict that you want to check (and which maybe will appear or perish for the given team). If this is nullptr every edict will be checked. |
visFlags | Modifiers for the checks | |
[in] | ent | The edict that is (maybe) seeing other edicts |
G_AppearPerishEvent
Definition at line 359 of file g_vis.cpp.
References G_DoTestVis(), G_TeamToPM(), and Edict::inuse.
Referenced by G_CheckVis(), and G_CheckVisTeamAll().
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().
|
static |
[in] | team | The team looking at the edict (or not) |
[in] | check | The edict to check the visibility for |
[in] | visFlags | The flags for the vis check |
[in] | playerMask | The mask for the players to send the appear/perish events to. If this is 0 the events are not sent - we only update the visflags of the edict |
[in] | ent | The edict that was responsible for letting the check edict appear and is looking |
Definition at line 290 of file g_vis.cpp.
References G_AppearPerishEvent(), G_EventActorAdd(), G_IsActor, G_TeamToVisMask, G_TestVis(), G_VisFlagsSwap(), G_VisShouldStop(), VIS_APPEAR, VIS_PERISH, VIS_STOP, VS_CHANGE, VS_YES, and VT_NEW.
Referenced by G_CheckVisPlayer(), and G_CheckVisTeam().
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 the visibility between two points
[in] | from | The point to check visibility from |
[in] | to | The point to check visibility to |
Definition at line 54 of file g_vis.cpp.
References G_TestLineWithEnts().
Referenced by G_ActorVis(), 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().
|
static |
Definition at line 277 of file g_vis.cpp.
References G_IsCivilian, and G_IsLivingActor().
Referenced by G_DoTestVis().