comparison mm7_2.cpp @ 237:2799737f8a74

more text parsers refactor
author Gloval
date Mon, 18 Feb 2013 00:47:36 +0400
parents 47e06334c564
children fb8a876f41e1
comparison
equal deleted inserted replaced
234:47e06334c564 237:2799737f8a74
7563 v9 = pMapInfo->uEncounterMonster1AtLeast; 7563 v9 = pMapInfo->uEncounterMonster1AtLeast;
7564 v10 = rand(); 7564 v10 = rand();
7565 v11 = pMapInfo->uEncounterMonster1AtMost; 7565 v11 = pMapInfo->uEncounterMonster1AtMost;
7566 pTexture = pMapInfo->pEncounterMonster1Texture; 7566 pTexture = pMapInfo->pEncounterMonster1Texture;
7567 v12 = v10 % (v11 - v9 + 1); 7567 v12 = v10 % (v11 - v9 + 1);
7568 v13 = pMapInfo->field_34; 7568 v13 = pMapInfo->Dif_M1;
7569 goto LABEL_20; 7569 goto LABEL_20;
7570 case 3u: 7570 case 3u:
7571 pTexture = pMapInfo->pEncounterMonster1Texture; 7571 pTexture = pMapInfo->pEncounterMonster1Texture;
7572 v44 = "%s A"; 7572 v44 = "%s A";
7573 goto LABEL_25; 7573 goto LABEL_25;
7583 v9 = pMapInfo->uEncounterMonster2AtLeast; 7583 v9 = pMapInfo->uEncounterMonster2AtLeast;
7584 v14 = rand(); 7584 v14 = rand();
7585 v15 = pMapInfo->uEncounterMonster2AtMost; 7585 v15 = pMapInfo->uEncounterMonster2AtMost;
7586 pTexture = pMapInfo->pEncounterMonster2Texture; 7586 pTexture = pMapInfo->pEncounterMonster2Texture;
7587 v12 = v14 % (v15 - v9 + 1); 7587 v12 = v14 % (v15 - v9 + 1);
7588 v13 = pMapInfo->field_37; 7588 v13 = pMapInfo->Dif_M2;
7589 goto LABEL_20; 7589 goto LABEL_20;
7590 case 6u: 7590 case 6u:
7591 pTexture = pMapInfo->pEncounterMonster1Texture; 7591 pTexture = pMapInfo->pEncounterMonster1Texture;
7592 v44 = "%s B"; 7592 v44 = "%s B";
7593 goto LABEL_25; 7593 goto LABEL_25;
7603 v9 = pMapInfo->uEncounterMonster3AtLeast; 7603 v9 = pMapInfo->uEncounterMonster3AtLeast;
7604 v16 = rand(); 7604 v16 = rand();
7605 v17 = pMapInfo->uEncounterMonster3AtMost; 7605 v17 = pMapInfo->uEncounterMonster3AtMost;
7606 pTexture = pMapInfo->pEncounterMonster3Texture; 7606 pTexture = pMapInfo->pEncounterMonster3Texture;
7607 v12 = v16 % (v17 - v9 + 1); 7607 v12 = v16 % (v17 - v9 + 1);
7608 v13 = pMapInfo->field_3A; 7608 v13 = pMapInfo->Dif_M3;
7609 LABEL_20: 7609 LABEL_20:
7610 v57 = v13; 7610 v57 = v13;
7611 v56 = v9 + v12; 7611 v56 = v9 + v12;
7612 strcpy(Source, pTexture); 7612 strcpy(Source, pTexture);
7613 goto LABEL_26; 7613 goto LABEL_26;
7934 v2 = a1; 7934 v2 = a1;
7935 v3 = a2; 7935 v3 = a2;
7936 v4 = rand(); 7936 v4 = rand();
7937 v34 = 0; 7937 v34 = 0;
7938 v5 = v4 % 100; 7938 v5 = v4 % 100;
7939 v6 = 2 * (v2->field_2F + 7 * v3->uIndex) - 14; 7939 v6 = 2 * (v2->Treasure_prob + 7 * v3->uIndex) - 14;
7940 v7 = (unsigned __int8)byte_4E8168[v6 + 16]; 7940 v7 = (unsigned __int8)byte_4E8168[v6 + 16];
7941 v8 = (unsigned __int8)byte_4E8168[v6 + 17]; 7941 v8 = (unsigned __int8)byte_4E8168[v6 + 17];
7942 v32 = v5; 7942 v32 = v5;
7943 v33 = v7; 7943 v33 = v7;
7944 v9 = rand(); 7944 v9 = rand();
8112 do 8112 do
8113 { 8113 {
8114 if ( (v3->uItemID & 0x80000000u) == 0 ) 8114 if ( (v3->uItemID & 0x80000000u) == 0 )
8115 goto LABEL_56; 8115 goto LABEL_56;
8116 v4 = rand() % 5 + 1; 8116 v4 = rand() % 5 + 1;
8117 v5 = (unsigned __int8)byte_4E8168[2 * (v2->field_2F + 7 * abs((int)v3->uItemID)) + 2]; 8117 v5 = (unsigned __int8)byte_4E8168[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 2];
8118 v6 = (unsigned __int8)byte_4E8168[2 * (v2->field_2F + 7 * abs((int)v3->uItemID)) + 3]; 8118 v6 = (unsigned __int8)byte_4E8168[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 3];
8119 v7 = rand(); 8119 v7 = rand();
8120 v8 = v6 - v5 + 1; 8120 v8 = v6 - v5 + 1;
8121 v9 = v5 + v7 % v8; 8121 v9 = v5 + v7 % v8;
8122 v19 = v5 + v7 % v8; 8122 v19 = v5 + v7 % v8;
8123 if ( v9 < 7 ) 8123 if ( v9 < 7 )
9243 9243
9244 9244
9245 //----- (00453F62) -------------------------------------------------------- 9245 //----- (00453F62) --------------------------------------------------------
9246 void MapStats::Initialize() 9246 void MapStats::Initialize()
9247 { 9247 {
9248 MapStats *v1; // esi@1 9248 char work_str[32]; // [sp+Ch] [bp-34h]@3
9249 unsigned int v2; // ebx@3 9249 int work_str_pos;
9250 char *v3; // eax@4 9250 int work_str_len;
9251 char *v4; // edi@4 9251 int i;
9252 char v5; // cl@5 9252 char* test_string;
9253 int v6; // eax@5 9253 unsigned char c;
9254 size_t v7; // eax@32 9254 bool break_loop;
9255 size_t v8; // eax@35 9255 unsigned int temp_str_len;
9256 size_t v9; // eax@42 9256 char* tmp_pos;
9257 size_t v10; // eax@45 9257 int decode_step;
9258 size_t v11; // eax@52 9258 int item_counter;
9259 size_t v12; // eax@55 9259
9260 char Str[32]; // [sp+Ch] [bp-34h]@30
9261 char *v14; // [sp+2Ch] [bp-14h]@9
9262 int v15; // [sp+30h] [bp-10h]@4
9263 int v16; // [sp+34h] [bp-Ch]@4
9264 unsigned int v17; // [sp+38h] [bp-8h]@30
9265 MapStats *v18; // [sp+3Ch] [bp-4h]@30
9266
9267 v1 = this;
9268 if ( pMapStatsTXT_Raw ) 9260 if ( pMapStatsTXT_Raw )
9269 pAllocator->FreeChunk(pMapStatsTXT_Raw); 9261 pAllocator->FreeChunk(pMapStatsTXT_Raw);
9270 pMapStatsTXT_Raw = 0; 9262 pMapStatsTXT_Raw = NULL;
9271 pMapStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("MapStats.txt", 0); 9263 pMapStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("MapStats.txt", 0);
9272 strtok(pMapStatsTXT_Raw, "\r"); 9264 strtok(pMapStatsTXT_Raw, "\r");
9273 strtok(0, "\r"); 9265 strtok(NULL, "\r");
9274 strtok(0, "\r"); 9266 strtok(NULL, "\r");
9275 v2 = 1; 9267
9276 v1->uNumMaps = 77; 9268 for (i=1; i<77; ++i)
9277 do 9269 {
9278 { 9270 test_string = strtok(NULL, "\r") + 1;
9279 v3 = strtok(0, "\r"); 9271 break_loop = false;
9280 v16 = 0; 9272 decode_step=0;
9281 v15 = 0; 9273 do
9282 v4 = v3; 9274 {
9283 do 9275 c = *(unsigned char*)test_string;
9284 { 9276 temp_str_len = 0;
9285 v5 = *v4; 9277 while((c!='\t')&&(c>0))
9286 v6 = 0; 9278 {
9287 while ( v5 != 9 && v5 ) 9279 ++temp_str_len;
9288 { 9280 c=test_string[temp_str_len];
9289 ++v6; 9281 }
9290 v5 = v4[v6]; 9282 tmp_pos=test_string+temp_str_len;
9291 } 9283 if (*tmp_pos == 0)
9292 v14 = &v4[v6]; 9284 break_loop = true;
9293 if ( !v4[v6] ) 9285 *tmp_pos = 0;
9294 v15 = 1; 9286 if (temp_str_len)
9295 v4[v6] = 0; 9287 {
9296 if ( v6 ) 9288 switch (decode_step)
9297 { 9289 {
9298 switch ( v16 ) 9290 case 1:
9299 { 9291 pInfos[i].pName = RemoveQuotes(test_string);
9300 case 1: 9292 break;
9301 v1->pInfos[v2].pName = (char *)RemoveQuotes(v4); 9293 case 2:
9302 break; 9294 pInfos[i].pFilename = RemoveQuotes(test_string);
9303 case 2: 9295 break;
9304 v1->pInfos[v2].pFilename = (char *)RemoveQuotes(v4); 9296 case 3:
9305 break; 9297 pInfos[i].uNumResets = atoi(test_string);
9306 case 3: 9298 break;
9307 v1->pInfos[v2].uNumResets = atoi(v4); 9299 case 4:
9308 break; 9300 pInfos[i].uFirstVisitedAt = atoi(test_string);
9309 case 4: 9301 break;
9310 v1->pInfos[v2].uFirstVisitedAt = atoi(v4); 9302 case 5:
9311 break; 9303 pInfos[i]._per = atoi(test_string);
9312 case 5: 9304 break;
9313 v1->pInfos[v2]._per = atoi(v4); 9305 case 6:
9314 break; 9306 pInfos[i].uRespawnIntervalDays = atoi(test_string);
9315 case 6: 9307 break;
9316 v1->pInfos[v2].uRespawnIntervalDays = atoi(v4); 9308 case 7:
9317 break; 9309 pInfos[i]._alert_days = atoi(test_string);
9318 case 7: 9310 break;
9319 v1->pInfos[v2]._alert_days = atoi(v4); 9311 case 8:
9320 break; 9312 pInfos[i]._steal_perm = atoi(test_string);
9321 case 8: 9313 break;
9322 v1->pInfos[v2]._steal_perm = atoi(v4); 9314 case 9:
9323 break; 9315 pInfos[i].LockX5 = atoi(test_string);
9324 case 9: 9316 break;
9325 v1->pInfos[v2].field_2D = atoi(v4); 9317 case 10:
9326 break; 9318 pInfos[i].Trap_D20 = atoi(test_string);
9327 case 10: 9319 break;
9328 v1->pInfos[v2].field_2E = atoi(v4); 9320 case 11:
9329 break; 9321 pInfos[i].Treasure_prob = atoi(test_string);
9330 case 11: 9322 break;
9331 v1->pInfos[v2].field_2F = atoi(v4); 9323 case 12:
9332 break; 9324 pInfos[i].Encounter_percent = atoi(test_string);
9333 case 12: 9325 break;
9334 v1->pInfos[v2].field_30 = atoi(v4); 9326 case 13:
9335 break; 9327 pInfos[i].EncM1percent = atoi(test_string);
9336 case 13: 9328 break;
9337 v1->pInfos[v2].field_31 = atoi(v4); 9329 case 14:
9338 break; 9330 pInfos[i].EncM2percent = atoi(test_string);
9339 case 14: 9331 break;
9340 v1->pInfos[v2].field_32 = atoi(v4); 9332 case 15:
9341 break; 9333 pInfos[i].EncM3percent = atoi(test_string);
9342 case 15: 9334 break;
9343 v1->pInfos[v2].field_33 = atoi(v4); 9335 case 16:
9344 break; 9336 pInfos[i].pEncounterMonster1Texture = RemoveQuotes(test_string);
9345 case 16: 9337 break;
9346 v1->pInfos[v2].pEncounterMonster1Texture = (char *)RemoveQuotes(v4); 9338 case 18:
9347 break; 9339 pInfos[i].Dif_M1 = atoi(test_string);
9348 case 18: 9340 break;
9349 v1->pInfos[v2].field_34 = atoi(v4); 9341 case 19:
9350 break; 9342 pInfos[i].uEncounterMonster1AtLeast = 1;
9351 case 19: 9343 pInfos[i].uEncounterMonster1AtMost = 1;
9352 v18 = (MapStats *)((char *)v1 + 68 * v2); 9344 strcpy(work_str, test_string);
9353 v18->pInfos[0].uEncounterMonster1AtLeast = 1; 9345 work_str_pos = 0;
9354 strcpy(Str, v4); 9346 work_str_len=strlen(work_str);
9355 v17 = 0; 9347 if (work_str_len )
9356 if ( strlen(Str) ) 9348 {
9357 { 9349 while (work_str[work_str_pos] != '-' )
9358 while ( Str[v17] != 45 ) 9350 {
9359 { 9351 ++work_str_pos;
9360 ++v17; 9352 if (work_str_pos >= work_str_len )
9361 v7 = strlen(Str); 9353 break;
9362 if ( v17 >= v7 ) 9354 }
9363 goto LABEL_35; 9355 work_str[work_str_pos] = 0;
9364 } 9356 pInfos[i].uEncounterMonster1AtLeast = atoi(work_str);
9365 Str[v17] = 0; 9357 if ( work_str_pos < work_str_len )
9366 v18->pInfos[0].uEncounterMonster1AtLeast = atoi(Str); 9358 pInfos[i].uEncounterMonster1AtMost = atoi(&work_str[work_str_pos + 1]);
9367 } 9359 else
9368 LABEL_35: 9360 pInfos[i].uEncounterMonster1AtMost = pInfos[i].uEncounterMonster1AtLeast;
9369 v8 = strlen(Str); 9361 }
9370 if ( v17 == v8 ) 9362 break;
9371 v18->pInfos[0].uEncounterMonster1AtMost = atoi(&v4[v17 + 1]); 9363 case 20:
9372 else 9364 pInfos[i].pEncounterMonster2Texture = RemoveQuotes(test_string);
9373 v18->pInfos[0].uEncounterMonster1AtMost = v18->pInfos[0].uEncounterMonster1AtLeast; 9365 break;
9374 break; 9366 case 22:
9375 case 20: 9367 pInfos[i].Dif_M2 = atoi(test_string);
9376 v1->pInfos[v2].pEncounterMonster2Texture = (char *)RemoveQuotes(v4); 9368 break;
9377 break; 9369 case 23:
9378 case 22: 9370 pInfos[i].uEncounterMonster2AtLeast = 1;
9379 v1->pInfos[v2].field_37 = atoi(v4); 9371 pInfos[i].uEncounterMonster2AtMost = 1;
9380 break; 9372 strcpy(work_str, test_string);
9381 case 23: 9373 work_str_pos = 0;
9382 v18 = (MapStats *)((char *)v1 + 68 * v2); 9374 work_str_len=strlen(work_str);
9383 v18->pInfos[0].uEncounterMonster2AtLeast = 1; 9375 if (work_str_len )
9384 strcpy(Str, v4); 9376 {
9385 v17 = 0; 9377 while (work_str[work_str_pos] != '-' )
9386 if ( strlen(Str) ) 9378 {
9387 { 9379 ++work_str_pos;
9388 while ( Str[v17] != 45 ) 9380 if (work_str_pos >= work_str_len )
9389 { 9381 break;
9390 ++v17; 9382 }
9391 v9 = strlen(Str); 9383 work_str[work_str_pos] = 0;
9392 if ( v17 >= v9 ) 9384 pInfos[i].uEncounterMonster2AtLeast = atoi(work_str);
9393 goto LABEL_45; 9385 if ( work_str_pos < work_str_len )
9394 } 9386 pInfos[i].uEncounterMonster2AtMost = atoi(&work_str[work_str_pos + 1]);
9395 Str[v17] = 0; 9387 else
9396 v18->pInfos[0].uEncounterMonster2AtLeast = atoi(Str); 9388 pInfos[i].uEncounterMonster2AtMost = pInfos[i].uEncounterMonster2AtLeast;
9397 } 9389 }
9398 LABEL_45: 9390 break;
9399 v10 = strlen(Str); 9391 case 24:
9400 if ( v17 == v10 ) 9392 pInfos[i].pEncounterMonster3Texture = RemoveQuotes(test_string);
9401 v18->pInfos[0].uEncounterMonster2AtMost = atoi(&v4[v17 + 1]); 9393 break;
9402 else 9394 case 26:
9403 v18->pInfos[0].uEncounterMonster2AtMost = v18->pInfos[0].uEncounterMonster2AtLeast; 9395 pInfos[i].Dif_M3 = atoi(test_string);
9404 break; 9396 break;
9405 case 24: 9397 case 27:
9406 v1->pInfos[v2].pEncounterMonster3Texture = (char *)RemoveQuotes(v4); 9398 pInfos[i].uEncounterMonster3AtLeast = 1;
9407 break; 9399 pInfos[i].uEncounterMonster3AtMost = 1;
9408 case 26: 9400 strcpy(work_str, test_string);
9409 v1->pInfos[v2].field_3A = atoi(v4); 9401 work_str_pos = 0;
9410 break; 9402 work_str_len=strlen(work_str);
9411 case 27: 9403 if (work_str_len )
9412 v18 = (MapStats *)((char *)v1 + 68 * v2); 9404 {
9413 v18->pInfos[0].uEncounterMonster3AtLeast = 1; 9405 while (work_str[work_str_pos] != '-' )
9414 strcpy(Str, v4); 9406 {
9415 v17 = 0; 9407 ++work_str_pos;
9416 if ( strlen(Str) ) 9408 if (work_str_pos >= work_str_len )
9417 { 9409 break;
9418 while ( Str[v17] != 45 ) 9410 }
9419 { 9411 work_str[work_str_pos] = 0;
9420 ++v17; 9412 pInfos[i].uEncounterMonster3AtLeast = atoi(work_str);
9421 v11 = strlen(Str); 9413 if ( work_str_pos < work_str_len )
9422 if ( v17 >= v11 ) 9414 pInfos[i].uEncounterMonster3AtMost = atoi(&work_str[work_str_pos + 1]);
9423 goto LABEL_55; 9415 else
9424 } 9416 pInfos[i].uEncounterMonster3AtMost = pInfos[i].uEncounterMonster3AtLeast;
9425 Str[v17] = 0; 9417 }
9426 v18->pInfos[0].uEncounterMonster3AtLeast = atoi(Str); 9418 break;
9427 } 9419 case 28:
9428 LABEL_55: 9420 pInfos[i].uRedbookTrackID = atoi(test_string);
9429 v12 = strlen(Str); 9421 break;
9430 if ( v17 == v12 ) 9422 case 29:
9431 v18->pInfos[0].uEncounterMonster3AtMost = atoi(&v4[v17 + 1]); 9423 {
9432 else 9424 if ( !strcmp(test_string, "CAVE") )
9433 v18->pInfos[0].uEncounterMonster3AtMost = v18->pInfos[0].uEncounterMonster3AtLeast; 9425 {
9434 break; 9426 pInfos[i].uEAXEnv = 8;
9435 case 28: 9427 break;
9436 v1->pInfos[v2].uRedbookTrackID = atoi(v4); 9428 }
9437 break; 9429 if ( !strcmp(test_string, "STONEROOM") )
9438 case 29: 9430 {
9439 if ( strcmp(v4, "GENERIC") ) 9431 pInfos[i].uEAXEnv = 5;
9440 { 9432 break;
9441 if ( strcmp(v4, "PADDEDCELL") ) 9433 }
9442 { 9434 if ( !strcmp(test_string, "MOUNTAINS") )
9443 if ( strcmp(v4, "ROOM") ) 9435 {
9444 { 9436 pInfos[i].uEAXEnv = 17;
9445 if ( strcmp(v4, "BATHROOM") ) 9437 break;
9446 { 9438 }
9447 if ( strcmp(v4, "LIVINGROOM") ) 9439 if ( !strcmp(test_string, "PLAIN") )
9448 { 9440 {
9449 if ( strcmp(v4, "STONEROOM") ) 9441 pInfos[i].uEAXEnv = 19;
9450 { 9442 break;
9451 if ( strcmp(v4, "AUDITORIUM") ) 9443 }
9452 { 9444 if ( !strcmp(test_string, "FOREST") )
9453 if ( strcmp(v4, "CONCERTHALL") ) 9445 {
9454 { 9446 pInfos[i].uEAXEnv = 15;
9455 if ( strcmp(v4, "CAVE") ) 9447 break;
9456 { 9448 }
9457 if ( strcmp(v4, "ARENA") ) 9449 if ( !strcmp(test_string, "CITY") )
9458 { 9450 {
9459 if ( strcmp(v4, "HANGAR") ) 9451 pInfos[i].uEAXEnv = 16;
9460 { 9452 break;
9461 if ( strcmp(v4, "CARPETEDHALLWAY") ) 9453 }
9462 { 9454 if ( !strcmp(test_string, "UNDERWATER") )
9463 if ( strcmp(v4, "HALLWAY") ) 9455 {
9464 { 9456 pInfos[i].uEAXEnv = 22;
9465 if ( strcmp(v4, "STONECORRIDOR") ) 9457 break;
9466 { 9458 }
9467 if ( strcmp(v4, "ALLEY") ) 9459 if ( !strcmp(test_string, "ARENA") )
9468 { 9460 {
9469 if ( strcmp(v4, "FOREST") ) 9461 pInfos[i].uEAXEnv = 9;
9470 { 9462 break;
9471 if ( strcmp(v4, "CITY") ) 9463 }
9472 { 9464 if ( !strcmp(test_string, "GENERIC") )
9473 if ( strcmp(v4, "MOUNTAINS") ) 9465 {
9474 { 9466 pInfos[i].uEAXEnv = 0;
9475 if ( strcmp(v4, "QUARRY") ) 9467 break;
9476 { 9468 }
9477 if ( strcmp(v4, "PLAIN") ) 9469 if ( !strcmp(test_string, "PADDEDCELL") )
9478 { 9470 {
9479 if ( strcmp(v4, "PARKINGLOT") ) 9471 pInfos[i].uEAXEnv = 1;
9480 { 9472 break;
9481 if ( strcmp(v4, "SEWERPIPE") ) 9473 }
9482 { 9474 if ( !strcmp(test_string, "ROOM") )
9483 if ( strcmp(v4, "UNDERWATER") ) 9475 {
9484 { 9476 pInfos[i].uEAXEnv = 2;
9485 if ( strcmp(v4, "DRUGGED") ) 9477 break;
9486 { 9478 }
9487 if ( strcmp(v4, "DIZZY") ) 9479 if ( !strcmp(test_string, "BATHROOM") )
9488 { 9480 {
9489 if ( strcmp(v4, "PSYCHOTIC") ) 9481 pInfos[i].uEAXEnv = 3;
9490 v1->pInfos[v2].uEAXEnv = 26; 9482 break;
9491 else 9483 }
9492 v1->pInfos[v2].uEAXEnv = 25; 9484 if ( !strcmp(test_string, "LIVINGROOM") )
9493 } 9485 {
9494 else 9486 pInfos[i].uEAXEnv = 4;
9495 { 9487 break;
9496 v1->pInfos[v2].uEAXEnv = 24; 9488 }
9497 } 9489 if ( !strcmp(test_string, "AUDITORIUM") )
9498 } 9490 {
9499 else 9491 pInfos[i].uEAXEnv = 6;
9500 { 9492 break;
9501 v1->pInfos[v2].uEAXEnv = 23; 9493 }
9502 } 9494 if ( !strcmp(test_string, "CONCERTHALL") )
9503 } 9495 {
9504 else 9496 pInfos[i].uEAXEnv = 7;
9505 { 9497 break;
9506 v1->pInfos[v2].uEAXEnv = 22; 9498 }
9507 } 9499 if ( !strcmp(test_string, "HANGAR") )
9508 } 9500 {
9509 else 9501 pInfos[i].uEAXEnv = 10;
9510 { 9502 break;
9511 v1->pInfos[v2].uEAXEnv = 21; 9503 }
9512 } 9504 if ( !strcmp(test_string, "CARPETEDHALLWAY") )
9513 } 9505 {
9514 else 9506 pInfos[i].uEAXEnv = 11;
9515 { 9507 break;
9516 v1->pInfos[v2].uEAXEnv = 20; 9508 }
9517 } 9509 if ( !strcmp(test_string, "HALLWAY") )
9518 } 9510 {
9519 else 9511 pInfos[i].uEAXEnv = 12;
9520 { 9512 break;
9521 v1->pInfos[v2].uEAXEnv = 19; 9513 }
9522 } 9514 if ( !strcmp(test_string, "STONECORRIDOR") )
9523 } 9515 {
9524 else 9516 pInfos[i].uEAXEnv = 13;
9525 { 9517 break;
9526 v1->pInfos[v2].uEAXEnv = 18; 9518 }
9527 } 9519 if ( !strcmp(test_string, "ALLEY") )
9528 } 9520 {
9529 else 9521 pInfos[i].uEAXEnv = 14;
9530 { 9522 break;
9531 v1->pInfos[v2].uEAXEnv = 17; 9523 }
9532 } 9524 if ( !strcmp(test_string, "QUARRY") )
9533 } 9525 {
9534 else 9526 pInfos[i].uEAXEnv = 18;
9535 { 9527 break;
9536 v1->pInfos[v2].uEAXEnv = 16; 9528 }
9537 } 9529 if ( !strcmp(test_string, "PARKINGLOT") )
9538 } 9530 {
9539 else 9531 pInfos[i].uEAXEnv = 20;
9540 { 9532 break;
9541 v1->pInfos[v2].uEAXEnv = 15; 9533 }
9542 } 9534 if ( !strcmp(test_string, "SEWERPIPE") )
9543 } 9535 {
9544 else 9536 pInfos[i].uEAXEnv = 21;
9545 { 9537 break;
9546 v1->pInfos[v2].uEAXEnv = 14; 9538 }
9547 } 9539 if ( !strcmp(test_string, "DRUGGED") )
9548 } 9540 {
9549 else 9541 pInfos[i].uEAXEnv = 23;
9550 { 9542 break;
9551 v1->pInfos[v2].uEAXEnv = 13; 9543 }
9552 } 9544 if ( !strcmp(test_string, "DIZZY") )
9553 } 9545 {
9554 else 9546 pInfos[i].uEAXEnv = 24;
9555 { 9547 break;
9556 v1->pInfos[v2].uEAXEnv = 12; 9548 }
9557 } 9549 if ( !strcmp(test_string, "PSYCHOTIC") )
9558 } 9550 {
9559 else 9551 pInfos[i].uEAXEnv = 25;
9560 { 9552 break;
9561 v1->pInfos[v2].uEAXEnv = 11; 9553 }
9562 } 9554 pInfos[i].uEAXEnv = 26;
9563 } 9555
9564 else 9556 }
9565 { 9557 break;
9566 v1->pInfos[v2].uEAXEnv = 10; 9558 }
9567 } 9559 }
9568 } 9560 else
9569 else 9561 {
9570 { 9562 break_loop = true;
9571 v1->pInfos[v2].uEAXEnv = 9; 9563 }
9572 } 9564 ++decode_step;
9573 } 9565 test_string=tmp_pos+1;
9574 else 9566 } while ((decode_step<31)&&!break_loop);
9575 { 9567 }
9576 v1->pInfos[v2].uEAXEnv = 8; 9568
9577 } 9569 uNumMaps = 77;
9578 }
9579 else
9580 {
9581 v1->pInfos[v2].uEAXEnv = 7;
9582 }
9583 }
9584 else
9585 {
9586 v1->pInfos[v2].uEAXEnv = 6;
9587 }
9588 }
9589 else
9590 {
9591 v1->pInfos[v2].uEAXEnv = 5;
9592 }
9593 }
9594 else
9595 {
9596 v1->pInfos[v2].uEAXEnv = 4;
9597 }
9598 }
9599 else
9600 {
9601 v1->pInfos[v2].uEAXEnv = 3;
9602 }
9603 }
9604 else
9605 {
9606 v1->pInfos[v2].uEAXEnv = 2;
9607 }
9608 }
9609 else
9610 {
9611 v1->pInfos[v2].uEAXEnv = 1;
9612 }
9613 }
9614 else
9615 {
9616 v1->pInfos[v2].uEAXEnv = 0;
9617 }
9618 break;
9619 default:
9620 break;
9621 }
9622 }
9623 else
9624 {
9625 v15 = 1;
9626 }
9627 ++v16;
9628 v4 = v14 + 1;
9629 }
9630 while ( v16 - 1 <= 29 && !v15 );
9631 ++v2;
9632 }
9633 while ( (signed int)v2 < 77 );
9634 v1->uNumMaps = v2;
9635 } 9570 }
9636 // 453F62: using guessed type char Str[32]; 9571 // 453F62: using guessed type char Str[32];
9637 9572
9638 9573
9639 9574
9671 } 9606 }
9672 9607
9673 //----- (004547E4) -------------------------------------------------------- 9608 //----- (004547E4) --------------------------------------------------------
9674 void FactionTable::Initialize() 9609 void FactionTable::Initialize()
9675 { 9610 {
9676 char *v1; // ebx@1 9611 int i;
9677 char *v2; // eax@4 9612 char* test_string;
9678 signed int v3; // edi@4 9613 unsigned char c;
9679 int v4; // ebp@4 9614 bool break_loop;
9680 char v5; // dl@5 9615 unsigned int temp_str_len;
9681 char *v6; // ecx@5 9616 char* tmp_pos;
9682 int v7; // esi@9 9617 int decode_step;
9683 signed int v8; // [sp+4h] [bp-Ch]@3 9618 int item_counter;
9684 signed int v9; // [sp+8h] [bp-8h]@4 9619
9685 char *v10; // [sp+Ch] [bp-4h]@1
9686
9687 v1 = 0;
9688 v10 = (char *)relations;
9689 if ( pHostileTXT_Raw ) 9620 if ( pHostileTXT_Raw )
9690 pAllocator->FreeChunk(pHostileTXT_Raw); 9621 pAllocator->FreeChunk(pHostileTXT_Raw);
9691 pHostileTXT_Raw = 0; 9622 pHostileTXT_Raw = NULL;
9692 pHostileTXT_Raw = (char *)pEvents_LOD->LoadRaw("hostile.txt", 0); 9623 pHostileTXT_Raw = (char *)pEvents_LOD->LoadRaw("hostile.txt", 0);
9693 strtok(pHostileTXT_Raw, "\r"); 9624 strtok(pHostileTXT_Raw, "\r");
9694 v8 = 0; 9625 for (i=0; i<89; ++i)
9695 do 9626 {
9696 { 9627 test_string = strtok(NULL, "\r") + 1;
9697 v2 = strtok(v1, "\r") + 1; 9628 break_loop = false;
9698 v3 = 0; 9629 decode_step=0;
9699 v9 = (signed int)v1; 9630 do
9700 v4 = (int)&v10[v8-89]; 9631 {
9701 do 9632 c = *(unsigned char*)test_string;
9702 { 9633 temp_str_len = 0;
9703 v5 = *v2; 9634 while((c!='\t')&&(c>0))
9704 v6 = 0; 9635 {
9705 if ( *v2 != 9 ) 9636 ++temp_str_len;
9706 { 9637 c=test_string[temp_str_len];
9707 v1 = 0; 9638 }
9708 do 9639 tmp_pos=test_string+temp_str_len;
9709 { 9640 if (*tmp_pos == 0)
9710 if ( !v5 ) 9641 break_loop = true;
9711 break; 9642 *tmp_pos = 0;
9712 ++v6; 9643 if (temp_str_len)
9713 v5 = v2[(int)v6]; 9644 {
9714 } 9645 if ( decode_step >= 1 && decode_step < 90 )
9715 while ( v5 != 9 ); 9646 relations[decode_step-1][i] = atoi(test_string);
9716 } 9647 }
9717 v7 = (int)&v2[(int)v6]; 9648 else
9718 if ( v2[(int)v6] == (char)v1 ) 9649 {
9719 v9 = 1; 9650 break_loop = true;
9720 *(char *)v7 = (char)v1; 9651 }
9721 if ( v6 == v1 ) 9652 ++decode_step;
9722 { 9653 test_string=tmp_pos+1;
9723 v9 = 1; 9654 } while ((decode_step<92)&&!break_loop);
9724 } 9655 }
9725 else 9656 if ( pHostileTXT_Raw)
9726 {
9727 if ( v3 >= 1 && v3 <= 90 )
9728 *(char *)v4 = atoi(v2);
9729 }
9730 ++v3;
9731 v4 += 89;
9732 v2 = (char *)(v7 + 1);
9733 }
9734 while ( v3 - 1 <= 90 && (char *)v9 == v1 );
9735 ++v8;
9736 }
9737 while ( v8 < 89 );
9738
9739 if ( pHostileTXT_Raw != v1 )
9740 { 9657 {
9741 pAllocator->FreeChunk(pHostileTXT_Raw); 9658 pAllocator->FreeChunk(pHostileTXT_Raw);
9742 pHostileTXT_Raw = v1; 9659 pHostileTXT_Raw = NULL;
9743 } 9660 }
9744 } 9661 }
9745 9662
9746 //----- (004548E2) -------------------------------------------------------- 9663 //----- (004548E2) --------------------------------------------------------
9747 unsigned int __fastcall ParseSpellType(FrameTableTxtLine *a1, int a2) 9664 unsigned int __fastcall ParseSpellType(FrameTableTxtLine *a1, int a2)