- moved sectno method to DCoreActor.

This commit is contained in:
Christoph Oelckers 2021-12-30 16:39:43 +01:00
parent f0b7fe4add
commit 88e4bb9f79
10 changed files with 17 additions and 16 deletions

View file

@ -58,6 +58,12 @@ public:
spr.sectp = sect;
}
int sectno() const
{
return spr.sectp ? ::sector.IndexOf(spr.sectp) : -1;
}
};
// holds pointers to the game-side actors.

View file

@ -629,11 +629,6 @@ inline sectortype* spritetypebase::sector() const
return sectp;
}
inline int spritetypebase::sectno() const
{
return sectp? ::sector.IndexOf(sectp) : -1;
}
inline sectortype* walltype::nextSector() const
{
return !validSectorIndex(nextsector)? nullptr : &::sector[nextsector];

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->spr.sectno();
vp.SectCount = camera->sectno();
vp.Pos.X = npos.X;
vp.Pos.Y = npos.Y;

View file

@ -158,7 +158,7 @@ inline void GetActorExtents(DBloodActor* actor, int* top, int* bottom)
inline bool CheckSector(const BitArray& bits, DBloodActor* act)
{
return bits[act->spr.sectno()];
return bits[act->sectno()];
}
inline bool IsTargetTeammate(DBloodActor* pSource, DBloodActor* pTarget)

View file

@ -722,7 +722,7 @@ void viewDrawScreen(bool sceneonly)
BloodStatIterator it(kStatExplosion);
while (auto actor = it.Next())
{
if (actor->hasX() && gotsector[actor->spr.sectno()])
if (actor->hasX() && gotsector[actor->sectno()])
{
brightness += actor->xspr.data3 * 32;
}
@ -735,7 +735,7 @@ void viewDrawScreen(bool sceneonly)
case kMissileTeslaAlt:
case kMissileFlareAlt:
case kMissileTeslaRegular:
if (gotsector[actor->spr.sectno()]) brightness += 256;
if (gotsector[actor->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->spr.sectno();
iSector = sActor->sectno();
}
else
{
@ -1232,7 +1232,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, act->spr.sectno(), sActor, sPlayer);
else*/ SetGameVarID(lVar2, act->sectno(), sActor, sPlayer);
break;
case ACTOR_STATNUM:
if (!bSet) /*changespritestat(iActor, lValue);

View file

@ -855,7 +855,7 @@ static void SpawnPortals()
{
if (p.type == PORTAL_SECTOR_FLOOR && p.dz == act->spr.hitag)
{
p.targets.Push(act2->spr.sectno());
p.targets.Push(act2->sectno());
}
}
}
@ -868,7 +868,7 @@ static void SpawnPortals()
{
if (p.type == PORTAL_SECTOR_CEILING && p.dz == act->spr.hitag)
{
p.targets.Push(act->spr.sectno());
p.targets.Push(act->sectno());
}
}
}

View file

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

View file

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

View file

@ -119,7 +119,7 @@ void FAF_DrawRooms(int x, int y, int z, fixed_t q16ang, fixed_t q16horiz, int se
while (auto actor = it.Next())
{
// manually set gotpic
if (gotsector[actor->spr.sectno()])
if (gotsector[actor->sectno()])
{
gotpic.Set(FAF_MIRROR_PIC);
}