- Exhumed: third batch of refactoring writes to spr.pos.

This commit is contained in:
Christoph Oelckers 2022-01-31 20:03:22 +01:00
parent 24101f8e92
commit 255e12872c
3 changed files with 31 additions and 45 deletions

View file

@ -294,7 +294,7 @@ int BelowNear(DExhumedActor* pActor, int x, int y, int walldist)
if (z2 < pActor->spr.pos.Z)
{
pActor->spr.pos.Z = z2;
pActor->set_int_z(z2);
overridesect = pSector;
pActor->spr.zvel = 0;
@ -348,7 +348,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
if (pSect2 != pSector)
{
pActor->spr.pos.Z = ebp;
pActor->set_int_z(ebp);
if (pSect2->Flag & kSectUnderwater)
{
@ -446,7 +446,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
// loc_1543B:
ebp = mySprfloor;
pActor->spr.pos.Z = mySprfloor;
pActor->set_int_z(mySprfloor);
}
else
{
@ -466,7 +466,7 @@ Collision movespritez(DExhumedActor* pActor, int z, int height, int, int clipdis
}
pActor->spr.cstat = cstat; // restore cstat
pActor->spr.pos.Z = ebp;
pActor->set_int_z(ebp);
if (pActor->spr.statnum == 100)
{
@ -538,7 +538,9 @@ Collision movesprite(DExhumedActor* pActor, int dx, int dy, int dz, int ceildist
}
Collision coll;
clipmove(pActor->spr.pos, &pSector, dx, dy, nClipDist, nSpriteHeight, flordist, clipmask, coll);
auto pos = pActor->spr.pos;
clipmove(pos, &pSector, dx, dy, nClipDist, nSpriteHeight, flordist, clipmask, coll);
pActor->set_int_pos(pos);
if (coll.type != kHitNone) // originally this or'ed the two values which can create unpredictable bad values in some edge cases.
{
coll.exbits = nRet.exbits;
@ -553,8 +555,7 @@ Collision movesprite(DExhumedActor* pActor, int dx, int dy, int dz, int ceildist
if ((pSector->floorz - z) < (dz + flordist))
{
pActor->spr.pos.X = x;
pActor->spr.pos.Y = y;
pActor->set_int_xy( x, y);
}
else
{
@ -639,9 +640,7 @@ Collision MoveCreatureWithCaution(DExhumedActor* pActor)
if (zDiff > 15360 || (pSector->Flag & kSectUnderwater) || (pSector->pBelow != nullptr && pSector->pBelow->Flag) || pSector->Damage)
{
pActor->spr.pos.X = x;
pActor->spr.pos.Y = y;
pActor->spr.pos.Z = z;
pActor->set_int_pos({ x, y, z });
ChangeActorSect(pActor, pSectorPre);
@ -820,9 +819,7 @@ void CreatePushBlock(sectortype* pSector)
sBlockInfo[nBlock].pActor = pActor;
pActor->spr.pos.X = xAvg;
pActor->spr.pos.Y = yAvg;
pActor->spr.pos.Z = pSector->floorz - 256;
pActor->set_int_pos({ xAvg, yAvg, pSector->floorz - 256 });
pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE;
int var_28 = 0;
@ -980,8 +977,7 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)
{
if (pActor->spr.statnum < 99)
{
pActor->spr.pos.X += xvect;
pActor->spr.pos.Y += yvect;
pActor->add_int_pos({ xvect, yvect, 0 });
}
else
{
@ -1055,7 +1051,10 @@ void MoveSector(sectortype* pSector, int nAngle, int *nXVel, int *nYVel)
if (pActor->spr.statnum >= 99 && nZVal == pActor->spr.pos.Z && !(pActor->spr.cstat & CSTAT_SPRITE_INVISIBLE))
{
pSectorB = pSector;
clipmove(pActor->spr.pos, &pSectorB, xvect, yvect, 4 * pActor->spr.clipdist, 5120, -5120, CLIPMASK0, scratch);
auto lpos = pActor->spr.pos;
clipmove(lpos, &pSectorB, xvect, yvect, 4 * pActor->spr.clipdist, 5120, -5120, CLIPMASK0, scratch);
pActor->set_int_pos(lpos);
}
}
}
@ -1356,7 +1355,7 @@ DExhumedActor* BuildCreatureChunk(DExhumedActor* pSrc, int nPic, bool bSpecial)
if (pActor == nullptr) {
return nullptr;
}
pActor->spr.pos = pSrc->spr.pos;
pActor->set_int_pos(pSrc->spr.pos);
ChangeActorSect(pActor, pSrc->sector());
@ -1412,7 +1411,7 @@ void AICreatureChunk::Tick(RunListEvent* ev)
pActor->spr.xvel = 0;
pActor->spr.yvel = 0;
pActor->spr.zvel = 0;
pActor->spr.pos.Z = pSector->floorz;
pActor->set_int_z(pSector->floorz);
}
else
{

View file

@ -407,8 +407,7 @@ void BuildTail()
pTailActor->spr.lotag = runlist_HeadRun() + 1;
pTailActor->spr.intowner = runlist_AddRunRec(pTailActor->spr.lotag - 1, (i + 1), 0x1B0000);
pTailActor->spr.shade = -12;
pTailActor->spr.pos.X = x;
pTailActor->spr.pos.Y = y;
pTailActor->set_int_xy(x, y);
pTailActor->spr.hitag = 0;
pTailActor->spr.cstat = 0;
pTailActor->spr.clipdist = 100;
@ -418,7 +417,7 @@ void BuildTail()
pTailActor->spr.pal = pTailActor->sector()->ceilingpal;
pTailActor->spr.xoffset = 0;
pTailActor->spr.yoffset = 0;
pTailActor->spr.pos.Z = z;
pTailActor->set_int_z(z);
pTailActor->spr.extra = -1;
}
@ -453,9 +452,7 @@ void BuildQueenEgg(int nQueen, int nVal)
auto pActor2 = insertActor(pSector, 121);
pActor2->spr.pos.X = x;
pActor2->spr.pos.Y = y;
pActor2->spr.pos.Z = nFloorZ;
pActor2->set_int_pos({ x, y, nFloorZ });
pActor2->spr.pal = 0;
pActor2->spr.clipdist = 50;
pActor2->spr.xoffset = 0;
@ -655,7 +652,7 @@ void AIQueenEgg::Tick(RunListEvent* ev)
if (pEgg->nCounter <= 0)
{
auto pWaspSprite = BuildWasp(nullptr, pActor->spr.pos.X, pActor->spr.pos.Y, pActor->spr.pos.Z, pActor->sector(), pActor->spr.ang, true);
pActor->spr.pos.Z = pWaspSprite->spr.pos.Z;
pActor->set_int_z(pWaspSprite->spr.pos.Z);
DestroyEgg(nEgg);
}
@ -713,9 +710,7 @@ void BuildQueenHead(int nQueen)
auto pActor2 = insertActor(pSector, 121);
pActor2->spr.pos.X = x;
pActor2->spr.pos.Y = y;
pActor2->spr.pos.Z = z;
pActor2->set_int_pos({ x, y, z });
pActor2->spr.clipdist = 70;
pActor2->spr.xrepeat = 80;
pActor2->spr.yrepeat = 80;
@ -874,7 +869,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
}
else
{
pActor->spr.pos.Z -= 2048;
pActor->add_int_z(-2048);
goto __MOVEQS;
}
break;
@ -950,9 +945,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
ChangeActorSect(pTActor, headSect);
}
pTActor->spr.pos.X = MoveQX[nHd];
pTActor->spr.pos.Y = MoveQY[nHd];
pTActor->spr.pos.Z = MoveQZ[nHd];
pTActor->set_int_pos({ MoveQX[nHd], MoveQY[nHd], MoveQZ[nHd] });
pTActor->spr.ang = MoveQA[nHd];
}
}
@ -999,9 +992,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
ChangeActorSect(pActor, pSector);
pActor->spr.pos.X = x;
pActor->spr.pos.Y = y;
pActor->spr.pos.Z = z;
pActor->set_int_pos({ x, y, z });
if (QueenHead.nIndex2 < 10) {
for (int i = (10 - QueenHead.nIndex2) * 2; i > 0; i--)
@ -1126,9 +1117,7 @@ void BuildQueen(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector,
nAngle = pActor->spr.ang;
}
pActor->spr.pos.X = x;
pActor->spr.pos.Y = y;
pActor->spr.pos.Z = z;
pActor->set_int_pos({ x, y, z });
pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
pActor->spr.pal = 0;
pActor->spr.shade = -12;

View file

@ -52,9 +52,7 @@ DExhumedActor* BuildSpider(DExhumedActor* spp, int x, int y, int z, sectortype*
nAngle = spp->spr.ang;
}
spp->spr.pos.X = x;
spp->spr.pos.Y = y;
spp->spr.pos.Z = z;
spp->set_int_pos({ x, y, z });
spp->spr.cstat = CSTAT_SPRITE_BLOCK_ALL;
spp->spr.shade = -12;
spp->spr.clipdist = 15;
@ -102,7 +100,7 @@ void AISpider::Tick(RunListEvent* ev)
{
if (spp->spr.cstat & CSTAT_SPRITE_YFLIP)
{
spp->spr.pos.Z = spp->sector()->ceilingz + GetActorHeight(spp);
spp->set_int_z(spp->sector()->ceilingz + GetActorHeight(spp));
}
else
{
@ -179,7 +177,7 @@ void AISpider::Tick(RunListEvent* ev)
if (spp->spr.cstat & CSTAT_SPRITE_YFLIP)
{
spp->spr.zvel = 0;
spp->spr.pos.Z = pSector->ceilingz + (tileHeight(spp->spr.picnum) << 5);
spp->set_int_z(pSector->ceilingz + (tileHeight(spp->spr.picnum) << 5));
if (pSector->ceilingstat & CSTAT_SECTOR_SKY)
{
@ -212,7 +210,7 @@ void AISpider::Tick(RunListEvent* ev)
{
spp->spr.cstat ^= CSTAT_SPRITE_YFLIP;
spp->spr.zvel = 1;
spp->spr.pos.Z = pSector->ceilingz + GetActorHeight(spp);
spp->set_int_z(pSector->ceilingz + GetActorHeight(spp));
}
else
{
@ -290,7 +288,7 @@ void AISpider::Tick(RunListEvent* ev)
&& !((spp->sector()->ceilingstat) & CSTAT_SECTOR_SKY))
{
spp->spr.cstat |= CSTAT_SPRITE_YFLIP;
spp->spr.pos.Z = GetActorHeight(spp) + spp->sector()->ceilingz;
spp->set_int_z(GetActorHeight(spp) + spp->sector()->ceilingz);
spp->spr.zvel = 0;
spp->nAction = 1;