mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 09:23:51 +00:00
Implement jumping animations
This commit is contained in:
parent
48e594b7c4
commit
ac3d3df9fc
2 changed files with 42 additions and 1 deletions
|
@ -179,6 +179,42 @@ void CharacterController::refreshCurrentAnims(CharacterState idle, CharacterStat
|
|||
1.0f, "start", "stop", 0.0f, ~0ul);
|
||||
}
|
||||
|
||||
if(force && mJumpState != JumpState_None)
|
||||
{
|
||||
std::string jump;
|
||||
MWRender::Animation::Group jumpgroup = MWRender::Animation::Group_All;
|
||||
if(mJumpState != JumpState_None)
|
||||
{
|
||||
jump = "jump";
|
||||
if(weap != sWeaponTypeListEnd)
|
||||
{
|
||||
jump += weap->shortgroup;
|
||||
if(!mAnimation->hasAnimation(jump))
|
||||
{
|
||||
jumpgroup = MWRender::Animation::Group_LowerBody;
|
||||
jump = "jump";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(mJumpState == JumpState_Falling)
|
||||
{
|
||||
int mode = ((jump == mCurrentJump) ? 2 : 1);
|
||||
|
||||
mAnimation->disable(mCurrentJump);
|
||||
mCurrentJump = jump;
|
||||
mAnimation->play(mCurrentJump, Priority_Jump, jumpgroup, false,
|
||||
1.0f, ((mode!=2)?"start":"loop start"), "stop", 0.0f, ~0ul);
|
||||
}
|
||||
else
|
||||
{
|
||||
mAnimation->disable(mCurrentJump);
|
||||
mCurrentJump.clear();
|
||||
mAnimation->play(jump, Priority_Jump, jumpgroup, true,
|
||||
1.0f, "loop stop", "stop", 0.0f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
if(force || movement != mMovementState)
|
||||
{
|
||||
mMovementState = movement;
|
||||
|
@ -737,6 +773,7 @@ void CharacterController::update(float duration)
|
|||
{
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst = world->getStore().get<ESM::GameSetting>();
|
||||
|
||||
forcestateupdate = (mJumpState != JumpState_Falling);
|
||||
mJumpState = JumpState_Falling;
|
||||
|
||||
// This is a guess. All that seems to be known is that "While the player is in the
|
||||
|
@ -757,6 +794,7 @@ void CharacterController::update(float duration)
|
|||
}
|
||||
else if(vec.z > 0.0f && mJumpState == JumpState_None)
|
||||
{
|
||||
forcestateupdate = true;
|
||||
mJumpState = JumpState_Falling;
|
||||
|
||||
float z = cls.getJump(mPtr);
|
||||
|
@ -772,6 +810,7 @@ void CharacterController::update(float duration)
|
|||
}
|
||||
else if(mJumpState == JumpState_Falling)
|
||||
{
|
||||
forcestateupdate = true;
|
||||
mJumpState = JumpState_Landing;
|
||||
vec.z = 0.0f;
|
||||
}
|
||||
|
@ -831,7 +870,7 @@ void CharacterController::update(float duration)
|
|||
}
|
||||
|
||||
if(cls.isNpc())
|
||||
forcestateupdate = updateNpcState(onground, inwater, isrunning, sneak);
|
||||
forcestateupdate = updateNpcState(onground, inwater, isrunning, sneak) || forcestateupdate;
|
||||
|
||||
refreshCurrentAnims(idlestate, movestate, forcestateupdate);
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ class NpcStats;
|
|||
|
||||
enum Priority {
|
||||
Priority_Default,
|
||||
Priority_Jump,
|
||||
Priority_Movement,
|
||||
Priority_Weapon,
|
||||
Priority_Torch,
|
||||
|
@ -142,6 +143,7 @@ class CharacterController
|
|||
UpperBodyCharacterState mUpperBodyState;
|
||||
|
||||
JumpingState mJumpState;
|
||||
std::string mCurrentJump;
|
||||
|
||||
WeaponType mWeaponType;
|
||||
std::string mCurrentWeapon;
|
||||
|
|
Loading…
Reference in a new issue