1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 20:53:52 +00:00

Play the left-arm torch animation when it's equipped

This commit is contained in:
Chris Robinson 2013-05-17 06:21:59 -07:00
parent ee585046ac
commit e8bbb755c3
3 changed files with 22 additions and 0 deletions

View file

@ -441,6 +441,17 @@ void CharacterController::update(float duration, Movement &movement)
}
}
}
MWWorld::ContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
if(torch != inv.end() && torch->getTypeName() == typeid(ESM::Light).name())
{
if(!mAnimation->isPlaying("torch"))
mAnimation->play("torch", Priority_Torch,
MWRender::Animation::Group_LeftArm, false,
"start", "stop", 0.0f, (~(size_t)0));
}
else if(mAnimation->isPlaying("torch"))
mAnimation->disable("torch");
}
}

View file

@ -18,6 +18,7 @@ class Movement;
enum Priority {
Priority_Default,
Priority_Weapon,
Priority_Torch,
Priority_Death,

View file

@ -175,6 +175,16 @@ namespace MWRender
mAnimation->play(mCurrentAnimGroup, 1, Animation::Group_All, false, "start", "stop", 0.0f, 0);
}
MWWorld::ContainerStoreIterator torch = inv.getSlot(MWWorld::InventoryStore::Slot_CarriedLeft);
if(torch != inv.end() && torch->getTypeName() == typeid(ESM::Light).name())
{
if(!mAnimation->getInfo("torch"))
mAnimation->play("torch", 2, MWRender::Animation::Group_LeftArm, false,
"start", "stop", 0.0f, (~(size_t)0));
}
else if(mAnimation->getInfo("torch"))
mAnimation->disable("torch");
mAnimation->forceUpdate();
mAnimation->runAnimation(0.0f);