Merge branch 'issue-4805' into 'master'

Bug #4805: NPC movement speed calculations do not take race Weight into account

See merge request OpenMW/openmw!89

(cherry picked from commit 98f52fa8ad8d8746786c529373db81f8602135df)

61682570 Bug #4805: NPC movement speed calculations do not take race Weight into account
0c8308bc Revert "Bug #4805: NPC movement speed calculations do not take race Weight into account"
4b43e91f Change to only affect movement speed and not animation speed
a66ae118 Use adjustScale() to adjust movement calculation instead of using race weight
6295eadc Make sure height is also factored into movement speed
fde0ca8b Remove height from movement calculation and factor in cell reference scale
pull/2330/head
Alexei Dobrohotov 5 years ago
parent 571094a3ca
commit 89a0b2d2d4

@ -135,6 +135,7 @@ Programmers
Mitchell Schwitzer (schwitzerm)
naclander
Narmo
Nat Meo (Utopium)
Nathan Jeffords (blunted2night)
NeveHanter
Nialsy

@ -32,6 +32,7 @@
Bug #4800: Standing collisions are not updated immediately when an object is teleported without a cell change
Bug #4803: Stray special characters before begin statement break script compilation
Bug #4804: Particle system with the "Has Sizes = false" causes an exception
Bug #4805: NPC movement speed calculations do not take race Weight into account
Bug #4810: Raki creature broken in OpenMW
Bug #4813: Creatures with known file but no "Sound Gen Creature" assigned use default sounds
Bug #4815: "Finished" journal entry with lower index doesn't close journal, SetJournalIndex closes journal

@ -2368,6 +2368,19 @@ void CharacterController::update(float duration, bool animationOnly)
else
moved = osg::Vec3f(0.f, 0.f, 0.f);
float scale = mPtr.getCellRef().getScale();
moved.x() *= scale;
moved.y() *= scale;
if(mPtr.getClass().isNpc())
{
const ESM::NPC* npc = mPtr.get<ESM::NPC>()->mBase;
const ESM::Race* race = world->getStore().get<ESM::Race>().find(npc->mRace);
float weight = npc->isMale() ? race->mData.mWeight.mMale : race->mData.mWeight.mFemale;
moved.x() *= weight;
moved.y() *= weight;
}
// Ensure we're moving in generally the right direction...
if(speed > 0.f)
{

Loading…
Cancel
Save