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,6 +1555,8 @@ AActor *LookForEnemiesInBlock (AActor *lookee, int index, void *extparam)
continue;
other = NULL;
if (lookee->flags & MF_FRIENDLY)
{
if (link->flags & MF_FRIENDLY)
{
if (!lookee->IsFriend(link))
@ -1577,6 +1579,11 @@ AActor *LookForEnemiesInBlock (AActor *lookee, int index, void *extparam)
{
other = link;
}
}
else if (lookee->flags8 & MF8_SEEFRIENDLYMONSTERS && link->flags & MF_FRIENDLY)
{
other = link;
}
// [MBF] If the monster is already engaged in a one-on-one attack
// with a healthy friend, don't attack around 60% the time.
@ -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),