Merge branch '164-crash-on-patching-and-possibly-right-after-login' into main/gingo...
[ryzomcore.git] / ryzom / client / src / motion / modes / mount_mode.cpp
blobf52d5c9ba4c1390a059095d70b5ca20559afe764
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 //////////////
21 // Includes //
22 //////////////
23 #include "stdpch.h"
24 #include "../../misc.h"
25 // 3D Interface.
26 #include "nel/3d/u_driver.h"
27 // Client.
28 #include "../../input.h"
29 #include "../user_controls.h"
30 #include "../../actions_client.h"
31 #include "../../view.h"
32 #include "../../time_client.h"
33 #include "../../entities.h"
34 #include "../../interface_v3/interface_manager.h"
35 #include "../../cursor_functions.h"
36 #include "../../entities.h"
39 ///////////
40 // Using //
41 ///////////
42 using namespace std;
43 using namespace NLMISC;
44 using namespace NL3D;
47 /////////////
48 // Externs //
49 /////////////
50 extern UDriver *Driver;
51 extern CEventsListener EventsListener; // Inputs Manager
53 ///////////////
54 // Functions //
55 ///////////////
56 //-----------------------------------------------
57 // mountModeStart :
58 // Manage interactions in interactive mode (start).
59 //-----------------------------------------------
60 void CUserControls::mountModeStart()
62 // Get the interface instace.
63 CInterfaceManager *instance = CInterfaceManager::getInstance();
64 if(instance)
66 // Cursor mode.
67 SetMouseCursor ();
70 // Adjust eyes height to the mount.
71 UserEntity->eyesHeight(2.5f);
72 // No more Velocity.
73 UserEntity->frontVelocity(0);
74 UserEntity->lateralVelocity(0);
75 // No more autowalk
76 _DirectionMove = none;
78 // UserEntity->walkVelocity(((float)(instance->getDbProp("SERVER:USER:MOUNT_WALK_SPEED")->getValue32()))/1000.0f); // was: 2.8f
79 // UserEntity->runVelocity(((float)(instance->getDbProp("SERVER:USER:MOUNT_RUN_SPEED")->getValue32()))/1000.0f); // was: 12.f
81 // First person view, user is not selectable.
82 UserEntity->selectable(false);
84 _InternalView = true;
86 // Show/hide all or parts of the user body.
87 UserEntity->updateVisualDisplay();
88 }// mountModeStart //
90 //-----------------------------------------------
91 // mountModeStop :
92 // Manage interactions in interactive mode (stop).
93 //-----------------------------------------------
94 void CUserControls::mountModeStop()
96 // Restore eyes height.
97 UserEntity->eyesHeight(ClientCfg.EyesHeight);
99 // \todo GUIGUI : remove this after the UBI Demo.
100 UserEntity->walkVelocity(ClientCfg.Walk);
101 UserEntity->runVelocity(ClientCfg.Run);
102 }// mountModeStop //
104 //-----------------------------------------------
105 // mountMode :
106 // Manage interactions in mount mode.
107 //-----------------------------------------------
108 void CUserControls::mountMode()
110 // Manage common moves.
111 commonMove();
113 // Set the view.
114 View.viewPos(UserEntity->pos() + CVector(0,0,_ZOscil));
115 commonSetView();
117 }// mountMode //