mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-02 00:45:33 +00:00
Add a quick hack to let "playgroup all" work on creatures and NPCs
This commit is contained in:
parent
4210880c06
commit
8b5b74f9ee
2 changed files with 60 additions and 24 deletions
|
@ -52,6 +52,18 @@ CreatureAnimation::CreatureAnimation(const MWWorld::Ptr& ptr, OEngine::Render::O
|
|||
}
|
||||
ent->setRenderQueueGroup(transparent ? RQG_Alpha : RQG_Main);
|
||||
}
|
||||
|
||||
if(mEntityList.mSkelBase)
|
||||
{
|
||||
Ogre::AnimationStateSet *aset = mEntityList.mSkelBase->getAllAnimationStates();
|
||||
Ogre::AnimationStateIterator as = aset->getAnimationStateIterator();
|
||||
while(as.hasMoreElements())
|
||||
{
|
||||
Ogre::AnimationState *state = as.getNext();
|
||||
state->setEnabled(true);
|
||||
state->setLoop(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,20 +71,26 @@ void CreatureAnimation::runAnimation(float timepassed)
|
|||
{
|
||||
if(mAnimate > 0)
|
||||
{
|
||||
//Add the amount of time passed to time
|
||||
|
||||
//Handle the animation transforms dependent on time
|
||||
|
||||
//Handle the shapes dependent on animation transforms
|
||||
mTime += timepassed;
|
||||
if(mTime >= mStopTime)
|
||||
|
||||
if(mEntityList.mSkelBase)
|
||||
{
|
||||
mAnimate--;
|
||||
//std::cout << "Stopping the animation\n";
|
||||
if(mAnimate == 0)
|
||||
mTime = mStopTime;
|
||||
else
|
||||
mTime = mStartTime + (mTime - mStopTime);
|
||||
Ogre::AnimationStateSet *aset = mEntityList.mSkelBase->getAllAnimationStates();
|
||||
Ogre::AnimationStateIterator as = aset->getAnimationStateIterator();
|
||||
while(as.hasMoreElements())
|
||||
{
|
||||
Ogre::AnimationState *state = as.getNext();
|
||||
state->setTimePosition(mTime);
|
||||
if(state->getTimePosition() >= state->getLength())
|
||||
{
|
||||
mAnimate--;
|
||||
//std::cout << "Stopping the animation\n";
|
||||
if(mAnimate == 0)
|
||||
mTime = state->getLength();
|
||||
else
|
||||
mTime = mTime - state->getLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleAnimationTransforms();
|
||||
|
|
|
@ -117,6 +117,18 @@ NpcAnimation::NpcAnimation(const MWWorld::Ptr& ptr, OEngine::Render::OgreRendere
|
|||
//stay in the same place when we skipanim, or open a gui window
|
||||
}
|
||||
|
||||
if(mEntityList.mSkelBase)
|
||||
{
|
||||
Ogre::AnimationStateSet *aset = mEntityList.mSkelBase->getAllAnimationStates();
|
||||
Ogre::AnimationStateIterator as = aset->getAnimationStateIterator();
|
||||
while(as.hasMoreElements())
|
||||
{
|
||||
Ogre::AnimationState *state = as.getNext();
|
||||
state->setEnabled(true);
|
||||
state->setLoop(false);
|
||||
}
|
||||
}
|
||||
|
||||
if(isFemale)
|
||||
mInsert->scale(race->data.height.female, race->data.height.female, race->data.height.female);
|
||||
else
|
||||
|
@ -361,24 +373,30 @@ void NpcAnimation::runAnimation(float timepassed)
|
|||
timeToChange = 0;
|
||||
updateParts();
|
||||
}
|
||||
|
||||
timeToChange += timepassed;
|
||||
|
||||
//1. Add the amount of time passed to time
|
||||
|
||||
//2. Handle the animation transforms dependent on time
|
||||
|
||||
//3. Handle the shapes dependent on animation transforms
|
||||
if(mAnimate > 0)
|
||||
{
|
||||
mTime += timepassed;
|
||||
if(mTime > mStopTime)
|
||||
|
||||
if(mEntityList.mSkelBase)
|
||||
{
|
||||
mAnimate--;
|
||||
if(mAnimate == 0)
|
||||
mTime = mStopTime;
|
||||
else
|
||||
mTime = mStartTime + (mTime - mStopTime);
|
||||
Ogre::AnimationStateSet *aset = mEntityList.mSkelBase->getAllAnimationStates();
|
||||
Ogre::AnimationStateIterator as = aset->getAnimationStateIterator();
|
||||
while(as.hasMoreElements())
|
||||
{
|
||||
Ogre::AnimationState *state = as.getNext();
|
||||
state->setTimePosition(mTime);
|
||||
if(state->getTimePosition() >= state->getLength())
|
||||
{
|
||||
mAnimate--;
|
||||
//std::cout << "Stopping the animation\n";
|
||||
if(mAnimate == 0)
|
||||
mTime = state->getLength();
|
||||
else
|
||||
mTime = mTime - state->getLength();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
handleAnimationTransforms();
|
||||
|
|
Loading…
Reference in a new issue