mirror of
https://github.com/ZDoom/Raze.git
synced 2025-01-31 12:30:40 +00:00
- added 0 checks to all divisions for calculating dudeSlope.
I had it happen once that an actor was targeting itself here which resulted in zero distance and a division by zero exception.
This commit is contained in:
parent
46d2c52b19
commit
88e86b4248
5 changed files with 5 additions and 5 deletions
|
@ -281,7 +281,7 @@ static void beastThinkChase(DBloodActor* actor)
|
||||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||||
{
|
{
|
||||||
aiSetTarget(actor, actor->GetTarget());
|
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)
|
if (nDist < 0x1400 && nDist > 0xa00 && abs(nDeltaAngle) < 85 && (pTarget->flags & 2)
|
||||||
&& IsPlayerSprite(pTarget) && Chance(0x8000))
|
&& IsPlayerSprite(pTarget) && Chance(0x8000))
|
||||||
{
|
{
|
||||||
|
|
|
@ -183,7 +183,7 @@ static void calebThinkChase(DBloodActor* actor)
|
||||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||||
{
|
{
|
||||||
aiSetTarget(actor, actor->GetTarget());
|
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)
|
if (nDist < 0x599 && abs(nDeltaAngle) < 28)
|
||||||
{
|
{
|
||||||
XSECTOR* pXSector;
|
XSECTOR* pXSector;
|
||||||
|
|
|
@ -297,7 +297,7 @@ static void cultThinkChase(DBloodActor* actor)
|
||||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||||
{
|
{
|
||||||
aiSetTarget(actor, actor->GetTarget());
|
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) {
|
switch (pSprite->type) {
|
||||||
case kDudeCultistTommy:
|
case kDudeCultistTommy:
|
||||||
if (nDist < 0x1e00 && nDist > 0xe00 && abs(nDeltaAngle) < 85 && !TargetNearExplosion(pTarget)
|
if (nDist < 0x1e00 && nDist > 0xe00 && abs(nDeltaAngle) < 85 && !TargetNearExplosion(pTarget)
|
||||||
|
|
|
@ -173,7 +173,7 @@ static void gillThinkChase(DBloodActor* actor)
|
||||||
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
if (nDist < pDudeInfo->seeDist && abs(nDeltaAngle) <= pDudeInfo->periphery)
|
||||||
{
|
{
|
||||||
aiSetTarget(actor, actor->GetTarget());
|
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)
|
if (nDist < 921 && abs(nDeltaAngle) < 28)
|
||||||
{
|
{
|
||||||
XSECTOR* pXSector;
|
XSECTOR* pXSector;
|
||||||
|
|
|
@ -568,7 +568,7 @@ static void unicultThinkChase(DBloodActor* actor)
|
||||||
if ((PlayClock & 64) == 0 && Chance(0x3000) && !spriteIsUnderwater(actor, false))
|
if ((PlayClock & 64) == 0 && Chance(0x3000) && !spriteIsUnderwater(actor, false))
|
||||||
playGenDudeSound(actor, kGenDudeSndChasing);
|
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 curWeapon = actor->genDudeExtra().curWeapon;
|
||||||
int weaponType = actor->genDudeExtra().weaponType;
|
int weaponType = actor->genDudeExtra().weaponType;
|
||||||
|
|
Loading…
Reference in a new issue