Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / client_sheets / fx_sheet.cpp
blobd647b686fe72090633e99effee3c040e2f10f967
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 // INCLUDE //
22 /////////////
23 #include "stdpch.h" // First include for pre-compiled headers.
24 // Georges
25 #include "nel/georges/u_form_elm.h"
26 // Client.
27 #include "fx_sheet.h"
30 ///////////
31 // USING //
32 ///////////
33 using namespace NLGEORGES;
34 using namespace std;
37 uint CFXSheet::CPSStruct::StandardIndex = 2;
40 //-----------------------------------------------
41 // CFXSheet :
42 // Constructor.
43 //-----------------------------------------------
44 CFXSheet::CFXSheet()
46 // Initialize the type.
47 Type = CEntitySheet::FX;
48 }// CFXSheet //
50 //-----------------------------------------------
51 // build :
52 // Build the sheet from an external script.
53 //-----------------------------------------------
54 void CFXSheet::build(const NLGEORGES::UFormElm &item)
57 // Trail List
58 const UFormElm *elmt = 0;
59 bool result = item.getNodeByName(&elmt, "Trail_List");
60 if(result)
62 if (elmt)
64 uint arrawSize;
65 elmt->getArraySize(arrawSize);
66 // Get all animation for the State.
67 for(uint i = 0; i<arrawSize; ++i)
69 const UFormElm *trailElmt;
70 result = elmt->getArrayNode(&trailElmt, i);
71 if (result)
73 if(trailElmt)
75 // Get the shape
76 string shape;
77 if(!trailElmt->getValueByName(shape, "Shape"))
78 debug("Key 'Shape' not found.");
80 nlinfo("trail %s", shape.c_str());
81 if(!shape.empty())
82 TrailList.push_back(shape);
85 else
87 nlwarning("CAnimationState::build : element (%d) should be here in 'animations'. Sheet is %s.", Id.toString().c_str());
92 else
94 nlwarning("CFXSheet::build: there is no element 'Trail_List' in the form %s.", Id.toString().c_str());
97 // PS List
98 elmt = 0;
99 item.getNodeByName(&elmt, "PS_List");
100 if(elmt)
102 uint arrawSize;
103 elmt->getArraySize(arrawSize);
104 // Get all animation for the State.
105 for(uint i = 0; i<arrawSize; ++i)
107 const UFormElm *psElmt;
108 elmt->getArrayNode(&psElmt, i);
109 if(psElmt)
111 // Get the shape
112 CPSStruct ps;
113 if(!psElmt->getValueByName(ps.PSName, "PS"))
114 debug("Key 'PS' not found.");
115 if(!psElmt->getValueByName(ps.Anim, "Anim"))
116 debug("Key 'Anim' not found.");
118 CPSStruct::CPSUserParamStruct params;
120 // Power Null
121 ps.Power.push_back(params);
123 // Weak
124 if(!psElmt->getValueByName(params.UserParam0, "weak.User Param 0"))
125 debug("Key 'weak.User Param 0' not found.");
126 if(!psElmt->getValueByName(params.UserParam1, "weak.User Param 1"))
127 debug("Key 'weak.User Param 1' not found.");
128 if(!psElmt->getValueByName(params.UserParam2, "weak.User Param 2"))
129 debug("Key 'weak.User Param 2' not found.");
130 if(!psElmt->getValueByName(params.UserParam3, "weak.User Param 3"))
131 debug("Key 'weak.User Param 3' not found.");
132 ps.Power.push_back(params);
134 // Standard
135 nlassert( CPSStruct::StandardIndex == ps.Power.size() );
136 if(!psElmt->getValueByName(params.UserParam0, "standard.User Param 0"))
137 debug("Key 'standard.User Param 0' not found.");
138 if(!psElmt->getValueByName(params.UserParam1, "standard.User Param 1"))
139 debug("Key 'standard.User Param 1' not found.");
140 if(!psElmt->getValueByName(params.UserParam2, "standard.User Param 2"))
141 debug("Key 'standard.User Param 2' not found.");
142 if(!psElmt->getValueByName(params.UserParam3, "standard.User Param 3"))
143 debug("Key 'standard.User Param 3' not found.");
144 ps.Power.push_back(params);
146 // Strong
147 if(!psElmt->getValueByName(params.UserParam0, "strong.User Param 0"))
148 debug("Key 'strong.User Param 0' not found.");
149 if(!psElmt->getValueByName(params.UserParam1, "strong.User Param 1"))
150 debug("Key 'strong.User Param 1' not found.");
151 if(!psElmt->getValueByName(params.UserParam2, "strong.User Param 2"))
152 debug("Key 'strong.User Param 2' not found.");
153 if(!psElmt->getValueByName(params.UserParam3, "strong.User Param 3"))
154 debug("Key 'strong.User Param 3' not found.");
155 ps.Power.push_back(params);
157 // Critical
158 if(!psElmt->getValueByName(params.UserParam0, "critical.User Param 0"))
159 debug("Key 'critical.User Param 0' not found.");
160 if(!psElmt->getValueByName(params.UserParam1, "critical.User Param 1"))
161 debug("Key 'critical.User Param 1' not found.");
162 if(!psElmt->getValueByName(params.UserParam2, "critical.User Param 2"))
163 debug("Key 'critical.User Param 2' not found.");
164 if(!psElmt->getValueByName(params.UserParam3, "critical.User Param 3"))
165 debug("Key 'critical.User Param 3' not found.");
166 ps.Power.push_back(params);
168 // Weak Combo
169 if(!psElmt->getValueByName(params.UserParam0, "weak combo.User Param 0"))
170 debug("Key 'weak combo.User Param 0' not found.");
171 if(!psElmt->getValueByName(params.UserParam1, "weak combo.User Param 1"))
172 debug("Key 'weak combo.User Param 1' not found.");
173 if(!psElmt->getValueByName(params.UserParam2, "weak combo.User Param 2"))
174 debug("Key 'weak combo.User Param 2' not found.");
175 if(!psElmt->getValueByName(params.UserParam3, "weak combo.User Param 3"))
176 debug("Key 'weak combo.User Param 3' not found.");
177 ps.Power.push_back(params);
179 // Strng Combo
180 if(!psElmt->getValueByName(params.UserParam0, "strong combo.User Param 0"))
181 debug("Key 'strong combo.User Param 0' not found.");
182 if(!psElmt->getValueByName(params.UserParam1, "strong combo.User Param 1"))
183 debug("Key 'strong combo.User Param 1' not found.");
184 if(!psElmt->getValueByName(params.UserParam2, "strong combo.User Param 2"))
185 debug("Key 'strong combo.User Param 2' not found.");
186 if(!psElmt->getValueByName(params.UserParam3, "strong combo.User Param 3"))
187 debug("Key 'strong combo.User Param 3' not found.");
188 ps.Power.push_back(params);
190 if(!ps.PSName.empty())
191 PSList.push_back(ps);
193 else
194 nlwarning("CAnimationState::build : element (%d) should be here in 'animations'.");
197 else
198 nlwarning("CFXSheet::build: there is no element 'PS_List' in the form.");
199 }// build //
202 //-----------------------------------------------
203 // serial :
204 // Serialize FX sheet into binary data file.
205 //-----------------------------------------------
206 void CFXSheet::serial(NLMISC::IStream &f)
208 f.serialCont(TrailList);
209 f.serialCont(PSList);
210 }// serial //