comparison Monsters.cpp @ 237:2799737f8a74

more text parsers refactor
author Gloval
date Mon, 18 Feb 2013 00:47:36 +0400
parents 9b77686e2239
children 52329962fcdb
comparison
equal deleted inserted replaced
234:47e06334c564 237:2799737f8a74
213 213
214 214
215 //----- (00454F4E) -------------------------------------------------------- 215 //----- (00454F4E) --------------------------------------------------------
216 void MonsterStats::InitializePlacements() 216 void MonsterStats::InitializePlacements()
217 { 217 {
218 char *v1; // ebx@1 218 int i;
219 MonsterStats *v2; // edi@1 219 char* test_string;
220 char *v3; // eax@2 220 unsigned char c;
221 char v4; // dl@3 221 bool break_loop;
222 char *v5; // ecx@3 222 unsigned int temp_str_len;
223 int v6; // esi@7 223 char* tmp_pos;
224 signed int v7; // [sp+Ch] [bp-10h]@1 224 int decode_step;
225 char **v8; // [sp+10h] [bp-Ch]@1 225 int item_counter;
226 signed int v9; // [sp+14h] [bp-8h]@2 226
227 char *v10; // [sp+18h] [bp-4h]@2
228
229 v1 = 0;
230 v2 = this;
231 pMonsterPlacementTXT_Raw = (char *)pEvents_LOD->LoadRaw("placemon.txt", 0); 227 pMonsterPlacementTXT_Raw = (char *)pEvents_LOD->LoadRaw("placemon.txt", 0);
232 strtok(pMonsterPlacementTXT_Raw, "\r"); 228 strtok(pMonsterPlacementTXT_Raw, "\r");
233 v2->uNumPlacements = 31; 229 for (i=1; i<31; ++i)
234 v8 = v2->pPlacement.pSubstrings; 230 {
235 v7 = 30; 231 test_string = strtok(NULL, "\r") + 1;
236 do 232 break_loop = false;
237 { 233 decode_step=0;
238 v3 = strtok(v1, "\r") + 1; 234 do
239 v10 = v1; 235 {
240 v9 = (signed int)v1; 236 c = *(unsigned char*)test_string;
241 do 237 temp_str_len = 0;
242 { 238 while((c!='\t')&&(c>0))
243 v4 = *v3; 239 {
244 v5 = 0; 240 ++temp_str_len;
245 if ( *v3 != 9 ) 241 c=test_string[temp_str_len];
246 { 242 }
247 v1 = 0; 243 tmp_pos=test_string+temp_str_len;
248 do 244 if (*tmp_pos == 0)
249 { 245 break_loop = true;
250 if ( !v4 ) 246 *tmp_pos = 0;
251 break; 247 if (temp_str_len)
252 ++v5; 248 {
253 v4 = v3[(unsigned int)v5]; 249 if (decode_step==1)
254 } 250 pPlaceStrings[i]=RemoveQuotes(test_string);
255 while ( v4 != 9 ); 251 }
256 } 252 else
257 v6 = (int)&v3[(unsigned int)v5]; 253 {
258 if ( v3[(unsigned int)v5] == (unsigned char)v1 ) 254 break_loop = true;
259 v9 = 1; 255 }
260 *(unsigned char *)v6 = (unsigned char)v1; 256 ++decode_step;
261 if ( v5 == v1 ) 257 test_string=tmp_pos+1;
262 { 258 } while ((decode_step<3)&&!break_loop);
263 v9 = 1; 259 }
264 } 260 uNumPlacements = 31;
265 else
266 {
267 if ( v10 == (char *)1 )
268 *v8 = (char *)RemoveQuotes(v3);
269 }
270 ++v10;
271 v3 = (char *)(v6 + 1);
272 }
273 while ( (signed int)(v10 - 1) <= 31 && (char *)v9 == v1 );
274 ++v8;
275 --v7;
276 }
277 while ( v7 );
278 v2->uNumPlacements = 31;
279 } 261 }
280 262
281 //----- (0045501E) -------------------------------------------------------- 263 //----- (0045501E) --------------------------------------------------------
282 void MonsterStats::Initialize() 264 void MonsterStats::Initialize()
283 { 265 {