From a5e4faaed277434599607e78daf7958f83767bf7 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 8 Jul 2013 22:37:44 -0700 Subject: [PATCH] Show arms and body parts in first person This isn't yet fully correct. The arms need to rotate up and down with the camera, and the mesh's bounding box is causing them to blink out at certain angles since they don't fit the animation. --- apps/openmw/mwrender/npcanimation.cpp | 38 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/apps/openmw/mwrender/npcanimation.cpp b/apps/openmw/mwrender/npcanimation.cpp index cc12d1d20a..6f53010ae1 100644 --- a/apps/openmw/mwrender/npcanimation.cpp +++ b/apps/openmw/mwrender/npcanimation.cpp @@ -210,14 +210,6 @@ void NpcAnimation::updateParts(bool forceupdate) if(!forceupdate) return; - /* FIXME: Remove this once we figure out how to show what in first-person */ - if(mViewMode == VM_FirstPerson) - { - for(size_t i = 0;i < slotlistsize;i++) - this->*slotlist[i].mPart = inv.getSlot(slotlist[i].mSlot); - return; - } - for(size_t i = 0;i < slotlistsize && mViewMode != VM_HeadOnly;i++) { MWWorld::ContainerStoreIterator store = inv.getSlot(slotlist[i].mSlot); @@ -316,7 +308,8 @@ void NpcAnimation::updateParts(bool forceupdate) bodypartMap[ESM::PRT_Tail] = ESM::BodyPart::MP_Tail; } - sRaceMapping[thisCombination].resize(ESM::PRT_Count, NULL); + std::vector &parts = sRaceMapping[thisCombination]; + parts.resize(ESM::PRT_Count, NULL); const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore(); const MWWorld::Store &partStore = store.get(); @@ -337,11 +330,27 @@ void NpcAnimation::updateParts(bool forceupdate) && bodypart.mId[bodypart.mId.size()-3] == '1' && bodypart.mId[bodypart.mId.size()-2] == 's' && bodypart.mId[bodypart.mId.size()-1] == 't'; - if (firstPerson != (mViewMode == VM_FirstPerson)) + if(firstPerson != (mViewMode == VM_FirstPerson)) + { + if(mViewMode == VM_FirstPerson && (bodypart.mData.mPart == ESM::BodyPart::MP_Hand || + bodypart.mData.mPart == ESM::BodyPart::MP_Wrist || + bodypart.mData.mPart == ESM::BodyPart::MP_Forearm)) + { + /* Allow 3rd person skins as a fallback for the forearms if 1st person is missing. */ + for(std::map::iterator bIt = bodypartMap.begin();bIt != bodypartMap.end();++bIt) + { + if(bIt->second == bodypart.mData.mPart) + { + if(!parts[bIt->first]) + parts[bIt->first] = &*it; + } + } + } continue; - for (std::map::iterator bIt = bodypartMap.begin(); bIt != bodypartMap.end(); ++bIt ) - if (bIt->second == bodypart.mData.mPart) - sRaceMapping[thisCombination][bIt->first] = &*it; + } + for(std::map::iterator bIt = bodypartMap.begin();bIt != bodypartMap.end();++bIt) + if(bIt->second == bodypart.mData.mPart) + parts[bIt->first] = &*it; } } @@ -484,8 +493,7 @@ void NpcAnimation::addPartGroup(int group, int priority, const std::vector