Add infos into target window
[ryzomcore.git] / ryzom / client / src / attached_fx.h
blob6f8f791cd625dfc1ae65a0784860cf479ca74128
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/>.
17 #ifndef CL_ATTACHED_FX_H
18 #define CL_ATTACHED_FX_H
20 #include "fx_manager.h"
21 #include "animation_fx.h"
22 #include "game_share/entity_types.h"
23 #include "client_sheets/fx_stick_mode.h"
24 #include "nel/misc/smart_ptr.h"
25 #include "nel/misc/vector.h"
26 #include "nel/3d/animation_time.h"
28 namespace NL3D
30 class UParticleSystemInstance;
33 class CCharacterCL;
35 // max number of anim a fx animation can span over.
36 const uint MAX_FX_ANIM_COUNT = 2;
39 /** An fx linked to a character using a stick mode (replacement to former class CCharacterCL::CAnimFX)
40 * \TODO nico The template sheet is named CAnimationFX. Maybe CAttachedFXTemplate would be a better name...
41 * \author Nicolas Vizerie
42 * \author Nevrax France
43 * \date 2005
45 class CAttachedFX : public NLMISC::CRefCount
47 public:
48 friend class CCharacterCL;
49 // FX targeter (could be the caster for a ray, or for range impact...)
50 class CTargeterInfo
52 public:
53 uint8 Slot;
54 CFXStickMode StickMode;
55 NLMISC::CVector StickOffset;
56 NLMISC::CVector DefaultPos; // Default pos used if slot isn't available
57 CTargeterInfo()
59 Slot = CLFECOMMON::INVALID_SLOT;
60 StickOffset = NLMISC::CVector::Null;
61 DefaultPos = NLMISC::CVector::Null;
64 // Description of fx to build
65 class CBuildInfo
67 public:
68 const CAnimationFX* Sheet;
69 const CFXStickMode* StickMode; // NULL to use default stick mode of the sheet
70 NLMISC::CVector StickOffset;
71 const NLMISC::CMatrix* StaticMatrix; // Useful if stick mode is "StaticMatrix"
72 uint MaxNumAnimCount; // Number of frame on which the fx can overlap when it is being shutdown
73 float TimeOut;
74 double StartTime;
75 float DelayBeforeStart;
76 public:
77 CBuildInfo()
79 Sheet = NULL;
80 StickMode = NULL;
81 StickOffset = NLMISC::CVector::Null;
82 StaticMatrix = NULL;
83 MaxNumAnimCount = 0;
84 TimeOut = FX_MANAGER_DEFAULT_TIMEOUT;
85 StartTime = 0.0;
86 DelayBeforeStart = 0.f;
89 CAttachedFX();
90 ~CAttachedFX();
91 // Creation from a sheet (sheet used in buildInfo)
92 void create(CCharacterCL &parent,
93 const CBuildInfo &buildInfo,
94 const CTargeterInfo &targeterInfo
96 // Creation from an externally created FX (sheet is still used to specify track)
97 void create(CCharacterCL &parent,
98 NL3D::UParticleSystemInstance instance,
99 const CBuildInfo &buildInfo,
100 const CTargeterInfo &targeterInfo
102 // reset that object
103 void clear();
105 /* old params
106 CAnimFX &dest,
107 NL3D::UParticleSystemInstance instance,
108 const CAnimationFX *sheet,
109 const CFXStickMode *stickMode,
110 float timeOut = FX_MANAGER_DEFAULT_TIMEOUT,
111 const NLMISC::CVector &stickOffset = NLMISC::CVector::Null,
112 uint maxNumAnimCount = 0,
113 uint8 targeterSlot = CLFECOMMON::INVALID_SLOT
117 // update position
118 void update(CCharacterCL &parent, const NLMISC::CMatrix &alignMatrix);
119 // a smart pointer to that object
120 typedef NLMISC::CSmartPtr<CAttachedFX> TSmartPtr;
121 public:
122 NL3D::UParticleSystemInstance FX;
123 const CAnimationFX *AniFX;
125 NL3D::TGlobalAnimationTime SpawnTime; // used for track evaluation
126 NLMISC::CVector SpawnPos; // spawn pos is in world in 'spawn' mode, or local for 'sticked' and 'follow' modes
127 double TimeOutDate; // timeOut date for FXs to be removed. If the fx is in the active list, then the date is relative and is added to current date when the fx is shutdown
128 uint MaxAnimCount; // max number of anim changes during which the fx is still visible while being shutdown (0 if no limit)
130 CFXStickMode::TStickMode StickMode; // The stick mode for that fx. If NULL, the default stickmode of the .animation_fx sheet is used instead
131 uint8 UserBoneID; // filled only when fx is sticked
133 CTargeterInfo TargeterInfo;
134 uint8 TargeterUserBoneID; // filled at setup
135 // eval pos from slot & stick mode
136 void evalTargeterStickPos(NLMISC::CVector &dest) const;
143 #endif