- cleaned up a few more loops.

This commit is contained in:
Christoph Oelckers 2020-11-02 19:13:58 +01:00
parent 618c739318
commit d8a7821b4f
3 changed files with 26 additions and 28 deletions

View file

@ -572,10 +572,10 @@ void resetpspritevars(int g)
which_palookup = 9;
j = connecthead;
StatIterator it(STAT_PLAYER);
while ((i = it.NextIndex()) >= 0)
DukeStatIterator it(STAT_PLAYER);
while (auto act = it.Next())
{
s = &sprite[i];
s = &act->s;
if (numplayersprites == MAXPLAYERS)
I_Error("Too many player sprites (max 16.)");
@ -595,7 +595,7 @@ void resetpspritevars(int g)
numplayersprites++;
if (j >= 0)
{
s->owner = i;
act->SetOwner(act);
s->shade = 0;
s->xrepeat = isRR() ? 24 : 42;
s->yrepeat = isRR() ? 17 : 36;
@ -626,13 +626,13 @@ void resetpspritevars(int g)
else
s->pal = ps[j].palookup = ud.user_pals[j];
ps[j].i = i;
ps[j].i = act->GetIndex();
ps[j].frag_ps = j;
hittype[i].owner = i;
act->SetOwner(act);
hittype[i].bposx = ps[j].bobposx = ps[j].oposx = ps[j].posx = s->x;
hittype[i].bposy = ps[j].bobposy = ps[j].oposy = ps[j].posy = s->y;
hittype[i].bposz = ps[j].oposz = ps[j].posz = s->z;
act->bposx = ps[j].bobposx = ps[j].oposx = ps[j].posx = s->x;
act->bposy = ps[j].bobposy = ps[j].oposy = ps[j].posy = s->y;
act->bposz = ps[j].oposz = ps[j].posz = s->z;
ps[j].angle.oang = ps[j].angle.ang = buildang(s->ang);
updatesector(s->x, s->y, &ps[j].cursectnum);

View file

@ -276,10 +276,9 @@ void prelevel_d(int g)
prelevel_common(g);
StatIterator it(STAT_DEFAULT);
while ((i = it.NextIndex()) >= 0)
DukeStatIterator it(STAT_DEFAULT);
while (auto ac = it.Next())
{
auto ac = &hittype[i];
auto si = &ac->s;
LoadActor(ac, -1, -1);
@ -292,7 +291,7 @@ void prelevel_d(int g)
{
case GPSPEED:
sector[si->sectnum].extra = si->lotag;
deletesprite(i);
deletesprite(ac);
break;
case CYCLER:
@ -305,7 +304,7 @@ void prelevel_d(int g)
cyclers[numcyclers][4] = si->hitag;
cyclers[numcyclers][5] = (si->ang == 1536);
numcyclers++;
deletesprite(i);
deletesprite(ac);
break;
}
}
@ -363,11 +362,11 @@ void prelevel_d(int g)
if (lotaglist > 64)
I_Error("Too many switches (64 max).");
StatIterator it1(STAT_EFFECTOR);
while ((j = it1.NextIndex()) >= 0)
DukeStatIterator it1(STAT_EFFECTOR);
while (auto ac = it1.Next())
{
if (sprite[j].lotag == 12 && sprite[j].hitag == spr->lotag)
hittype[j].temp_data[0] = 1;
if (ac->s.lotag == 12 && ac->s.hitag == spr->lotag)
ac->temp_data[0] = 1;
}
}
break;

View file

@ -557,10 +557,9 @@ void prelevel_r(int g)
}
}
StatIterator it(STAT_DEFAULT);
while ((i = it.NextIndex()) >= 0)
DukeStatIterator it(STAT_DEFAULT);
while (auto ac = it.Next())
{
auto ac = &hittype[i];
auto si = &ac->s;
LoadActor(ac, -1, -1);
@ -577,7 +576,7 @@ void prelevel_r(int g)
case GPSPEED:
sector[si->sectnum].extra = si->lotag;
deletesprite(i);
deletesprite(ac);
break;
case CYCLER:
@ -590,22 +589,22 @@ void prelevel_r(int g)
cyclers[numcyclers][4] = si->hitag;
cyclers[numcyclers][5] = (si->ang == 1536);
numcyclers++;
deletesprite(i);
deletesprite(ac);
break;
case RRTILE18:
addtorch(si);
deletesprite(i);
deletesprite(ac);
break;
case RRTILE35:
addlightning(si);
deletesprite(i);
deletesprite(ac);
break;
case RRTILE68:
shadedsector[si->sectnum] = 1;
deletesprite(i);
deletesprite(ac);
break;
case RRTILE67:
@ -695,9 +694,9 @@ void prelevel_r(int g)
lotaglist = 0;
it.Reset(STAT_DEFAULT);
while ((i = it.NextIndex()) >= 0)
while (auto ac = it.Next())
{
auto spr = &sprite[i];
auto spr = &ac->s;
switch (spr->picnum)
{
case RRTILE8464 + 1: