- all sector iterators in actors_d.cpp, actors_r.cpp and actors_lava.cpp.

This commit is contained in:
Christoph Oelckers 2020-10-14 20:49:43 +02:00
parent 060b66b96b
commit 5c9b261823
3 changed files with 119 additions and 145 deletions

View file

@ -2651,8 +2651,8 @@ static void greenslime(int i)
//Check randomly to see of there is an actor near //Check randomly to see of there is an actor near
if (rnd(32)) if (rnd(32))
{ {
j = headspritesect[sect]; SectIterator it(sect);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
switch (sprite[j].picnum) switch (sprite[j].picnum)
{ {
@ -2668,8 +2668,6 @@ static void greenslime(int i)
return; return;
} }
} }
j = nextspritesect[j];
} }
} }
@ -3527,7 +3525,7 @@ void moveexplosions_d(void) // STATNUM 5
void moveeffectors_d(void) //STATNUM 3 void moveeffectors_d(void) //STATNUM 3
{ {
int q = 0, l, x, st, j, * t; int q = 0, l, x, st, j, * t;
int p, sh, nextj; int p, sh;
short k; short k;
spritetype* s; spritetype* s;
sectortype* sc; sectortype* sc;
@ -3686,18 +3684,17 @@ void moveeffectors_d(void) //STATNUM 3
case SE_24_CONVEYOR: case SE_24_CONVEYOR:
case 34: case 34:
{
if (t[4]) break; if (t[4]) break;
x = (sprite[i].yvel * sintable[(s->ang + 512) & 2047]) >> 18; x = (sprite[i].yvel * sintable[(s->ang + 512) & 2047]) >> 18;
l = (sprite[i].yvel * sintable[s->ang & 2047]) >> 18; l = (sprite[i].yvel * sintable[s->ang & 2047]) >> 18;
k = 0; k = 0;
j = headspritesect[s->sectnum]; SectIterator it(s->sectnum);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
nextj = nextspritesect[j];
auto sprj = &sprite[j]; auto sprj = &sprite[j];
if (sprj->zvel >= 0) if (sprj->zvel >= 0)
switch (sprj->statnum) switch (sprj->statnum)
@ -3717,10 +3714,8 @@ void moveeffectors_d(void) //STATNUM 3
case BLOODSPLAT3: case BLOODSPLAT3:
case BLOODSPLAT4: case BLOODSPLAT4:
sprj->xrepeat = sprj->yrepeat = 0; sprj->xrepeat = sprj->yrepeat = 0;
j = nextj;
continue; continue;
case LASERLINE: case LASERLINE:
j = nextj;
continue; continue;
} }
case 6: case 6:
@ -3759,7 +3754,6 @@ void moveeffectors_d(void) //STATNUM 3
} }
break; break;
} }
j = nextj;
} }
for (p = connecthead; p >= 0; p = connectpoint2[p]) for (p = connecthead; p >= 0; p = connectpoint2[p])
@ -3774,10 +3768,10 @@ void moveeffectors_d(void) //STATNUM 3
} }
} }
sc->floorxpanning += sprite[i].yvel >> 7; sc->floorxpanning += sprite[i].yvel >> 7;
break; break;
}
case 35: case 35:
handle_se35(i, SMALLSMOKE, EXPLOSION2); handle_se35(i, SMALLSMOKE, EXPLOSION2);
break; break;
@ -3849,7 +3843,6 @@ void moveeffectors_d(void) //STATNUM 3
{ {
if (sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag) if (sprite[j].picnum == NATURALLIGHTNING && sprite[j].hitag == s->hitag)
sprite[j].cstat |= 32768; sprite[j].cstat |= 32768;
j = nextspritestat[j];
} }
} }
else if (hittype[i].temp_data[2] > (hittype[i].temp_data[1] >> 3) && hittype[i].temp_data[2] < (hittype[i].temp_data[1] >> 2)) else if (hittype[i].temp_data[2] > (hittype[i].temp_data[1] >> 3) && hittype[i].temp_data[2] < (hittype[i].temp_data[1] >> 2))
@ -3928,18 +3921,18 @@ void moveeffectors_d(void) //STATNUM 3
l = sgn(s->z - sc->floorz) * sprite[i].yvel ; l = sgn(s->z - sc->floorz) * sprite[i].yvel ;
sc->floorz += l; sc->floorz += l;
j = headspritesect[s->sectnum]; SectIterator it(s->sectnum);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) auto sj = &sprite[j];
if (ps[sprite[j].yvel].on_ground == 1) if (sj->picnum == APLAYER && sj->owner >= 0)
ps[sprite[j].yvel].posz += l; if (ps[sj->yvel].on_ground == 1)
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) ps[sj->yvel].posz += l;
if (sj->zvel == 0 && sj->statnum != 3 && sj->statnum != 4)
{ {
hittype[j].bposz = sprite[j].z += l; hittype[j].bposz = sj->z += l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j];
} }
} }
} }
@ -3958,18 +3951,18 @@ void moveeffectors_d(void) //STATNUM 3
l = sgn(t[1] - sc->floorz) * sprite[i].yvel ; l = sgn(t[1] - sc->floorz) * sprite[i].yvel ;
sc->floorz += l; sc->floorz += l;
j = headspritesect[s->sectnum]; SectIterator it(s->sectnum);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) auto sj = &sprite[j];
if (ps[sprite[j].yvel].on_ground == 1) if (sj->picnum == APLAYER && sj->owner >= 0)
ps[sprite[j].yvel].posz += l; if (ps[sj->yvel].on_ground == 1)
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) ps[sj->yvel].posz += l;
if (sj->zvel == 0 && sj->statnum != 3 && sj->statnum != 4)
{ {
hittype[j].bposz = sprite[j].z += l; hittype[j].bposz = sj->z += l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j];
} }
} }
} }
@ -3990,18 +3983,18 @@ void moveeffectors_d(void) //STATNUM 3
l = sgn(s->z - sc->floorz) * sprite[i].yvel ; l = sgn(s->z - sc->floorz) * sprite[i].yvel ;
sc->floorz += l; sc->floorz += l;
j = headspritesect[s->sectnum]; SectIterator it(s->sectnum);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) auto sj = &sprite[j];
if (ps[sprite[j].yvel].on_ground == 1) if (sj->picnum == APLAYER && sj->owner >= 0)
ps[sprite[j].yvel].posz += l; if (ps[sj->yvel].on_ground == 1)
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) ps[sj->yvel].posz += l;
if (sj->zvel == 0 && sj->statnum != 3 && sj->statnum != 4)
{ {
hittype[j].bposz = sprite[j].z += l; hittype[j].bposz = sj->z += l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j];
} }
} }
} }
@ -4019,18 +4012,18 @@ void moveeffectors_d(void) //STATNUM 3
l = sgn(s->z - t[1]) * sprite[i].yvel ; l = sgn(s->z - t[1]) * sprite[i].yvel ;
sc->floorz -= l; sc->floorz -= l;
j = headspritesect[s->sectnum]; SectIterator it(s->sectnum);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) auto sj = &sprite[j];
if (ps[sprite[j].yvel].on_ground == 1) if (sj->picnum == APLAYER && sj->owner >= 0)
ps[sprite[j].yvel].posz -= l; if (ps[sj->yvel].on_ground == 1)
if (sprite[j].zvel == 0 && sprite[j].statnum != 3 && sprite[j].statnum != 4) ps[sj->yvel].posz -= l;
if (sj->zvel == 0 && sj->statnum != 3 && sj->statnum != 4)
{ {
hittype[j].bposz = sprite[j].z -= l; hittype[j].bposz = sj->z -= l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j];
} }
} }
} }

