From 0bfde1c4d34f8c6571150e746ff89022931f9ee3 Mon Sep 17 00:00:00 2001 From: pogokeen Date: Fri, 5 Apr 2019 17:45:22 +0000 Subject: [PATCH] Fix issue where swingdoors would refuse to open or close if an enemy was in front of the door in an overlapping but unrelated/disjoint sector git-svn-id: https://svn.eduke32.com/eduke32@7473 1a8010ca-5511-0410-912e-c29ae57300e0 --- source/build/include/clip.h | 2 ++ source/build/src/clip.cpp | 4 +--- source/duke3d/src/actors.cpp | 7 +++++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/source/build/include/clip.h b/source/build/include/clip.h index b88689e16..21484be7c 100644 --- a/source/build/include/clip.h +++ b/source/build/include/clip.h @@ -88,6 +88,8 @@ extern int16_t clipsectorlist[MAXCLIPSECTORS], origclipsectorlist[MAXCLIPSECTORS int clipinsidebox(vec2_t *vect, int wallnum, int walldist); int clipinsideboxline(int x, int y, int x1, int y1, int x2, int y2, int walldist); +int sectoradjacent(int sect1, int sect2); + extern int32_t clipmoveboxtracenum; int32_t clipmove(vec3_t *pos, int16_t *sectnum, int32_t xvect, int32_t yvect, int32_t walldist, int32_t ceildist, diff --git a/source/build/src/clip.cpp b/source/build/src/clip.cpp index 4fffac53f..00f28d724 100644 --- a/source/build/src/clip.cpp +++ b/source/build/src/clip.cpp @@ -909,8 +909,7 @@ static int32_t get_floorspr_clipyou(int32_t x1, int32_t x2, int32_t x3, int32_t return clipyou; } -#if 0 -static int sectoradjacent(int sect1, int sect2) +int sectoradjacent(int sect1, int sect2) { if (sector[sect1].wallnum > sector[sect2].wallnum) swaplong(§1, §2); @@ -921,7 +920,6 @@ static int sectoradjacent(int sect1, int sect2) return 0; } -#endif // // clipmove diff --git a/source/duke3d/src/actors.cpp b/source/duke3d/src/actors.cpp index 3c583aed0..4856e49da 100644 --- a/source/duke3d/src/actors.cpp +++ b/source/duke3d/src/actors.cpp @@ -6676,8 +6676,11 @@ ACTOR_STATIC void G_MoveEffectors(void) //STATNUM 3 { for (SPRITES_OF(STAT_ACTOR, k)) { - if (sprite[k].extra > 0 && A_CheckEnemySprite(&sprite[k]) - && clipinsidebox((vec2_t *)&sprite[k], j, 256) == 1) + if (sprite[k].extra > 0 && + (pSprite->sectnum == sprite[k].sectnum || + sectoradjacent(pSprite->sectnum, sprite[k].sectnum)) && + A_CheckEnemySprite(&sprite[k]) && + clipinsidebox((vec2_t *)&sprite[k], j, 256) == 1) goto next_sprite; } }