From 0cab84f17a9830e5d096d350cda010b5e0c59fdd Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Sun, 3 Jan 2021 15:44:57 +1100 Subject: [PATCH] - Duke: Backport EDuke32 commits b1e3f3bcf9c5214ae835d09e12cc41bac4f057ce & 4c4fdd1f4ab9381b60db06f37ec270850599e1ae in relation to swinging doors. --- source/games/duke/src/actors.cpp | 32 +++++++++++++++++++------------ source/games/duke/src/sectors.cpp | 14 ++++++++++++-- 2 files changed, 32 insertions(+), 14 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 0967c31c0..d9fc20de6 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -3668,26 +3668,16 @@ void handle_se11(DDukeActor *actor) startwall = sc->wallptr; endwall = startwall + sc->wallnum; + DukeStatIterator it(STAT_ACTOR); + for (int j = startwall; j < endwall; j++) { - DukeStatIterator it(STAT_ACTOR); while (auto ac = it.Next()) { auto sk = &ac->s; if (sk->extra > 0 && badguy(ac) && clipinsidebox(sk->x, sk->y, j, 256L) == 1) return; } - - it.Reset(STAT_PLAYER); - while (auto ac = it.Next()) - { - auto sk = &ac->s; - if (ac->GetOwner() && clipinsidebox(sk->x, sk->y, j, 144L) == 1) - { - t[5] = 8; // Delay - return; - } - } } int k = (s->yvel >> 3) * t[3]; @@ -3696,6 +3686,24 @@ void handle_se11(DDukeActor *actor) ms(actor); setsprite(actor, s->pos); + for (int j = startwall; j < endwall; j++) + { + it.Reset(STAT_PLAYER); + while (auto ac = it.Next()) + { + auto sk = &ac->s; + if (ac->GetOwner() && clipinsidebox(sk->x, sk->y, j, 144L) == 1) + { + t[5] = 8; // Delay + t[2] -= k; + t[4] -= k; + ms(actor); + setsprite(actor, s->pos); + return; + } + } + } + if (t[4] <= -511 || t[4] >= 512) { t[4] = 0; diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index d29047ede..a176c768b 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -815,7 +815,7 @@ static void handle_st23(int sn, DDukeActor* actor) DDukeActor* act2; while ((act2 = it.Next())) { - if (act2->s.lotag == 11 && act2->s.sectnum == sn && !act2->temp_data[4]) + if (act2->s.lotag == SE_11_SWINGING_DOOR && act2->s.sectnum == sn && !act2->temp_data[4]) { break; } @@ -827,9 +827,19 @@ static void handle_st23(int sn, DDukeActor* actor) if (act2) { DukeStatIterator it(STAT_EFFECTOR); + while (auto act3 = it.Next()) { - if (l == (sector[act3->s.sectnum].lotag & 0x8000) && act3->s.lotag == 11 && act2->s.hitag == act3->s.hitag && !act3->temp_data[4]) + if (l == (sector[act3->s.sectnum].lotag & 0x8000) && act3->s.lotag == SE_11_SWINGING_DOOR && act2->s.hitag == act3->s.hitag && act3->temp_data[4]) + { + return; + } + } + + it.Reset(STAT_EFFECTOR); + while (auto act3 = it.Next()) + { + if (l == (sector[act3->s.sectnum].lotag & 0x8000) && act3->s.lotag == SE_11_SWINGING_DOOR && act2->s.hitag == act3->s.hitag) { if (sector[act3->s.sectnum].lotag & 0x8000) sector[act3->s.sectnum].lotag &= 0x7fff; else sector[act3->s.sectnum].lotag |= 0x8000;