- Duke: Backport EDuke32 commits b1e3f3bcf9c5214ae835d09e12cc41bac4f057ce & 4c4fdd1f4ab9381b60db06f37ec270850599e1ae in relation to swinging doors.

This commit is contained in:
Mitchell Richters 2021-01-03 15:44:57 +11:00
parent 9b7d07df90
commit 0cab84f17a
2 changed files with 32 additions and 14 deletions

View file

@ -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;

View file

@ -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;