From e6f1d9256739ae9489b9a61d6f7e55b272705e68 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 17 Aug 2022 19:03:45 +0200 Subject: [PATCH] - use floats for spawning Exhumed actors --- source/games/exhumed/src/aistuff.h | 26 ++++++++++----------- source/games/exhumed/src/anubis.cpp | 8 +++---- source/games/exhumed/src/fish.cpp | 7 ++---- source/games/exhumed/src/init.cpp | 33 ++++++++++++++------------- source/games/exhumed/src/lavadude.cpp | 7 +++--- source/games/exhumed/src/lion.cpp | 8 +++---- source/games/exhumed/src/mummy.cpp | 8 ++----- source/games/exhumed/src/osdcmds.cpp | 29 +++++++++++------------ source/games/exhumed/src/queen.cpp | 18 +++++++-------- source/games/exhumed/src/rat.cpp | 27 ++++++++++------------ source/games/exhumed/src/rex.cpp | 17 ++++++-------- source/games/exhumed/src/roach.cpp | 26 ++++++++++----------- source/games/exhumed/src/scorp.cpp | 29 +++++++++++------------ source/games/exhumed/src/set.cpp | 8 +++---- source/games/exhumed/src/spider.cpp | 8 +++---- source/games/exhumed/src/wasp.cpp | 4 ++-- 16 files changed, 118 insertions(+), 145 deletions(-) diff --git a/source/games/exhumed/src/aistuff.h b/source/games/exhumed/src/aistuff.h index f660549cb..47eae2316 100644 --- a/source/games/exhumed/src/aistuff.h +++ b/source/games/exhumed/src/aistuff.h @@ -38,7 +38,7 @@ void BuildSplash(DExhumedActor* actor, sectortype* pSector); // anubis -void BuildAnubis(DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int nAngle, uint8_t bIsDrummer); +void BuildAnubis(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int nAngle, uint8_t bIsDrummer); void FuncAnubis(int, int a, int b, int c); // bubbles @@ -86,7 +86,7 @@ void BackUpBullet(int *x, int *y, int nAngle); // fish -void BuildFish(DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int nAngle); +void BuildFish(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int nAngle); void FuncFish(int, int, int, int); void FuncFishLimb(int a, int b, int c); @@ -168,7 +168,7 @@ void DoRegenerates(); // lavadude -void BuildLava(DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int nAngle, int nChannel); +void BuildLava(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int nAngle, int nChannel); DExhumedActor* BuildLavaLimb(DExhumedActor* nSprite, int edx, int ebx); void FuncLavaLimb(int, int, int, int); void FuncLava(int, int, int, int); @@ -190,7 +190,7 @@ void AddFlicker(sectortype* pSector, int nVal); // lion -void BuildLion(DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int nAngle); +void BuildLion(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int nAngle); void FuncLion(int, int, int, int); // move @@ -240,7 +240,7 @@ void SetQuake(DExhumedActor* nSprite, int nVal); enum { kMaxMummies = 150 }; -void BuildMummy(DExhumedActor* val, int x, int y, int z, sectortype* pSector, int nAngle); +void BuildMummy(DExhumedActor* val, const DVector3& pos, sectortype* pSector, int nAngle); // object @@ -296,7 +296,7 @@ int BuildSlide(int nChannel, walltype* edx, walltype* ebx, walltype* ecx, wallty // queen void InitQueens(); -void BuildQueen(DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int nAngle, int nVal); +void BuildQueen(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int nAngle, int nVal); void FuncQueenEgg(int, int, int, int); void FuncQueenHead(int, int, int, int); void FuncQueen(int, int, int, int); @@ -327,17 +327,17 @@ void FuncRa(int, int, int, int); // rat void InitRats(); -void BuildRat(DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int nAngle); +void BuildRat(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int nAngle); void FuncRat(int a, int, int b, int nRun); // rex -void BuildRex(DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int nAngle, int nChannel); +void BuildRex(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int nAngle, int nChannel); void FuncRex(int, int, int, int); // roach -void BuildRoach(int nType, DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int angle); +void BuildRoach(int nType, DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int angle); void FuncRoach(int a, int, int nDamage, int nRun); // runlist @@ -699,12 +699,12 @@ void runlist_ExecObjects(); // scorp -void BuildScorp(DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int nAngle, int nChannel); +void BuildScorp(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int nAngle, int nChannel); void FuncScorp(int, int, int, int); // set -void BuildSet(DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int nAngle, int nChannel); +void BuildSet(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int nAngle, int nChannel); void FuncSoul(int, int, int, int); void FuncSet(int, int, int, int); @@ -737,7 +737,7 @@ void FuncSnake(int, int, int, int); // spider -DExhumedActor* BuildSpider(DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int nAngle); +DExhumedActor* BuildSpider(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int nAngle); void FuncSpider(int a, int, int b, int nRun); // switch @@ -763,7 +763,7 @@ std::pair BuildSwPressWall(int nChannel, int nLink, walltype* pWall); // wasp -DExhumedActor* BuildWasp(DExhumedActor* nSprite, int x, int y, int z, sectortype* pSector, int nAngle, bool bEggWasp); +DExhumedActor* BuildWasp(DExhumedActor* nSprite, const DVector3& pos, sectortype* pSector, int nAngle, bool bEggWasp); void FuncWasp(int eax, int, int edx, int nRun); diff --git a/source/games/exhumed/src/anubis.cpp b/source/games/exhumed/src/anubis.cpp index 51570cd5c..040fb6ff0 100644 --- a/source/games/exhumed/src/anubis.cpp +++ b/source/games/exhumed/src/anubis.cpp @@ -43,23 +43,21 @@ static const actionSeq AnubisSeq[] = { { 43, 1 }, }; -void BuildAnubis(DExhumedActor* ap, int x, int y, int z, sectortype* pSector, int nAngle, uint8_t bIsDrummer) +void BuildAnubis(DExhumedActor* ap, const DVector3& pos, sectortype* pSector, int nAngle, uint8_t bIsDrummer) { if (ap == nullptr) { ap = insertActor(pSector, 101); + ap->spr.pos = pos; } else { ChangeActorStat(ap, 101); - x = ap->int_pos().X; - y = ap->int_pos().Y; - z = ap->sector()->int_floorz(); + ap->spr.pos.Z = ap->sector()->floorz; nAngle = ap->int_ang(); } - ap->set_int_pos({ x, y, z }); ap->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; ap->spr.xoffset = 0; ap->spr.shade = -12; diff --git a/source/games/exhumed/src/fish.cpp b/source/games/exhumed/src/fish.cpp index 5e2e7ff91..662500b76 100644 --- a/source/games/exhumed/src/fish.cpp +++ b/source/games/exhumed/src/fish.cpp @@ -138,22 +138,19 @@ void AIFishLimb::Draw(RunListEvent* ev) } -void BuildFish(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle) +void BuildFish(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, int nAngle) { if (pActor == nullptr) { pActor = insertActor(pSector, 103); + pActor->spr.pos = pos; } else { - x = pActor->int_pos().X; - y = pActor->int_pos().Y; - z = pActor->int_pos().Z; nAngle = pActor->int_ang(); ChangeActorStat(pActor, 103); } - pActor->set_int_pos({ x, y, z }); pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; pActor->spr.shade = -12; pActor->spr.clipdist = 80; diff --git a/source/games/exhumed/src/init.cpp b/source/games/exhumed/src/init.cpp index ef9112bf6..c3a25cdb7 100644 --- a/source/games/exhumed/src/init.cpp +++ b/source/games/exhumed/src/init.cpp @@ -251,6 +251,7 @@ void SnapSectors(sectortype* pSectorA, sectortype* pSectorB, int b) void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) { + static const DVector3 nulvec = {0,0,0}; int nChannel = runlist_AllocChannel(nHitag % 1000); int nSpeed = nLotag / 1000; @@ -425,7 +426,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildAnubis(pActor, 0, 0, 0, nullptr, 0, 1); + BuildAnubis(pActor, nulvec, nullptr, 0, 1); return; } case 117: @@ -435,27 +436,27 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildWasp(pActor, 0, 0, 0, nullptr, 0, false); + BuildWasp(pActor, nulvec, nullptr, 0, false); return; } case 116: { - BuildRat(pActor, 0, 0, 0, nullptr, -1); + BuildRat(pActor, nulvec, nullptr, -1); return; } case 115: // Rat (eating) { - BuildRat(pActor, 0, 0, 0, nullptr, 0); + BuildRat(pActor, nulvec, nullptr, 0); return; } case 113: { - BuildQueen(pActor, 0, 0, 0, nullptr, 0, nChannel); + BuildQueen(pActor, nulvec, nullptr, 0, nChannel); return; } case 112: { - BuildScorp(pActor, 0, 0, 0, nullptr, 0, nChannel); + BuildScorp(pActor, nulvec, nullptr, 0, nChannel); return; } case 111: @@ -465,7 +466,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildSet(pActor, 0, 0, 0, nullptr, 0, nChannel); + BuildSet(pActor, nulvec, nullptr, 0, nChannel); return; } case 108: @@ -475,7 +476,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildLava(pActor, 0, 0, 0, nullptr, 0, nChannel); + BuildLava(pActor, nulvec, nullptr, 0, nChannel); return; } case 107: @@ -485,7 +486,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildRex(pActor, 0, 0, 0, nullptr, 0, nChannel); + BuildRex(pActor, nulvec, nullptr, 0, nChannel); return; } case 106: @@ -495,7 +496,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildFish(pActor, 0, 0, 0, nullptr, 0); + BuildFish(pActor, nulvec, nullptr, 0); return; } case 105: @@ -505,7 +506,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildSpider(pActor, 0, 0, 0, nullptr, 0); + BuildSpider(pActor, nulvec, nullptr, 0); return; } case 104: @@ -515,7 +516,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildRoach(1, pActor, 0, 0, 0, nullptr, 0); + BuildRoach(1, pActor, nulvec, nullptr, 0); return; } case 103: @@ -525,7 +526,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildRoach(0, pActor, 0, 0, 0, nullptr, 0); + BuildRoach(0, pActor, nulvec, nullptr, 0); return; } case 102: @@ -535,7 +536,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildLion(pActor, 0, 0, 0, nullptr, 0); + BuildLion(pActor, nulvec, nullptr, 0); return; } case 101: @@ -545,7 +546,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildMummy(pActor, 0, 0, 0, nullptr, 0); + BuildMummy(pActor, nulvec, nullptr, 0); return; } case 100: @@ -555,7 +556,7 @@ void ProcessSpriteTag(DExhumedActor* pActor, int nLotag, int nHitag) return; } - BuildAnubis(pActor, 0, 0, 0, nullptr, 0, 0); + BuildAnubis(pActor, nulvec, nullptr, 0, 0); return; } case 99: // underwater type 2 diff --git a/source/games/exhumed/src/lavadude.cpp b/source/games/exhumed/src/lavadude.cpp index 1aebfbb00..ff3137534 100644 --- a/source/games/exhumed/src/lavadude.cpp +++ b/source/games/exhumed/src/lavadude.cpp @@ -97,23 +97,22 @@ void AILavaDudeLimb::Draw(RunListEvent* ev) } -void BuildLava(DExhumedActor* pActor, int x, int y, int, sectortype* pSector, int nAngle, int nChannel) +void BuildLava(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, int nAngle, int nChannel) { if (pActor == nullptr) { pActor = insertActor(pSector, 118); + pActor->spr.pos = pos; } else { pSector = pActor->sector(); nAngle = pActor->int_ang(); - x = pActor->int_pos().X; - y = pActor->int_pos().Y; + pActor->spr.pos.Z = pSector->floorz; ChangeActorStat(pActor, 118); } - pActor->set_int_pos({ x, y, pSector->int_floorz() }); pActor->spr.cstat = CSTAT_SPRITE_INVISIBLE; pActor->spr.xrepeat = 200; pActor->spr.yrepeat = 200; diff --git a/source/games/exhumed/src/lion.cpp b/source/games/exhumed/src/lion.cpp index c7e026fef..dae22770d 100644 --- a/source/games/exhumed/src/lion.cpp +++ b/source/games/exhumed/src/lion.cpp @@ -41,22 +41,20 @@ static actionSeq LionSeq[] = { }; -void BuildLion(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle) +void BuildLion(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, int nAngle) { if (pActor == nullptr) { pActor = insertActor(pSector, 104); + pActor->spr.pos = pos; } else { ChangeActorStat(pActor, 104); - x = pActor->int_pos().X; - y = pActor->int_pos().Y; - z = pActor->sector()->int_floorz(); + pActor->spr.pos.Z = pActor->sector()->floorz; nAngle = pActor->int_ang(); } - pActor->set_int_pos({ x, y, z }); pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; pActor->spr.clipdist = 60; pActor->spr.shade = -12; diff --git a/source/games/exhumed/src/mummy.cpp b/source/games/exhumed/src/mummy.cpp index 67b75920a..e257ba533 100644 --- a/source/games/exhumed/src/mummy.cpp +++ b/source/games/exhumed/src/mummy.cpp @@ -37,23 +37,19 @@ static actionSeq MummySeq[] = { }; -void BuildMummy(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle) +void BuildMummy(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, int nAngle) { if (pActor == nullptr) { pActor = insertActor(pSector, 102); + pActor->spr.pos = pos; } else { - x = pActor->int_pos().X; - y = pActor->int_pos().Y; - z = pActor->int_pos().Z; nAngle = pActor->int_ang(); - ChangeActorStat(pActor, 102); } - pActor->set_int_pos({ x, y, z }); pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; pActor->spr.shade = -12; pActor->spr.clipdist = 32; diff --git a/source/games/exhumed/src/osdcmds.cpp b/source/games/exhumed/src/osdcmds.cpp index 2ab721925..04cd35b3b 100644 --- a/source/games/exhumed/src/osdcmds.cpp +++ b/source/games/exhumed/src/osdcmds.cpp @@ -71,20 +71,21 @@ static int osdcmd_spawn(CCmdFuncPtr parm) if (parm->numparms != 1) return CCMD_SHOWHELP; auto c = parm->parms[0]; auto sectp = initsectp; - if (!stricmp(c, "anubis")) BuildAnubis(nullptr, initx, inity, sectp->int_floorz(), sectp, inita, false); - else if (!stricmp(c, "spider")) BuildSpider(nullptr, initx, inity, sectp->int_floorz(), sectp, inita); - else if (!stricmp(c, "mummy")) BuildMummy(nullptr, initx, inity, sectp->int_floorz(), sectp, inita); - else if (!stricmp(c, "fish")) BuildFish(nullptr, initx, inity, initz + PlayerList[nLocalPlayer].eyelevel, sectp, inita); - else if (!stricmp(c, "lion")) BuildLion(nullptr, initx, inity, sectp->int_floorz(), sectp, inita); - else if (!stricmp(c, "lava")) BuildLava(nullptr, initx, inity, sectp->int_floorz(), sectp, inita, nNetPlayerCount); - else if (!stricmp(c, "rex")) BuildRex(nullptr, initx, inity, sectp->int_floorz(), sectp, inita, nNetPlayerCount); - else if (!stricmp(c, "set")) BuildSet(nullptr, initx, inity, sectp->int_floorz(), sectp, inita, nNetPlayerCount); - else if (!stricmp(c, "queen")) BuildQueen(nullptr, initx, inity, sectp->int_floorz(), sectp, inita, nNetPlayerCount); - else if (!stricmp(c, "roach")) BuildRoach(0, nullptr, initx, inity, sectp->int_floorz(), sectp, inita); - else if (!stricmp(c, "roach2")) BuildRoach(1, nullptr, initx, inity, sectp->int_floorz(), sectp, inita); - else if (!stricmp(c, "wasp")) BuildWasp(nullptr, initx, inity, sectp->int_floorz() - 25600, sectp, inita, false); - else if (!stricmp(c, "scorp")) BuildScorp(nullptr, initx, inity, sectp->int_floorz(), sectp, inita, nNetPlayerCount); - else if (!stricmp(c, "rat")) BuildRat(nullptr, initx, inity, sectp->int_floorz(), sectp, inita); + DVector3 initpos = { initx * inttoworld, inity * inttoworld, sectp->floorz }; + if (!stricmp(c, "anubis")) BuildAnubis(nullptr, initpos, sectp, inita, false); + else if (!stricmp(c, "spider")) BuildSpider(nullptr, initpos, sectp, inita); + else if (!stricmp(c, "mummy")) BuildMummy(nullptr, initpos, sectp, inita); + else if (!stricmp(c, "fish")) BuildFish(nullptr, initpos.plusZ(PlayerList[nLocalPlayer].eyelevel * zinttoworld), sectp, inita); + else if (!stricmp(c, "lion")) BuildLion(nullptr, initpos, sectp, inita); + else if (!stricmp(c, "lava")) BuildLava(nullptr, initpos, sectp, inita, nNetPlayerCount); + else if (!stricmp(c, "rex")) BuildRex(nullptr, initpos, sectp, inita, nNetPlayerCount); + else if (!stricmp(c, "set")) BuildSet(nullptr, initpos, sectp, inita, nNetPlayerCount); + else if (!stricmp(c, "queen")) BuildQueen(nullptr, initpos, sectp, inita, nNetPlayerCount); + else if (!stricmp(c, "roach")) BuildRoach(0, nullptr, initpos, sectp, inita); + else if (!stricmp(c, "roach2")) BuildRoach(1, nullptr, initpos, sectp, inita); + else if (!stricmp(c, "wasp")) BuildWasp(nullptr, initpos.plusZ(-100), sectp, inita, false); + else if (!stricmp(c, "scorp")) BuildScorp(nullptr, initpos, sectp, inita, nNetPlayerCount); + else if (!stricmp(c, "rat")) BuildRat(nullptr, initpos, sectp, inita); else Printf("Unknown creature type %s\n", c); return CCMD_OK; } diff --git a/source/games/exhumed/src/queen.cpp b/source/games/exhumed/src/queen.cpp index c8fc8df70..1545bf8d0 100644 --- a/source/games/exhumed/src/queen.cpp +++ b/source/games/exhumed/src/queen.cpp @@ -651,7 +651,7 @@ void AIQueenEgg::Tick(RunListEvent* ev) pEgg->nCounter--; if (pEgg->nCounter <= 0) { - auto pWaspSprite = BuildWasp(nullptr, pActor->int_pos().X, pActor->int_pos().Y, pActor->int_pos().Z, pActor->sector(), pActor->int_ang(), true); + auto pWaspSprite = BuildWasp(nullptr, pActor->spr.pos, pActor->sector(), pActor->int_ang(), true); pActor->set_int_z(pWaspSprite->int_pos().Z); DestroyEgg(nEgg); @@ -1095,7 +1095,7 @@ void AIQueenHead::Draw(RunListEvent* ev) seq_PlotSequence(ev->nParam, nSeq, QueenHead.nFrame, edx); } -void BuildQueen(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle, int nChannel) +void BuildQueen(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, int nAngle, int nChannel) { QueenCount--; @@ -1107,17 +1107,15 @@ void BuildQueen(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, if (pActor == nullptr) { pActor = insertActor(pSector, 121); - } - else - { - ChangeActorStat(pActor, 121); - x = pActor->int_pos().X; - y = pActor->int_pos().Y; - z = pActor->sector()->int_floorz(); + pActor->spr.pos = pos; + } + else + { + ChangeActorStat(pActor, 121); + pActor->spr.pos.Z = pActor->sector()->floorz; nAngle = pActor->int_ang(); } - pActor->set_int_pos({ x, y, z }); pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; pActor->spr.pal = 0; pActor->spr.shade = -12; diff --git a/source/games/exhumed/src/rat.cpp b/source/games/exhumed/src/rat.cpp index 28903ee6a..f4a1b5c5c 100644 --- a/source/games/exhumed/src/rat.cpp +++ b/source/games/exhumed/src/rat.cpp @@ -73,23 +73,20 @@ void SetRatVel(DExhumedActor* pActor) pActor->spr.yvel = bsin(pActor->int_ang(), -2); } -void BuildRat(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle) +void BuildRat(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, int nAngle) { - if (pActor == nullptr) - { - pActor = insertActor(pSector, 108); - } - else - { - x = pActor->int_pos().X; - y = pActor->int_pos().Y; - z = pActor->int_pos().Z; - nAngle = pActor->int_ang(); + if (pActor == nullptr) + { + pActor = insertActor(pSector, 108); + pActor->spr.pos = pos; + } + else + { + ChangeActorStat(pActor, 108); + pActor->spr.pos.Z = pActor->sector()->floorz; + nAngle = pActor->int_ang(); + } - ChangeActorStat(pActor, 108); - } - - pActor->set_int_pos({ x, y, z }); pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; pActor->spr.shade = -12; pActor->spr.xoffset = 0; diff --git a/source/games/exhumed/src/rex.cpp b/source/games/exhumed/src/rex.cpp index 10a86c624..4543de956 100644 --- a/source/games/exhumed/src/rex.cpp +++ b/source/games/exhumed/src/rex.cpp @@ -37,23 +37,20 @@ static actionSeq RexSeq[] = { {28, 1} }; -void BuildRex(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle, int nChannel) +void BuildRex(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, int nAngle, int nChannel) { if (pActor == nullptr) { pActor = insertActor(pSector, 119); - } - else - { - x = pActor->int_pos().X; - y = pActor->int_pos().Y; - z = pActor->sector()->int_floorz(); - nAngle = pActor->int_ang(); - + pActor->spr.pos = pos; + } + else + { + nAngle = pActor->int_ang(); + pActor->spr.pos.Z = pActor->sector()->floorz; ChangeActorStat(pActor, 119); } - pActor->set_int_pos({ x, y, z }); pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; pActor->spr.clipdist = 80; pActor->spr.shade = -12; diff --git a/source/games/exhumed/src/roach.cpp b/source/games/exhumed/src/roach.cpp index b05a1c7fe..0fe89208a 100644 --- a/source/games/exhumed/src/roach.cpp +++ b/source/games/exhumed/src/roach.cpp @@ -35,22 +35,20 @@ static actionSeq RoachSeq[] = { }; // TODO - make nType a bool? -void BuildRoach(int nType, DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int angle) +void BuildRoach(int nType, DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, int angle) { - if (pActor == nullptr) - { - pActor = insertActor(pSector, 105); - } - else - { - ChangeActorStat(pActor, 105); - x = pActor->int_pos().X; - y = pActor->int_pos().Y; - z = pActor->sector()->int_floorz(); - angle = pActor->int_ang(); - } + if (pActor == nullptr) + { + pActor = insertActor(pSector, 105); + pActor->spr.pos = pos; + } + else + { + ChangeActorStat(pActor, 105); + pActor->spr.pos.Z = pActor->sector()->floorz; + angle = pActor->int_ang(); + } - pActor->set_int_pos({ x, y, z }); pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; pActor->spr.shade = -12; pActor->spr.xoffset = 0; diff --git a/source/games/exhumed/src/scorp.cpp b/source/games/exhumed/src/scorp.cpp index 1729b7683..31f6a048c 100644 --- a/source/games/exhumed/src/scorp.cpp +++ b/source/games/exhumed/src/scorp.cpp @@ -38,23 +38,20 @@ static actionSeq ScorpSeq[] = { {53, 1} }; -void BuildScorp(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle, int nChannel) +void BuildScorp(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, int nAngle, int nChannel) { - if (pActor == nullptr) - { - pActor = insertActor(pSector, 122); - } - else - { - ChangeActorStat(pActor, 122); + if (pActor == nullptr) + { + pActor = insertActor(pSector, 122); + pActor->spr.pos = pos; + } + else + { + ChangeActorStat(pActor, 122); + pActor->spr.pos.Z = pActor->sector()->floorz; + nAngle = pActor->int_ang(); + } - x = pActor->int_pos().X; - y = pActor->int_pos().Y; - z = pActor->sector()->int_floorz(); - nAngle = pActor->int_ang(); - } - - pActor->set_int_pos({ x, y, z }); pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; pActor->spr.clipdist = 70; pActor->spr.shade = -12; @@ -367,7 +364,7 @@ void AIScorp::Tick(RunListEvent* ev) return; } - auto pSpiderActor = BuildSpider(nullptr, pActor->int_pos().X, pActor->int_pos().Y, pActor->int_pos().Z, pActor->sector(), pActor->int_ang()); + auto pSpiderActor = BuildSpider(nullptr, pActor->spr.pos, pActor->sector(), pActor->int_ang()); if (pSpiderActor) { pSpiderActor->set_int_ang(RandomSize(11)); diff --git a/source/games/exhumed/src/set.cpp b/source/games/exhumed/src/set.cpp index b20372319..4cf2fc803 100644 --- a/source/games/exhumed/src/set.cpp +++ b/source/games/exhumed/src/set.cpp @@ -39,22 +39,20 @@ static actionSeq SetSeq[] = { {74, 1} }; -void BuildSet(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle, int nChannel) +void BuildSet(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, int nAngle, int nChannel) { if (pActor == nullptr) { pActor = insertActor(pSector, 120); + pActor->spr.pos = pos; } else { ChangeActorStat(pActor, 120); - x = pActor->int_pos().X; - y = pActor->int_pos().Y; - z = pActor->sector()->int_floorz(); + pActor->spr.pos.Z = pActor->sector()->floorz; nAngle = pActor->int_ang(); } - pActor->set_int_pos({ x, y, z }); pActor->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; pActor->spr.shade = -12; pActor->spr.clipdist = 110; diff --git a/source/games/exhumed/src/spider.cpp b/source/games/exhumed/src/spider.cpp index 4ad146087..9b5a623d5 100644 --- a/source/games/exhumed/src/spider.cpp +++ b/source/games/exhumed/src/spider.cpp @@ -36,23 +36,21 @@ static actionSeq SpiderSeq[] = { }; -DExhumedActor* BuildSpider(DExhumedActor* spp, int x, int y, int z, sectortype* pSector, int nAngle) +DExhumedActor* BuildSpider(DExhumedActor* spp, const DVector3& pos, sectortype* pSector, int nAngle) { if (spp == nullptr) { spp = insertActor(pSector, 99); + spp->spr.pos = pos; } else { ChangeActorStat(spp, 99); - x = spp->int_pos().X; - y = spp->int_pos().Y; - z = spp->sector()->int_floorz(); + spp->spr.pos.Z = spp->sector()->floorz; nAngle = spp->int_ang(); } - spp->set_int_pos({ x, y, z }); spp->spr.cstat = CSTAT_SPRITE_BLOCK_ALL; spp->spr.shade = -12; spp->spr.clipdist = 15; diff --git a/source/games/exhumed/src/wasp.cpp b/source/games/exhumed/src/wasp.cpp index 52f0af036..7938482b1 100644 --- a/source/games/exhumed/src/wasp.cpp +++ b/source/games/exhumed/src/wasp.cpp @@ -40,13 +40,13 @@ void SetWaspVel(DExhumedActor* pActor) pActor->spr.yvel = bsin(pActor->int_ang()); } -DExhumedActor* BuildWasp(DExhumedActor* pActor, int x, int y, int z, sectortype* pSector, int nAngle, bool bEggWasp) +DExhumedActor* BuildWasp(DExhumedActor* pActor, const DVector3& pos, sectortype* pSector, int nAngle, bool bEggWasp) { if (pActor == nullptr) { pActor = insertActor(pSector, 107); - pActor->set_int_pos({ x, y, z }); + pActor->spr.pos = pos; } else {