Mercurial > mm7
changeset 237:2799737f8a74
more text parsers refactor
author | Gloval |
---|---|
date | Mon, 18 Feb 2013 00:47:36 +0400 |
parents | 47e06334c564 |
children | b070b83a897b |
files | LayingItem.cpp MapInfo.h Monsters.cpp Monsters.h NPC.h StorylineTextTable.cpp mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_5.cpp mm7_data.h |
diffstat | 11 files changed, 1127 insertions(+), 1440 deletions(-) [+] |
line wrap: on
line diff
--- a/LayingItem.cpp Sun Feb 17 18:50:35 2013 +0400 +++ b/LayingItem.cpp Mon Feb 18 00:47:36 2013 +0400 @@ -64,14 +64,14 @@ { v17 = 0; v11 = 5; - if ( pMapInfo->field_2E ) + if ( pMapInfo->Trap_D20 ) { do { ++v17; v11 += rand() % 20 + 1; } - while ( v17 < pMapInfo->field_2E ); + while ( v17 < pMapInfo->Trap_D20 ); } switch ( v1->uItemType ) {
--- a/MapInfo.h Sun Feb 17 18:50:35 2013 +0400 +++ b/MapInfo.h Mon Feb 18 00:47:36 2013 +0400 @@ -20,20 +20,20 @@ int _steal_perm; int _per; char field_2C; - char field_2D; - char field_2E; - char field_2F; - char field_30; - char field_31; - char field_32; - char field_33; - char field_34; + char LockX5; + char Trap_D20; + char Treasure_prob; + char Encounter_percent; + char EncM1percent; + char EncM2percent; + char EncM3percent; + char Dif_M1; unsigned __int8 uEncounterMonster1AtLeast; unsigned __int8 uEncounterMonster1AtMost; - char field_37; + char Dif_M2; unsigned __int8 uEncounterMonster2AtLeast; unsigned __int8 uEncounterMonster2AtMost; - char field_3A; + char Dif_M3; unsigned __int8 uEncounterMonster3AtLeast; unsigned __int8 uEncounterMonster3AtMost; char field_3D;
--- a/Monsters.cpp Sun Feb 17 18:50:35 2013 +0400 +++ b/Monsters.cpp Mon Feb 18 00:47:36 2013 +0400 @@ -215,67 +215,49 @@ //----- (00454F4E) -------------------------------------------------------- void MonsterStats::InitializePlacements() { - char *v1; // ebx@1 - MonsterStats *v2; // edi@1 - char *v3; // eax@2 - char v4; // dl@3 - char *v5; // ecx@3 - int v6; // esi@7 - signed int v7; // [sp+Ch] [bp-10h]@1 - char **v8; // [sp+10h] [bp-Ch]@1 - signed int v9; // [sp+14h] [bp-8h]@2 - char *v10; // [sp+18h] [bp-4h]@2 + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; - v1 = 0; - v2 = this; pMonsterPlacementTXT_Raw = (char *)pEvents_LOD->LoadRaw("placemon.txt", 0); strtok(pMonsterPlacementTXT_Raw, "\r"); - v2->uNumPlacements = 31; - v8 = v2->pPlacement.pSubstrings; - v7 = 30; - do - { - v3 = strtok(v1, "\r") + 1; - v10 = v1; - v9 = (signed int)v1; - do - { - v4 = *v3; - v5 = 0; - if ( *v3 != 9 ) - { - v1 = 0; - do - { - if ( !v4 ) - break; - ++v5; - v4 = v3[(unsigned int)v5]; - } - while ( v4 != 9 ); - } - v6 = (int)&v3[(unsigned int)v5]; - if ( v3[(unsigned int)v5] == (unsigned char)v1 ) - v9 = 1; - *(unsigned char *)v6 = (unsigned char)v1; - if ( v5 == v1 ) - { - v9 = 1; - } - else - { - if ( v10 == (char *)1 ) - *v8 = (char *)RemoveQuotes(v3); - } - ++v10; - v3 = (char *)(v6 + 1); - } - while ( (signed int)(v10 - 1) <= 31 && (char *)v9 == v1 ); - ++v8; - --v7; - } - while ( v7 ); - v2->uNumPlacements = 31; + for (i=1; i<31; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + if (decode_step==1) + pPlaceStrings[i]=RemoveQuotes(test_string); + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<3)&&!break_loop); + } + uNumPlacements = 31; } //----- (0045501E) --------------------------------------------------------
--- a/Monsters.h Sun Feb 17 18:50:35 2013 +0400 +++ b/Monsters.h Mon Feb 18 00:47:36 2013 +0400 @@ -141,15 +141,8 @@ }; #pragma pack(pop) -/* 188 */ -#pragma pack(push, 1) -struct MonsterPlacement -{ - unsigned int uNumStrings; - char *pSubstrings[30]; -}; -#pragma pack(pop) + /* 189 */ #pragma pack(push, 1) struct MonsterStats @@ -160,10 +153,10 @@ static bool BelongsToSupertype(unsigned int uMonsterInfoID, enum MONSTER_SUPERTYPE eSupertype); - MonsterInfo pInfos[265]; - MonsterPlacement pPlacement; - unsigned int uNumMonsters; - unsigned int uNumPlacements; + MonsterInfo pInfos[265]; //0 - 5b18h + char *pPlaceStrings[31];; //5B18h placement counts from 1 + unsigned int uNumMonsters; //5B94h + unsigned int uNumPlacements; //5B98h int field_5B9C; }; #pragma pack(pop)
--- a/NPC.h Sun Feb 17 18:50:35 2013 +0400 +++ b/NPC.h Mon Feb 18 00:47:36 2013 +0400 @@ -57,8 +57,8 @@ #pragma pack(push, 1) struct NPCStats_stru0 { - int field_0; - char field_4[60]; + int field_0; //summ + char field_4[60]; //prof position }; #pragma pack(pop) @@ -90,7 +90,7 @@ bool InitializeAdditionalNPCs(NPCData *a2, int a3, int a4, int a5); void _476C60(); - + NPCData pNPCData[501]; NPCData pNewNPCData[501]; char *pNPCNames[540][2]; @@ -103,7 +103,7 @@ NPCData array_13EF4[100]; char *pCatchPhrases[52]; char *pNPCNames2[500]; - NPCStats_stru0 array_16544[77]; + NPCStats_stru0 array_16544[77]; //16544h proffesion position in area int field_17884; int field_17888; NPCGreeting pNPCGreetings[205];
--- a/StorylineTextTable.cpp Sun Feb 17 18:50:35 2013 +0400 +++ b/StorylineTextTable.cpp Mon Feb 18 00:47:36 2013 +0400 @@ -11,33 +11,23 @@ //----- (00453E6D) -------------------------------------------------------- void StorylineText::Initialize() -{ - char *v1; // ebx@1 - StorylineText *v2; // esi@1 - char *v3; // ecx@4 - char v4; // dl@5 - char *v5; // eax@5 - int v6; // esi@9 - int v7; // [sp+Ch] [bp-10h]@3 - int v8; // [sp+10h] [bp-Ch]@4 - char *v9; // [sp+14h] [bp-8h]@4 - int Str; // [sp+18h] [bp-4h]@3 - int i,j; + { + + int i; char* test_string; unsigned char c; bool break_loop; unsigned int temp_str_len; char* tmp_pos; int decode_step; - v1 = 0; - v2 = this; - if ( pHistoryTXT_Raw ) - pAllocator->FreeChunk(pHistoryTXT_Raw); - pHistoryTXT_Raw = NULL; - pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0); - strtok(pHistoryTXT_Raw, "\r"); - for (i=0;i<29;++i) + if ( pHistoryTXT_Raw ) + pAllocator->FreeChunk(pHistoryTXT_Raw); + pHistoryTXT_Raw = NULL; + pHistoryTXT_Raw = (char *)pEvents_LOD->LoadRaw("history.txt", 0); + strtok(pHistoryTXT_Raw, "\r"); + + for (i=0;i<29;++i) { test_string = strtok(NULL, "\r") + 1; break_loop = false; @@ -72,10 +62,10 @@ } else { - break_loop = true; + break_loop = true; } ++decode_step; test_string=tmp_pos+1; } while ((decode_step<4)&&!break_loop); } -} \ No newline at end of file + } \ No newline at end of file
--- a/mm7_1.cpp Sun Feb 17 18:50:35 2013 +0400 +++ b/mm7_1.cpp Mon Feb 18 00:47:36 2013 +0400 @@ -3186,7 +3186,7 @@ v38 = v121->dword_000334_unique_name; v77 = 2000; if ( v38 ) - v72 = (char *)*(&pMonsterStats->pPlacement.uNumStrings + v38); + v72 = pMonsterStats->pPlaceStrings[v38]; else v72 = pMonsterStats->pInfos[v121->pMonsterInfo.uID].pName; } @@ -4392,7 +4392,7 @@ v2 = pMapStats->GetMapInfo(pCurrentMapName); if ( !(*v1 & 1) || !v2 ) goto LABEL_12; - if ( pPlayers[uActiveCharacter]->GetDisarmTrap() < 2 * pMapStats->pInfos[v2].field_2D ) + if ( pPlayers[uActiveCharacter]->GetDisarmTrap() < 2 * pMapStats->pInfos[v2].LockX5 ) { v29 = 811; v30 = 812; @@ -5184,7 +5184,7 @@ v28 = pTmpBuf; v29 = pActor->dword_000334_unique_name; if ( v29 ) - v40 = (char *)*(&pMonsterStats->pPlacement.uNumStrings + v29); + v40 = pMonsterStats->pPlaceStrings[v29]; else v40 = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].pName; strncpy(pTmpBuf, v40, 0x7D0u);
--- a/mm7_2.cpp Sun Feb 17 18:50:35 2013 +0400 +++ b/mm7_2.cpp Mon Feb 18 00:47:36 2013 +0400 @@ -7565,7 +7565,7 @@ v11 = pMapInfo->uEncounterMonster1AtMost; pTexture = pMapInfo->pEncounterMonster1Texture; v12 = v10 % (v11 - v9 + 1); - v13 = pMapInfo->field_34; + v13 = pMapInfo->Dif_M1; goto LABEL_20; case 3u: pTexture = pMapInfo->pEncounterMonster1Texture; @@ -7585,7 +7585,7 @@ v15 = pMapInfo->uEncounterMonster2AtMost; pTexture = pMapInfo->pEncounterMonster2Texture; v12 = v14 % (v15 - v9 + 1); - v13 = pMapInfo->field_37; + v13 = pMapInfo->Dif_M2; goto LABEL_20; case 6u: pTexture = pMapInfo->pEncounterMonster1Texture; @@ -7605,7 +7605,7 @@ v17 = pMapInfo->uEncounterMonster3AtMost; pTexture = pMapInfo->pEncounterMonster3Texture; v12 = v16 % (v17 - v9 + 1); - v13 = pMapInfo->field_3A; + v13 = pMapInfo->Dif_M3; LABEL_20: v57 = v13; v56 = v9 + v12; @@ -7936,7 +7936,7 @@ v4 = rand(); v34 = 0; v5 = v4 % 100; - v6 = 2 * (v2->field_2F + 7 * v3->uIndex) - 14; + v6 = 2 * (v2->Treasure_prob + 7 * v3->uIndex) - 14; v7 = (unsigned __int8)byte_4E8168[v6 + 16]; v8 = (unsigned __int8)byte_4E8168[v6 + 17]; v32 = v5; @@ -8114,8 +8114,8 @@ if ( (v3->uItemID & 0x80000000u) == 0 ) goto LABEL_56; v4 = rand() % 5 + 1; - v5 = (unsigned __int8)byte_4E8168[2 * (v2->field_2F + 7 * abs((int)v3->uItemID)) + 2]; - v6 = (unsigned __int8)byte_4E8168[2 * (v2->field_2F + 7 * abs((int)v3->uItemID)) + 3]; + v5 = (unsigned __int8)byte_4E8168[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 2]; + v6 = (unsigned __int8)byte_4E8168[2 * (v2->Treasure_prob + 7 * abs((int)v3->uItemID)) + 3]; v7 = rand(); v8 = v6 - v5 + 1; v9 = v5 + v7 % v8; @@ -9245,393 +9245,328 @@ //----- (00453F62) -------------------------------------------------------- void MapStats::Initialize() { - MapStats *v1; // esi@1 - unsigned int v2; // ebx@3 - char *v3; // eax@4 - char *v4; // edi@4 - char v5; // cl@5 - int v6; // eax@5 - size_t v7; // eax@32 - size_t v8; // eax@35 - size_t v9; // eax@42 - size_t v10; // eax@45 - size_t v11; // eax@52 - size_t v12; // eax@55 - char Str[32]; // [sp+Ch] [bp-34h]@30 - char *v14; // [sp+2Ch] [bp-14h]@9 - int v15; // [sp+30h] [bp-10h]@4 - int v16; // [sp+34h] [bp-Ch]@4 - unsigned int v17; // [sp+38h] [bp-8h]@30 - MapStats *v18; // [sp+3Ch] [bp-4h]@30 - - v1 = this; + char work_str[32]; // [sp+Ch] [bp-34h]@3 + int work_str_pos; + int work_str_len; + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; + if ( pMapStatsTXT_Raw ) pAllocator->FreeChunk(pMapStatsTXT_Raw); - pMapStatsTXT_Raw = 0; + pMapStatsTXT_Raw = NULL; pMapStatsTXT_Raw = (char *)pEvents_LOD->LoadRaw("MapStats.txt", 0); strtok(pMapStatsTXT_Raw, "\r"); - strtok(0, "\r"); - strtok(0, "\r"); - v2 = 1; - v1->uNumMaps = 77; - do - { - v3 = strtok(0, "\r"); - v16 = 0; - v15 = 0; - v4 = v3; - do - { - v5 = *v4; - v6 = 0; - while ( v5 != 9 && v5 ) - { - ++v6; - v5 = v4[v6]; - } - v14 = &v4[v6]; - if ( !v4[v6] ) - v15 = 1; - v4[v6] = 0; - if ( v6 ) - { - switch ( v16 ) - { - case 1: - v1->pInfos[v2].pName = (char *)RemoveQuotes(v4); - break; - case 2: - v1->pInfos[v2].pFilename = (char *)RemoveQuotes(v4); - break; - case 3: - v1->pInfos[v2].uNumResets = atoi(v4); - break; - case 4: - v1->pInfos[v2].uFirstVisitedAt = atoi(v4); - break; - case 5: - v1->pInfos[v2]._per = atoi(v4); - break; - case 6: - v1->pInfos[v2].uRespawnIntervalDays = atoi(v4); - break; - case 7: - v1->pInfos[v2]._alert_days = atoi(v4); - break; - case 8: - v1->pInfos[v2]._steal_perm = atoi(v4); - break; - case 9: - v1->pInfos[v2].field_2D = atoi(v4); - break; - case 10: - v1->pInfos[v2].field_2E = atoi(v4); - break; - case 11: - v1->pInfos[v2].field_2F = atoi(v4); - break; - case 12: - v1->pInfos[v2].field_30 = atoi(v4); - break; - case 13: - v1->pInfos[v2].field_31 = atoi(v4); - break; - case 14: - v1->pInfos[v2].field_32 = atoi(v4); - break; - case 15: - v1->pInfos[v2].field_33 = atoi(v4); - break; - case 16: - v1->pInfos[v2].pEncounterMonster1Texture = (char *)RemoveQuotes(v4); - break; - case 18: - v1->pInfos[v2].field_34 = atoi(v4); - break; - case 19: - v18 = (MapStats *)((char *)v1 + 68 * v2); - v18->pInfos[0].uEncounterMonster1AtLeast = 1; - strcpy(Str, v4); - v17 = 0; - if ( strlen(Str) ) - { - while ( Str[v17] != 45 ) - { - ++v17; - v7 = strlen(Str); - if ( v17 >= v7 ) - goto LABEL_35; - } - Str[v17] = 0; - v18->pInfos[0].uEncounterMonster1AtLeast = atoi(Str); - } -LABEL_35: - v8 = strlen(Str); - if ( v17 == v8 ) - v18->pInfos[0].uEncounterMonster1AtMost = atoi(&v4[v17 + 1]); - else - v18->pInfos[0].uEncounterMonster1AtMost = v18->pInfos[0].uEncounterMonster1AtLeast; - break; - case 20: - v1->pInfos[v2].pEncounterMonster2Texture = (char *)RemoveQuotes(v4); - break; - case 22: - v1->pInfos[v2].field_37 = atoi(v4); - break; - case 23: - v18 = (MapStats *)((char *)v1 + 68 * v2); - v18->pInfos[0].uEncounterMonster2AtLeast = 1; - strcpy(Str, v4); - v17 = 0; - if ( strlen(Str) ) - { - while ( Str[v17] != 45 ) - { - ++v17; - v9 = strlen(Str); - if ( v17 >= v9 ) - goto LABEL_45; - } - Str[v17] = 0; - v18->pInfos[0].uEncounterMonster2AtLeast = atoi(Str); - } -LABEL_45: - v10 = strlen(Str); - if ( v17 == v10 ) - v18->pInfos[0].uEncounterMonster2AtMost = atoi(&v4[v17 + 1]); - else - v18->pInfos[0].uEncounterMonster2AtMost = v18->pInfos[0].uEncounterMonster2AtLeast; - break; - case 24: - v1->pInfos[v2].pEncounterMonster3Texture = (char *)RemoveQuotes(v4); - break; - case 26: - v1->pInfos[v2].field_3A = atoi(v4); - break; - case 27: - v18 = (MapStats *)((char *)v1 + 68 * v2); - v18->pInfos[0].uEncounterMonster3AtLeast = 1; - strcpy(Str, v4); - v17 = 0; - if ( strlen(Str) ) - { - while ( Str[v17] != 45 ) - { - ++v17; - v11 = strlen(Str); - if ( v17 >= v11 ) - goto LABEL_55; - } - Str[v17] = 0; - v18->pInfos[0].uEncounterMonster3AtLeast = atoi(Str); - } -LABEL_55: - v12 = strlen(Str); - if ( v17 == v12 ) - v18->pInfos[0].uEncounterMonster3AtMost = atoi(&v4[v17 + 1]); - else - v18->pInfos[0].uEncounterMonster3AtMost = v18->pInfos[0].uEncounterMonster3AtLeast; - break; - case 28: - v1->pInfos[v2].uRedbookTrackID = atoi(v4); - break; - case 29: - if ( strcmp(v4, "GENERIC") ) - { - if ( strcmp(v4, "PADDEDCELL") ) - { - if ( strcmp(v4, "ROOM") ) - { - if ( strcmp(v4, "BATHROOM") ) - { - if ( strcmp(v4, "LIVINGROOM") ) - { - if ( strcmp(v4, "STONEROOM") ) - { - if ( strcmp(v4, "AUDITORIUM") ) - { - if ( strcmp(v4, "CONCERTHALL") ) - { - if ( strcmp(v4, "CAVE") ) - { - if ( strcmp(v4, "ARENA") ) - { - if ( strcmp(v4, "HANGAR") ) - { - if ( strcmp(v4, "CARPETEDHALLWAY") ) - { - if ( strcmp(v4, "HALLWAY") ) - { - if ( strcmp(v4, "STONECORRIDOR") ) - { - if ( strcmp(v4, "ALLEY") ) - { - if ( strcmp(v4, "FOREST") ) - { - if ( strcmp(v4, "CITY") ) - { - if ( strcmp(v4, "MOUNTAINS") ) - { - if ( strcmp(v4, "QUARRY") ) - { - if ( strcmp(v4, "PLAIN") ) - { - if ( strcmp(v4, "PARKINGLOT") ) - { - if ( strcmp(v4, "SEWERPIPE") ) - { - if ( strcmp(v4, "UNDERWATER") ) - { - if ( strcmp(v4, "DRUGGED") ) - { - if ( strcmp(v4, "DIZZY") ) - { - if ( strcmp(v4, "PSYCHOTIC") ) - v1->pInfos[v2].uEAXEnv = 26; - else - v1->pInfos[v2].uEAXEnv = 25; - } - else - { - v1->pInfos[v2].uEAXEnv = 24; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 23; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 22; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 21; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 20; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 19; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 18; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 17; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 16; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 15; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 14; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 13; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 12; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 11; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 10; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 9; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 8; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 7; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 6; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 5; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 4; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 3; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 2; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 1; - } - } - else - { - v1->pInfos[v2].uEAXEnv = 0; - } - break; - default: - break; - } - } - else - { - v15 = 1; - } - ++v16; - v4 = v14 + 1; - } - while ( v16 - 1 <= 29 && !v15 ); - ++v2; - } - while ( (signed int)v2 < 77 ); - v1->uNumMaps = v2; + strtok(NULL, "\r"); + strtok(NULL, "\r"); + + for (i=1; i<77; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 1: + pInfos[i].pName = RemoveQuotes(test_string); + break; + case 2: + pInfos[i].pFilename = RemoveQuotes(test_string); + break; + case 3: + pInfos[i].uNumResets = atoi(test_string); + break; + case 4: + pInfos[i].uFirstVisitedAt = atoi(test_string); + break; + case 5: + pInfos[i]._per = atoi(test_string); + break; + case 6: + pInfos[i].uRespawnIntervalDays = atoi(test_string); + break; + case 7: + pInfos[i]._alert_days = atoi(test_string); + break; + case 8: + pInfos[i]._steal_perm = atoi(test_string); + break; + case 9: + pInfos[i].LockX5 = atoi(test_string); + break; + case 10: + pInfos[i].Trap_D20 = atoi(test_string); + break; + case 11: + pInfos[i].Treasure_prob = atoi(test_string); + break; + case 12: + pInfos[i].Encounter_percent = atoi(test_string); + break; + case 13: + pInfos[i].EncM1percent = atoi(test_string); + break; + case 14: + pInfos[i].EncM2percent = atoi(test_string); + break; + case 15: + pInfos[i].EncM3percent = atoi(test_string); + break; + case 16: + pInfos[i].pEncounterMonster1Texture = RemoveQuotes(test_string); + break; + case 18: + pInfos[i].Dif_M1 = atoi(test_string); + break; + case 19: + pInfos[i].uEncounterMonster1AtLeast = 1; + pInfos[i].uEncounterMonster1AtMost = 1; + strcpy(work_str, test_string); + work_str_pos = 0; + work_str_len=strlen(work_str); + if (work_str_len ) + { + while (work_str[work_str_pos] != '-' ) + { + ++work_str_pos; + if (work_str_pos >= work_str_len ) + break; + } + work_str[work_str_pos] = 0; + pInfos[i].uEncounterMonster1AtLeast = atoi(work_str); + if ( work_str_pos < work_str_len ) + pInfos[i].uEncounterMonster1AtMost = atoi(&work_str[work_str_pos + 1]); + else + pInfos[i].uEncounterMonster1AtMost = pInfos[i].uEncounterMonster1AtLeast; + } + break; + case 20: + pInfos[i].pEncounterMonster2Texture = RemoveQuotes(test_string); + break; + case 22: + pInfos[i].Dif_M2 = atoi(test_string); + break; + case 23: + pInfos[i].uEncounterMonster2AtLeast = 1; + pInfos[i].uEncounterMonster2AtMost = 1; + strcpy(work_str, test_string); + work_str_pos = 0; + work_str_len=strlen(work_str); + if (work_str_len ) + { + while (work_str[work_str_pos] != '-' ) + { + ++work_str_pos; + if (work_str_pos >= work_str_len ) + break; + } + work_str[work_str_pos] = 0; + pInfos[i].uEncounterMonster2AtLeast = atoi(work_str); + if ( work_str_pos < work_str_len ) + pInfos[i].uEncounterMonster2AtMost = atoi(&work_str[work_str_pos + 1]); + else + pInfos[i].uEncounterMonster2AtMost = pInfos[i].uEncounterMonster2AtLeast; + } + break; + case 24: + pInfos[i].pEncounterMonster3Texture = RemoveQuotes(test_string); + break; + case 26: + pInfos[i].Dif_M3 = atoi(test_string); + break; + case 27: + pInfos[i].uEncounterMonster3AtLeast = 1; + pInfos[i].uEncounterMonster3AtMost = 1; + strcpy(work_str, test_string); + work_str_pos = 0; + work_str_len=strlen(work_str); + if (work_str_len ) + { + while (work_str[work_str_pos] != '-' ) + { + ++work_str_pos; + if (work_str_pos >= work_str_len ) + break; + } + work_str[work_str_pos] = 0; + pInfos[i].uEncounterMonster3AtLeast = atoi(work_str); + if ( work_str_pos < work_str_len ) + pInfos[i].uEncounterMonster3AtMost = atoi(&work_str[work_str_pos + 1]); + else + pInfos[i].uEncounterMonster3AtMost = pInfos[i].uEncounterMonster3AtLeast; + } + break; + case 28: + pInfos[i].uRedbookTrackID = atoi(test_string); + break; + case 29: + { + if ( !strcmp(test_string, "CAVE") ) + { + pInfos[i].uEAXEnv = 8; + break; + } + if ( !strcmp(test_string, "STONEROOM") ) + { + pInfos[i].uEAXEnv = 5; + break; + } + if ( !strcmp(test_string, "MOUNTAINS") ) + { + pInfos[i].uEAXEnv = 17; + break; + } + if ( !strcmp(test_string, "PLAIN") ) + { + pInfos[i].uEAXEnv = 19; + break; + } + if ( !strcmp(test_string, "FOREST") ) + { + pInfos[i].uEAXEnv = 15; + break; + } + if ( !strcmp(test_string, "CITY") ) + { + pInfos[i].uEAXEnv = 16; + break; + } + if ( !strcmp(test_string, "UNDERWATER") ) + { + pInfos[i].uEAXEnv = 22; + break; + } + if ( !strcmp(test_string, "ARENA") ) + { + pInfos[i].uEAXEnv = 9; + break; + } + if ( !strcmp(test_string, "GENERIC") ) + { + pInfos[i].uEAXEnv = 0; + break; + } + if ( !strcmp(test_string, "PADDEDCELL") ) + { + pInfos[i].uEAXEnv = 1; + break; + } + if ( !strcmp(test_string, "ROOM") ) + { + pInfos[i].uEAXEnv = 2; + break; + } + if ( !strcmp(test_string, "BATHROOM") ) + { + pInfos[i].uEAXEnv = 3; + break; + } + if ( !strcmp(test_string, "LIVINGROOM") ) + { + pInfos[i].uEAXEnv = 4; + break; + } + if ( !strcmp(test_string, "AUDITORIUM") ) + { + pInfos[i].uEAXEnv = 6; + break; + } + if ( !strcmp(test_string, "CONCERTHALL") ) + { + pInfos[i].uEAXEnv = 7; + break; + } + if ( !strcmp(test_string, "HANGAR") ) + { + pInfos[i].uEAXEnv = 10; + break; + } + if ( !strcmp(test_string, "CARPETEDHALLWAY") ) + { + pInfos[i].uEAXEnv = 11; + break; + } + if ( !strcmp(test_string, "HALLWAY") ) + { + pInfos[i].uEAXEnv = 12; + break; + } + if ( !strcmp(test_string, "STONECORRIDOR") ) + { + pInfos[i].uEAXEnv = 13; + break; + } + if ( !strcmp(test_string, "ALLEY") ) + { + pInfos[i].uEAXEnv = 14; + break; + } + if ( !strcmp(test_string, "QUARRY") ) + { + pInfos[i].uEAXEnv = 18; + break; + } + if ( !strcmp(test_string, "PARKINGLOT") ) + { + pInfos[i].uEAXEnv = 20; + break; + } + if ( !strcmp(test_string, "SEWERPIPE") ) + { + pInfos[i].uEAXEnv = 21; + break; + } + if ( !strcmp(test_string, "DRUGGED") ) + { + pInfos[i].uEAXEnv = 23; + break; + } + if ( !strcmp(test_string, "DIZZY") ) + { + pInfos[i].uEAXEnv = 24; + break; + } + if ( !strcmp(test_string, "PSYCHOTIC") ) + { + pInfos[i].uEAXEnv = 25; + break; + } + pInfos[i].uEAXEnv = 26; + + } + break; + } + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<31)&&!break_loop); + } + + uNumMaps = 77; } // 453F62: using guessed type char Str[32]; @@ -9673,73 +9608,55 @@ //----- (004547E4) -------------------------------------------------------- void FactionTable::Initialize() { - char *v1; // ebx@1 - char *v2; // eax@4 - signed int v3; // edi@4 - int v4; // ebp@4 - char v5; // dl@5 - char *v6; // ecx@5 - int v7; // esi@9 - signed int v8; // [sp+4h] [bp-Ch]@3 - signed int v9; // [sp+8h] [bp-8h]@4 - char *v10; // [sp+Ch] [bp-4h]@1 - - v1 = 0; - v10 = (char *)relations; + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; + if ( pHostileTXT_Raw ) pAllocator->FreeChunk(pHostileTXT_Raw); - pHostileTXT_Raw = 0; + pHostileTXT_Raw = NULL; pHostileTXT_Raw = (char *)pEvents_LOD->LoadRaw("hostile.txt", 0); strtok(pHostileTXT_Raw, "\r"); - v8 = 0; - do - { - v2 = strtok(v1, "\r") + 1; - v3 = 0; - v9 = (signed int)v1; - v4 = (int)&v10[v8-89]; - do - { - v5 = *v2; - v6 = 0; - if ( *v2 != 9 ) - { - v1 = 0; - do - { - if ( !v5 ) - break; - ++v6; - v5 = v2[(int)v6]; - } - while ( v5 != 9 ); - } - v7 = (int)&v2[(int)v6]; - if ( v2[(int)v6] == (char)v1 ) - v9 = 1; - *(char *)v7 = (char)v1; - if ( v6 == v1 ) - { - v9 = 1; - } - else - { - if ( v3 >= 1 && v3 <= 90 ) - *(char *)v4 = atoi(v2); - } - ++v3; - v4 += 89; - v2 = (char *)(v7 + 1); - } - while ( v3 - 1 <= 90 && (char *)v9 == v1 ); - ++v8; - } - while ( v8 < 89 ); - - if ( pHostileTXT_Raw != v1 ) + for (i=0; i<89; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + if ( decode_step >= 1 && decode_step < 90 ) + relations[decode_step-1][i] = atoi(test_string); + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<92)&&!break_loop); + } + if ( pHostileTXT_Raw) { pAllocator->FreeChunk(pHostileTXT_Raw); - pHostileTXT_Raw = v1; + pHostileTXT_Raw = NULL; } }
--- a/mm7_3.cpp Sun Feb 17 18:50:35 2013 +0400 +++ b/mm7_3.cpp Mon Feb 18 00:47:36 2013 +0400 @@ -4748,432 +4748,364 @@ // 6BE3C5: using guessed type char bNoNPCHiring; //----- (004763E0) -------------------------------------------------------- -void __cdecl InitializeAwards() -{ - char *v0; // ebx@1 - char *v1; // eax@4 - char v2; // dl@5 - char *v3; // ecx@5 - int v4; // esi@9 - signed int v5; // [sp+Ch] [bp-Ch]@4 - char *v6; // [sp+10h] [bp-8h]@4 - Award *v7; // [sp+14h] [bp-4h]@3 - - v0 = 0; +void InitializeAwards() +{ + + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; + if ( pAwardsTXT_Raw ) pAllocator->FreeChunk(pAwardsTXT_Raw); - pAwardsTXT_Raw = 0; + pAwardsTXT_Raw = NULL; pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0); strtok(pAwardsTXT_Raw, "\r"); - v7 = pAwards; - for (uint i = 0; i < 104; ++i) - { - v1 = strtok(v0, "\r") + 1; - v6 = v0; - v5 = (signed int)v0; - do - { - v2 = *v1; - v3 = 0; - if ( *v1 != 9 ) - { - v0 = 0; - do - { - if ( !v2 ) - break; - ++v3; - v2 = v1[(int)v3]; - } - while ( v2 != 9 ); - } - v4 = (int)&v1[(int)v3]; - if ( v1[(int)v3] == (char)v0 ) - v5 = 1; - *(char *)v4 = (char)v0; - if ( v3 == v0 ) - { - v5 = 1; - } - else - { - if ( v6 == (char *)1 ) - { - v7->pText = RemoveQuotes(v1); - } - else - { - if ( v6 == (char *)2 ) - v7->uSort = atoi(v1); - } - } - ++v6; - v1 = (char *)(v4 + 1); - } - while ( (signed int)(v6 - 1) <= 2 && (char *)v5 == v0 ); - ++v7; - } - //while ( (signed int)v7 < (signed int)&dword_7241C8 ); + + for (i=1; i<104; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + if (decode_step==1) + pAwards[i].pText=RemoveQuotes(test_string); + else if (decode_step==2) + pAwards[i].uSort=atoi(test_string); + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<3)&&!break_loop); + } + } // 7241C8: using guessed type int dword_7241C8; //----- (004764C2) -------------------------------------------------------- -void __cdecl InitializeScrolls() -{ - char *v0; // ebx@1 - char *v1; // eax@4 - int v2; // edi@4 - char v3; // dl@5 - char *v4; // ecx@5 - int v5; // esi@9 - const char **v6; // [sp+10h] [bp-8h]@3 - signed int v7; // [sp+14h] [bp-4h]@4 - - v0 = 0; +void InitializeScrolls() +{ + + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; + if ( pScrollsTXT_Raw ) pAllocator->FreeChunk(pScrollsTXT_Raw); - pScrollsTXT_Raw = 0; + pScrollsTXT_Raw = NULL; pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0); strtok(pScrollsTXT_Raw, "\r"); - v6 = pScrolls; - for (uint i = 0; i < 82; ++i) - { - v1 = strtok(v0, "\r") + 1; - v2 = 0; - v7 = (signed int)v0; - do - { - v3 = *v1; - v4 = 0; - if ( *v1 != 9 ) - { - v0 = 0; - do - { - if ( !v3 ) - break; - ++v4; - v3 = v1[(int)v4]; - } - while ( v3 != 9 ); - } - v5 = (int)&v1[(int)v4]; - if ( v1[(int)v4] == (char)v0 ) - v7 = 1; - *(char *)v5 = (char)v0; - if ( v4 == v0 ) - { - v7 = 1; - } - else - { - if ( v2 == 1 ) - *v6 = RemoveQuotes(v1); - } - ++v2; - v1 = (char *)(v5 + 1); - } - while ( v2 - 1 <= 1 && (char *)v7 == v0 ); - ++v6; - } - //while ( (signed int)v6 < (signed int)dword_723E80_award_related ); + for (i=0; i<82; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + if ( decode_step == 1) + pScrolls[i]=RemoveQuotes(test_string); + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<2)&&!break_loop); + } } //----- (00476590) -------------------------------------------------------- -void __cdecl InitializeMerchants() -{ - char *v0; // ebx@1 - //char **v1; // edi@3 - char *v2; // ecx@4 - char v3; // dl@5 - char *v4; // eax@5 - int v5; // esi@9 - signed int v6; // [sp+Ch] [bp-8h]@4 - char *v7; // [sp+10h] [bp-4h]@4 - - v0 = 0; +void InitializeMerchants() +{ + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; + if ( pMerchantsTXT_Raw ) pAllocator->FreeChunk(pMerchantsTXT_Raw); - pMerchantsTXT_Raw = 0; + pMerchantsTXT_Raw = NULL; pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0); strtok(pMerchantsTXT_Raw, "\r"); - //v1 = (char **)pMerchantsRepairPhrases; - for (uint i = 0; i < 7; ++i) - { - v7 = v0; - v6 = (signed int)v0; - v2 = strtok(v0, "\r") + 1; - do - { - v3 = *v2; - v4 = 0; - if ( *v2 != 9 ) - { - v0 = 0; - do - { - if ( !v3 ) - break; - ++v4; - v3 = v2[(int)v4]; - } - while ( v3 != 9 ); - } - v5 = (int)&v2[(int)v4]; - if ( v2[(int)v4] == (char)v0 ) - v6 = 1; - *(char *)v5 = (char)v0; - if ( v4 == v0 ) - { - v6 = 1; - } - else - { - if ( v7 == (char *)1 ) - { - pMerchantsBuyPhrases[i] = RemoveQuotes(v2); - } - else - { - if ( v7 == (char *)2 ) - { - pMerchantsSellPhrases[i] = RemoveQuotes(v2); - } - else - { - if ( v7 == (char *)3 ) - { - pMerchantsRepairPhrases[i] = RemoveQuotes(v2); - } - else - { - if ( v7 - 3 == (char *)1 ) - pMerchantsIdentifyPhrases[i] = RemoveQuotes(v2); - } - } - } - } - ++v7; - v2 = (char *)(v5 + 1); - } - while ( (signed int)(v7 - 1) <= 4 && (char *)v6 == v0 ); - //++v1; - } - //while ( (signed int)v1 < (signed int)pMerchantsIdentifyPhrases ); + + for (i=0; i<7; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 1: + pMerchantsBuyPhrases[i]=RemoveQuotes(test_string); + break; + case 2: + pMerchantsSellPhrases[i]=RemoveQuotes(test_string); + break; + case 3: + pMerchantsRepairPhrases[i]=RemoveQuotes(test_string); + break; + case 4: + pMerchantsIdentifyPhrases[i]=RemoveQuotes(test_string); + break; + } + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<5)&&!break_loop); + } + } //----- (00476682) -------------------------------------------------------- -void __cdecl InitializeTransitions() -{ - char *v0; // ebx@1 - char *v1; // eax@4 - int v2; // edi@4 - char v3; // dl@5 - char *v4; // ecx@5 - int v5; // esi@9 - char **v6; // [sp+10h] [bp-8h]@3 - signed int v7; // [sp+14h] [bp-4h]@4 - - v0 = 0; +void InitializeTransitions() +{ + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; + if ( pTransitionsTXT_Raw ) pAllocator->FreeChunk(pTransitionsTXT_Raw); - pTransitionsTXT_Raw = 0; + pTransitionsTXT_Raw = NULL; pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0); strtok(pTransitionsTXT_Raw, "\r"); - v6 = pTransitionStrings; - for (uint i = 0; i < 464; ++i) - { - v1 = strtok(v0, "\r") + 1; - v2 = 0; - v7 = (signed int)v0; - do - { - v3 = *v1; - v4 = 0; - if ( *v1 != 9 ) - { - v0 = 0; - do - { - if ( !v3 ) - break; - ++v4; - v3 = v1[(int)v4]; - } - while ( v3 != 9 ); - } - v5 = (int)&v1[(int)v4]; - if ( v1[(int)v4] == (char)v0 ) - v7 = 1; - *(char *)v5 = (char)v0; - if ( v4 == v0 ) - { - v7 = 1; - } - else - { - if ( v2 == 1 ) - *v6 = (char *)RemoveQuotes(v1); - } - ++v2; - v1 = (char *)(v5 + 1); - } - while ( v2 - 1 <= 1 && (char *)v7 == v0 ); - ++v6; - } - //while ( (signed int)v6 < (signed int)"awards.txt" ); + + for (i=0; i<464; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + if ( decode_step == 1) + pTransitionStrings[i]=RemoveQuotes(test_string); + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<2)&&!break_loop); + } } //----- (00476750) -------------------------------------------------------- void __cdecl InitializeAutonotes() { - Autonote *v0; // ebp@3 - int v1; // ebx@4 - char *v2; // esi@4 - char v3; // cl@5 - int v4; // eax@5 - char *v5; // edi@9 - signed int v6; // [sp+0h] [bp-4h]@4 + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; if ( pAutonoteTXT_Raw ) pAllocator->FreeChunk(pAutonoteTXT_Raw); pAutonoteTXT_Raw = 0; pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0); strtok(pAutonoteTXT_Raw, "\r"); - v0 = pAutonoteTxt; - for (uint i = 0; i < 195; ++i) - { - v1 = 0; - v2 = strtok(0, "\r") + 1; - v6 = 0; - do - { - v3 = *v2; - v4 = 0; - while ( v3 != 9 && v3 ) - { - ++v4; - v3 = v2[v4]; - } - v5 = &v2[v4]; - if ( !v2[v4] ) - v6 = 1; - *v5 = 0; - if ( v4 ) - { - if ( v1 == 1 ) - { - v0->pText = RemoveQuotes(v2); - } - else - { - if ( v1 == 2 ) - { - if ( _strcmpi(v2, "potion") ) - { - if ( _strcmpi(v2, "stat") ) - { - if ( _strcmpi(v2, "seer") ) - { - if ( _strcmpi(v2, "obelisk") ) - v0->eType = (AUTONOTE_TYPE)(5 - (_strcmpi(v2, "teacher") != 0)); - else - v0->eType = (AUTONOTE_TYPE)2; - } - else - { - v0->eType = (AUTONOTE_TYPE)3; - } - } - else - { - v0->eType = (AUTONOTE_TYPE)1; - } - } - else - { - v0->eType = (AUTONOTE_TYPE)0; - } - } - } - } - else - { - v6 = 1; - } - ++v1; - v2 = v5 + 1; - } - while ( v1 - 1 <= 2 && !v6 ); - ++v0; - } - //while ( (signed int)v0 < (signed int)&pScrolls[1] ); + + for (i=0; i<195; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 1: + pAutonoteTxt[i].pText=RemoveQuotes(test_string); + break; + case 2: + { + if ( !_strcmpi(test_string, "potion")) + { + pAutonoteTxt[i].eType = AUTONOTE_POTION_RECEPIE; + break; + } + if ( !_strcmpi(test_string, "stat") ) + { + pAutonoteTxt[i].eType = AUTONOTE_STAT_HINT; + break; + } + if ( !_strcmpi(test_string, "seer") ) + { + pAutonoteTxt[i].eType = AUTONOTE_SEER; + break; + } + if ( !_strcmpi(test_string, "obelisk") ) + { + pAutonoteTxt[i].eType = AUTONOTE_OBELISK; + break; + } + if ( !_strcmpi(test_string, "teacher") ) + { + pAutonoteTxt[i].eType = AUTONOTE_TEACHER; + break; + } + pAutonoteTxt[i].eType =AUTONOTE_MISC; + break; + } + } + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<3)&&!break_loop); + } } //----- (004768A9) -------------------------------------------------------- void __cdecl InitializeQuests() { - char *v0; // ebx@1 - char *v1; // eax@4 - int v2; // edi@4 - char v3; // dl@5 - char *v4; // ecx@5 - int v5; // esi@9 - //const char **v6; // [sp+10h] [bp-8h]@3 - signed int v7; // [sp+14h] [bp-4h]@4 - - v0 = 0; + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; + if ( pQuestsTXT_Raw ) pAllocator->FreeChunk(pQuestsTXT_Raw); - pQuestsTXT_Raw = 0; + pQuestsTXT_Raw = NULL; pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0); strtok(pQuestsTXT_Raw, "\r"); - //v6 = pQuestTable; - for (uint i = 0; i < 512; ++i) - //do - { - v1 = strtok(v0, "\r") + 1; - v2 = 0; - v7 = (signed int)v0; - do - { - v3 = *v1; - v4 = 0; - if ( *v1 != '\t' ) - { - v0 = 0; - do - { - if ( !v3 ) - break; - ++v4; - v3 = v1[(int)v4]; - } - while ( v3 != '\t' ); - } - v5 = (int)&v1[(int)v4]; - if ( v1[(int)v4] == (char)v0 ) - v7 = 1; - *(char *)v5 = (char)v0; - if ( v4 == v0 ) - { - v7 = 1; - } - else - { - if ( v2 == 1 ) - pQuestTable[i] = RemoveQuotes(v1); - } - ++v2; - v1 = (char *)(v5 + 1); - } - while ( v2 - 1 <= 1 && (char *)v7 == v0 ); - //++v6; - } - //while ( (signed int)v6 < (signed int)&unk_723714 ); + for (i=0; i<512; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + if ( decode_step == 1) + pQuestTable[i] =RemoveQuotes(test_string); + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<2)&&!break_loop); + } } @@ -5181,214 +5113,150 @@ //----- (00476977) -------------------------------------------------------- void NPCStats::Initialize2() { - char *v4; // eax@4 - char v5; // dl@5 - int v6; // ecx@5 - char *v7; // edi@9 - char *v9; // eax@21 - char v10; // dl@22 - int v11; // ecx@22 - char *v12; // edi@26 - char *v14; // eax@39 - char v15; // dl@40 - int v16; // ecx@40 - char *v17; // edi@44 - char v18; // zf@47 - NPCStats_stru0 *v19; // eax@57 - signed int v20; // edx@57 - signed int v21; // ecx@58 - int v22; // [sp+10h] [bp-10h]@4 - int v23; // [sp+10h] [bp-10h]@21 - int v25; // [sp+14h] [bp-Ch]@4 - int v26; // [sp+14h] [bp-Ch]@21 - signed int v27; // [sp+14h] [bp-Ch]@39 - //signed int v28; // [sp+18h] [bp-8h]@3 - //signed int v29; // [sp+18h] [bp-8h]@20 - signed int v30; // [sp+18h] [bp-8h]@37 - char *v31; // [sp+1Ch] [bp-4h]@37 - - //v1 = this; - //v2 = 0; + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + int item_counter; + + if (pNPCTextTXT_Raw) pAllocator->FreeChunk(pNPCTextTXT_Raw); - - //v3 = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0); + pNPCTextTXT_Raw =NULL; pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0); strtok(pNPCTextTXT_Raw, "\r"); - for (uint i = 0; i < 789; ++i) - { - v4 = strtok(nullptr, "\r") + 1; - v22 = 0; - v25 = 0; - do - { - v5 = *v4; - v6 = 0; - if ( *v4 != 9 ) - { - do - { - if ( !v5 ) - break; - ++v6; - v5 = v4[v6]; - } - while ( v5 != 9 ); - //v2 = 0; - } - v7 = &v4[v6]; - if ( !v4[v6] ) - v25 = 1; - *v7 = 0; - if ( v6 == 0 ) - { - v25 = 1; - } - else - { - if ( v22 == 1 ) - pNPCTopics[i].pText = RemoveQuotes(v4); - } - ++v22; - v4 = v7 + 1; - } - while ( (signed int)(v22 - 1) <= 1 && !v25);// == nullptr ); - } + for (i=0; i<789; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + if ( decode_step == 1) + pNPCTopics[i].pText =RemoveQuotes(test_string); + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<2)&&!break_loop); + } if (pNPCTopicTXT_Raw) pAllocator->FreeChunk(pNPCTopicTXT_Raw); - - //v8 = (char *)pEvents_LOD->LoadRaw("npctopic.txt", (int)v2); + pNPCTopicTXT_Raw =NULL; pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0); strtok(pNPCTopicTXT_Raw, "\r"); - for (uint i = 0; i < 579; ++i) - { - v9 = strtok(nullptr, "\r") + 1; - v23 = 0; - v26 = 0; - do - { - v10 = *v9; - v11 = 0; - if ( *v9 != 9 ) - { - do - { - if ( !v10 ) - break; - ++v11; - v10 = v9[v11]; - } - while ( v10 != 9 ); - //v2 = 0; - } - v12 = &v9[v11]; - if ( !v9[v11] ) - v26 = 1; - *v12 = 0; - if ( v11 == 0 ) - { - v26 = 1; - } - else - { - if ( v23 == 1 ) - pNPCTopics[i].pTopic = RemoveQuotes(v9); - } - ++v23; - v9 = v12 + 1; - } - while ( (signed int)(v23 - 1) <= 1 && !v26 ); - } + for (i=0; i<579; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + if ( decode_step == 1) + pNPCTopics[i].pTopic = RemoveQuotes(test_string); + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<2)&&!break_loop); + } if (pNPCDistTXT_Raw) pAllocator->FreeChunk(pNPCDistTXT_Raw); - - //v13 = (char *)pEvents_LOD->LoadRaw("npcdist.txt", (int)v2); + pNPCDistTXT_Raw = NULL; pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdist.txt", 0); strtok(pNPCDistTXT_Raw, "\r"); - strtok(nullptr, "\r"); - v30 = 1; - v31 = &array_16544[0].field_4[1]; - - char *v2 = 0; - while ( 2 ) - { - v14 = strtok(nullptr, "\r") + 1; - v27 = 0; - char *v24 = nullptr; - do - { - v15 = *v14; - v16 = 0; - if ( *v14 != 9 ) - { - do - { - if ( !v15 ) - break; - ++v16; - v15 = v14[v16]; - } - while ( v15 != 9 ); - v2 = v24; - } - v17 = &v14[v16]; - if ( !v14[v16] ) - v27 = 1; - *v17 = 0; - if ( !v16 ) - { - v27 = 1; - goto LABEL_54; - } - v18 = v2 == 0; - if ( (signed int)v2 > 0 ) - { - if ( (signed int)v2 < 77 ) - { - array_16544[(int)v2].field_4[v30] = atoi(v14); - goto LABEL_54; - } - v18 = v2 == 0; - } - if ( v18 ) - *v31 = 10; -LABEL_54: - ++v2; - v14 = v17 + 1; - v24 = v2; - } - while ( (signed int)(v2 - 1) <= 77 && !v27 ); - ++v30; - ++v31; - if ( v30 < 59 ) - { - v2 = 0; - continue; - } - break; - } - v19 = array_16544; - v20 = 77; - do - { - v19->field_0 = 0; - v21 = 1; - do - v19->field_0 += v19->field_4[v21++]; - while ( v21 < 59 ); - ++v19; - --v20; - } - while ( v20 ); + strtok(NULL, "\r"); + + for (i=1; i<59; ++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + if ((decode_step>0)&&(decode_step<77)) + { + array_16544[decode_step].field_4[i]=atoi(test_string); + } + else if (decode_step==0) + { + array_16544[0].field_4[i]=10; + } + } + else + { + break_loop = true; + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<78)&&!break_loop); + } + + for (i=0; i<78; ++i) + { + array_16544[i].field_0=0; + for (int ii=1; ii<59; ++ii) + { + array_16544[i].field_0+=array_16544[i].field_4[ii]; + } + } if (pNPCDistTXT_Raw) { pAllocator->FreeChunk(pNPCDistTXT_Raw); - pNPCDistTXT_Raw = nullptr; + pNPCDistTXT_Raw = NULL; } } @@ -15243,322 +15111,259 @@ //----- (00443801) -------------------------------------------------------- -int __cdecl Initialize2DA() -{ - const char *v0; // esi@3 - _2devent *v1; // edi@3 - char *v2; // esi@5 - int v3; // edx@5 - char v4; // cl@6 - int v5; // eax@6 - int v6; // ebx@10 - int v7; // eax@60 - int result; // eax@78 - signed int v9; // [sp+10h] [bp-8h]@5 - signed int v10; // [sp+14h] [bp-4h]@5 - - int it = 0; - - if ( p2DEventsTXT_Raw ) - pAllocator->FreeChunk(p2DEventsTXT_Raw); - p2DEventsTXT_Raw = 0; - v0 = "\r"; - p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0); - strtok(p2DEventsTXT_Raw, "\r"); - strtok(0, "\r"); - v1 = p2DEvents; - while ( 1 ) - { - v2 = strtok(0, v0) + 1; - v10 = 0; - v3 = -2; - v9 = -2; - do - { - v4 = *v2; - v5 = 0; - while ( v4 != 9 && v4 ) - { - ++v5; - v4 = v2[v5]; - } - v6 = (int)&v2[v5]; - if ( !v2[v5] ) - v10 = 1; - *(char *)v6 = 0; - if ( v5 ) - { - switch ( v3 ) - { - case 0: - if ( _strnicmp(v2, "wea", 3u) ) - { - if ( _strnicmp(v2, "arm", 3u) ) - { - if ( _strnicmp(v2, "mag", 3u) ) - { - if ( _strnicmp(v2, "alc", 3u) ) - { - if ( _strnicmp(v2, "sta", 3u) ) - { - if ( _strnicmp(v2, "boa", 3u) ) - { - if ( _strnicmp(v2, "tem", 3u) ) - { - if ( _strnicmp(v2, "tra", 3u) ) - { - if ( _strnicmp(v2, "tow", 3u) ) - { - if ( _strnicmp(v2, "tav", 3u) ) - { - if ( _strnicmp(v2, "ban", 3u) ) - { - if ( _strnicmp(v2, "fir", 3u) ) - { - if ( _strnicmp(v2, "air", 3u) ) - { - if ( _strnicmp(v2, "wat", 3u) ) - { - if ( _strnicmp(v2, "ear", 3u) ) - { - if ( _strnicmp(v2, "spi", 3u) ) - { - if ( _strnicmp(v2, "min", 3u) ) - { - if ( _strnicmp(v2, "bod", 3u) ) - { - if ( _strnicmp(v2, "lig", 3u) ) - { - if ( _strnicmp(v2, "dar", 3u) ) - { - if ( _strnicmp(v2, "ele", 3u) ) - { - if ( _strnicmp(v2, "sel", 3u) ) - { - if ( _strnicmp(v2, "mir", 3u) ) - { - v7 = -(_strnicmp(v2, "mer", 3u) != 0); - LOBYTE(v7) = v7 & 0xEE; - v1->uType = v7 + 18; - } - else - { - v1->uType = 16; - } - } - else - { - v1->uType = 15; - } - } - else - { - v1->uType = 14; - } - } - else - { - v1->uType = 13; - } - } - else - { - v1->uType = 12; - } - } - else - { - v1->uType = 11; - } - } - else - { - v1->uType = 10; - } - } - else - { - v1->uType = 9; - } - } - else - { - v1->uType = 8; - } - } - else - { - v1->uType = 7; - } - } - else - { - v1->uType = 6; - } - } - else - { - v1->uType = 5; - } - } - else - { - v1->uType = 22; - } - } - else - { - v1->uType = 21; - } - } - else - { - v1->uType = 17; - } - } - else - { - v1->uType = 30; - } - } - else - { - v1->uType = 23; - } - } - else - { - v1->uType = 28; - } - } - else - { - v1->uType = 27; - } - } - else - { - v1->uType = 4; - } - } - else - { - v1->uType = 3; - } - } - else - { - v1->uType = 2; - } - } - else - { - v1->uType = 1; - } - break; - case 2: - v1->uAnimationID = atoi(v2); - break; - case 3: - v1->pName = (char *)RemoveQuotes(v2); - break; - case 4: - v1->pProprieterName = RemoveQuotes(v2); - break; - case 5: - v1->pProprieterTitle = RemoveQuotes(v2); - break; - case 6: - v1->field_14 = atoi(v2); - break; - case 7: - v1->_state = atoi(v2); - break; - case 8: - v1->_rep = atoi(v2); - break; - case 9: - v1->_per = atoi(v2); - break; - case 10: - v1->fPriceMultiplier = atof(v2); - break; - case 11: - v1->flt_24 = atof(v2); - break; - case 13: - v1->field_1C = atoi(v2); - break; - case 16: - v1->uOpenTime = atoi(v2); - break; - case 17: - v1->uCloseTime = atoi(v2); - break; - case 18: - v1->uExitPicID = atoi(v2); - break; - case 19: - v1->uExitMapID = atoi(v2); - break; - case 20: - v1->_quest_related = atoi(v2); - break; - case 21: - v1->pEnterText = RemoveQuotes(v2); - break; - default: - break; - } - } - v2 = (char *)(v6 + 1); - v3 = v9 + 1; - v9 = v3; - result = v3 + 1; - } - while ( v3 + 1 <= 23 && !v10 ); - ++v1; - //if ( (signed int)v1 >= (signed int)&unk_597F10 ) - if (++it >= 525) - return result; - v0 = "\r"; - } +void Initialize2DA() +{ + + int i; + char* test_string; + unsigned char c; + bool break_loop; + unsigned int temp_str_len; + char* tmp_pos; + int decode_step; + + if ( p2DEventsTXT_Raw ) + pAllocator->FreeChunk(p2DEventsTXT_Raw); + p2DEventsTXT_Raw = NULL; + p2DEventsTXT_Raw = (char *)pEvents_LOD->LoadRaw("2dEvents.txt", 0); + strtok(p2DEventsTXT_Raw, "\r"); + strtok(NULL, "\r"); + + for (i=0;i<525;++i) + { + test_string = strtok(NULL, "\r") + 1; + break_loop = false; + decode_step=0; + do + { + c = *(unsigned char*)test_string; + temp_str_len = 0; + while((c!='\t')&&(c>0)) + { + ++temp_str_len; + c=test_string[temp_str_len]; + } + tmp_pos=test_string+temp_str_len; + if (*tmp_pos == 0) + break_loop = true; + *tmp_pos = 0; + if (temp_str_len) + { + switch (decode_step) + { + case 2: + { + if ( !_strnicmp(test_string, "wea", 3) ) + { + p2DEvents[i].uType = 1; + break; + } + if ( !_strnicmp(test_string, "arm", 3) ) + { + p2DEvents[i].uType = 2; + break; + } + if ( !_strnicmp(test_string, "mag", 3) ) + { + p2DEvents[i].uType = 3; + break; + } + if ( !_strnicmp(test_string, "alc", 3) ) + { + p2DEvents[i].uType = 4; + break; + } + if ( !_strnicmp(test_string, "sta", 3) ) + { + p2DEvents[i].uType = 27; + break; + } + if ( !_strnicmp(test_string, "boa", 3) ) + { + p2DEvents[i].uType = 28; + break; + } + if ( !_strnicmp(test_string, "tem", 3) ) + { + p2DEvents[i].uType = 23; + break; + } + if ( !_strnicmp(test_string, "tra", 3) ) + { + p2DEvents[i].uType = 30; + break; + } + if ( !_strnicmp(test_string, "tow", 3) ) + { + p2DEvents[i].uType = 17; + break; + } + + if ( !_strnicmp(test_string, "tav", 3) ) + { + p2DEvents[i].uType = 21; + break; + } + if ( !_strnicmp(test_string, "ban", 3) ) + { + p2DEvents[i].uType = 22; + break; + } + if ( !_strnicmp(test_string, "fir", 3) ) + { + p2DEvents[i].uType = 5; + break; + } + if ( !_strnicmp(test_string, "air", 3) ) + { + p2DEvents[i].uType = 6; + break; + } + if ( !_strnicmp(test_string, "wat", 3) ) + { + p2DEvents[i].uType = 7; + break; + } + if ( !_strnicmp(test_string, "ear", 3) ) + { + p2DEvents[i].uType = 8; + break; + } + if ( !_strnicmp(test_string, "spi", 3) ) + { + p2DEvents[i].uType = 9; + break; + } + if ( !_strnicmp(test_string, "min", 3) ) + { + p2DEvents[i].uType = 10; + break; + } + if ( !_strnicmp(test_string, "bod", 3) ) + { + p2DEvents[i].uType = 11; + break; + } + if ( !_strnicmp(test_string, "lig", 3) ) + { + p2DEvents[i].uType = 12; + break; + } + if ( !_strnicmp(test_string, "dar", 3) ) + { + p2DEvents[i].uType = 13; + break; + } + if ( !_strnicmp(test_string, "ele", 3) ) + { + p2DEvents[i].uType = 14; + break; + } + if ( !_strnicmp(test_string, "sel", 3) ) + { + p2DEvents[i].uType = 15; + break; + } + if ( !_strnicmp(test_string, "mir", 3) ) + { + p2DEvents[i].uType = 16; + break; + } + if ( !_strnicmp(test_string, "mer", 3) ) + { + p2DEvents[i].uType = 17; + break; + } + p2DEvents[i].uType = 18; + } + break; + + case 4: + p2DEvents[i].uAnimationID = atoi(test_string); + break; + case 5: + p2DEvents[i].pName = RemoveQuotes(test_string); + break; + case 6: + p2DEvents[i].pProprieterName = RemoveQuotes(test_string); + break; + case 7: + p2DEvents[i].pProprieterTitle = RemoveQuotes(test_string); + break; + case 8: + p2DEvents[i].field_14 = atoi(test_string); + break; + case 9: + p2DEvents[i]._state = atoi(test_string); + break; + case 10: + p2DEvents[i]._rep = atoi(test_string); + break; + case 11: + p2DEvents[i]._per = atoi(test_string); + break; + case 12: + p2DEvents[i].fPriceMultiplier = atof(test_string); + break; + case 13: + p2DEvents[i].flt_24 = atof(test_string); + break; + case 15: + p2DEvents[i].field_1C = atoi(test_string); + break; + case 18: + p2DEvents[i].uOpenTime = atoi(test_string); + break; + case 19: + p2DEvents[i].uCloseTime = atoi(test_string); + break; + case 20: + p2DEvents[i].uExitPicID = atoi(test_string); + break; + case 21: + p2DEvents[i].uExitMapID = atoi(test_string); + break; + case 22: + p2DEvents[i]._quest_related = atoi(test_string); + break; + case 23: + p2DEvents[i].pEnterText = RemoveQuotes(test_string); + break; + } + } + ++decode_step; + test_string=tmp_pos+1; + } while ((decode_step<24)&&!break_loop); + } + } //----- (00443CE1) -------------------------------------------------------- -unsigned int __fastcall LoadEventsToBuffer(const char *pContainerName, char *a2, unsigned int uBufferSize) -{ - const char *v3; // edi@1 - FILE *v4; // eax@1 - unsigned int v5; // esi@3 - char Args; // [sp+8h] [bp-B4h]@6 - //Texture DstBuf; // [sp+6Ch] [bp-50h]@1 - void *Dst; // [sp+B4h] [bp-8h]@1 +unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize) +{ + FILE *pLodFile; // eax@1 + unsigned int uTextureSize; // esi@3 + char Args[60]; // [sp+8h] [bp-B4h]@6 void *ptr; // [sp+B8h] [bp-4h]@1 - - v3 = pContainerName; - Dst = a2; - ptr = pEvents_LOD->LoadRaw(pContainerName, 0); - Texture DstBuf; // [sp+6Ch] [bp-50h]@1 - //Texture::Texture(&DstBuf); - - v4 = pEvents_LOD->FindContainer(v3, 0); - if ( !v4 ) - Abortf("Unable to load %s", v3); - fread(&DstBuf, 1u, 0x30u, v4); - v5 = DstBuf.uDecompressedSize; + + ptr = pEvents_LOD->LoadRaw(pContainerName, 0); + pLodFile = pEvents_LOD->FindContainer(pContainerName, 0); + if ( !pLodFile ) + Abortf("Unable to load %s", pContainerName); + fread(&DstBuf, 1, 48, pLodFile); + uTextureSize = DstBuf.uDecompressedSize; if ( !DstBuf.uDecompressedSize ) - v5 = DstBuf.uTextureSize; - memset(&DstBuf, 0, 0x48u); - if ( (signed int)v5 >= (signed int)uBufferSize ) - { - sprintf(&Args, "File %s Size %lu - Buffer size %lu", v3, v5, uBufferSize); - Abortf(&Args); - } - memcpy(Dst, ptr, v5); + uTextureSize = DstBuf.uTextureSize; + memset(&DstBuf, 0, 72); + if ( uTextureSize >= (signed int)uBufferSize ) + { + sprintf(Args, "File %s Size %lu - Buffer size %lu", pContainerName, uTextureSize, uBufferSize); + Abortf(Args); + } + memcpy(pBuffer, ptr, uTextureSize); pAllocator->FreeChunk(ptr); - return v5; + return uTextureSize; } //----- (00443DA1) --------------------------------------------------------
--- a/mm7_5.cpp Sun Feb 17 18:50:35 2013 +0400 +++ b/mm7_5.cpp Mon Feb 18 00:47:36 2013 +0400 @@ -2901,13 +2901,13 @@ if ( !v90 ) v90 = rand() % (signed int)pMapStats->uNumMaps + 1; pMapInfo = &pMapStats->pInfos[v90]; - if ( rand() % 100 + 1 <= pMapInfo->field_30 ) + if ( rand() % 100 + 1 <= pMapInfo->Encounter_percent ) { v91 = rand() % 100; - v92 = pMapInfo->field_31; + v92 = pMapInfo->EncM1percent; v93 = v91 + 1; if ( v93 > v92 ) - pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->field_32) + 2); + pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); else pNPCData4 = (NPCData *)v0; if ( !sub_45063B(pMapInfo, (int)pNPCData4) )
--- a/mm7_data.h Sun Feb 17 18:50:35 2013 +0400 +++ b/mm7_data.h Mon Feb 18 00:47:36 2013 +0400 @@ -2001,8 +2001,8 @@ __int16 __fastcall sub_441A4E(int a1); void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap); int __fastcall DrawBook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074); // idb -int __cdecl Initialize2DA(); -unsigned int __fastcall LoadEventsToBuffer(const char *pContainerName, char *a2, unsigned int uBufferSize); +void Initialize2DA(); +unsigned int LoadEventsToBuffer(const char *pContainerName, char *pBuffer, unsigned int uBufferSize); void __cdecl Initialize_GlobalEVT(); void __cdecl LoadLevel_InitializeLevelStr(); void __cdecl LoadLevel_InitializeLevelEvt();