diff --git a/source/games/blood/src/aibeast.cpp b/source/games/blood/src/aibeast.cpp index 62d424095..3c09c1dbf 100644 --- a/source/games/blood/src/aibeast.cpp +++ b/source/games/blood/src/aibeast.cpp @@ -281,7 +281,7 @@ static void beastThinkChase(DBloodActor* actor) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) { aiSetTarget(actor, actor->GetTarget()); - actor->dudeSlope = DivScale(pTarget->z - pSprite->z, nDist, 10); + actor->dudeSlope = nDist == 0? 0 : DivScale(pTarget->z - pSprite->z, nDist, 10); if (nDist < 0x1400 && nDist > 0xa00 && abs(nDeltaAngle) < 85 && (pTarget->flags & 2) && IsPlayerSprite(pTarget) && Chance(0x8000)) { diff --git a/source/games/blood/src/aicaleb.cpp b/source/games/blood/src/aicaleb.cpp index b641a0864..83a7eed10 100644 --- a/source/games/blood/src/aicaleb.cpp +++ b/source/games/blood/src/aicaleb.cpp @@ -183,7 +183,7 @@ static void calebThinkChase(DBloodActor* actor) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) { aiSetTarget(actor, actor->GetTarget()); - actor->dudeSlope = DivScale(pTarget->z - pSprite->z, nDist, 10); + actor->dudeSlope = nDist == 0 ? 0 : DivScale(pTarget->z-pSprite->z, nDist, 10); if (nDist < 0x599 && abs(nDeltaAngle) < 28) { XSECTOR* pXSector; diff --git a/source/games/blood/src/aicult.cpp b/source/games/blood/src/aicult.cpp index 8ffece960..41308222b 100644 --- a/source/games/blood/src/aicult.cpp +++ b/source/games/blood/src/aicult.cpp @@ -297,7 +297,7 @@ static void cultThinkChase(DBloodActor* actor) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) { aiSetTarget(actor, actor->GetTarget()); - actor->dudeSlope = DivScale(pTarget->z - pSprite->z, nDist, 10); + actor->dudeSlope = nDist == 0 ? 0 : DivScale(pTarget->z - pSprite->z, nDist, 10); switch (pSprite->type) { case kDudeCultistTommy: if (nDist < 0x1e00 && nDist > 0xe00 && abs(nDeltaAngle) < 85 && !TargetNearExplosion(pTarget) diff --git a/source/games/blood/src/aigilbst.cpp b/source/games/blood/src/aigilbst.cpp index 2b25d15e1..f3e54c4a1 100644 --- a/source/games/blood/src/aigilbst.cpp +++ b/source/games/blood/src/aigilbst.cpp @@ -173,7 +173,7 @@ static void gillThinkChase(DBloodActor* actor) if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery) { aiSetTarget(actor, actor->GetTarget()); - actor->dudeSlope = DivScale(pTarget->z - pSprite->z, nDist, 10); + actor->dudeSlope = nDist == 0 ? 0 : DivScale(pTarget->z - pSprite->z, nDist, 10); if (nDist < 921 && abs(nDeltaAngle) < 28) { XSECTOR* pXSector; diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 97663577e..ee414876f 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -568,7 +568,7 @@ static void unicultThinkChase(DBloodActor* actor) if ((PlayClock & 64) == 0 && Chance(0x3000) && !spriteIsUnderwater(actor, false)) playGenDudeSound(actor, kGenDudeSndChasing); - actor->dudeSlope = DivScale(pTarget->z - pSprite->z, dist, 10); + actor->dudeSlope = dist == 0 ? 0 : DivScale(pTarget->z - pSprite->z, dist, 10); int curWeapon = actor->genDudeExtra().curWeapon; int weaponType = actor->genDudeExtra().weaponType;