From 2eb068e4a6a0a3b557b8dd20eef5c086214ecf54 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 28 Sep 2022 14:18:23 +0200 Subject: [PATCH] - deleted unused CheckProximityPoint and cleaned up earthquake calculations. --- source/games/blood/src/gameutil.cpp | 24 ------------------------ source/games/blood/src/gameutil.h | 1 - source/games/blood/src/triggers.cpp | 10 ++++------ 3 files changed, 4 insertions(+), 31 deletions(-) diff --git a/source/games/blood/src/gameutil.cpp b/source/games/blood/src/gameutil.cpp index 525652ad7..868195780 100644 --- a/source/games/blood/src/gameutil.cpp +++ b/source/games/blood/src/gameutil.cpp @@ -60,30 +60,6 @@ bool CheckProximity(DBloodActor* actor, const DVector3& pos, sectortype* pSector return 0; } -//--------------------------------------------------------------------------- -// -// -// -//--------------------------------------------------------------------------- - -bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist) -{ - int oX = abs(nX2 - nX1) >> 4; - if (oX >= nDist) - return 0; - int oY = abs(nY2 - nY1) >> 4; - if (oY >= nDist) - return 0; - if (nZ2 != nZ1) - { - int oZ = abs(nZ2 - nZ1) >> 8; - if (oZ >= nDist) - return 0; - } - if (approxDist(oX, oY) >= nDist) return 0; - return 1; -} - //--------------------------------------------------------------------------- // // Note: This function features some very bad math. diff --git a/source/games/blood/src/gameutil.h b/source/games/blood/src/gameutil.h index 702bba4c5..7e5cffea0 100644 --- a/source/games/blood/src/gameutil.h +++ b/source/games/blood/src/gameutil.h @@ -33,7 +33,6 @@ enum { bool CheckProximity(DBloodActor* pSprite, const DVector3& pos, sectortype* pSector, int nDist); -bool CheckProximityPoint(int nX1, int nY1, int nZ1, int nX2, int nY2, int nZ2, int nDist); bool IntersectRay(int wx, int wy, int wdx, int wdy, int x1, int y1, int z1, int x2, int y2, int z2, int* ix, int* iy, int* iz); int HitScan(DBloodActor* pSprite, double z, const DVector3& pos, unsigned int nMask, double range = 0); diff --git a/source/games/blood/src/triggers.cpp b/source/games/blood/src/triggers.cpp index 70e457927..e5322fba0 100644 --- a/source/games/blood/src/triggers.cpp +++ b/source/games/blood/src/triggers.cpp @@ -509,12 +509,10 @@ void OperateSprite(DBloodActor* actor, EVENT event) actor->xspr.triggerOn = 0; actor->xspr.isTriggered = 1; SetSpriteState(actor, 1, initiator); - for (int p = connecthead; p >= 0; p = connectpoint2[p]) { - auto vec = actor->int_pos() - gPlayer[p].actor->int_pos(); - int dx = (vec.X) >> 4; - int dy = (vec.Y) >> 4; - int dz = (vec.Z) >> 8; - int nDist = dx * dx + dy * dy + dz * dz + 0x40000; + for (int p = connecthead; p >= 0; p = connectpoint2[p]) + { + auto vec = actor->spr.pos - gPlayer[p].actor->spr.pos; + int nDist = int(vec.LengthSquared()) + 0x40000; gPlayer[p].quakeEffect = DivScale(actor->xspr.data1, nDist, 16); } break;