mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
Init NPC type properly in the NpcAnimation
This commit is contained in:
parent
fa8e7b8037
commit
e171d34192
@ -238,6 +238,18 @@ void HeadAnimationTime::setBlinkStop(float value)
|
|||||||
|
|
||||||
// ----------------------------------------------------
|
// ----------------------------------------------------
|
||||||
|
|
||||||
|
NpcAnimation::NpcType NpcAnimation::getNpcType()
|
||||||
|
{
|
||||||
|
const MWWorld::Class &cls = mPtr.getClass();
|
||||||
|
NpcAnimation::NpcType curType = Type_Normal;
|
||||||
|
if (cls.getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Vampirism).getMagnitude() > 0)
|
||||||
|
curType = Type_Vampire;
|
||||||
|
if (cls.getNpcStats(mPtr).isWerewolf())
|
||||||
|
curType = Type_Werewolf;
|
||||||
|
|
||||||
|
return curType;
|
||||||
|
}
|
||||||
|
|
||||||
static NpcAnimation::PartBoneMap createPartListMap()
|
static NpcAnimation::PartBoneMap createPartListMap()
|
||||||
{
|
{
|
||||||
NpcAnimation::PartBoneMap result;
|
NpcAnimation::PartBoneMap result;
|
||||||
@ -283,7 +295,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, osg::ref_ptr<osg::Group> par
|
|||||||
mViewMode(viewMode),
|
mViewMode(viewMode),
|
||||||
mShowWeapons(false),
|
mShowWeapons(false),
|
||||||
mShowCarriedLeft(true),
|
mShowCarriedLeft(true),
|
||||||
mNpcType(Type_Normal),
|
mNpcType(getNpcType()),
|
||||||
mFirstPersonFieldOfView(firstPersonFieldOfView),
|
mFirstPersonFieldOfView(firstPersonFieldOfView),
|
||||||
mSoundsDisabled(disableSounds),
|
mSoundsDisabled(disableSounds),
|
||||||
mAccurateAiming(false),
|
mAccurateAiming(false),
|
||||||
@ -431,8 +443,9 @@ void NpcAnimation::updateNpcBase()
|
|||||||
|
|
||||||
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 = (mNpcType == Type_Werewolf);
|
NpcType curType = getNpcType();
|
||||||
bool isVampire = (mNpcType == Type_Vampire);
|
bool isWerewolf = (curType == Type_Werewolf);
|
||||||
|
bool isVampire = (curType == Type_Vampire);
|
||||||
bool isFemale = !mNpc->isMale();
|
bool isFemale = !mNpc->isMale();
|
||||||
|
|
||||||
if (isWerewolf)
|
if (isWerewolf)
|
||||||
@ -517,14 +530,7 @@ void NpcAnimation::updateParts()
|
|||||||
if (!mObjectRoot.get())
|
if (!mObjectRoot.get())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const MWWorld::Class &cls = mPtr.getClass();
|
NpcType curType = getNpcType();
|
||||||
|
|
||||||
NpcType curType = Type_Normal;
|
|
||||||
if (cls.getCreatureStats(mPtr).getMagicEffects().get(ESM::MagicEffect::Vampirism).getMagnitude() > 0)
|
|
||||||
curType = Type_Vampire;
|
|
||||||
if (cls.getNpcStats(mPtr).isWerewolf())
|
|
||||||
curType = Type_Werewolf;
|
|
||||||
|
|
||||||
if (curType != mNpcType)
|
if (curType != mNpcType)
|
||||||
{
|
{
|
||||||
mNpcType = curType;
|
mNpcType = curType;
|
||||||
@ -632,7 +638,7 @@ void NpcAnimation::updateParts()
|
|||||||
showWeapons(mShowWeapons);
|
showWeapons(mShowWeapons);
|
||||||
showCarriedLeft(mShowCarriedLeft);
|
showCarriedLeft(mShowCarriedLeft);
|
||||||
|
|
||||||
bool isWerewolf = (mNpcType == Type_Werewolf);
|
bool isWerewolf = (getNpcType() == Type_Werewolf);
|
||||||
std::string race = (isWerewolf ? "werewolf" : Misc::StringUtils::lowerCase(mNpc->mRace));
|
std::string race = (isWerewolf ? "werewolf" : Misc::StringUtils::lowerCase(mNpc->mRace));
|
||||||
|
|
||||||
const std::vector<const ESM::BodyPart*> &parts = getBodyParts(race, !mNpc->isMale(), mViewMode == VM_FirstPerson, isWerewolf);
|
const std::vector<const ESM::BodyPart*> &parts = getBodyParts(race, !mNpc->isMale(), mViewMode == VM_FirstPerson, isWerewolf);
|
||||||
|
@ -74,6 +74,8 @@ private:
|
|||||||
|
|
||||||
void updateNpcBase();
|
void updateNpcBase();
|
||||||
|
|
||||||
|
NpcType getNpcType();
|
||||||
|
|
||||||
PartHolderPtr insertBoundedPart(const std::string &model, const std::string &bonename,
|
PartHolderPtr insertBoundedPart(const std::string &model, const std::string &bonename,
|
||||||
const std::string &bonefilter, bool enchantedGlow, osg::Vec4f* glowColor=nullptr);
|
const std::string &bonefilter, bool enchantedGlow, osg::Vec4f* glowColor=nullptr);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user