mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-20 03:53:52 +00:00
Merge remote-tracking branch 'mrcheko/master'
This commit is contained in:
commit
f62497dfdc
5 changed files with 23 additions and 12 deletions
|
@ -178,6 +178,12 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
|
||||||
mHitState = CharState_Hit;
|
mHitState = CharState_Hit;
|
||||||
int iHit = rand() % (sHitListSize-1);
|
int iHit = rand() % (sHitListSize-1);
|
||||||
mCurrentHit = sHitList[iHit];
|
mCurrentHit = sHitList[iHit];
|
||||||
|
if(mPtr.getRefData().getHandle()=="player" && !mAnimation->hasAnimation(mCurrentHit))
|
||||||
|
{
|
||||||
|
//only 3 different hit animations if player is in 1st person
|
||||||
|
int iHit = rand() % (sHitListSize-3);
|
||||||
|
mCurrentHit = sHitList[iHit];
|
||||||
|
}
|
||||||
mAnimation->play(mCurrentHit, Priority_Hit, MWRender::Animation::Group_All, true, 1, "start", "stop", 0.0f, 0);
|
mAnimation->play(mCurrentHit, Priority_Hit, MWRender::Animation::Group_All, true, 1, "start", "stop", 0.0f, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -482,7 +488,7 @@ bool CharacterController::updateNpcState(bool onground, bool inwater, bool isrun
|
||||||
const bool isWerewolf = stats.isWerewolf();
|
const bool isWerewolf = stats.isWerewolf();
|
||||||
|
|
||||||
bool forcestateupdate = false;
|
bool forcestateupdate = false;
|
||||||
if(weaptype != mWeaponType)
|
if(weaptype != mWeaponType && mHitState != CharState_KnockDown)
|
||||||
{
|
{
|
||||||
forcestateupdate = true;
|
forcestateupdate = true;
|
||||||
|
|
||||||
|
|
|
@ -388,7 +388,6 @@ Ogre::Node *Animation::getNode(const std::string &name)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NifOgre::TextKeyMap::const_iterator Animation::findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname)
|
NifOgre::TextKeyMap::const_iterator Animation::findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname)
|
||||||
{
|
{
|
||||||
NifOgre::TextKeyMap::const_iterator iter(keys.begin());
|
NifOgre::TextKeyMap::const_iterator iter(keys.begin());
|
||||||
|
@ -1009,15 +1008,17 @@ void Animation::detachObjectFromBone(Ogre::MovableObject *obj)
|
||||||
mSkelBase->detachObjectFromBone(obj);
|
mSkelBase->detachObjectFromBone(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Animation::isPlaying(Group group) const
|
bool Animation::allowSwitchViewMode() const
|
||||||
{
|
{
|
||||||
for (AnimStateMap::const_iterator stateiter = mStates.begin(); stateiter != mStates.end(); ++stateiter)
|
for (AnimStateMap::const_iterator stateiter = mStates.begin(); stateiter != mStates.end(); ++stateiter)
|
||||||
{
|
{
|
||||||
if(stateiter->second.mGroups == group)
|
if(stateiter->second.mGroups == Group_UpperBody
|
||||||
return true;
|
|| (stateiter->first.size()==4 && stateiter->first.find("hit") != std::string::npos)
|
||||||
}
|
|| (stateiter->first.find("knock") != std::string::npos) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Animation::addEffect(const std::string &model, int effectId, bool loop, const std::string &bonename, std::string texture)
|
void Animation::addEffect(const std::string &model, int effectId, bool loop, const std::string &bonename, std::string texture)
|
||||||
{
|
{
|
||||||
|
|
|
@ -258,7 +258,8 @@ public:
|
||||||
/** Returns true if the named animation group is playing. */
|
/** Returns true if the named animation group is playing. */
|
||||||
bool isPlaying(const std::string &groupname) const;
|
bool isPlaying(const std::string &groupname) const;
|
||||||
|
|
||||||
bool isPlaying(Group group) const;
|
//Checks if playing any animation which shouldn't be stopped when switching camera view modes
|
||||||
|
bool allowSwitchViewMode() const;
|
||||||
|
|
||||||
/** Gets info about the given animation group.
|
/** Gets info about the given animation group.
|
||||||
* \param groupname Animation group to check.
|
* \param groupname Animation group to check.
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace MWRender
|
||||||
|
|
||||||
void Camera::update(float duration, bool paused)
|
void Camera::update(float duration, bool paused)
|
||||||
{
|
{
|
||||||
if (!mAnimation->isPlaying(MWRender::Animation::Group_UpperBody))
|
if (mAnimation->allowSwitchViewMode())
|
||||||
{
|
{
|
||||||
// Now process the view changes we queued earlier
|
// Now process the view changes we queued earlier
|
||||||
if (mVanityToggleQueued)
|
if (mVanityToggleQueued)
|
||||||
|
@ -144,7 +144,7 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
// Changing the view will stop all playing animations, so if we are playing
|
// Changing the view will stop all playing animations, so if we are playing
|
||||||
// anything important, queue the view change for later
|
// anything important, queue the view change for later
|
||||||
if (mAnimation->isPlaying(MWRender::Animation::Group_UpperBody))
|
if (!mAnimation->allowSwitchViewMode())
|
||||||
{
|
{
|
||||||
mViewModeToggleQueued = true;
|
mViewModeToggleQueued = true;
|
||||||
return;
|
return;
|
||||||
|
@ -171,7 +171,7 @@ namespace MWRender
|
||||||
{
|
{
|
||||||
// Changing the view will stop all playing animations, so if we are playing
|
// Changing the view will stop all playing animations, so if we are playing
|
||||||
// anything important, queue the view change for later
|
// anything important, queue the view change for later
|
||||||
if (mAnimation->isPlaying(MWRender::Animation::Group_UpperBody))
|
if (!mPreviewMode)
|
||||||
{
|
{
|
||||||
mVanityToggleQueued = true;
|
mVanityToggleQueued = true;
|
||||||
return false;
|
return false;
|
||||||
|
@ -205,7 +205,7 @@ namespace MWRender
|
||||||
|
|
||||||
void Camera::togglePreviewMode(bool enable)
|
void Camera::togglePreviewMode(bool enable)
|
||||||
{
|
{
|
||||||
if (mAnimation->isPlaying(MWRender::Animation::Group_UpperBody))
|
if (mFirstPersonView && !mAnimation->allowSwitchViewMode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(mPreviewMode == enable)
|
if(mPreviewMode == enable)
|
||||||
|
|
|
@ -141,6 +141,9 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, Ogre::SceneNode* node, int v
|
||||||
void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode)
|
void NpcAnimation::setViewMode(NpcAnimation::ViewMode viewMode)
|
||||||
{
|
{
|
||||||
assert(viewMode != VM_HeadOnly);
|
assert(viewMode != VM_HeadOnly);
|
||||||
|
if(mViewMode == viewMode)
|
||||||
|
return;
|
||||||
|
|
||||||
mViewMode = viewMode;
|
mViewMode = viewMode;
|
||||||
rebuild();
|
rebuild();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue