Use configured resolution for login/outgame/ingame
[ryzomcore.git] / ryzom / client / src / attack_list.h
blob06d9169511390cb92540d90be9bf49ff2dbf8019
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_ATTACK_LIST_H
20 #define CL_ATTACK_LIST_H
22 #include "animation_fx.h"
23 #include "animation_fx_id_array.h"
25 #include "client_sheets/attack_sheet.h"
26 #include "client_sheets/attack_id_sheet.h"
28 #include "nel/misc/string_conversion.h"
31 namespace NL3D
33 class UAnimationSet;
37 class CAttackListSheet;
39 /** Description of a creature attack
41 class CAttack
43 public:
44 // pointer on base sheet
45 const CAttackSheet *Sheet;
46 CAnimationFXSet AttackBeginFX; // .animation_fx_set
47 CAnimationFXSet AttackLoopFX;
48 CAnimationFXSet AttackEndFX;
49 CAnimationFXSet AttackStaticObjectCastFX;
50 CAnimationFXSet AttackFailFX;
51 CAnimationFXSet ProjectileFX;
52 CAnimationFXSet ImpactFX;
53 public:
54 // ctor
55 CAttack();
56 // Init from parent sheet
57 void init(const CAttackSheet *sheet, NL3D::UAnimationSet *as);
60 /// A named attack, to be inserted in an attack list
61 struct CAttackListEntry
63 CAttackListEntry() : ID(0) { }
64 CAttackListEntry(const CAttackIDSheet *id) : ID(id) { }
65 const CAttackIDSheet *ID;
66 CAttack Attack;
69 inline bool operator == (const CAttackListEntry &lhs, const CAttackListEntry &rhs)
71 nlassert(lhs.ID && rhs.ID);
72 return lhs.ID == rhs.ID;
75 inline bool operator < (const CAttackListEntry &lhs, const CAttackListEntry &rhs)
77 nlassert(lhs.ID && rhs.ID);
78 return *lhs.ID < *rhs.ID;
82 /** A list of attacks, sorted by their IDs
84 class CAttackList
86 public:
87 // build from a sheet
88 void init(const CAttackListSheet *attackList, NL3D::UAnimationSet *as);
90 // get an attack from its ID, or NULL if not found
91 const CAttack *getAttackFromID(const CAttackIDSheet &id) const;
92 private:
93 std::vector<CAttackListEntry> _Attacks;
97 /** gather all creature attack in a single place
99 class CAttackListManager
101 public:
102 // get the unique instance of this class
103 static CAttackListManager &getInstance();
104 // release memory
105 static void releaseInstance();
106 /** This :
107 * - Init an animation set.
108 * - Build all creature attacks datas and build their tracks.
110 void init();
111 void release();
112 // get an attack list by its name (NULL if not found)
113 const CAttackList *getAttackList(const std::string &name) const;
114 // get auras fx sorted by their id
115 const CAnimationFXIDArray &getAuras() const { return _Auras; }
116 // get link fx sorted by their id
117 const CAnimationFXIDArray &getLinks() const { return _Links; }
118 private:
119 typedef std::map<std::string,
120 CAttackList,
121 NLMISC::CUnsensitiveStrLessPred> TAttackListMap;
122 NL3D::UAnimationSet *_AnimationSet;
123 static CAttackListManager *_Instance;
124 TAttackListMap _AttackMap;
125 // auras and links
126 CAnimationFXIDArray _Auras;
127 CAnimationFXIDArray _Links;
128 private:
129 // ctor
130 CAttackListManager();
131 void buildAurasFXs();
132 void buildLinkFXs();
137 #endif