Linux multi-monitor fullscreen support
[ryzomcore.git] / ryzom / client / src / animation_set.h
blobdb4f9c8d097be27999726703df92953ebd6ae601
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/>.
19 #ifndef CL_ANIMATION_SET_H
20 #define CL_ANIMATION_SET_H
22 /////////////
23 // INCLUDE //
24 /////////////
25 // Misc
26 #include "nel/misc/types_nl.h"
27 #include "nel/misc/smart_ptr.h"
28 // Client
29 #include "animation_type.h"
30 #include "animation_state.h"
31 // std
32 #include <map>
35 ///////////
36 // CLASS //
37 ///////////
39 /**
40 * Class to manage an animation set.
41 * \author Guillaume PUZIN (GUIGUI)
42 * \author Nevrax France
43 * \date 2002
45 class CAnimationSet
47 private:
48 double _MaxDist;
49 double _Angle;
50 double _AboutFaceAngle;
51 double _SpeedToRun;
52 double _SpeedToWalk;
53 double _WalkDist;
54 double _RunDist;
55 double _WalkLength;
56 double _RunLength;
58 private:
60 /// AnimationState cache
61 std::vector<CAnimationState> _AnimationStates;
62 CAnimationSetSheet *_Sheet;
64 public:
65 /// Constructor
66 CAnimationSet();
68 /**
69 * Build the animation set according to the georges file. (read in the sheet manager)
71 void init(CAnimationSetSheet *sheet, NL3D::UAnimationSet *animationSet);
73 /**
74 * Return the distance after the one you have to break the idle.
75 * \return double : this distance.
77 double maxDist() const {return _MaxDist;}
78 /**
79 * Return the distance after the one you have to break the idle.
80 * \return double : this distance.
82 double angle() const {return _Angle;}
83 /**
84 * Return the distance after the one you have to break the idle.
85 * \return double : this distance.
87 double aboutFaceAngle() const {return _AboutFaceAngle;}
88 /**
89 * When in walk animation, after this speed the animation should switch in run mode.
90 * \return double : a speed.
92 double speedToRun() const {return _SpeedToRun;}
93 /**
94 * When in run animation, before this speed the animation should switch in walk mode.
95 * \return double : a speed.
97 double speedToWalk() const {return _SpeedToWalk;}
99 /// Return the animation state from its Id. Your id must be valid, no check for optimal performances.
100 const CAnimationState *getAnimationState(const TAnimStateId& stateId) const
102 if ((uint)stateId<_AnimationStates.size ())
103 return &(_AnimationStates[stateId]);
104 else
105 return NULL;
108 // get number of animation states
109 uint getNumAnimationState() const { return (uint)_AnimationStates.size(); }
110 // get an animation state by its index
111 CAnimationState *getAnimationStateByIndex(uint index);
113 /// Return the covered distance by 1 walking animation.
114 double walkDist() const {return _WalkDist;}
115 /// Return the covered distance by 1 running animation.
116 double runDist() const {return _RunDist;}
117 /// Return the length (in sec) of the walking animation.
118 double walkLength() const {return _WalkLength;}
119 /// Return the length (in sec) of the running animation.
120 double runLength() const {return _RunLength;}
122 // get the sheet name
123 std::string getSheetName() const
125 std::string name;
126 if(_Sheet) return _Sheet->Name;
127 return name;
132 #endif // CL_ANIMATION_SET_H
134 /* End of animation_set.h */