1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 09:23:52 +00:00

Implement switching to and from first-person animations

Note that the current animation gets interrupted, so switching to first person
may break movement until you stop and try to move again. This can be fixed by
alerting the character controller in the mechanics manager to force a state
update when switching POV.
This commit is contained in:
Chris Robinson 2013-04-25 05:23:05 -07:00
parent 9a2a32f2a5
commit 2769adcee0

View file

@ -97,13 +97,9 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
std::string smodel = (!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif"); std::string smodel = (!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif");
addObjectList(node, smodel, true); addObjectList(node, smodel, true);
if(mBodyPrefix.find("argonian") != std::string::npos) if(viewMode != VM_HeadOnly)
addObjectList(node, "meshes\\argonian_swimkna.nif", true); setViewMode(viewMode);
else if(!mNpc->isMale() && !isBeast) else
addObjectList(node, "meshes\\base_anim_female.nif", true);
if(mNpc->mModel.length() > 0)
addObjectList(node, "meshes\\"+mNpc->mModel, true);
forceUpdate(); forceUpdate();
} }
@ -112,28 +108,30 @@ void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode)
assert(viewMode != VM_HeadOnly); assert(viewMode != VM_HeadOnly);
mViewMode = viewMode; mViewMode = viewMode;
/* FIXME: Enable this once first-person animations work. */ Ogre::SceneNode *node = mInsert->getParentSceneNode();
#if 0
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 isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0; bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
std::string smodel = (!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif");
std::vector<std::string> skelnames(1, smodel); clearExtraSources();
if(!mNpc->isMale() && !isBeast) if(mBodyPrefix.find("argonian") != std::string::npos)
skelnames.push_back("meshes\\base_anim_female.nif"); addObjectList(node, "meshes\\argonian_swimkna.nif", true);
else if(mBodyPrefix.find("argonian") != std::string::npos) else if(!mNpc->isMale() && !isBeast)
skelnames.push_back("meshes\\argonian_swimkna.nif"); addObjectList(node, "meshes\\base_anim_female.nif", true);
if(mNpc->mModel.length() > 0) if(mNpc->mModel.length() > 0)
skelnames.push_back("meshes\\"+Misc::StringUtils::lowerCase(mNpc->mModel)); addObjectList(node, "meshes\\"+mNpc->mModel, true);
if(mViewMode == VM_FirstPerson) if(mViewMode == VM_FirstPerson)
{ {
smodel = (!isBeast ? "meshes\\base_anim.1st.nif" : "meshes\\base_animkna.1st.nif"); /* A bit counter-intuitive, but unlike third-person anims, it seems
skelnames.push_back(smodel); * beast races get both base_anim.1st.nif and base_animkna.1st.nif.
*/
addObjectList(node, "meshes\\base_anim.1st.nif", true);
if(isBeast)
addObjectList(node, "meshes\\base_animkna.1st.nif", true);
if(!mNpc->isMale() && !isBeast)
addObjectList(node, "meshes\\base_anim_female.1st.nif", true);
} }
setAnimationSources(skelnames);
#endif
for(size_t i = 0;i < sPartListSize;i++) for(size_t i = 0;i < sPartListSize;i++)
removeIndividualPart(i); removeIndividualPart(i);