- remaining s() in object.cpp.

This commit is contained in:
Christoph Oelckers 2021-12-23 18:54:40 +01:00
parent 301350ef8c
commit d40da386a4

View file

@ -438,13 +438,12 @@ DExhumedActor* FindWallSprites(sectortype* pSector)
ExhumedSpriteIterator it; ExhumedSpriteIterator it;
while (auto actor = it.Next()) while (auto actor = it.Next())
{ {
auto spr = &actor->s(); if (actor->spr.lotag == 0)
if (spr->lotag == 0)
{ {
if ((spr->cstat & (CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_ONE_SIDE)) == (CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_ONE_SIDE)) if ((actor->spr.cstat & (CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_ONE_SIDE)) == (CSTAT_SPRITE_ALIGNMENT_WALL | CSTAT_SPRITE_ONE_SIDE))
{ {
int var_28 = spr->pos.X; int var_28 = actor->spr.pos.X;
int ebx = spr->pos.Y; int ebx = actor->spr.pos.Y;
if ((var_28 >= var_24) && (esi >= var_28) && (ebx >= ecx) && (ebx <= edi)) if ((var_28 >= var_24) && (esi >= var_28) && (ebx >= ecx) && (ebx <= edi))
{ {
@ -838,8 +837,7 @@ void AIElev::Tick(RunListEvent* ev)
SetQuake(pElevSpr, 30); SetQuake(pElevSpr, 30);
} }
auto sp = &pElevSpr->s(); PlayFXAtXYZ(StaticSound[kSound26], pElevSpr->spr.pos.X, pElevSpr->spr.pos.Y, pElevSpr->spr.pos.Z);
PlayFXAtXYZ(StaticSound[kSound26], sp->pos.X, sp->pos.Y, sp->pos.Z);
} }
if (var_18 & 0x4) if (var_18 & 0x4)
@ -1360,32 +1358,30 @@ DExhumedActor* BuildSpark(DExhumedActor* pActor, int nVal)
{ {
auto pSpark = insertActor(pActor->spr.sector(), 0); auto pSpark = insertActor(pActor->spr.sector(), 0);
auto spr = &pSpark->s(); pSpark->spr.pos.X = pActor->spr.pos.X;
pSpark->spr.pos.Y = pActor->spr.pos.Y;
spr->pos.X = pActor->spr.pos.X; pSpark->spr.cstat = 0;
spr->pos.Y = pActor->spr.pos.Y; pSpark->spr.shade = -127;
spr->cstat = 0; pSpark->spr.pal = 1;
spr->shade = -127; pSpark->spr.xoffset = 0;
spr->pal = 1; pSpark->spr.yoffset = 0;
spr->xoffset = 0; pSpark->spr.xrepeat = 50;
spr->yoffset = 0; pSpark->spr.yrepeat = 50;
spr->xrepeat = 50;
spr->yrepeat = 50;
if (nVal >= 2) if (nVal >= 2)
{ {
spr->picnum = kEnergy2; pSpark->spr.picnum = kEnergy2;
nSmokeSparks++; nSmokeSparks++;
if (nVal == 3) if (nVal == 3)
{ {
spr->xrepeat = 120; pSpark->spr.xrepeat = 120;
spr->yrepeat = 120; pSpark->spr.yrepeat = 120;
} }
else else
{ {
spr->xrepeat = pActor->spr.xrepeat + 15; pSpark->spr.xrepeat = pActor->spr.xrepeat + 15;
spr->yrepeat = pActor->spr.xrepeat + 15; pSpark->spr.yrepeat = pActor->spr.xrepeat + 15;
} }
} }
else else
@ -1394,30 +1390,30 @@ DExhumedActor* BuildSpark(DExhumedActor* pActor, int nVal)
if (nVal) if (nVal)
{ {
spr->xvel = bcos(nAngle, -5); pSpark->spr.xvel = bcos(nAngle, -5);
spr->yvel = bsin(nAngle, -5); pSpark->spr.yvel = bsin(nAngle, -5);
} }
else else
{ {
spr->xvel = bcos(nAngle, -6); pSpark->spr.xvel = bcos(nAngle, -6);
spr->yvel = bsin(nAngle, -6); pSpark->spr.yvel = bsin(nAngle, -6);
} }
spr->zvel = -(RandomSize(4) << 7); pSpark->spr.zvel = -(RandomSize(4) << 7);
spr->picnum = kTile985 + nVal; pSpark->spr.picnum = kTile985 + nVal;
} }
spr->pos.Z = pActor->spr.pos.Z; pSpark->spr.pos.Z = pActor->spr.pos.Z;
spr->lotag = runlist_HeadRun() + 1; pSpark->spr.lotag = runlist_HeadRun() + 1;
spr->clipdist = 1; pSpark->spr.clipdist = 1;
spr->hitag = 0; pSpark->spr.hitag = 0;
spr->backuppos(); pSpark->spr.backuppos();
// GrabTimeSlot(3); // GrabTimeSlot(3);
spr->extra = -1; pSpark->spr.extra = -1;
spr->owner = runlist_AddRunRec(spr->lotag - 1, pSpark, 0x260000); pSpark->spr.owner = runlist_AddRunRec(pSpark->spr.lotag - 1, pSpark, 0x260000);
spr->hitag = runlist_AddRunRec(NewRun, pSpark, 0x260000); pSpark->spr.hitag = runlist_AddRunRec(NewRun, pSpark, 0x260000);
return pSpark; return pSpark;
} }
@ -1581,33 +1577,32 @@ DExhumedActor* BuildEnergyBlock(sectortype* pSector)
int yAvg = y / pSector->wallnum; int yAvg = y / pSector->wallnum;
auto pActor = insertActor(pSector, 406); auto pActor = insertActor(pSector, 406);
auto spr = &pActor->s();
spr->pos.X = xAvg; pActor->spr.pos.X = xAvg;
spr->pos.Y = yAvg; pActor->spr.pos.Y = yAvg;
pSector->extra = (int16_t)EnergyBlocks.Push(pActor); pSector->extra = (int16_t)EnergyBlocks.Push(pActor);
// GrabTimeSlot(3); // GrabTimeSlot(3);
spr->pos.Z = pSector->firstWall()->nextSector()->floorz; pActor->spr.pos.Z = pSector->firstWall()->nextSector()->floorz;
// CHECKME - name of this variable? // CHECKME - name of this variable?
int nRepeat = (spr->pos.Z - pSector->floorz) >> 8; int nRepeat = (pActor->spr.pos.Z - pSector->floorz) >> 8;
if (nRepeat > 255) { if (nRepeat > 255) {
nRepeat = 255; nRepeat = 255;
} }
spr->xrepeat = nRepeat; pActor->spr.xrepeat = nRepeat;
spr->cstat = CSTAT_SPRITE_INVISIBLE; pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
spr->xvel = 0; pActor->spr.xvel = 0;
spr->yvel = 0; pActor->spr.yvel = 0;
spr->zvel = 0; pActor->spr.zvel = 0;
spr->extra = -1; pActor->spr.extra = -1;
spr->lotag = runlist_HeadRun() + 1; pActor->spr.lotag = runlist_HeadRun() + 1;
spr->hitag = 0; pActor->spr.hitag = 0;
spr->owner = runlist_AddRunRec(spr->lotag - 1, pActor, 0x250000); pActor->spr.owner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x250000);
spr->backuppos(); pActor->spr.backuppos();
return pActor; return pActor;
} }
@ -1737,31 +1732,29 @@ void AIEnergyBlock::Damage(RunListEvent* ev)
{ {
auto pActor = ev->pObjActor; auto pActor = ev->pObjActor;
if (!pActor) return; if (!pActor) return;
auto spr = &pActor->s();
ev->nDamage >>= 2; ev->nDamage >>= 2;
if (ev->nDamage <= 0) { if (ev->nDamage <= 0) {
return; return;
} }
if (ev->nDamage < spr->xrepeat) if (ev->nDamage < pActor->spr.xrepeat)
{ {
spr->xrepeat -= ev->nDamage; pActor->spr.xrepeat -= ev->nDamage;
auto pActor2 = insertActor(lasthitsect, 0); auto pActor2 = insertActor(lasthitsect, 0);
auto pSprite2 = &pActor2->s();
pSprite2->ang = ev->nParam; pActor2->spr.ang = ev->nParam;
pSprite2->pos.X = lasthitx; pActor2->spr.pos.X = lasthitx;
pSprite2->pos.Y = lasthity; pActor2->spr.pos.Y = lasthity;
pSprite2->pos.Z = lasthitz; pActor2->spr.pos.Z = lasthitz;
BuildSpark(pActor2, 0); // shoot out blue orb when damaged BuildSpark(pActor2, 0); // shoot out blue orb when damaged
DeleteActor(pActor2); DeleteActor(pActor2);
} }
else else
{ {
spr->xrepeat = 0; // using xrepeat to store health pActor->spr.xrepeat = 0; // using xrepeat to store health
ExplodeEnergyBlock(pActor); ExplodeEnergyBlock(pActor);
} }
} }
@ -1770,9 +1763,8 @@ void AIEnergyBlock::RadialDamage(RunListEvent* ev)
{ {
auto pActor = ev->pObjActor; auto pActor = ev->pObjActor;
if (!pActor) return; if (!pActor) return;
auto spr = &pActor->s();
auto pSector =spr->sector(); auto pSector =pActor->spr.sector();
if (pSector->extra == -1) { if (pSector->extra == -1) {
return; return;
@ -1780,14 +1772,14 @@ void AIEnergyBlock::RadialDamage(RunListEvent* ev)
int nFloorZ = pSector->floorz; int nFloorZ = pSector->floorz;
pSector->floorz = spr->pos.Z; pSector->floorz = pActor->spr.pos.Z;
spr->pos.Z -= 256; pActor->spr.pos.Z -= 256;
ev->nDamage = runlist_CheckRadialDamage(pActor); ev->nDamage = runlist_CheckRadialDamage(pActor);
// restore previous values // restore previous values
pSector->floorz = nFloorZ; pSector->floorz = nFloorZ;
spr->pos.Z += 256; pActor->spr.pos.Z += 256;
if (ev->nDamage <= 0) { if (ev->nDamage <= 0) {
return; return;
@ -1800,23 +1792,21 @@ void AIEnergyBlock::RadialDamage(RunListEvent* ev)
DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag) DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag)
{ {
auto spr = &pActor->s();
ChangeActorStat(pActor, ObjectStatnum[nOjectType]); ChangeActorStat(pActor, ObjectStatnum[nOjectType]);
// 0x7FFD to ensure set as blocking ('B' and 'H') sprite and also disable translucency and set not invisible // 0x7FFD to ensure set as blocking ('B' and 'H') sprite and also disable translucency and set not invisible
spr->cstat = (spr->cstat | CSTAT_SPRITE_BLOCK_ALL) & ~(CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_INVISIBLE); pActor->spr.cstat = (pActor->spr.cstat | CSTAT_SPRITE_BLOCK_ALL) & ~(CSTAT_SPRITE_TRANSLUCENT | CSTAT_SPRITE_INVISIBLE);
spr->xvel = 0; pActor->spr.xvel = 0;
spr->yvel = 0; pActor->spr.yvel = 0;
spr->zvel = 0; pActor->spr.zvel = 0;
spr->extra = -1; pActor->spr.extra = -1;
spr->lotag = runlist_HeadRun() + 1; pActor->spr.lotag = runlist_HeadRun() + 1;
spr->hitag = 0; pActor->spr.hitag = 0;
spr->owner = runlist_AddRunRec(spr->lotag - 1, pActor, 0x170000); pActor->spr.owner = runlist_AddRunRec(pActor->spr.lotag - 1, pActor, 0x170000);
// GrabTimeSlot(3); // GrabTimeSlot(3);
pActor->nPhase = ObjectList.Push(pActor); pActor->nPhase = ObjectList.Push(pActor);
if (spr->statnum == kStatDestructibleSprite) { if (pActor->spr.statnum == kStatDestructibleSprite) {
pActor->nHealth = 4; pActor->nHealth = 4;
} }
else { else {
@ -1836,29 +1826,28 @@ DExhumedActor* BuildObject(DExhumedActor* pActor, int nOjectType, int nHitag)
pActor->nFrame = RandomSize(4) % (SeqSize[pActor->nIndex] - 1); pActor->nFrame = RandomSize(4) % (SeqSize[pActor->nIndex] - 1);
} }
auto pActor2 = insertActor(spr->sector(), 0); auto pActor2 = insertActor(pActor->spr.sector(), 0);
auto pSprite2 = &pActor2->s();
pActor->pTarget = pActor2; pActor->pTarget = pActor2;
pActor->nIndex2 = -1; pActor->nIndex2 = -1;
pSprite2->cstat = CSTAT_SPRITE_INVISIBLE; pActor2->spr.cstat = CSTAT_SPRITE_INVISIBLE;
pSprite2->pos.X = spr->pos.X; pActor2->spr.pos.X = pActor->spr.pos.X;
pSprite2->pos.Y = spr->pos.Y; pActor2->spr.pos.Y = pActor->spr.pos.Y;
pSprite2->pos.Z = spr->pos.Z; pActor2->spr.pos.Z = pActor->spr.pos.Z;
} }
else else
{ {
pActor->nFrame = 0; pActor->nFrame = 0;
pActor->nIndex = -1; pActor->nIndex = -1;
if (spr->statnum == kStatDestructibleSprite) { if (pActor->spr.statnum == kStatDestructibleSprite) {
pActor->nIndex2 = -1; pActor->nIndex2 = -1;
} }
else { else {
pActor->nIndex2 = -nHitag; pActor->nIndex2 = -nHitag;
} }
} }
spr->backuppos(); pActor->spr.backuppos();
return pActor; return pActor;
} }
@ -1981,12 +1970,8 @@ void AIObject::Tick(RunListEvent* ev)
StartRegenerate(pActor); StartRegenerate(pActor);
pActor->nHealth = 120; pActor->nHealth = 120;
auto pTargSpr = &pActor->pTarget->s(); pActor->spr.pos = pActor->pTarget->spr.pos;
pActor->spr.pos.X = pTargSpr->pos.X; ChangeActorSect(pActor, pActor->pTarget->spr.sector());
pActor->spr.pos.Y = pTargSpr->pos.Y;
pActor->spr.pos.Z = pTargSpr->pos.Z;
ChangeActorSect(pActor, pTargSpr->sector());
return; return;
} }
} }
@ -2560,11 +2545,10 @@ void PostProcess()
ExhumedSpriteIterator it; ExhumedSpriteIterator it;
while (auto act = it.Next()) while (auto act = it.Next())
{ {
auto spr = &act->s(); if (act->spr.statnum < kMaxStatus && act->spr.picnum == kTile3603)
if (spr->statnum < kMaxStatus && spr->picnum == kTile3603)
{ {
ChangeActorStat(act, 407); ChangeActorStat(act, 407);
spr->pal = 1; act->spr.pal = 1;
} }
} }
} }