- Exhumed: eliminated several set_int_pos calls

This commit is contained in:
Christoph Oelckers 2022-08-20 16:29:57 +02:00
parent 7d9406bf01
commit f78ecd22a4
6 changed files with 33 additions and 64 deletions

View file

@ -493,7 +493,7 @@ HITSPRITE:
{
if ((pHitSect->pBelow != nullptr && (pHitSect->pBelow->Flag & kSectUnderwater)) || pHitSect->Depth)
{
pActor->set_int_pos({ x2, y2, z2 });
pActor->spr.pos = pos;
BuildSplash(pActor, pHitSect);
}
else
@ -521,7 +521,7 @@ HITSPRITE:
}
else
{
pActor->set_int_pos({ x2, y2, z2 });
pActor->spr.pos = pos;
ChangeActorSect(pActor, pHitSect);
}

View file

@ -412,9 +412,7 @@ void AIFish::Tick(RunListEvent* ev)
}
}
int x = pActor->int_pos().X;
int y = pActor->int_pos().Y;
int z = pActor->int_pos().Z;
auto pos = pActor->spr.pos;
auto pSector =pActor->sector();
// loc_2EF54
@ -423,7 +421,7 @@ void AIFish::Tick(RunListEvent* ev)
if (!(pActor->sector()->Flag & kSectUnderwater))
{
ChangeActorSect(pActor, pSector);
pActor->set_int_pos({ x, y, z });
pActor->spr.pos = pos;
IdleFish(pActor, 0);
return;

View file

@ -277,9 +277,7 @@ void AILavaDude::Tick(RunListEvent* ev)
}
}
int x = pActor->int_pos().X;
int y = pActor->int_pos().Y;
int z = pActor->int_pos().Z;
auto pos = pActor->spr.pos;
auto pSector =pActor->sector();
auto coll = movesprite(pActor, pActor->spr.xvel << 8, pActor->spr.yvel << 8, 0, 0, 0, CLIPMASK0);
@ -287,7 +285,7 @@ void AILavaDude::Tick(RunListEvent* ev)
if (pSector != pActor->sector())
{
ChangeActorSect(pActor, pSector);
pActor->set_int_pos({ x, y, z });
pActor->spr.pos = pos;
pActor->set_int_ang((pActor->int_ang() + ((RandomWord() & 0x3FF) + 1024)) & kAngleMask);
pActor->spr.xvel = bcos(pActor->int_ang());

View file

@ -860,9 +860,7 @@ void AIPlayer::Tick(RunListEvent* ev)
y /= 2;
}
int spr_x = pPlayerActor->int_pos().X;
int spr_y = pPlayerActor->int_pos().Y;
int spr_z = pPlayerActor->int_pos().Z;
auto spr_pos = pPlayerActor->spr.pos;
auto spr_sect = pPlayerActor->sector();
// TODO
@ -898,7 +896,7 @@ void AIPlayer::Tick(RunListEvent* ev)
{
ChangeActorSect(pPlayerActor, spr_sect);
pPlayerActor->set_int_xy(spr_x, spr_y);
pPlayerActor->spr.pos.XY() = spr_pos.XY();
if (zVel < pPlayerActor->spr.zvel) {
pPlayerActor->spr.zvel = zVel;
@ -1041,7 +1039,7 @@ void AIPlayer::Tick(RunListEvent* ev)
}
else
{
pPlayerActor->set_int_pos({ spr_x, spr_y, spr_z });
pPlayerActor->spr.pos = spr_pos;
ChangeActorSect(pPlayerActor, spr_sect);
}
@ -1067,7 +1065,7 @@ void AIPlayer::Tick(RunListEvent* ev)
sectdone:
if (!PlayerList[nPlayer].bPlayerPan && !PlayerList[nPlayer].bLockPan)
{
PlayerList[nPlayer].nDestVertPan = q16horiz(clamp((spr_z - pPlayerActor->int_pos().Z) << 9, gi->playerHorizMin(), gi->playerHorizMax()));
PlayerList[nPlayer].nDestVertPan = q16horiz(clamp((int(spr_pos.Z * zworldtoint) - pPlayerActor->int_pos().Z) << 9, gi->playerHorizMin(), gi->playerHorizMax()));
}
playerX -= pPlayerActor->int_pos().X;
@ -1108,26 +1106,23 @@ sectdone:
{
if (nMove.type == kHitWall)
{
int var_C4 = pPlayerActor->int_pos().X;
int var_D4 = pPlayerActor->int_pos().Y;
int var_C8 = pPlayerActor->int_pos().Z;
auto pos = pPlayerActor->spr.pos;
ChangeActorSect(pPlayerActor, pViewSect);
int var_FC = pViewSect->int_floorz() + (-5120);
pPlayerActor->set_int_pos({ spr_x, spr_y, var_FC });
double fz = pViewSect->floorz - 20;
pPlayerActor->spr.pos = DVector3(spr_pos.XY(), fz);
auto coll = movesprite(pPlayerActor, x, y, 0, 5120, 0, CLIPMASK0);
if (coll.type == kHitWall)
{
ChangeActorSect(pPlayerActor, pPlayerActor->sector());
pPlayerActor->set_int_pos({ var_C4, var_D4, var_C8 });
pPlayerActor->spr.pos = pos;
}
else
{
pPlayerActor->set_int_z(var_FC - 256);
pPlayerActor->spr.pos.Z = fz-1;
D3PlayFX(StaticSound[kSound42], pPlayerActor);
}
}
@ -1137,8 +1132,8 @@ sectdone:
// loc_1ADAF
PlayerList[nPlayer].pPlayerViewSect = pViewSect;
PlayerList[nPlayer].nPlayerD.X = pPlayerActor->int_pos().X - spr_x;
PlayerList[nPlayer].nPlayerD.Y = pPlayerActor->int_pos().Y - spr_y;
PlayerList[nPlayer].nPlayerD.X = int((pPlayerActor->spr.pos.X - spr_pos.X) * worldtoint);
PlayerList[nPlayer].nPlayerD.Y = int((pPlayerActor->spr.pos.Y - spr_pos.Y) * worldtoint);
int var_5C = pViewSect->Flag & kSectUnderwater;

View file

@ -118,11 +118,9 @@ TObjPtr<DExhumedActor*> tailspr[kMaxTails];
Queen QueenList[kMaxQueens];
Head QueenHead;
int MoveQX[25];
int MoveQY[25];
int MoveQZ[25];
DVector3 MoveQP[25];
sectortype* MoveQS[25];
int16_t MoveQA[25];
DAngle MoveQA[25];
size_t MarkQueen()
@ -207,9 +205,7 @@ void SerializeQueen(FSerializer& arc)
.Array("tailspr", tailspr, countof(tailspr))
("queen", QueenList[0])
("eggs", QueenEgg)
.Array("moveqx", MoveQX, countof(MoveQX))
.Array("moveqy", MoveQY, countof(MoveQY))
.Array("moveqz", MoveQZ, countof(MoveQZ))
.Array("moveqv", MoveQP, countof(MoveQP))
.Array("moveqa", MoveQA, countof(MoveQA))
.Array("moveqs", MoveQS, countof(MoveQS));
}
@ -392,9 +388,7 @@ void BuildTail()
{
auto head = QueenHead.pActor;
int x = head->int_pos().X;
int y = head->int_pos().Y;
int z = head->int_pos().Z;
auto pos = head->spr.pos;
auto pSector =head->sector();
int i;
@ -407,7 +401,6 @@ 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->set_int_xy(x, y);
pTailActor->spr.hitag = 0;
pTailActor->spr.cstat = 0;
pTailActor->spr.clipdist = 100;
@ -417,15 +410,13 @@ void BuildTail()
pTailActor->spr.pal = pTailActor->sector()->ceilingpal;
pTailActor->spr.xoffset = 0;
pTailActor->spr.yoffset = 0;
pTailActor->set_int_z(z);
pTailActor->spr.pos = pos;
pTailActor->spr.extra = -1;
}
for (i = 0; i < 24 + 1; i++)
{
MoveQX[i] = x;
MoveQZ[i] = z;
MoveQY[i] = y;
MoveQP[i] = pos;
assert(pSector);
MoveQS[i] = pSector;
}
@ -444,15 +435,12 @@ void BuildQueenEgg(int nQueen, int nVal)
DExhumedActor* pActor = QueenList[nQueen].pActor;
if (!pActor) return;
int x = pActor->int_pos().X;
int y = pActor->int_pos().Y;
auto pSector =pActor->sector();
int nFloorZ = pSector->int_floorz();
int nAngle = pActor->int_ang();
auto pActor2 = insertActor(pSector, 121);
pActor2->set_int_pos({ x, y, nFloorZ });
pActor2->spr.pos = DVector3(pActor->spr.pos.XY(), pSector->floorz);
pActor2->spr.pal = 0;
pActor2->spr.clipdist = 50;
pActor2->spr.xoffset = 0;
@ -702,15 +690,13 @@ void BuildQueenHead(int nQueen)
DExhumedActor* pActor = QueenList[nQueen].pActor;
if (!pActor) return;
int x = pActor->int_pos().X;
int y = pActor->int_pos().Y;
int nAngle = pActor->int_ang();
auto pSector = pActor->sector();
int z = pSector->int_floorz();
auto pActor2 = insertActor(pSector, 121);
pActor2->set_int_pos({ x, y, z });
pActor2->spr.pos.XY() = pActor->spr.pos();
pActor2->spr.pos.Z = pSector->floorz;
pActor2->spr.clipdist = 70;
pActor2->spr.xrepeat = 80;
pActor2->spr.yrepeat = 80;
@ -918,12 +904,10 @@ void AIQueenHead::Tick(RunListEvent* ev)
// switch break. MoveQS stuff?
__MOVEQS:
MoveQX[nQHead] = pActor->int_pos().X;
MoveQY[nQHead] = pActor->int_pos().Y;
MoveQZ[nQHead] = pActor->int_pos().Z;
MoveQP[nQHead] = pActor->spr.pos;
assert(pActor->sector());
MoveQS[nQHead] = pActor->sector();
MoveQA[nQHead] = pActor->int_ang();
MoveQA[nQHead] = pActor->spr.angle;
nHd = nQHead;
@ -945,8 +929,8 @@ void AIQueenHead::Tick(RunListEvent* ev)
ChangeActorSect(pTActor, headSect);
}
pTActor->set_int_pos({ MoveQX[nHd], MoveQY[nHd], MoveQZ[nHd] });
pTActor->set_int_ang(MoveQA[nHd]);
pTActor->spr.pos = MoveQP[nHd];
pTActor->spr.angle = MoveQA[nHd];
}
}
@ -968,9 +952,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
{
if (QueenHead.nIndex2 >= 15 || QueenHead.nIndex2 < 10)
{
int x = pActor->int_pos().X;
int y = pActor->int_pos().Y;
int z = pActor->int_pos().Z;
auto pos = pActor->spr.pos;
auto pSector =pActor->sector();
int nAngle = RandomSize(11) & kAngleMask;
@ -992,7 +974,7 @@ void AIQueenHead::Tick(RunListEvent* ev)
ChangeActorSect(pActor, pSector);
pActor->set_int_pos({ x, y, z });
pActor->spr.pos = pos;
if (QueenHead.nIndex2 < 10) {
for (int i = (10 - QueenHead.nIndex2) * 2; i > 0; i--)

View file

@ -369,17 +369,13 @@ void AISnake::Tick(RunListEvent* ev)
int var_28 = (nAngle + 512) & kAngleMask;
auto pSector = pActor->sector();
int x = pActor->int_pos().X;
int y = pActor->int_pos().Y;
int z = pActor->int_pos().Z;
for (int i = 7; i > 0; i--)
{
DExhumedActor* pActor2 = SnakeList[nSnake].pSprites[i];
if (!pActor2) continue;
pActor2->set_int_ang(nAngle);
pActor2->set_int_pos({ x, y, z });
pActor2->spr.pos = pActor->spr.pos;
ChangeActorSect(pActor2, pSector);