Changed: #1469 Parsing of steps in client and only one magic step

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 13 years ago
parent 55582b6d05
commit c21fbc5a9f

@ -104,7 +104,7 @@ CAMERA_ANIMATION_REGISTER_MODIFIER_PLAYER(CCameraAnimationModifierPlayerShake, "
class CCameraAnimationModifierPlayerSoundTrigger : public ICameraAnimationModifierPlayer class CCameraAnimationModifierPlayerSoundTrigger : public ICameraAnimationModifierPlayer
{ {
protected: protected:
TPositionOrEntity SoundPos; CPositionOrEntity SoundPos;
NLMISC::CSheetId SoundId; NLMISC::CSheetId SoundId;
public: public:
@ -116,7 +116,7 @@ public:
/// This function is called when it's time to init the modifier from an impulse /// This function is called when it's time to init the modifier from an impulse
virtual bool initModifier(NLMISC::CBitMemStream& impulse) virtual bool initModifier(NLMISC::CBitMemStream& impulse)
{ {
impulse.serial(const_cast<TPositionOrEntity&>(SoundPos)); impulse.serial(const_cast<CPositionOrEntity&>(SoundPos));
impulse.serial(const_cast<NLMISC::CSheetId&>(SoundId)); impulse.serial(const_cast<NLMISC::CSheetId&>(SoundId));
// We play the sound once here // We play the sound once here

@ -45,9 +45,6 @@ public:
/// Function called when the step stops /// Function called when the step stops
virtual void stopStep() = 0; virtual void stopStep() = 0;
/// Gets the duration in seconds of this step
virtual float getDuration() const = 0;
/// Function that adds a camera animation modifier to this step /// Function that adds a camera animation modifier to this step
void addModifier(ICameraAnimationModifierPlayer* modifier); void addModifier(ICameraAnimationModifierPlayer* modifier);

@ -17,13 +17,86 @@
#include "camera_animation_manager/camera_animation_step_player_factory.h" #include "camera_animation_manager/camera_animation_step_player_factory.h"
#include "game_share/position_or_entity_type.h" #include "game_share/position_or_entity_type.h"
#include "camera_animation_manager/position_or_entity_helper.h"
#include "camera_animation_manager/camera_animation_info.h" #include "camera_animation_manager/camera_animation_info.h"
#include "camera_animation_manager/position_or_entity_pos_resolver.h" #include "camera_animation_manager/position_or_entity_pos_resolver.h"
#include "client_cfg.h" #include "client_cfg.h"
#include "time_client.h" #include "time_client.h"
#include "game_share/camera_anim_type_parser.h"
/// Magic camera animation step
class CCameraAnimationStepPlayerStep: public ICameraAnimationStepPlayer
{
protected:
CPositionOrEntityHelper LookAtTarget;
float DirectionTransitionTime;
CPositionOrEntityHelper PositionTarget;
float PositionTransitionTime;
float DistanceTo;
bool HasTurnAround;
float TurnAroundSpeed;
public:
CCameraAnimationStepPlayerStep()
{
DirectionTransitionTime = 0.f;
PositionTransitionTime = 0.f;
DistanceTo = 0.f;
HasTurnAround = false;
TurnAroundSpeed = 0.f;
}
/// This function is called when it's time to init the step from an impulse
virtual bool initStep(NLMISC::CBitMemStream& bms)
{
bms.serial(const_cast<CPositionOrEntityHelper&>(LookAtTarget));
if (!LookAtTarget.isPreviousPos())
{
NLMISC::serialDuration(bms, DirectionTransitionTime);
}
bms.serial(const_cast<CPositionOrEntityHelper&>(PositionTarget));
if (!PositionTarget.isPreviousPos())
{
NLMISC::serialDistance(bms, DistanceTo);
NLMISC::serialDuration(bms, PositionTransitionTime);
bms.serialBit(const_cast<bool&>(HasTurnAround));
if (HasTurnAround)
{
NLMISC::serialSpeed(bms, TurnAroundSpeed);
}
}
return true;
}
/// Function that plays the step
virtual TCameraAnimationOutputInfo updateStep(const TCameraAnimationInputInfo& currCamInfo)
{
TCameraAnimationOutputInfo camInfo;
/*// We don't change the position
camInfo.CamPos = currCamInfo.StartCamPos;
float ratio = currCamInfo.ElapsedTimeSinceStartStep / getDuration();
// We compute the final look at direction
NLMISC::CVector finalDir = resolvePositionOrEntityPosition(LookAtPos) - camInfo.CamPos;
// We get the current look at direction
camInfo.CamLookAtDir = computeCurrentLookAtDir(ratio, currCamInfo.StartCamLookAtDir, finalDir);*/
return camInfo;
}
virtual void stopStep()
{
}
};
CAMERA_ANIMATION_REGISTER_STEP_PLAYER(CCameraAnimationStepPlayerStep, "camera_animation_step");
/// Basic camera animation step that has generic values /*/// Basic camera animation step that has generic values
/// - look_at_position /// - look_at_position
/// - text /// - text
/// - duration /// - duration
@ -384,4 +457,4 @@ public:
{ {
} }
}; };
CAMERA_ANIMATION_REGISTER_STEP_PLAYER(CCameraAnimationStepPlayerReturn, "camera_animation_return"); CAMERA_ANIMATION_REGISTER_STEP_PLAYER(CCameraAnimationStepPlayerReturn, "camera_animation_return");*/

@ -0,0 +1,35 @@
// 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/position_or_entity_helper.h"
#include "game_share/mirror.h"
#include "game_share/mirrored_data_set.h"
#include "game_share/base_types.h"
#include "user_entity.h"
/*NLMISC::CVector CPositionOrEntityHelper::getDiffPos(const NLMISC::CVector& targetPos) const
{
return Position;
}
NLMISC::CVector CPositionOrEntityHelper::setPositionFromDiffPos(const NLMISC::CVector& diffPos)
{
return Position;
}
*/

@ -0,0 +1,63 @@
// 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_POSITIONORENTITYTYPEHELPER_H
#define RY_POSITIONORENTITYTYPEHELPER_H
#include "game_share/position_or_entity_type.h"
//////////////////////////////////////////////////////////////////////////
/************************************************************************/
/* Class that can contain either an entity id or a position */
/************************************************************************/
class CPositionOrEntityHelper: public CPositionOrEntity
{
public:
CPositionOrEntityHelper(): CPositionOrEntity()
{
}
CPositionOrEntityHelper(const NLMISC::CVector& position): CPositionOrEntity(position)
{
}
CPositionOrEntityHelper(const TDataSetIndex& eid): CPositionOrEntity(eid)
{
}
CPositionOrEntityHelper(PositionOrEntityType type): CPositionOrEntity(type)
{
}
CPositionOrEntityHelper(const CPositionOrEntity& c): CPositionOrEntity(c)
{
}
// Declares abstract methods
/// This function returns the difference between the player's position and the specified position
/*NLMISC::CVector getDiffPos(const NLMISC::CVector& targetPos) const;
/// This function returns the target position given the difference between the player's position and this target position
NLMISC::CVector setPositionFromDiffPos(const NLMISC::CVector& diffPos);*/
};
#endif /* RY_POSITIONORENTITYTYPEHELPER_H */

@ -19,7 +19,7 @@
#include "game_share/position_or_entity_type.h" #include "game_share/position_or_entity_type.h"
#include "entities.h" #include "entities.h"
NLMISC::CVector resolvePositionOrEntityPosition(const TPositionOrEntity& posOrEntity) NLMISC::CVector resolvePositionOrEntityPosition(const CPositionOrEntity& posOrEntity)
{ {
if (!posOrEntity.isValid()) if (!posOrEntity.isValid())
{ {

@ -20,11 +20,12 @@
#include "nel/misc/entity_id.h" #include "nel/misc/entity_id.h"
#include "nel/misc/vector.h" #include "nel/misc/vector.h"
#include "game_share/position_or_entity_type.h" #include "game_share/position_or_entity_type.h"
#include "camera_animation_manager/position_or_entity_helper.h"
/// Function that returns the stored position if it contains a position /// Function that returns the stored position if it contains a position
/// Or the current entity's position if it contains an entity /// Or the current entity's position if it contains an entity
NLMISC::CVector resolvePositionOrEntityPosition(const TPositionOrEntity& posOrEntity); NLMISC::CVector resolvePositionOrEntityPosition(const CPositionOrEntity& posOrEntity);
#endif /* RY_POSITIONORENTITYPOSRESOLVER_H */ #endif /* RY_POSITIONORENTITYPOSRESOLVER_H */

@ -3565,7 +3565,7 @@ void impulseSetNpcIconTimer(NLMISC::CBitMemStream &impulse)
void impulsePlaySoundTrigger(NLMISC::CBitMemStream& impulse) void impulsePlaySoundTrigger(NLMISC::CBitMemStream& impulse)
{ {
NLMISC::CSheetId SoundId; NLMISC::CSheetId SoundId;
TPositionOrEntity SoundPosition; CPositionOrEntity SoundPosition;
impulse.serial(SoundId); impulse.serial(SoundId);
impulse.serial(SoundPosition); impulse.serial(SoundPosition);
@ -3590,8 +3590,8 @@ void impulseCameraAnimationStep(NLMISC::CBitMemStream& impulse)
{ {
// We got a new step // We got a new step
// We first get its name // We first get its name
std::string stepName = ""; std::string stepName = "camera_animation_step";
impulse.serial(stepName); //impulse.serial(stepName);
// We tell the camera animation player to load and play this instruction // We tell the camera animation player to load and play this instruction
CCameraAnimationPlayer::getInstance()->playStep(stepName, impulse); CCameraAnimationPlayer::getInstance()->playStep(stepName, impulse);

@ -141,10 +141,10 @@ public:
} }
/// This function returns the difference between the player's position and the specified position /// This function returns the difference between the player's position and the specified position
virtual NLMISC::CVector getDiffPos(const NLMISC::CVector& targetPos) const = 0; /*virtual NLMISC::CVector getDiffPos(const NLMISC::CVector& targetPos) const = 0;
/// This function returns the target position given the difference between the player's position and this target position /// This function returns the target position given the difference between the player's position and this target position
virtual NLMISC::CVector setPositionFromDiffPos(const NLMISC::CVector& diffPos) = 0; virtual NLMISC::CVector setPositionFromDiffPos(const NLMISC::CVector& diffPos) = 0;*/
TDataSetIndex getEntityId() const TDataSetIndex getEntityId() const
{ {
@ -175,14 +175,16 @@ public:
{ {
if (f.isReading()) if (f.isReading())
{ {
NLMISC::CVector diffPos = NLMISC::CVector(); /*NLMISC::CVector diffPos = NLMISC::CVector();
NLMISC::serialPositionDifference(f, diffPos); NLMISC::serialPositionDifference(f, diffPos);
setPositionFromDiffPos(diffPos); setPositionFromDiffPos(diffPos);*/
f.serial(Position);
} }
else else
{ {
NLMISC::CVector diffPos = getDiffPos(getPosition()); /*NLMISC::CVector diffPos = getDiffPos(getPosition());
NLMISC::serialPositionDifference(f, diffPos); NLMISC::serialPositionDifference(f, diffPos);*/
f.serial(Position);
} }
} }
else if (isEntityId()) else if (isEntityId())

@ -116,7 +116,7 @@ CPositionOrEntityHelper CPositionOrEntityHelper::fromString(const std::string& s
return CPositionOrEntityHelper(); return CPositionOrEntityHelper();
} }
NLMISC::CVector CPositionOrEntityHelper::getDiffPos(const NLMISC::CVector& targetPos) const /*NLMISC::CVector CPositionOrEntityHelper::getDiffPos(const NLMISC::CVector& targetPos) const
{ {
return Position; return Position;
} }
@ -124,4 +124,4 @@ NLMISC::CVector CPositionOrEntityHelper::getDiffPos(const NLMISC::CVector& targe
NLMISC::CVector CPositionOrEntityHelper::setPositionFromDiffPos(const NLMISC::CVector& diffPos) NLMISC::CVector CPositionOrEntityHelper::setPositionFromDiffPos(const NLMISC::CVector& diffPos)
{ {
return Position; return Position;
} }*/

@ -59,10 +59,10 @@ public:
// Declares abstract methods // Declares abstract methods
/// This function returns the difference between the player's position and the specified position /// This function returns the difference between the player's position and the specified position
NLMISC::CVector getDiffPos(const NLMISC::CVector& targetPos) const; /*NLMISC::CVector getDiffPos(const NLMISC::CVector& targetPos) const;
/// This function returns the target position given the difference between the player's position and this target position /// This function returns the target position given the difference between the player's position and this target position
NLMISC::CVector setPositionFromDiffPos(const NLMISC::CVector& diffPos); NLMISC::CVector setPositionFromDiffPos(const NLMISC::CVector& diffPos);*/
}; };

Loading…
Cancel
Save