- Added DesingatedTeam property from Skulltag. Allows friendly fire calculations to be applied to monsters/objects and allows the friendly AI to be aware of teams.

SVN r3113 (trunk)
This commit is contained in:
Braden Obrzut 2011-01-22 03:35:33 +00:00
commit d9d94d04ba
6 changed files with 56 additions and 23 deletions

View file

@ -44,6 +44,7 @@
#include "thingdef/thingdef.h"
#include "d_dehacked.h"
#include "g_level.h"
#include "teaminfo.h"
#include "gi.h"
@ -1417,9 +1418,7 @@ AActor *LookForEnemiesInBlock (AActor *lookee, int index, void *extparam)
other = NULL;
if (link->flags & MF_FRIENDLY)
{
if (deathmatch &&
lookee->FriendPlayer != 0 && link->FriendPlayer != 0 &&
lookee->FriendPlayer != link->FriendPlayer)
if (!lookee->IsFriend(link))
{
// This is somebody else's friend, so go after it
other = link;
@ -1581,7 +1580,7 @@ bool P_LookForPlayers (AActor *actor, INTBOOL allaround, FLookExParams *params)
}
#endif
// [SP] If you don't see any enemies in deathmatch, look for players (but only when friend to a specific player.)
if (actor->FriendPlayer == 0) return result;
if (actor->FriendPlayer == 0 && (!teamplay || actor->DesignatedTeam == TEAM_NONE)) return result;
if (result || !deathmatch) return true;
@ -1664,10 +1663,8 @@ bool P_LookForPlayers (AActor *actor, INTBOOL allaround, FLookExParams *params)
// We're going to ignore our master, but go after his enemies.
if ( actor->flags & MF_FRIENDLY )
{
if ( actor->FriendPlayer == 0 )
continue; // I have no friends, I will ignore players.
if ( actor->FriendPlayer == player->mo->FriendPlayer )
continue; // This is my master.
if ( actor->IsFriend(player->mo) )
continue;
}
if ((player->mo->flags & MF_SHADOW && !(i_compatflags & COMPATF_INVISIBILITY)) ||