-more in spawneffectors

This commit is contained in:
Christoph Oelckers 2021-11-17 23:35:20 +01:00
parent 94d0e9775f
commit a38fdd2890

View file

@ -619,7 +619,7 @@ void spawneffector(DDukeActor* actor)
auto sectp = sp->sector(); auto sectp = sp->sector();
int sect = sp->sectnum; int sect = sp->sectnum;
auto t = actor->temp_data; auto t = actor->temp_data;
int startwall, endwall, d, s, clostest = 0; int startwall, endwall, d, clostest = 0;
sp->yvel = sectp->extra; sp->yvel = sectp->extra;
sp->cstat |= 32768; sp->cstat |= 32768;
@ -978,47 +978,39 @@ void spawneffector(DDukeActor* actor)
} }
} }
startwall = sectp->wallptr;
endwall = startwall + sectp->wallnum;
t[1] = tempwallptr; t[1] = tempwallptr;
for (s = startwall; s < endwall; s++) for (auto& wal : wallsofsector(sectp))
{ {
msx[tempwallptr] = wall[s].x - sp->x; msx[tempwallptr] = wal.x - sp->x;
msy[tempwallptr] = wall[s].y - sp->y; msy[tempwallptr] = wal.y - sp->y;
tempwallptr++; tempwallptr++;
if (tempwallptr > 2047) if (tempwallptr > 2047)
{ {
I_Error("Too many moving sectors at (%d,%d).\n", wall[s].x, wall[s].y); I_Error("Too many moving sectors at (%d,%d).\n", wal.x, wal.y);
} }
} }
if (sp->lotag == SE_30_TWO_WAY_TRAIN || sp->lotag == SE_6_SUBWAY || sp->lotag == SE_14_SUBWAY_CAR || sp->lotag == SE_5_BOSS) if (sp->lotag == SE_30_TWO_WAY_TRAIN || sp->lotag == SE_6_SUBWAY || sp->lotag == SE_14_SUBWAY_CAR || sp->lotag == SE_5_BOSS)
{ {
startwall = sectp->wallptr;
endwall = startwall + sectp->wallnum;
if (sectp->hitag == -1) if (sectp->hitag == -1)
sp->extra = 0; sp->extra = 0;
else sp->extra = 1; else sp->extra = 1;
sectp->hitag = ActorToScriptIndex(actor); sectp->hitag = ActorToScriptIndex(actor);
int j = 0; int s = -1;
for (auto& wal : wallsofsector(sectp))
for (s = startwall; s < endwall; s++)
{ {
if (wall[s].nextsector >= 0 && if (wal.nextsector >= 0 &&
sector[wall[s].nextsector].hitag == 0 && wal.nextSector()->hitag == 0 &&
(sector[wall[s].nextsector].lotag < 3 || (isRRRA() && sector[wall[s].nextsector].lotag == 160))) (wal.nextSector()->lotag < 3 || (isRRRA() && wal.nextSector()->lotag == 160)))
{ {
s = wall[s].nextsector; s = wal.nextsector;
j = 1;
break; break;
} }
} }
if (j == 0) if (s == -1)
{ {
I_Error("Subway found no zero'd sectors with locators\nat (%d,%d).\n", sp->x, sp->y); I_Error("Subway found no zero'd sectors with locators\nat (%d,%d).\n", sp->x, sp->y);
} }