- eliminated ca. half of the xwall references.

This commit is contained in:
Christoph Oelckers 2021-11-19 01:16:20 +01:00
parent 9cad3196ed
commit 59312c42bb

View file

@ -273,26 +273,24 @@ void evInit()
memset(rxBucket, 0, sizeof(rxBucket)); memset(rxBucket, 0, sizeof(rxBucket));
// add all the tags to the bucket array // add all the tags to the bucket array
for (int i = 0; i < numsectors; i++) for(auto& sect : sectors())
{ {
int nXSector = sector[i].extra; if (sect.hasX() && sect.xs().rxID > 0)
if (nXSector > 0 && xsector[nXSector].rxID > 0)
{ {
assert(nCount < kChannelMax); assert(nCount < kChannelMax);
rxBucket[nCount].type = SS_SECTOR; rxBucket[nCount].type = SS_SECTOR;
rxBucket[nCount].rxindex = i; rxBucket[nCount].rxindex = sectnum(&sect);
nCount++; nCount++;
} }
} }
for (int i = 0; i < numwalls; i++) for(auto& wal: walls())
{ {
int nXWall = wall[i].extra; if (wal.hasX() && wal.xw().rxID > 0)
if (nXWall > 0 && xwall[nXWall].rxID > 0)
{ {
assert(nCount < kChannelMax); assert(nCount < kChannelMax);
rxBucket[nCount].type = SS_WALL; rxBucket[nCount].type = SS_WALL;
rxBucket[nCount].rxindex = i; rxBucket[nCount].rxindex = wallnum(&wal);
nCount++; nCount++;
} }
} }
@ -323,19 +321,13 @@ void evInit()
static bool evGetSourceState(int type, int nIndex, DBloodActor* actor) static bool evGetSourceState(int type, int nIndex, DBloodActor* actor)
{ {
int nXIndex;
switch (type) switch (type)
{ {
case SS_SECTOR: case SS_SECTOR:
nXIndex = sector[nIndex].extra; return sector[nIndex].hasX() && sector[nIndex].xs().state != 0;
assert(nXIndex > 0 && nXIndex < kMaxXSectors);
return xsector[nXIndex].state != 0;
case SS_WALL: case SS_WALL:
nXIndex = wall[nIndex].extra; return wall[nIndex].hasX() && wall[nIndex].xw().state != 0;
assert(nXIndex > 0 && nXIndex < kMaxXWalls);
return xwall[nXIndex].state != 0;
case SS_SPRITE: case SS_SPRITE:
if (actor->hasX()) if (actor->hasX())