SW: Fix FindDistance3D calls to not z>>4 at the call site

This is handled by the function itself now.

Fixes the distance issue with the ceiling fan.

git-svn-id: https://svn.eduke32.com/eduke32@8525 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-12-26 06:28:16 +00:00 committed by Christoph Oelckers
parent ae94566fb5
commit 3bbecf84c2
5 changed files with 18 additions and 18 deletions

View file

@ -2188,7 +2188,7 @@ DoFlagRangeTest(short Weapon, short range)
if (!FAFcansee(sp->x, sp->y, sp->z, sp->sectnum, wp->x, wp->y, wp->z, wp->sectnum))
continue;
dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, (wp->z - sp->z) >> 4);
dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, wp->z - sp->z);
if (dist > range)
continue;

View file

@ -1219,7 +1219,7 @@ DoPickTarget(SPRITEp sp, uint32_t max_delta_ang, SWBOOL skip_targets)
// Only look at closest ones
//if ((dist = Distance(sp->x, sp->y, ep->x, ep->y)) > PICK_DIST)
if ((dist = FindDistance3D(sp->x - ep->x, sp->y - ep->y, (sp->z - ep->z)>>4)) > PICK_DIST)
if ((dist = FindDistance3D(sp->x - ep->x, sp->y - ep->y, sp->z - ep->z)) > PICK_DIST)
continue;
if (skip_targets != 2) // Used for spriteinfo mode
@ -8178,7 +8178,7 @@ int SearchSpawnPosition(PLAYERp pp)
if (opp != pp) // don't test for yourself
{
if (FindDistance3D(sp->x - opp->posx, sp->y - opp->posy, (sp->z - opp->posz)>>4) < 1000)
if (FindDistance3D(sp->x - opp->posx, sp->y - opp->posy, sp->z - opp->posz) < 1000)
{
blocked = TRUE;
break;

View file

@ -200,7 +200,7 @@ void QuakeViewChange(PLAYERp pp, int *z_diff, int *x_diff, int *y_diff, short *a
{
sp = &sprite[i];
dist = FindDistance3D(pp->posx - sp->x, pp->posy - sp->y, (pp->posz - sp->z)>>4);
dist = FindDistance3D(pp->posx - sp->x, pp->posy - sp->y, pp->posz - sp->z);
// shake whole level
if (QUAKE_TestDontTaper(sp))

View file

@ -1424,7 +1424,7 @@ WeaponExplodeSectorInRange(short weapon)
sp = &sprite[i];
// test to see if explosion is close to crack sprite
dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, (wp->z - sp->z)>>4);
dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, wp->z - sp->z);
if (sp->clipdist == 0)
continue;
@ -2568,7 +2568,7 @@ int DoPlayerGrabStar(PLAYERp pp)
{
sp = &sprite[StarQueue[i]];
if (FindDistance3D(sp->x - pp->posx, sp->y - pp->posy, (sp->z - pp->posz + Z(12))>>4) < 500)
if (FindDistance3D(sp->x - pp->posx, sp->y - pp->posy, sp->z - pp->posz + Z(12)) < 500)
{
break;
}

View file

@ -7857,7 +7857,7 @@ int DoExpDamageTest(short Weapon)
{
int zdist=0;
if ((unsigned)FindDistance3D(sp->x - wp->x, sp->y - wp->y, (sp->z - wp->z)>>4) > wu->Radius + u->Radius)
if ((unsigned)FindDistance3D(sp->x - wp->x, sp->y - wp->y, sp->z - wp->z) > wu->Radius + u->Radius)
continue;
// added hitscan block because mines no long clip against actors/players
@ -7894,7 +7894,7 @@ int DoExpDamageTest(short Weapon)
if ((unsigned)dist > wu->Radius)
continue;
dist = FindDistance3D(sp->x - wp->x, sp->y - wp->y, (SPRITEp_MID(sp) - wp->z)>>4);
dist = FindDistance3D(sp->x - wp->x, sp->y - wp->y, SPRITEp_MID(sp) - wp->z);
if ((unsigned)dist > wu->Radius)
continue;
@ -9020,7 +9020,7 @@ DoGrenade(int16_t Weapon)
if (TEST(u->Flags, SPR_UNDERWATER) && (RANDOM_P2(1024 << 4) >> 4) < 256)
SpawnBubble(Weapon);
////DSPRINTF(ds, "dist %d, u->ret %d", FindDistance3D(u->xchange, u->ychange, u->zchange>>4), u->ret);
////DSPRINTF(ds, "dist %d, u->ret %d", FindDistance3D(u->xchange, u->ychange, u->zchange), u->ret);
//MONO_PRINT(ds);
if (u->ret)
@ -9453,7 +9453,7 @@ DoMineRangeTest(short Weapon, short range)
if (u->ID == GIRLNINJA_RUN_R0 && !ownerisplayer)
continue;
dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, (wp->z - sp->z)>>4);
dist = FindDistance3D(wp->x - sp->x, wp->y - sp->y, wp->z - sp->z);
if (dist > range)
continue;
@ -11281,7 +11281,7 @@ SpawnNuclearSecondaryExp(int16_t Weapon, short ang)
eu->ret = move_missile(explosion, eu->xchange, eu->ychange, 0,
eu->ceiling_dist, eu->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS);
if (FindDistance3D(exp->x - sp->x, exp->y - sp->y, (exp->z - sp->z)>>4) < 1024)
if (FindDistance3D(exp->x - sp->x, exp->y - sp->y, exp->z - sp->z) < 1024)
{
KillSprite(explosion);
return -1;
@ -11627,7 +11627,7 @@ SpawnGrenadeSecondaryExp(int16_t Weapon, short ang)
eu->ret = move_missile(explosion, eu->xchange, eu->ychange, 0,
eu->ceiling_dist, eu->floor_dist, CLIPMASK_MISSILE, MISSILEMOVETICS);
if (FindDistance3D(exp->x - sp->x, exp->y - sp->y, (exp->z - sp->z)>>4) < 1024)
if (FindDistance3D(exp->x - sp->x, exp->y - sp->y, exp->z - sp->z) < 1024)
{
KillSprite(explosion);
return -1;
@ -13925,7 +13925,7 @@ InitSwordAttack(PLAYERp pp)
if (hitinfo.sect < 0)
return 0;
if (FindDistance3D(pp->posx - hitinfo.pos.x, pp->posy - hitinfo.pos.y, (pp->posz - hitinfo.pos.z)>>4) < 700)
if (FindDistance3D(pp->posx - hitinfo.pos.x, pp->posy - hitinfo.pos.y, pp->posz - hitinfo.pos.z) < 700)
{
if (hitinfo.sprite >= 0)
@ -14117,7 +14117,7 @@ InitFistAttack(PLAYERp pp)
if (hitinfo.sect < 0)
return 0;
if (FindDistance3D(pp->posx - hitinfo.pos.x, pp->posy - hitinfo.pos.y, (pp->posz - hitinfo.pos.z)>>4) < 700)
if (FindDistance3D(pp->posx - hitinfo.pos.x, pp->posy - hitinfo.pos.y, pp->posz - hitinfo.pos.z) < 700)
{
if (hitinfo.sprite >= 0)
@ -16155,7 +16155,7 @@ InitRipperSlash(short SpriteNum)
if (i == SpriteNum)
break;
if ((unsigned)FindDistance3D(sp->x - hp->x, sp->y - hp->y, (sp->z - hp->z)>>4) > hu->Radius + u->Radius)
if ((unsigned)FindDistance3D(sp->x - hp->x, sp->y - hp->y, sp->z - hp->z) > hu->Radius + u->Radius)
continue;
DISTANCE(hp->x, hp->y, sp->x, sp->y, dist, a, b, c);
@ -16304,7 +16304,7 @@ DoBladeDamage(short SpriteNum)
if (dist > 2000)
continue;
dist = FindDistance3D(sp->x - hp->x, sp->y - hp->y, (sp->z - hp->z)>>4);
dist = FindDistance3D(sp->x - hp->x, sp->y - hp->y, sp->z - hp->z);
if (dist > 2000)
continue;
@ -16347,7 +16347,7 @@ DoStaticFlamesDamage(short SpriteNum)
if (dist > 2000)
continue;
dist = FindDistance3D(sp->x - hp->x, sp->y - hp->y, (sp->z - hp->z)>>4);
dist = FindDistance3D(sp->x - hp->x, sp->y - hp->y, sp->z - hp->z);
if (dist > 2000)
continue;
@ -17365,7 +17365,7 @@ InitEelFire(short SpriteNum)
if (hp != u->tgt_sp)
continue;
if ((unsigned)FindDistance3D(sp->x - hp->x, sp->y - hp->y, (sp->z - hp->z)>>4) > hu->Radius + u->Radius)
if ((unsigned)FindDistance3D(sp->x - hp->x, sp->y - hp->y, sp->z - hp->z) > hu->Radius + u->Radius)
continue;
DISTANCE(hp->x, hp->y, sp->x, sp->y, dist, a, b, c);