- all iterators in Exhumed handled.

This commit is contained in:
Christoph Oelckers 2020-10-15 19:10:51 +02:00
parent a8e7d1ef74
commit db4f0d041e
7 changed files with 34 additions and 53 deletions

View file

@ -194,7 +194,10 @@ void ShutDown(void)
void DoClockBeep()
{
for (int i = headspritestat[407]; i != -1; i = nextspritestat[i]) {
int i;
StatIterator it(407);
while ((i = it.NextIndex()) >= 0)
{
PlayFX2(StaticSound[kSound74], i);
}
}
@ -207,7 +210,9 @@ void DoRedAlert(int nVal)
nRedTicks = 30;
}
for (int i = headspritestat[405]; i != -1; i = nextspritestat[i])
int i;
StatIterator it(405);
while ((i = it.NextIndex()) >= 0)
{
if (nVal)
{
@ -533,9 +538,7 @@ void GameInterface::app_init()
void mychangespritesect(int nSprite, int nSector)
{
DoKenTest();
changespritesect(nSprite, nSector);
DoKenTest();
}
void mydeletesprite(int nSprite)

View file

@ -298,7 +298,9 @@ void AddFlash(short nSector, int x, int y, int z, int val)
}
}
for (short nSprite = headspritesect[nSector]; nSprite >= 0; nSprite = nextspritesect[nSprite])
int nSprite;
SectIterator it(nSector);
while ((nSprite = it.NextIndex()) >= 0)
{
if (sprite[nSprite].pal < 4)
{

View file

@ -1001,7 +1001,8 @@ void MoveSector(short nSector, int nAngle, int *nXVel, int *nYVel)
// GREEN
if (yvect || xvect)
{
for (i = headspritesect[nSector]; i != -1; i = nextspritesect[i])
SectIterator it(nSector);
while ((i = it.NextIndex()) >= 0)
{
if (sprite[i].statnum < 99)
{
@ -1027,7 +1028,8 @@ void MoveSector(short nSector, int nAngle, int *nXVel, int *nYVel)
}
}
for (i = headspritesect[nNextSector]; i != -1; i = nextspritesect[i])
it.Reset(nNextSector);
while ((i = it.NextIndex()) >= 0)
{
if (sprite[i].statnum >= 99)
{
@ -1078,7 +1080,8 @@ void MoveSector(short nSector, int nAngle, int *nXVel, int *nYVel)
if (!(nSectFlag & kSectUnderwater))
{
for (i = headspritesect[nSector]; i != -1; i = nextspritesect[i])
SectIterator it(nSector);
while ((i = it.NextIndex()) >= 0)
{
if (sprite[i].statnum >= 99 && nZVal == sprite[i].z && !(sprite[i].cstat & 0x8000))
{

View file

@ -490,11 +490,11 @@ int CheckSectorSprites(short nSector, int nVal)
if (nVal)
{
short nSprite = headspritesect[nSector];
int nZDiff = sector[nSector].floorz - sector[nSector].ceilingz;
while (nSprite != -1)
int nSprite;
SectIterator it(nSector);
while ((nSprite = it.NextIndex()) >= 0)
{
if ((sprite[nSprite].cstat & 0x101) && (nZDiff < GetSpriteHeight(nSprite)))
{
@ -515,12 +515,13 @@ int CheckSectorSprites(short nSector, int nVal)
sprite[nSprite].sectnum | 0x4000);
}
}
nSprite = nextspritesect[nSprite];
}
}
else
{
for (int i = headspritesect[nSector]; i != -1; i = nextspritesect[i])
int i;
SectIterator it(nSector);
while ((i = it.NextIndex()) >= 0)
{
if (sprite[i].cstat & 0x101) {
return 1;
@ -535,15 +536,13 @@ int CheckSectorSprites(short nSector, int nVal)
// done
void MoveSectorSprites(int nSector, int z)
{
int nSprite = headspritesect[nSector];
while (nSprite != -1)
int nSprite;
SectIterator it(nSector);
while ((nSprite = it.NextIndex()) >= 0)
{
if (sprite[nSprite].statnum != 200) {
sprite[nSprite].z += z;
}
nSprite = nextspritesect[nSprite];
}
}
@ -1621,7 +1620,6 @@ void KillCreatures()
{
signed int v0;
signed int v1;
int i;
v0 = 99;
v1 = 99;
@ -1630,7 +1628,9 @@ void KillCreatures()
{
if (v0 != 100)
{
for (i = headspritestat[v1]; i != -1; i = nextspritestat[i])
int i;
StatIterator it(v1);
while ((i = it.NextIndex()) >= 0)
{
runlist_DamageEnemy(i, -1, 1600);
}

View file

@ -161,11 +161,10 @@ void feebtag(int x, int y, int z, int nSector, short *nSprite, int nVal2, int nV
{
if (nSector != -1)
{
short i = headspritesect[nSector];
while (i != -1)
int i;
SectIterator it(nSector);
while ((i = it.NextIndex()) >= 0)
{
short nNextSprite = nextspritesect[i];
short nStat = sprite[i].statnum;
if (nStat >= 900 && !(sprite[i].cstat & 0x8000))
@ -193,8 +192,6 @@ void feebtag(int x, int y, int z, int nSector, short *nSprite, int nVal2, int nV
}
}
}
i = nNextSprite;
}
}
@ -666,31 +663,6 @@ void PlayAlert(const char *str)
PlayLocalSound(StaticSound[kSound63], 0);
}
void DoKenTest()
{
int nPlayerSprite = PlayerList[0].nSprite;
if ((unsigned int)nPlayerSprite >= kMaxSprites)
{
return;
}
int nSector = sprite[nPlayerSprite].sectnum;
if ((unsigned int)nSector >= kMaxSectors)
{
Printf("DoKenTest: (unsigned int)nSector >= kMaxSectors\n");
return;
}
for (int i = headspritesect[nSector]; ; i = nextspritesect[i])
{
if (i == -1) {
return;
}
if (nextspritesect[i] == i) {
I_Error("ERROR in Ken's linked list!\n");
}
}
}
static void pickupMessage(int no)
{

View file

@ -28,7 +28,6 @@ void RestoreSavePoint(int nPlayer, int *x, int *y, int *z, short *nSector, short
void SetSavePoint(int nPlayer, int x, int y, int z, short nSector, short nAngle);
void InitPlayer();
void InitPlayerKeys(short nPlayer);
void DoKenTest();
int GrabPlayer();
void InitPlayerInventory(short nPlayer);
void RestartPlayer(short nPlayer);

View file

@ -274,7 +274,9 @@ int FindSnakeEnemy(short nSnake)
int nEnemy = -1;
for (int i = headspritesect[nSector]; i >= 0; i = nextspritesect[i])
int i;
SectIterator it(nSector);
while ((i = it.NextIndex()) >= 0)
{
if (sprite[i].statnum >= 90 && sprite[i].statnum < 150 && (sprite[i].cstat & 0x101))
{