- deleted unused CheckProximityPoint and cleaned up earthquake calculations.

This commit is contained in:
Christoph Oelckers 2022-09-28 14:18:23 +02:00
parent d99ed7676b
commit 2eb068e4a6
3 changed files with 4 additions and 31 deletions

View file

@ -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.

View file

@ -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);

View file

@ -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;