1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 09:35:28 +00:00

Merge SpecialIdle character state into Idle

This commit is contained in:
Chris Robinson 2013-01-21 03:24:52 -08:00
parent 6905bd18ba
commit e956a1cbc0
2 changed files with 7 additions and 13 deletions

View File

@ -36,8 +36,7 @@ static const struct {
const char groupname[32]; const char groupname[32];
Ogre::Vector3 accumulate; Ogre::Vector3 accumulate;
} sStateList[] = { } sStateList[] = {
{ CharState_SpecialIdle, "idle", Ogre::Vector3(1.0f, 1.0f, 0.0f) }, { CharState_Idle, "idle", Ogre::Vector3(1.0f, 1.0f, 0.0f) },
{ CharState_Idle, "idle", Ogre::Vector3::ZERO },
{ CharState_WalkForward, "walkforward", Ogre::Vector3(0.0f, 1.0f, 0.0f) }, { CharState_WalkForward, "walkforward", Ogre::Vector3(0.0f, 1.0f, 0.0f) },
{ CharState_WalkBack, "walkback", Ogre::Vector3(0.0f, 1.0f, 0.0f) }, { CharState_WalkBack, "walkback", Ogre::Vector3(0.0f, 1.0f, 0.0f) },
@ -163,8 +162,7 @@ Ogre::Vector3 CharacterController::update(float duration)
movement += mAnimation->runAnimation(duration); movement += mAnimation->runAnimation(duration);
mSkipAnim = false; mSkipAnim = false;
if(!(getState() == CharState_SpecialIdle || getState() == CharState_Idle || if(!(getState() == CharState_Idle || getState() == CharState_Dead))
getState() == CharState_Dead))
{ {
movement = mDirection * movement.length(); movement = mDirection * movement.length();
} }
@ -175,7 +173,9 @@ Ogre::Vector3 CharacterController::update(float duration)
void CharacterController::playGroup(const std::string &groupname, int mode, int count) void CharacterController::playGroup(const std::string &groupname, int mode, int count)
{ {
if(mAnimation && mAnimation->hasAnimation(groupname)) if(!mAnimation || !mAnimation->hasAnimation(groupname))
std::cerr<< "Animation "<<groupname<<" not found" <<std::endl;
else
{ {
count = std::max(count, 1); count = std::max(count, 1);
if(mode != 0 || mAnimQueue.size() == 0) if(mode != 0 || mAnimQueue.size() == 0)
@ -184,7 +184,7 @@ void CharacterController::playGroup(const std::string &groupname, int mode, int
while(count-- > 0) while(count-- > 0)
mAnimQueue.push_back(groupname); mAnimQueue.push_back(groupname);
mCurrentGroup = groupname; mCurrentGroup = groupname;
mState = CharState_SpecialIdle; mState = CharState_Idle;
mLoop = false; mLoop = false;
mAnimation->setAccumulation(Ogre::Vector3::ZERO); mAnimation->setAccumulation(Ogre::Vector3::ZERO);
mAnimation->play(mCurrentGroup, ((mode==2) ? "loop start" : "start")); mAnimation->play(mCurrentGroup, ((mode==2) ? "loop start" : "start"));
@ -207,12 +207,7 @@ void CharacterController::skipAnim()
void CharacterController::setState(CharacterState state, bool loop) void CharacterController::setState(CharacterState state, bool loop)
{ {
if(mState == state) if(mState == state)
{ return;
// If setting the same state again, only reset the animation if looping
// is being turned on.
if(mLoop == loop || !(mLoop=loop))
return;
}
else else
{ {
mState = state; mState = state;

View File

@ -14,7 +14,6 @@ namespace MWMechanics
{ {
enum CharacterState { enum CharacterState {
CharState_SpecialIdle, /* When running a PlayGroup/LoopGroup animation. */
CharState_Idle, CharState_Idle,
CharState_WalkForward, CharState_WalkForward,