static int G_DoTestVis (const int team, edict_t * check, bool perish, int playerMask, const edict_t *ent) { int status = 0; const int visFlags = perish ? VT_PERISH : 0; const int vis = G_TestVis(team, check, visFlags); /* visibility has changed ... */ if (vis & VIS_CHANGE) { /* swap the vis mask for the given team */ const bool appear = (vis & VIS_YES) == VIS_YES; if (playerMask == 0) { G_VisFlagsSwap(check, G_TeamToVisMask(team)); } else { G_AppearPerishEvent(playerMask, appear, check, ent); } /* ... to visible */ if (vis & VIS_YES) { status |= VIS_APPEAR; if (G_VisShouldStop(check)) status |= VIS_STOP; } else status |= VIS_PERISH; } return status; }
/** * @param[in] team The team looking at the edict (or not) * @param[in] check The edict to check the visibility for * @param[in] visFlags The flags for the vis check * @param[in] playerMask The mask for the players to send the appear/perish events to. If this is @c 0 the events * are not sent - we only update the visflags of the edict * @param[in] ent The edict that was responsible for letting the check edict appear and is looking */ static int G_DoTestVis (const int team, Edict* check, const vischeckflags_t visFlags, playermask_t playerMask, const Edict* ent) { int status = 0; const int vis = G_TestVis(team, check, visFlags); /* visibility has changed ... */ if (vis & VS_CHANGE) { /* swap the vis mask for the given team */ const bool appear = (vis & VS_YES) == VS_YES; if (playerMask == 0) { G_VisFlagsSwap(*check, G_TeamToVisMask(team)); } else { G_AppearPerishEvent(playerMask, appear, *check, ent); } /* ... to visible */ if (vis & VS_YES) { status |= VIS_APPEAR; if (G_VisShouldStop(check)) status |= VIS_STOP; } else { status |= VIS_PERISH; } } else if (vis == 0 && (visFlags & VT_NEW)) { if (G_IsActor(check)) { G_EventActorAdd(playerMask, *check); } } return status; }