- all direct references to xsector have been removed.

This commit is contained in:
Christoph Oelckers 2021-11-19 20:25:16 +01:00
parent c54137766c
commit 93f5a111bf
5 changed files with 28 additions and 30 deletions

View file

@ -300,10 +300,9 @@ void PropagateMarkerReferences(void)
int nOwner = actor->s().owner;
if (nOwner >= 0 && nOwner < numsectors)
{
int nXSector = sector[nOwner].extra;
if (nXSector > 0 && nXSector < kMaxXSectors)
if (sector[nOwner].hasX())
{
xsector[nXSector].marker0 = actor;
sector[nOwner].xs().marker0 = actor;
continue;
}
}
@ -314,10 +313,9 @@ void PropagateMarkerReferences(void)
int nOwner = actor->s().owner;
if (nOwner >= 0 && nOwner < numsectors)
{
int nXSector = sector[nOwner].extra;
if (nXSector > 0 && nXSector < kMaxXSectors)
if (sector[nOwner].hasX())
{
xsector[nXSector].marker1 = actor;
sector[nOwner].xs().marker1 = actor;
continue;
}
}

View file

@ -636,9 +636,9 @@ void GetZRange(DBloodActor *actor, int *ceilZ, Collision *ceilColl, int *floorZ,
int nSector = floorColl->index;
if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (sector[nSector].floorstat & 1))
*floorZ = 0x7fffffff;
if (sector[nSector].extra > 0)
if (sector[nSector].hasX())
{
XSECTOR *pXSector = &xsector[sector[nSector].extra];
XSECTOR *pXSector = &sector[nSector].xs();
*floorZ += pXSector->Depth << 10;
}
auto actor = getUpperLink(nSector);
@ -682,9 +682,9 @@ void GetZRangeAtXYZ(int x, int y, int z, int nSector, int *ceilZ, Collision* cei
int nSector = floorColl->index;
if ((nClipParallax & PARALLAXCLIP_FLOOR) == 0 && (sector[nSector].floorstat & 1))
*floorZ = 0x7fffffff;
if (sector[nSector].extra > 0)
if (sector[nSector].hasX())
{
XSECTOR *pXSector = &xsector[sector[nSector].extra];
XSECTOR* pXSector = &sector[nSector].xs();
*floorZ += pXSector->Depth << 10;
}
auto actor = getUpperLink(nSector);
@ -794,7 +794,7 @@ BitArray GetClosestSpriteSectors(int nSector, int x, int y, int nDist, TArray<in
{
sectorMap.Set(nNextSector);
search.Add(nNextSector);
if (pWalls && wal.extra > 0)
if (pWalls && wal.hasX())
{
XWALL* pXWall = &wal.xw();
if (pXWall->triggerVector && !pXWall->isTriggered && !pXWall->state)

View file

@ -1165,7 +1165,7 @@ void nnExtProcessSuperSprites()
continue;
int index = rxBucket[j].rxindex;
XSECTOR* pXSector = &xsector[sector[index].extra];
XSECTOR* pXSector = &sector[index].xs();
if ((!pXSector->locked) && (fWindAlways || pXSector->windAlways || pXSector->busy))
windGenDoVerticalWind(pXWind->sysData2, index);
}
@ -1179,7 +1179,7 @@ void nnExtProcessSuperSprites()
continue;
int index = rxBucket[j].rxindex;
XSECTOR* pXSector = &xsector[sector[index].extra];
XSECTOR* pXSector = &sector[index].xs();
if ((!pXSector->locked) && (fWindAlways || pXSector->windAlways || pXSector->busy))
windGenDoVerticalWind(pXWind->sysData2, index);
}
@ -1333,7 +1333,7 @@ void nnExtProcessSuperSprites()
continue;
}
XSECTOR* pXSector = (sector[pDebris->sectnum].extra >= 0) ? &xsector[sector[pDebris->sectnum].extra] : nullptr;
XSECTOR* pXSector = (sector[pDebris->sectnum].hasX()) ? &sector[pDebris->sectnum].xs() : nullptr;
viewBackupSpriteLoc(debrisactor);
bool uwater = false;
@ -1707,7 +1707,7 @@ void debrisMove(int listIndex)
bool uwater = false;
int tmpFraction = actor->spriteMass.fraction;
if (sector[nSector].extra >= 0 && xsector[sector[nSector].extra].Underwater)
if (sector[nSector].hasX() && sector[nSector].xs().Underwater)
{
tmpFraction >>= 1;
uwater = true;
@ -1756,8 +1756,8 @@ void debrisMove(int listIndex)
nSector = pSprite->sectnum;
}
if (sector[nSector].extra > 0)
uwater = xsector[sector[nSector].extra].Underwater;
if (sector[nSector].hasX())
uwater = sector[nSector].xs().Underwater;
if (actor->zvel)
pSprite->z += actor->zvel >> 8;
@ -1981,7 +1981,7 @@ void windGenStopWindOnSectors(DBloodActor* sourceactor)
for (int i = bucketHead[pXSource->txID]; i < bucketHead[pXSource->txID + 1]; i++)
{
if (rxBucket[i].type != OBJ_SECTOR) continue;
XSECTOR* pXSector = &xsector[sector[rxBucket[i].rxindex].extra];
XSECTOR* pXSector = &sector[rxBucket[i].rxindex].xs();
if ((pXSector->state == 1 && !pXSector->windAlways)
|| ((pSource->flags & kModernTypeFlag1) && !(pSource->flags & kModernTypeFlag2)))
{
@ -1997,7 +1997,7 @@ void windGenStopWindOnSectors(DBloodActor* sourceactor)
for (int i = bucketHead[rx]; i < bucketHead[rx + 1]; i++)
{
if (rxBucket[i].type != OBJ_SECTOR) continue;
XSECTOR* pXSector = &xsector[sector[rxBucket[i].rxindex].extra];
XSECTOR* pXSector = &sector[rxBucket[i].rxindex].xs();
if ((pXSector->state == 1 && !pXSector->windAlways) || (pSource->flags & kModernTypeFlag2))
pXSector->windVel = 0;
}
@ -2855,7 +2855,7 @@ void usePropertiesChanger(DBloodActor* sourceactor, int objType, int objIndex, D
case OBJ_SECTOR:
{
sectortype* pSector = &sector[objIndex];
XSECTOR* pXSector = &xsector[sector[objIndex].extra];
XSECTOR* pXSector = &pSector->xs();
// data1 = sector underwater status and depth level
if (pXSource->data1 >= 0 && pXSource->data1 < 2) {
@ -3014,7 +3014,7 @@ void useTeleportTarget(DBloodActor* sourceactor, DBloodActor* actor)
auto pXSource = &sourceactor->x();
PLAYER* pPlayer = getPlayerById(pSprite->type);
XSECTOR* pXSector = (sector[pSource->sectnum].extra >= 0) ? &xsector[sector[pSource->sectnum].extra] : NULL;
XSECTOR* pXSector = (pSource->sector()->hasX()) ? &pSource->sector()->xs() : nullptr;
bool isDude = (!pPlayer && actor->IsDudeActor());
if (pSprite->sectnum != pSource->sectnum)
@ -7533,9 +7533,9 @@ bool nnExtCanMove(DBloodActor* actor, DBloodActor* target, int nAngle, int nRang
if (!FindSector(x, y, z, &nSector))
return false;
if (sector[nSector].extra > 0) {
if (sector[nSector].hasX()) {
XSECTOR* pXSector = &xsector[sector[nSector].extra];
XSECTOR* pXSector = &sector[nSector].xs();
return !((sector[nSector].type == kSectorDamage || pXSector->damageType > 0) && pXSector->state && !nnExtIsImmune(actor, pXSector->damageType, 16));
}

View file

@ -549,8 +549,7 @@ static void fakeMoveDude(spritetype *pSprite)
return;
}
}
int n XSector = sector [pSprite->sectnum]. extra;
if (n XSector > 0 && xsector[n XSector].Underwater)
if (pSprite->sector()->hasX() && pSprite->sector()->xs().Underwater)
return;
if (predict.floordist >= 0x100)
return;

View file

@ -1774,10 +1774,11 @@ void trTriggerSprite(DBloodActor* actor, int command)
}
}
void trMessageSector(unsigned int nSector, EVENT event) {
assert(nSector < (unsigned int)numsectors);
assert(sector[nSector].extra > 0 && sector[nSector].extra < kMaxXSectors);
XSECTOR *pXSector = &xsector[sector[nSector].extra];
void trMessageSector(unsigned int nSector, EVENT event)
{
assert(validSectorIndex(nSector));
assert(sector[nSector].hasX());
XSECTOR *pXSector = &sector[nSector].xs();
if (!pXSector->locked || event.cmd == kCmdUnlock || event.cmd == kCmdToggleLock) {
switch (event.cmd) {
case kCmdLink:
@ -1965,7 +1966,7 @@ void trProcessBusy(void)
int oldBusy = gBusy[i].busy;
gBusy[i].busy = ClipRange(oldBusy+gBusy[i].delta*4, 0, 65536);
#ifdef NOONE_EXTENSIONS
if (!gModernMap || !xsector[sector[gBusy[i].index].extra].unused1) nStatus = gBusyProc[gBusy[i].type](gBusy[i].index, gBusy[i].busy);
if (!gModernMap || !sector[gBusy[i].index].xs().unused1) nStatus = gBusyProc[gBusy[i].type](gBusy[i].index, gBusy[i].busy);
else nStatus = 3; // allow to pause/continue motion for sectors any time by sending special command
#else
nStatus = gBusyProc[gBusy[i].type](gBusy[i].at0, gBusy[i].at8);