forked from teamnwah/openmw-tes3coop
Merge remote-tracking branch 'gus/renderWeaponShield'
This commit is contained in:
commit
cd61177eed
4 changed files with 37 additions and 3 deletions
|
@ -737,4 +737,6 @@ Ogre::Vector3 Animation::runAnimation(float duration)
|
||||||
return movement;
|
return movement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Animation::showWeapons(bool showWeapon){}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,8 @@ public:
|
||||||
|
|
||||||
virtual Ogre::Vector3 runAnimation(float duration);
|
virtual Ogre::Vector3 runAnimation(float duration);
|
||||||
|
|
||||||
|
virtual void showWeapons(bool showWeapon);
|
||||||
|
|
||||||
/* Returns if there's an animation playing on the given layer. */
|
/* Returns if there's an animation playing on the given layer. */
|
||||||
bool isPlaying(size_t layeridx) const
|
bool isPlaying(size_t layeridx) const
|
||||||
{ return mLayer[layeridx].mPlaying; }
|
{ return mLayer[layeridx].mPlaying; }
|
||||||
|
|
|
@ -30,7 +30,7 @@ const NpcAnimation::PartInfo NpcAnimation::sPartList[NpcAnimation::sPartListSize
|
||||||
{ ESM::PRT_LHand, "Left Hand" },
|
{ ESM::PRT_LHand, "Left Hand" },
|
||||||
{ ESM::PRT_RWrist, "Right Wrist" },
|
{ ESM::PRT_RWrist, "Right Wrist" },
|
||||||
{ ESM::PRT_LWrist, "Left Wrist" },
|
{ ESM::PRT_LWrist, "Left Wrist" },
|
||||||
{ ESM::PRT_Shield, "Shield" },
|
{ ESM::PRT_Shield, "Shield Bone" },
|
||||||
{ ESM::PRT_RForearm, "Right Forearm" },
|
{ ESM::PRT_RForearm, "Right Forearm" },
|
||||||
{ ESM::PRT_LForearm, "Left Forearm" },
|
{ ESM::PRT_LForearm, "Left Forearm" },
|
||||||
{ ESM::PRT_RUpperarm, "Right Upper Arm" },
|
{ ESM::PRT_RUpperarm, "Right Upper Arm" },
|
||||||
|
@ -45,7 +45,7 @@ const NpcAnimation::PartInfo NpcAnimation::sPartList[NpcAnimation::sPartListSize
|
||||||
{ ESM::PRT_LLeg, "Left Upper Leg" },
|
{ ESM::PRT_LLeg, "Left Upper Leg" },
|
||||||
{ ESM::PRT_RPauldron, "Right Clavicle" },
|
{ ESM::PRT_RPauldron, "Right Clavicle" },
|
||||||
{ ESM::PRT_LPauldron, "Left Clavicle" },
|
{ ESM::PRT_LPauldron, "Left Clavicle" },
|
||||||
{ ESM::PRT_Weapon, "Weapon" },
|
{ ESM::PRT_Weapon, "Weapon Bone" },
|
||||||
{ ESM::PRT_Tail, "Tail" }
|
{ ESM::PRT_Tail, "Tail" }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -74,7 +74,10 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
||||||
mGloveL(inv.end()),
|
mGloveL(inv.end()),
|
||||||
mGloveR(inv.end()),
|
mGloveR(inv.end()),
|
||||||
mSkirtIter(inv.end()),
|
mSkirtIter(inv.end()),
|
||||||
mViewMode(viewMode)
|
mWeapon(inv.end()),
|
||||||
|
mShield(inv.end()),
|
||||||
|
mViewMode(viewMode),
|
||||||
|
mShowWeapons(false)
|
||||||
{
|
{
|
||||||
mNpc = mPtr.get<ESM::NPC>()->mBase;
|
mNpc = mPtr.get<ESM::NPC>()->mBase;
|
||||||
|
|
||||||
|
@ -175,6 +178,7 @@ void NpcAnimation::updateParts(bool forceupdate)
|
||||||
{ &NpcAnimation::mGloveR, MWWorld::InventoryStore::Slot_RightGauntlet, 0 },
|
{ &NpcAnimation::mGloveR, MWWorld::InventoryStore::Slot_RightGauntlet, 0 },
|
||||||
{ &NpcAnimation::mShirt, MWWorld::InventoryStore::Slot_Shirt, 0 },
|
{ &NpcAnimation::mShirt, MWWorld::InventoryStore::Slot_Shirt, 0 },
|
||||||
{ &NpcAnimation::mPants, MWWorld::InventoryStore::Slot_Pants, 0 },
|
{ &NpcAnimation::mPants, MWWorld::InventoryStore::Slot_Pants, 0 },
|
||||||
|
{ &NpcAnimation::mShield, MWWorld::InventoryStore::Slot_CarriedLeft, 0 }
|
||||||
};
|
};
|
||||||
static const size_t slotlistsize = sizeof(slotlist)/sizeof(slotlist[0]);
|
static const size_t slotlistsize = sizeof(slotlist)/sizeof(slotlist[0]);
|
||||||
|
|
||||||
|
@ -333,6 +337,8 @@ void NpcAnimation::updateParts(bool forceupdate)
|
||||||
if (mPartPriorities[part] < 1 && bodypart)
|
if (mPartPriorities[part] < 1 && bodypart)
|
||||||
addOrReplaceIndividualPart(part, -1,1, "meshes\\"+bodypart->mModel);
|
addOrReplaceIndividualPart(part, -1,1, "meshes\\"+bodypart->mModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showWeapons(mShowWeapons);
|
||||||
}
|
}
|
||||||
|
|
||||||
NifOgre::ObjectList NpcAnimation::insertBoundedPart(const std::string &model, int group, const std::string &bonename)
|
NifOgre::ObjectList NpcAnimation::insertBoundedPart(const std::string &model, int group, const std::string &bonename)
|
||||||
|
@ -464,4 +470,23 @@ void NpcAnimation::addPartGroup(int group, int priority, const std::vector<ESM::
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NpcAnimation::showWeapons(bool showWeapon)
|
||||||
|
{
|
||||||
|
mShowWeapons = showWeapon;
|
||||||
|
if(showWeapon)
|
||||||
|
{
|
||||||
|
MWWorld::InventoryStore &inv = MWWorld::Class::get(mPtr).getInventoryStore(mPtr);
|
||||||
|
mWeapon = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedRight);
|
||||||
|
if(mWeapon != inv.end()) // special case for weapons
|
||||||
|
{
|
||||||
|
std::string mesh = MWWorld::Class::get(*mWeapon).getModel(*mWeapon);
|
||||||
|
addOrReplaceIndividualPart(ESM::PRT_Weapon,-1,1,mesh);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
removeIndividualPart(ESM::PRT_Weapon);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,7 @@ private:
|
||||||
std::string mHairModel;
|
std::string mHairModel;
|
||||||
std::string mBodyPrefix;
|
std::string mBodyPrefix;
|
||||||
ViewMode mViewMode;
|
ViewMode mViewMode;
|
||||||
|
bool mShowWeapons;
|
||||||
|
|
||||||
float mTimeToChange;
|
float mTimeToChange;
|
||||||
MWWorld::ContainerStoreIterator mRobe;
|
MWWorld::ContainerStoreIterator mRobe;
|
||||||
|
@ -60,6 +61,8 @@ private:
|
||||||
MWWorld::ContainerStoreIterator mGloveL;
|
MWWorld::ContainerStoreIterator mGloveL;
|
||||||
MWWorld::ContainerStoreIterator mGloveR;
|
MWWorld::ContainerStoreIterator mGloveR;
|
||||||
MWWorld::ContainerStoreIterator mSkirtIter;
|
MWWorld::ContainerStoreIterator mSkirtIter;
|
||||||
|
MWWorld::ContainerStoreIterator mWeapon;
|
||||||
|
MWWorld::ContainerStoreIterator mShield;
|
||||||
|
|
||||||
int mVisibilityFlags;
|
int mVisibilityFlags;
|
||||||
|
|
||||||
|
@ -85,6 +88,8 @@ public:
|
||||||
|
|
||||||
virtual Ogre::Vector3 runAnimation(float timepassed);
|
virtual Ogre::Vector3 runAnimation(float timepassed);
|
||||||
|
|
||||||
|
virtual void showWeapons(bool showWeapon);
|
||||||
|
|
||||||
void setViewMode(ViewMode viewMode);
|
void setViewMode(ViewMode viewMode);
|
||||||
|
|
||||||
void forceUpdate()
|
void forceUpdate()
|
||||||
|
|
Loading…
Reference in a new issue