From 8af2f5aaf6223fb91698ab7f59c0c7da5fa81451 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Mon, 13 Feb 2023 13:32:44 -0500 Subject: [PATCH] - add +mnotvisible flag as per feature suggestion: https://forum.zdoom.org/viewtopic.php?t=77277 --- src/playsim/actor.h | 1 + src/playsim/p_enemy.cpp | 2 +- src/playsim/p_mobj.cpp | 1 + src/playsim/p_sight.cpp | 5 ++++- src/scripting/thingdef_data.cpp | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/playsim/actor.h b/src/playsim/actor.h index b1c848e409..41f57ef28e 100644 --- a/src/playsim/actor.h +++ b/src/playsim/actor.h @@ -413,6 +413,7 @@ enum ActorFlag8 MF8_STOPRAILS = 0x00000200, // [MC] Prevent rails from going further if an actor has this flag. MF8_ABSVIEWANGLES = 0x00000400, // [MC] By default view angle/pitch/roll is an offset. This will make it absolute instead. MF8_FALLDAMAGE = 0x00000800, // Monster will take fall damage regardless of map settings. + MF8_MNOTVISIBLE = 0x00001000, // Actor not visible to monsters MF8_ALLOWTHRUBITS = 0x00008000, // [MC] Enable ThruBits property MF8_FULLVOLSEE = 0x00010000, // Play see sound at full volume MF8_E1M8BOSS = 0x00020000, // MBF21 boss death. diff --git a/src/playsim/p_enemy.cpp b/src/playsim/p_enemy.cpp index 7eea4cefb4..0514f848a4 100644 --- a/src/playsim/p_enemy.cpp +++ b/src/playsim/p_enemy.cpp @@ -2344,7 +2344,7 @@ void A_DoChase (AActor *actor, bool fastchase, FState *meleestate, FState *missi // [RH] Don't chase invisible targets if (actor->target != NULL && - actor->target->renderflags & RF_INVISIBLE && + ((actor->target->renderflags & RF_INVISIBLE) || (actor->target->flags8 & MF8_MNOTVISIBLE)) && actor->target != actor->goal) { actor->target = nullptr; diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 1c0052abec..af416f1949 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -1681,6 +1681,7 @@ bool AActor::CanSeek(AActor *target) const if ((flags2 & MF2_DONTSEEKINVISIBLE) && ((target->flags & MF_SHADOW) || (target->renderflags & RF_INVISIBLE) || + (target->flags8 & MF8_MNOTVISIBLE) || !target->RenderStyle.IsVisible(target->Alpha) ) ) return false; diff --git a/src/playsim/p_sight.cpp b/src/playsim/p_sight.cpp index f75b1f61da..588bbec81a 100644 --- a/src/playsim/p_sight.cpp +++ b/src/playsim/p_sight.cpp @@ -866,7 +866,10 @@ sightcounts[0]++; // // [RH] Andy Baker's stealth monsters: // Cannot see an invisible object - if ((flags & SF_IGNOREVISIBILITY) == 0 && ((t2->renderflags & RF_INVISIBLE) || !t2->RenderStyle.IsVisible(t2->Alpha))) + if ((flags & SF_IGNOREVISIBILITY) == 0 && + ((t2->renderflags & RF_INVISIBLE) || + (t2->flags8 & MF8_MNOTVISIBLE) || + !t2->RenderStyle.IsVisible(t2->Alpha))) { // small chance of an attack being made anyway if ((t1->Level->BotInfo.m_Thinking ? pr_botchecksight() : pr_checksight()) > 50) { diff --git a/src/scripting/thingdef_data.cpp b/src/scripting/thingdef_data.cpp index 2861456d88..f04738b249 100644 --- a/src/scripting/thingdef_data.cpp +++ b/src/scripting/thingdef_data.cpp @@ -326,6 +326,7 @@ static FFlagDef ActorFlagDefs[]= DEFINE_FLAG(MF8, RETARGETAFTERSLAM, AActor, flags8), DEFINE_FLAG(MF8, STOPRAILS, AActor, flags8), DEFINE_FLAG(MF8, FALLDAMAGE, AActor, flags8), + DEFINE_FLAG(MF8, MNOTVISIBLE, AActor, flags8), DEFINE_FLAG(MF8, ABSVIEWANGLES, AActor, flags8), DEFINE_FLAG(MF8, ALLOWTHRUBITS, AActor, flags8), DEFINE_FLAG(MF8, FULLVOLSEE, AActor, flags8),