- removed the mostly unused macros for sprite iteration.

This commit is contained in:
Christoph Oelckers 2020-10-15 16:59:43 +02:00
parent aa5c7c3e34
commit be3292d29b
5 changed files with 13 additions and 28 deletions

View file

@ -2418,7 +2418,9 @@ int actOwnerIdToSpriteId(int nSprite)
bool actTypeInSector(int nSector, int nType)
{
for (int nSprite = headspritesect[nSector]; nSprite >= 0; nSprite = nextspritestat[nSprite])
int nSprite;
SectIterator it(nSector);
while ((nSprite = it.NextIndex()) >= 0)
{
if (sprite[nSprite].index == nType)
return 1;

View file

@ -219,7 +219,9 @@ static void sub_68230(int, int nXSprite)
static char TargetNearExplosion(spritetype *pSprite)
{
for (short nSprite = headspritesect[pSprite->sectnum]; nSprite >= 0; nSprite = nextspritesect[nSprite])
int nSprite;
SectIterator it(pSprite->sectnum);
while ((nSprite = it.NextIndex()) >= 0)
{
if (sprite[nSprite].type == kThingArmedTNTStick || sprite[nSprite].statnum == kStatExplosion)
return 1;

View file

@ -363,7 +363,10 @@ void CounterCheck(int nSector) // 12
int nReq = pXSector->waitTimeA; int nType = pXSector->data; int nCount = 0;
if (!nType || !nReq) return;
for (int nSprite = headspritesect[nSector]; nSprite >= 0; nSprite = nextspritesect[nSprite]) {
int nSprite;
SectIterator it(nSector);
while ((nSprite = it.NextIndex()) >= 0)
{
if (sprite[nSprite].type == nType) nCount++;
}

View file

@ -81,33 +81,9 @@ enum rendmode_t {
#define PR_LIGHT_PRIO_LOW 4
#define PR_LIGHT_PRIO_LOW_GAME 5
// Convenient sprite iterators, must not be used if any sprites inside the loop
// are potentially deleted or their sector changed...
#define SPRITES_OF(Statnum, Iter) Iter=headspritestat[Statnum]; Iter>=0; Iter=nextspritestat[Iter]
#define SPRITES_OF_SECT(Sectnum, Iter) Iter=headspritesect[Sectnum]; Iter>=0; Iter=nextspritesect[Iter]
// ... in which case this iterator may be used:
#define SPRITES_OF_SECT_SAFE(Sectnum, Iter, Next) Iter=headspritesect[Sectnum]; \
Iter>=0 && (Next=nextspritesect[Iter], 1); Iter=Next
#define SPRITES_OF_STAT_SAFE(Statnum, Iter, Next) Iter=headspritestat[Statnum]; \
Iter>=0 && (Next=nextspritestat[Iter], 1); Iter=Next
////////// yax defs //////////
#define SECTORFLD(Sect,Fld, Cf) (*((Cf) ? (&sector[Sect].floor##Fld) : (&sector[Sect].ceiling##Fld)))
#define YAX_CEILING 0 // don't change!
#define YAX_FLOOR 1 // don't change!
# define YAX_MAXBUNCHES 256
# define YAX_BIT 1024
// "has next wall when constrained"-bit (1<<10: ceiling, 1<<11: floor)
# define YAX_NEXTWALLBIT(Cf) (1<<(10+Cf))
# define YAX_NEXTWALLBITS (YAX_NEXTWALLBIT(0)|YAX_NEXTWALLBIT(1))
# define yax_preparedrawrooms()
# define yax_drawrooms(SpriteAnimFunc, sectnum, didmirror, smoothr)
#define CLIPMASK0 (IntToFixed(1)+1)
#define CLIPMASK1 (IntToFixed(256)+64)

View file

@ -139,7 +139,9 @@ void so_addinterpolation(SECTOR_OBJECTp sop)
}
}
for (SPRITES_OF_SECT(*sectp - sector, i))
int i;
SectIterator it(*sectp - sector);
while ((i = it.NextIndex()) >= 0)
if (sprite[i].statnum == STAT_VATOR && SP_TAG1(sprite+i) == SECT_VATOR)
break;
interp->hasvator |= (i >= 0);