forked from teamnwah/openmw-tes3coop
Add support for NPCs with missing head/hair models (Fixes #2078)
This commit is contained in:
parent
be16f1d0a5
commit
a355550cab
1 changed files with 16 additions and 6 deletions
|
@ -56,8 +56,13 @@ std::string getVampireHead(const std::string& race, bool female)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(sVampireMapping[thisCombination]);
|
if (sVampireMapping.find(thisCombination) == sVampireMapping.end())
|
||||||
return "meshes\\" + sVampireMapping[thisCombination]->mModel;
|
sVampireMapping[thisCombination] = NULL;
|
||||||
|
|
||||||
|
const ESM::BodyPart* bodyPart = sVampireMapping[thisCombination];
|
||||||
|
if (!bodyPart)
|
||||||
|
return std::string();
|
||||||
|
return "meshes\\" + bodyPart->mModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isSkinned (NifOgre::ObjectScenePtr scene)
|
bool isSkinned (NifOgre::ObjectScenePtr scene)
|
||||||
|
@ -256,10 +261,15 @@ void NpcAnimation::updateNpcBase()
|
||||||
{
|
{
|
||||||
if (isVampire)
|
if (isVampire)
|
||||||
mHeadModel = getVampireHead(mNpc->mRace, mNpc->mFlags & ESM::NPC::Female);
|
mHeadModel = getVampireHead(mNpc->mRace, mNpc->mFlags & ESM::NPC::Female);
|
||||||
else
|
else if (!mNpc->mHead.empty())
|
||||||
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHead)->mModel;
|
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHead)->mModel;
|
||||||
|
else
|
||||||
|
mHeadModel = "";
|
||||||
|
|
||||||
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHair)->mModel;
|
if (!mNpc->mHair.empty())
|
||||||
|
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHair)->mModel;
|
||||||
|
else
|
||||||
|
mHairModel = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
|
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
|
||||||
|
@ -399,9 +409,9 @@ void NpcAnimation::updateParts()
|
||||||
|
|
||||||
if(mViewMode != VM_FirstPerson)
|
if(mViewMode != VM_FirstPerson)
|
||||||
{
|
{
|
||||||
if(mPartPriorities[ESM::PRT_Head] < 1)
|
if(mPartPriorities[ESM::PRT_Head] < 1 && !mHeadModel.empty())
|
||||||
addOrReplaceIndividualPart(ESM::PRT_Head, -1,1, mHeadModel);
|
addOrReplaceIndividualPart(ESM::PRT_Head, -1,1, mHeadModel);
|
||||||
if(mPartPriorities[ESM::PRT_Hair] < 1 && mPartPriorities[ESM::PRT_Head] <= 1)
|
if(mPartPriorities[ESM::PRT_Hair] < 1 && mPartPriorities[ESM::PRT_Head] <= 1 && !mHairModel.empty())
|
||||||
addOrReplaceIndividualPart(ESM::PRT_Hair, -1,1, mHairModel);
|
addOrReplaceIndividualPart(ESM::PRT_Hair, -1,1, mHairModel);
|
||||||
}
|
}
|
||||||
if(mViewMode == VM_HeadOnly)
|
if(mViewMode == VM_HeadOnly)
|
||||||
|
|
Loading…
Reference in a new issue