Factor race weight into magic projectile speed (bug #6343)

pull/3208/head^2
Alexei Dobrohotov 3 years ago
parent 3ade72a7ad
commit b918135b4b

@ -69,6 +69,7 @@
Bug #6323: Wyrmhaven: Alboin doesn't follower the player character out of his house
Bug #6326: Detect Enchantment/Key should detect items in unresolved containers
Bug #6327: Blocking roots the character in place
Bug #6343: Magic projectile speed doesn't take race weight into account
Bug #6347: PlaceItem/PlaceItemCell/PlaceAt should work with levelled creatures
Bug #6354: SFX abruptly cut off after crossing max distance; implement soft fading of sound effects
Bug #6363: Some scripts in Morrowland fail to work

@ -22,6 +22,8 @@
#include <components/sceneutil/lightmanager.hpp>
#include <components/sceneutil/nodecallback.hpp>
#include <components/settings/settings.hpp>
#include "../mwworld/manualref.hpp"
#include "../mwworld/class.hpp"
#include "../mwworld/esmstore.hpp"
@ -407,6 +409,7 @@ namespace MWWorld
void ProjectileManager::moveMagicBolts(float duration)
{
static const bool normaliseRaceSpeed = Settings::Manager::getBool("normalise race speed", "Game");
for (auto& magicBoltState : mMagicBolts)
{
if (magicBoltState.mToDelete)
@ -426,10 +429,16 @@ namespace MWWorld
}
}
const auto& store = MWBase::Environment::get().getWorld()->getStore();
osg::Quat orient = magicBoltState.mNode->getAttitude();
static float fTargetSpellMaxSpeed = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
.find("fTargetSpellMaxSpeed")->mValue.getFloat();
static float fTargetSpellMaxSpeed = store.get<ESM::GameSetting>().find("fTargetSpellMaxSpeed")->mValue.getFloat();
float speed = fTargetSpellMaxSpeed * magicBoltState.mSpeed;
if (!normaliseRaceSpeed && !caster.isEmpty() && caster.getClass().isNpc())
{
const auto npc = caster.get<ESM::NPC>()->mBase;
const auto race = store.get<ESM::Race>().find(npc->mRace);
speed *= npc->isMale() ? race->mData.mWeight.mMale : race->mData.mWeight.mFemale;
}
osg::Vec3f direction = orient * osg::Vec3f(0,1,0);
direction.normalize();
projectile->setVelocity(direction * speed);

@ -275,7 +275,7 @@ normalise race speed
:Range: True/False
:Default: False
By default race weight is factored into horizontal movement speed like in Morrowind.
By default race weight is factored into horizontal movement and magic projectile speed like in Morrowind.
For example, an NPC which has 1.2 race weight is faster than an NPC with the exact same stats and weight 1.0 by a factor of 120%.
If this setting is true, race weight is ignored in the calculations which allows for a movement behavior
equivalent to the one introduced by the equivalent Morrowind Code Patch feature.

Loading…
Cancel
Save