- the second third of SW.

This commit is contained in:
Christoph Oelckers 2020-10-15 17:40:22 +02:00
parent a506b45369
commit 679c394b29
15 changed files with 172 additions and 149 deletions

View file

@ -482,7 +482,8 @@ void EnemyDefaults(short SpriteNum, ACTOR_ACTION_SETp action, PERSONALITYp perso
}
else
{
TRAVERSE_SPRITE_SECT(headspritesect[sectnum],i,nexti)
SectIterator it(sectnum);
while ((i = it.NextIndex()) >= 0)
{
SPRITEp np = &sprite[i];
if (np->picnum == ST1 && np->hitag == SECT_SINK)

View file

@ -1482,8 +1482,7 @@ int ConnectCopySprite(uspritetype const * tsp)
void PreDrawStackedWater(void)
{
short si,snexti;
short i,nexti;
int i, si;
SPRITEp sp;
USERp u,nu;
short New;
@ -1491,7 +1490,8 @@ void PreDrawStackedWater(void)
StatIterator it(STAT_CEILING_FLOOR_PIC_OVERRIDE);
while ((si = it.NextIndex()) >= 0)
{
TRAVERSE_SPRITE_SECT(headspritesect[sprite[si].sectnum], i, nexti)
SectIterator it(sprite[si].sectnum);
while ((i = it.NextIndex()) >= 0)
{
if (User[i])
{

View file

@ -118,7 +118,8 @@ void DiffuseLighting(SPRITEp sp)
// diffused lighting
count = 0;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_LIGHTING_DIFFUSE],i,nexti)
StatIterator it(STAT_LIGHTING_DIFFUSE);
while ((i = it.NextIndex()) >= 0)
{
dsp = &sprite[i];
@ -145,7 +146,8 @@ void DoLightingMatch(short match, short state)
short i,nexti;
SPRITEp sp;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_LIGHTING],i,nexti)
StatIterator it(STAT_LIGHTING);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -270,7 +272,8 @@ void InitLighting(void)
// processed on level startup
// puts lights in correct state
TRAVERSE_SPRITE_STAT(headspritestat[STAT_LIGHTING],i,nexti)
StatIterator it(STAT_LIGHTING);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -287,7 +290,8 @@ void DoLighting(void)
SPRITEp sp;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_LIGHTING],i,nexti)
StatIterator it(STAT_LIGHTING);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];

View file

@ -4322,7 +4322,8 @@ GetOverlapSector2(int x, int y, short *over, short *under)
// if nothing was found, check them all
if (found == 0)
{
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DIVE_AREA],i,nexti)
StatIterator it(STAT_DIVE_AREA);
while ((i = it.NextIndex()) >= 0)
{
if (inside(x, y, sprite[i].sectnum))
{
@ -4334,7 +4335,8 @@ GetOverlapSector2(int x, int y, short *over, short *under)
for (stat = 0; stat < SIZ(UnderStatList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[UnderStatList[stat]],i,nexti)
it.Reset(UnderStatList[stat]);
while ((i = it.NextIndex()) >= 0)
{
// ignore underwater areas with lotag of 0
if (sprite[i].lotag == 0)

View file

@ -118,13 +118,15 @@ void SetSectorWallBits(short sectnum, int bit_mask, bool set_sectwall, bool set_
void WallSetupDontMove(void)
{
int i,j,nexti,nextj;
int i,j;
SPRITEp spu, spl;
WALLp wallp;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_DONT_MOVE_UPPER],i,nexti)
StatIterator it(STAT_WALL_DONT_MOVE_UPPER);
while ((i = it.NextIndex()) >= 0)
{
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_DONT_MOVE_LOWER],j,nextj)
StatIterator it1(STAT_WALL_DONT_MOVE_LOWER);
while ((j = it1.NextIndex()) >= 0)
{
spu = &sprite[i];
spl = &sprite[j];
@ -870,7 +872,8 @@ OperateSector(short sectnum, short player_is_operating)
if (SectUser[sectnum] && SectUser[sectnum]->stag == SECT_LOCK_DOOR)
return false;
TRAVERSE_SPRITE_SECT(headspritesect[sectnum], i, nexti)
SectIterator it(sectnum);
while ((i = it.NextIndex()) >= 0)
{
fsp = &sprite[i];
@ -2076,29 +2079,6 @@ OperateTripTrigger(PLAYERp pp)
SECTORp sectp = &sector[pp->cursectnum];
#if 0
// new method
if (TEST(sectp->extra, SECTFX_TRIGGER))
{
SPRITEp sp;
TRAVERSE_SPRITE_SECT(headspritesect[*sectp],i,nexti)
{
sp = &sprite[i];
if (sp->statnum == STAT_TRIGGER && SP_TAG7(sp) == 0)
{
switch (SP_TAG3(sp))
{
case 1: // Secret Area
break;
}
}
}
}
#endif
// old method
switch (LOW_TAG(pp->cursectnum))
{
@ -3215,7 +3195,8 @@ DoPanning(void)
SECTORp sectp;
WALLp wallp;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FLOOR_PAN], i, nexti)
StatIterator it(STAT_FLOOR_PAN);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
sectp = &sector[sp->sectnum];
@ -3230,7 +3211,8 @@ DoPanning(void)
sectp->floorypanning &= 255;
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_CEILING_PAN], i, nexti)
it.Reset(STAT_CEILING_PAN);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
sectp = &sector[sp->sectnum];
@ -3245,7 +3227,8 @@ DoPanning(void)
sectp->ceilingypanning &= 255;
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_PAN], i, nexti)
it.Reset(STAT_WALL_PAN);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
wallp = &wall[sp->owner];

