From b99cfc155718f461de77d831889df48609ff95f5 Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Thu, 5 Jul 2012 21:43:17 +0200 Subject: [PATCH] Added: #1469 Base of the impulses for camera animation steps --HG-- branch : gsoc2012-fabien --- .../camera_animation_manager.cpp | 13 ++++++- .../camera_animation_step_factory.cpp | 17 +++++++-- .../camera_animation_step_factory.h | 6 ++- .../camera_animation_steps.cpp | 38 +++++++++++++++++-- 4 files changed, 65 insertions(+), 9 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 3fe8541cf..5ea8f2af5 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 @@ -21,6 +21,7 @@ #include "primitives_parser.h" #include "nel/ligo/primitive.h" #include "camera_animation_manager/camera_animation_step_factory.h" +#include "player_manager/player_manager.h" using namespace std; using namespace NLMISC; @@ -159,7 +160,17 @@ bool CCameraAnimationManager::TCameraAnimInfo::sendAnimationStep(const NLMISC::C ICameraAnimationStep* step = Steps[currentStep]; // We send the animation step to the client - step->sendAnimationStep(eid); + NLNET::CMessage msgout("IMPULSION_ID"); + msgout.serial(const_cast(eid)); + NLMISC::CBitMemStream bms; + GenericMsgManager.pushNameToStream("CAMERA_ANIMATION:STEP", bms); + + // We tell the step to fill the message + step->sendAnimationStep(Name, bms); + + // We add the buffer to the message + msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length()); + NLNET::CUnifiedNetwork::getInstance()->send(NLNET::TServiceId(eid.getDynamicId()), msgout); return true; } diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.cpp b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.cpp index 78afbcc5a..e8e372ba1 100644 --- a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.cpp +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.cpp @@ -79,7 +79,18 @@ void ICameraAnimationStep::addModifier(ICameraAnimationModifier* modifier) Modifiers.push_back(modifier); } -void ICameraAnimationStep::sendAnimationStep(const NLMISC::CEntityId& eid) +void ICameraAnimationStep::sendAnimationStep(const std::string& name, NLMISC::CBitMemStream& bms) { - throw std::exception("The method or operation is not implemented."); -} \ No newline at end of file + // We first add the name of the step + bms.serial(const_cast(name)); + + // We ask the step to add its information to the message + sendAnimationStep(bms); + + // We finally send the modifiers instructions + std::vector::iterator it; + for (it = Modifiers.begin(); it != Modifiers.end(); ++it) + { + //TODO + } +} diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.h b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.h index 9de16bc9d..c3fb555a9 100644 --- a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.h +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_step_factory.h @@ -41,7 +41,11 @@ public: virtual float getDuration() const = 0; /// Function that sends the animation step the to client - void sendAnimationStep(const NLMISC::CEntityId& eid); + virtual void sendAnimationStep(NLMISC::CBitMemStream& bms) = 0; + + /// Function that send all information about a step to the client (this includes modifiers) + void sendAnimationStep(const std::string& name, NLMISC::CBitMemStream& bms); + protected: // The list of modifiers std::vector Modifiers; diff --git a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_steps.cpp b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_steps.cpp index 11bb6ceee..5317a91d4 100644 --- a/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_steps.cpp +++ b/code/ryzom/server/src/entities_game_service/camera_animation_manager/camera_animation_steps.cpp @@ -71,6 +71,11 @@ public: return true; } + virtual void sendAnimationStep(NLMISC::CBitMemStream& bms) + { + + } + virtual float getDuration() const { return Duration; @@ -82,7 +87,7 @@ public: class CCameraAnimationStepStatic : public CCameraAnimationStepBasic { public: - bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) + virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) { if (!CCameraAnimationStepBasic::parseStep(prim, filename)) { @@ -91,6 +96,11 @@ public: } return true; } + + virtual void sendAnimationStep(NLMISC::CBitMemStream& bms) + { + CCameraAnimationStepBasic::sendAnimationStep(bms); + } }; CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepStatic, "camera_animation_static"); @@ -108,7 +118,7 @@ public: EndPos = ""; } - bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) + virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) { if (!CCameraAnimationStepBasic::parseStep(prim, filename)) { @@ -128,6 +138,11 @@ public: return true; } + + virtual void sendAnimationStep(NLMISC::CBitMemStream& bms) + { + CCameraAnimationStepBasic::sendAnimationStep(bms); + } }; CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepGoTo, "camera_animation_go_to"); @@ -148,7 +163,7 @@ public: DistanceToEntity = 0.f; } - bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) + virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) { if (!CCameraAnimationStepBasic::parseStep(prim, filename)) { @@ -180,6 +195,11 @@ public: return true; } + + virtual void sendAnimationStep(NLMISC::CBitMemStream& bms) + { + CCameraAnimationStepBasic::sendAnimationStep(bms); + } }; CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepFollowEntity, "camera_animation_follow_entity"); @@ -203,7 +223,7 @@ public: Speed = 0.f; } - bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) + virtual bool parseStep(const NLLIGO::IPrimitive* prim, const std::string& filename) { if (!CCameraAnimationStepBasic::parseStep(prim, filename)) { @@ -247,6 +267,11 @@ public: return true; } + + virtual void sendAnimationStep(NLMISC::CBitMemStream& bms) + { + CCameraAnimationStepBasic::sendAnimationStep(bms); + } }; CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepTurnAround, "camera_animation_turn_around"); @@ -284,6 +309,11 @@ public: return true; } + virtual void sendAnimationStep(NLMISC::CBitMemStream& bms) + { + + } + virtual float getDuration() const { return Duration;