mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Fix NPC race height not being applied
This commit is contained in:
parent
66a2df68db
commit
485b6c855a
5 changed files with 24 additions and 8 deletions
|
@ -511,6 +511,20 @@ namespace MWClass
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Npc::adjustScale(const MWWorld::Ptr &ptr, float &scale) const
|
||||||
|
{
|
||||||
|
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||||
|
ptr.get<ESM::NPC>();
|
||||||
|
|
||||||
|
const ESM::Race* race =
|
||||||
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(ref->mBase->mRace);
|
||||||
|
|
||||||
|
if (ref->mBase->isMale())
|
||||||
|
scale *= race->mData.mHeight.mMale;
|
||||||
|
else
|
||||||
|
scale *= race->mData.mHeight.mFemale;
|
||||||
|
}
|
||||||
|
|
||||||
MWWorld::Ptr
|
MWWorld::Ptr
|
||||||
Npc::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
Npc::copyToCellImpl(const MWWorld::Ptr &ptr, MWWorld::CellStore &cell) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,6 +110,8 @@ namespace MWClass
|
||||||
/// \param actor Actor that is resposible for the ID being applied to \a ptr.
|
/// \param actor Actor that is resposible for the ID being applied to \a ptr.
|
||||||
/// \return Any effect?
|
/// \return Any effect?
|
||||||
|
|
||||||
|
virtual void adjustScale (const MWWorld::Ptr &ptr, float &scale) const;
|
||||||
|
|
||||||
virtual void skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType) const;
|
virtual void skillUsageSucceeded (const MWWorld::Ptr& ptr, int skill, int usageType) const;
|
||||||
///< Inform actor \a ptr that a skill use has succeeded.
|
///< Inform actor \a ptr that a skill use has succeeded.
|
||||||
|
|
||||||
|
|
|
@ -104,11 +104,14 @@ namespace MWRender
|
||||||
mAnimation = new NpcAnimation(mCharacter, mNode,
|
mAnimation = new NpcAnimation(mCharacter, mNode,
|
||||||
MWWorld::Class::get(mCharacter).getInventoryStore (mCharacter), 0, renderHeadOnly());
|
MWWorld::Class::get(mCharacter).getInventoryStore (mCharacter), 0, renderHeadOnly());
|
||||||
|
|
||||||
|
float scale=1.f;
|
||||||
|
MWWorld::Class::get(mCharacter).adjustScale(mCharacter, scale);
|
||||||
|
mNode->setScale(Ogre::Vector3(scale));
|
||||||
|
|
||||||
mNode->setVisible (false);
|
mNode->setVisible (false);
|
||||||
|
|
||||||
Ogre::Vector3 scale = mNode->getScale();
|
mCamera->setPosition(mPosition * mNode->getScale());
|
||||||
mCamera->setPosition(mPosition * scale);
|
mCamera->lookAt(mLookAt * mNode->getScale());
|
||||||
mCamera->lookAt(mLookAt * scale);
|
|
||||||
|
|
||||||
onSetup();
|
onSetup();
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,11 +85,6 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
||||||
MWBase::Environment::get().getWorld()->getStore();
|
MWBase::Environment::get().getWorld()->getStore();
|
||||||
const ESM::Race *race = store.get<ESM::Race>().find(mNpc->mRace);
|
const ESM::Race *race = store.get<ESM::Race>().find(mNpc->mRace);
|
||||||
|
|
||||||
float scale = race->mData.mHeight.mMale;
|
|
||||||
if(!mNpc->isMale())
|
|
||||||
scale = race->mData.mHeight.mFemale;
|
|
||||||
node->scale(Ogre::Vector3(scale));
|
|
||||||
|
|
||||||
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHead)->mModel;
|
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHead)->mModel;
|
||||||
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHair)->mModel;
|
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHair)->mModel;
|
||||||
|
|
||||||
|
|
|
@ -885,6 +885,8 @@ void RenderingManager::renderPlayer(const MWWorld::Ptr &ptr)
|
||||||
mPlayer->setAnimation(anim);
|
mPlayer->setAnimation(anim);
|
||||||
mWater->removeEmitter (ptr);
|
mWater->removeEmitter (ptr);
|
||||||
mWater->addEmitter (ptr);
|
mWater->addEmitter (ptr);
|
||||||
|
// apply race height
|
||||||
|
MWBase::Environment::get().getWorld()->scaleObject(ptr, 1.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderingManager::getPlayerData(Ogre::Vector3 &eyepos, float &pitch, float &yaw)
|
void RenderingManager::getPlayerData(Ogre::Vector3 &eyepos, float &pitch, float &yaw)
|
||||||
|
|
Loading…
Reference in a new issue