forked from teamnwah/openmw-tes3coop
Remove duplicate code
This commit is contained in:
parent
0c9882956a
commit
719e884b7c
2 changed files with 22 additions and 28 deletions
|
@ -1524,19 +1524,7 @@ bool CharacterController::updateWeaponState()
|
||||||
return forcestateupdate;
|
return forcestateupdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterController::update(float duration)
|
void CharacterController::updateAnimQueue()
|
||||||
{
|
|
||||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
|
||||||
const MWWorld::Class &cls = mPtr.getClass();
|
|
||||||
osg::Vec3f movement(0.f, 0.f, 0.f);
|
|
||||||
float speed = 0.f;
|
|
||||||
|
|
||||||
updateMagicEffects();
|
|
||||||
|
|
||||||
if(!mAnimQueue.empty())
|
|
||||||
mAnimation->setLoopingEnabled(mAnimQueue.front().mGroup, mAnimQueue.size() <= 1);
|
|
||||||
|
|
||||||
if(!cls.isActor())
|
|
||||||
{
|
{
|
||||||
if(mAnimQueue.size() > 1)
|
if(mAnimQueue.size() > 1)
|
||||||
{
|
{
|
||||||
|
@ -1552,6 +1540,21 @@ void CharacterController::update(float duration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CharacterController::update(float duration)
|
||||||
|
{
|
||||||
|
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||||
|
const MWWorld::Class &cls = mPtr.getClass();
|
||||||
|
osg::Vec3f movement(0.f, 0.f, 0.f);
|
||||||
|
float speed = 0.f;
|
||||||
|
|
||||||
|
updateMagicEffects();
|
||||||
|
|
||||||
|
if(!mAnimQueue.empty())
|
||||||
|
mAnimation->setLoopingEnabled(mAnimQueue.front().mGroup, mAnimQueue.size() <= 1);
|
||||||
|
|
||||||
|
if(!cls.isActor())
|
||||||
|
updateAnimQueue();
|
||||||
else if(!cls.getCreatureStats(mPtr).isDead())
|
else if(!cls.getCreatureStats(mPtr).isDead())
|
||||||
{
|
{
|
||||||
bool onground = world->isOnGround(mPtr);
|
bool onground = world->isOnGround(mPtr);
|
||||||
|
@ -1819,19 +1822,8 @@ void CharacterController::update(float duration)
|
||||||
{
|
{
|
||||||
idlestate = (inwater ? CharState_IdleSwim : (sneak && !inJump ? CharState_IdleSneak : CharState_Idle));
|
idlestate = (inwater ? CharState_IdleSwim : (sneak && !inJump ? CharState_IdleSneak : CharState_Idle));
|
||||||
}
|
}
|
||||||
else if(mAnimQueue.size() > 1)
|
else
|
||||||
{
|
updateAnimQueue();
|
||||||
if(mAnimation->isPlaying(mAnimQueue.front().mGroup) == false)
|
|
||||||
{
|
|
||||||
mAnimation->disable(mAnimQueue.front().mGroup);
|
|
||||||
mAnimQueue.pop_front();
|
|
||||||
|
|
||||||
bool loopfallback = (mAnimQueue.front().mGroup.compare(0,4,"idle") == 0);
|
|
||||||
mAnimation->play(mAnimQueue.front().mGroup, Priority_Default,
|
|
||||||
MWRender::Animation::BlendMask_All, false,
|
|
||||||
1.0f, "start", "stop", 0.0f, mAnimQueue.front().mLoopCount, loopfallback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!mSkipAnim)
|
if (!mSkipAnim)
|
||||||
{
|
{
|
||||||
|
|
|
@ -212,6 +212,8 @@ class CharacterController : public MWRender::Animation::TextKeyListener
|
||||||
bool updateCreatureState();
|
bool updateCreatureState();
|
||||||
void updateIdleStormState(bool inwater);
|
void updateIdleStormState(bool inwater);
|
||||||
|
|
||||||
|
void updateAnimQueue();
|
||||||
|
|
||||||
void updateHeadTracking(float duration);
|
void updateHeadTracking(float duration);
|
||||||
|
|
||||||
void updateMagicEffects();
|
void updateMagicEffects();
|
||||||
|
|
Loading…
Reference in a new issue