- the remaining trivial sector[] replacements

This commit is contained in:
Christoph Oelckers 2021-11-25 17:27:41 +01:00
parent 1a7cc6d782
commit b3eceb3b56
5 changed files with 38 additions and 44 deletions

View file

@ -902,7 +902,7 @@ void DoExplodeSector(short match)
if (!actor->hasU())
/*u = */SpawnUser(actor, 0, nullptr);
sectp = &sector[esp->sectnum];
sectp = esp->sector();
sectp->ceilingz -= Z(SP_TAG4(esp));

View file

@ -1519,7 +1519,7 @@ void PreMapCombineFloors(void)
dx = BoundList[base_offset].offset->x - BoundList[i].offset->x;
dy = BoundList[base_offset].offset->y - BoundList[i].offset->y;
BFSSectorSearch search(&sector[BoundList[i].offset->sectnum]);
BFSSectorSearch search(BoundList[i].offset->sector());
while (auto dasect = search.GetNext())
{
SWSectIterator it(dasect);
@ -1625,9 +1625,9 @@ void SpriteSetup(void)
// Clear Sprite Extension structure
// Clear all extra bits - they are set by sprites
for (int i = 0; i < numsectors; i++)
for(auto& sect : sectors())
{
sector[i].extra = 0;
sect.extra = 0;
}
// Clear PARALLAX_LEVEL overrides
@ -4624,7 +4624,7 @@ void DoActorZrange(DSWActor* actor)
u->highActor = ceilhit.actor;
break;
case kHitSector:
u->hi_sectp = &sector[ceilhit.index];
u->hi_sectp = ceilhit.sector();
break;
default:
ASSERT(true==false);
@ -4637,7 +4637,7 @@ void DoActorZrange(DSWActor* actor)
u->lowActor = florhit.actor;
break;
case kHitSector:
u->lo_sectp = &sector[florhit.index];
u->lo_sectp = florhit.sector();
break;
default:
ASSERT(true==false);
@ -4665,7 +4665,7 @@ int DoActorGlobZ(DSWActor* actor)
u->highActor = globhihit.actor;
break;
default:
u->hi_sectp = &sector[globhihit.index];
u->hi_sectp = globhihit.sector();
break;
}
@ -4675,7 +4675,7 @@ int DoActorGlobZ(DSWActor* actor)
u->lowActor = globlohit.actor;
break;
default:
u->lo_sectp = &sector[globlohit.index];
u->lo_sectp = globlohit.sector();
break;
}
@ -6548,7 +6548,7 @@ Collision move_sprite(DSWActor* actor, int xchange, int ychange, int zchange, in
if (FAF_ConnectArea(spr->sector()))
SetActorZ(actor, &spr->pos);
if (TEST(sector[spr->sectnum].extra, SECTFX_WARP_SECTOR))
if (TEST(spr->sector()->extra, SECTFX_WARP_SECTOR))
{
DSWActor* sp_warp;
if ((sp_warp = WarpPlane(&spr->x, &spr->y, &spr->z, &dasectnum)))

View file

@ -787,11 +787,13 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop)
// look through all sectors for whole sectors that are IN bounds
for (k = 0; k < numsectors; k++)
for (auto&sec : sectors())
{
auto sect = &sec;
SectorInBounds = true;
for(auto& wal : wallsofsector(&sector[k]))
for(auto& wal : wallsofsector(sect))
{
// all walls have to be in bounds to be in sector object
if (!(wal.x > xlow && wal.x < xhigh && wal.y > ylow && wal.y < yhigh))
@ -803,7 +805,6 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop)
if (SectorInBounds)
{
auto sect = &sector[k];
sop->sectp[sop->num_sectors] = sect;
sop->sectp[sop->num_sectors+1] = nullptr;
@ -1017,7 +1018,6 @@ void SetupSectorObject(sectortype* sectp, short tag)
USERp u;
tag -= (TAG_OBJECT_CENTER - 1);
// sector[sectnum].lotag = tag;
object_num = tag / 5;
sop = &SectorObject[object_num];
@ -1093,8 +1093,6 @@ void SetupSectorObject(sectortype* sectp, short tag)
sop->mid_sector = sectp;
SectorMidPoint(sectp, &sop->xmid, &sop->ymid, &sop->zmid);
//sop->zmid = sector[sectnum].floorz;
//sop->zmid = DIV2(sector[sectnum].floorz + sector[sectnum].ceilingz);
sop->dir = 1;
sop->track = sectp->hitag;

View file

@ -121,7 +121,7 @@ int DoWallMove(DSWActor* actor)
{
wal.x = sp->x + nx;
wal.y = sp->y + ny;
sector[wal.sector].dirty = 255;
wal.sectorp()->dirty = 255;
}
if (shade1)

View file

@ -4223,8 +4223,7 @@ bool VehicleMoveHit(DSWActor* actor)
{
case kHitSector:
{
short hit_sect = u->coll.index;
SECTORp sectp = &sector[hit_sect];
SECTORp sectp = u->coll.sector();
if (TEST(sectp->extra, SECTFX_SECTOR_OBJECT))
{
@ -4307,12 +4306,10 @@ bool WeaponMoveHit(DSWActor* actor)
case kHitSector:
{
int hit_sect;
SECTORp sectp;
SECTOR_OBJECTp sop;
hit_sect = u->coll.index;
sectp = &sector[hit_sect];
sectp = u->coll.sector();
ASSERT(sectp->extra != -1);
@ -4332,7 +4329,7 @@ bool WeaponMoveHit(DSWActor* actor)
return true;
}
if (sector[hit_sect].hasU() && FixedToInt(sector[hit_sect].depth_fixed) > 0)
if (sectp->hasU() && FixedToInt(sectp->depth_fixed) > 0)
{
SpawnSplash(actor);
return true;
@ -7656,11 +7653,11 @@ int DoStar(DSWActor* actor)
case kHitSector:
{
bool did_hit_wall;
short hit_sect = u->coll.index;
auto hit_sect = u->coll.sector();
if (sp->z > ((u->hiz + u->loz) >> 1))
{
if (sector[hit_sect].hasU() && FixedToInt(sector[hit_sect].depth_fixed) > 0)
if (hit_sect->hasU() && FixedToInt(hit_sect->depth_fixed) > 0)
{
SpawnSplash(actor);
KillActor(actor);
@ -8384,27 +8381,26 @@ bool SlopeBounce(DSWActor* actor, bool *hit_wall)
int hiz,loz;
int slope;
int dax,day,daz;
short hit_sector;
short daang;
hit_sector = u->coll.index;
auto hit_sector = u->coll.sector();
getzsofslope(hit_sector, sp->x, sp->y, &hiz, &loz);
getzsofslopeptr(hit_sector, sp->x, sp->y, &hiz, &loz);
// detect the ceiling and the hit_wall
if (sp->z < DIV2(hiz+loz))
{
if (!TEST(sector[hit_sector].ceilingstat, CEILING_STAT_SLOPE))
if (!TEST(hit_sector->ceilingstat, CEILING_STAT_SLOPE))
slope = 0;
else
slope = sector[hit_sector].ceilingheinum;
slope = hit_sector->ceilingheinum;
}
else
{
if (!TEST(sector[hit_sector].floorstat, FLOOR_STAT_SLOPE))
if (!TEST(hit_sector->floorstat, FLOOR_STAT_SLOPE))
slope = 0;
else
slope = sector[hit_sector].floorheinum;
slope = hit_sector->floorheinum;
}
if (!slope)
@ -8417,7 +8413,7 @@ bool SlopeBounce(DSWActor* actor, bool *hit_wall)
*hit_wall = false;
// get angle of the first wall of the sector
auto wallp = sector[hit_sector].firstWall();
auto wallp = hit_sector->firstWall();
daang = getangle(wallp->delta());
// k is now the slope of the ceiling or floor
@ -11223,7 +11219,7 @@ int DoFindGround(DSWActor* actor)
}
case kHitSector:
{
u->lo_sectp = &sector[florhit.index];
u->lo_sectp = florhit.sector();
u->lowActor = nullptr;
return true;
}
@ -11280,7 +11276,7 @@ int DoFindGroundPoint(DSWActor* actor)
}
case kHitSector:
{
u->lo_sectp = &sector[florhit.index];
u->lo_sectp = florhit.sector();
u->lowActor = nullptr;
return true;
}
@ -18246,7 +18242,7 @@ bool MissileHitDiveArea(DSWActor* actor)
if (u->coll.type == kHitSector)
{
short hit_sect = u->coll.index;
auto hit_sect = u->coll.sector();
if (SpriteInDiveArea(sp))
{
@ -18255,7 +18251,7 @@ bool MissileHitDiveArea(DSWActor* actor)
return false;
// Check added by Jim because of sprite bridge over water
if (sp->z < (sector[hit_sect].floorz-Z(20)))
if (sp->z < (hit_sect->floorz-Z(20)))
return false;
SET(u->Flags, SPR_UNDERWATER);
@ -18667,7 +18663,7 @@ int QueueFloorBlood(DSWActor* actor)
USER* u = actor->u();
SPRITEp hsp = &actor->s();
SPRITEp sp;
SECTORp sectp = &sector[hsp->sectnum];
SECTORp sectp = hsp->sector();
DSWActor* spawnedActor = nullptr;
@ -18677,10 +18673,10 @@ int QueueFloorBlood(DSWActor* actor)
if (TEST(u->Flags, SPR_UNDERWATER) || SpriteInUnderwaterArea(hsp) || SpriteInDiveArea(hsp))
return -1; // No blood underwater!
if (TEST(sector[hsp->sectnum].extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER)
if (TEST(hsp->sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER)
return -1; // No prints liquid areas!
if (TEST(sector[hsp->sectnum].extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA)
if (TEST(hsp->sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA)
return -1; // Not in lave either
if (TestDontStickSector(hsp->sectnum))
@ -18752,7 +18748,7 @@ int QueueFootPrint(DSWActor* actor)
USERp nu;
short rnd_num=0;
bool Found=false;
SECTORp sectp = &sector[hsp->sectnum];
SECTORp sectp = hsp->sector();
if (TEST(sectp->extra, SECTFX_SINK)||TEST(sectp->extra, SECTFX_CURRENT))
@ -18764,19 +18760,19 @@ int QueueFootPrint(DSWActor* actor)
Found = true;
// Stupid masked floor stuff! Damn your weirdness!
if (TEST(sector[u->PlayerP->cursectnum].ceilingstat, CEILING_STAT_PLAX))
if (TEST(u->PlayerP->cursector()->ceilingstat, CEILING_STAT_PLAX))
Found = true;
if (TEST(sector[u->PlayerP->cursectnum].floorstat, CEILING_STAT_PLAX))
if (TEST(u->PlayerP->cursector()->floorstat, CEILING_STAT_PLAX))
Found = true;
}
if (TEST(u->Flags, SPR_UNDERWATER) || SpriteInUnderwaterArea(hsp) || Found || SpriteInDiveArea(hsp))
return -1; // No prints underwater!
if (TEST(sector[hsp->sectnum].extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER)
if (TEST(hsp->sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_WATER)
return -1; // No prints liquid areas!
if (TEST(sector[hsp->sectnum].extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA)
if (TEST(hsp->sector()->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_LAVA)
return -1; // Not in lave either
if (TestDontStickSector(hsp->sectnum))