diff --git a/source/common/rendering/hwrenderer/data/hw_aabbtree.cpp b/source/common/rendering/hwrenderer/data/hw_aabbtree.cpp index 20a1d39a1..5afcbac3a 100644 --- a/source/common/rendering/hwrenderer/data/hw_aabbtree.cpp +++ b/source/common/rendering/hwrenderer/data/hw_aabbtree.cpp @@ -53,7 +53,7 @@ TArray LevelAABBTree::FindNodePath(unsigned int line, unsigned int node) return path; } -double LevelAABBTree::RayTest(const DVector3 &ray_start, const DVector3 &ray_end) +double LevelAABBTree::RayTest(const DVector2 &ray_start, const DVector2 &ray_end) { // Precalculate some of the variables used by the ray/line intersection test DVector2 raydelta = ray_end - ray_start; diff --git a/source/common/rendering/hwrenderer/data/hw_aabbtree.h b/source/common/rendering/hwrenderer/data/hw_aabbtree.h index 2bd0e1506..fce75d994 100644 --- a/source/common/rendering/hwrenderer/data/hw_aabbtree.h +++ b/source/common/rendering/hwrenderer/data/hw_aabbtree.h @@ -49,7 +49,7 @@ protected: public: // Shoot a ray from ray_start to ray_end and return the closest hit as a fractional value between 0 and 1. Returns 1 if no line was hit. - double RayTest(const DVector3 &ray_start, const DVector3 &ray_end); + double RayTest(const DVector2 &ray_start, const DVector2 &ray_end); const void *Nodes() const { return nodes.Data(); } const void *Lines() const { return treelines.Data(); } diff --git a/source/common/rendering/hwrenderer/data/hw_shadowmap.cpp b/source/common/rendering/hwrenderer/data/hw_shadowmap.cpp index e53609840..9f809a767 100644 --- a/source/common/rendering/hwrenderer/data/hw_shadowmap.cpp +++ b/source/common/rendering/hwrenderer/data/hw_shadowmap.cpp @@ -83,7 +83,7 @@ CUSTOM_CVAR(Int, gl_shadowmap_quality, 512, CVAR_ARCHIVE | CVAR_GLOBALCONFIG) } } -bool IShadowMap::ShadowTest(const DVector3 &lpos, const DVector3 &pos) +bool IShadowMap::ShadowTest(const DVector2 &lpos, const DVector2 &pos) { if (mAABBTree && gl_light_shadowmap) return mAABBTree->RayTest(lpos, pos) >= 1.0f; diff --git a/source/common/rendering/hwrenderer/data/hw_shadowmap.h b/source/common/rendering/hwrenderer/data/hw_shadowmap.h index 3bc2eb98f..ae2ceed90 100644 --- a/source/common/rendering/hwrenderer/data/hw_shadowmap.h +++ b/source/common/rendering/hwrenderer/data/hw_shadowmap.h @@ -17,7 +17,7 @@ public: void Reset(); // Test if a world position is in shadow relative to the specified light and returns false if it is - bool ShadowTest(const DVector3 &lpos, const DVector3 &pos); + bool ShadowTest(const DVector2 &lpos, const DVector2 &pos); static cycle_t UpdateCycles; static int LightsProcessed; diff --git a/source/common/utility/vectors.h b/source/common/utility/vectors.h index a7bc2b2f3..352c161c0 100644 --- a/source/common/utility/vectors.h +++ b/source/common/utility/vectors.h @@ -88,11 +88,6 @@ struct TVector2 TVector2(const TVector2 &other) = default; - TVector2 (const TVector3 &other) // Copy the X and Y from the 3D vector and discard the Z - : X(other.X), Y(other.Y) - { - } - TVector2(vec_t *o) : X(o[0]), Y(o[1]) { diff --git a/source/core/gamefuncs.cpp b/source/core/gamefuncs.cpp index 1975d94c2..5d300712d 100644 --- a/source/core/gamefuncs.cpp +++ b/source/core/gamefuncs.cpp @@ -559,7 +559,7 @@ double intersectWallSprite(DCoreActor* actor, const DVector3& start, const DVect { DVector2 points[2]; - GetWallSpritePosition(&actor->spr, actor->spr.pos, points, false); + GetWallSpritePosition(&actor->spr, actor->spr.pos.XY(), points, false); points[1] -= points[0]; if ((actor->spr.cstat & CSTAT_SPRITE_ONE_SIDE)) //check for back side of one way sprite @@ -617,7 +617,7 @@ double intersectFloorSprite(DCoreActor* actor, const DVector3& start, const DVec } DVector2 points[4]; - GetFlatSpritePosition(actor, actor->spr.pos, points, nullptr, false); + GetFlatSpritePosition(actor, actor->spr.pos.XY(), points, nullptr, false); double factor = (actor->spr.pos.Z - start.Z) / direction.Z; if (factor <= 0 || factor > maxfactor) return -1; result = start + factor * direction; @@ -635,7 +635,7 @@ double intersectSlopeSprite(DCoreActor* actor, const DVector3& start, const DVec { DVector2 points[4]; double ptz[4]; - GetFlatSpritePosition(actor, actor->spr.pos, points, ptz, false); + GetFlatSpritePosition(actor, actor->spr.pos.XY(), points, ptz, false); DVector3 pt1(points[0], ptz[0]); DVector3 pt2(points[1], ptz[1]); DVector3 pt3(points[2], ptz[2]); @@ -854,8 +854,8 @@ bool checkRangeOfWall(walltype* wal, EWallFlags flagmask, const DVector3& pos, d auto pos2 = wal->point2Wall()->pos; // Checks borrowed from GZDoom. - DVector2 boxtl = pos - DVector2(maxdist, maxdist); - DVector2 boxbr = pos + DVector2(maxdist, maxdist); + DVector2 boxtl = pos.XY() - DVector2(maxdist, maxdist); + DVector2 boxbr = pos.XY() + DVector2(maxdist, maxdist); if (!BoxInRange(boxtl, boxbr, pos1, pos2)) return false; if (BoxOnLineSide(boxtl, boxbr, pos1, pos2 - pos1) != -1) return false; @@ -1211,7 +1211,7 @@ int pushmove(DVector3& pos, sectortype** pSect, double walldist, double ceildist for (int t = 0; t < 16; t++) { pos += dv; - if (IsCloseToWall(pos, wal, (walldist - 0.25)) == EClose::Outside) break; + if (IsCloseToWall(pos.XY(), wal, (walldist - 0.25)) == EClose::Outside) break; } pushed = true; diff --git a/source/core/rendering/scene/hw_drawinfo.cpp b/source/core/rendering/scene/hw_drawinfo.cpp index 7a482603b..7c4654df5 100644 --- a/source/core/rendering/scene/hw_drawinfo.cpp +++ b/source/core/rendering/scene/hw_drawinfo.cpp @@ -380,8 +380,8 @@ void HWDrawInfo::CreateScene(bool portal) if(!portal) mClipper->SetVisibleRange(vp.RotAngle, a1); - if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, vp.Pos, vp.RotAngle - a1, vp.RotAngle + a1); - else mDrawer.Init(this, mClipper, vp.Pos, 0, 0); + if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, vp.Pos.XY(), vp.RotAngle - a1, vp.RotAngle + a1); + else mDrawer.Init(this, mClipper, vp.Pos.XY(), 0, 0); if (vp.SectNums) mDrawer.RenderScene(vp.SectNums, vp.SectCount, portal); else @@ -417,8 +417,8 @@ void HWDrawInfo::CreateScene(bool portal) if (eff.geosector[i] == drawsectp) drawsectp = eff.geosectorwarp[i]; } - if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, vp.Pos, vp.RotAngle - a1, vp.RotAngle + a1); - else mDrawer.Init(this, mClipper, vp.Pos, 0, 0); + if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, vp.Pos.XY(), vp.RotAngle - a1, vp.RotAngle + a1); + else mDrawer.Init(this, mClipper, vp.Pos.XY(), 0, 0); int drawsect = sectindex(drawsectp); mDrawer.RenderScene(&drawsect, 1, false); @@ -449,8 +449,8 @@ void HWDrawInfo::CreateScene(bool portal) if (eff.geosector[i] == orgdrawsectp) drawsectp = eff.geosectorwarp2[i]; } - if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, vp.Pos, vp.RotAngle - a1, vp.RotAngle + a1); - else mDrawer.Init(this, mClipper, vp.Pos, 0, 0); + if (a1 != 0xffffffff) mDrawer.Init(this, mClipper, vp.Pos.XY(), vp.RotAngle - a1, vp.RotAngle + a1); + else mDrawer.Init(this, mClipper, vp.Pos.XY(), 0, 0); drawsect = sectindex(drawsectp); mDrawer.RenderScene(&drawsect, 1, false); diff --git a/source/core/rendering/scene/hw_portal.cpp b/source/core/rendering/scene/hw_portal.cpp index 0e2badba0..52731ab89 100644 --- a/source/core/rendering/scene/hw_portal.cpp +++ b/source/core/rendering/scene/hw_portal.cpp @@ -472,7 +472,7 @@ bool P_ClipLineToPortal(walltype* line, walltype* portal, DVector2 view) int HWLinePortal::ClipSeg(walltype *seg, const DVector3 &viewpos) { - return P_ClipLineToPortal(seg, line, viewpos) ? PClip_InFront : PClip_Inside; + return P_ClipLineToPortal(seg, line, viewpos.XY()) ? PClip_InFront : PClip_Inside; } int HWLinePortal::ClipSector(sectortype *sub) @@ -607,7 +607,7 @@ bool HWLineToLinePortal::Setup(HWDrawInfo *di, FRenderState &rstate, Clipper *cl auto destcenter = line->center(); destcenter.Y = -destcenter.Y; - DVector2 npos = vp.Pos - srccenter + destcenter; + DVector2 npos = vp.Pos.XY() - srccenter + destcenter; #if 0 // Blood does not rotate these. Needs map checking to make sure it can be added. int dx = origin->point2Wall()->x - origin->x; @@ -674,7 +674,7 @@ bool HWLineToSpritePortal::Setup(HWDrawInfo* di, FRenderState& rstate, Clipper* auto srccenter = origin->center(); srccenter.Y = -srccenter.Y; DVector2 destcenter = { camera->spr.pos.X, -camera->spr.pos.Y }; - DVector2 npos = vp.Pos - srccenter + destcenter; + DVector2 npos = vp.Pos.XY() - srccenter + destcenter; double origx = vp.Pos.X; double origy = vp.Pos.Y; diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 7804a9011..3b8bf3c0e 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -5084,11 +5084,11 @@ void MoveDude(DBloodActor* actor) switch (tileGetSurfType(floorColl)) { case kSurfWater: - gFX.fxSpawnActor(FX_9, actor->sector(), DVector3(actor->spr.pos, floorZ)); + gFX.fxSpawnActor(FX_9, actor->sector(), DVector3(actor->spr.pos.XY(), floorZ)); break; case kSurfLava: { - auto pFX = gFX.fxSpawnActor(FX_10, actor->sector(), DVector3(actor->spr.pos, floorZ)); + auto pFX = gFX.fxSpawnActor(FX_10, actor->sector(), DVector3(actor->spr.pos.XY(), floorZ)); if (pFX) { for (int i = 0; i < 7; i++) diff --git a/source/games/blood/src/aicult.cpp b/source/games/blood/src/aicult.cpp index b07a186e7..bcc9d94d8 100644 --- a/source/games/blood/src/aicult.cpp +++ b/source/games/blood/src/aicult.cpp @@ -278,7 +278,7 @@ static void cultThinkChase(DBloodActor* actor) && (target->spr.flags & 2) && gGameOptions.nDifficulty > 2 && target->IsPlayerActor() && getPlayer(target)->isRunning && Chance(0x8000)) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: @@ -299,7 +299,7 @@ static void cultThinkChase(DBloodActor* actor) } else if (nDist < 0x460 && nDeltaAngle < DAngle1 * 5) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: @@ -346,7 +346,7 @@ static void cultThinkChase(DBloodActor* actor) && (target->spr.flags & 2) && gGameOptions.nDifficulty >= 2 && target->IsPlayerActor() && !getPlayer(target)->isRunning && Chance(0x8000)) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: @@ -367,7 +367,7 @@ static void cultThinkChase(DBloodActor* actor) } else if (nDist < 0x320 && nDeltaAngle < DAngle1 * 5) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: @@ -414,7 +414,7 @@ static void cultThinkChase(DBloodActor* actor) && (target->spr.flags & 2) && gGameOptions.nDifficulty > 2 && target->IsPlayerActor() && getPlayer(target)->isRunning && Chance(0x8000)) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: @@ -436,7 +436,7 @@ static void cultThinkChase(DBloodActor* actor) else if (nDist < 0x320 && nDeltaAngle < DAngle1 * 5) { AISTATE *pCultistTsProneFire = !cl_bloodvanillaenemies && !VanillaMode() ? &cultistTsProneFireFixed : &cultistTsProneFire; - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: @@ -481,7 +481,7 @@ static void cultThinkChase(DBloodActor* actor) case kDudeCultistTNT: if (nDist < 0x2c0 && nDist > 0x140 && nDeltaAngle < DAngle15 && (target->spr.flags & 2) && target->IsPlayerActor()) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: @@ -501,7 +501,7 @@ static void cultThinkChase(DBloodActor* actor) } else if (nDist < 0x140 && nDeltaAngle < DAngle15 && (target->spr.flags & 2) && target->IsPlayerActor()) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: @@ -525,7 +525,7 @@ static void cultThinkChase(DBloodActor* actor) && (target->spr.flags & 2) && gGameOptions.nDifficulty > 2 && target->IsPlayerActor() && getPlayer(target)->isRunning && Chance(0x8000)) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: @@ -546,7 +546,7 @@ static void cultThinkChase(DBloodActor* actor) } else if (nDist < 0x320 && abs(nDeltaAngle) < DAngle1 * 5) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dvec.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 6cd8a1541..84d056c3c 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -486,7 +486,7 @@ static void unicultThinkChase(DBloodActor* actor) if (inAttack(actor->xspr.aiState)) velocity.X = velocity.Y = max(actor->clipdist, 0.5) / 32768; - aiGenDudeChooseDirection(actor, nAngle, velocity); + aiGenDudeChooseDirection(actor, nAngle, velocity.XY()); GENDUDEEXTRA* pExtra = &actor->genDudeExtra; if (!pExtra->canAttack) diff --git a/source/games/blood/src/aizombf.cpp b/source/games/blood/src/aizombf.cpp index 8d94e46dd..2fbe7393b 100644 --- a/source/games/blood/src/aizombf.cpp +++ b/source/games/blood/src/aizombf.cpp @@ -136,7 +136,7 @@ static void zombfThinkChase(DBloodActor* actor) aiSetTarget(actor, actor->GetTarget()); if (nDist < 0x100 && nDist > 0xe0 && abs(nDeltaAngle) < DAngle15) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dv, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dv.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: @@ -155,7 +155,7 @@ static void zombfThinkChase(DBloodActor* actor) } else if (nDist < 0x140 && nDist > 0x60 && nDeltaAngle < DAngle15) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dv, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dv.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: @@ -174,7 +174,7 @@ static void zombfThinkChase(DBloodActor* actor) } else if (nDist < 0x40 && nDeltaAngle < DAngle15) { - int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dv, 0), CLIPMASK1, 0); + int hit = HitScan(actor, actor->spr.pos.Z, DVector3(dv.XY(), 0), CLIPMASK1, 0); switch (hit) { case -1: diff --git a/source/games/blood/src/callback.cpp b/source/games/blood/src/callback.cpp index 375b258c1..1cec0db8c 100644 --- a/source/games/blood/src/callback.cpp +++ b/source/games/blood/src/callback.cpp @@ -452,7 +452,7 @@ void fxBloodBits(DBloodActor* actor, sectortype*) // 14 DAngle nAngle = RandomAngle(); int nDist = Random(16); auto pos = actor->spr.pos + nAngle.ToVector() * nDist * 4; - gFX.fxSpawnActor(FX_48, actor->sector(), DVector3(pos, actor->spr.pos.Z)); + gFX.fxSpawnActor(FX_48, actor->sector(), DVector3(pos.XY(), actor->spr.pos.Z)); if (actor->spr.Angles.Yaw == DAngle180) { int nChannel = 28 + (actor->GetIndex() & 2); // this is a little stupid... @@ -460,7 +460,7 @@ void fxBloodBits(DBloodActor* actor, sectortype*) // 14 } if (Chance(0x5000)) { - auto pFX = gFX.fxSpawnActor(FX_36, actor->sector(), DVector3(pos, floorZ - 0.25)); + auto pFX = gFX.fxSpawnActor(FX_36, actor->sector(), DVector3(pos.XY(), floorZ - 0.25)); if (pFX) pFX->spr.Angles.Yaw = nAngle; } diff --git a/source/games/blood/src/nnexts.cpp b/source/games/blood/src/nnexts.cpp index e4b10f655..6fb3d1aa6 100644 --- a/source/games/blood/src/nnexts.cpp +++ b/source/games/blood/src/nnexts.cpp @@ -1837,7 +1837,7 @@ void debrisMove(int listIndex) if ((floorColl.actor()->spr.cstat & CSTAT_SPRITE_ALIGNMENT_MASK) == 0) { - actor->vel.XY() += (actor->spr.pos - floorColl.actor()->spr.pos) / 4096.; + actor->vel.XY() += (actor->spr.pos.XY() - floorColl.actor()->spr.pos.XY()) / 4096.; return; } } @@ -8238,10 +8238,10 @@ void aiPatrolAlarmLite(DBloodActor* actor, DBloodActor* targetactor) double eaz2 = (getDudeInfo(targetactor)->eyeHeight * targetactor->spr.scale.Y); double nDist = (dudeactor->spr.pos.XY() - actor->spr.pos.XY()).LengthSquared(); - if (nDist >= kPatrolAlarmSeeDistSq || !cansee(DVector3(actor->spr.pos, zt1), actor->sector(), dudeactor->spr.pos.plusZ(-eaz2), dudeactor->sector())) + if (nDist >= kPatrolAlarmSeeDistSq || !cansee(DVector3(actor->spr.pos.XY(), zt1), actor->sector(), dudeactor->spr.pos.plusZ(-eaz2), dudeactor->sector())) { nDist = (dudeactor->spr.pos.XY() - targetactor->spr.pos.XY()).LengthSquared(); - if (nDist >= kPatrolAlarmSeeDistSq || !cansee(DVector3(targetactor->spr.pos, zt2), targetactor->sector(), dudeactor->spr.pos.plusZ(-eaz2), dudeactor->sector())) + if (nDist >= kPatrolAlarmSeeDistSq || !cansee(DVector3(targetactor->spr.pos.XY(), zt2), targetactor->sector(), dudeactor->spr.pos.plusZ(-eaz2), dudeactor->sector())) continue; } diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 3bb02cb1c..3189afaa0 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -906,7 +906,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec if (actor->spr.cstat & CSTAT_SPRITE_MOVE_FORWARD) { - auto spot = rotatepoint(pivot, actor->basePoint, ptang_w2); + auto spot = rotatepoint(pivot, actor->basePoint.XY(), ptang_w2); viewBackupSpriteLoc(actor); actor->spr.pos.XY() = spot + pt_w2 - pivot; actor->spr.Angles.Yaw += angleofs; @@ -917,7 +917,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec // fix Y arg in RotatePoint for reverse (green) moving sprites. (Original Blood bug?) DVector2 pivotDy(pivot.X, gModernMap ? pivot.Y : pivot.X); - auto spot = rotatepoint(pivotDy, actor->basePoint, ptang_w2); + auto spot = rotatepoint(pivotDy, actor->basePoint.XY(), ptang_w2); viewBackupSpriteLoc(actor); actor->spr.pos.XY() = spot - pt_w2 + pivot; actor->spr.Angles.Yaw += angleofs; @@ -956,7 +956,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec if (ac->spr.cstat & CSTAT_SPRITE_MOVE_FORWARD) { - auto spot = rotatepoint(pivot, ac->basePoint, ptang_w2); + auto spot = rotatepoint(pivot, ac->basePoint.XY(), ptang_w2); viewBackupSpriteLoc(ac); ac->spr.pos.XY() = spot + pt_w2 - pivot; ac->spr.Angles.Yaw += angleofs; @@ -964,7 +964,7 @@ void TranslateSector(sectortype* pSector, double wave1, double wave2, const DVec } else if (ac->spr.cstat & CSTAT_SPRITE_MOVE_REVERSE) { - auto spot = rotatepoint(pivot, ac->basePoint, ptang_w2); + auto spot = rotatepoint(pivot, ac->basePoint.XY(), ptang_w2); viewBackupSpriteLoc(ac); ac->spr.pos.XY() = spot - pt_w2 + pivot; ac->spr.Angles.Yaw += angleofs; @@ -1360,7 +1360,7 @@ int HDoorBusy(sectortype* pSector, unsigned int a2, DBloodActor* initiator) if (!pXSector->marker0 || !pXSector->marker1) return 0; auto marker0 = pXSector->marker0; auto marker1 = pXSector->marker1; - TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->spr.pos, marker0->spr.pos, marker0->spr.Angles.Yaw, marker1->spr.pos, marker1->spr.Angles.Yaw, pSector->type == kSectorSlide); + TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->spr.pos.XY(), marker0->spr.pos.XY(), marker0->spr.Angles.Yaw, marker1->spr.pos.XY(), marker1->spr.Angles.Yaw, pSector->type == kSectorSlide); ZTranslateSector(pSector, pXSector, a2, nWave); pXSector->busy = a2; if (pXSector->command == kCmdLink && pXSector->txID) @@ -1391,7 +1391,7 @@ int RDoorBusy(sectortype* pSector, unsigned int a2, DBloodActor* initiator) nWave = pXSector->busyWaveB; if (!pXSector->marker0) return 0; auto marker0 = pXSector->marker0; - TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->spr.pos, marker0->spr.pos, nullAngle, marker0->spr.pos, marker0->spr.Angles.Yaw, pSector->type == kSectorRotate); + TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->spr.pos.XY(), marker0->spr.pos.XY(), nullAngle, marker0->spr.pos.XY(), marker0->spr.Angles.Yaw, pSector->type == kSectorRotate); ZTranslateSector(pSector, pXSector, a2, nWave); pXSector->busy = a2; if (pXSector->command == kCmdLink && pXSector->txID) @@ -1424,13 +1424,13 @@ int StepRotateBusy(sectortype* pSector, unsigned int a2, DBloodActor* initiator) { ang2 = ang1 + marker0->spr.Angles.Yaw; int nWave = pXSector->busyWaveA; - TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->spr.pos, marker0->spr.pos, ang1, marker0->spr.pos, ang2, true); + TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->spr.pos.XY(), marker0->spr.pos.XY(), ang1, marker0->spr.pos.XY(), ang2, true); } else { ang2 = ang1 - marker0->spr.Angles.Yaw; int nWave = pXSector->busyWaveB; - TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->spr.pos, marker0->spr.pos, ang2, marker0->spr.pos, ang1, true); + TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), marker0->spr.pos.XY(), marker0->spr.pos.XY(), ang2, marker0->spr.pos.XY(), ang1, true); } pXSector->busy = a2; if (pXSector->command == kCmdLink && pXSector->txID) @@ -1484,7 +1484,7 @@ int PathBusy(sectortype* pSector, unsigned int a2, DBloodActor* initiator) if (!basepath || !marker0 || !marker1) return 0; int nWave = marker0->xspr.wave; - TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), basepath->spr.pos, marker0->spr.pos, marker0->spr.Angles.Yaw, marker1->spr.pos, marker1->spr.Angles.Yaw, true); + TranslateSector(pSector, GetWaveValue(pXSector->busy, nWave), GetWaveValue(a2, nWave), basepath->spr.pos.XY(), marker0->spr.pos.XY(), marker0->spr.Angles.Yaw, marker1->spr.pos.XY(), marker1->spr.Angles.Yaw, true); ZTranslateSector(pSector, pXSector, a2, nWave); pXSector->busy = a2; if ((a2 & 0xffff) == 0) @@ -2324,9 +2324,9 @@ void trInit(TArray& actors) { auto marker0 = pXSector->marker0; auto marker1 = pXSector->marker1; - TranslateSector(pSector, 0, -1, marker0->spr.pos, marker0->spr.pos, marker0->spr.Angles.Yaw, marker1->spr.pos, marker1->spr.Angles.Yaw, pSector->type == kSectorSlide); + TranslateSector(pSector, 0, -1, marker0->spr.pos.XY(), marker0->spr.pos.XY(), marker0->spr.Angles.Yaw, marker1->spr.pos.XY(), marker1->spr.Angles.Yaw, pSector->type == kSectorSlide); UpdateBasePoints(pSector); - TranslateSector(pSector, 0, FixedToFloat(pXSector->busy), marker0->spr.pos, marker0->spr.pos, marker0->spr.Angles.Yaw, marker1->spr.pos, marker1->spr.Angles.Yaw, pSector->type == kSectorSlide); + TranslateSector(pSector, 0, FixedToFloat(pXSector->busy), marker0->spr.pos.XY(), marker0->spr.pos.XY(), marker0->spr.Angles.Yaw, marker1->spr.pos.XY(), marker1->spr.Angles.Yaw, pSector->type == kSectorSlide); ZTranslateSector(pSector, pXSector, pXSector->busy, 1); break; } @@ -2334,9 +2334,9 @@ void trInit(TArray& actors) case kSectorRotate: { auto marker0 = pXSector->marker0; - TranslateSector(pSector, 0, -1, marker0->spr.pos, marker0->spr.pos, nullAngle, marker0->spr.pos, marker0->spr.Angles.Yaw, pSector->type == kSectorRotate); + TranslateSector(pSector, 0, -1, marker0->spr.pos.XY(), marker0->spr.pos.XY(), nullAngle, marker0->spr.pos.XY(), marker0->spr.Angles.Yaw, pSector->type == kSectorRotate); UpdateBasePoints(pSector); - TranslateSector(pSector, 0, FixedToFloat(pXSector->busy), marker0->spr.pos, marker0->spr.pos, nullAngle, marker0->spr.pos, marker0->spr.Angles.Yaw, pSector->type == kSectorRotate); + TranslateSector(pSector, 0, FixedToFloat(pXSector->busy), marker0->spr.pos.XY(), marker0->spr.pos.XY(), nullAngle, marker0->spr.pos.XY(), marker0->spr.Angles.Yaw, pSector->type == kSectorRotate); ZTranslateSector(pSector, pXSector, pXSector->busy, 1); break; } diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 510c0911b..638223aa4 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -1224,7 +1224,7 @@ int movesprite_ex(DDukeActor* actor, const DVector3& change, unsigned int clipty if (bg) { if (actor->spr.scale.X > 0.9375) - clipmove(ppos, &dasectp, change * 0.5, 64., 4., 4., cliptype, result); + clipmove(ppos, &dasectp, change.XY() * 0.5, 64., 4., 4., cliptype, result); else { // todo: move this mess to the actor definitions once we have them all available. @@ -1237,7 +1237,7 @@ int movesprite_ex(DDukeActor* actor, const DVector3& change, unsigned int clipty clipdist = 12; } - clipmove(ppos, &dasectp, change * 0.5, clipdist, 4., 4., cliptype, result); + clipmove(ppos, &dasectp, change.XY() * 0.5, clipdist, 4., 4., cliptype, result); } // conditional code from hell... @@ -1262,9 +1262,9 @@ int movesprite_ex(DDukeActor* actor, const DVector3& change, unsigned int clipty else { if (actor->spr.statnum == STAT_PROJECTILE) - clipmove(ppos, &dasectp, change * 0.5, 0.5, 4., 4., cliptype, result); + clipmove(ppos, &dasectp, change.XY() * 0.5, 0.5, 4., 4., cliptype, result); else - clipmove(ppos, &dasectp, change * 0.5, actor->clipdist, 4., 4., cliptype, result); + clipmove(ppos, &dasectp, change.XY() * 0.5, actor->clipdist, 4., 4., cliptype, result); } actor->spr.pos.XY() = ppos.XY(); @@ -1640,7 +1640,7 @@ void handle_se00(DDukeActor* actor) pact->spr.Angles.Yaw += ang_amount * direction; pact->spr.pos.Z += zchange; - auto result = rotatepoint(Owner->spr.pos, pact->spr.pos.XY(), ang_amount * direction); + auto result = rotatepoint(Owner->spr.pos.XY(), pact->spr.pos.XY(), ang_amount * direction); p->bobpos += (result - pact->spr.pos.XY()); pact->spr.pos.XY() = result; } @@ -1660,7 +1660,7 @@ void handle_se00(DDukeActor* actor) act2->spr.pos.Z += zchange; - auto pos = rotatepoint(Owner->spr.pos, act2->spr.pos.XY(), ang_amount * direction); + auto pos = rotatepoint(Owner->spr.pos.XY(), act2->spr.pos.XY(), ang_amount * direction); act2->spr.pos.X = pos.X; act2->spr.pos.Y = pos.Y; } diff --git a/source/games/duke/src/gameexec.cpp b/source/games/duke/src/gameexec.cpp index ee8baa612..878ecb64b 100644 --- a/source/games/duke/src/gameexec.cpp +++ b/source/games/duke/src/gameexec.cpp @@ -1451,7 +1451,7 @@ int ifcansee(DDukeActor* actor, DDukePlayer* p) { // else, they did see it. // save where we were looking.. - actor->ovel = tosee->spr.pos; + actor->ovel = tosee->spr.pos.XY(); } if (j == 1 && (actor->spr.statnum == STAT_ACTOR || actor->spr.statnum == STAT_STANDABLE)) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 93c9c1f5e..2c83bc01d 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1840,7 +1840,7 @@ HORIZONLY: ChangeActorSect(pact, p->cursector); } else - clipmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, p->vel, 10.25, 4., iif, CLIPMASK0, clip); + clipmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, p->vel.XY(), 10.25, 4., iif, CLIPMASK0, clip); if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk) p->GetActor()->spr.pos.Z += 32; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 0524f9f54..2cfe2679c 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -2722,7 +2722,7 @@ HORIZONLY: ChangeActorSect(pact, p->cursector); } else - clipmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, p->vel, 10.25, 4., iif, CLIPMASK0, clip); + clipmove(p->GetActor()->spr.pos.XY(), p->GetActor()->getOffsetZ(), &p->cursector, p->vel.XY(), 10.25, 4., iif, CLIPMASK0, clip); if (p->jetpack_on == 0 && psectlotag != 2 && psectlotag != 1 && shrunk) p->GetActor()->spr.pos.Z += 32; diff --git a/source/games/exhumed/src/move.cpp b/source/games/exhumed/src/move.cpp index c2f7b285e..1efa7afb7 100644 --- a/source/games/exhumed/src/move.cpp +++ b/source/games/exhumed/src/move.cpp @@ -173,7 +173,7 @@ static int BelowNear(DExhumedActor* pActor, const Collision& loHit, double walld { if (!search.Check(wal.nextSector())) { - if (IsCloseToWall(pActor->spr.pos, &wal, walldist) != EClose::Outside) + if (IsCloseToWall(pActor->spr.pos.XY(), &wal, walldist) != EClose::Outside) { search.Add(wal.nextSector()); } diff --git a/source/games/exhumed/src/object.cpp b/source/games/exhumed/src/object.cpp index ffe7a7438..a7898e001 100644 --- a/source/games/exhumed/src/object.cpp +++ b/source/games/exhumed/src/object.cpp @@ -2317,7 +2317,7 @@ void ProcessTrailSprite(DExhumedActor* pActor, int nLotag, int nHitag) { auto nPoint = sTrailPoint.Reserve(1); - sTrailPoint[nPoint].pos = pActor->spr.pos; + sTrailPoint[nPoint].pos = pActor->spr.pos.XY(); int nTrail = FindTrail(nHitag); diff --git a/source/games/sw/src/draw.cpp b/source/games/sw/src/draw.cpp index 45aac6fea..958feb97f 100644 --- a/source/games/sw/src/draw.cpp +++ b/source/games/sw/src/draw.cpp @@ -573,7 +573,7 @@ DSWActor* ConnectCopySprite(spritetypebase const* tsp) testz = GetSpriteZOfTop(tsp) - 10; if (testz < tsp->sectp->ceilingz) - updatesectorz(DVector3(tsp->pos, testz), &newsector); + updatesectorz(DVector3(tsp->pos.XY(), testz), &newsector); if (newsector != nullptr && newsector != tsp->sectp) { @@ -587,7 +587,7 @@ DSWActor* ConnectCopySprite(spritetypebase const* tsp) testz = GetSpriteZOfBottom(tsp) + 10; if (testz > tsp->sectp->floorz) - updatesectorz(DVector3(tsp->pos, testz), &newsector); + updatesectorz(DVector3(tsp->pos.XY(), testz), &newsector); if (newsector != nullptr && newsector != tsp->sectp) { diff --git a/source/games/sw/src/jsector.cpp b/source/games/sw/src/jsector.cpp index dcc69031a..6fc27bdeb 100644 --- a/source/games/sw/src/jsector.cpp +++ b/source/games/sw/src/jsector.cpp @@ -451,7 +451,7 @@ void JS_DrawCameras(DSWPlayer* pp, const DVector3& campos, double smoothratio) if (tex && tex->isSeen(true)) { DSWActor* camactor = mirror[cnt].camspriteActor; - DVector2 vec = camactor->spr.pos - campos.XY(); + DVector2 vec = camactor->spr.pos.XY() - campos.XY(); dist = abs(vec.X) + abs(vec.Y); diff --git a/source/games/sw/src/jweapon.cpp b/source/games/sw/src/jweapon.cpp index bc93bce48..f5c21d6ea 100644 --- a/source/games/sw/src/jweapon.cpp +++ b/source/games/sw/src/jweapon.cpp @@ -1215,7 +1215,7 @@ int SpawnRadiationCloud(DSWActor* actor) int DoRadiationCloud(DSWActor* actor) { - actor->spr.pos.XY() += actor->user.change; + actor->spr.pos.XY() += actor->user.change.XY(); actor->spr.pos.Z -= actor->vel.Z; if (actor->user.ID) diff --git a/source/games/sw/src/mclip.cpp b/source/games/sw/src/mclip.cpp index baa5d1886..919b88784 100644 --- a/source/games/sw/src/mclip.cpp +++ b/source/games/sw/src/mclip.cpp @@ -60,7 +60,7 @@ Collision MultiClipMove(DSWPlayer* pp, double zz, double floordist) // move the box to position instead of using offset- this prevents small rounding errors // allowing you to move through wall DAngle ang = (pp->GetActor()->spr.Angles.Yaw + sop->clipbox_ang[i]); - DVector3 spos(pp->GetActor()->getPosWithOffsetZ(), zz); + DVector3 spos(pp->GetActor()->spr.pos.XY(), zz); DVector2 vect = ang.ToVector() * sop->clipbox_vdist[i]; Collision coll; @@ -73,7 +73,7 @@ Collision MultiClipMove(DSWPlayer* pp, double zz, double floordist) min_dist = 0; min_ndx = i; // ox is where it should be - opos[i].XY() = pp->GetActor()->getPosWithOffsetZ() + ang.ToVector() * sop->clipbox_vdist[i]; + opos[i].XY() = pp->GetActor()->spr.pos.XY() + ang.ToVector() * sop->clipbox_vdist[i]; // spos.x is where it hit pos[i].XY() = spos.XY(); @@ -133,7 +133,7 @@ int MultiClipTurn(DSWPlayer* pp, DAngle new_ang, double zz, double floordist) { DAngle ang = new_ang + sop->clipbox_ang[i]; - DVector3 spos(pp->GetActor()->getPosWithOffsetZ(), zz); + DVector3 spos(pp->GetActor()->spr.pos.XY(), zz); DVector2 vect = ang.ToVector() * sop->clipbox_vdist[i]; Collision coll; diff --git a/source/games/sw/src/morph.cpp b/source/games/sw/src/morph.cpp index 2ca9863c7..b25ad2a0f 100644 --- a/source/games/sw/src/morph.cpp +++ b/source/games/sw/src/morph.cpp @@ -326,7 +326,7 @@ void MorphTornado(SECTOR_OBJECT* sop) return; // place at correct x,y offset from center - DVector2 pos = sop->pmid - sop->morph_off; + DVector2 pos = sop->pmid.XY() - sop->morph_off; DVector2 spos = pos; // move it from last x,y @@ -343,7 +343,7 @@ void MorphTornado(SECTOR_OBJECT* sop) } // save x,y back as offset info - sop->morph_off = sop->pmid - mpos; + sop->morph_off = sop->pmid.XY() - mpos; if ((RANDOM_P2(1024<<4)>>4) < sop->morph_rand_freq) sop->morph_ang = RandomAngle(); @@ -399,10 +399,10 @@ void MorphFloor(SECTOR_OBJECT* sop) auto pos = sop->pmid - sop->morph_off; // move it from last x,y - DVector2 mpos = pos + sop->morph_ang.ToVector() * sop->morph_speed; + DVector2 mpos = pos.XY() + sop->morph_ang.ToVector() * sop->morph_speed; // save x,y back as offset info - sop->morph_off = sop->pmid - mpos; + sop->morph_off = sop->pmid.XY() - mpos; // bound check radius if ((sop->pmid - mpos).Length() > sop->morph_dist_max) @@ -411,8 +411,8 @@ void MorphFloor(SECTOR_OBJECT* sop) sop->morph_ang = sop->morph_ang + DAngle180; // back it up and save it off - mpos = pos + sop->morph_ang.ToVector() * sop->morph_speed; - sop->morph_off = sop->pmid - mpos; + mpos = pos.XY() + sop->morph_ang.ToVector() * sop->morph_speed; + sop->morph_off = sop->pmid.XY() - mpos; } if ((RANDOM_P2(1024<<4)>>4) < sop->morph_rand_freq) diff --git a/source/games/sw/src/player.cpp b/source/games/sw/src/player.cpp index 73406a45b..9f1eb4d13 100644 --- a/source/games/sw/src/player.cpp +++ b/source/games/sw/src/player.cpp @@ -2239,7 +2239,7 @@ void DriveCrush(DSWPlayer* pp, DVector2* quad) SWSectIterator it(sop->op_main_sector); while (auto actor = it.Next()) { - if (testpointinquad(actor->spr.pos, quad)) + if (testpointinquad(actor->spr.pos.XY(), quad)) { if ((actor->spr.extra & SPRX_BREAKABLE) && HitBreakSprite(actor, 0)) continue; @@ -2274,7 +2274,7 @@ void DriveCrush(DSWPlayer* pp, DVector2* quad) SWStatIterator it2(STAT_ENEMY); while (auto actor = it.Next()) { - if (testpointinquad(actor->spr.pos, quad)) + if (testpointinquad(actor->spr.pos.XY(), quad)) { //if (actor->spr.z < pp->posz) if (actor->spr.pos.Z < sop->crush_z) @@ -2301,7 +2301,7 @@ void DriveCrush(DSWPlayer* pp, DVector2* quad) it2.Reset(STAT_DEAD_ACTOR); while (auto actor = it.Next()) { - if (testpointinquad(actor->spr.pos, quad)) + if (testpointinquad(actor->spr.pos.XY(), quad)) { if (actor->spr.pos.Z < sop->crush_z) continue; @@ -2323,7 +2323,7 @@ void DriveCrush(DSWPlayer* pp, DVector2* quad) if (actor->user.PlayerP == pp) continue; - if (testpointinquad(actor->spr.pos, quad)) + if (testpointinquad(actor->spr.pos.XY(), quad)) { int damage; @@ -2437,7 +2437,7 @@ void DoPlayerMoveVehicle(DSWPlayer* pp) if (wal.extra && (wal.extra & (WALLFX_LOOP_OUTER|WALLFX_LOOP_OUTER_SECONDARY)) == WALLFX_LOOP_OUTER) { pos[count] = wal.pos; - opos[count] = sop->pmid - sop->orig[wallcount]; + opos[count] = sop->pmid.XY() - sop->orig[wallcount]; count++; } @@ -2613,7 +2613,7 @@ void DoPlayerMoveTurret(DSWPlayer* pp) pact->spr.Angles.Yaw = new_ang; } - OperateSectorObject(pp->sop, pact->spr.Angles.Yaw, pp->sop->pmid); + OperateSectorObject(pp->sop, pact->spr.Angles.Yaw, pp->sop->pmid.XY()); if (PLAYER_MOVING(pp) == 0) pp->Flags &= ~(PF_PLAYER_MOVED); @@ -3626,7 +3626,7 @@ bool PlayerOnLadder(DSWPlayer* pp) // set players "view" distance from the ladder - needs to be farther than // the sprite - pp->LadderPosition = lActor->spr.pos + npos; + pp->LadderPosition = lActor->spr.pos.XY() + npos; pp->GetActor()->spr.Angles.Yaw = lActor->spr.Angles.Yaw + DAngle180; return true; @@ -3975,7 +3975,7 @@ void DoPlayerWarpToUnderwater(DSWPlayer* pp) auto over = over_act->sector(); auto under = under_act->sector(); - if (GetOverlapSector(pp->GetActor()->getPosWithOffsetZ(), &over, &under) == 2) + if (GetOverlapSector(pp->GetActor()->spr.pos.XY(), &over, &under) == 2) { pp->setcursector(under); } @@ -4047,7 +4047,7 @@ void DoPlayerWarpToSurface(DSWPlayer* pp) auto over = over_act->sector(); auto under = under_act->sector(); - if (GetOverlapSector(pp->GetActor()->getPosWithOffsetZ(), &over, &under)) + if (GetOverlapSector(pp->GetActor()->spr.pos.XY(), &over, &under)) { pp->setcursector(over); } @@ -4378,7 +4378,7 @@ void DoPlayerDive(DSWPlayer* pp) auto sect = pp->cursector; // check for sector above to see if it is an underwater sector also - updatesectorz(DVector3(pp->GetActor()->getPosWithOffsetZ(), pp->cursector->ceilingz - 8), §); + updatesectorz(DVector3(plActor->spr.pos.XY(), pp->cursector->ceilingz - 8), §); if (!SectorIsUnderwaterArea(sect)) { diff --git a/source/games/sw/src/rotator.cpp b/source/games/sw/src/rotator.cpp index 39d5dabfb..f9f6018fa 100644 --- a/source/games/sw/src/rotator.cpp +++ b/source/games/sw/src/rotator.cpp @@ -396,7 +396,7 @@ int DoRotator(DSWActor* actor) ndx = 0; for(auto& wal : actor->sector()->walls) { - auto nxy = rotatepoint(pivot->spr.pos, r->orig[ndx], DAngle::fromBuild(r->pos)); + auto nxy = rotatepoint(pivot->spr.pos.XY(), r->orig[ndx], DAngle::fromBuild(r->pos)); dragpoint(&wal, nxy); ndx++; diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 128e6860b..898a04827 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -1150,7 +1150,7 @@ bool TestKillSectorObject(SECTOR_OBJECT* sop) { KillMatchingCrackSprites(sop->match_event); // get new sectnums - CollapseSectorObject(sop, sop->pmid); + CollapseSectorObject(sop, sop->pmid.XY()); DoSpawnSpotsForKill(sop->match_event); KillSectorObjectSprites(sop); return true; @@ -1315,7 +1315,7 @@ void DoDeleteSpriteMatch(short match) if (actor->spr.lotag == match) { found = actor; - del = actor->spr.pos; + del = actor->spr.pos.XY(); break; } } @@ -1328,7 +1328,7 @@ void DoDeleteSpriteMatch(short match) it.Reset(StatList[stat]); while (auto actor = it.Next()) { - if (del == actor->spr.pos) + if (del == actor->spr.pos.XY()) { // special case lighting delete of Fade On/off after fades if (StatList[stat] == STAT_LIGHTING) diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 55dd15fce..aaeea601e 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -6232,7 +6232,7 @@ Collision move_sprite(DSWActor* actor, const DVector3& change, double ceildist, } - clipmove(clip_pos, &dasect, change * numtics * 0.125, actor->clipdist, ceildist, flordist, cliptype, retval, 1); + clipmove(clip_pos, &dasect, change.XY() * numtics * 0.125, actor->clipdist, ceildist, flordist, cliptype, retval, 1); actor->spr.pos.XY() = clip_pos.XY(); @@ -6451,7 +6451,7 @@ Collision move_missile(DSWActor* actor, const DVector3& change, double ceil_dist } - clipmove(clip_pos, &dasect, change * numtics * 0.125, actor->clipdist, ceil_dist, flor_dist, cliptype, retval, 1); + clipmove(clip_pos, &dasect, change.XY() * numtics * 0.125, actor->clipdist, ceil_dist, flor_dist, cliptype, retval, 1); actor->spr.pos.XY() = clip_pos.XY(); if (dasect == nullptr) diff --git a/source/games/sw/src/track.cpp b/source/games/sw/src/track.cpp index 8d5960eb1..c87483c8d 100644 --- a/source/games/sw/src/track.cpp +++ b/source/games/sw/src/track.cpp @@ -599,7 +599,7 @@ void TrackSetup(void) it.Reset(STAT_TRACK + ndx); while (auto actor = it.Next()) { - dist = Distance((tp + t->NumPoints - 1)->pos, actor->spr.pos); + dist = Distance((tp + t->NumPoints - 1)->pos.XY(), actor->spr.pos.XY()); if (dist < low_dist) { @@ -683,7 +683,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop) I_Error("SOP bound sprite with hitag %d not found", 500 + (int(sop - SectorObject) * 5)); } - DVector2 vlow = BoundActor->spr.pos; + DVector2 vlow = BoundActor->spr.pos.XY(); KillActor(BoundActor); @@ -692,7 +692,7 @@ void SectorObjectSetupBounds(SECTOR_OBJECT* sop) { I_Error("SOP bound sprite with hitag %d not found", 501 + (int(sop - SectorObject) * 5)); } - DVector2 vhigh = BoundActor->spr.pos; + DVector2 vhigh = BoundActor->spr.pos.XY(); KillActor(BoundActor); @@ -1348,7 +1348,7 @@ void PlaceSectorObjectsOnTracks(void) // move all walls in sectors for (auto& wal : sop->sectp[j]->walls) { - sop->orig[sop->num_walls] = sop->pmid - wal.pos; + sop->orig[sop->num_walls] = sop->pmid.XY() - wal.pos; sop->num_walls++; } } @@ -1367,7 +1367,7 @@ void PlaceSectorObjectsOnTracks(void) { tpoint = Track[sop->track].TrackPoint; - dist = Distance((tpoint + j)->pos, sop->pmid); + dist = Distance((tpoint + j)->pos.XY(), sop->pmid.XY()); if (dist < low_dist) { @@ -1430,7 +1430,7 @@ void PlaceActorsOnTracks(void) { tpoint = Track[actor->user.track].TrackPoint; - dist = Distance((tpoint + j)->pos, actor->spr.pos); + dist = Distance((tpoint + j)->pos.XY(), actor->spr.pos.XY()); if (dist < low_dist) { @@ -2655,7 +2655,7 @@ void DoTornadoObject(SECTOR_OBJECT* sop) } TornadoSpin(sop); - RefreshPoints(sop, pos - sop->pmid.XY(), true); + RefreshPoints(sop, pos.XY() - sop->pmid.XY(), true); } void DoAutoTurretObject(SECTOR_OBJECT* sop) @@ -2744,7 +2744,7 @@ void DoAutoTurretObject(SECTOR_OBJECT* sop) } } - OperateSectorObjectForTics(sop, sop->ang, sop->pmid, 2*synctics); + OperateSectorObjectForTics(sop, sop->ang, sop->pmid.XY(), 2*synctics); } } diff --git a/source/games/sw/src/wallmove.cpp b/source/games/sw/src/wallmove.cpp index 1e5359e94..5c6442a8b 100644 --- a/source/games/sw/src/wallmove.cpp +++ b/source/games/sw/src/wallmove.cpp @@ -123,7 +123,7 @@ int DoWallMove(DSWActor* actor) } else { - wal.move(actor->spr.pos + nvec); + wal.move(actor->spr.pos.XY() + nvec); } if (shade1) diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 137eb8621..86986341b 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -3571,7 +3571,7 @@ int DoVomit(DSWActor* actor) { actor->user.Counter = NORM_ANGLE(actor->user.Counter + (30*MISSILEMOVETICS)); // notreallypos - auto v = actor->user.pos + mapangle(actor->user.Counter).ToVector() * 12 * REPEAT_SCALE; + auto v = actor->user.pos.XY() + mapangle(actor->user.Counter).ToVector() * 12 * REPEAT_SCALE; actor->spr.scale = v; if (actor->user.Flags & (SPR_JUMPING)) { @@ -11791,7 +11791,7 @@ int InitEnemyNapalm(DSWActor* actor) for (i = 0; i < SIZ(mp); i++) { auto actorNew = SpawnActor(STAT_MISSILE, FIREBALL1, s_Napalm, actor->sector(), - DVector3(actor->spr.pos, ActorZOfTop(actor) + (ActorSizeZ(actor) * 0.25)), actor->spr.Angles.Yaw, NAPALM_VELOCITY); + DVector3(actor->spr.pos.XY(), ActorZOfTop(actor) + (ActorSizeZ(actor) * 0.25)), actor->spr.Angles.Yaw, NAPALM_VELOCITY); actorNew->spr.hitag = LUMINOUS; //Always full brightness if (i==0) // Only attach sound to first projectile @@ -11893,7 +11893,7 @@ int InitEnemyMirv(DSWActor* actor) PlaySound(DIGI_MIRVFIRE, actor, v3df_none); auto actorNew = SpawnActor(STAT_MISSILE, MIRV_METEOR, s_Mirv, actor->sector(), - DVector3(actor->spr.pos, ActorZOfTop(actor) + (ActorSizeZ(actor) * 0.25)), actor->spr.Angles.Yaw, MIRV_VELOCITY); + DVector3(actor->spr.pos.XY(), ActorZOfTop(actor) + (ActorSizeZ(actor) * 0.25)), actor->spr.Angles.Yaw, MIRV_VELOCITY); PlaySound(DIGI_MIRVWIZ, actorNew, v3df_follow); @@ -13975,7 +13975,7 @@ int InitSerpSlash(DSWActor* actor) bool WallSpriteInsideSprite(DSWActor* wactor, DSWActor* actor) { DVector2 out[2]; - GetWallSpritePosition(&wactor->spr, wactor->spr.pos, out); + GetWallSpritePosition(&wactor->spr, wactor->spr.pos.XY(), out); return IsCloseToLine(actor->spr.pos.XY(), out[0], out[1], actor->clipdist) != EClose::Outside; } @@ -16758,7 +16758,7 @@ int InitEnemyFireball(DSWActor* actor) for (int i = 0; i < 2; i++) { auto actorNew = SpawnActor(STAT_MISSILE, GORO_FIREBALL, s_Fireball, actor->sector(), - DVector3(actor->spr.pos, nz), actor->spr.Angles.Yaw, GORO_FIREBALL_VELOCITY); + DVector3(actor->spr.pos.XY(), nz), actor->spr.Angles.Yaw, GORO_FIREBALL_VELOCITY); actorNew->spr.hitag = LUMINOUS; //Always full brightness actorNew->spr.scale = DVector2(0.3125, 0.3125); @@ -16858,7 +16858,7 @@ bool WarpToUnderwater(DVector3& pos, sectortype** psectu) spos = overActor->spr.pos.XY() - pos.XY(); // update to the new x y position - pos.XY() = underActor->spr.pos - spos; + pos.XY() = underActor->spr.pos.XY() - spos; auto over = overActor->sector(); auto under = underActor->sector(); @@ -17001,7 +17001,7 @@ bool SpriteWarpToUnderwater(DSWActor* actor) auto over = overActor->sector(); auto under = underActor->sector(); - if (GetOverlapSector(actor->spr.pos, &over, &under) == 2) + if (GetOverlapSector(actor->spr.pos.XY(), &over, &under) == 2) { ChangeActorSect(actor, under); } @@ -17077,7 +17077,7 @@ bool SpriteWarpToSurface(DSWActor* actor) auto over = overActor->sector(); auto under = underActor->sector(); - if (GetOverlapSector(actor->spr.pos, &over, &under)) + if (GetOverlapSector(actor->spr.pos.XY(), &over, &under)) { ChangeActorSect(actor, over); }