From 3a77742b7294cfcd729678014b4c86f8a383ca4a Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 20 Aug 2022 16:44:30 +0200 Subject: [PATCH] - handle most set_int_z calls in Exhumed --- source/games/exhumed/src/anubis.cpp | 2 +- source/games/exhumed/src/bullet.cpp | 4 ++-- source/games/exhumed/src/move.cpp | 2 +- source/games/exhumed/src/mummy.cpp | 2 +- source/games/exhumed/src/object.cpp | 28 +++++++++++++-------------- source/games/exhumed/src/player.cpp | 6 +++--- source/games/exhumed/src/queen.cpp | 2 +- source/games/exhumed/src/sequence.cpp | 2 +- source/games/exhumed/src/spider.cpp | 2 +- 9 files changed, 24 insertions(+), 26 deletions(-) diff --git a/source/games/exhumed/src/anubis.cpp b/source/games/exhumed/src/anubis.cpp index e400a4e39..11737dd1d 100644 --- a/source/games/exhumed/src/anubis.cpp +++ b/source/games/exhumed/src/anubis.cpp @@ -416,7 +416,7 @@ void AIAnubis::Damage(RunListEvent* ev) ap->spr.xvel = 0; ap->spr.yvel = 0; ap->spr.zvel = 0; - ap->set_int_z(ap->sector()->int_floorz()); + ap->spr.pos.Z = ap->sector()->floorz; ap->spr.cstat &= ~CSTAT_SPRITE_BLOCK_ALL; ap->nHealth = 0; diff --git a/source/games/exhumed/src/bullet.cpp b/source/games/exhumed/src/bullet.cpp index d5af0580c..3b7fd7290 100644 --- a/source/games/exhumed/src/bullet.cpp +++ b/source/games/exhumed/src/bullet.cpp @@ -685,11 +685,11 @@ DExhumedActor* BuildBullet(DExhumedActor* pActor, int nType, int nZOffset, int n pSector = pBulletActor->sector(); - while (pBulletActor->int_pos().Z < pSector->int_ceilingz()) + while (pBulletActor->spr.pos.Z < pSector->ceilingz) { if (pSector->pAbove == nullptr) { - pBulletActor->set_int_z(pSector->int_ceilingz()); + pBulletActor->spr.pos.Z = pSector->ceilingz; break; } diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index 4ce1c077c..64d4d979e 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -1408,7 +1408,7 @@ void AICreatureChunk::Tick(RunListEvent* ev) pActor->spr.xvel = 0; pActor->spr.yvel = 0; pActor->spr.zvel = 0; - pActor->set_int_z(pSector->int_floorz()); + pActor->spr.pos.Z = pSector->floorz; } else { diff --git a/source/games/exhumed/src/mummy.cpp b/source/games/exhumed/src/mummy.cpp index 917fdfb8c..1a1487ff8 100644 --- a/source/games/exhumed/src/mummy.cpp +++ b/source/games/exhumed/src/mummy.cpp @@ -444,7 +444,7 @@ void AIMummy::Damage(RunListEvent* ev) pActor->spr.xvel = 0; pActor->spr.yvel = 0; pActor->spr.zvel = 0; - pActor->set_int_z(pActor->sector()->int_floorz()); + pActor->spr.pos.Z = pActor->sector()->floorz; } else { diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index e34015a00..b348d36d9 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -630,19 +630,19 @@ int CheckSectorSprites(sectortype* pSector, int nVal) } // done -void MoveSectorSprites(sectortype* pSector, int z) +void MoveSectorSprites(sectortype* pSector, double z) { - int newz = pSector->int_floorz(); - int oldz = newz - z; - int minz = min(newz, oldz); - int maxz = max(newz, oldz); + double newz = pSector->floorz; + double oldz = newz - z; + double minz = min(newz, oldz); + double maxz = max(newz, oldz); ExhumedSectIterator it(pSector); while (auto pActor = it.Next()) { - int actz = pActor->int_pos().Z; + int actz = pActor->spr.pos.Z; if ((pActor->spr.statnum != 200 && actz >= minz && actz <= maxz) || pActor->spr.statnum >= 900) { - pActor->set_int_z(newz); + pActor->spr.pos.Z = newz; } } } @@ -788,7 +788,7 @@ void AIElev::Tick(RunListEvent* ev) } else { - MoveSectorSprites(pSector, nVal); + MoveSectorSprites(pSector, nVal * inttoworld); if (nVal < 0 && CheckSectorSprites(pSector, 2)) { @@ -1399,7 +1399,7 @@ DExhumedActor* BuildSpark(DExhumedActor* pActor, int nVal) pSpark->spr.picnum = kTile985 + nVal; } - pSpark->set_int_z(pActor->int_pos().Z); + pSpark->spr.pos.Z = pActor->spr.pos.Z; pSpark->spr.lotag = runlist_HeadRun() + 1; pSpark->spr.clipdist = 1; pSpark->spr.hitag = 0; @@ -1580,7 +1580,7 @@ DExhumedActor* BuildEnergyBlock(sectortype* pSector) // GrabTimeSlot(3); - pActor->set_int_z(pSector->firstWall()->nextSector()->int_floorz()); + pActor->spr.pos.Z = pSector->firstWall()->nextSector()->floorz; // CHECKME - name of this variable? int nRepeat = (pActor->int_pos().Z - pSector->int_floorz()) >> 8; @@ -1660,7 +1660,7 @@ void ExplodeEnergyBlock(DExhumedActor* pActor) pSector->extra = -1; pSector->set_int_floorz(pActor->int_pos().Z); - pActor->set_int_z((pActor->int_pos().Z + pSector->int_floorz()) / 2); + pActor->spr.pos.Z = (pActor->spr.pos.Z + pSector->floorz) * 0.5; BuildSpark(pActor, 3); @@ -2119,11 +2119,9 @@ void DoDrips() } else { - int nFloorZ = pSector->int_floorz(); - + double nFloorZ = pSector->floorz; pSector->set_int_floorz(edx + sBob[i].z); - - MoveSectorSprites(pSector, pSector->int_floorz() - nFloorZ); + MoveSectorSprites(pSector, pSector->floorz - nFloorZ); } } } diff --git a/source/games/exhumed/src/player.cpp b/source/games/exhumed/src/player.cpp index d7148b599..753a55c5d 100644 --- a/source/games/exhumed/src/player.cpp +++ b/source/games/exhumed/src/player.cpp @@ -877,7 +877,7 @@ void AIPlayer::Tick(RunListEvent* ev) vec3_t pos = pPlayerActor->int_pos(); SetActor(pPlayerActor, &pos); - pPlayerActor->set_int_z(pPlayerActor->sector()->int_floorz()); + pPlayerActor->spr.pos.Z = pPlayerActor->sector()->floorz; } else { @@ -1257,7 +1257,7 @@ sectdone: ChangeActorSect(pFloorActor, pPlayerActor->sector()); } - pFloorActor->set_int_z(pPlayerActor->sector()->int_floorz()); + pFloorActor->spr.pos.Z = pPlayerActor->sector()->floorz; } int var_30 = 0; @@ -2444,7 +2444,7 @@ sectdone: { pPlayerActor->spr.picnum = seq_GetSeqPicnum(kSeqJoe, 120, 0); pPlayerActor->spr.cstat = 0; - pPlayerActor->set_int_z(pPlayerActor->sector()->int_floorz()); + pPlayerActor->spr.pos.Z = pPlayerActor->sector()->floorz; } // will invalidate nPlayerSprite diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index 9ab4e2819..c1c76feef 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -640,7 +640,7 @@ void AIQueenEgg::Tick(RunListEvent* ev) if (pEgg->nCounter <= 0) { auto pWaspSprite = BuildWasp(nullptr, pActor->spr.pos, pActor->sector(), pActor->int_ang(), true); - pActor->set_int_z(pWaspSprite->int_pos().Z); + pActor->spr.pos.Z = pWaspSprite->spr.pos.Z; DestroyEgg(nEgg); } diff --git a/source/games/exhumed/src/sequence.cpp b/source/games/exhumed/src/sequence.cpp index c2682c201..987a3fd86 100644 --- a/source/games/exhumed/src/sequence.cpp +++ b/source/games/exhumed/src/sequence.cpp @@ -632,7 +632,7 @@ int seq_PlotSequence(int nSprite, int16_t edx, int16_t nFrame, int16_t ecx) } pTSprite->cstat = CSTAT_SPRITE_ALIGNMENT_FLOOR | CSTAT_SPRITE_TRANSLUCENT; - pTSprite->set_int_z(nFloorZ); + pTSprite->pos.Z = pSector->floorz; pTSprite->yrepeat = (uint8_t)edx; pTSprite->xrepeat = (uint8_t)edx; pTSprite->statnum = -3; diff --git a/source/games/exhumed/src/spider.cpp b/source/games/exhumed/src/spider.cpp index 81db1dad4..bbacce89f 100644 --- a/source/games/exhumed/src/spider.cpp +++ b/source/games/exhumed/src/spider.cpp @@ -175,7 +175,7 @@ void AISpider::Tick(RunListEvent* ev) if (spp->spr.cstat & CSTAT_SPRITE_YFLIP) { spp->spr.zvel = 0; - spp->set_int_z(pSector->int_ceilingz() + (tileHeight(spp->spr.picnum) << 5)); + spp->spr.pos.Z = pSector->ceilingz + (tileHeight(spp->spr.picnum) / 8.); // was << 5 in Build coordinates if (pSector->ceilingstat & CSTAT_SECTOR_SKY) {