diff --git a/source/games/blood/src/actor.cpp b/source/games/blood/src/actor.cpp index b6b021f38..e9ecdd6d5 100644 --- a/source/games/blood/src/actor.cpp +++ b/source/games/blood/src/actor.cpp @@ -5908,7 +5908,7 @@ static void actCheckTraps() } pos += vec / 2; } - gVectorData[kVectorTchernobogBurn].maxDist = actor->xspr.data1 << 9; + gVectorData[kVectorTchernobogBurn].maxDist = actor->xspr.data1 << 9; // hacking static game data should be prohibited... actFireVector(actor, 0., 0., DVector3(actor->spr.angle.ToVector(), Random2F(0x8888) * 4), kVectorTchernobogBurn); } break; @@ -6614,7 +6614,7 @@ void actFireVector(DBloodActor* shooter, double offset, double zoffset, DVector3 dv /= dv.XY().Length(); assert(vectorType >= 0 && vectorType < kVectorMax); const VECTORDATA* pVectorData = &gVectorData[vectorType]; - double nRange = pVectorData->maxDist * inttoworld; + double nRange = pVectorData->fMaxDist(); // The vector for hitscan must be longer than what we got here as long as it works with integers. int hit = VectorScan(shooter, offset, zoffset, dv, nRange, 1); if (hit == 3) @@ -6742,7 +6742,7 @@ void actFireVector(DBloodActor* shooter, double offset, double zoffset, DVector3 } if (Chance(pVectorData->fxChance)) { - double tt = gVectorData[19].maxDist * inttoworld; + double tt = gVectorData[19].fMaxDist(); dv.X += FixedToFloat<14>(Random3(4000)); // random messiness... dv.Y += FixedToFloat<14>(Random3(4000)); dv.Z += FixedToFloat<14>(Random3(4000)); diff --git a/source/games/blood/src/actor.h b/source/games/blood/src/actor.h index 65934727d..c43855754 100644 --- a/source/games/blood/src/actor.h +++ b/source/games/blood/src/actor.h @@ -168,6 +168,8 @@ struct VECTORDATA { int bloodSplats; // blood splats int splatChance; // blood splat chance SURFHIT surfHit[15]; + + double fMaxDist() const { return maxDist * maptoworld; } }; extern const AMMOITEMDATA gAmmoItemData[]; diff --git a/source/games/blood/src/aiunicult.cpp b/source/games/blood/src/aiunicult.cpp index 7ccb8fe9d..4c0ca65f8 100644 --- a/source/games/blood/src/aiunicult.cpp +++ b/source/games/blood/src/aiunicult.cpp @@ -608,7 +608,7 @@ static void unicultThinkChase(DBloodActor* actor) } } - else if (dist <= meleeVector->maxDist * inttoworld) + else if (dist <= meleeVector->fMaxDist()) { if (spriteIsUnderwater(actor, false)) @@ -645,7 +645,7 @@ static void unicultThinkChase(DBloodActor* actor) if (weaponType == kGenDudeWeaponHitscan) { - if ((vdist = gVectorData[curWeapon].maxDist * inttoworld) <= 0) + if ((vdist = gVectorData[curWeapon].fMaxDist()) <= 0) vdist = mdist; } @@ -657,9 +657,9 @@ static void unicultThinkChase(DBloodActor* actor) aiSetTarget(actor, actor->spr.pos); return; } - else if (actor->genDudeExtra.slaveCount > gGameOptions.nDifficulty || dist < meleeVector->maxDist * inttoworld) + else if (actor->genDudeExtra.slaveCount > gGameOptions.nDifficulty || dist < meleeVector->fMaxDist()) { - if (dist <= meleeVector->maxDist * inttoworld) + if (dist <= meleeVector->fMaxDist()) { aiGenDudeNewState(actor, &genDudePunch); return; @@ -696,7 +696,7 @@ static void unicultThinkChase(DBloodActor* actor) case kMissileFireballTchernobog: if (mdist == defDist) mdist = 3000/16.; if (dist > mdist || actor->xspr.locked == 1) break; - else if (dist <= meleeVector->maxDist * inttoworld && Chance(0x9000)) + else if (dist <= meleeVector->fMaxDist() && Chance(0x9000)) aiGenDudeNewState(actor, &genDudePunch); else if (state == 1) aiGenDudeNewState(actor, &genDudeChaseW); else if (state == 2) aiGenDudeNewState(actor, &genDudeChaseD); @@ -708,14 +708,14 @@ static void unicultThinkChase(DBloodActor* actor) //viewSetSystemMessage("%d", target->xspr.burnTime); if (spriteIsUnderwater(actor, false)) { - if (dist > meleeVector->maxDist * inttoworld) aiGenDudeNewState(actor, &genDudeChaseW); + if (dist > meleeVector->fMaxDist()) aiGenDudeNewState(actor, &genDudeChaseW); else if (Chance(0x8000)) aiGenDudeNewState(actor, &genDudePunch); else aiGenDudeNewState(actor, &genDudeDodgeShortW); return; } else if (dist <= 250 && target->xspr.burnTime >= 2000 && target->GetBurnSource() == actor) { - if (dist > meleeVector->maxDist * inttoworld) aiGenDudeNewState(actor, &genDudeChaseL); + if (dist > meleeVector->fMaxDist()) aiGenDudeNewState(actor, &genDudeChaseL); else aiGenDudeNewState(actor, &genDudePunch); return; } @@ -2291,7 +2291,7 @@ bool genDudePrepare(DBloodActor* actor, int propId) pExtra->isMelee = false; if (pExtra->weaponType == kGenDudeWeaponKamikaze) pExtra->isMelee = true; else if (pExtra->weaponType == kGenDudeWeaponHitscan) { - if (gVectorData[pExtra->curWeapon].maxDist > 0 && gVectorData[pExtra->curWeapon].maxDist <= kGenDudeMaxMeleeDist) + if (gVectorData[pExtra->curWeapon].fMaxDist() > 0 && gVectorData[pExtra->curWeapon].fMaxDist() <= kGenDudeMaxMeleeDistf) pExtra->isMelee = true; } diff --git a/source/games/blood/src/aiunicult.h b/source/games/blood/src/aiunicult.h index 1aa5d57cd..2cb116ef0 100644 --- a/source/games/blood/src/aiunicult.h +++ b/source/games/blood/src/aiunicult.h @@ -36,6 +36,7 @@ enum kGenDudeTransformStatus = -222, kGenDudeUpdTimeRate = 10, kGenDudeMaxMeleeDist = 2048, + kGenDudeMaxMeleeDistf = 128, kGenDudeMinDispesion = 200, kGenDudeMaxDispersion = 3500, };