- 3 loops in premap_r.cpp

This commit is contained in:
Christoph Oelckers 2020-10-28 06:37:17 +01:00
parent 8360ba99ff
commit 9f3b74f4a2

View file

@ -469,18 +469,19 @@ void prelevel_r(int g)
for (j = 0; j < MAXSPRITES; j++) for (j = 0; j < MAXSPRITES; j++)
{ {
if (sprite[j].pal == 100) auto spr = &sprite[j];
if (spr->pal == 100)
{ {
if (numplayers > 1) if (numplayers > 1)
deletesprite(j); deletesprite(j);
else else
sprite[j].pal = 0; spr->pal = 0;
} }
else if (sprite[j].pal == 101) else if (spr->pal == 101)
{ {
sprite[j].extra = 0; spr->extra = 0;
sprite[j].hitag = 1; spr->hitag = 1;
sprite[j].pal = 0; spr->pal = 0;
changespritestat(j, 118); changespritestat(j, 118);
} }
} }
@ -495,19 +496,20 @@ void prelevel_r(int g)
{ {
case 41: case 41:
{ {
SectIterator it(i); DukeSectIterator it(i);
while ((k = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
if (sprite[k].picnum == RRTILE11) auto spr = &act->s;
if (spr->picnum == RRTILE11)
{ {
dist = sprite[k].lotag << 4; dist = spr->lotag << 4;
speed = sprite[k].hitag; speed = spr->hitag;
deletesprite(k); deletesprite(act);
} }
if (sprite[k].picnum == RRTILE38) if (spr->picnum == RRTILE38)
{ {
sound = sprite[k].lotag; sound = spr->lotag;
deletesprite(k); deletesprite(act);
} }
} }
for (j = 0; j < numsectors; j++) for (j = 0; j < numsectors; j++)
@ -525,10 +527,10 @@ void prelevel_r(int g)
{ {
short ii; short ii;
int childsectnum = -1; int childsectnum = -1;
SectIterator it(i); DukeSectIterator it(i);
while ((k = it.NextIndex()) >= 0) while (auto act = it.Next())
{ {
auto sj = &sprite[k]; auto sj = &act->s;
if (sj->picnum == RRTILE64) if (sj->picnum == RRTILE64)
{ {
dist = sj->lotag << 4; dist = sj->lotag << 4;
@ -542,12 +544,12 @@ void prelevel_r(int g)
deletesprite(ii); deletesprite(ii);
} }
} }
deletesprite(k); deletesprite(act);
} }
if (sj->picnum == RRTILE65) if (sj->picnum == RRTILE65)
{ {
sound = sj->lotag; sound = sj->lotag;
deletesprite(k); deletesprite(act);
} }
} }
addminecart(dist, speed, i, sector[i].hitag, sound, childsectnum); addminecart(dist, speed, i, sector[i].hitag, sound, childsectnum);
@ -593,12 +595,12 @@ void prelevel_r(int g)
break; break;
case RRTILE18: case RRTILE18:
addtorch(&sprite[i]); addtorch(si);
deletesprite(i); deletesprite(i);
break; break;
case RRTILE35: case RRTILE35:
addlightning(&sprite[i]); addlightning(si);
deletesprite(i); deletesprite(i);
break; break;