Mercurial > mm7
comparison Spells.cpp @ 191:4813b57396ba
spell init in progress
author | Gloval |
---|---|
date | Sat, 16 Feb 2013 02:26:01 +0400 |
parents | 038a4d09406f |
children | 1c8add70bcf9 29545d87e11d |
comparison
equal
deleted
inserted
replaced
190:9b77686e2239 | 191:4813b57396ba |
---|---|
105 return result; | 105 return result; |
106 } | 106 } |
107 | 107 |
108 //----- (0045384A) -------------------------------------------------------- | 108 //----- (0045384A) -------------------------------------------------------- |
109 void SpellStats::Initialize() | 109 void SpellStats::Initialize() |
110 { | 110 { |
111 SpellStats *v1; // esi@1 | 111 |
112 const char *v2; // ebp@3 | 112 int decode_step; |
113 char *v3; // edi@3 | 113 char* test_string; |
114 signed int v4; // ebx@4 | 114 bool break_loop; |
115 char *v5; // esi@4 | 115 unsigned char c; |
116 char v6; // cl@5 | 116 unsigned int temp_str_len; |
117 int v7; // eax@5 | 117 char* tmp_pos; |
118 size_t v8; // ebp@40 | 118 |
119 int v9; // eax@41 | 119 if ( pSpellsTXT_Raw ) |
120 int v10; // eax@42 | 120 pAllocator->FreeChunk(pSpellsTXT_Raw); |
121 int v11; // eax@43 | 121 pSpellsTXT_Raw = NULL; |
122 char *v12; // [sp+10h] [bp-10h]@3 | 122 |
123 signed int v13; // [sp+14h] [bp-Ch]@4 | 123 pSpellsTXT_Raw = (char *)pEvents_LOD->LoadRaw("spells.txt", 0); |
124 signed int v14; // [sp+18h] [bp-8h]@3 | 124 strtok(pSpellsTXT_Raw, "\r"); |
125 int v15; // [sp+1Ch] [bp-4h]@9 | 125 strtok(NULL, "\r"); |
126 | 126 v14 = 1; |
127 v1 = this; | 127 for(int i=1; i<100; ++i) |
128 | 128 { |
129 if ( pSpellsTXT_Raw ) | 129 test_string=strtok(NULL, "\r")+1; |
130 pAllocator->FreeChunk(pSpellsTXT_Raw); | 130 decode_step =0; |
131 pSpellsTXT_Raw = NULL; | 131 break_loop=false; |
132 | 132 do |
133 pSpellsTXT_Raw = (char *)pEvents_LOD->LoadRaw("spells.txt", 0); | 133 { |
134 strtok(pSpellsTXT_Raw, "\r"); | 134 c = *(unsigned char*)test_string; |
135 strtok(NULL, "\r"); | 135 temp_str_len = 0; |
136 v14 = 1; | 136 while((c!='\t')&&(c>0)) |
137 v12 = (char *)&pSpellDatas[1].field_10; | 137 { |
138 v3 = (char *)&v1->pInfos[1].uSchool; | 138 ++temp_str_len; |
139 do | 139 c=test_string[temp_str_len]; |
140 { | 140 } |
141 v4 = 0; | 141 tmp_pos=test_string+temp_str_len; |
142 v5 = strtok(0, v2) + 1; | 142 if (*tmp_pos == 0) |
143 v13 = 0; | 143 break_loop = true; |
144 do | 144 *tmp_pos = 0; |
145 { | 145 if (temp_str_len) |
146 v6 = *v5; | 146 { |
147 v7 = 0; | 147 switch (decode_step) |
148 while ( v6 != 9 && v6 ) | 148 { |
149 { | 149 case 2: |
150 ++v7; | 150 pInfos[i].pName=RemoveQuotes(test_string); |
151 v6 = v5[v7]; | 151 break; |
152 } | 152 case 3: |
153 v15 = (int)&v5[v7]; | 153 pInfos[i].uSchool = 4; |
154 if ( !v5[v7] ) | 154 if (!_strcmpi("fire", test_string) ) |
155 v13 = 1; | 155 { |
156 v5[v7] = 0; | 156 pInfos[i].uSchool =0; |
157 if ( v7 ) | 157 break; |
158 { | 158 } |
159 switch ( v4 ) | 159 if ( !_strcmpi("air", test_string) ) |
160 { | 160 { |
161 case 2: | 161 pInfos[i].uSchool = 1; |
162 *((char **)v3 - 7) = RemoveQuotes(v5); | 162 break; |
163 break; | 163 } |
164 case 3: | 164 if ( !_strcmpi("water", test_string)) |
165 *v3 = 4; | 165 { |
166 if ( _strcmpi("fire", v5) ) | 166 pInfos[i].uSchool = 2; |
167 { | 167 break; |
168 if ( _strcmpi("air", v5) ) | 168 } |
169 { | 169 if ( !_strcmpi("earth", test_string)) |
170 if ( _strcmpi("water", v5) ) | 170 { |
171 { | 171 pInfos[i].uSchool = 3; |
172 if ( _strcmpi("earth", v5) ) | 172 break; |
173 { | 173 } |
174 if ( _strcmpi("spirit", v5) ) | 174 if ( !_strcmpi("spirit", test_string)) |
175 { | 175 { |
176 if ( _strcmpi("mind", v5) ) | 176 pInfos[i].uSchool = 6; |
177 { | 177 break; |
178 if ( _strcmpi("body", v5) ) | 178 } |
179 { | 179 if ( !_strcmpi("mind", test_string)) |
180 if ( _strcmpi("light", v5) ) | 180 { |
181 { | 181 pInfos[i].uSchool = 7; |
182 if ( _strcmpi("dark", v5) ) | 182 break; |
183 { | 183 } |
184 if ( !_strcmpi("magic", v5) ) | 184 if ( !_strcmpi("body", test_string) ) |
185 *v3 = 5; | 185 { |
186 } | 186 pInfos[i].uSchool = 8; |
187 else | 187 break; |
188 { | 188 } |
189 *v3 = 10; | 189 if ( !_strcmpi("light", test_string) ) |
190 } | 190 { |
191 } | 191 pInfos[i].uSchool = 9; |
192 else | 192 break; |
193 { | 193 } |
194 *v3 = 9; | 194 if ( !_strcmpi("dark", test_string)) |
195 } | 195 { |
196 } | 196 pInfos[i].uSchool = 10; |
197 else | 197 break; |
198 { | 198 } |
199 *v3 = 8; | 199 |
200 } | 200 if ( !_strcmpi("magic", test_string)) |
201 } | 201 { |
202 else | 202 pInfos[i].uSchool = 5; |
203 { | 203 break; |
204 *v3 = 7; | 204 } |
205 } | 205 |
206 } | 206 break; |
207 else | 207 case 4: |
208 { | 208 pInfos[i].pShortName=RemoveQuotes(test_string); |
209 *v3 = 6; | 209 break; |
210 } | 210 case 5: |
211 } | 211 pInfos[i].pDescription=RemoveQuotes(test_string); |
212 else | 212 break; |
213 { | 213 case 6: |
214 *v3 = 3; | 214 pInfos[i].pBasicSkillDesc=RemoveQuotes(test_string); |
215 } | 215 break; |
216 } | 216 case 7: |
217 else | 217 pInfos[i].pExpertSkillDesc=RemoveQuotes(test_string); |
218 { | 218 break; |
219 *v3 = 2; | 219 case 8: |
220 } | 220 pInfos[i].pMasterSkillDesc=RemoveQuotes(test_string); |
221 } | 221 break; |
222 else | 222 case 9: |
223 { | 223 pInfos[i].pGrandmasterSkillDesc=RemoveQuotes(test_string); |
224 *v3 = 1; | 224 break; |
225 } | 225 case 10: |
226 } | 226 int in_string_pos=0; |
227 else | 227 int in_str_len=strlen(test_string); |
228 { | 228 /*v4 = 0; fix_me |
229 *v3 = 0; | 229 v8 = strlen(v5); |
230 } | 230 if ( (signed int)v8 > 0 ) |
231 break; | 231 { |
232 case 4: | 232 do |
233 *((char **)v3 - 6) = RemoveQuotes(v5); | 233 { |
234 break; | 234 v9 = tolower((unsigned __int8)v5[v4]) - 99; |
235 case 5: | 235 if ( v9 ) |
236 *((char **)v3 - 5) = RemoveQuotes(v5); | 236 { |
237 break; | 237 v10 = v9 - 2; |
238 case 6: | 238 if ( v10 ) |
239 *((char **)v3 - 4) = RemoveQuotes(v5); | 239 { |
240 break; | 240 v11 = v10 - 8; |
241 case 7: | 241 if ( v11 ) |
242 *((char **)v3 - 3) = RemoveQuotes(v5); | 242 { |
243 break; | 243 if ( v11 == 11 ) |
244 case 8: | 244 *v12 |= 8u; |
245 *((char **)v3 - 2) = RemoveQuotes(v5); | 245 } |
246 break; | 246 else |
247 case 9: | 247 { |
248 *((char **)v3 - 1) = RemoveQuotes(v5); | 248 *v12 |= 1u; |
249 break; | 249 } |
250 case 10: | 250 } |
251 v4 = 0; | 251 else |
252 v8 = strlen(v5); | 252 { |
253 if ( (signed int)v8 > 0 ) | 253 *v12 |= 2u; |
254 { | 254 } |
255 do | 255 } |
256 { | 256 else |
257 v9 = tolower((unsigned __int8)v5[v4]) - 99; | 257 { |
258 if ( v9 ) | 258 *v12 |= 4u; |
259 { | 259 } |
260 v10 = v9 - 2; | 260 ++v4; |
261 if ( v10 ) | 261 } |
262 { | 262 while ( v4 < (signed int)v8 );*/ |
263 v11 = v10 - 8; | 263 break; |
264 if ( v11 ) | 264 } |
265 { | 265 } |
266 if ( v11 == 11 ) | 266 else |
267 *v12 |= 8u; | 267 break_loop=true; |
268 } | 268 ++decode_step; |
269 else | 269 test_string=tmp_pos+1; |
270 { | 270 } while ((decode_step<11)&&!break_loop); |
271 *v12 |= 1u; | 271 if ((i%11)==0) |
272 } | 272 strtok(NULL, "\r"); |
273 } | 273 } |
274 else | 274 |
275 { | 275 } |
276 *v12 |= 2u; | |
277 } | |
278 } | |
279 else | |
280 { | |
281 *v12 |= 4u; | |
282 } | |
283 ++v4; | |
284 } | |
285 while ( v4 < (signed int)v8 ); | |
286 } | |
287 v2 = "\r"; | |
288 break; | |
289 default: | |
290 break; | |
291 } | |
292 } | |
293 else | |
294 { | |
295 v13 = 1; | |
296 } | |
297 ++v4; | |
298 v5 = (char *)(v15 + 1); | |
299 } | |
300 while ( v4 - 1 <= 10 && !v13 ); | |
301 if ( !(v14 % 11) ) | |
302 strtok(0, v2); | |
303 v12 += 20; | |
304 ++v14; | |
305 v3 += 36; | |
306 } | |
307 while ( (signed int)v12 <= (signed int)&pSpellDatas[90].field_12 ); | |
308 } |