Use the correct spell projectile speed GMST in AI aiming

pull/540/head
Capostrophic 6 years ago committed by Capostrophic
parent 1cfc1f9bdb
commit 3527f3800e

@ -22,6 +22,7 @@
Bug #3876: Landscape texture painting is misaligned Bug #3876: Landscape texture painting is misaligned
Bug #3897: Have Goodbye give all choices the effects of Goodbye Bug #3897: Have Goodbye give all choices the effects of Goodbye
Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters Bug #3911: [macOS] Typing in the "Content List name" dialog box produces double characters
Bug #3948: AiCombat moving target aiming uses incorrect speed for magic projectiles
Bug #3950: FLATTEN_STATIC_TRANSFORMS optimization breaks animated collision shapes Bug #3950: FLATTEN_STATIC_TRANSFORMS optimization breaks animated collision shapes
Bug #3993: Terrain texture blending map is not upscaled Bug #3993: Terrain texture blending map is not upscaled
Bug #3997: Almalexia doesn't pace Bug #3997: Almalexia doesn't pace

@ -600,27 +600,26 @@ osg::Vec3f AimDirToMovingTarget(const MWWorld::Ptr& actor, const MWWorld::Ptr& t
float duration, int weapType, float strength) float duration, int weapType, float strength)
{ {
float projSpeed; float projSpeed;
const MWWorld::Store<ESM::GameSetting>& gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
// get projectile speed (depending on weapon type) // get projectile speed (depending on weapon type)
if (weapType == ESM::Weapon::MarksmanThrown) if (weapType == ESM::Weapon::MarksmanThrown)
{ {
static float fThrownWeaponMinSpeed = static float fThrownWeaponMinSpeed = gmst.find("fThrownWeaponMinSpeed")->getFloat();
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fThrownWeaponMinSpeed")->getFloat(); static float fThrownWeaponMaxSpeed = gmst.find("fThrownWeaponMaxSpeed")->getFloat();
static float fThrownWeaponMaxSpeed =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fThrownWeaponMaxSpeed")->getFloat();
projSpeed = projSpeed = fThrownWeaponMinSpeed + (fThrownWeaponMaxSpeed - fThrownWeaponMinSpeed) * strength;
fThrownWeaponMinSpeed + (fThrownWeaponMaxSpeed - fThrownWeaponMinSpeed) * strength;
} }
else else if (weapType != 0)
{ {
static float fProjectileMinSpeed = static float fProjectileMinSpeed = gmst.find("fProjectileMinSpeed")->getFloat();
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fProjectileMinSpeed")->getFloat(); static float fProjectileMaxSpeed = gmst.find("fProjectileMaxSpeed")->getFloat();
static float fProjectileMaxSpeed =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fProjectileMaxSpeed")->getFloat();
projSpeed = projSpeed = fProjectileMinSpeed + (fProjectileMaxSpeed - fProjectileMinSpeed) * strength;
fProjectileMinSpeed + (fProjectileMaxSpeed - fProjectileMinSpeed) * strength; }
else // weapType is 0 ==> it's a target spell projectile
{
projSpeed = gmst.find("fTargetSpellMaxSpeed")->getFloat();
} }
// idea: perpendicular to dir to target speed components of target move vector and projectile vector should be the same // idea: perpendicular to dir to target speed components of target move vector and projectile vector should be the same

Loading…
Cancel
Save