diff --git a/src/playsim/actor.h b/src/playsim/actor.h index cbb98f69ce..6ba1e706c2 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -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 --- diff --git a/src/playsim/p_enemy.cpp b/src/playsim/p_enemy.cpp index 2da804105c..8a4a33f030 100644 --- a/src/playsim/p_enemy.cpp +++ b/src/playsim/p_enemy.cpp @@ -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() && diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index eeee67547a..ebd68beca5 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -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),