From 16daae2b6e22c507b4d042e48e78d376baf11b4b Mon Sep 17 00:00:00 2001 From: Fabien_HENON Date: Tue, 7 Aug 2012 20:50:32 +0200 Subject: [PATCH] Added: #1469 Basic implementation of a CamAnimMode in the UserControls --HG-- branch : gsoc2012-fabien --- .../client/src/motion/modes/cam_anim_mode.cpp | 81 +++++++++++++++++++ .../ryzom/client/src/motion/user_controls.cpp | 22 +++++ code/ryzom/client/src/motion/user_controls.h | 12 +++ 3 files changed, 115 insertions(+) create mode 100644 code/ryzom/client/src/motion/modes/cam_anim_mode.cpp diff --git a/code/ryzom/client/src/motion/modes/cam_anim_mode.cpp b/code/ryzom/client/src/motion/modes/cam_anim_mode.cpp new file mode 100644 index 000000000..7cef7f8cb --- /dev/null +++ b/code/ryzom/client/src/motion/modes/cam_anim_mode.cpp @@ -0,0 +1,81 @@ +// 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 . + + + + +////////////// +// INCLUDES // +////////////// +#include "stdpch.h" +// Client. +#include "../../input.h" +#include "../user_controls.h" +#include "../../user_entity.h" +#include "../../view.h" +#include "../../interface_v3/interface_manager.h" +#include "../../entities.h" + + +/////////// +// USING // +/////////// + + +//////////// +// EXTERN // +//////////// + + +/////////////// +// Functions // +/////////////// +//----------------------------------------------- +// camAnimModeStart : +// Manage interactions in interactive mode (start). +//----------------------------------------------- +void CUserControls::camAnimModeStart() +{ + // No more Velocity. + UserEntity->frontVelocity(0); + UserEntity->lateralVelocity(0); + // No more autowalk + _DirectionMove = none; + // Third person view but player dead, user is not selectable. + UserEntity->selectable(false); + _InternalView = false; + // Show/hide all or parts of the user body (after _InternaView is set). + UserEntity->updateVisualDisplay(); +}// camAnimModeStart // + +//----------------------------------------------- +// camAnimModeStop : +// Manage interactions in interactive mode (stop). +//----------------------------------------------- +void CUserControls::camAnimModeStop() +{ + UserEntity->frontVelocity(_CamAnimEntityFrontVelocity); + UserEntity->lateralVelocity(_CamAnimEntityLateralVelocity); +}// camAnimModeStop // + +//----------------------------------------------- +// camAnimMode : +// Manage interactions in free head mode. +//----------------------------------------------- +void CUserControls::camAnimMode() +{ + // Call the camera animation update function to update the view +}// camAnimMode // diff --git a/code/ryzom/client/src/motion/user_controls.cpp b/code/ryzom/client/src/motion/user_controls.cpp index a56f7227e..25d19aa22 100644 --- a/code/ryzom/client/src/motion/user_controls.cpp +++ b/code/ryzom/client/src/motion/user_controls.cpp @@ -172,6 +172,9 @@ void CUserControls::init() _NeedReleaseForward = false; _NextForwardCancelMoveTo = false; + _CamAnimEntityFrontVelocity = 0.f; + _CamAnimEntityLateralVelocity = 0.f; + }// init // @@ -238,6 +241,11 @@ void CUserControls::update() deathMode(); break; + // Camera animation mode + case CamAnimMode: + camAnimMode(); + break; + // Mount Mode case MountMode: mountMode(); @@ -1089,6 +1097,11 @@ void CUserControls::mode(const TMoveMode mode) deathModeStop(); break; + // Camera animation Mode + case CamAnimMode: + camAnimModeStop(); + break; + // Mount Mode case MountMode: mountModeStop(); @@ -1125,6 +1138,11 @@ void CUserControls::mode(const TMoveMode mode) deathModeStart(); break; + // Camera animation Mode + case CamAnimMode: + camAnimModeStart(); + break; + // Mount Mode case MountMode: mountModeStart(); @@ -1160,6 +1178,10 @@ string CUserControls::modeStr() const case CUserControls::DeathMode: return "DeathMode"; + // Camera animation Mode + case CUserControls::CamAnimMode: + return "CamAnimMode"; + // Mount Mode case CUserControls::MountMode: return "MountMode"; diff --git a/code/ryzom/client/src/motion/user_controls.h b/code/ryzom/client/src/motion/user_controls.h index be1cbaf99..0a7045373 100644 --- a/code/ryzom/client/src/motion/user_controls.h +++ b/code/ryzom/client/src/motion/user_controls.h @@ -55,6 +55,7 @@ public: DeathMode, // Mode for the Death. MountMode, // Mode for the Mount. ThirdMode, // Third Person View Mode + CamAnimMode, // Mode for camera animation nbMode // Not really a mode, just here to know how many modes are there. }; @@ -109,6 +110,13 @@ private: /// Manage the Death Mode. void deathMode(); + /// Manage the camera animation Mode (start). + void camAnimModeStart(); + /// Manage the camera animation Mode (stop). + void camAnimModeStop(); + /// Manage the camera animation Mode. + void camAnimMode(); + /// Manage the Mount Mode (start). void mountModeStart(); /// Manage the Mount Mode (stop). @@ -305,6 +313,10 @@ private: /// when true the next forward action will cancel any moveto bool _NextForwardCancelMoveTo; + + /// Variables used by the camera animation mode to remember values + float _CamAnimEntityFrontVelocity; + float _CamAnimEntityLateralVelocity; }; /// User Controls (mouse, keyboard, interfaces, ...)