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/>.
23 #include "stdpch.h" // First include for pre-compiled headers.
25 #include "nel/georges/u_form_elm.h"
33 using namespace NLGEORGES
;
37 uint
CFXSheet::CPSStruct::StandardIndex
= 2;
40 //-----------------------------------------------
43 //-----------------------------------------------
46 // Initialize the type.
47 Type
= CEntitySheet::FX
;
50 //-----------------------------------------------
52 // Build the sheet from an external script.
53 //-----------------------------------------------
54 void CFXSheet::build(const NLGEORGES::UFormElm
&item
)
58 const UFormElm
*elmt
= 0;
59 bool result
= item
.getNodeByName(&elmt
, "Trail_List");
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
);
77 if(!trailElmt
->getValueByName(shape
, "Shape"))
78 debug("Key 'Shape' not found.");
80 nlinfo("trail %s", shape
.c_str());
82 TrailList
.push_back(shape
);
87 nlwarning("CAnimationState::build : element (%d) should be here in 'animations'. Sheet is %s.", Id
.toString().c_str());
94 nlwarning("CFXSheet::build: there is no element 'Trail_List' in the form %s.", Id
.toString().c_str());
99 item
.getNodeByName(&elmt
, "PS_List");
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
);
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
;
121 ps
.Power
.push_back(params
);
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
);
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
);
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
);
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
);
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
);
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
);
194 nlwarning("CAnimationState::build : element (%d) should be here in 'animations'.");
198 nlwarning("CFXSheet::build: there is no element 'PS_List' in the form.");
202 //-----------------------------------------------
204 // Serialize FX sheet into binary data file.
205 //-----------------------------------------------
206 void CFXSheet::serial(NLMISC::IStream
&f
)
208 f
.serialCont(TrailList
);
209 f
.serialCont(PSList
);