From 3277b508cdd74f0568e9301a63ff457a73dc408f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 26 May 2011 23:25:02 +0000 Subject: [PATCH] - added SEEINVISIBLE submission. SVN r3215 (trunk) --- src/actor.h | 1 + src/p_enemy.cpp | 37 +++++++++++++++++++--------------- src/p_mobj.cpp | 3 ++- src/thingdef/thingdef_data.cpp | 1 + 4 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/actor.h b/src/actor.h index 18d96a0dd..49d438be8 100644 --- a/src/actor.h +++ b/src/actor.h @@ -326,6 +326,7 @@ enum MF6_ADDITIVEPOISONDURATION = 0x00200000, MF6_NOMENU = 0x00400000, // Player class should not appear in the class selection menu. MF6_BOSSCUBE = 0x00800000, // Actor spawned by A_BrainSpit, flagged for timefreeze reasons. + MF6_SEEINVISIBLE = 0x01000000, // Monsters can see invisible player. // --- mobj.renderflags --- diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index 0931c4d51..19d32626b 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -1667,19 +1667,24 @@ bool P_LookForPlayers (AActor *actor, INTBOOL allaround, FLookExParams *params) continue; } - if ((player->mo->flags & MF_SHADOW && !(i_compatflags & COMPATF_INVISIBILITY)) || - player->mo->flags3 & MF3_GHOST) + // [RC] Well, let's let special monsters with this flag active be able to see + // the player then, eh? + if(!(actor->flags & MF6_SEEINVISIBLE)) { - if ((P_AproxDistance (player->mo->x - actor->x, - player->mo->y - actor->y) > 2*MELEERANGE) - && P_AproxDistance (player->mo->velx, player->mo->vely) - < 5*FRACUNIT) - { // Player is sneaking - can't detect - return false; - } - if (pr_lookforplayers() < 225) - { // Player isn't sneaking, but still didn't detect - return false; + if ((player->mo->flags & MF_SHADOW && !(i_compatflags & COMPATF_INVISIBILITY)) || + player->mo->flags3 & MF3_GHOST) + { + if ((P_AproxDistance (player->mo->x - actor->x, + player->mo->y - actor->y) > 2*MELEERANGE) + && P_AproxDistance (player->mo->velx, player->mo->vely) + < 5*FRACUNIT) + { // Player is sneaking - can't detect + return false; + } + if (pr_lookforplayers() < 225) + { // Player isn't sneaking, but still didn't detect + return false; + } } } @@ -2757,7 +2762,7 @@ void A_Face (AActor *self, AActor *other, angle_t max_turn) } // This will never work well if the turn angle is limited. - if (max_turn == 0 && (self->angle == other_angle) && other->flags & MF_SHADOW) + if (max_turn == 0 && (self->angle == other_angle) && other->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE) ) { self->angle += pr_facetarget.Random2() << 21; } @@ -2846,10 +2851,10 @@ DEFINE_ACTION_FUNCTION(AActor, A_MonsterRail) self->target->x - self->target->velx * 3, self->target->y - self->target->vely * 3); - if (self->target->flags & MF_SHADOW) - { + if (self->target->flags & MF_SHADOW && !(self->flags6 & MF6_SEEINVISIBLE)) + { self->angle += pr_railface.Random2() << 21; - } + } P_RailAttack (self, self->GetMissileDamage (0, 1), 0); self->pitch = saved_pitch; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index bc751e475..7c431834a 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -5071,7 +5071,8 @@ AActor *P_SpawnMissileXYZ (fixed_t x, fixed_t y, fixed_t z, th->velz = (fixed_t)(velocity.Z); // invisible target: rotate velocity vector in 2D - if (dest->flags & MF_SHADOW) + // [RC] Now monsters can aim at invisible player as if they were fully visible. + if (dest->flags & MF_SHADOW && !(source->flags6 & MF6_SEEINVISIBLE)) { angle_t an = pr_spawnmissile.Random2 () << 20; an >>= ANGLETOFINESHIFT; diff --git a/src/thingdef/thingdef_data.cpp b/src/thingdef/thingdef_data.cpp index 5347e6a1c..3c0c99c47 100644 --- a/src/thingdef/thingdef_data.cpp +++ b/src/thingdef/thingdef_data.cpp @@ -229,6 +229,7 @@ static FFlagDef ActorFlags[]= DEFINE_FLAG(MF6, ADDITIVEPOISONDURATION, AActor, flags6), DEFINE_FLAG(MF6, BLOCKEDBYSOLIDACTORS, AActor, flags6), DEFINE_FLAG(MF6, NOMENU, AActor, flags6), + DEFINE_FLAG(MF6, SEEINVISIBLE, AActor, flags6), // Effect flags DEFINE_FLAG(FX, VISIBILITYPULSE, AActor, effects),