mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-31 14:36:39 +00:00
Merge remote-tracking branch 'kcat/cleanups'
This commit is contained in:
commit
6cf9691591
5 changed files with 81 additions and 85 deletions
|
@ -412,7 +412,14 @@ namespace MWClass
|
||||||
MWBase::Environment::get().getSoundManager()->playSound3D(victim, "critical damage", 1.0f, 1.0f);
|
MWBase::Environment::get().getSoundManager()->playSound3D(victim, "critical damage", 1.0f, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
healthdmg = (otherstats.getFatigue().getCurrent() < 1.0f || npcstats.isWerewolf());
|
healthdmg = (otherstats.getFatigue().getCurrent() < 1.0f);
|
||||||
|
if(npcstats.isWerewolf())
|
||||||
|
{
|
||||||
|
healthdmg = true;
|
||||||
|
// GLOB instead of GMST because it gets updated during a quest
|
||||||
|
const MWWorld::Store<ESM::Global> &glob = world->getStore().get<ESM::Global>();
|
||||||
|
damage *= glob.find("WerewolfClawMult")->mValue.getFloat();
|
||||||
|
}
|
||||||
if(healthdmg)
|
if(healthdmg)
|
||||||
damage *= gmst.find("fHandtoHandHealthPer")->getFloat();
|
damage *= gmst.find("fHandtoHandHealthPer")->getFloat();
|
||||||
}
|
}
|
||||||
|
|
|
@ -951,14 +951,6 @@ Ogre::AxisAlignedBox Animation::getWorldBounds()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Animation::isPriorityActive(int priority) const
|
|
||||||
{
|
|
||||||
for (AnimStateMap::const_iterator it = mStates.begin(); it != mStates.end(); ++it)
|
|
||||||
if (it->second.mPriority == priority)
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ogre::TagPoint *Animation::attachObjectToBone(const Ogre::String &bonename, Ogre::MovableObject *obj)
|
Ogre::TagPoint *Animation::attachObjectToBone(const Ogre::String &bonename, Ogre::MovableObject *obj)
|
||||||
{
|
{
|
||||||
Ogre::TagPoint *tag = NULL;
|
Ogre::TagPoint *tag = NULL;
|
||||||
|
|
|
@ -177,9 +177,6 @@ public:
|
||||||
|
|
||||||
bool hasAnimation(const std::string &anim);
|
bool hasAnimation(const std::string &anim);
|
||||||
|
|
||||||
bool isPriorityActive (int priority) const;
|
|
||||||
///< Is there an animation playing with the given priority?
|
|
||||||
|
|
||||||
// Specifies the axis' to accumulate on. Non-accumulated axis will just
|
// Specifies the axis' to accumulate on. Non-accumulated axis will just
|
||||||
// move visually, but not affect the actual movement. Each x/y/z value
|
// move visually, but not affect the actual movement. Each x/y/z value
|
||||||
// should be on the scale of 0 to 1.
|
// should be on the scale of 0 to 1.
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
#include "../mwworld/inventorystore.hpp"
|
#include "../mwworld/inventorystore.hpp"
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
|
|
||||||
|
#include "../mwmechanics/npcstats.hpp"
|
||||||
|
|
||||||
#include "../mwbase/environment.hpp"
|
#include "../mwbase/environment.hpp"
|
||||||
#include "../mwbase/world.hpp"
|
#include "../mwbase/world.hpp"
|
||||||
#include "../mwbase/mechanicsmanager.hpp"
|
#include "../mwbase/mechanicsmanager.hpp"
|
||||||
|
@ -92,45 +94,7 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, MWWor
|
||||||
mPartPriorities[i] = 0;
|
mPartPriorities[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MWWorld::ESMStore &store =
|
updateNpcBase();
|
||||||
MWBase::Environment::get().getWorld()->getStore();
|
|
||||||
const ESM::Race *race = store.get<ESM::Race>().find(mNpc->mRace);
|
|
||||||
|
|
||||||
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHead)->mModel;
|
|
||||||
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHair)->mModel;
|
|
||||||
|
|
||||||
mBodyPrefix = "b_n_" + mNpc->mRace;
|
|
||||||
Misc::StringUtils::toLower(mBodyPrefix);
|
|
||||||
|
|
||||||
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
|
|
||||||
std::string smodel = (viewMode != VM_FirstPerson) ?
|
|
||||||
(!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif") :
|
|
||||||
(!isBeast ? "meshes\\base_anim.1st.nif" : "meshes\\base_animkna.1st.nif") ;
|
|
||||||
setObjectRoot(smodel, true);
|
|
||||||
|
|
||||||
if(mViewMode != VM_FirstPerson)
|
|
||||||
{
|
|
||||||
addAnimSource(smodel);
|
|
||||||
if(mBodyPrefix.find("argonian") != std::string::npos)
|
|
||||||
addAnimSource("meshes\\argonian_swimkna.nif");
|
|
||||||
else if(!mNpc->isMale() && !isBeast)
|
|
||||||
addAnimSource("meshes\\base_anim_female.nif");
|
|
||||||
if(mNpc->mModel.length() > 0)
|
|
||||||
addAnimSource("meshes\\"+mNpc->mModel);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* A bit counter-intuitive, but unlike third-person anims, it seems
|
|
||||||
* beast races get both base_anim.1st.nif and base_animkna.1st.nif.
|
|
||||||
*/
|
|
||||||
addAnimSource("meshes\\base_anim.1st.nif");
|
|
||||||
if(isBeast)
|
|
||||||
addAnimSource("meshes\\base_animkna.1st.nif");
|
|
||||||
if(!mNpc->isMale() && !isBeast)
|
|
||||||
addAnimSource("meshes\\base_anim_female.1st.nif");
|
|
||||||
}
|
|
||||||
|
|
||||||
forceUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode)
|
void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode)
|
||||||
|
@ -138,27 +102,57 @@ void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode)
|
||||||
assert(viewMode != VM_HeadOnly);
|
assert(viewMode != VM_HeadOnly);
|
||||||
mViewMode = viewMode;
|
mViewMode = viewMode;
|
||||||
|
|
||||||
|
updateNpcBase();
|
||||||
|
|
||||||
|
MWBase::Environment::get().getMechanicsManager()->forceStateUpdate(mPtr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NpcAnimation::updateNpcBase()
|
||||||
|
{
|
||||||
clearAnimSources();
|
clearAnimSources();
|
||||||
|
|
||||||
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 = MWWorld::Class::get(mPtr).getNpcStats(mPtr).isWerewolf();
|
||||||
|
|
||||||
|
if(!isWerewolf)
|
||||||
|
{
|
||||||
|
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHead)->mModel;
|
||||||
|
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find(mNpc->mHair)->mModel;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mHeadModel = "meshes\\" + store.get<ESM::BodyPart>().find("WerewolfHead")->mModel;
|
||||||
|
mHairModel = "meshes\\" + store.get<ESM::BodyPart>().find("WerewolfHair")->mModel;
|
||||||
|
}
|
||||||
|
|
||||||
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
|
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;
|
||||||
std::string smodel = (viewMode != VM_FirstPerson) ?
|
std::string smodel = (mViewMode != VM_FirstPerson) ?
|
||||||
(!isBeast ? "meshes\\base_anim.nif" : "meshes\\base_animkna.nif") :
|
(!isWerewolf ? !isBeast ? "meshes\\base_anim.nif"
|
||||||
(!isBeast ? "meshes\\base_anim.1st.nif" : "meshes\\base_animkna.1st.nif") ;
|
: "meshes\\base_animkna.nif"
|
||||||
|
: "meshes\\wolf\\skin.nif") :
|
||||||
|
(!isWerewolf ? !isBeast ? "meshes\\base_anim.1st.nif"
|
||||||
|
: "meshes\\base_animkna.1st.nif"
|
||||||
|
: "meshes\\wolf\\skin.1st.nif");
|
||||||
setObjectRoot(smodel, true);
|
setObjectRoot(smodel, true);
|
||||||
|
|
||||||
if(mViewMode != VM_FirstPerson)
|
if(mViewMode != VM_FirstPerson)
|
||||||
{
|
{
|
||||||
addAnimSource(smodel);
|
addAnimSource(smodel);
|
||||||
if(mBodyPrefix.find("argonian") != std::string::npos)
|
if(!isWerewolf)
|
||||||
|
{
|
||||||
|
if(Misc::StringUtils::lowerCase(mNpc->mRace).find("argonian") != std::string::npos)
|
||||||
addAnimSource("meshes\\argonian_swimkna.nif");
|
addAnimSource("meshes\\argonian_swimkna.nif");
|
||||||
else if(!mNpc->isMale() && !isBeast)
|
else if(!mNpc->isMale() && !isBeast)
|
||||||
addAnimSource("meshes\\base_anim_female.nif");
|
addAnimSource("meshes\\base_anim_female.nif");
|
||||||
if(mNpc->mModel.length() > 0)
|
if(mNpc->mModel.length() > 0)
|
||||||
addAnimSource("meshes\\"+mNpc->mModel);
|
addAnimSource("meshes\\"+mNpc->mModel);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(isWerewolf)
|
||||||
|
addAnimSource(smodel);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* A bit counter-intuitive, but unlike third-person anims, it seems
|
/* A bit counter-intuitive, but unlike third-person anims, it seems
|
||||||
|
@ -170,7 +164,7 @@ void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode)
|
||||||
if(!mNpc->isMale() && !isBeast)
|
if(!mNpc->isMale() && !isBeast)
|
||||||
addAnimSource("meshes\\base_anim_female.1st.nif");
|
addAnimSource("meshes\\base_anim_female.1st.nif");
|
||||||
}
|
}
|
||||||
MWBase::Environment::get().getMechanicsManager()->forceStateUpdate(mPtr);
|
}
|
||||||
|
|
||||||
for(size_t i = 0;i < ESM::PRT_Count;i++)
|
for(size_t i = 0;i < ESM::PRT_Count;i++)
|
||||||
removeIndividualPart((ESM::PartReferenceType)i);
|
removeIndividualPart((ESM::PartReferenceType)i);
|
||||||
|
@ -499,10 +493,12 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
|
||||||
mPartPriorities[type] = priority;
|
mPartPriorities[type] = priority;
|
||||||
|
|
||||||
mObjectParts[type] = insertBoundedPart(mesh, group, sPartList.at(type));
|
mObjectParts[type] = insertBoundedPart(mesh, group, sPartList.at(type));
|
||||||
if(mObjectParts[type].mSkelBase && mObjectParts[type].mSkelBase->isParentTagPoint())
|
if(mObjectParts[type].mSkelBase)
|
||||||
|
{
|
||||||
|
Ogre::SkeletonInstance *skel = mObjectParts[type].mSkelBase->getSkeleton();
|
||||||
|
if(mObjectParts[type].mSkelBase->isParentTagPoint())
|
||||||
{
|
{
|
||||||
Ogre::Node *root = mObjectParts[type].mSkelBase->getParentNode();
|
Ogre::Node *root = mObjectParts[type].mSkelBase->getParentNode();
|
||||||
Ogre::SkeletonInstance *skel = mObjectParts[type].mSkelBase->getSkeleton();
|
|
||||||
if(skel->hasBone("BoneOffset"))
|
if(skel->hasBone("BoneOffset"))
|
||||||
{
|
{
|
||||||
Ogre::Bone *offset = skel->getBone("BoneOffset");
|
Ogre::Bone *offset = skel->getBone("BoneOffset");
|
||||||
|
@ -515,6 +511,9 @@ bool NpcAnimation::addOrReplaceIndividualPart(ESM::PartReferenceType type, int g
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateSkeletonInstance(mSkelBase->getSkeleton(), skel);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// type == ESM::PRT_Head should get an animation source based on the current output of
|
// type == ESM::PRT_Head should get an animation source based on the current output of
|
||||||
// the actor's 'say' sound (0 = silent, 1 = loud?).
|
// the actor's 'say' sound (0 = silent, 1 = loud?).
|
||||||
|
|
|
@ -40,7 +40,6 @@ private:
|
||||||
const ESM::NPC *mNpc;
|
const ESM::NPC *mNpc;
|
||||||
std::string mHeadModel;
|
std::string mHeadModel;
|
||||||
std::string mHairModel;
|
std::string mHairModel;
|
||||||
std::string mBodyPrefix;
|
|
||||||
ViewMode mViewMode;
|
ViewMode mViewMode;
|
||||||
bool mShowWeapons;
|
bool mShowWeapons;
|
||||||
|
|
||||||
|
@ -65,6 +64,8 @@ private:
|
||||||
int mPartslots[ESM::PRT_Count]; //Each part slot is taken by clothing, armor, or is empty
|
int mPartslots[ESM::PRT_Count]; //Each part slot is taken by clothing, armor, or is empty
|
||||||
int mPartPriorities[ESM::PRT_Count];
|
int mPartPriorities[ESM::PRT_Count];
|
||||||
|
|
||||||
|
void updateNpcBase();
|
||||||
|
|
||||||
NifOgre::ObjectList insertBoundedPart(const std::string &model, int group, const std::string &bonename);
|
NifOgre::ObjectList insertBoundedPart(const std::string &model, int group, const std::string &bonename);
|
||||||
|
|
||||||
void updateParts(bool forceupdate = false);
|
void updateParts(bool forceupdate = false);
|
||||||
|
|
Loading…
Reference in a new issue