diff --git a/code/ryzom/client/src/camera_animation_manager/camera_animation_steps_players.cpp b/code/ryzom/client/src/camera_animation_manager/camera_animation_steps_players.cpp new file mode 100644 index 000000000..a742ebdd6 --- /dev/null +++ b/code/ryzom/client/src/camera_animation_manager/camera_animation_steps_players.cpp @@ -0,0 +1,213 @@ +// Ryzom - MMORPG Framework +// Copyright (C) 2010 Winch Gate Property Limited +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// + +#include "camera_animation_manager/camera_animation_step_player_factory.h" +#include "game_share/position_or_entity_type.h" + + + +/// Basic camera animation step that has generic values +/// - look_at_position +/// - text +/// - duration +class CCameraAnimationStepPlayerBasic : public ICameraAnimationStepPlayer +{ +protected: + TPositionOrEntity LookAtPos; + std::string Text; + float Duration; + +public: + CCameraAnimationStepPlayerBasic() + { + Text = ""; + Duration = 0.f; + } + + /// This function is called when it's time to init the step from an impulse + virtual bool initStep(NLMISC::CBitMemStream& impulse) + { + impulse.serial(const_cast(LookAtPos)); + impulse.serial(const_cast(Text)); + impulse.serial(const_cast(Duration)); + + return true; + } + + /// Function that plays the step + virtual void playStep() + { + + } + +}; // This class must not be registered because it's a base class + +///////////////////////////////////////////////////////////////////////////// +/// Static camera animation step (that does not have specific variables) +class CCameraAnimationStepPlayerStatic : public CCameraAnimationStepPlayerBasic +{ +public: + /// This function is called when it's time to init the step from an impulse + virtual bool initStep(NLMISC::CBitMemStream& impulse) + { + CCameraAnimationStepPlayerBasic::initStep(impulse); + return true; + } + + /// Function that plays the step + virtual void playStep() + { + + } +}; +CAMERA_ANIMATION_REGISTER_STEP_PLAYER(CCameraAnimationStepPlayerStatic, "camera_animation_static"); + +///////////////////////////////////////////////////////////////////////////// +/// Go to camera animation step +/// - end_position +class CCameraAnimationStepPlayerGoTo: public CCameraAnimationStepPlayerBasic +{ +protected: + TPositionOrEntity EndPos; + +public: + CCameraAnimationStepPlayerGoTo() + { + } + + /// This function is called when it's time to init the step from an impulse + virtual bool initStep(NLMISC::CBitMemStream& impulse) + { + CCameraAnimationStepPlayerBasic::initStep(impulse); + + impulse.serial(const_cast(EndPos)); + + return true; + } + + /// Function that plays the step + virtual void playStep() + { + + } +}; +CAMERA_ANIMATION_REGISTER_STEP_PLAYER(CCameraAnimationStepPlayerGoTo, "camera_animation_go_to"); + +///////////////////////////////////////////////////////////////////////////// +/// Follow entity camera animation step +/// - entity_to_follow +/// - distance_to_entity +class CCameraAnimationStepPlayerFollowEntity: public CCameraAnimationStepPlayerBasic +{ +protected: + TPositionOrEntity EntityToFollow; + float DistanceToEntity; + +public: + CCameraAnimationStepPlayerFollowEntity() + { + DistanceToEntity = 0.f; + } + + /// This function is called when it's time to init the step from an impulse + virtual bool initStep(NLMISC::CBitMemStream& impulse) + { + CCameraAnimationStepPlayerBasic::initStep(impulse); + + impulse.serial(const_cast(EntityToFollow)); + impulse.serial(const_cast(DistanceToEntity)); + + return true; + } + + /// Function that plays the step + virtual void playStep() + { + + } +}; +CAMERA_ANIMATION_REGISTER_STEP_PLAYER(CCameraAnimationStepPlayerFollowEntity, "camera_animation_follow_entity"); + +///////////////////////////////////////////////////////////////////////////// +/// Turn around camera animation step +/// - point_to_turn_around +/// - distance_to_point +/// - speed +class CCameraAnimationStepPlayerTurnAround: public CCameraAnimationStepPlayerBasic +{ +protected: + TPositionOrEntity PointToTurnAround; + float DistanceToPoint; + float Speed; + +public: + CCameraAnimationStepPlayerTurnAround() + { + DistanceToPoint = 0.f; + Speed = 0.f; + } + + /// This function is called when it's time to init the step from an impulse + virtual bool initStep(NLMISC::CBitMemStream& impulse) + { + CCameraAnimationStepPlayerBasic::initStep(impulse); + + impulse.serial(const_cast(PointToTurnAround)); + impulse.serial(const_cast(DistanceToPoint)); + impulse.serial(const_cast(Speed)); + + return true; + } + + /// Function that plays the step + virtual void playStep() + { + + } +}; +CAMERA_ANIMATION_REGISTER_STEP_PLAYER(CCameraAnimationStepPlayerTurnAround, "camera_animation_turn_around"); + +///////////////////////////////////////////////////////////////////////////// +/// Animation step that returns to the starting position. It directly inherits from the interface because it +/// does not need all the parameters of a basic step +/// - duration +class CCameraAnimationStepPlayerReturn : public ICameraAnimationStepPlayer +{ +protected: + float Duration; + +public: + CCameraAnimationStepPlayerReturn() + { + Duration = 0.f; + } + + /// This function is called when it's time to init the step from an impulse + virtual bool initStep(NLMISC::CBitMemStream& impulse) + { + impulse.serial(const_cast(Duration)); + + return true; + } + + /// Function that plays the step + virtual void playStep() + { + + } +}; +CAMERA_ANIMATION_REGISTER_STEP_PLAYER(CCameraAnimationStepPlayerReturn, "camera_animation_return"); \ No newline at end of file