mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-01 19:15:31 +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);
|
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)
|
if(force || movement != mMovementState)
|
||||||
{
|
{
|
||||||
mMovementState = movement;
|
mMovementState = movement;
|
||||||
|
@ -737,6 +773,7 @@ void CharacterController::update(float duration)
|
||||||
{
|
{
|
||||||
const MWWorld::Store<ESM::GameSetting> &gmst = world->getStore().get<ESM::GameSetting>();
|
const MWWorld::Store<ESM::GameSetting> &gmst = world->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
|
forcestateupdate = (mJumpState != JumpState_Falling);
|
||||||
mJumpState = JumpState_Falling;
|
mJumpState = JumpState_Falling;
|
||||||
|
|
||||||
// This is a guess. All that seems to be known is that "While the player is in the
|
// 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)
|
else if(vec.z > 0.0f && mJumpState == JumpState_None)
|
||||||
{
|
{
|
||||||
|
forcestateupdate = true;
|
||||||
mJumpState = JumpState_Falling;
|
mJumpState = JumpState_Falling;
|
||||||
|
|
||||||
float z = cls.getJump(mPtr);
|
float z = cls.getJump(mPtr);
|
||||||
|
@ -772,6 +810,7 @@ void CharacterController::update(float duration)
|
||||||
}
|
}
|
||||||
else if(mJumpState == JumpState_Falling)
|
else if(mJumpState == JumpState_Falling)
|
||||||
{
|
{
|
||||||
|
forcestateupdate = true;
|
||||||
mJumpState = JumpState_Landing;
|
mJumpState = JumpState_Landing;
|
||||||
vec.z = 0.0f;
|
vec.z = 0.0f;
|
||||||
}
|
}
|
||||||
|
@ -831,7 +870,7 @@ void CharacterController::update(float duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cls.isNpc())
|
if(cls.isNpc())
|
||||||
forcestateupdate = updateNpcState(onground, inwater, isrunning, sneak);
|
forcestateupdate = updateNpcState(onground, inwater, isrunning, sneak) || forcestateupdate;
|
||||||
|
|
||||||
refreshCurrentAnims(idlestate, movestate, forcestateupdate);
|
refreshCurrentAnims(idlestate, movestate, forcestateupdate);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ class NpcStats;
|
||||||
|
|
||||||
enum Priority {
|
enum Priority {
|
||||||
Priority_Default,
|
Priority_Default,
|
||||||
|
Priority_Jump,
|
||||||
Priority_Movement,
|
Priority_Movement,
|
||||||
Priority_Weapon,
|
Priority_Weapon,
|
||||||
Priority_Torch,
|
Priority_Torch,
|
||||||
|
@ -142,6 +143,7 @@ class CharacterController
|
||||||
UpperBodyCharacterState mUpperBodyState;
|
UpperBodyCharacterState mUpperBodyState;
|
||||||
|
|
||||||
JumpingState mJumpState;
|
JumpingState mJumpState;
|
||||||
|
std::string mCurrentJump;
|
||||||
|
|
||||||
WeaponType mWeaponType;
|
WeaponType mWeaponType;
|
||||||
std::string mCurrentWeapon;
|
std::string mCurrentWeapon;
|
||||||
|
|
Loading…
Reference in a new issue