- Backported VisibleToTeam and VisibleToPlayerClass from Skulltag with some modifications.

SVN r3290 (trunk)
This commit is contained in:
Braden Obrzut 2011-09-08 01:28:26 +00:00
commit c013e72caa
4 changed files with 58 additions and 1 deletions

View file

@ -310,6 +310,7 @@ void AActor::Serialize (FArchive &arc)
<< smokecounter
<< BlockingMobj
<< BlockingLine
<< VisibleToTeam // [BB]
<< pushfactor
<< Species
<< Score;
@ -871,6 +872,34 @@ bool AActor::CheckLocalView (int playernum) const
return false;
}
//============================================================================
//
// AActor :: IsVisibleToPlayer
//
// Returns true if this actor should be seen by the console player.
//
//============================================================================
bool AActor::IsVisibleToPlayer() const
{
// [BB] Safety check. This should never be NULL. Nevertheless, we return true to leave the default ZDoom behavior unaltered.
if ( players[consoleplayer].camera == NULL )
return true;
if ( VisibleToTeam != 0 && teamplay &&
VisibleToTeam-1 != players[consoleplayer].userinfo.team )
return false;
const player_t* pPlayer = players[consoleplayer].camera->player;
if ( ( VisibleToPlayerClass != NAME_None )
&& pPlayer && pPlayer->mo && ( VisibleToPlayerClass != pPlayer->mo->GetClass()->TypeName ) )
return false;
// [BB] Passed all checks.
return true;
}
//============================================================================
//
// AActor :: ConversationAnimation