From c7684cb979bc0c4791d6e88bb9cf626764ed3417 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Fri, 18 Jan 2013 14:50:55 -0800 Subject: [PATCH] Pass the key time to markerEvent --- apps/openmw/mwmechanics/character.cpp | 2 +- apps/openmw/mwmechanics/character.hpp | 2 +- apps/openmw/mwrender/animation.cpp | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/openmw/mwmechanics/character.cpp b/apps/openmw/mwmechanics/character.cpp index f5b6301a2..241033802 100644 --- a/apps/openmw/mwmechanics/character.cpp +++ b/apps/openmw/mwmechanics/character.cpp @@ -56,7 +56,7 @@ CharacterController::CharacterController(const CharacterController &rhs) } -void CharacterController::markerEvent(const std::string &evt) +void CharacterController::markerEvent(float time, const std::string &evt) { if(evt.compare(0, 7, "sound: ") == 0) { diff --git a/apps/openmw/mwmechanics/character.hpp b/apps/openmw/mwmechanics/character.hpp index 992cb8f1f..902b8cc36 100644 --- a/apps/openmw/mwmechanics/character.hpp +++ b/apps/openmw/mwmechanics/character.hpp @@ -32,7 +32,7 @@ class CharacterController protected: /* Called by the animation whenever a new text key is reached. */ - void markerEvent(const std::string &evt); + void markerEvent(float time, const std::string &evt); friend class MWRender::Animation; diff --git a/apps/openmw/mwrender/animation.cpp b/apps/openmw/mwrender/animation.cpp index b6c712522..cfc72de37 100644 --- a/apps/openmw/mwrender/animation.cpp +++ b/apps/openmw/mwrender/animation.cpp @@ -223,13 +223,15 @@ void Animation::runAnimation(float timepassed) break; } + float time = mNextKey->first; const std::string &evt = mNextKey->second; - updatePosition(mNextKey->first); - timepassed = targetTime - mNextKey->first; mNextKey++; + updatePosition(time); + timepassed = targetTime - time; + if(mController) - mController->markerEvent(evt); + mController->markerEvent(time, evt); } }