mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
Handle NPCs being a werewolf in NpcAnimation
Note that the body mesh comes from having a WerewolfRobe force-equipped.
This commit is contained in:
parent
5ac82a50b7
commit
ceed2e30b8
@ -9,6 +9,8 @@
|
|||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
@ -92,20 +94,32 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
|||||||
mPartPriorities[i] = 0;
|
mPartPriorities[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MWWorld::ESMStore &store =
|
const MWWorld::ESMStore &store = 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);
|
||||||
|
bool isWerewolf = MWWorld::Class::get(mPtr).getNpcStats(mPtr).isWerewolf();
|
||||||
|
|
||||||
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHead)->mModel;
|
if(!isWerewolf)
|
||||||
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHair)->mModel;
|
{
|
||||||
|
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHead)->mModel;
|
||||||
|
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHair)->mModel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find("WerewolfHead")->mModel;
|
||||||
|
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find("WerewolfHair")->mModel;
|
||||||
|
}
|
||||||
|
|
||||||
mBodyPrefix = "b_n_" + mNpc->mRace;
|
mBodyPrefix = "b_n_" + mNpc->mRace;
|
||||||
Misc::StringUtils::toLower(mBodyPrefix);
|
Misc::StringUtils::toLower(mBodyPrefix);
|
||||||
|
|
||||||
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
|
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
|
||||||
std::string smodel = (viewMode != VM_FirstPerson) ?
|
std::string smodel = (viewMode != VM_FirstPerson) ?
|
||||||
(!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif") :
|
(!isWerewolf ? (!isBeast ? "meshes\\base_anim.nif"
|
||||||
(!isBeast ? "meshes\\base_anim.1st.nif" : "meshes\\base_animkna.1st.nif") ;
|
: "meshes\\base_animkna.nif")
|
||||||
|
: "meshes\\wolf\\skin.nif") :
|
||||||
|
(!isWerewolf ? (!isBeast ? "meshes\\base_anim.1st.nif"
|
||||||
|
: "meshes\\base_animkna.1st.nif")
|
||||||
|
: "meshes\\wolf\\skin.1st.nif");
|
||||||
setObjectRoot(smodel, true);
|
setObjectRoot(smodel, true);
|
||||||
|
|
||||||
if(mViewMode != VM_FirstPerson)
|
if(mViewMode != VM_FirstPerson)
|
||||||
@ -142,33 +156,60 @@ void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode)
|
|||||||
|
|
||||||
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
const MWWorld::ESMStore &store = 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);
|
||||||
|
bool isWerewolf = MWWorld::Class::get(mPtr).getNpcStats(mPtr).isWerewolf();
|
||||||
|
|
||||||
|
if(!isWerewolf)
|
||||||
|
{
|
||||||
|
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHead)->mModel;
|
||||||
|
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHair)->mModel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find("WerewolfHead")->mModel;
|
||||||
|
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find("WerewolfHair")->mModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
mBodyPrefix = "b_n_" + mNpc->mRace;
|
||||||
|
Misc::StringUtils::toLower(mBodyPrefix);
|
||||||
|
|
||||||
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
|
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
|
||||||
std::string smodel = (viewMode != VM_FirstPerson) ?
|
std::string smodel = (viewMode != VM_FirstPerson) ?
|
||||||
(!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif") :
|
(!isWerewolf ? !isBeast ? "meshes\\base_anim.nif"
|
||||||
(!isBeast ? "meshes\\base_anim.1st.nif" : "meshes\\base_animkna.1st.nif") ;
|
: "meshes\\base_animkna.nif"
|
||||||
|
: "meshes\\wolf\\skin.nif") :
|
||||||
|
(!isWerewolf ? !isBeast ? "meshes\\base_anim.1st.nif"
|
||||||
|
: "meshes\\base_animkna.1st.nif"
|
||||||
|
: "meshes\\wolf\\skin.1st.nif");
|
||||||
setObjectRoot(smodel, true);
|
setObjectRoot(smodel, true);
|
||||||
|
|
||||||
if(mViewMode != VM_FirstPerson)
|
if(mViewMode != VM_FirstPerson)
|
||||||
{
|
{
|
||||||
addAnimSource(smodel);
|
addAnimSource(smodel);
|
||||||
if(mBodyPrefix.find("argonian") != std::string::npos)
|
if(!isWerewolf)
|
||||||
addAnimSource("meshes\\argonian_swimkna.nif");
|
{
|
||||||
else if(!mNpc->isMale() && !isBeast)
|
if(mBodyPrefix.find("argonian") != std::string::npos)
|
||||||
addAnimSource("meshes\\base_anim_female.nif");
|
addAnimSource("meshes\\argonian_swimkna.nif");
|
||||||
if(mNpc->mModel.length() > 0)
|
else if(!mNpc->isMale() && !isBeast)
|
||||||
addAnimSource("meshes\\"+mNpc->mModel);
|
addAnimSource("meshes\\base_anim_female.nif");
|
||||||
|
if(mNpc->mModel.length() > 0)
|
||||||
|
addAnimSource("meshes\\"+mNpc->mModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* A bit counter-intuitive, but unlike third-person anims, it seems
|
if(isWerewolf)
|
||||||
* beast races get both base_anim.1st.nif and base_animkna.1st.nif.
|
addAnimSource(smodel);
|
||||||
*/
|
else
|
||||||
addAnimSource("meshes\\base_anim.1st.nif");
|
{
|
||||||
if(isBeast)
|
/* A bit counter-intuitive, but unlike third-person anims, it seems
|
||||||
addAnimSource("meshes\\base_animkna.1st.nif");
|
* beast races get both base_anim.1st.nif and base_animkna.1st.nif.
|
||||||
if(!mNpc->isMale() && !isBeast)
|
*/
|
||||||
addAnimSource("meshes\\base_anim_female.1st.nif");
|
addAnimSource("meshes\\base_anim.1st.nif");
|
||||||
|
if(isBeast)
|
||||||
|
addAnimSource("meshes\\base_animkna.1st.nif");
|
||||||
|
if(!mNpc->isMale() && !isBeast)
|
||||||
|
addAnimSource("meshes\\base_anim_female.1st.nif");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
MWBase::Environment::get().getMechanicsManager()->forceStateUpdate(mPtr);
|
MWBase::Environment::get().getMechanicsManager()->forceStateUpdate(mPtr);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user