1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
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.
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_H
20 #define CL_ANIMATION_H
27 #include "game_share/magic_fx.h"
28 #include "client_sheets/animation_set_list_sheet.h"
30 #include "animation_fx.h"
46 class CAnimationFXSet
;
50 * Class to describe an animation.
51 * \author Guillaume PUZIN (GUIGUI)
52 * \author Nevrax France
54 * \todo GUIGUI : change the animation name to remove ".anim".
59 /// Type of an animation.
62 UnknownAnim
= 0xffffffff
71 /// Build the structure from the georges file read in sheet manager
72 void init(CAnimationSheet
*sheet
, NL3D::UAnimationSet
*animationSet
);
74 /// Return the Animation Id or UnknownAnim.
75 uint
id() const {return _Animation
;}
76 /// Return the Animation Id or UnknownAnim.
77 const NLSOUND::TSoundAnimId
&soundId() const {return _SoundAnim
;}
78 /// Must apply the Character scale Pos factor to the "pos" channel" of this animation.
79 bool applyCharacterScalePosFactor() const {return _Sheet
->ApplyCharacterScalePosFactor
;}
80 /// Return the fx associated with the animation.
81 std::string
fx() const { return _Sheet
->FxNames
.get(_Sheet
->IdFX
); }
82 /// Is the head controlable by the code.
83 bool headControlable() const {return _Sheet
->HeadControlable
;}
85 /// Is the head controlable by the code.
86 bool isReverse() const {return _Sheet
->Reverse
;}
88 /// Is the head controlable by the code.
89 bool hideAtEndAnim() const {return _Sheet
->HideAtEndAnim
;}
91 double getRot() const {return _Rot
;}
92 double virtualRot() const {return _Sheet
->VirtualRot
;}
95 CAnimationFXSet
&getFXSet() { return _FXSet
; }
96 const CAnimationFXSet
&getFXSet() const { return _FXSet
; }
98 /** Return the next animation to play or -1.
99 * only filtered anim (in animFilterStates) are used. if none, return -1
101 sint8
getNextAnim(const std::vector
<bool> &animFilterStates
) const;
103 static std::set
<std::string
> MissingAnim
;
105 // static void memoryCompress() { _FxNames.memoryCompress(); }
106 // static void memoryRelease() { _FxNames.clear(); }
108 void resetSoundAnim();
109 void reloadSoundAnim();
111 // true if this animation can be played according to the character job/race
112 bool filterOk(uint32 jobSpecialisation
, EGSPD::CPeople::TPeople race
) const
116 // Common case: No job restriction and no race restriction? => always ok
117 if(_Sheet
->JobRestriction
==0 && _Sheet
->RaceRestriction
==EGSPD::CPeople::Unknown
)
119 // if job restriction don't match
120 if(_Sheet
->JobRestriction
!=0 && _Sheet
->JobRestriction
!=jobSpecialisation
)
122 // if race restriction don't match
123 if(_Sheet
->RaceRestriction
!=EGSPD::CPeople::Unknown
&& _Sheet
->RaceRestriction
!=race
)
129 // return the list of Next Anim
130 const std::vector
<sint8
> &getNextAnimList() const;
133 /// Id of the sound animation.
134 NLSOUND::TSoundAnimId _SoundAnim
;
136 /// Name of the sound animation, for SoundAnimManager Reload
137 std::string _SoundAnimName
;
142 /// Rotation in the animation.
145 // FX set to launch with the animation
146 CAnimationFXSet _FXSet
;
149 CAnimationSheet
*_Sheet
;
152 void computeAnimation(NL3D::UAnimationSet
*animationSet
, const std::string
&animName
);
156 #endif // CL_ANIMATION_H
158 /* End of animation.h */