Added: #1469 Base declaration of the CCameraAnimationPlayer class in the client

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 12 years ago
parent 448d822b4d
commit 29dca7b9d7

@ -10,6 +10,7 @@ ADD_SUBDIRECTORY(seven_zip)
FILE(GLOB CFG ../*.cfg ../*.cfg.in)
FILE(GLOB SRC *.cpp *.h motion/*.cpp motion/*.h client.rc)
FILE(GLOB SRC_INTERFACE interface_v3/*.h interface_v3/*.cpp)
FILE(GLOB SRC_CAMERA_ANIMATION_MANAGER camera_animation_manager/*.h camera_animation_manager/*.cpp)
FILE(GLOB SRC_MODE motion/modes/*.cpp motion/modes/*.h)
FILE(GLOB SRC_R2 r2/*.h r2/*.cpp r2/dmc/*.h r2/dmc/*.cpp)
@ -37,6 +38,7 @@ LIST(REMOVE_ITEM SRC_INTERFACE
SOURCE_GROUP("" FILES ${SRC})
SOURCE_GROUP("cfg" FILES ${CFG})
SOURCE_GROUP("interface_v3" FILES ${SRC_INTERFACE})
SOURCE_GROUP("Camera animation manager" FILES ${SRC_CAMERA_ANIMATION_MANAGER})
SOURCE_GROUP("mode" FILES ${SRC_MODE})
SOURCE_GROUP("r2" FILES ${SRC_R2})
@ -60,7 +62,7 @@ if(APPLE)
SET(MAC_RESOURCES_DIR ${CMAKE_SOURCE_DIR}/ryzom/client/macosx)
ENDIF(APPLE)
ADD_EXECUTABLE(ryzom_client WIN32 MACOSX_BUNDLE ${SRC} ${SRC_INTERFACE} ${SRC_MODE} ${SRC_R2})
ADD_EXECUTABLE(ryzom_client WIN32 MACOSX_BUNDLE ${SRC} ${SRC_INTERFACE} ${SRC_CAMERA_ANIMATION_MANAGER} ${SRC_MODE} ${SRC_R2})
IF(APPLE)
SET_TARGET_PROPERTIES(ryzom_client PROPERTIES OUTPUT_NAME ${MACOSX_BUNDLE_BUNDLE_NAME})

@ -0,0 +1,52 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
//
#include "camera_animation_manager/camera_animation_player.h"
using namespace std;
using namespace NLMISC;
using namespace NLLIGO;
using namespace NLNET;
CCameraAnimationPlayer* CCameraAnimationPlayer::_Instance = NULL;
CCameraAnimationPlayer::CCameraAnimationPlayer()
{
}
CCameraAnimationPlayer::~CCameraAnimationPlayer()
{
}
void CCameraAnimationPlayer::start()
{
}
void CCameraAnimationPlayer::stop()
{
}
void CCameraAnimationPlayer::playStep( const std::string& stepName, NLMISC::CBitMemStream& impulse )
{
}

@ -0,0 +1,75 @@
// Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
// 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 <http://www.gnu.org/licenses/>.
#ifndef RY_CAMERAANIMATIONPLAYER_H
#define RY_CAMERAANIMATIONPLAYER_H
#include <string>
#include "nel\misc\bit_mem_stream.h"
/************************************************************************/
/* Class that manages the camera animations. (singleton).
* It's responsible of :
* - Parsing camera animations in primitives
* - Sending a specified animation to the client
*
* \author Fabien Henon
* \date 2012
*/
/************************************************************************/
class CCameraAnimationPlayer
{
public:
/// Gets the current instance of the manager
static CCameraAnimationPlayer* getInstance()
{
if (_Instance == NULL)
_Instance = new CCameraAnimationPlayer();
return _Instance;
}
/// Releases the instance
static void release()
{
if (_Instance != NULL)
{
delete _Instance;
_Instance = NULL;
}
}
/// Starts playing an animation
void start();
/// Stops an animation
void stop();
/// Loads and play the specified step
void playStep(const std::string& stepName, NLMISC::CBitMemStream& impulse);
private:
/// Constructor
CCameraAnimationPlayer();
/// Destructor
~CCameraAnimationPlayer();
/// Instance of the manager
static CCameraAnimationPlayer* _Instance;
};
#endif /* RY_CAMERAANIMATIONPLAYER_H */

@ -91,6 +91,7 @@
#include "nel/misc/vector.h"
#include "nel/misc/entity_id.h"
#include "entity_cl.h"
#include "camera_animation_manager/camera_animation_player.h"
#define OLD_STRING_SYSTEM
@ -3596,17 +3597,25 @@ void impulsePlaySoundTrigger(NLMISC::CBitMemStream& impulse)
void impulseCameraAnimationPlay(NLMISC::CBitMemStream& impulse)
{
// We start playing an animation
CCameraAnimationPlayer::getInstance()->start();
}
void impulseCameraAnimationStep(NLMISC::CBitMemStream& impulse)
{
// We got a new step
// We first get its name
std::string stepName = "";
impulse.serial(stepName);
// We tell the camera animation player to load and play this instruction
CCameraAnimationPlayer::getInstance()->playStep(stepName, impulse);
}
void impulseCameraAnimationFinished(NLMISC::CBitMemStream& impulse)
{
// We stop an animation
CCameraAnimationPlayer::getInstance()->stop();
}
//-----------------------------------------------

@ -90,6 +90,7 @@
#include "faction_war_manager.h"
#include "interface_v3/interface_ddx.h"
#include "bg_downloader_access.h"
#include "camera_animation_manager/camera_animation_player.h"
///////////
@ -356,6 +357,8 @@ void releaseMainLoopReselect()
// Btw the 2 methods should have strong similarities
void releaseMainLoop(bool closeConnection)
{
CCameraAnimationPlayer::release();
ProgressBar.release();
// Release R2 editor if applicable
@ -602,6 +605,7 @@ void release()
CSheetId::uninit();
// shutdown a few other singletons
CCameraAnimationPlayer::release();
CLoginProgressPostThread::releaseInstance();
CAttackListManager::releaseInstance();
CFactionWarManager::release();

@ -32,10 +32,10 @@ TPositionOrEntity CPositionOrEntityHelper::fromString(const std::string& s)
std::string str = s;
CMissionParser::removeBlanks(str);
std::vector<std::string> res;
NLMISC::splitString(str, ";", res);
std::vector<std::string> resS;
NLMISC::splitString(str, ";", resS);
// If we don't have 3 components, it's an entity
if (res.size() != 3)
if (resS.size() != 3)
{
std::vector<TAIAlias> res;
CAIAliasTranslator::getInstance()->getNPCAliasesFromName(str, res);
@ -63,9 +63,9 @@ TPositionOrEntity CPositionOrEntityHelper::fromString(const std::string& s)
else
{
// It's a position
std::string xStr = res[0];
std::string yStr = res[1];
std::string zStr = res[2];
std::string xStr = resS[0];
std::string yStr = resS[1];
std::string zStr = resS[2];
CMissionParser::removeBlanks(xStr);
CMissionParser::removeBlanks(yStr);

Loading…
Cancel
Save