Added MF8_SEEFRIENDLYMONSTERS.

Non-friendly monsters with this flag on will be able to attack friendly monsters on sight.
This commit is contained in:
inkoalawetrust 2022-04-19 16:54:50 +03:00 committed by Rachael Alexanderson
parent 9963b5a57f
commit dbf707b83b
3 changed files with 30 additions and 15 deletions

View file

@ -423,7 +423,8 @@ enum ActorFlag8
MF8_MAP07BOSS2 = 0x00800000, // MBF21 boss death.
MF8_AVOIDHAZARDS = 0x01000000, // MBF AI enhancement.
MF8_STAYONLIFT = 0x02000000, // MBF AI enhancement.
MF8_DONTFOLLOWPLAYERS = 0x04000000, // [inkoalwetrust] Friendly monster will not follow players.
MF8_DONTFOLLOWPLAYERS = 0x04000000, // [inkoalawetrust] Friendly monster will not follow players.
MF8_SEEFRIENDLYMONSTERS = 0X08000000, // [inkoalawetrust] Hostile monster can see friendly monsters.
};
// --- mobj.renderflags ---

View file

@ -1555,25 +1555,32 @@ AActor *LookForEnemiesInBlock (AActor *lookee, int index, void *extparam)
continue;
other = NULL;
if (link->flags & MF_FRIENDLY)
if (lookee->flags & MF_FRIENDLY)
{
if (!lookee->IsFriend(link))
if (link->flags & MF_FRIENDLY)
{
// This is somebody else's friend, so go after it
other = link;
}
else if (link->target != NULL && !(link->target->flags & MF_FRIENDLY))
{
other = link->target;
if (!(other->flags & MF_SHOOTABLE) ||
other->health <= 0 ||
(other->flags2 & MF2_DORMANT))
if (!lookee->IsFriend(link))
{
other = NULL;;
// This is somebody else's friend, so go after it
other = link;
}
else if (link->target != NULL && !(link->target->flags & MF_FRIENDLY))
{
other = link->target;
if (!(other->flags & MF_SHOOTABLE) ||
other->health <= 0 ||
(other->flags2 & MF2_DORMANT))
{
other = NULL;;
}
}
}
else
{
other = link;
}
}
else
else if (lookee->flags8 & MF8_SEEFRIENDLYMONSTERS && link->flags & MF_FRIENDLY)
{
other = link;
}
@ -1617,7 +1624,7 @@ int P_LookForEnemies (AActor *actor, INTBOOL allaround, FLookExParams *params)
{
AActor *other;
other = P_BlockmapSearch (actor, actor->friendlyseeblocks, LookForEnemiesInBlock, params);
other = P_BlockmapSearch(actor, actor->friendlyseeblocks, LookForEnemiesInBlock, params);
if (other != NULL)
{
@ -1726,6 +1733,12 @@ int P_LookForPlayers (AActor *actor, INTBOOL allaround, FLookExParams *params)
} // [SP] if false, and in deathmatch, intentional fall-through
else if (actor->flags8 & MF8_SEEFRIENDLYMONSTERS)
{
bool result = P_LookForEnemies (actor, allaround, params);
if (result) return true;
}
if (!(gameinfo.gametype & (GAME_DoomStrifeChex)) &&
actor->Level->isPrimaryLevel() &&

View file

@ -339,6 +339,7 @@ static FFlagDef ActorFlagDefs[]=
DEFINE_FLAG(MF8, AVOIDHAZARDS, AActor, flags8),
DEFINE_FLAG(MF8, STAYONLIFT, AActor, flags8),
DEFINE_FLAG(MF8, DONTFOLLOWPLAYERS, AActor, flags8),
DEFINE_FLAG(MF8, SEEFRIENDLYMONSTERS, AActor, flags8),
// Effect flags
DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),