diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index 026349d1d..55c5483c8 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -6008,7 +6008,7 @@ static void actCheckDudes() else pPlayer->chokeEffect = 0; - if (actor->vel.X != 0 || actor->int_vel().Y) + if (!actor->vel.XY().isZero()) sfxPlay3DSound(actor, 709, 100, 2); pPlayer->bubbleTime = ClipLow(pPlayer->bubbleTime - 4, 0); @@ -6239,9 +6239,8 @@ DBloodActor* actSpawnDude(DBloodActor* source, int nType, double dist) // //--------------------------------------------------------------------------- -DBloodActor* actSpawnThing(sectortype* pSector, int x, int y, int z, int nThingType) +DBloodActor* actSpawnThing(sectortype* pSector, const DVector3& pos, int nThingType) { - DVector3 pos(x * inttoworld, y * inttoworld, z * zinttoworld); assert(nThingType >= kThingBase && nThingType < kThingMax); auto actor = actSpawnSprite(pSector, pos, 4, 1); int nType = nThingType - kThingBase; @@ -6743,13 +6742,13 @@ void actFireVector(DBloodActor* shooter, double offset, double zoffset, DVector3 } if (Chance(pVectorData->fxChance)) { - int tt = gVectorData[19].maxDist; + double tt = gVectorData[19].maxDist * inttoworld; dv.X += FixedToFloat<14>(Random3(4000)); // random messiness... dv.Y += FixedToFloat<14>(Random3(4000)); dv.Z += FixedToFloat<14>(Random3(4000)); if (HitScan(actor, gHitInfo.hitpos.Z, dv, CLIPMASK1, tt) == 0) { - if (approxDist(gHitInfo.hitpos.XY() - actor->spr.pos.XY()) <= tt) + if ((gHitInfo.hitpos.XY() - actor->spr.pos.XY()).LengthSquared() <= tt * tt) { auto pWall = gHitInfo.hitWall; auto pSector1 = gHitInfo.hitSector; diff --git a/source/games/blood/src/actor.h b/source/games/blood/src/actor.h index 2146ffb8c..2c286af98 100644 --- a/source/games/blood/src/actor.h +++ b/source/games/blood/src/actor.h @@ -234,10 +234,11 @@ void actProcessSprites(void); DBloodActor* actSpawnSprite(sectortype* pSector, const DVector3& pos, int nStat, bool a6); DBloodActor* actSpawnDude(DBloodActor* pSource, int nType, double dist); DBloodActor * actSpawnSprite(DBloodActor *pSource, int nStat); -DBloodActor * actSpawnThing(sectortype* pSector, int x, int y, int z, int nThingType); -inline DBloodActor* actSpawnThing(sectortype* pSector, const DVector3& pos, int nThingType) +DBloodActor* actSpawnThing(sectortype* pSector, const DVector3& pos, int nThingType); + +inline DBloodActor* actSpawnThing(sectortype* pSector, int x, int y, int z, int nThingType) { - return actSpawnThing(pSector, int(pos.X * worldtoint), int(pos.Y * worldtoint), int(pos.Z * zworldtoint), nThingType); + return actSpawnThing(pSector, DVector3(x * inttoworld, y * inttoworld, z * zinttoworld), nThingType); } inline DBloodActor* actFireThing(DBloodActor* actor, double xyoff, double zoff, double zvel, int thingType, double nSpeed);