From df78357e0512e05c444ac41f98b7f3118e5c4bf9 Mon Sep 17 00:00:00 2001 From: scrawl Date: Sun, 2 Feb 2014 03:24:40 +0100 Subject: [PATCH] Handle knockout separately (Closes #1151) --- apps/openmw/mwmechanics/character.cpp | 17 +++++++++++++++-- apps/openmw/mwmechanics/character.hpp | 1 + apps/openmw/mwmechanics/creaturestats.cpp | 3 --- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index d58dee9ad..2f234db7b 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -157,7 +157,14 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat bool block = mPtr.getClass().getCreatureStats(mPtr).getBlock(); if(mHitState == CharState_None) { - if(knockdown) + if (mPtr.getClass().getCreatureStats(mPtr).getFatigue().getCurrent() < 0) + { + mHitState = CharState_KnockOut; + mCurrentHit = "knockout"; + mAnimation->play(mCurrentHit, Priority_Knockdown, MWRender::Animation::Group_All, false, 1, "start", "stop", 0.0f, ~0ul); + mPtr.getClass().getCreatureStats(mPtr).setKnockedDown(true); + } + else if(knockdown) { mHitState = CharState_KnockDown; mCurrentHit = "knockdown"; @@ -187,6 +194,12 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat mPtr.getClass().getCreatureStats(mPtr).setBlock(false); mHitState = CharState_None; } + else if (mHitState == CharState_KnockOut && mPtr.getClass().getCreatureStats(mPtr).getFatigue().getCurrent() > 0) + { + mHitState = CharState_KnockDown; + mAnimation->disable(mCurrentHit); + mAnimation->play(mCurrentHit, Priority_Knockdown, MWRender::Animation::Group_All, true, 1, "loop stop", "stop", 0.0f, 0); + } } const WeaponInfo *weap = std::find_if(sWeaponTypeList, sWeaponTypeListEnd, FindWeaponType(mWeaponType)); @@ -1121,7 +1134,7 @@ void CharacterController::update(float duration) if (!mSkipAnim) { rot *= Ogre::Math::RadiansToDegrees(1.0f); - if(mHitState != CharState_KnockDown) + if(mHitState != CharState_KnockDown && mHitState != CharState_KnockOut) { world->rotateObject(mPtr, rot.x, rot.y, rot.z, true); } diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index 8b6dc6c94..0c022c462 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -93,6 +93,7 @@ enum CharacterState { CharState_Hit, CharState_KnockDown, + CharState_KnockOut, CharState_Block }; diff --git a/apps/openmw/mwmechanics/creaturestats.cpp b/apps/openmw/mwmechanics/creaturestats.cpp index c862c0ab4..8f890befb 100644 --- a/apps/openmw/mwmechanics/creaturestats.cpp +++ b/apps/openmw/mwmechanics/creaturestats.cpp @@ -179,9 +179,6 @@ namespace MWMechanics mDynamic[index] = value; - if (index == 2 && value.getCurrent() < 0) - setKnockedDown(true); - if (index==0 && mDynamic[index].getCurrent()<1) { if (!mDead)