comparison mm7_3.cpp @ 2:2ca04ccb612a

NoCD, main menu, various
author Nomad
date Wed, 10 Oct 2012 14:21:15 +0200
parents ac0fb48cd27a
children 540178ef9b18
comparison
equal deleted inserted replaced
1:ac0fb48cd27a 2:2ca04ccb612a
5672 pAllocator->FreeChunk(pAwardsTXT_Raw); 5672 pAllocator->FreeChunk(pAwardsTXT_Raw);
5673 pAwardsTXT_Raw = 0; 5673 pAwardsTXT_Raw = 0;
5674 pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0); 5674 pAwardsTXT_Raw = (char *)pEvents_LOD->LoadRaw("awards.txt", 0);
5675 strtok(pAwardsTXT_Raw, "\r"); 5675 strtok(pAwardsTXT_Raw, "\r");
5676 v7 = pAwards; 5676 v7 = pAwards;
5677 do 5677 for (uint i = 0; i < 104; ++i)
5678 { 5678 {
5679 v1 = strtok(v0, "\r") + 1; 5679 v1 = strtok(v0, "\r") + 1;
5680 v6 = v0; 5680 v6 = v0;
5681 v5 = (signed int)v0; 5681 v5 = (signed int)v0;
5682 do 5682 do
5719 v1 = (char *)(v4 + 1); 5719 v1 = (char *)(v4 + 1);
5720 } 5720 }
5721 while ( (signed int)(v6 - 1) <= 2 && (char *)v5 == v0 ); 5721 while ( (signed int)(v6 - 1) <= 2 && (char *)v5 == v0 );
5722 ++v7; 5722 ++v7;
5723 } 5723 }
5724 while ( (signed int)v7 < (signed int)&dword_7241C8 ); 5724 //while ( (signed int)v7 < (signed int)&dword_7241C8 );
5725 } 5725 }
5726 // 7241C8: using guessed type int dword_7241C8; 5726 // 7241C8: using guessed type int dword_7241C8;
5727 5727
5728 //----- (004764C2) -------------------------------------------------------- 5728 //----- (004764C2) --------------------------------------------------------
5729 void __cdecl InitializeScrolls() 5729 void __cdecl InitializeScrolls()
5742 pAllocator->FreeChunk(pScrollsTXT_Raw); 5742 pAllocator->FreeChunk(pScrollsTXT_Raw);
5743 pScrollsTXT_Raw = 0; 5743 pScrollsTXT_Raw = 0;
5744 pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0); 5744 pScrollsTXT_Raw = (char *)pEvents_LOD->LoadRaw("scroll.txt", 0);
5745 strtok(pScrollsTXT_Raw, "\r"); 5745 strtok(pScrollsTXT_Raw, "\r");
5746 v6 = pScrolls; 5746 v6 = pScrolls;
5747 do 5747 for (uint i = 0; i < 82; ++i)
5748 { 5748 {
5749 v1 = strtok(v0, "\r") + 1; 5749 v1 = strtok(v0, "\r") + 1;
5750 v2 = 0; 5750 v2 = 0;
5751 v7 = (signed int)v0; 5751 v7 = (signed int)v0;
5752 do 5752 do
5782 v1 = (char *)(v5 + 1); 5782 v1 = (char *)(v5 + 1);
5783 } 5783 }
5784 while ( v2 - 1 <= 1 && (char *)v7 == v0 ); 5784 while ( v2 - 1 <= 1 && (char *)v7 == v0 );
5785 ++v6; 5785 ++v6;
5786 } 5786 }
5787 while ( (signed int)v6 < (signed int)dword_723E80_award_related ); 5787 //while ( (signed int)v6 < (signed int)dword_723E80_award_related );
5788 } 5788 }
5789 // 723E80: using guessed type int dword_723E80_award_related[]; 5789
5790 5790
5791 //----- (00476590) -------------------------------------------------------- 5791 //----- (00476590) --------------------------------------------------------
5792 void __cdecl InitializeMerchants() 5792 void __cdecl InitializeMerchants()
5793 { 5793 {
5794 char *v0; // ebx@1 5794 char *v0; // ebx@1
5795 char **v1; // edi@3 5795 //char **v1; // edi@3
5796 char *v2; // ecx@4 5796 char *v2; // ecx@4
5797 char v3; // dl@5 5797 char v3; // dl@5
5798 char *v4; // eax@5 5798 char *v4; // eax@5
5799 int v5; // esi@9 5799 int v5; // esi@9
5800 signed int v6; // [sp+Ch] [bp-8h]@4 5800 signed int v6; // [sp+Ch] [bp-8h]@4
5804 if ( pMerchantsTXT_Raw ) 5804 if ( pMerchantsTXT_Raw )
5805 pAllocator->FreeChunk(pMerchantsTXT_Raw); 5805 pAllocator->FreeChunk(pMerchantsTXT_Raw);
5806 pMerchantsTXT_Raw = 0; 5806 pMerchantsTXT_Raw = 0;
5807 pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0); 5807 pMerchantsTXT_Raw = (char *)pEvents_LOD->LoadRaw("merchant.txt", 0);
5808 strtok(pMerchantsTXT_Raw, "\r"); 5808 strtok(pMerchantsTXT_Raw, "\r");
5809 v1 = (char **)pMerchantsRepairPhrases; 5809 //v1 = (char **)pMerchantsRepairPhrases;
5810 do 5810 for (uint i = 0; i < 7; ++i)
5811 { 5811 {
5812 v7 = v0; 5812 v7 = v0;
5813 v6 = (signed int)v0; 5813 v6 = (signed int)v0;
5814 v2 = strtok(v0, "\r") + 1; 5814 v2 = strtok(v0, "\r") + 1;
5815 do 5815 do
5838 } 5838 }
5839 else 5839 else
5840 { 5840 {
5841 if ( v7 == (char *)1 ) 5841 if ( v7 == (char *)1 )
5842 { 5842 {
5843 *(v1 - 14) = RemoveQuotes(v2); 5843 pMerchantsBuyPhrases[i] = RemoveQuotes(v2);
5844 } 5844 }
5845 else 5845 else
5846 { 5846 {
5847 if ( v7 == (char *)2 ) 5847 if ( v7 == (char *)2 )
5848 { 5848 {
5849 *(v1 - 7) = RemoveQuotes(v2); 5849 pMerchantsSellPhrases[i] = RemoveQuotes(v2);
5850 } 5850 }
5851 else 5851 else
5852 { 5852 {
5853 if ( v7 == (char *)3 ) 5853 if ( v7 == (char *)3 )
5854 { 5854 {
5855 *v1 = RemoveQuotes(v2); 5855 pMerchantsRepairPhrases[i] = RemoveQuotes(v2);
5856 } 5856 }
5857 else 5857 else
5858 { 5858 {
5859 if ( v7 - 3 == (char *)1 ) 5859 if ( v7 - 3 == (char *)1 )
5860 v1[7] = RemoveQuotes(v2); 5860 pMerchantsIdentifyPhrases[i] = RemoveQuotes(v2);
5861 } 5861 }
5862 } 5862 }
5863 } 5863 }
5864 } 5864 }
5865 ++v7; 5865 ++v7;
5866 v2 = (char *)(v5 + 1); 5866 v2 = (char *)(v5 + 1);
5867 } 5867 }
5868 while ( (signed int)(v7 - 1) <= 4 && (char *)v6 == v0 ); 5868 while ( (signed int)(v7 - 1) <= 4 && (char *)v6 == v0 );
5869 ++v1; 5869 //++v1;
5870 } 5870 }
5871 while ( (signed int)v1 < (signed int)pMerchantsIdentifyPhrases ); 5871 //while ( (signed int)v1 < (signed int)pMerchantsIdentifyPhrases );
5872 } 5872 }
5873 5873
5874 //----- (00476682) -------------------------------------------------------- 5874 //----- (00476682) --------------------------------------------------------
5875 void __cdecl InitializeTransitions() 5875 void __cdecl InitializeTransitions()
5876 { 5876 {
5888 pAllocator->FreeChunk(pTransitionsTXT_Raw); 5888 pAllocator->FreeChunk(pTransitionsTXT_Raw);
5889 pTransitionsTXT_Raw = 0; 5889 pTransitionsTXT_Raw = 0;
5890 pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0); 5890 pTransitionsTXT_Raw = (char *)pEvents_LOD->LoadRaw("trans.txt", 0);
5891 strtok(pTransitionsTXT_Raw, "\r"); 5891 strtok(pTransitionsTXT_Raw, "\r");
5892 v6 = pTransitionStrings; 5892 v6 = pTransitionStrings;
5893 do 5893 for (uint i = 0; i < 464; ++i)
5894 { 5894 {
5895 v1 = strtok(v0, "\r") + 1; 5895 v1 = strtok(v0, "\r") + 1;
5896 v2 = 0; 5896 v2 = 0;
5897 v7 = (signed int)v0; 5897 v7 = (signed int)v0;
5898 do 5898 do
5928 v1 = (char *)(v5 + 1); 5928 v1 = (char *)(v5 + 1);
5929 } 5929 }
5930 while ( v2 - 1 <= 1 && (char *)v7 == v0 ); 5930 while ( v2 - 1 <= 1 && (char *)v7 == v0 );
5931 ++v6; 5931 ++v6;
5932 } 5932 }
5933 while ( (signed int)v6 < (signed int)"awards.txt" ); 5933 //while ( (signed int)v6 < (signed int)"awards.txt" );
5934 } 5934 }
5935 5935
5936 //----- (00476750) -------------------------------------------------------- 5936 //----- (00476750) --------------------------------------------------------
5937 void __cdecl InitializeAutonotes() 5937 void __cdecl InitializeAutonotes()
5938 { 5938 {
5948 pAllocator->FreeChunk(pAutonoteTXT_Raw); 5948 pAllocator->FreeChunk(pAutonoteTXT_Raw);
5949 pAutonoteTXT_Raw = 0; 5949 pAutonoteTXT_Raw = 0;
5950 pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0); 5950 pAutonoteTXT_Raw = (char *)pEvents_LOD->LoadRaw("autonote.txt", 0);
5951 strtok(pAutonoteTXT_Raw, "\r"); 5951 strtok(pAutonoteTXT_Raw, "\r");
5952 v0 = (char *)&stru_723720[0].eType; 5952 v0 = (char *)&stru_723720[0].eType;
5953 do 5953 for (uint i = 0; i < 195; ++i)
5954 { 5954 {
5955 v1 = 0; 5955 v1 = 0;
5956 v2 = strtok(0, "\r") + 1; 5956 v2 = strtok(0, "\r") + 1;
5957 v6 = 0; 5957 v6 = 0;
5958 do 5958 do
6014 v2 = (char *)(v5 + 1); 6014 v2 = (char *)(v5 + 1);
6015 } 6015 }
6016 while ( v1 - 1 <= 2 && !v6 ); 6016 while ( v1 - 1 <= 2 && !v6 );
6017 v0 += 8; 6017 v0 += 8;
6018 } 6018 }
6019 while ( (signed int)v0 < (signed int)&pScrolls[1] ); 6019 //while ( (signed int)v0 < (signed int)&pScrolls[1] );
6020 } 6020 }
6021 // 723720: using guessed type Autonote stru_723720[195]; 6021
6022 6022
6023 //----- (004768A9) -------------------------------------------------------- 6023 //----- (004768A9) --------------------------------------------------------
6024 void __cdecl InitializeQuests() 6024 void __cdecl InitializeQuests()
6025 { 6025 {
6026 char *v0; // ebx@1 6026 char *v0; // ebx@1
6027 char *v1; // eax@4 6027 char *v1; // eax@4
6028 int v2; // edi@4 6028 int v2; // edi@4
6029 char v3; // dl@5 6029 char v3; // dl@5
6030 char *v4; // ecx@5 6030 char *v4; // ecx@5
6031 int v5; // esi@9 6031 int v5; // esi@9
6032 const char **v6; // [sp+10h] [bp-8h]@3 6032 //const char **v6; // [sp+10h] [bp-8h]@3
6033 signed int v7; // [sp+14h] [bp-4h]@4 6033 signed int v7; // [sp+14h] [bp-4h]@4
6034 6034
6035 v0 = 0; 6035 v0 = 0;
6036 if ( pQuestsTXT_Raw ) 6036 if ( pQuestsTXT_Raw )
6037 pAllocator->FreeChunk(pQuestsTXT_Raw); 6037 pAllocator->FreeChunk(pQuestsTXT_Raw);
6038 pQuestsTXT_Raw = 0; 6038 pQuestsTXT_Raw = 0;
6039 pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0); 6039 pQuestsTXT_Raw = (char *)pEvents_LOD->LoadRaw("quests.txt", 0);
6040 strtok(pQuestsTXT_Raw, "\r"); 6040 strtok(pQuestsTXT_Raw, "\r");
6041 v6 = pQuestTable; 6041
6042 do 6042 //v6 = pQuestTable;
6043 for (uint i = 0; i < 512; ++i)
6044 //do
6043 { 6045 {
6044 v1 = strtok(v0, "\r") + 1; 6046 v1 = strtok(v0, "\r") + 1;
6045 v2 = 0; 6047 v2 = 0;
6046 v7 = (signed int)v0; 6048 v7 = (signed int)v0;
6047 do 6049 do
6069 v7 = 1; 6071 v7 = 1;
6070 } 6072 }
6071 else 6073 else
6072 { 6074 {
6073 if ( v2 == 1 ) 6075 if ( v2 == 1 )
6074 *v6 = RemoveQuotes(v1); 6076 pQuestTable[i] = RemoveQuotes(v1);
6075 } 6077 }
6076 ++v2; 6078 ++v2;
6077 v1 = (char *)(v5 + 1); 6079 v1 = (char *)(v5 + 1);
6078 } 6080 }
6079 while ( v2 - 1 <= 1 && (char *)v7 == v0 ); 6081 while ( v2 - 1 <= 1 && (char *)v7 == v0 );
6080 ++v6; 6082 //++v6;
6081 } 6083 }
6082 while ( (signed int)v6 < (signed int)&unk_723714 ); 6084 //while ( (signed int)v6 < (signed int)&unk_723714 );
6083 } 6085 }
6084 6086
6085 6087
6086 6088
6087 //----- (00476977) -------------------------------------------------------- 6089 //----- (00476977) --------------------------------------------------------
6088 void NPCStats::Initialize2() 6090 void NPCStats::Initialize2()
6089 { 6091 {
6090 NPCStats *v1; // esi@1
6091 char *v2; // ebx@1
6092 char *v3; // eax@3
6093 char *v4; // eax@4 6092 char *v4; // eax@4
6094 char v5; // dl@5 6093 char v5; // dl@5
6095 char *v6; // ecx@5 6094 char *v6; // ecx@5
6096 int v7; // edi@9 6095 int v7; // edi@9
6097 char *v8; // eax@20
6098 char *v9; // eax@21 6096 char *v9; // eax@21
6099 char v10; // dl@22 6097 char v10; // dl@22
6100 char *v11; // ecx@22 6098 char *v11; // ecx@22
6101 int v12; // edi@26 6099 int v12; // edi@26
6102 char *v13; // eax@37
6103 char *v14; // eax@39 6100 char *v14; // eax@39
6104 char v15; // dl@40 6101 char v15; // dl@40
6105 int v16; // ecx@40 6102 int v16; // ecx@40
6106 int v17; // edi@44 6103 int v17; // edi@44
6107 char v18; // zf@47 6104 char v18; // zf@47
6108 NPCStats_stru0 *v19; // eax@57 6105 NPCStats_stru0 *v19; // eax@57
6109 signed int v20; // edx@57 6106 signed int v20; // edx@57
6110 signed int v21; // ecx@58 6107 signed int v21; // ecx@58
6111 char *v22; // [sp+10h] [bp-10h]@4 6108 char *v22; // [sp+10h] [bp-10h]@4
6112 char *v23; // [sp+10h] [bp-10h]@21 6109 char *v23; // [sp+10h] [bp-10h]@21
6113 char *v24; // [sp+10h] [bp-10h]@39
6114 char *v25; // [sp+14h] [bp-Ch]@4 6110 char *v25; // [sp+14h] [bp-Ch]@4
6115 char *v26; // [sp+14h] [bp-Ch]@21 6111 char *v26; // [sp+14h] [bp-Ch]@21
6116 signed int v27; // [sp+14h] [bp-Ch]@39 6112 signed int v27; // [sp+14h] [bp-Ch]@39
6117 signed int v28; // [sp+18h] [bp-8h]@3 6113 //signed int v28; // [sp+18h] [bp-8h]@3
6118 signed int v29; // [sp+18h] [bp-8h]@20 6114 //signed int v29; // [sp+18h] [bp-8h]@20
6119 signed int v30; // [sp+18h] [bp-8h]@37 6115 signed int v30; // [sp+18h] [bp-8h]@37
6120 char *v31; // [sp+1Ch] [bp-4h]@37 6116 char *v31; // [sp+1Ch] [bp-4h]@37
6121 6117
6122 v1 = this; 6118 //v1 = this;
6123 v2 = 0; 6119 //v2 = 0;
6124 if ( this->pNPCTextTXT_Raw ) 6120 if (pNPCTextTXT_Raw)
6125 pAllocator->FreeChunk(this->pNPCTextTXT_Raw); 6121 pAllocator->FreeChunk(pNPCTextTXT_Raw);
6126 v1->pNPCTextTXT_Raw = 0; 6122
6127 v3 = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0); 6123 //v3 = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0);
6128 v1->pNPCTextTXT_Raw = v3; 6124 pNPCTextTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctext.txt", 0);
6129 strtok(v3, "\r"); 6125 strtok(pNPCTextTXT_Raw, "\r");
6130 v28 = (signed int)&unk_72166C_pNPCText; 6126
6131 do 6127 for (uint i = 0; i < 789; ++i)
6132 { 6128 {
6133 v4 = strtok(v2, "\r") + 1; 6129 v4 = strtok(nullptr, "\r") + 1;
6134 v22 = v2; 6130 v22 = nullptr;
6135 v25 = v2; 6131 v25 = nullptr;
6136 do 6132 do
6137 { 6133 {
6138 v5 = *v4; 6134 v5 = *v4;
6139 v6 = 0; 6135 v6 = 0;
6140 if ( *v4 != 9 ) 6136 if ( *v4 != 9 )
6145 break; 6141 break;
6146 ++v6; 6142 ++v6;
6147 v5 = v4[(int)v6]; 6143 v5 = v4[(int)v6];
6148 } 6144 }
6149 while ( v5 != 9 ); 6145 while ( v5 != 9 );
6150 v2 = 0; 6146 //v2 = 0;
6151 } 6147 }
6152 v7 = (int)&v4[(int)v6]; 6148 v7 = (int)&v4[(int)v6];
6153 if ( !v4[(int)v6] ) 6149 if ( !v4[(int)v6] )
6154 v25 = (char *)1; 6150 v25 = (char *)1;
6155 *(char *)v7 = 0; 6151 *(char *)v7 = 0;
6156 if ( v6 == v2 ) 6152 if ( v6 == nullptr )
6157 { 6153 {
6158 v25 = (char *)1; 6154 v25 = (char *)1;
6159 } 6155 }
6160 else 6156 else
6161 { 6157 {
6162 if ( v22 == (char *)1 ) 6158 if ( v22 == (char *)1 )
6163 *(int *)v28 = (int)RemoveQuotes(v4); 6159 pNPCTopics[i].pText = RemoveQuotes(v4);
6164 } 6160 }
6165 ++v22; 6161 ++v22;
6166 v4 = (char *)(v7 + 1); 6162 v4 = (char *)(v7 + 1);
6167 } 6163 }
6168 while ( (signed int)(v22 - 1) <= 1 && v25 == v2 ); 6164 while ( (signed int)(v22 - 1) <= 1 && v25 == nullptr );
6169 v28 += 8; 6165 }
6170 } 6166
6171 while ( v28 < (signed int)pQuestTable ); 6167 if (pNPCTopicTXT_Raw)
6172 if ( v1->pNPCTopicTXT_Raw != v2 ) 6168 pAllocator->FreeChunk(pNPCTopicTXT_Raw);
6173 pAllocator->FreeChunk(v1->pNPCTopicTXT_Raw); 6169
6174 v1->pNPCTopicTXT_Raw = v2; 6170 //v8 = (char *)pEvents_LOD->LoadRaw("npctopic.txt", (int)v2);
6175 v8 = (char *)pEvents_LOD->LoadRaw("npctopic.txt", (int)v2); 6171 pNPCTopicTXT_Raw = (char *)pEvents_LOD->LoadRaw("npctopic.txt", 0);
6176 v1->pNPCTopicTXT_Raw = v8; 6172 strtok(pNPCTopicTXT_Raw, "\r");
6177 strtok(v8, "\r"); 6173
6178 v29 = (signed int)&unk_721668_pNPCTopic; 6174 for (uint i = 0; i < 579; ++i)
6179 do 6175 {
6180 { 6176 v9 = strtok(nullptr, "\r") + 1;
6181 v9 = strtok(v2, "\r") + 1; 6177 v23 = nullptr;
6182 v23 = v2; 6178 v26 = nullptr;
6183 v26 = v2;
6184 do 6179 do
6185 { 6180 {
6186 v10 = *v9; 6181 v10 = *v9;
6187 v11 = 0; 6182 v11 = 0;
6188 if ( *v9 != 9 ) 6183 if ( *v9 != 9 )
6193 break; 6188 break;
6194 ++v11; 6189 ++v11;
6195 v10 = v9[(int)v11]; 6190 v10 = v9[(int)v11];
6196 } 6191 }
6197 while ( v10 != 9 ); 6192 while ( v10 != 9 );
6198 v2 = 0; 6193 //v2 = 0;
6199 } 6194 }
6200 v12 = (int)&v9[(int)v11]; 6195 v12 = (int)&v9[(int)v11];
6201 if ( !v9[(int)v11] ) 6196 if ( !v9[(int)v11] )
6202 v26 = (char *)1; 6197 v26 = (char *)1;
6203 *(char *)v12 = 0; 6198 *(char *)v12 = 0;
6204 if ( v11 == v2 ) 6199 if ( v11 == nullptr )
6205 { 6200 {
6206 v26 = (char *)1; 6201 v26 = (char *)1;
6207 } 6202 }
6208 else 6203 else
6209 { 6204 {
6210 if ( v23 == (char *)1 ) 6205 if ( v23 == (char *)1 )
6211 *(int *)v29 = (int)RemoveQuotes(v9); 6206 pNPCTopics[i].pTopic = RemoveQuotes(v9);
6212 } 6207 }
6213 ++v23; 6208 ++v23;
6214 v9 = (char *)(v12 + 1); 6209 v9 = (char *)(v12 + 1);
6215 } 6210 }
6216 while ( (signed int)(v23 - 1) <= 1 && v26 == v2 ); 6211 while ( (signed int)(v23 - 1) <= 1 && v26 == nullptr );
6217 v29 += 8; 6212 }
6218 } 6213
6219 while ( v29 < (signed int)&unk_722880 ); 6214 if (pNPCDistTXT_Raw)
6220 if ( v1->pNPCDistTXT_Raw != v2 ) 6215 pAllocator->FreeChunk(pNPCDistTXT_Raw);
6221 pAllocator->FreeChunk(v1->pNPCDistTXT_Raw); 6216
6222 v1->pNPCDistTXT_Raw = v2; 6217 //v13 = (char *)pEvents_LOD->LoadRaw("npcdist.txt", (int)v2);
6223 v13 = (char *)pEvents_LOD->LoadRaw("npcdist.txt", (int)v2); 6218 pNPCDistTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcdist.txt", 0);
6224 v1->pNPCDistTXT_Raw = v13; 6219 strtok(pNPCDistTXT_Raw, "\r");
6225 strtok(v13, "\r"); 6220 strtok(nullptr, "\r");
6226 strtok(v2, "\r");
6227 v30 = 1; 6221 v30 = 1;
6228 v31 = &v1->array_16544[0].field_4[1]; 6222 v31 = &array_16544[0].field_4[1];
6223
6224 char *v2 = 0;
6229 while ( 2 ) 6225 while ( 2 )
6230 { 6226 {
6231 v14 = strtok(v2, "\r") + 1; 6227 v14 = strtok(nullptr, "\r") + 1;
6232 v27 = 0; 6228 v27 = 0;
6233 v24 = v2; 6229 char *v24 = nullptr;
6234 do 6230 do
6235 { 6231 {
6236 v15 = *v14; 6232 v15 = *v14;
6237 v16 = 0; 6233 v16 = 0;
6238 if ( *v14 != 9 ) 6234 if ( *v14 != 9 )
6259 v18 = v2 == 0; 6255 v18 = v2 == 0;
6260 if ( (signed int)v2 > 0 ) 6256 if ( (signed int)v2 > 0 )
6261 { 6257 {
6262 if ( (signed int)v2 < 77 ) 6258 if ( (signed int)v2 < 77 )
6263 { 6259 {
6264 v1->array_16544[(int)v2].field_4[v30] = atoi(v14); 6260 array_16544[(int)v2].field_4[v30] = atoi(v14);
6265 goto LABEL_54; 6261 goto LABEL_54;
6266 } 6262 }
6267 v18 = v2 == 0; 6263 v18 = v2 == 0;
6268 } 6264 }
6269 if ( v18 ) 6265 if ( v18 )
6281 v2 = 0; 6277 v2 = 0;
6282 continue; 6278 continue;
6283 } 6279 }
6284 break; 6280 break;
6285 } 6281 }
6286 v19 = v1->array_16544; 6282 v19 = array_16544;
6287 v20 = 77; 6283 v20 = 77;
6288 do 6284 do
6289 { 6285 {
6290 v19->field_0 = 0; 6286 v19->field_0 = 0;
6291 v21 = 1; 6287 v21 = 1;
6294 while ( v21 < 59 ); 6290 while ( v21 < 59 );
6295 ++v19; 6291 ++v19;
6296 --v20; 6292 --v20;
6297 } 6293 }
6298 while ( v20 ); 6294 while ( v20 );
6299 if ( v1->pNPCDistTXT_Raw ) 6295
6300 { 6296 if (pNPCDistTXT_Raw)
6301 pAllocator->FreeChunk(v1->pNPCDistTXT_Raw); 6297 {
6302 v1->pNPCDistTXT_Raw = 0; 6298 pAllocator->FreeChunk(pNPCDistTXT_Raw);
6299 pNPCDistTXT_Raw = nullptr;
6303 } 6300 }
6304 } 6301 }
6305 6302
6306 //----- (00476C60) -------------------------------------------------------- 6303 //----- (00476C60) --------------------------------------------------------
6307 void NPCStats::_476C60() 6304 void NPCStats::_476C60()
6567 } 6564 }
6568 6565
6569 //----- (0047702F) -------------------------------------------------------- 6566 //----- (0047702F) --------------------------------------------------------
6570 void NPCStats::Initialize() 6567 void NPCStats::Initialize()
6571 { 6568 {
6572 NPCStats *v1; // edi@1 6569 //NPCStats *v1; // edi@1
6573 char *v2; // ebx@1 6570 char *v2; // ebx@1
6574 char *v3; // eax@1 6571 //char *v3; // eax@1
6575 char *v4; // ebx@3 6572 char *v4; // ebx@3
6576 char v5; // al@4 6573 char v5; // al@4
6577 int v6; // ecx@4 6574 int v6; // ecx@4
6578 char *v7; // eax@18 6575 //char *v7; // eax@18
6579 char *v8; // ebx@18 6576 char *v8; // ebx@18
6580 char *v9; // ecx@19 6577 char *v9; // ecx@19
6581 char v10; // dl@20 6578 char v10; // dl@20
6582 int v11; // eax@20 6579 int v11; // eax@20
6583 char v12; // zf@41 6580 char v12; // zf@41
6588 signed int v17; // [sp+14h] [bp-Ch]@19 6585 signed int v17; // [sp+14h] [bp-Ch]@19
6589 unsigned int v18; // [sp+18h] [bp-8h]@1 6586 unsigned int v18; // [sp+18h] [bp-8h]@1
6590 char *v19; // [sp+18h] [bp-8h]@18 6587 char *v19; // [sp+18h] [bp-8h]@18
6591 signed int v20; // [sp+1Ch] [bp-4h]@3 6588 signed int v20; // [sp+1Ch] [bp-4h]@3
6592 signed int v21; // [sp+1Ch] [bp-4h]@19 6589 signed int v21; // [sp+1Ch] [bp-4h]@19
6593 6590 //v1 = this;
6594 v1 = this;
6595 6591
6596 Initialize1(); 6592 Initialize1();
6597 Initialize2(); 6593 Initialize2();
6598 6594
6599 InitializeQuests(); 6595 InitializeQuests();
6601 InitializeAwards(); 6597 InitializeAwards();
6602 InitializeTransitions(); 6598 InitializeTransitions();
6603 InitializeMerchants(); 6599 InitializeMerchants();
6604 InitializeScrolls(); 6600 InitializeScrolls();
6605 v2 = 0; 6601 v2 = 0;
6606 v1->field_17FC0 = 0; 6602 field_17FC0 = 0;
6607 v1->pNPCNamesTXT_Raw = 0; 6603 pNPCNamesTXT_Raw = 0;
6608 v3 = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0); 6604 //v3 = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0);
6609 v1->pNPCNamesTXT_Raw = v3; 6605 pNPCNamesTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcnames.txt", 0);
6610 strtok(v3, "\r"); 6606 strtok(pNPCNamesTXT_Raw, "\r");
6611 v18 = 0; 6607 v18 = 0;
6612 v16 = (char *)v1->pNPCNames; 6608 v16 = (char *)pNPCNames;
6613 while ( 1 ) 6609 while ( 1 )
6614 { 6610 {
6615 v4 = strtok(v2, "\r") + 1; 6611 v4 = strtok(v2, "\r") + 1;
6616 v20 = 0; 6612 v20 = 0;
6617 do 6613 do
6646 } 6642 }
6647 } 6643 }
6648 else 6644 else
6649 { 6645 {
6650 LABEL_45: 6646 LABEL_45:
6651 if ( v20 == 1 && !v1->uNumNPCNames[1] ) 6647 if ( v20 == 1 && !uNumNPCNames[1] )
6652 v1->uNumNPCNames[1] = v18; 6648 uNumNPCNames[1] = v18;
6653 } 6649 }
6654 ++v20; 6650 ++v20;
6655 v4 += v14 + 1; 6651 v4 += v14 + 1;
6656 } 6652 }
6657 while ( v20 <= 1 ); 6653 while ( v20 <= 1 );
6659 v16 += 8; 6655 v16 += 8;
6660 if ( (signed int)v18 >= 540 ) 6656 if ( (signed int)v18 >= 540 )
6661 break; 6657 break;
6662 v2 = 0; 6658 v2 = 0;
6663 } 6659 }
6664 v1->pNPCProfTXT_Raw = 0; 6660 pNPCProfTXT_Raw = 0;
6665 v1->uNumNPCNames[0] = v18; 6661 uNumNPCNames[0] = v18;
6666 v7 = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0); 6662 //v7 = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0);
6667 v1->pNPCProfTXT_Raw = v7; 6663 pNPCProfTXT_Raw = (char *)pEvents_LOD->LoadRaw("npcprof.txt", 0);
6668 strtok(v7, "\r"); 6664 strtok(pNPCProfTXT_Raw, "\r");
6669 strtok(0, "\r"); 6665 strtok(0, "\r");
6670 strtok(0, "\r"); 6666 strtok(0, "\r");
6671 strtok(0, "\r"); 6667 strtok(0, "\r");
6672 v8 = (char *)&v1->pProfessions[0].pJoinText; 6668 v8 = (char *)&pProfessions[0].pJoinText;
6673 v19 = (char *)&v1->pProfessions[0].pJoinText; 6669 v19 = (char *)&pProfessions[0].pJoinText;
6674 v13 = 58; 6670 v13 = 58;
6675 do 6671 do
6676 { 6672 {
6677 v21 = 0; 6673 v21 = 0;
6678 v9 = strtok(0, "\r") + 1; 6674 v9 = strtok(0, "\r") + 1;
6730 v8 += 20; 6726 v8 += 20;
6731 v12 = v13-- == 1; 6727 v12 = v13-- == 1;
6732 v19 = v8; 6728 v19 = v8;
6733 } 6729 }
6734 while ( !v12 ); 6730 while ( !v12 );
6735 v1->uNumNPCProfessions = 59; 6731 uNumNPCProfessions = 59;
6736 } 6732 }
6737 6733
6738 //----- (00477266) -------------------------------------------------------- 6734 //----- (00477266) --------------------------------------------------------
6739 void NPCStats::Release() 6735 void NPCStats::Release()
6740 { 6736 {
16874 v1 = pMapStats->GetMapInfo(pCurrentMapName); 16870 v1 = pMapStats->GetMapInfo(pCurrentMapName);
16875 if ( v1 ) 16871 if ( v1 )
16876 sprintfex(byte_591098, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s" 16872 sprintfex(byte_591098, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
16877 else 16873 else
16878 strcpy(byte_591098, pGlobalTXT_LocalizationStrings[79]);// "Exit" 16874 strcpy(byte_591098, pGlobalTXT_LocalizationStrings[79]);// "Exit"
16879 result = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, (enum WindowType)17, 0, (int)byte_591098); 16875 result = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)17, 0, (int)byte_591098);
16880 pDialogueWindow = result; 16876 pDialogueWindow = result;
16881 return result; 16877 return result;
16882 } 16878 }
16883 16879
16884 //----- (00444D80) -------------------------------------------------------- 16880 //----- (00444D80) --------------------------------------------------------
17064 pEventTimer->Resume(); 17060 pEventTimer->Resume();
17065 } 17061 }
17066 17062
17067 17063
17068 //----- (00445308) -------------------------------------------------------- 17064 //----- (00445308) --------------------------------------------------------
17069 int __fastcall sub_445308(int a1) 17065 const char *__fastcall sub_445308(int a1)
17070 { 17066 {
17071 int result; // eax@12
17072
17073 if ( a1 == 10 17067 if ( a1 == 10
17074 || a1 == 11 17068 || a1 == 11
17075 || a1 == 12 17069 || a1 == 12
17076 || a1 == 33 17070 || a1 == 33
17077 || a1 == 34 17071 || a1 == 34
17079 || a1 == 40 17073 || a1 == 40
17080 || a1 == 41 17074 || a1 == 41
17081 || a1 == 42 17075 || a1 == 42
17082 || a1 == 43 17076 || a1 == 43
17083 || a1 == 52 ) 17077 || a1 == 52 )
17084 result = *(&pNPCStats->field_13A60 + 5 * a1); 17078 return (const char *)*(&pNPCStats->field_13A60 + 5 * a1);
17085 else 17079 else
17086 result = dword_722320; 17080 return pNPCTopics[407].pTopic;
17087 return result;
17088 } 17081 }
17089 // 722320: using guessed type int dword_722320; 17082
17090 17083
17091 //----- (00445350) -------------------------------------------------------- 17084 //----- (00445350) --------------------------------------------------------
17092 void __cdecl DrawDialogueUI() 17085 void __cdecl DrawDialogueUI()
17093 { 17086 {
17094 NPCData *v0; // ebx@2 17087 NPCData *v0; // ebx@2
17244 } 17237 }
17245 goto LABEL_24; 17238 goto LABEL_24;
17246 } 17239 }
17247 if ( byte_5B0938[0] ) 17240 if ( byte_5B0938[0] )
17248 goto LABEL_24; 17241 goto LABEL_24;
17249 v7 = ptr_F8B1E8; 17242 v7 = (char *)ptr_F8B1E8;
17250 LABEL_37: 17243 LABEL_37:
17251 v8 = 0; 17244 v8 = 0;
17252 goto LABEL_38; 17245 goto LABEL_38;
17253 } 17246 }
17254 } 17247 }
18152 *v12 = 0; 18145 *v12 = 0;
18153 if ( pVideoPlayer->field_54 ) 18146 if ( pVideoPlayer->field_54 )
18154 pVideoPlayer->Unload(); 18147 pVideoPlayer->Unload();
18155 pVideoPlayer->bStopBeforeSchedule = 0; 18148 pVideoPlayer->bStopBeforeSchedule = 0;
18156 pVideoPlayer->field_40 = 0; 18149 pVideoPlayer->field_40 = 0;
18157 if ( pAsyncMouse ) 18150 if (pAsyncMouse)
18158 pAsyncMouse->Suspend(); 18151 pAsyncMouse->Suspend();
18159 v128 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; 18152 v128 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions;
18160 v13 = &pSomeEVT[v9]; 18153 v13 = &pSomeEVT[v9];
18161 v14 = (unsigned __int8)v13[5]; 18154 v14 = (unsigned __int8)v13[5];
18162 v15 = (unsigned __int8)v13[6]; 18155 v15 = (unsigned __int8)v13[6];
18191 if ( v128 == 3 ) 18184 if ( v128 == 3 )
18192 pGameLoadingUI_ProgressBar->uType = 1; 18185 pGameLoadingUI_ProgressBar->uType = 1;
18193 if ( v128 == 13 ) 18186 if ( v128 == 13 )
18194 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); 18187 pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u);
18195 } 18188 }
18196 if ( pAsyncMouse ) 18189 if (pAsyncMouse)
18197 pAsyncMouse->Resume(); 18190 pAsyncMouse->Resume();
18198 goto LABEL_291; 18191 goto LABEL_291;
18199 case EVENT_CheckSkill: 18192 case EVENT_CheckSkill:
18200 v19 = v10->f[7] + ((v10->f[8] + ((v10->f[9] + (v10->f[10] << 8)) << 8)) << 8); 18193 v19 = v10->f[7] + ((v10->f[8] + ((v10->f[9] + (v10->f[10] << 8)) << 8)) << 8);
18201 if ( v127 < 0 ) 18194 if ( v127 < 0 )
18337 ptr_507BC0->Release(); 18330 ptr_507BC0->Release();
18338 pParty->uFlags &= 0xFFFFFFFDu; 18331 pParty->uFlags &= 0xFFFFFFFDu;
18339 if ( EnterHouse((enum HOUSE_TYPE)170) ) 18332 if ( EnterHouse((enum HOUSE_TYPE)170) )
18340 { 18333 {
18341 pAudioPlayer->StopChannels(-1, -1); 18334 pAudioPlayer->StopChannels(-1, -1);
18342 ptr_507BC0 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior, 170, 0); 18335 ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0);
18343 ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, v7, 0); 18336 ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, v7, 0);
18344 ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, v7, 0); 18337 ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, v7, 0);
18345 ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, v7, 0); 18338 ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, v7, 0);
18346 ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, v7, 0); 18339 ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, v7, 0);
18347 ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, v7, 0); 18340 ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, v7, 0);
18348 ptr_F8B1E8 = (char *)dword_72193C; 18341 ptr_F8B1E8 = pNPCTopics[90].pText;
18349 } 18342 }
18350 } 18343 }
18351 } 18344 }
18352 goto LABEL_291; 18345 goto LABEL_291;
18353 case EVENT_NPCSetItem: 18346 case EVENT_NPCSetItem:
18415 pParty->uFlags &= 0xFFFFFFFDu; 18408 pParty->uFlags &= 0xFFFFFFFDu;
18416 _5C3420_pDecoration = (LevelDecoration *)1; 18409 _5C3420_pDecoration = (LevelDecoration *)1;
18417 if ( EnterHouse((enum HOUSE_TYPE)165) ) 18410 if ( EnterHouse((enum HOUSE_TYPE)165) )
18418 { 18411 {
18419 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); 18412 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
18420 v47 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior, 165, 0); 18413 v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0);
18421 ptr_507BC0 = v47; 18414 ptr_507BC0 = v47;
18422 v48 = v47->pControlsHead; 18415 v48 = v47->pControlsHead;
18423 if ( v48 ) 18416 if ( v48 )
18424 { 18417 {
18425 do 18418 do
19138 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); 19131 pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0);
19139 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0); 19132 pAudioPlayer->PlaySound(SOUND_EnteringAHouse, 814, 0, -1, 0, 0, 0, 0);
19140 v104 = 187; 19133 v104 = 187;
19141 if ( uCurrentHouse_Animation != 167 ) 19134 if ( uCurrentHouse_Animation != 167 )
19142 v104 = v103; 19135 v104 = v103;
19143 ptr_507BC0 = GUIWindow::Create(0, 0, 0x280u, 0x1E0u, WINDOW_HouseInterior, v104, 0); 19136 ptr_507BC0 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, v104, 0);
19144 ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, v7, 0); 19137 ptr_507BC0->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, v7, 0);
19145 ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, v7, 0); 19138 ptr_507BC0->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, v7, 0);
19146 ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, v7, 0); 19139 ptr_507BC0->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, v7, 0);
19147 ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, v7, 0); 19140 ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, v7, 0);
19148 ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, v7, 0); 19141 ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, v7, 0);