View file

@ -75,7 +75,8 @@ SlidorSwitch(short match, short setting)
short i,nexti;
bool found = false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti)
StatIterator it(STAT_DEFAULT);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -158,7 +159,8 @@ DoSlidorMatch(PLAYERp pp, short match, bool manual)
//SlidorSwitch(match, ON);
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SLIDOR], i, nexti)
StatIterator it(STAT_SLIDOR);
while ((i = it.NextIndex()) >= 0)
{
fsp = &sprite[i];
@ -234,7 +236,8 @@ TestSlidorMatchActive(short match)
short i,nexti;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SLIDOR], i, nexti)
StatIterator it(STAT_SLIDOR);
while ((i = it.NextIndex()) >= 0)
{
fsp = &sprite[i];
@ -625,7 +628,8 @@ int DoSlidorMove(short SpriteNum)
USERp bu;
bool found = false;
TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti)
SectIterator it(sp->sectnum);
while ((i = it.NextIndex()) >= 0)
{
bsp = &sprite[i];
bu = User[i];

View file

@ -284,7 +284,8 @@ void StartAmbientSound(void)
if (!SoundEnabled()) return;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_AMBIENT], i, nexti)
StatIterator it(STAT_AMBIENT);
while ((i = it.NextIndex()) >= 0)
{
SPRITEp sp = &sprite[i];
InitAmbient(sp->lotag, sp);

View file

@ -79,7 +79,8 @@ SpikeSwitch(short match, short setting)
short i,nexti;
bool found = false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti)
StatIterator it(STAT_DEFAULT);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -147,7 +148,8 @@ short DoSpikeOperate(short sectnum)
short match;
short i,nexti;
TRAVERSE_SPRITE_SECT(headspritesect[sectnum], i, nexti)
SectIterator it(sectnum);
while ((i = it.NextIndex()) >= 0)
{
fsp = &sprite[i];
@ -185,7 +187,8 @@ DoSpikeMatch(short match)
//SpikeSwitch(match, ON);
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SPIKE], i, nexti)
StatIterator it(STAT_SPIKE);
while ((i = it.NextIndex()) >= 0)
{
fsp = &sprite[i];
@ -218,7 +221,8 @@ TestSpikeMatchActive(short match)
short i,nexti;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SPIKE], i, nexti)
StatIterator it(STAT_SPIKE);
while ((i = it.NextIndex()) >= 0)
{
fsp = &sprite[i];
@ -303,7 +307,8 @@ void MoveSpritesWithSpike(short sectnum)
short i,nexti;
int cz,fz;
TRAVERSE_SPRITE_SECT(headspritesect[sectnum], i, nexti)
SectIterator it(sectnum);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -399,7 +404,8 @@ int DoSpike(short SpriteNum)
USERp bu;
bool found = false;
TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti)
SectIterator it(sp->sectnum);
while ((i = it.NextIndex()) >= 0)
{
bsp = &sprite[i];
bu = User[i];

View file

@ -732,7 +732,8 @@ KillSprite(int16_t SpriteNum)
for (stat = 0; stat < SIZ(MissileStats); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[MissileStats[stat]], i, nexti)
StatIterator it(MissileStats[stat]);
while ((i = it.NextIndex()) >= 0)
{
mu = User[i];
@ -752,7 +753,8 @@ KillSprite(int16_t SpriteNum)
// don't bother th check if you've never had children
for (stat = 0; stat < STAT_DONT_DRAW; stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[stat], i, nexti)
StatIterator it(stat);
while ((i = it.NextIndex()) >= 0)
{
if (sprite[i].owner == SpriteNum)
{
@ -1765,7 +1767,8 @@ SpriteSetupPost(void)
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FLOOR_PAN], SpriteNum, NextSprite)
{
TRAVERSE_SPRITE_SECT(headspritesect[sprite[SpriteNum].sectnum],i,nexti)
SectIterator it(sprite[SpriteNum].sectnum);
while ((i = it.NextIndex()) >= 0)
{
ds = &sprite[i];
@ -3820,7 +3823,8 @@ bool ItemSpotClear(SPRITEp sip, short statnum, short id)
if (TEST_BOOL2(sip))
{
TRAVERSE_SPRITE_SECT(headspritesect[sip->sectnum],i,nexti)
SectIterator it(sip->sectnum);
while ((i = it.NextIndex()) >= 0)
{
if (sprite[i].statnum == statnum && User[i]->ID == id)
{
@ -6697,7 +6701,8 @@ SpriteControl(void)
int tx, ty, tmin, dist;
short StateTics;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_MISC], i, nexti)
StatIterator it(STAT_MISC);
while ((i = it.NextIndex()) >= 0)
{
#if INLINE_STATE
ASSERT(User[i]);
@ -6717,7 +6722,8 @@ SpriteControl(void)
{
for (stat = STAT_SKIP2_START + 1; stat <= STAT_SKIP2_END; stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[stat], i, nexti)
StatIterator it(stat);
while ((i = it.NextIndex()) >= 0)
{
#if INLINE_STATE
ASSERT(User[i]);
@ -6794,7 +6800,8 @@ SpriteControl(void)
{
for (stat = STAT_SKIP4_START; stat <= STAT_SKIP4_END; stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[stat], i, nexti)
StatIterator it(stat);
while ((i = it.NextIndex()) >= 0)
{
#if INLINE_STATE
ASSERT(User[i]);
@ -6811,7 +6818,8 @@ SpriteControl(void)
}
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_NO_STATE], i, nexti)
StatIterator it(STAT_NO_STATE);
while ((i = it.NextIndex()) >= 0)
{
if (User[i] && User[i]->ActorActionFunc)
(*User[i]->ActorActionFunc)(i);
@ -6820,7 +6828,8 @@ SpriteControl(void)
if (MoveSkip8 == 0)
{
TRAVERSE_SPRITE_STAT(headspritestat[STAT_STATIC_FIRE], i, nexti)
it.Reset(STAT_STATIC_FIRE);
while ((i = it.NextIndex()) >= 0)
{
extern int DoStaticFlamesDamage(short SpriteNum);
ASSERT(User[i]);
@ -6830,7 +6839,8 @@ SpriteControl(void)
if (MoveSkip4 == 0) // limit to 10 times a second
{
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALLBLOOD_QUEUE], i, nexti)
it.Reset(STAT_WALLBLOOD_QUEUE);
while ((i = it.NextIndex()) >= 0)
{
#if INLINE_STATE
ASSERT(User[i]);
@ -6849,7 +6859,8 @@ SpriteControl(void)
// vator/rotator/spike/slidor all have some code to
// prevent calling of the action func()
TRAVERSE_SPRITE_STAT(headspritestat[STAT_VATOR], i, nexti)
it.Reset(STAT_VATOR);
while ((i = it.NextIndex()) >= 0)
{
u = User[i];
@ -6869,7 +6880,8 @@ SpriteControl(void)
(*User[i]->ActorActionFunc)(i);
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SPIKE], i, nexti)
it.Reset(STAT_SPIKE);
while ((i = it.NextIndex()) >= 0)
{
u = User[i];
@ -6890,7 +6902,8 @@ SpriteControl(void)
(*User[i]->ActorActionFunc)(i);
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_ROTATOR], i, nexti)
it.Reset(STAT_ROTATOR);
while ((i = it.NextIndex()) >= 0)
{
u = User[i];
@ -6908,7 +6921,8 @@ SpriteControl(void)
(*User[i]->ActorActionFunc)(i);
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SLIDOR], i, nexti)
it.Reset(STAT_SLIDOR);
while ((i = it.NextIndex()) >= 0)
{
u = User[i];
@ -6926,7 +6940,8 @@ SpriteControl(void)
(*User[i]->ActorActionFunc)(i);
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SUICIDE], i, nexti)
it.Reset(STAT_SUICIDE);
while ((i = it.NextIndex()) >= 0)
{
KillSprite(i);
}
@ -7514,36 +7529,6 @@ move_ground_missile(short spritenum, int xchange, int ychange, int ceildist, int
return retval;
}
/*
int push_check(short SpriteNum)
{
switch (sprite[SpriteNum].lotag)
{
case TAG_DOOR_S,LIDING:
{
SPRITEp sp;
USERp u;
short i,nexti,sect;
//DSPRINTF(ds,"Door Closing %d",sectnum);
MONO_PRINT(ds);
TRAVERSE_SPRITE_SECT(headspritesect[sectnum], i, nexti)
{
sp = &sprite[i];
u = User[i];
sect = pushmove((vec3_t *)sp, &sp->sectnum, (((int)sp->clipdist)<<2)-8, u->ceiling_dist, u->floor_dist, CLIPMASK0);
if (sect == -1)
{
KillSprite(i);
}
}
}
}
}
*/
#include "saveable.h"

View file

@ -2321,7 +2321,8 @@ void CallbackSOsink(ANIMp ap, void *data)
ASSERT(found);
TRAVERSE_SPRITE_SECT(headspritesect[dest_sector], i, nexti)
SectIterator it(dest_sector);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];

View file

@ -84,7 +84,8 @@ VatorSwitch(short match, short setting)
short i,nexti;
bool found = false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DEFAULT], i, nexti)
StatIterator it(STAT_DEFAULT);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -152,7 +153,8 @@ short DoVatorOperate(PLAYERp pp, short sectnum)
short match;
short i,nexti;
TRAVERSE_SPRITE_SECT(headspritesect[sectnum], i, nexti)
SectIterator it(sectnum);
while ((i = it.NextIndex()) >= 0)
{
fsp = &sprite[i];
@ -224,7 +226,8 @@ DoVatorMatch(PLAYERp pp, short match)
//VatorSwitch(match, ON);
TRAVERSE_SPRITE_STAT(headspritestat[STAT_VATOR], i, nexti)
StatIterator it(STAT_VATOR);
while ((i = it.NextIndex()) >= 0)
{
fsp = &sprite[i];
@ -295,7 +298,8 @@ TestVatorMatchActive(short match)
short i,nexti;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_VATOR], i, nexti)
StatIterator it(STAT_VATOR);
while ((i = it.NextIndex()) >= 0)
{
fsp = &sprite[i];
@ -320,7 +324,8 @@ void InterpSectorSprites(short sectnum, bool state)
SPRITEp sp;
short i,nexti;
TRAVERSE_SPRITE_SECT(headspritesect[sectnum], i, nexti)
SectIterator it(sectnum);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -349,7 +354,8 @@ void MoveSpritesWithSector(short sectnum, int z_amt, bool type)
if (SectUser[sectnum])
both = !!TEST(SectUser[sectnum]->flags, SECTFU_VATOR_BOTH);
TRAVERSE_SPRITE_SECT(headspritesect[sectnum], i, nexti)
SectIterator it(sectnum);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -540,7 +546,8 @@ int DoVator(short SpriteNum)
USERp bu;
bool found = false;
TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti)
SectIterator it(sp->sectnum);
while ((i = it.NextIndex()) >= 0)
{
bsp = &sprite[i];
bu = User[i];
@ -591,7 +598,8 @@ int DoVator(short SpriteNum)
int i,nexti;
SPRITEp bsp;
TRAVERSE_SPRITE_SECT(headspritesect[sp->sectnum], i, nexti)
SectIterator it(sp->sectnum);
while ((i = it.NextIndex()) >= 0)
{
bsp = &sprite[i];

View file

@ -48,7 +48,8 @@ void ProcessVisOn(void)
short i, nexti;
SPRITEp sp;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_VIS_ON], i, nexti)
StatIterator it(STAT_VIS_ON);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -95,7 +96,8 @@ void VisViewChange(PLAYERp pp, int *vis)
return;
// find the closest quake - should be a strength value
TRAVERSE_SPRITE_STAT(headspritestat[STAT_VIS_ON], i, nexti)
StatIterator it(STAT_VIS_ON);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -140,7 +142,8 @@ int SpawnVis(short Parent, short sectnum, int x, int y, int z, int amt)
return -1;
// kill any others with the same parent
TRAVERSE_SPRITE_STAT(headspritestat[STAT_VIS_ON], i, nexti)
StatIterator it(STAT_VIS_ON);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
if (sp->owner == Parent)

View file

@ -168,7 +168,8 @@ bool CanSeeWallMove(SPRITEp wp, short match)
bool found = false;
SPRITEp sp;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE_CANSEE], i, nexti)
StatIterator it(STAT_WALL_MOVE_CANSEE);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -196,7 +197,8 @@ int DoWallMoveMatch(short match)
bool found = false;
// just all with the same matching tags
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE], i, nexti)
StatIterator it(STAT_WALL_MOVE);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];

