mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-03-11 03:41:22 +00:00
- Adjust VisibleToPlayerClass to accept multiple classes as well as work with inheritance.
SVN r3291 (trunk)
This commit is contained in:
parent
c013e72caa
commit
faa122ede3
4 changed files with 22 additions and 9 deletions
|
@ -820,9 +820,6 @@ public:
|
||||||
// [BB] If 0, everybody can see the actor, if > 0, only members of team (VisibleToTeam-1) can see it.
|
// [BB] If 0, everybody can see the actor, if > 0, only members of team (VisibleToTeam-1) can see it.
|
||||||
DWORD VisibleToTeam;
|
DWORD VisibleToTeam;
|
||||||
|
|
||||||
// [BB] If NAME_None, all players can see the actor, else only players whose playerclass name is VisibleToPlayerClass can see it.
|
|
||||||
FNameNoInit VisibleToPlayerClass;
|
|
||||||
|
|
||||||
int special1; // Special info
|
int special1; // Special info
|
||||||
int special2; // Special info
|
int special2; // Special info
|
||||||
int health;
|
int health;
|
||||||
|
|
|
@ -210,6 +210,7 @@ struct FActorInfo
|
||||||
PainChanceList *PainChances;
|
PainChanceList *PainChances;
|
||||||
PainFlashList *PainFlashes;
|
PainFlashList *PainFlashes;
|
||||||
FPlayerColorSetMap *ColorSets;
|
FPlayerColorSetMap *ColorSets;
|
||||||
|
TArray<const PClass *> VisibleToPlayerClass;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FDoomEdMap
|
class FDoomEdMap
|
||||||
|
|
|
@ -892,9 +892,21 @@ bool AActor::IsVisibleToPlayer() const
|
||||||
|
|
||||||
const player_t* pPlayer = players[consoleplayer].camera->player;
|
const player_t* pPlayer = players[consoleplayer].camera->player;
|
||||||
|
|
||||||
if ( ( VisibleToPlayerClass != NAME_None )
|
if(pPlayer && pPlayer->mo && GetClass()->ActorInfo->VisibleToPlayerClass.Size() > 0)
|
||||||
&& pPlayer && pPlayer->mo && ( VisibleToPlayerClass != pPlayer->mo->GetClass()->TypeName ) )
|
{
|
||||||
return false;
|
bool visible = false;
|
||||||
|
for(unsigned int i = 0;i < GetClass()->ActorInfo->VisibleToPlayerClass.Size();++i)
|
||||||
|
{
|
||||||
|
const PClass *cls = GetClass()->ActorInfo->VisibleToPlayerClass[i];
|
||||||
|
if(cls && pPlayer->mo->GetClass()->IsDescendantOf(cls))
|
||||||
|
{
|
||||||
|
visible = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!visible)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// [BB] Passed all checks.
|
// [BB] Passed all checks.
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -1246,10 +1246,13 @@ DEFINE_PROPERTY(visibletoteam, I, Actor)
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
// [BB]
|
// [BB]
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
DEFINE_PROPERTY(visibletoplayerclass, S, Actor)
|
DEFINE_PROPERTY(visibletoplayerclass, S_s, Actor)
|
||||||
{
|
{
|
||||||
PROP_STRING_PARM(n, 0);
|
for(unsigned int i = 0;i < PROP_PARM_COUNT;++i)
|
||||||
defaults->VisibleToPlayerClass = n;
|
{
|
||||||
|
PROP_STRING_PARM(n, i);
|
||||||
|
info->VisibleToPlayerClass.Push(FindClassTentative(n, "PlayerPawn"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
Loading…
Reference in a new issue