- Exhumed: use the sprite's sector() member where possible.

This commit is contained in:
Christoph Oelckers 2021-11-09 00:24:04 +01:00
parent ef241acda2
commit 366df9d4b6
16 changed files with 41 additions and 41 deletions

View file

@ -58,7 +58,7 @@ void BuildAnubis(DExhumedActor* ap, int x, int y, int z, int nSector, int nAngle
x = sp->x;
y = sp->y;
z = sector[sp->sectnum].floorz;
z = sp->sector()->floorz;
nAngle = sp->ang;
}
@ -70,7 +70,7 @@ void BuildAnubis(DExhumedActor* ap, int x, int y, int z, int nSector, int nAngle
sp->shade = -12;
sp->yoffset = 0;
sp->picnum = 1;
sp->pal = sector[sp->sectnum].ceilingpal;
sp->pal = sp->sector()->ceilingpal;
sp->clipdist = 60;
sp->ang = nAngle;
sp->xrepeat = 40;
@ -430,7 +430,7 @@ void AIAnubis::Damage(RunListEvent* ev)
sp->xvel = 0;
sp->yvel = 0;
sp->zvel = 0;
sp->z = sector[sp->sectnum].floorz;
sp->z = sp->sector()->floorz;
sp->cstat &= 0xFEFE;
ap->nHealth = 0;

View file

@ -105,7 +105,7 @@ void AIFishLimb::Tick(RunListEvent* ev)
}
}
int FloorZ = sector[pSprite->sectnum].floorz;
int FloorZ = pSprite->sector()->floorz;
if (FloorZ <= pSprite->z)
{
@ -172,7 +172,7 @@ void BuildFish(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAng
pSprite->clipdist = 80;
pSprite->xrepeat = 40;
pSprite->yrepeat = 40;
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
pSprite->pal = pSprite->sector()->ceilingpal;
pSprite->xoffset = 0;
pSprite->yoffset = 0;
pSprite->picnum = seq_GetSeqPicnum(kSeqFish, FishSeq[0].a, 0);

View file

@ -55,7 +55,7 @@ void BuildLion(DExhumedActor* pActor, int x, int y, int z, short nSector, short
pSprite = &pActor->s();
x = pSprite->x;
y = pSprite->y;
z = sector[pSprite->sectnum].floorz;
z = pSprite->sector()->floorz;
nAngle = pSprite->ang;
}
@ -68,7 +68,7 @@ void BuildLion(DExhumedActor* pActor, int x, int y, int z, short nSector, short
pSprite->xrepeat = 40;
pSprite->yrepeat = 40;
pSprite->picnum = 1;
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
pSprite->pal = pSprite->sector()->ceilingpal;
pSprite->xoffset = 0;
pSprite->yoffset = 0;
pSprite->ang = nAngle;

View file

@ -370,7 +370,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
}
// loc_151E7:
while (ebp > sector[pSprite->sectnum].floorz && SectBelow[pSprite->sectnum] >= 0)
while (ebp > pSprite->sector()->floorz && SectBelow[pSprite->sectnum] >= 0)
{
edi = SectBelow[pSprite->sectnum];
@ -394,7 +394,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
}
else
{
while ((ebp < sector[pSprite->sectnum].ceilingz) && (SectAbove[pSprite->sectnum] >= 0))
while ((ebp < pSprite->sector()->ceilingz) && (SectAbove[pSprite->sectnum] >= 0))
{
edi = SectAbove[pSprite->sectnum];
@ -603,7 +603,7 @@ Collision movesprite(DExhumedActor* pActor, int dx, int dy, int dz, int ceildist
if (pSprite->pal < 5 && !pSprite->hitag)
{
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
pSprite->pal = pSprite->sector()->ceilingpal;
}
}
}

View file

@ -67,7 +67,7 @@ void BuildMummy(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAn
pSprite->zvel = 0;
pSprite->xrepeat = 42;
pSprite->yrepeat = 42;
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
pSprite->pal = pSprite->sector()->ceilingpal;
pSprite->xoffset = 0;
pSprite->yoffset = 0;
pSprite->ang = nAngle;
@ -458,7 +458,7 @@ void AIMummy::Damage(RunListEvent* ev)
pSprite->xvel = 0;
pSprite->yvel = 0;
pSprite->zvel = 0;
pSprite->z = sector[pSprite->sectnum].floorz;
pSprite->z = pSprite->sector()->floorz;
}
else
{

View file

@ -2030,7 +2030,7 @@ void AIObject::Tick(RunListEvent* ev)
int var_18;
// red branch
if ((nStat == kStatExplodeTarget) || (pSprite->z < sector[pSprite->sectnum].floorz))
if ((nStat == kStatExplodeTarget) || (pSprite->z < pSprite->sector()->floorz))
{
var_18 = 36;
}
@ -2040,7 +2040,7 @@ void AIObject::Tick(RunListEvent* ev)
}
AddFlash(pSprite->sectnum, pSprite->x, pSprite->y, pSprite->z, 128);
BuildAnim(nullptr, var_18, 0, pSprite->x, pSprite->y, sector[pSprite->sectnum].floorz, pSprite->sectnum, 240, 4);
BuildAnim(nullptr, var_18, 0, pSprite->x, pSprite->y, pSprite->sector()->floorz, pSprite->sectnum, 240, 4);
// int edi = nSprite | 0x4000;

View file

@ -440,7 +440,7 @@ void StartDeathSeq(int nPlayer, int nVal)
auto pSprite = &pActor->s();
PlayerList[nPlayer].nHealth = 0;
short nLotag = sector[pSprite->sectnum].lotag;
short nLotag = pSprite->sector()->lotag;
if (nLotag > 0) {
runlist_SignalRun(nLotag - 1, nPlayer, &ExhumedAI::EnterSector);
@ -902,7 +902,7 @@ void AIPlayer::Tick(RunListEvent* ev)
vec3_t pos = { pPlayerSprite->x, pPlayerSprite->y, pPlayerSprite->z };
setActorPos(pPlayerActor, &pos);
pPlayerSprite->z = sector[pPlayerSprite->sectnum].floorz;
pPlayerSprite->z = pPlayerSprite->sector()->floorz;
}
else
{
@ -1298,7 +1298,7 @@ sectdone:
ChangeActorSect(pFloorActor, pPlayerSprite->sectnum);
}
pFloorSprite->z = sector[pPlayerSprite->sectnum].floorz;
pFloorSprite->z = pPlayerSprite->sector()->floorz;
}
int var_30 = 0;
@ -2240,9 +2240,9 @@ sectdone:
// CORRECT ? // loc_1BAF9:
if (bTouchFloor)
{
if (sector[pPlayerSprite->sectnum].lotag > 0)
if (pPlayerSprite->sector()->lotag > 0)
{
runlist_SignalRun(sector[pPlayerSprite->sectnum].lotag - 1, nPlayer, &ExhumedAI::TouchFloor);
runlist_SignalRun(pPlayerSprite->sector()->lotag - 1, nPlayer, &ExhumedAI::TouchFloor);
}
}
@ -2253,9 +2253,9 @@ sectdone:
runlist_SignalRun(sector[nSector].lotag - 1, nPlayer, &ExhumedAI::EnterSector);
}
if (sector[pPlayerSprite->sectnum].lotag > 0)
if (pPlayerSprite->sector()->lotag > 0)
{
runlist_SignalRun(sector[pPlayerSprite->sectnum].lotag - 1, nPlayer, &ExhumedAI::LeaveSector);
runlist_SignalRun(pPlayerSprite->sector()->lotag - 1, nPlayer, &ExhumedAI::LeaveSector);
}
}
@ -2289,7 +2289,7 @@ sectdone:
// loc_1BC57:
// CHECKME - are we finished with 'nSector' variable at this point? if so, maybe set it to pPlayerSprite->sectnum so we can make this code a bit neater. Don't assume pPlayerSprite->sectnum == nSector here!!
if (nStandHeight > (sector[pPlayerSprite->sectnum].floorz - sector[pPlayerSprite->sectnum].ceilingz)) {
if (nStandHeight > (pPlayerSprite->sector()->floorz - pPlayerSprite->sector()->ceilingz)) {
var_48 = 1;
}
@ -2487,7 +2487,7 @@ sectdone:
{
pPlayerSprite->picnum = seq_GetSeqPicnum(kSeqJoe, 120, 0);
pPlayerSprite->cstat = 0;
pPlayerSprite->z = sector[pPlayerSprite->sectnum].floorz;
pPlayerSprite->z = pPlayerSprite->sector()->floorz;
}
// will invalidate nPlayerSprite
@ -2535,7 +2535,7 @@ sectdone:
case 16:
PlayerList[nPlayer].field_2 = SeqSize[var_AC] - 1;
if (pPlayerSprite->z < sector[pPlayerSprite->sectnum].floorz) {
if (pPlayerSprite->z < pPlayerSprite->sector()->floorz) {
pPlayerSprite->z += 256;
}

View file

@ -1123,7 +1123,7 @@ void BuildQueen(DExhumedActor* pActor, int x, int y, int z, int nSector, int nAn
pSprite = &pActor->s();
x = pSprite->x;
y = pSprite->y;
z = sector[pSprite->sectnum].floorz;
z = pSprite->sector()->floorz;
nAngle = pSprite->ang;
}

View file

@ -97,7 +97,7 @@ void BuildRat(DExhumedActor* pActor, int x, int y, int z, short nSector, int nAn
pSprite->xoffset = 0;
pSprite->yoffset = 0;
pSprite->picnum = 1;
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
pSprite->pal = pSprite->sector()->ceilingpal;
pSprite->clipdist = 30;
pSprite->ang = nAngle;
pSprite->xrepeat = 50;

View file

@ -50,7 +50,7 @@ void BuildRex(DExhumedActor* pActor, int x, int y, int z, short nSector, short n
pSprite = &pActor->s();
x = pSprite->x;
y = pSprite->y;
z = sector[pSprite->sectnum].floorz;
z = pSprite->sector()->floorz;
nAngle = pSprite->ang;
ChangeActorStat(pActor, 119);
@ -65,7 +65,7 @@ void BuildRex(DExhumedActor* pActor, int x, int y, int z, short nSector, short n
pSprite->xrepeat = 64;
pSprite->yrepeat = 64;
pSprite->picnum = 1;
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
pSprite->pal = pSprite->sector()->ceilingpal;
pSprite->xoffset = 0;
pSprite->yoffset = 0;
pSprite->ang = nAngle;

View file

@ -61,7 +61,7 @@ void BuildRoach(int nType, DExhumedActor* pActor, int x, int y, int z, short nSe
pSprite = &pActor->s();
x = pSprite->x;
y = pSprite->y;
z = sector[pSprite->sectnum].floorz;
z = pSprite->sector()->floorz;
angle = pSprite->ang;
}
@ -73,7 +73,7 @@ void BuildRoach(int nType, DExhumedActor* pActor, int x, int y, int z, short nSe
pSprite->xoffset = 0;
pSprite->yoffset = 0;
pSprite->picnum = 1;
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
pSprite->pal = pSprite->sector()->ceilingpal;
pSprite->clipdist = 60;
pSprite->ang = angle;
pSprite->xrepeat = 40;

View file

@ -54,7 +54,7 @@ void BuildScorp(DExhumedActor* pActor, int x, int y, int z, short nSector, short
pSprite = &pActor->s();
x = pSprite->x;
y = pSprite->y;
z = sector[pSprite->sectnum].floorz;
z = pSprite->sector()->floorz;
nAngle = pSprite->ang;
}
@ -67,7 +67,7 @@ void BuildScorp(DExhumedActor* pActor, int x, int y, int z, short nSector, short
pSprite->xrepeat = 80;
pSprite->yrepeat = 80;
pSprite->picnum = 1;
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
pSprite->pal = pSprite->sector()->ceilingpal;
pSprite->xoffset = 0;
pSprite->yoffset = 0;
pSprite->ang = nAngle;

View file

@ -53,7 +53,7 @@ void BuildSet(DExhumedActor* pActor, int x, int y, int z, short nSector, short n
pSprite = &pActor->s();
x = pSprite->x;
y = pSprite->y;
z = sector[pSprite->sectnum].floorz;
z = pSprite->sector()->floorz;
nAngle = pSprite->ang;
}
@ -68,7 +68,7 @@ void BuildSet(DExhumedActor* pActor, int x, int y, int z, short nSector, short n
pSprite->zvel = 0;
pSprite->xrepeat = 87;
pSprite->yrepeat = 96;
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
pSprite->pal = pSprite->sector()->ceilingpal;
pSprite->xoffset = 0;
pSprite->yoffset = 0;
pSprite->ang = nAngle;

View file

@ -51,7 +51,7 @@ DExhumedActor* BuildSpider(DExhumedActor* spp, int x, int y, int z, short nSecto
x = sp->x;
y = sp->y;
z = sector[sp->sectnum].floorz;
z = sp->sector()->floorz;
nAngle = sp->ang;
}
@ -66,7 +66,7 @@ DExhumedActor* BuildSpider(DExhumedActor* spp, int x, int y, int z, short nSecto
sp->zvel = 0;
sp->xrepeat = 40;
sp->yrepeat = 40;
sp->pal = sector[sp->sectnum].ceilingpal;
sp->pal = sp->sector()->ceilingpal;
sp->xoffset = 0;
sp->yoffset = 0;
sp->ang = nAngle;
@ -106,7 +106,7 @@ void AISpider::Tick(RunListEvent* ev)
{
if (sp->cstat & 8)
{
sp->z = sector[sp->sectnum].ceilingz + GetActorHeight(spp);
sp->z = sp->sector()->ceilingz + GetActorHeight(spp);
}
else
{
@ -291,10 +291,10 @@ void AISpider::Tick(RunListEvent* ev)
if (nMov.exbits & kHitAux1
&& sp->zvel < 0
&& hiHit.type != kHitSprite
&& !((sector[sp->sectnum].ceilingstat) & 1))
&& !((sp->sector()->ceilingstat) & 1))
{
sp->cstat |= 8;
sp->z = GetActorHeight(spp) + sector[sp->sectnum].ceilingz;
sp->z = GetActorHeight(spp) + sp->sector()->ceilingz;
sp->zvel = 0;
spp->nAction = 1;

View file

@ -291,7 +291,7 @@ void DrawView(double smoothRatio, bool sceneonly)
else
{
viewz = playerZ + nQuake[nLocalPlayer];
int floorZ = sector[pPlayerSprite->sectnum].floorz;
int floorZ = pPlayerSprite->sector()->floorz;
if (viewz > floorZ)
viewz = floorZ;

View file

@ -61,7 +61,7 @@ DExhumedActor* BuildWasp(DExhumedActor* pActor, int x, int y, int z, short nSect
pSprite->shade = -12;
pSprite->cstat = 0x101;
pSprite->pal = sector[pSprite->sectnum].ceilingpal;
pSprite->pal = pSprite->sector()->ceilingpal;
pSprite->clipdist = 70;
if (bEggWasp)