Move the priority enum to MWMechanics

actorid
Chris Robinson 12 years ago
parent 7ba2508556
commit 70dc2f77ad

@ -40,56 +40,56 @@ namespace MWMechanics
static const struct {
CharacterState state;
const char groupname[32];
MWRender::Animation::Priority priority;
Priority priority;
bool loops;
} sStateList[] = {
{ CharState_Idle, "idle", MWRender::Animation::Priority_Default, true },
{ CharState_Idle2, "idle2", MWRender::Animation::Priority_Default, true },
{ CharState_Idle3, "idle3", MWRender::Animation::Priority_Default, true },
{ CharState_Idle4, "idle4", MWRender::Animation::Priority_Default, true },
{ CharState_Idle5, "idle5", MWRender::Animation::Priority_Default, true },
{ CharState_Idle6, "idle6", MWRender::Animation::Priority_Default, true },
{ CharState_Idle7, "idle7", MWRender::Animation::Priority_Default, true },
{ CharState_Idle8, "idle8", MWRender::Animation::Priority_Default, true },
{ CharState_Idle9, "idle9", MWRender::Animation::Priority_Default, true },
{ CharState_IdleSwim, "idleswim", MWRender::Animation::Priority_Default, true },
{ CharState_IdleSneak, "idlesneak", MWRender::Animation::Priority_Default, true },
{ CharState_WalkForward, "walkforward", MWRender::Animation::Priority_Default, true },
{ CharState_WalkBack, "walkback", MWRender::Animation::Priority_Default, true },
{ CharState_WalkLeft, "walkleft", MWRender::Animation::Priority_Default, true },
{ CharState_WalkRight, "walkright", MWRender::Animation::Priority_Default, true },
{ CharState_SwimWalkForward, "swimwalkforward", MWRender::Animation::Priority_Default, true },
{ CharState_SwimWalkBack, "swimwalkback", MWRender::Animation::Priority_Default, true },
{ CharState_SwimWalkLeft, "swimwalkleft", MWRender::Animation::Priority_Default, true },
{ CharState_SwimWalkRight, "swimwalkright", MWRender::Animation::Priority_Default, true },
{ CharState_RunForward, "runforward", MWRender::Animation::Priority_Default, true },
{ CharState_RunBack, "runback", MWRender::Animation::Priority_Default, true },
{ CharState_RunLeft, "runleft", MWRender::Animation::Priority_Default, true },
{ CharState_RunRight, "runright", MWRender::Animation::Priority_Default, true },
{ CharState_SwimRunForward, "swimrunforward", MWRender::Animation::Priority_Default, true },
{ CharState_SwimRunBack, "swimrunback", MWRender::Animation::Priority_Default, true },
{ CharState_SwimRunLeft, "swimrunleft", MWRender::Animation::Priority_Default, true },
{ CharState_SwimRunRight, "swimrunright", MWRender::Animation::Priority_Default, true },
{ CharState_SneakForward, "sneakforward", MWRender::Animation::Priority_Default, true },
{ CharState_SneakBack, "sneakback", MWRender::Animation::Priority_Default, true },
{ CharState_SneakLeft, "sneakleft", MWRender::Animation::Priority_Default, true },
{ CharState_SneakRight, "sneakright", MWRender::Animation::Priority_Default, true },
{ CharState_TurnLeft, "turnleft", MWRender::Animation::Priority_Default, true },
{ CharState_TurnRight, "turnright", MWRender::Animation::Priority_Default, true },
{ CharState_Jump, "jump", MWRender::Animation::Priority_Default, true },
{ CharState_Death1, "death1", MWRender::Animation::Priority_Death, false },
{ CharState_Death2, "death2", MWRender::Animation::Priority_Death, false },
{ CharState_Death3, "death3", MWRender::Animation::Priority_Death, false },
{ CharState_Death4, "death4", MWRender::Animation::Priority_Death, false },
{ CharState_Death5, "death5", MWRender::Animation::Priority_Death, false },
{ CharState_Idle, "idle", Priority_Default, true },
{ CharState_Idle2, "idle2", Priority_Default, true },
{ CharState_Idle3, "idle3", Priority_Default, true },
{ CharState_Idle4, "idle4", Priority_Default, true },
{ CharState_Idle5, "idle5", Priority_Default, true },
{ CharState_Idle6, "idle6", Priority_Default, true },
{ CharState_Idle7, "idle7", Priority_Default, true },
{ CharState_Idle8, "idle8", Priority_Default, true },
{ CharState_Idle9, "idle9", Priority_Default, true },
{ CharState_IdleSwim, "idleswim", Priority_Default, true },
{ CharState_IdleSneak, "idlesneak", Priority_Default, true },
{ CharState_WalkForward, "walkforward", Priority_Default, true },
{ CharState_WalkBack, "walkback", Priority_Default, true },
{ CharState_WalkLeft, "walkleft", Priority_Default, true },
{ CharState_WalkRight, "walkright", Priority_Default, true },
{ CharState_SwimWalkForward, "swimwalkforward", Priority_Default, true },
{ CharState_SwimWalkBack, "swimwalkback", Priority_Default, true },
{ CharState_SwimWalkLeft, "swimwalkleft", Priority_Default, true },
{ CharState_SwimWalkRight, "swimwalkright", Priority_Default, true },
{ CharState_RunForward, "runforward", Priority_Default, true },
{ CharState_RunBack, "runback", Priority_Default, true },
{ CharState_RunLeft, "runleft", Priority_Default, true },
{ CharState_RunRight, "runright", Priority_Default, true },
{ CharState_SwimRunForward, "swimrunforward", Priority_Default, true },
{ CharState_SwimRunBack, "swimrunback", Priority_Default, true },
{ CharState_SwimRunLeft, "swimrunleft", Priority_Default, true },
{ CharState_SwimRunRight, "swimrunright", Priority_Default, true },
{ CharState_SneakForward, "sneakforward", Priority_Default, true },
{ CharState_SneakBack, "sneakback", Priority_Default, true },
{ CharState_SneakLeft, "sneakleft", Priority_Default, true },
{ CharState_SneakRight, "sneakright", Priority_Default, true },
{ CharState_TurnLeft, "turnleft", Priority_Default, true },
{ CharState_TurnRight, "turnright", Priority_Default, true },
{ CharState_Jump, "jump", Priority_Default, true },
{ CharState_Death1, "death1", Priority_Death, false },
{ CharState_Death2, "death2", Priority_Death, false },
{ CharState_Death3, "death3", Priority_Death, false },
{ CharState_Death4, "death4", Priority_Death, false },
{ CharState_Death5, "death5", Priority_Death, false },
};
static const size_t sStateListSize = sizeof(sStateList)/sizeof(sStateList[0]);
@ -111,7 +111,7 @@ static const struct {
static const size_t sWeaponTypeListSize = sizeof(sWeaponTypeList)/sizeof(sWeaponTypeList[0]);
void CharacterController::getCurrentGroup(std::string &group, MWRender::Animation::Priority &priority, bool &loops) const
void CharacterController::getCurrentGroup(std::string &group, Priority &priority, bool &loops) const
{
std::string name;
for(size_t i = 0;i < sStateListSize;i++)
@ -172,7 +172,7 @@ CharacterController::CharacterController(const MWWorld::Ptr &ptr, MWRender::Anim
}
std::string group;
MWRender::Animation::Priority prio;
Priority prio;
bool loops;
getCurrentGroup(group, prio, loops);
mAnimation->play(group, prio, MWRender::Animation::Group_All, false,
@ -348,8 +348,7 @@ void CharacterController::update(float duration, Movement &movement)
{
mAnimQueue.pop_front();
if(mAnimQueue.size() > 0)
mAnimation->play(mAnimQueue.front().first,
MWRender::Animation::Priority_Default,
mAnimation->play(mAnimQueue.front().first, Priority_Default,
MWRender::Animation::Group_All, false,
"start", "stop", 0.0f, mAnimQueue.front().second);
}
@ -399,7 +398,7 @@ void CharacterController::playGroup(const std::string &groupname, int mode, int
mAnimQueue.push_back(std::make_pair(groupname, count-1));
mCharState = CharState_SpecialIdle;
mAnimation->play(groupname, MWRender::Animation::Priority_Default,
mAnimation->play(groupname, Priority_Default,
MWRender::Animation::Group_All, false,
((mode==2) ? "loop start" : "start"), "stop", 0.0f, count-1);
}
@ -433,7 +432,7 @@ void CharacterController::forceStateUpdate()
mAnimQueue.clear();
std::string group;
MWRender::Animation::Priority prio;
Priority prio;
bool loops;
getCurrentGroup(group, prio, loops);
mAnimation->play(group, prio, MWRender::Animation::Group_All, false,

@ -4,7 +4,6 @@
#include <OgreVector3.h>
#include "../mwworld/ptr.hpp"
#include "../mwrender/animation.hpp"
namespace MWRender
{
@ -16,6 +15,14 @@ namespace MWMechanics
class Movement;
enum Priority {
Priority_Default,
Priority_Death,
Num_Priorities
};
enum CharacterState {
CharState_SpecialIdle,
CharState_Idle,
@ -99,7 +106,7 @@ class CharacterController
float mSecondsOfRunning;
// Gets an animation group name from the current character state, and whether it should loop.
void getCurrentGroup(std::string &group, MWRender::Animation::Priority &prio, bool &loops) const;
void getCurrentGroup(std::string &group, Priority &prio, bool &loops) const;
public:
CharacterController(const MWWorld::Ptr &ptr, MWRender::Animation *anim, CharacterState state);

@ -479,7 +479,7 @@ bool Animation::handleTextKey(AnimState &state, const std::string &groupname, co
}
void Animation::play(const std::string &groupname, Priority priority, int groups, bool autodisable, const std::string &start, const std::string &stop, float startpoint, size_t loops)
void Animation::play(const std::string &groupname, int priority, int groups, bool autodisable, const std::string &start, const std::string &stop, float startpoint, size_t loops)
{
if(!mSkelBase)
return;
@ -490,6 +490,8 @@ void Animation::play(const std::string &groupname, Priority priority, int groups
return;
}
priority = std::max(0, priority);
AnimStateMap::iterator stateiter = mStates.begin();
while(stateiter != mStates.end())
{

@ -15,15 +15,6 @@ namespace MWRender
class Animation
{
public:
enum Priority {
Priority_Nil = -1, /* Do not use */
Priority_Default,
Priority_Death,
Num_Priorities
};
enum Group {
Group_LowerBody = 1<<0,
Group_UpperBody = 1<<1,
@ -175,7 +166,7 @@ public:
* "loop start" and "loop stop" markers if they exist,
* otherwise it will use "start" and "stop".
*/
void play(const std::string &groupname, Priority priority, int groups, bool autodisable,
void play(const std::string &groupname, int priority, int groups, bool autodisable,
const std::string &start, const std::string &stop,
float startpoint, size_t loops);

@ -172,8 +172,7 @@ namespace MWRender
if(groupname != mCurrentAnimGroup)
{
mCurrentAnimGroup = groupname;
mAnimation->play(mCurrentAnimGroup, Animation::Priority_Default,
Animation::Group_All, false, "start", "stop", 0.0f, 0);
mAnimation->play(mCurrentAnimGroup, 1, Animation::Group_All, false, "start", "stop", 0.0f, 0);
}
mAnimation->forceUpdate();
@ -200,8 +199,7 @@ namespace MWRender
mAnimation->showWeapons(true);
mCurrentAnimGroup = "inventoryhandtohand";
mAnimation->play(mCurrentAnimGroup, Animation::Priority_Default,
Animation::Group_All, false, "start", "stop", 0.0f, 0);
mAnimation->play(mCurrentAnimGroup, 1, Animation::Group_All, false, "start", "stop", 0.0f, 0);
}
// --------------------------------------------------------------------------------------------------
@ -235,8 +233,7 @@ namespace MWRender
void RaceSelectionPreview::onSetup ()
{
mAnimation->play("idle", Animation::Priority_Default, Animation::Group_All,
false, "start", "stop", 0.0f, 0);
mAnimation->play("idle", 1, Animation::Group_All, false, "start", "stop", 0.0f, 0);
updateCamera();
}

Loading…
Cancel
Save