1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-02 04:45:32 +00:00

bug repairing

This commit is contained in:
mrcheko 2014-01-06 22:00:01 +02:00
parent 7002412760
commit 2591ff2d5a
3 changed files with 34 additions and 12 deletions

View file

@ -249,7 +249,8 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
else else
{ {
mAnimation->disable(mCurrentJump); mAnimation->disable(mCurrentJump);
mCurrentJump.clear(); //mCurrentJump.clear();
mCurrentJump = jump;
mAnimation->play(jump, Priority_Jump, jumpgroup, true, mAnimation->play(jump, Priority_Jump, jumpgroup, true,
1.0f, "loop stop", "stop", 0.0f, 0); 1.0f, "loop stop", "stop", 0.0f, 0);
} }
@ -678,6 +679,7 @@ bool CharacterController::updateNpcState(bool onground, bool inwater, bool isrun
mUpperBodyState = UpperCharState_StartToMinAttack; mUpperBodyState = UpperCharState_StartToMinAttack;
} }
} }
animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete); animPlaying = mAnimation->getInfo(mCurrentWeapon, &complete);
} }
else else
@ -725,7 +727,6 @@ bool CharacterController::updateNpcState(bool onground, bool inwater, bool isrun
mUpperBodyState == UpperCharState_CastingSpell) mUpperBodyState == UpperCharState_CastingSpell)
{ {
mUpperBodyState = UpperCharState_WeapEquiped; mUpperBodyState = UpperCharState_WeapEquiped;
//don't allow to continue playing hit animation on UpperBody after actor had attacked during it //don't allow to continue playing hit animation on UpperBody after actor had attacked during it
if(mHitState != CharState_None) if(mHitState != CharState_None)
{ {
@ -748,6 +749,12 @@ bool CharacterController::updateNpcState(bool onground, bool inwater, bool isrun
stop = mAttackType+" max attack"; stop = mAttackType+" max attack";
mUpperBodyState = UpperCharState_MinAttackToMaxAttack; mUpperBodyState = UpperCharState_MinAttackToMaxAttack;
break; break;
/*case UpperCharState_MinAttackToMaxAttack:
if(!mAnimation->isPlaying(mCurrentWeapon))
mAnimation->play(mCurrentWeapon, Priority_Weapon,
MWRender::Animation::Group_UpperBody, false,
1e-9f, mAttackType+" min attack", mAttackType+" max attack", 0.99f, ~0ul);
break;*/
case UpperCharState_MaxAttackToMinHit: case UpperCharState_MaxAttackToMinHit:
if(mAttackType == "shoot") if(mAttackType == "shoot")
{ {
@ -797,12 +804,8 @@ bool CharacterController::updateNpcState(bool onground, bool inwater, bool isrun
} }
} }
if(!animPlaying)
{
mAnimation->setAccumulation(Ogre::Vector3(1.0f, 1.0f, 0.0f));
}
//if playing combat animation and lowerbody is not busy switch to whole body animation //if playing combat animation and lowerbody is not busy switch to whole body animation
if(weaptype != WeapType_None && animPlaying) if((weaptype != WeapType_None || UpperCharState_UnEquipingWeap) && animPlaying)
{ {
if( mMovementState != CharState_None || if( mMovementState != CharState_None ||
mJumpState != JumpState_None || mJumpState != JumpState_None ||
@ -810,16 +813,15 @@ bool CharacterController::updateNpcState(bool onground, bool inwater, bool isrun
MWBase::Environment::get().getWorld()->isSwimming(mPtr) || MWBase::Environment::get().getWorld()->isSwimming(mPtr) ||
cls.getStance(mPtr, MWWorld::Class::Sneak)) cls.getStance(mPtr, MWWorld::Class::Sneak))
{ {
mAnimation->setAccumulation(Ogre::Vector3(1.0f, 1.0f, 0.0f));
mAnimation->changeGroups(mCurrentWeapon, MWRender::Animation::Group_UpperBody); mAnimation->changeGroups(mCurrentWeapon, MWRender::Animation::Group_UpperBody);
} }
else else
{ {
mAnimation->setAccumulation(Ogre::Vector3(0.0f, 0.0f, 0.0f));
mAnimation->changeGroups(mCurrentWeapon, MWRender::Animation::Group_All); mAnimation->changeGroups(mCurrentWeapon, MWRender::Animation::Group_All);
} }
} }
MWWorld::ContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft); MWWorld::ContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
if(torch != inv.end() && torch->getTypeName() == typeid(ESM::Light).name() if(torch != inv.end() && torch->getTypeName() == typeid(ESM::Light).name()
&& mWeaponType != WeapType_Spell && mWeaponType != WeapType_HandToHand) && mWeaponType != WeapType_Spell && mWeaponType != WeapType_HandToHand)
@ -1001,7 +1003,13 @@ void CharacterController::update(float duration)
else else
{ {
if(!(vec.z > 0.0f)) if(!(vec.z > 0.0f))
{
if(!mAnimation->isPlaying(mCurrentJump))
{
mJumpState = JumpState_None; mJumpState = JumpState_None;
mCurrentJump.clear();
}
}
vec.z = 0.0f; vec.z = 0.0f;
if(std::abs(vec.x/2.0f) > std::abs(vec.y)) if(std::abs(vec.x/2.0f) > std::abs(vec.y))

View file

@ -562,6 +562,7 @@ void Animation::updatePosition(float oldtime, float newtime, Ogre::Vector3 &posi
/* Translate the accumulation root back to compensate for the move. */ /* Translate the accumulation root back to compensate for the move. */
mAccumRoot->setPosition(-off); mAccumRoot->setPosition(-off);
mAccumRootPosUpd=true;
} }
bool Animation::reset(AnimState &state, const NifOgre::TextKeyMap &keys, const std::string &groupname, const std::string &start, const std::string &stop, float startpoint) bool Animation::reset(AnimState &state, const NifOgre::TextKeyMap &keys, const std::string &groupname, const std::string &start, const std::string &stop, float startpoint)
@ -851,7 +852,7 @@ void Animation::disable(const std::string &groupname)
Ogre::Vector3 Animation::runAnimation(float duration) Ogre::Vector3 Animation::runAnimation(float duration)
{ {
Ogre::Vector3 movement(0.0f); Ogre::Vector3 movement(0.0f);
mAccumRootPosUpd = false;
AnimStateMap::iterator stateiter = mStates.begin(); AnimStateMap::iterator stateiter = mStates.begin();
while(stateiter != mStates.end()) while(stateiter != mStates.end())
{ {
@ -945,6 +946,18 @@ Ogre::Vector3 Animation::runAnimation(float duration)
updateEffects(duration); updateEffects(duration);
if (!mAccumRootPosUpd)
{
for(stateiter = mStates.begin();stateiter != mStates.end(); stateiter++)
{
if(mNonAccumCtrl && stateiter->first == mAnimationValuePtr[0]->getAnimName())
{
updatePosition(stateiter->second.mTime, stateiter->second.mTime, movement);
break;
}
}
}
return movement; return movement;
} }

View file

@ -128,6 +128,7 @@ protected:
NifOgre::ObjectScenePtr mObjectRoot; NifOgre::ObjectScenePtr mObjectRoot;
AnimSourceList mAnimSources; AnimSourceList mAnimSources;
Ogre::Node *mAccumRoot; Ogre::Node *mAccumRoot;
bool mAccumRootPosUpd;
Ogre::Node *mNonAccumRoot; Ogre::Node *mNonAccumRoot;
NifOgre::NodeTargetValue<Ogre::Real> *mNonAccumCtrl; NifOgre::NodeTargetValue<Ogre::Real> *mNonAccumCtrl;
Ogre::Vector3 mAccumulate; Ogre::Vector3 mAccumulate;