- use sectno() access function where we really need a sector index.

This commit is contained in:
Christoph Oelckers 2021-12-06 17:25:40 +01:00
parent 2d913982da
commit 6a43a270fa
11 changed files with 14 additions and 14 deletions

View file

@ -677,7 +677,7 @@ bool HWLineToSpritePortal::Setup(HWDrawInfo* di, FRenderState& rstate, Clipper*
int origy = vp.Pos.Y * -16;
vp.SectNums = nullptr;
vp.SectCount = camera->sectnum;
vp.SectCount = camera->sectno();
vp.Pos.X = npos.X;
vp.Pos.Y = npos.Y;

View file

@ -35,7 +35,7 @@ void collectTSpritesForPortal(int x, int y, int i, int interpolation)
tspritetype* pTSprite = &pm_tsprite[pm_spritesortcnt++];
*pTSprite = {};
pTSprite->type = pSprite->type;
pTSprite->sectnum = nSector2;
pTSprite->setsector(nSector2);
pTSprite->x = pSprite->x + dx;
pTSprite->y = pSprite->y + dy;
pTSprite->z = pSprite->z + dz;

View file

@ -53,7 +53,7 @@ int picHeight(int nPic, int repeat);
inline bool CheckSector(const BitArray& bits, spritetype* spr)
{
return bits[spr->sectnum];
return bits[spr->sectno()];
}

View file

@ -120,8 +120,8 @@ void InitMirrors(void)
if (link2 == nullptr)
continue;
int j = link2->s().sectnum;
auto sectj = link2->s().sector();
int j = sectnum(sectj);
if (sectj->ceilingpicnum != 504)
I_Error("Lower link sector %d doesn't have mirror picnum\n", j);
mirror[mirrorcnt].type = 2;

View file

@ -621,7 +621,7 @@ void viewDrawScreen(bool sceneonly)
BloodStatIterator it(kStatExplosion);
while (auto actor = it.Next())
{
if (actor->hasX() && gotsector[actor->s().sectnum])
if (actor->hasX() && gotsector[actor->s().sectno()])
{
brightness += actor->x().data3 * 32;
}
@ -635,7 +635,7 @@ void viewDrawScreen(bool sceneonly)
case kMissileTeslaAlt:
case kMissileFlareAlt:
case kMissileTeslaRegular:
if (gotsector[pSprite->sectnum]) brightness += 256;
if (gotsector[pSprite->sectno()]) brightness += 256;
break;
}
}

View file

@ -1041,7 +1041,7 @@ void DoSector(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
if (lVar1 == g_iThisActorID)
{
// if they've asked for 'this', then use 'this'...
iSector = sActor->s->sectnum;
iSector = sActor->s->sectno();
}
else
{
@ -1234,7 +1234,7 @@ void DoActor(bool bSet, int lVar1, int lLabelID, int lVar2, DDukeActor* sActor,
break;
case ACTOR_SECTNUM: // made read only because this is not safe.
if (!bSet) /*changespritesect(iActor, lValue);
else*/ SetGameVarID(lVar2, spr->sectnum, sActor, sPlayer);
else*/ SetGameVarID(lVar2, spr->sectno(), sActor, sPlayer);
break;
case ACTOR_STATNUM:
if (!bSet) /*changespritestat(iActor, lValue);

View file

@ -860,7 +860,7 @@ static void SpawnPortals()
{
if (p.type == PORTAL_SECTOR_FLOOR && p.dz == spr->hitag)
{
p.targets.Push(spr2->sectnum);
p.targets.Push(spr2->sectno());
}
}
}
@ -873,7 +873,7 @@ static void SpawnPortals()
{
if (p.type == PORTAL_SECTOR_CEILING && p.dz == spr->hitag)
{
p.targets.Push(spr->sectnum);
p.targets.Push(spr->sectno());
}
}
}

View file

@ -510,7 +510,7 @@ void prelevel_r(int g, TArray<DDukeActor*>& actors)
{
auto spr = act->s;
if (spr->picnum == RRTILE66)
if (spr->lotag == sj->sectnum)
if (spr->lotag == sj->sectno()) // bad map format design... Should have used a tag instead...
{
childsectnum = spr->sector();
deletesprite(act);

View file

@ -122,7 +122,7 @@ DDukeActor* EGS(sectortype* whatsectp, int s_x, int s_y, int s_z, int s_pn, int8
s->hitag = 0;
}
if (show2dsector[s->sectnum]) act->s->cstat2 |= CSTAT2_SPRITE_MAPPED;
if (show2dsector[s->sectno()]) act->s->cstat2 |= CSTAT2_SPRITE_MAPPED;
else act->s->cstat2 &= ~CSTAT2_SPRITE_MAPPED;
act->sx() = {};

View file

@ -2290,7 +2290,7 @@ sectdone:
// loc_1BC57:
// CHECKME - are we finished with 'nSector' variable at this point? if so, maybe set it to pPlayerSprite->sector() so we can make this code a bit neater. Don't assume pPlayerSprite->sectnum == nSector here!!
// CHECKME - are we finished with 'nSector' variable at this point? if so, maybe set it to pPlayerSprite->sector so we can make this code a bit neater. Don't assume pPlayerSprite->sector == nSector here!!
if (nStandHeight > (pPlayerSprite->sector()->floorz - pPlayerSprite->sector()->ceilingz)) {
var_48 = 1;
}

View file

@ -123,7 +123,7 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, int se
{
auto sp = &actor->s();
// manually set gotpic
if (gotsector[sp->sectnum])
if (gotsector[sp->sectno()])
{
setgotpic(FAF_MIRROR_PIC);
}