View file

@ -377,7 +377,6 @@ void moveminecart(void)
int speed; int speed;
int y; int y;
int x; int x;
short nextj;
int cx; int cx;
int cy; int cy;
int max_x; int max_x;
@ -514,13 +513,12 @@ void moveminecart(void)
} }
cx = (max_x + min_x) >> 1; cx = (max_x + min_x) >> 1;
cy = (max_y + min_y) >> 1; cy = (max_y + min_y) >> 1;
j = headspritesect[csect]; SectIterator it(csect);
while (j != -1) while ((j = it.NextIndex()) >= 0)
{ {
nextj = nextspritesect[j]; auto sj = &sprite[j];
if (badguy(&sprite[j])) if (badguy(&sprite[j]))
setsprite(j,cx,cy,sprite[j].z); setsprite(j,cx,cy,sprite[j].z);
j = nextj;
} }
} }
} }

View file

@ -214,7 +214,7 @@ void hitradius_r(short i, int r, int hp1, int hp2, int hp3, int hp4)
walltype* wal; walltype* wal;
int d, q, x1, y1; int d, q, x1, y1;
int sectcnt, sectend, dasect, startwall, endwall, nextsect; int sectcnt, sectend, dasect, startwall, endwall, nextsect;
short j, p, x, nextj, sect; short j, p, x, sect;
static const uint8_t statlist[] = { STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_PLAYER, STAT_FALLER, STAT_ZOMBIEACTOR, STAT_MISC }; static const uint8_t statlist[] = { STAT_DEFAULT, STAT_ACTOR, STAT_STANDABLE, STAT_PLAYER, STAT_FALLER, STAT_ZOMBIEACTOR, STAT_MISC };
short tempshort[MAXSECTORS]; // originally hijacked a global buffer which is bad. Q: How many do we really need? RedNukem says 64. short tempshort[MAXSECTORS]; // originally hijacked a global buffer which is bad. Q: How many do we really need? RedNukem says 64.
@ -272,10 +272,9 @@ SKIPWALLCHECK:
for (x = 0; x < 7; x++) for (x = 0; x < 7; x++)
{ {
j = headspritestat[statlist[x]]; StatIterator it1(statlist[x]);
while (j >= 0) while ((j = it1.NextIndex()) >= 0)
{ {
nextj = nextspritestat[j];
sj = &sprite[j]; sj = &sprite[j];
if (x == 0 || x >= 5 || AFLAMABLE(sj->picnum)) if (x == 0 || x >= 5 || AFLAMABLE(sj->picnum))
@ -285,7 +284,6 @@ SKIPWALLCHECK:
{ {
if (badguy(sj) && !cansee(sj->x, sj->y, sj->z + q, sj->sectnum, s->x, s->y, s->z + q, s->sectnum)) if (badguy(sj) && !cansee(sj->x, sj->y, sj->z + q, sj->sectnum, s->x, s->y, s->z + q, s->sectnum))
{ {
j = nextj;
continue; continue;
} }
fi.checkhitsprite(j, i); fi.checkhitsprite(j, i);
@ -295,12 +293,10 @@ SKIPWALLCHECK:
{ {
if (s->picnum == MORTER && j == s->owner) if (s->picnum == MORTER && j == s->owner)
{ {
j = nextj;
continue; continue;
} }
if ((isRRRA()) && s->picnum == CHEERBOMB && j == s->owner) if ((isRRRA()) && s->picnum == CHEERBOMB && j == s->owner)
{ {
j = nextj;
continue; continue;
} }
@ -312,7 +308,6 @@ SKIPWALLCHECK:
{ {
if ((isRRRA()) && sprite[j].picnum == MINION && sprite[j].pal == 19) if ((isRRRA()) && sprite[j].picnum == MINION && sprite[j].pal == 19)
{ {
j = nextj;
continue; continue;
} }
@ -369,7 +364,6 @@ SKIPWALLCHECK:
} }
} }
} }
j = nextj;
} }
} }
} }
@ -3497,7 +3491,7 @@ void moveexplosions_r(void) // STATNUM 5
void moveeffectors_r(void) //STATNUM 3 void moveeffectors_r(void) //STATNUM 3
{ {
int l, x, st, j, * t; int l, x, st, j, * t;
int p, sh, nextj, ns, pn; int p, sh, ns, pn;
short k; short k;
spritetype* s; spritetype* s;
sectortype* sc; sectortype* sc;
@ -3571,10 +3565,9 @@ void moveeffectors_r(void) //STATNUM 3
else else
{ {
s->xvel = k; s->xvel = k;
j = headspritesect[s->sectnum]; SectIterator it(s->sectnum);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
nextj = nextspritesect[j];
if (sprite[j].picnum == UFOBEAM) if (sprite[j].picnum == UFOBEAM)
if (ufospawn) if (ufospawn)
if (++ufocnt == 64) if (++ufocnt == 64)
@ -3604,7 +3597,6 @@ void moveeffectors_r(void) //STATNUM 3
ns = fi.spawn(i, pn); ns = fi.spawn(i, pn);
sprite[ns].z = sector[sprite[ns].sectnum].ceilingz; sprite[ns].z = sector[sprite[ns].sectnum].ceilingz;
} }
j = nextj;
} }
} }
@ -3627,7 +3619,6 @@ void moveeffectors_r(void) //STATNUM 3
} }
htj->temp_data[4] = t[4]; htj->temp_data[4] = t[4];
} }
j = nextspritestat[j];
} }
x = 0; x = 0;
} }
@ -3726,67 +3717,65 @@ void moveeffectors_r(void) //STATNUM 3
if (!isRRRA()) break; if (!isRRRA()) break;
case SE_24_CONVEYOR: case SE_24_CONVEYOR:
case 34: case 34:
{
if (t[4]) break; if (t[4]) break;
x = (sprite[i].yvel * sintable[(s->ang + 512) & 2047]) >> 18; x = (sprite[i].yvel * sintable[(s->ang + 512) & 2047]) >> 18;
l = (sprite[i].yvel * sintable[s->ang & 2047]) >> 18; l = (sprite[i].yvel * sintable[s->ang & 2047]) >> 18;
k = 0; k = 0;
j = headspritesect[s->sectnum]; SectIterator it(s->sectnum);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
nextj = nextspritesect[j]; auto sj = &sprite[j];
if (sprite[j].zvel >= 0) if (sj->zvel >= 0)
switch (sprite[j].statnum) switch (sj->statnum)
{ {
case 5: case 5:
switch (sprite[j].picnum) switch (sj->picnum)
{ {
case BLOODPOOL: case BLOODPOOL:
case FOOTPRINTS: case FOOTPRINTS:
case FOOTPRINTS2: case FOOTPRINTS2:
case FOOTPRINTS3: case FOOTPRINTS3:
sprite[j].xrepeat = sprite[j].yrepeat = 0; sj->xrepeat = sj->yrepeat = 0;
k = 1; k = 1;
break; break;
case BULLETHOLE: case BULLETHOLE:
j = nextj;
continue; continue;
} }
case 6: case 6:
case 1: case 1:
case 0: case 0:
if ( if (
sprite[j].picnum == BOLT1 || sj->picnum == BOLT1 ||
sprite[j].picnum == BOLT1 + 1 || sj->picnum == BOLT1 + 1 ||
sprite[j].picnum == BOLT1 + 2 || sj->picnum == BOLT1 + 2 ||
sprite[j].picnum == BOLT1 + 3 || sj->picnum == BOLT1 + 3 ||
wallswitchcheck(j) wallswitchcheck(j)
) )
break; break;
if (!(sprite[j].picnum >= CRANE && sprite[j].picnum <= (CRANE + 3))) if (!(sj->picnum >= CRANE && sj->picnum <= (CRANE + 3)))
{ {
if (sprite[j].z > (hittype[j].floorz - (16 << 8))) if (sj->z > (hittype[j].floorz - (16 << 8)))
{ {
hittype[j].bposx = sprite[j].x; hittype[j].bposx = sj->x;
hittype[j].bposy = sprite[j].y; hittype[j].bposy = sj->y;
sprite[j].x += x >> 1; sj->x += x >> 1;
sprite[j].y += l >> 1; sj->y += l >> 1;
setsprite(j, sprite[j].x, sprite[j].y, sprite[j].z); setsprite(j, sj->x, sj->y, sj->z);
if (sector[sprite[j].sectnum].floorstat & 2) if (sector[sj->sectnum].floorstat & 2)
if (sprite[j].statnum == 2) if (sj->statnum == 2)
makeitfall(j); makeitfall(j);
} }
} }
break; break;
} }
j = nextj;
} }
for (p = connecthead; p >= 0; p = connectpoint2[p]) for (p = connecthead; p >= 0; p = connectpoint2[p])
@ -3801,10 +3790,10 @@ void moveeffectors_r(void) //STATNUM 3
} }
} }
sc->floorxpanning += sprite[i].yvel >> 7; sc->floorxpanning += sprite[i].yvel >> 7;
break; break;
}
case 35: case 35:
handle_se35(i, SMALLSMOKE, EXPLOSION2); handle_se35(i, SMALLSMOKE, EXPLOSION2);
break; break;
@ -3874,18 +3863,18 @@ void moveeffectors_r(void) //STATNUM 3
l = sgn(s->z - sc->floorz) * sprite[i].yvel ; l = sgn(s->z - sc->floorz) * sprite[i].yvel ;
sc->floorz += l; sc->floorz += l;
j = headspritesect[s->sectnum]; SectIterator it(s->sectnum);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) auto sj = &sprite[j];
if (ps[sprite[j].yvel].on_ground == 1) if (sj->picnum == APLAYER && sj->owner >= 0)
ps[sprite[j].yvel].posz += l; if (ps[sj->yvel].on_ground == 1)
if (sprite[j].zvel == 0 && sprite[j].statnum != 3) ps[sj->yvel].posz += l;
if (sj->zvel == 0 && sj->statnum != 3)
{ {
hittype[j].bposz = sprite[j].z += l; hittype[j].bposz = sj->z += l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j];
} }
} }
} }
@ -3903,18 +3892,18 @@ void moveeffectors_r(void) //STATNUM 3
l = sgn(t[1] - sc->floorz) * sprite[i].yvel ; l = sgn(t[1] - sc->floorz) * sprite[i].yvel ;
sc->floorz += l; sc->floorz += l;
j = headspritesect[s->sectnum]; SectIterator it(s->sectnum);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) auto sj = &sprite[j];
if (ps[sprite[j].yvel].on_ground == 1) if (sj->picnum == APLAYER && sj->owner >= 0)
ps[sprite[j].yvel].posz += l; if (ps[sj->yvel].on_ground == 1)
if (sprite[j].zvel == 0 && sprite[j].statnum != 3) ps[sj->yvel].posz += l;
if (sj->zvel == 0 && sj->statnum != 3)
{ {
hittype[j].bposz = sprite[j].z += l; hittype[j].bposz = sj->z += l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j];
} }
} }
} }
@ -3934,18 +3923,18 @@ void moveeffectors_r(void) //STATNUM 3
l = sgn(s->z - sc->floorz) * sprite[i].yvel ; l = sgn(s->z - sc->floorz) * sprite[i].yvel ;
sc->floorz += l; sc->floorz += l;
j = headspritesect[s->sectnum]; SectIterator it(s->sectnum);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) auto sj = &sprite[j];
if (ps[sprite[j].yvel].on_ground == 1) if (sj->picnum == APLAYER && sj->owner >= 0)
ps[sprite[j].yvel].posz += l; if (ps[sj->yvel].on_ground == 1)
if (sprite[j].zvel == 0 && sprite[j].statnum != 3) ps[sj->yvel].posz += l;
if (sj->zvel == 0 && sj->statnum != 3)
{ {
hittype[j].bposz = sprite[j].z += l; hittype[j].bposz = sj->z += l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j];
} }
} }
} }
@ -3962,18 +3951,18 @@ void moveeffectors_r(void) //STATNUM 3
l = sgn(s->z - t[1]) * sprite[i].yvel ; l = sgn(s->z - t[1]) * sprite[i].yvel ;
sc->floorz -= l; sc->floorz -= l;
j = headspritesect[s->sectnum]; SectIterator it(s->sectnum);
while (j >= 0) while ((j = it.NextIndex()) >= 0)
{ {
if (sprite[j].picnum == APLAYER && sprite[j].owner >= 0) auto sj = &sprite[j];
if (ps[sprite[j].yvel].on_ground == 1) if (sj->picnum == APLAYER && sj->owner >= 0)
ps[sprite[j].yvel].posz -= l; if (ps[sj->yvel].on_ground == 1)
if (sprite[j].zvel == 0 && sprite[j].statnum != 3) ps[sj->yvel].posz -= l;
if (sj->zvel == 0 && sj->statnum != 3)
{ {
hittype[j].bposz = sprite[j].z -= l; hittype[j].bposz = sj->z -= l;
hittype[j].floorz = sc->floorz; hittype[j].floorz = sc->floorz;
} }
j = nextspritesect[j];
} }
} }
} }
@ -4492,24 +4481,22 @@ void destroyit(int g_i)
int k, jj; int k, jj;
int wi, wj; int wi, wj;
int spr; int spr;
int nextk;
int wallstart2, wallend2; int wallstart2, wallend2;
int sectnum; int sectnum;
int wallstart, wallend; int wallstart, wallend;
hitag = 0; hitag = 0;
k = headspritesect[g_sp->sectnum]; SectIterator it1(g_sp->sectnum);
while (k != -1) while ((k = it1.NextIndex()) >= 0)
{ {
nextk = nextspritesect[k]; auto sj = &sprite[k];
if (sprite[k].picnum == RRTILE63) if (sj->picnum == RRTILE63)
{ {
lotag = sprite[k].lotag; lotag = sj->lotag;
spr = k; spr = k;
if (sprite[k].hitag) if (sj->hitag)
hitag = sprite[k].hitag; hitag = sj->hitag;
} }
k = nextk;
} }
StatIterator it(STAT_DESTRUCT); StatIterator it(STAT_DESTRUCT);
while ((jj = it.NextIndex()) >= 0) while ((jj = it.NextIndex()) >= 0)
@ -4518,16 +4505,14 @@ void destroyit(int g_i)
if (hitag) if (hitag)
if (hitag == js->hitag) if (hitag == js->hitag)
{ {
k = headspritesect[js->sectnum]; SectIterator it(js->sectnum);
while (k != -1) while ((k = it.NextIndex()) >= 0)
{ {
nextk = nextspritesect[k];
if (sprite[k].picnum == DESTRUCTO) if (sprite[k].picnum == DESTRUCTO)
{ {
hittype[k].picnum = SHOTSPARK1; hittype[k].picnum = SHOTSPARK1;
hittype[k].extra = 1; hittype[k].extra = 1;
} }
k = nextk;
} }
} }
if (sprite[spr].sectnum != js->sectnum) if (sprite[spr].sectnum != js->sectnum)
@ -4576,10 +4561,9 @@ void destroyit(int g_i)
sector[sectnum].extra = sector[js->sectnum].extra; sector[sectnum].extra = sector[js->sectnum].extra;
} }
} }
k = headspritesect[g_sp->sectnum]; it1.Reset(g_sp->sectnum);
while (k != -1) while ((k = it.NextIndex()) >= 0)
{ {
nextk = nextspritesect[k];
switch (sprite[k].picnum) switch (sprite[k].picnum)
{ {
case DESTRUCTO: case DESTRUCTO:
@ -4592,7 +4576,6 @@ void destroyit(int g_i)
deletesprite(k); deletesprite(k);
break; break;
} }
k = nextk;
} }
} }