View file

@ -55,7 +55,8 @@ WarpPlaneSectorInfo(short sectnum, SPRITEp *sp_ceiling, SPRITEp *sp_floor)
if (sectnum < 0 || !TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR))
return false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WARP], i, nexti)
StatIterator it(STAT_WARP);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -172,7 +173,8 @@ WarpToArea(SPRITEp sp_from, int32_t* x, int32_t* y, int32_t* z, int16_t* sectnum
break;
}
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WARP], i, nexti)
StatIterator it(STAT_WARP);
while ((i = it.NextIndex()) >= 0)
{
SPRITEp sp = &sprite[i];
@ -221,7 +223,8 @@ WarpSectorInfo(short sectnum, SPRITEp *sp_warp)
if (!TEST(sector[sectnum].extra, SECTFX_WARP_SECTOR))
return false;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WARP], i, nexti)
StatIterator it(STAT_WARP);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];

View file

@ -2772,7 +2772,8 @@ int DoLavaErupt(short SpriteNum)
pp = Player + pnum;
if (pp->cursectnum >= 0 && TEST(sector[pp->cursectnum].extra, SECTFX_TRIGGER))
{
TRAVERSE_SPRITE_SECT(headspritesect[pp->cursectnum],i,nexti)
SectIterator it(pp->cursectnum);
while ((i = it.NextIndex()) >= 0)
{
tsp = &sprite[i];
@ -4934,7 +4935,6 @@ DoBreakFlames(short SpriteNum)
int
SetSuicide(short SpriteNum)
{
#if 1
USERp u = User[SpriteNum];
if (u != nullptr)
@ -4943,13 +4943,6 @@ SetSuicide(short SpriteNum)
u->RotNum = 0;
}
ChangeState(SpriteNum, s_Suicide);
#else
// this will NOT work because
// TRAVERSE_SPRITE_STAT([STAT_MISSILE], i, nexti)
// nexti will still be valid but will be on a different list
// and will have a different nextspritestat[nexti] result
changespritestat(SpriteNum, STAT_SUICIDE);
#endif
return 0;
}
@ -7537,7 +7530,8 @@ DoDamageTest(short Weapon)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
@ -7608,7 +7602,8 @@ DoFlamesDamageTest(short Weapon)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
@ -7797,7 +7792,8 @@ int DoExpDamageTest(short Weapon)
for (stat = 0; stat < max_stat; stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
@ -7844,7 +7840,8 @@ int DoExpDamageTest(short Weapon)
// Breakable stuff
for (stat = 0; stat < max_stat; stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatBreakList[stat]], i, nexti)
StatIterator it(StatBreakList[stat]);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
@ -7874,7 +7871,8 @@ int DoExpDamageTest(short Weapon)
return 0;
// wall damaging
TRAVERSE_SPRITE_STAT(headspritestat[STAT_WALL_MOVE], i, nexti)
StatIterator it(STAT_WALL_MOVE);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -7929,7 +7927,8 @@ int DoMineExpMine(short Weapon)
int tmin;
int zdist;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_MINE_STUCK], i, nexti)
StatIterator it(STAT_MINE_STUCK);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
@ -9352,7 +9351,8 @@ DoMineRangeTest(short Weapon, short range)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
u = User[i];
@ -13725,7 +13725,8 @@ InitSwordAttack(PLAYERp pp)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -13902,7 +13903,8 @@ InitFistAttack(PLAYERp pp)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
sp = &sprite[i];
@ -14221,7 +14223,8 @@ InitSumoStompAttack(short SpriteNum)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
tsp = &sprite[i];
@ -15992,7 +15995,8 @@ InitRipperSlash(short SpriteNum)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
hu = User[i];
@ -16029,7 +16033,8 @@ InitBunnySlash(short SpriteNum)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
@ -16062,7 +16067,8 @@ InitSerpSlash(short SpriteNum)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
@ -16129,7 +16135,8 @@ DoBladeDamage(short SpriteNum)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
@ -16172,7 +16179,8 @@ DoStaticFlamesDamage(short SpriteNum)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
@ -16218,7 +16226,8 @@ InitCoolgBash(short SpriteNum)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
@ -16255,7 +16264,8 @@ InitSkelSlash(short SpriteNum)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
@ -16288,7 +16298,8 @@ InitGoroChop(short SpriteNum)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
@ -17190,7 +17201,8 @@ InitEelFire(short SpriteNum)
for (stat = 0; stat < SIZ(StatDamageList); stat++)
{
TRAVERSE_SPRITE_STAT(headspritestat[StatDamageList[stat]], i, nexti)
StatIterator it(StatDamageList[stat]);
while ((i = it.NextIndex()) >= 0)
{
hp = &sprite[i];
hu = User[i];
@ -19770,7 +19782,8 @@ WarpToUnderwater(short *sectnum, int *x, int *y, int *z)
return false;
// search for DIVE_AREA "over" sprite for reference point
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DIVE_AREA], i, nexti)
StatIterator it(STAT_DIVE_AREA);
while ((i = it.NextIndex()) >= 0)
{
over_sp = &sprite[i];
@ -19787,7 +19800,8 @@ WarpToUnderwater(short *sectnum, int *x, int *y, int *z)
Found = false;
// search for UNDERWATER "under" sprite for reference point
TRAVERSE_SPRITE_STAT(headspritestat[STAT_UNDERWATER], i, nexti)
StatIterator it(STAT_UNDERWATER);
while ((i = it.NextIndex()) >= 0)
{
under_sp = &sprite[i];
@ -19843,7 +19857,8 @@ WarpToSurface(short *sectnum, int *x, int *y, int *z)
return false;
// search for UNDERWATER "under" sprite for reference point
TRAVERSE_SPRITE_STAT(headspritestat[STAT_UNDERWATER], i, nexti)
StatIterator it(STAT_UNDERWATER);
while ((i = it.NextIndex()) >= 0)
{
under_sp = &sprite[i];
@ -19860,7 +19875,8 @@ WarpToSurface(short *sectnum, int *x, int *y, int *z)
Found = false;
// search for DIVE_AREA "over" sprite for reference point
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DIVE_AREA], i, nexti)
StatIterator it(STAT_DIVE_AREA);
while ((i = it.NextIndex()) >= 0)
{
over_sp = &sprite[i];
@ -19915,7 +19931,8 @@ SpriteWarpToUnderwater(SPRITEp sp)
return false;
// search for DIVE_AREA "over" sprite for reference point
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DIVE_AREA], i, nexti)
StatIterator it(STAT_DIVE_AREA);
while ((i = it.NextIndex()) >= 0)
{
over_sp = &sprite[i];
@ -19932,7 +19949,8 @@ SpriteWarpToUnderwater(SPRITEp sp)
Found = false;
// search for UNDERWATER "under" sprite for reference point
TRAVERSE_SPRITE_STAT(headspritestat[STAT_UNDERWATER], i, nexti)
StatIterator it(STAT_UNDERWATER);
while ((i = it.NextIndex()) >= 0)
{
under_sp = &sprite[i];
@ -19994,7 +20012,8 @@ SpriteWarpToSurface(SPRITEp sp)
return false;
// search for UNDERWATER "under" sprite for reference point
TRAVERSE_SPRITE_STAT(headspritestat[STAT_UNDERWATER], i, nexti)
StatIterator it(STAT_UNDERWATER);
while ((i = it.NextIndex()) >= 0)
{
under_sp = &sprite[i];
@ -20015,7 +20034,8 @@ SpriteWarpToSurface(SPRITEp sp)
Found = false;
// search for DIVE_AREA "over" sprite for reference point
TRAVERSE_SPRITE_STAT(headspritestat[STAT_DIVE_AREA], i, nexti)
StatIterator it(STAT_DIVE_AREA);
while ((i = it.NextIndex()) >= 0)
{
over_sp = &sprite[i];