From 7416f42b4714de223c6e8cf2f69da136f7a34aa4 Mon Sep 17 00:00:00 2001 From: Rachael Alexanderson Date: Tue, 9 Jan 2018 12:34:01 -0500 Subject: [PATCH] - add 'FriendlySeeBlocks' actor property that allows a modder to expand the maximum radius that a friendly monster can see enemies. --- src/actor.h | 1 + src/p_enemy.cpp | 2 +- src/p_mobj.cpp | 2 ++ wadsrc/static/zscript/actor.txt | 3 +++ 4 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/actor.h b/src/actor.h index 0c92db400e..1510a5787c 100644 --- a/src/actor.h +++ b/src/actor.h @@ -1169,6 +1169,7 @@ public: int Score; // manipulated by score items, ACS or DECORATE. The engine doesn't use this itself for anything. FString * Tag; // Strife's tag name. int DesignatedTeam; // Allow for friendly fire cacluations to be done on non-players. + int friendlyseeblocks; // allow to override friendly search distance calculation AActor *BlockingMobj; // Actor that blocked the last move line_t *BlockingLine; // Line that blocked the last move diff --git a/src/p_enemy.cpp b/src/p_enemy.cpp index d44d3e4446..86bd5c8c33 100644 --- a/src/p_enemy.cpp +++ b/src/p_enemy.cpp @@ -1704,7 +1704,7 @@ bool P_LookForEnemies (AActor *actor, INTBOOL allaround, FLookExParams *params) { AActor *other; - other = P_BlockmapSearch (actor, 10, LookForEnemiesInBlock, params); + other = P_BlockmapSearch (actor, actor->friendlyseeblocks, LookForEnemiesInBlock, params); if (other != NULL) { diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index d5c5e93ea6..03f1e47508 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -355,6 +355,7 @@ DEFINE_FIELD(AActor, BloodColor) DEFINE_FIELD(AActor, BloodTranslation) DEFINE_FIELD(AActor, RenderHidden) DEFINE_FIELD(AActor, RenderRequired) +DEFINE_FIELD(AActor, friendlyseeblocks) //========================================================================== // @@ -533,6 +534,7 @@ void AActor::Serialize(FSerializer &arc) A("stealthalpha", StealthAlpha) A("renderhidden", RenderHidden) A("renderrequired", RenderRequired); + A("friendlyseeblocks", friendlyseeblocks); } #undef A diff --git a/wadsrc/static/zscript/actor.txt b/wadsrc/static/zscript/actor.txt index 6dd222fbfc..1cdbecc0e1 100644 --- a/wadsrc/static/zscript/actor.txt +++ b/wadsrc/static/zscript/actor.txt @@ -203,6 +203,7 @@ class Actor : Thinker native native readonly int BloodTranslation; native int RenderHidden; native int RenderRequired; + native readonly int FriendlySeeBlocks; meta String Obituary; // Player was killed by this actor meta String HitObituary; // Player was killed by this actor in melee @@ -292,6 +293,7 @@ class Actor : Thinker native property RipLevelMax: RipLevelMax; property RenderHidden: RenderHidden; property RenderRequired: RenderRequired; + property FriendlySeeBlocks: FriendlySeeBlocks; // need some definition work first //FRenderStyle RenderStyle; @@ -372,6 +374,7 @@ class Actor : Thinker native BurnHeight -1; RenderHidden 0; RenderRequired 0; + FriendlySeeBlocks 10; // 10 (blocks) * 128 (one map unit block) } // Functions