From 2629c3cf5f2c9dcfb291126ecb3d115e8dc317d1 Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Wed, 4 Jul 2012 19:22:12 +0200 Subject: [PATCH] Added: #1469 base functions to send the camera animation instructions --HG-- branch : gsoc2012-fabien --- .../camera_animation_manager.cpp | 28 +++++++++++++++-- .../camera_animation_manager.h | 30 +++++++++++++++++-- 2 files changed, 54 insertions(+), 4 deletions(-) diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.cpp b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.cpp index e48d8f0ff..d61ded987 100644 --- a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.cpp +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.cpp @@ -129,7 +129,31 @@ bool CCameraAnimationManager::parseCameraAnimations(const IPrimitive* prim, cons } } -void CCameraAnimationManager::sendAnimation(const NLMISC::CEntityId& eid, const std::string& _AnimationName) +void CCameraAnimationManager::sendAnimation(const NLMISC::CEntityId& eid, const std::string& animationName) { - + // We search for the correct camera animation + TCameraAnimationContainer::iterator it; + for (it = Animations.begin(); it != Animations.end(); ++it) + { + if (it->first == animationName) + { + it->second.sendAnimationSteps(eid); + break; + } + } +} + +void CCameraAnimationManager::TCameraAnimInfo::sendAnimationSteps(const NLMISC::CEntityId& eid) +{ + // We first send the first step + sendAnimationStep(eid, 0); + // Now we send the other steps after the duration + +} + +void CCameraAnimationManager::TCameraAnimInfo::sendAnimationStep(const NLMISC::CEntityId& eid, int currentStep) +{ + // We can send the current step + + } \ No newline at end of file diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.h b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.h index cf9240471..abde9623c 100644 --- a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.h +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_manager.h @@ -43,7 +43,7 @@ public: static void release(); /// Function that sends all the instructions of a camera animation to the specified entity - void sendAnimation(const NLMISC::CEntityId& eid, const std::string& _AnimationName); + void sendAnimation(const NLMISC::CEntityId& eid, const std::string& animationName); private: /// Constructor @@ -65,7 +65,7 @@ private: { Name = ""; } - + /// Function called to release the animations void release() { // We delete the camera animation steps @@ -78,9 +78,35 @@ private: Name = ""; } + /// Function called to send the camera animation instruction specified by the current step to the client + void sendAnimationStep(const NLMISC::CEntityId& eid, int currentStep); + /// Function called to send all the camera animation instructions to the client + void sendAnimationSteps(const NLMISC::CEntityId& eid); std::string Name; std::vector Steps; + + private: + class TCameraAnimTimerEvent: public CTimerEvent + { + public: + TCameraAnimTimerEvent(TCameraAnimInfo* info, int nextStep, const NLMISC::CEntityId& eid): _Eid(eid) + { + _Infos = info; + _Next = nextStep; + } + // Callback called when the timer finished + void timerCallback(CTimer* owner) + { + // We tell the camera anim info to send the current step + _Infos->sendAnimationStep(_Eid, _Next); + } + + private: + TCameraAnimInfo* _Infos; + int _Next; + const NLMISC::CEntityId& _Eid; + }; }; typedef std::map TCameraAnimationContainer;