Added: #1469 First impulse sent to the client to tell him the animation starts + function to get the name of a step (defined using a define)

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 13 years ago
parent 5075bc80ef
commit 73d578b764

@ -146,7 +146,10 @@ void CCameraAnimationManager::sendAnimation(const NLMISC::CEntityId& eid, const
void CCameraAnimationManager::TCameraAnimInfo::sendAnimationSteps(const NLMISC::CEntityId& eid)
{
// We first send the first step, and then the others
// We first send an impulse to the client to tell him an animation will start (this way he can remember its current position)
PlayerManager.sendImpulseToClient(eid, "CAMERA_ANIMATION:PLAY", Name);
// We send the first step, and then the others
sendAnimationStepsFrom(eid, 0);
}
@ -166,7 +169,7 @@ bool CCameraAnimationManager::TCameraAnimInfo::sendAnimationStep(const NLMISC::C
GenericMsgManager.pushNameToStream("CAMERA_ANIMATION:STEP", bms);
// We tell the step to fill the message
step->sendAnimationStep(Name, bms);
step->sendAnimationFullStep(bms);
// We add the buffer to the message
msgout.serialBufferWithSize((uint8*)bms.buffer(), bms.length());

@ -79,10 +79,10 @@ void ICameraAnimationStep::addModifier(ICameraAnimationModifier* modifier)
Modifiers.push_back(modifier);
}
void ICameraAnimationStep::sendAnimationStep(const std::string& name, NLMISC::CBitMemStream& bms)
void ICameraAnimationStep::sendAnimationFullStep(NLMISC::CBitMemStream& bms)
{
// We first add the name of the step
bms.serial(const_cast<std::string&>(name));
bms.serial(const_cast<std::string&>(getStepName()));
// We ask the step to add its information to the message
sendAnimationStep(bms);

@ -39,12 +39,14 @@ public:
/// Function that returns the duration of the step (in seconds)
virtual float getDuration() const = 0;
/// Function that returns the name of the step
virtual std::string getStepName() const = 0;
/// Function that sends the animation step the to client
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);
void sendAnimationFullStep(NLMISC::CBitMemStream& bms);
protected:
// The list of modifiers
@ -75,7 +77,7 @@ protected:
};
// Define used to register the different types of camera animation steps
#define CAMERA_ANIMATION_REGISTR_STEP(_class_,_name_) \
#define CAMERA_ANIMATION_REGISTER_STEP(_class_,_name_) \
class _class_##CameraAnimationStepFactory : public ICameraAnimationStepFactory \
{\
public:\
@ -96,4 +98,10 @@ public:\
};\
static _class_##CameraAnimationStepFactory* _class_##CameraAnimationStepFactoryInstance = new _class_##CameraAnimationStepFactory;
#define CAMERA_ANIMATION_STEP_NAME(name) \
std::string getStepName() const \
{ \
return name; \
}
#endif /* RY_CAMERAANIMATIONSTEPFACTORY_H */

@ -84,7 +84,7 @@ public:
{
return Duration;
}
}; // This class must not be registered because it a base class
}; // This class must not be registered because it's a base class
/////////////////////////////////////////////////////////////////////////////
/// Static camera animation step (that does not have specific variables)
@ -105,8 +105,10 @@ public:
{
CCameraAnimationStepBasic::sendAnimationStep(bms);
}
CAMERA_ANIMATION_STEP_NAME("camera_animation_static");
};
CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepStatic, "camera_animation_static");
CAMERA_ANIMATION_REGISTER_STEP(CCameraAnimationStepStatic, "camera_animation_static");
/////////////////////////////////////////////////////////////////////////////
/// Go to camera animation step
@ -149,8 +151,10 @@ public:
bms.serial(const_cast<TPositionOrEntity&>(EndPos));
}
CAMERA_ANIMATION_STEP_NAME("camera_animation_go_to");
};
CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepGoTo, "camera_animation_go_to");
CAMERA_ANIMATION_REGISTER_STEP(CCameraAnimationStepGoTo, "camera_animation_go_to");
/////////////////////////////////////////////////////////////////////////////
/// Follow entity camera animation step
@ -209,8 +213,10 @@ public:
bms.serial(const_cast<TPositionOrEntity&>(EntityToFollow));
bms.serial(const_cast<float&>(DistanceToEntity));
}
CAMERA_ANIMATION_STEP_NAME("camera_animation_follow_entity");
};
CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepFollowEntity, "camera_animation_follow_entity");
CAMERA_ANIMATION_REGISTER_STEP(CCameraAnimationStepFollowEntity, "camera_animation_follow_entity");
/////////////////////////////////////////////////////////////////////////////
/// Turn around camera animation step
@ -285,8 +291,10 @@ public:
bms.serial(const_cast<float&>(DistanceToPoint));
bms.serial(const_cast<float&>(Speed));
}
CAMERA_ANIMATION_STEP_NAME("camera_animation_turn_around");
};
CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepTurnAround, "camera_animation_turn_around");
CAMERA_ANIMATION_REGISTER_STEP(CCameraAnimationStepTurnAround, "camera_animation_turn_around");
/////////////////////////////////////////////////////////////////////////////
/// Animation step that returns to the starting position. It directly inherits from the interface because it
@ -331,5 +339,7 @@ public:
{
return Duration;
}
CAMERA_ANIMATION_STEP_NAME("camera_animation_return");
};
CAMERA_ANIMATION_REGISTR_STEP(CCameraAnimationStepReturn, "camera_animation_return");
CAMERA_ANIMATION_REGISTER_STEP(CCameraAnimationStepReturn, "camera_animation_return");
Loading…
Cancel
Save