2020-10-15 15:15:45 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
|
class StatIterator
|
|
|
|
{
|
|
|
|
int next;
|
|
|
|
public:
|
|
|
|
StatIterator(int stat)
|
|
|
|
{
|
|
|
|
assert(stat >= 0 && stat < MAXSTATUS);
|
|
|
|
next = headspritestat[stat];
|
|
|
|
}
|
|
|
|
|
|
|
|
void Reset(int stat)
|
|
|
|
{
|
|
|
|
assert(stat >= 0 && stat < MAXSTATUS);
|
|
|
|
next = headspritestat[stat];
|
|
|
|
}
|
|
|
|
|
|
|
|
int NextIndex()
|
|
|
|
{
|
|
|
|
int n = next;
|
2020-10-16 05:12:35 +00:00
|
|
|
if (n >= 0) next = nextspritestat[next];
|
2020-10-15 15:15:45 +00:00
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
int PeekIndex()
|
|
|
|
{
|
|
|
|
return next;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// These are only used by one particularly screwy loop in Blood's nnexts.cpp.
|
|
|
|
static int First(int stat)
|
|
|
|
{
|
|
|
|
return headspritestat[stat];
|
|
|
|
}
|
|
|
|
|
|
|
|
static int NextFor(int spr)
|
|
|
|
{
|
|
|
|
return nextspritestat[spr];
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
class SectIterator
|
|
|
|
{
|
|
|
|
int next;
|
|
|
|
public:
|
|
|
|
SectIterator(int stat)
|
|
|
|
{
|
2021-11-09 08:06:54 +00:00
|
|
|
assert(validSectorIndex(stat));
|
2020-10-15 15:15:45 +00:00
|
|
|
next = headspritesect[stat];
|
|
|
|
}
|
2021-11-15 21:44:16 +00:00
|
|
|
|
|
|
|
SectIterator(sectortype* sect)
|
|
|
|
{
|
|
|
|
assert(sect);
|
2021-11-20 22:20:43 +00:00
|
|
|
next = headspritesect[sector.IndexOf(sect)];
|
2021-11-15 21:44:16 +00:00
|
|
|
}
|
2020-10-15 15:15:45 +00:00
|
|
|
|
|
|
|
void Reset(int stat)
|
|
|
|
{
|
2021-11-09 08:06:54 +00:00
|
|
|
assert(validSectorIndex(stat));
|
2020-10-15 15:15:45 +00:00
|
|
|
next = headspritesect[stat];
|
|
|
|
}
|
|
|
|
|
2021-11-15 21:44:16 +00:00
|
|
|
void Reset(sectortype* sect)
|
|
|
|
{
|
|
|
|
assert(sect);
|
2021-11-20 22:20:43 +00:00
|
|
|
next = headspritesect[sector.IndexOf(sect)];
|
|
|
|
}
|
2021-11-15 21:44:16 +00:00
|
|
|
|
2020-10-15 15:15:45 +00:00
|
|
|
int NextIndex()
|
|
|
|
{
|
|
|
|
int n = next;
|
2020-10-16 05:12:35 +00:00
|
|
|
if (n >= 0) next = nextspritesect[next];
|
2020-10-15 15:15:45 +00:00
|
|
|
return n;
|
|
|
|
}
|
2020-10-16 05:12:35 +00:00
|
|
|
|
|
|
|
int PeekIndex()
|
|
|
|
{
|
|
|
|
return next;
|
|
|
|
}
|
2020-10-15 15:15:45 +00:00
|
|
|
};
|