From f9e4ce89fa8c06e9ef363bc818a122e4365761c5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Wed, 9 Oct 2024 09:56:38 +0200 Subject: [PATCH] Blood: fixed messed up math in podAttack. --- source/games/blood/src/aipod.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/games/blood/src/aipod.cpp b/source/games/blood/src/aipod.cpp index 239500a9d0f..f38fd81c8ac 100644 --- a/source/games/blood/src/aipod.cpp +++ b/source/games/blood/src/aipod.cpp @@ -70,28 +70,29 @@ void podAttack(int, DBloodActor* actor) dv.X += Random2F(1000, 4); dv.Y += Random2F(1000, 4); double nDist = dv.XY().Length(); + int nDist2 = int(nDist * 16) / 540; // truncation is important here. DBloodActor* pMissile = nullptr; switch (actor->spr.type) { case kDudePodGreen: dv.Z += 31.25; - if (pDudeInfo->SeeDist() * 1.6 < nDist) + if (pDudeInfo->seeDist < nDist * 160) { if (Chance(0x8000)) sfxPlay3DSound(actor, 2474, -1, 0); else sfxPlay3DSound(actor, 2475, -1, 0); - pMissile = actFireThing(actor, 0., -500., dv.Z / 32768 - 0.22125, kThingPodGreenBall, nDist * (2048. / 64800)); + pMissile = actFireThing(actor, 0., -31.25, dv.Z / 32768 - 0.22125, kThingPodGreenBall, nDist2 * (8. / 7.)); } if (pMissile) seqSpawn(68, pMissile, -1); break; case kDudePodFire: dv.Z += 31.25; - if (pDudeInfo->SeeDist() * 1.6 < nDist) + if (pDudeInfo->seeDist < nDist * 160) { sfxPlay3DSound(actor, 2454, -1, 0); - pMissile = actFireThing(actor, 0., -500., dv.Z / 32768 - 0.22125, kThingPodFireBall, nDist * (2048. / 64800)); + pMissile = actFireThing(actor, 0., -31.25, dv.Z / 32768 - 0.22125, kThingPodFireBall, nDist2 * (8. / 7.)); } if (pMissile) seqSpawn(22, pMissile, -1);