- another batch in SW.

This commit is contained in:
Christoph Oelckers 2020-10-15 18:07:35 +02:00
parent 727e2ceb29
commit 6eb6938bbe
9 changed files with 93 additions and 60 deletions

View file

@ -110,7 +110,7 @@ void CopySectorMatch(short match)
int ed,ss;
SPRITEp dest_sp, src_sp;
SECTORp dsectp,ssectp;
short kill, nextkill;
int kill;
SPRITEp k;
StatIterator it(STAT_COPY_DEST);
@ -130,7 +130,7 @@ void CopySectorMatch(short match)
if (SP_TAG2(src_sp) == SPRITE_TAG2(ed) &&
SP_TAG3(src_sp) == SPRITE_TAG3(ed))
{
short src_move, nextsrc_move;
int src_move;
ssectp = &sector[src_sp->sectnum];
// !!!!!AAAAAAAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHH
@ -140,7 +140,8 @@ void CopySectorMatch(short match)
#if 1
// kill all sprites in the dest sector that need to be
TRAVERSE_SPRITE_SECT(headspritesect[dest_sp->sectnum], kill, nextkill)
SectIterator itsec(dest_sp->sectnum);
while ((kill = itsec.NextIndex()) >= 0)
{
k = &sprite[kill];
@ -163,7 +164,8 @@ void CopySectorMatch(short match)
CopySectorWalls(dest_sp->sectnum, src_sp->sectnum);
TRAVERSE_SPRITE_SECT(headspritesect[src_sp->sectnum], src_move, nextsrc_move)
itsec.Reset(src_sp->sectnum);
while ((src_move = itsec.NextIndex()) >= 0)
{
// don't move ST1 Copy Tags
if (SPRITE_TAG1(src_move) != SECT_COPY_SOURCE)

View file

@ -454,7 +454,7 @@ void WarpCopySprite(void)
{
SPRITEp sp1, sp2, sp;
int sn, sn2;
int spnum, next_spnum;
int spnum;
int xoff,yoff,zoff;
short match;
short sect1, sect2;
@ -478,7 +478,8 @@ void WarpCopySprite(void)
sect1 = sp1->sectnum;
sect2 = sp2->sectnum;
TRAVERSE_SPRITE_SECT(headspritesect[sect1], spnum, next_spnum)
SectIterator it(sect1);
while ((spnum = it.NextIndex()) >= 0)
{
if (&sprite[spnum] == sp1)
continue;
@ -499,7 +500,8 @@ void WarpCopySprite(void)
New->sectnum = sp2->sectnum;
}
TRAVERSE_SPRITE_SECT(headspritesect[sect2], spnum, next_spnum)
it.Reset(sect2);
while ((spnum = it.NextIndex()) >= 0)
{
if (&sprite[spnum] == sp2)
continue;
@ -1900,7 +1902,9 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang)
// Draw sprites
k = Player[screenpeek].PlayerSprite;
for (i = 0; i < numsectors; i++)
for (j = headspritesect[i]; j >= 0; j = nextspritesect[j])
{
SectIterator it(i);
while ((j = it.NextIndex()) >= 0)
{
for (p = connecthead; p >= 0; p = connectpoint2[p])
{
@ -2074,7 +2078,8 @@ bool GameInterface::DrawAutomapPlayer(int cposx, int cposy, int czoom, int cang)
}
}
}
return true;
}
return true;
}

View file

@ -170,12 +170,12 @@ void
JS_SpriteSetup(void)
{
SPRITEp sp;
short SpriteNum = 0, NextSprite;
int SpriteNum;
USERp u;
short i;
TRAVERSE_SPRITE_STAT(headspritestat[0], SpriteNum, NextSprite)
StatIterator it(STAT_DEFAULT);
while ((SpriteNum = it.NextIndex()) >= 0)
{
short tag;
@ -288,7 +288,7 @@ void JS_InitMirrors(void)
{
short startwall, endwall;
int i, j, s;
short SpriteNum = 0, NextSprite;
int SpriteNum;
bool Found_Cam = false;
@ -384,7 +384,8 @@ void JS_InitMirrors(void)
Found_Cam = false;
if (TEST_BOOL1(&sprite[mirror[mirrorcnt].camera]))
{
TRAVERSE_SPRITE_STAT(headspritestat[0], SpriteNum, NextSprite)
StatIterator it(STAT_DEFAULT);
while ((SpriteNum = it.NextIndex()) >= 0)
{
sp = &sprite[SpriteNum];
if (sp->picnum >= CAMSPRITE && sp->picnum < CAMSPRITE + 8 &&
@ -1390,7 +1391,7 @@ void
UnlockKeyLock(short key_num, short hit_sprite)
{
SPRITEp sp;
int SpriteNum = 0, NextSprite = 0, color = 0;
int SpriteNum = 0, color = 0;
// Get palette by looking at key number
switch (key_num - 1)
@ -1421,7 +1422,8 @@ UnlockKeyLock(short key_num, short hit_sprite)
break;
}
TRAVERSE_SPRITE_STAT(headspritestat[0], SpriteNum, NextSprite)
StatIterator it(STAT_DEFAULT);
while ((SpriteNum = it.NextIndex()) >= 0)
{
sp = &sprite[SpriteNum];

View file

@ -2114,9 +2114,10 @@ void
DoFlagScore(int16_t pal)
{
SPRITEp sp;
int SpriteNum = 0, NextSprite = 0;
int SpriteNum;
TRAVERSE_SPRITE_STAT(headspritestat[0], SpriteNum, NextSprite)
StatIterator it(STAT_DEFAULT);
while ((SpriteNum = it.NextIndex()) >= 0)
{
sp = &sprite[SpriteNum];

View file

@ -7533,7 +7533,7 @@ InitMultiPlayerInfo(void)
SPRITEp sp;
short pnum, start0;
unsigned stat;
short SpriteNum, NextSprite, tag;
int SpriteNum, tag;
static short MultiStatList[] =
{
STAT_MULTI_START,
@ -7541,7 +7541,8 @@ InitMultiPlayerInfo(void)
};
// this routine is called before SpriteSetup - process start positions NOW
TRAVERSE_SPRITE_STAT(headspritestat[0], SpriteNum, NextSprite)
StatIterator it(STAT_DEFAULT);
while ((SpriteNum = it.NextIndex()) >= 0)
{
sp = &sprite[SpriteNum];

View file

@ -89,10 +89,11 @@ int COVERinsertsprite(short sectnum, short stat)
bool
FAF_Sector(short sectnum)
{
short SpriteNum, Next;
int SpriteNum;
SPRITEp sp;
TRAVERSE_SPRITE_SECT(headspritesect[sectnum], SpriteNum, Next)
SectIterator it(sectnum);
while ((SpriteNum = it.NextIndex()) >= 0)
{
sp = &sprite[SpriteNum];
@ -687,7 +688,7 @@ GetUpperLowerSector(short match, int x, int y, short *upper, short *lower)
int i;
short sectorlist[16];
int sln = 0;
short SpriteNum, Next;
int SpriteNum;
SPRITEp sp;
// keep a list of the last stacked sectors the view was in and
@ -700,7 +701,8 @@ GetUpperLowerSector(short match, int x, int y, short *upper, short *lower)
{
bool found = false;
TRAVERSE_SPRITE_SECT(headspritesect[GlobStackSect[i]], SpriteNum, Next)
SectIterator it(GlobStackSect[i]);
while ((SpriteNum = it.NextIndex()) >= 0)
{
sp = &sprite[SpriteNum];
@ -730,7 +732,8 @@ GetUpperLowerSector(short match, int x, int y, short *upper, short *lower)
{
bool found = false;
TRAVERSE_SPRITE_SECT(headspritesect[i], SpriteNum, Next)
SectIterator it(i);
while ((SpriteNum = it.NextIndex()) >= 0)
{
sp = &sprite[SpriteNum];

View file

@ -1134,14 +1134,15 @@ int DoSpawnSpot(short SpriteNum)
void
DoSpawnSpotsForKill(short match)
{
short sn, next_sn;
int sn;
SPRITEp sp;
USERp u;
if (match < 0)
return;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SPAWN_SPOT], sn, next_sn)
StatIterator it(STAT_SPAWN_SPOT);
while ((sn = it.NextIndex()) >= 0)
{
sp = &sprite[sn];
@ -1163,14 +1164,15 @@ DoSpawnSpotsForKill(short match)
void
DoSpawnSpotsForDamage(short match)
{
short sn, next_sn;
int sn;
SPRITEp sp;
USERp u;
if (match < 0)
return;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SPAWN_SPOT], sn, next_sn)
StatIterator it(STAT_SPAWN_SPOT);
while ((sn = it.NextIndex()) >= 0)
{
sp = &sprite[sn];
@ -1191,7 +1193,7 @@ DoSpawnSpotsForDamage(short match)
void
DoSoundSpotMatch(short match, short sound_num, short sound_type)
{
short sn, next_sn;
int sn;
SPRITEp sp;
int flags;
short snd2play;
@ -1202,7 +1204,8 @@ DoSoundSpotMatch(short match, short sound_num, short sound_type)
ASSERT(sound_num >= 0);
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SOUND_SPOT], sn, next_sn)
StatIterator it(STAT_SOUND_SPOT);
while ((sn = it.NextIndex()) >= 0)
{
sp = &sprite[sn];
@ -1278,10 +1281,11 @@ DoSoundSpotMatch(short match, short sound_num, short sound_type)
void
DoSoundSpotStopSound(short match)
{
short sn, next_sn;
int sn;
SPRITEp sp;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_SOUND_SPOT], sn, next_sn)
StatIterator it(STAT_SOUND_SPOT);
while ((sn = it.NextIndex()) >= 0)
{
sp = &sprite[sn];
@ -1296,10 +1300,11 @@ DoSoundSpotStopSound(short match)
void
DoStopSoundSpotMatch(short match)
{
short sn, next_sn;
int sn;
SPRITEp sp;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_STOP_SOUND_SPOT], sn, next_sn)
StatIterator it(STAT_STOP_SOUND_SPOT);
while ((sn = it.NextIndex()) >= 0)
{
sp = &sprite[sn];
@ -1528,11 +1533,12 @@ void DoDeleteSpriteMatch(short match)
void
DoChangorMatch(short match)
{
short sn, next_sn;
int sn;
SPRITEp sp;
SECTORp sectp;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_CHANGOR], sn, next_sn)
StatIterator it(STAT_CHANGOR);
while ((sn = it.NextIndex()) >= 0)
{
sp = &sprite[sn];
sectp = &sector[sp->sectnum];

View file

@ -1648,7 +1648,8 @@ void PreMapCombineFloors(void)
{
dasect = sectlist[sectlistplc++];
for (j=headspritesect[dasect]; j>=0; j=nextspritesect[j])
SectIterator it(dasect);
while ((j = it.NextIndex()) >= 0)
{
sprite[j].x += dx;
sprite[j].y += dy;
@ -1758,14 +1759,15 @@ SpriteSetupPost(void)
{
SPRITEp ds;
USERp u;
short SpriteNum, NextSprite;
int SpriteNum;
int i;
int cz,fz;
// Post processing of some sprites after gone through the main SpriteSetup()
// routine
TRAVERSE_SPRITE_STAT(headspritestat[STAT_FLOOR_PAN], SpriteNum, NextSprite)
StatIterator it(STAT_FLOOR_PAN);
while ((SpriteNum = it.NextIndex()) >= 0)
{
SectIterator it(sprite[SpriteNum].sectnum);
while ((i = it.NextIndex()) >= 0)
@ -1803,7 +1805,7 @@ void
SpriteSetup(void)
{
SPRITEp sp;
short SpriteNum = 0, NextSprite;
int SpriteNum;
USERp u;
short i, num;
int cz,fz;
@ -1827,7 +1829,8 @@ SpriteSetup(void)
// Call my little sprite setup routine first
JS_SpriteSetup();
TRAVERSE_SPRITE_STAT(headspritestat[0], SpriteNum, NextSprite)
StatIterator it(STAT_DEFAULT);
while ((SpriteNum = it.NextIndex()) >= 0)
{
sp = &sprite[SpriteNum];
@ -4752,7 +4755,8 @@ getzrangepoint(int x, int y, int z, short sectnum,
*florhit = sectnum + 16384;
// Go through sprites of only the current sector
for (j = headspritesect[sectnum]; j >= 0; j = nextspritesect[j])
SectIterator it(sectnum);
while ((j = it.NextIndex()) >= 0)
{
spr = &sprite[j];
cstat = spr->cstat;

View file

@ -351,14 +351,15 @@ TrackClonePoint(short SpriteNum)
void QuickJumpSetup(short stat, short lotag, short type)
{
short SpriteNum = 0, NextSprite, ndx;
int SpriteNum = 0, ndx;
TRACK_POINTp tp;
TRACKp t;
SPRITEp nsp;
short start_sprite, end_sprite;
// make short quick jump tracks
TRAVERSE_SPRITE_STAT(headspritestat[stat], SpriteNum, NextSprite)
StatIterator it(stat);
while ((SpriteNum = it.NextIndex()) >= 0)
{
// find an open track
@ -416,14 +417,15 @@ void QuickJumpSetup(short stat, short lotag, short type)
void QuickScanSetup(short stat, short lotag, short type)
{
short SpriteNum = 0, NextSprite, ndx;
int SpriteNum = 0, ndx;
TRACK_POINTp tp;
TRACKp t;
SPRITEp nsp;
short start_sprite, end_sprite;
// make short quick jump tracks
TRAVERSE_SPRITE_STAT(headspritestat[stat], SpriteNum, NextSprite)
StatIterator it(stat);
while ((SpriteNum = it.NextIndex()) >= 0)
{
// find an open track
@ -477,13 +479,14 @@ void QuickScanSetup(short stat, short lotag, short type)
void QuickExitSetup(short stat, short type)
{
short SpriteNum = 0, NextSprite, ndx;
int SpriteNum = 0, ndx;
TRACK_POINTp tp;
TRACKp t;
SPRITEp nsp;
short start_sprite, end_sprite;
TRAVERSE_SPRITE_STAT(headspritestat[stat], SpriteNum, NextSprite)
StatIterator it(stat);
while ((SpriteNum = it.NextIndex()) >= 0)
{
// find an open track
@ -532,13 +535,14 @@ void QuickExitSetup(short stat, short type)
void QuickLadderSetup(short stat, short lotag, short type)
{
short SpriteNum = 0, NextSprite, ndx;
int SpriteNum = 0, ndx;
TRACK_POINTp tp;
TRACKp t;
SPRITEp nsp;
short start_sprite, end_sprite;
TRAVERSE_SPRITE_STAT(headspritestat[stat], SpriteNum, NextSprite)
StatIterator it(stat);
while ((SpriteNum = it.NextIndex()) >= 0)
{
// find an open track
@ -594,7 +598,7 @@ void QuickLadderSetup(short stat, short lotag, short type)
void
TrackSetup(void)
{
short SpriteNum = 0, NextSprite, ndx;
int SpriteNum = 0, ndx;
TRACK_POINTp tp;
TRACKp t;
TRACK_POINTp New;
@ -623,7 +627,8 @@ TrackSetup(void)
t = &Track[ndx];
// find the first point and save it
TRAVERSE_SPRITE_STAT(headspritestat[STAT_TRACK + ndx], SpriteNum, NextSprite)
StatIterator it(STAT_TRACK + ndx);
while ((SpriteNum = it.NextIndex()) >= 0)
{
if (LOW_TAG_SPRITE(SpriteNum) == TRACK_START)
{
@ -660,7 +665,8 @@ TrackSetup(void)
int dist, low_dist = 999999;
// find the closest point to the last point
TRAVERSE_SPRITE_STAT(headspritestat[STAT_TRACK + ndx], SpriteNum, NextSprite)
StatIterator it(STAT_TRACK + ndx);
while ((SpriteNum = it.NextIndex()) >= 0)
{
dist = Distance((tp + t->NumPoints - 1)->x, (tp + t->NumPoints - 1)->y, sprite[SpriteNum].x, sprite[SpriteNum].y);
@ -705,9 +711,10 @@ TrackSetup(void)
SPRITEp
FindBoundSprite(short tag)
{
short sn, next_sn;
short sn;
TRAVERSE_SPRITE_STAT(headspritestat[STAT_ST1], sn, next_sn)
StatIterator it(STAT_ST1);
while ((sn = it.NextIndex()) >= 0)
{
if (sprite[sn].hitag == tag)
{
@ -1037,7 +1044,7 @@ SetupSectorObject(short sectnum, short tag)
{
SPRITEp sp;
SECTOR_OBJECTp sop;
short object_num, SpriteNum, NextSprite;
int object_num, SpriteNum;
short j;
short New;
USERp u;
@ -1131,7 +1138,8 @@ SetupSectorObject(short sectnum, short tag)
SET(u->Flags2, SPR2_SPRITE_FAKE_BLOCK); // for damage test
// check for any ST1 sprites laying on the center sector
TRAVERSE_SPRITE_SECT(headspritesect[sectnum], SpriteNum, NextSprite)
SectIterator it(sectnum);
while ((SpriteNum = it.NextIndex()) >= 0)
{
sp = &sprite[SpriteNum];
@ -2831,14 +2839,15 @@ PlaceSectorObject(SECTOR_OBJECTp sop, int newx, int newy)
void VehicleSetSmoke(SECTOR_OBJECTp sop, ANIMATORp animator)
{
short SpriteNum, NextSprite;
short SpriteNum;
SECTORp *sectp;
SPRITEp sp;
USERp u;
for (sectp = sop->sectp; *sectp; sectp++)
{
TRAVERSE_SPRITE_SECT(headspritesect[*sectp - sector], SpriteNum, NextSprite)
SectIterator it(*sectp - sector);
while ((SpriteNum = it.NextIndex()) >= 0)
{
sp = &sprite[SpriteNum];
u = User[SpriteNum];