Changed: #1469 Making sure animation cannot be played if the player is dead

--HG--
branch : gsoc2012-fabien
hg/feature/gsoc2012-fabien
Fabien_HENON 12 years ago
parent 0553079378
commit 9f4d2fea74

@ -48,6 +48,10 @@ void CCameraAnimationPlayer::start()
if (isPlaying()) if (isPlaying())
stop(); stop();
// If the player is dead, we do nothing
if (UserControls.mode() == CUserControls::DeathMode)
return;
_IsPlaying = true; _IsPlaying = true;
// We set the user controls in camAnimMode and we remember the current view and viewPos // We set the user controls in camAnimMode and we remember the current view and viewPos
@ -58,8 +62,11 @@ void CCameraAnimationPlayer::start()
_HasLastViewInfo = true; _HasLastViewInfo = true;
} }
void CCameraAnimationPlayer::stop() void CCameraAnimationPlayer::stop(bool interrupt)
{ {
if (!isPlaying())
return;
_IsPlaying = false; _IsPlaying = false;
stopStep(); stopStep();
@ -67,6 +74,7 @@ void CCameraAnimationPlayer::stop()
// We reset view and viewPos and the usercontrols mode // We reset view and viewPos and the usercontrols mode
if (_HasLastViewInfo) if (_HasLastViewInfo)
{ {
if (!interrupt)
UserControls.mode(_LastMode); UserControls.mode(_LastMode);
View.view(_LastView); View.view(_LastView);
View.viewPos(_LastViewPos); View.viewPos(_LastViewPos);

@ -58,7 +58,7 @@ public:
void start(); void start();
/// Stops an animation /// Stops an animation
void stop(); void stop(bool interrupt = false);
/// Loads and play the specified step /// Loads and play the specified step
void playStep(const std::string& stepName, NLMISC::CBitMemStream& impulse); void playStep(const std::string& stepName, NLMISC::CBitMemStream& impulse);

@ -69,7 +69,10 @@ void CUserControls::camAnimModeStart()
//----------------------------------------------- //-----------------------------------------------
void CUserControls::camAnimModeStop() void CUserControls::camAnimModeStop()
{ {
// We tell the camera animation player to stop (by interruption)
// If the camera animation player was not playing any animation it will have no effect but this function
// is usefull if the mode has changed (player is dead) to interrupt the animation
CCameraAnimationPlayer::getInstance()->stop(true);
}// camAnimModeStop // }// camAnimModeStop //
//----------------------------------------------- //-----------------------------------------------

Loading…
Cancel
Save