forked from mirror/openmw-tes3mp
Use an enum to specify the NPC's view mode (normal, head only)
This commit is contained in:
parent
973fdeb2e0
commit
9f9d978b0f
3 changed files with 16 additions and 10 deletions
|
@ -59,8 +59,8 @@ namespace MWRender
|
|||
|
||||
mNode = renderRoot->createChildSceneNode();
|
||||
|
||||
mAnimation = new NpcAnimation(mCharacter, mNode,
|
||||
MWWorld::Class::get(mCharacter).getInventoryStore (mCharacter), 0, renderHeadOnly());
|
||||
mAnimation = new NpcAnimation(mCharacter, mNode, MWWorld::Class::get(mCharacter).getInventoryStore(mCharacter),
|
||||
0, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal));
|
||||
|
||||
mNode->setVisible (false);
|
||||
|
||||
|
@ -101,8 +101,8 @@ namespace MWRender
|
|||
assert(mAnimation);
|
||||
delete mAnimation;
|
||||
|
||||
mAnimation = new NpcAnimation(mCharacter, mNode,
|
||||
MWWorld::Class::get(mCharacter).getInventoryStore (mCharacter), 0, renderHeadOnly());
|
||||
mAnimation = new NpcAnimation(mCharacter, mNode, MWWorld::Class::get(mCharacter).getInventoryStore(mCharacter),
|
||||
0, (renderHeadOnly() ? NpcAnimation::VM_HeadOnly : NpcAnimation::VM_Normal));
|
||||
|
||||
float scale=1.f;
|
||||
MWWorld::Class::get(mCharacter).adjustScale(mCharacter, scale);
|
||||
|
|
|
@ -56,7 +56,7 @@ NpcAnimation::~NpcAnimation()
|
|||
}
|
||||
|
||||
|
||||
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWorld::InventoryStore& inv, int visibilityFlags, bool headOnly)
|
||||
NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWorld::InventoryStore& inv, int visibilityFlags, ViewMode viewMode)
|
||||
: Animation(ptr),
|
||||
mStateID(-1),
|
||||
mTimeToChange(0),
|
||||
|
@ -73,7 +73,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
|||
mGloveL(inv.end()),
|
||||
mGloveR(inv.end()),
|
||||
mSkirtIter(inv.end()),
|
||||
mHeadOnly(headOnly)
|
||||
mViewMode(viewMode)
|
||||
{
|
||||
mNpc = mPtr.get<ESM::NPC>()->mBase;
|
||||
|
||||
|
@ -222,7 +222,7 @@ void NpcAnimation::updateParts(bool forceupdate)
|
|||
if(!forceupdate)
|
||||
return;
|
||||
|
||||
for(size_t i = 0;i < slotlistsize && !mHeadOnly;i++)
|
||||
for(size_t i = 0;i < slotlistsize && mViewMode != VM_HeadOnly;i++)
|
||||
{
|
||||
MWWorld::ContainerStoreIterator iter = inv.getSlot(slotlist[i].slot);
|
||||
|
||||
|
@ -259,7 +259,7 @@ void NpcAnimation::updateParts(bool forceupdate)
|
|||
if(mPartPriorities[ESM::PRT_Hair] < 1 && mPartPriorities[ESM::PRT_Head] <= 1)
|
||||
addOrReplaceIndividualPart(ESM::PRT_Hair, -1,1, mHairModel);
|
||||
|
||||
if (mHeadOnly)
|
||||
if(mViewMode == VM_HeadOnly)
|
||||
return;
|
||||
|
||||
static const struct {
|
||||
|
|
|
@ -26,6 +26,11 @@ struct PartInfo {
|
|||
const char name[32];
|
||||
};
|
||||
|
||||
enum ViewMode {
|
||||
VM_Normal,
|
||||
VM_HeadOnly
|
||||
};
|
||||
|
||||
private:
|
||||
static const size_t sPartListSize = 27;
|
||||
static const PartInfo sPartList[sPartListSize];
|
||||
|
@ -39,7 +44,7 @@ private:
|
|||
std::string mHeadModel;
|
||||
std::string mHairModel;
|
||||
std::string mBodyPrefix;
|
||||
bool mHeadOnly;
|
||||
ViewMode mViewMode;
|
||||
|
||||
float mTimeToChange;
|
||||
MWWorld::ContainerStoreIterator mRobe;
|
||||
|
@ -73,7 +78,8 @@ private:
|
|||
|
||||
public:
|
||||
NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node,
|
||||
MWWorld::InventoryStore& inv, int visibilityFlags, bool headOnly=false);
|
||||
MWWorld::InventoryStore& inv, int visibilityFlags,
|
||||
ViewMode viewMode=VM_Normal);
|
||||
virtual ~NpcAnimation();
|
||||
|
||||
virtual Ogre::Vector3 runAnimation(float timepassed);
|
||||
|
|
Loading…
Reference in a new issue