forked from teamnwah/openmw-tes3coop
Remove idles from the state list and rename it
This commit is contained in:
parent
e803cdbe7f
commit
9c13568bb7
1 changed files with 10 additions and 23 deletions
|
@ -44,19 +44,7 @@ struct StateInfo {
|
||||||
const char groupname[32];
|
const char groupname[32];
|
||||||
};
|
};
|
||||||
|
|
||||||
static const StateInfo sStateList[] = {
|
static const StateInfo sDeathList[] = {
|
||||||
{ CharState_Idle, "idle" },
|
|
||||||
{ CharState_Idle2, "idle2" },
|
|
||||||
{ CharState_Idle3, "idle3" },
|
|
||||||
{ CharState_Idle4, "idle4" },
|
|
||||||
{ CharState_Idle5, "idle5" },
|
|
||||||
{ CharState_Idle6, "idle6" },
|
|
||||||
{ CharState_Idle7, "idle7" },
|
|
||||||
{ CharState_Idle8, "idle8" },
|
|
||||||
{ CharState_Idle9, "idle9" },
|
|
||||||
{ CharState_IdleSwim, "idleswim" },
|
|
||||||
{ CharState_IdleSneak, "idlesneak" },
|
|
||||||
|
|
||||||
{ CharState_Death1, "death1" },
|
{ CharState_Death1, "death1" },
|
||||||
{ CharState_Death2, "death2" },
|
{ CharState_Death2, "death2" },
|
||||||
{ CharState_Death3, "death3" },
|
{ CharState_Death3, "death3" },
|
||||||
|
@ -64,8 +52,7 @@ static const StateInfo sStateList[] = {
|
||||||
{ CharState_Death5, "death5" },
|
{ CharState_Death5, "death5" },
|
||||||
{ CharState_SwimDeath, "swimdeath" },
|
{ CharState_SwimDeath, "swimdeath" },
|
||||||
};
|
};
|
||||||
static const StateInfo *sStateListEnd = &sStateList[sizeof(sStateList)/sizeof(sStateList[0])];
|
static const StateInfo *sDeathListEnd = &sDeathList[sizeof(sDeathList)/sizeof(sDeathList[0])];
|
||||||
|
|
||||||
|
|
||||||
static const StateInfo sMovementList[] = {
|
static const StateInfo sMovementList[] = {
|
||||||
{ CharState_WalkForward, "walkforward" },
|
{ CharState_WalkForward, "walkforward" },
|
||||||
|
@ -269,8 +256,8 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
|
||||||
refreshCurrentAnims(mIdleState, mMovementState, true);
|
refreshCurrentAnims(mIdleState, mMovementState, true);
|
||||||
if(mDeathState != CharState_None)
|
if(mDeathState != CharState_None)
|
||||||
{
|
{
|
||||||
const StateInfo *state = std::find_if(sStateList, sStateListEnd, FindCharState(mDeathState));
|
const StateInfo *state = std::find_if(sDeathList, sDeathListEnd, FindCharState(mDeathState));
|
||||||
if(state == sStateListEnd)
|
if(state == sDeathListEnd)
|
||||||
throw std::runtime_error("Failed to find character state "+Ogre::StringConverter::toString(mDeathState));
|
throw std::runtime_error("Failed to find character state "+Ogre::StringConverter::toString(mDeathState));
|
||||||
|
|
||||||
mCurrentDeath = state->groupname;
|
mCurrentDeath = state->groupname;
|
||||||
|
@ -633,8 +620,8 @@ void CharacterController::forceStateUpdate()
|
||||||
refreshCurrentAnims(mIdleState, mMovementState, true);
|
refreshCurrentAnims(mIdleState, mMovementState, true);
|
||||||
if(mDeathState != CharState_None)
|
if(mDeathState != CharState_None)
|
||||||
{
|
{
|
||||||
const StateInfo *state = std::find_if(sStateList, sStateListEnd, FindCharState(mDeathState));
|
const StateInfo *state = std::find_if(sDeathList, sDeathListEnd, FindCharState(mDeathState));
|
||||||
if(state == sStateListEnd)
|
if(state == sDeathListEnd)
|
||||||
throw std::runtime_error("Failed to find character state "+Ogre::StringConverter::toString(mDeathState));
|
throw std::runtime_error("Failed to find character state "+Ogre::StringConverter::toString(mDeathState));
|
||||||
|
|
||||||
mCurrentDeath = state->groupname;
|
mCurrentDeath = state->groupname;
|
||||||
|
@ -655,8 +642,8 @@ void CharacterController::kill()
|
||||||
if(MWBase::Environment::get().getWorld()->isSwimming(mPtr))
|
if(MWBase::Environment::get().getWorld()->isSwimming(mPtr))
|
||||||
{
|
{
|
||||||
mDeathState = CharState_SwimDeath;
|
mDeathState = CharState_SwimDeath;
|
||||||
state = std::find_if(sStateList, sStateListEnd, FindCharState(mDeathState));
|
state = std::find_if(sDeathList, sDeathListEnd, FindCharState(mDeathState));
|
||||||
if(state == sStateListEnd)
|
if(state == sDeathListEnd)
|
||||||
throw std::runtime_error("Failed to find character state "+Ogre::StringConverter::toString(mDeathState));
|
throw std::runtime_error("Failed to find character state "+Ogre::StringConverter::toString(mDeathState));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -671,8 +658,8 @@ void CharacterController::kill()
|
||||||
mDeathState = states[pos];
|
mDeathState = states[pos];
|
||||||
states.erase(states.begin()+pos);
|
states.erase(states.begin()+pos);
|
||||||
|
|
||||||
state = std::find_if(sStateList, sStateListEnd, FindCharState(mDeathState));
|
state = std::find_if(sDeathList, sDeathListEnd, FindCharState(mDeathState));
|
||||||
if(state == sStateListEnd)
|
if(state == sDeathListEnd)
|
||||||
throw std::runtime_error("Failed to find character state "+Ogre::StringConverter::toString(mDeathState));
|
throw std::runtime_error("Failed to find character state "+Ogre::StringConverter::toString(mDeathState));
|
||||||
}
|
}
|
||||||
mCurrentDeath = state->groupname;
|
mCurrentDeath = state->groupname;
|
||||||
|
|
Loading…
Reference in a new issue