comparison mm7_4.cpp @ 254:d1af3319bc44

BuilDialogueString: replaces %xx in dialogue strings by appropriate values
author Nomad
date Mon, 18 Feb 2013 08:48:23 +0200
parents 83f85ab6079a
children 0a37a56e9f02
comparison
equal deleted inserted replaced
250:83f85ab6079a 254:d1af3319bc44
4834 } 4834 }
4835 return result; 4835 return result;
4836 } 4836 }
4837 4837
4838 //----- (00495461) -------------------------------------------------------- 4838 //----- (00495461) --------------------------------------------------------
4839 char *__fastcall sub_495461(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) 4839 char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6)
4840 { 4840 {
4841 unsigned __int8 v6; // bl@1 4841 unsigned __int8 v6; // bl@1
4842 Player *pPlayer; // ebx@3 4842 Player *pPlayer; // ebx@3
4843 NPCData *v9; // eax@4 4843 //NPCData *v9; // eax@4
4844 //size_t v10; // eax@6 4844 //size_t v10; // eax@6
4845 char *v11; // esi@7 4845 char *v11; // esi@7
4846 int v12; // edx@7 4846 //int v12; // edx@7
4847 ItemGen *v13; // edi@7 4847 //ItemGen *v13; // edi@7
4848 char v14; // cl@8 4848 //char v14; // cl@8
4849 char *v15; // ecx@10 4849 //char *v15; // ecx@10
4850 int v16; // edx@10 4850 //int v16; // edx@10
4851 int v17; // eax@10 4851 int v17; // eax@10
4852 signed __int64 v18; // qax@18 4852 signed __int64 v18; // qax@18
4853 unsigned int v19; // edi@32 4853 unsigned int v19; // edi@32
4854 unsigned __int8 *v20; // ebx@32 4854 unsigned __int8 *v20; // ebx@32
4855 int v21; // ecx@34 4855 int v21; // ecx@34
4889 __int16 v55[56]; // [sp+10h] [bp-128h]@34 4889 __int16 v55[56]; // [sp+10h] [bp-128h]@34
4890 stru351 v56; // [sp+80h] [bp-B8h]@107 4890 stru351 v56; // [sp+80h] [bp-B8h]@107
4891 stru351 v57; // [sp+9Ch] [bp-9Ch]@115 4891 stru351 v57; // [sp+9Ch] [bp-9Ch]@115
4892 char a1[100]; // [sp+B8h] [bp-80h]@3 4892 char a1[100]; // [sp+B8h] [bp-80h]@3
4893 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3 4893 unsigned int v59; // [sp+11Ch] [bp-1Ch]@3
4894 size_t v60; // [sp+120h] [bp-18h]@3 4894 //size_t v60; // [sp+120h] [bp-18h]@3
4895 //Player *v61; // [sp+124h] [bp-14h]@3 4895 //Player *v61; // [sp+124h] [bp-14h]@3
4896 //char *Str; // [sp+128h] [bp-10h]@1 4896 //char *Str; // [sp+128h] [bp-10h]@1
4897 int v63; // [sp+12Ch] [bp-Ch]@32 4897 int v63; // [sp+12Ch] [bp-Ch]@32
4898 int v64; // [sp+130h] [bp-8h]@6 4898 //int v64; // [sp+130h] [bp-8h]@6
4899 NPCData *v65; // [sp+134h] [bp-4h]@6 4899 //NPCData *v65; // [sp+134h] [bp-4h]@6
4900 //int packed;
4901
4902
4900 4903
4901 v6 = uPlayerID; 4904 v6 = uPlayerID;
4902 //Str = lpsz; 4905 //Str = lpsz;
4903 if ( IsBadStringPtrA(lpsz, 1u) ) 4906 if ( IsBadStringPtrA(lpsz, 1u) )
4904 return "Invalid String Passed"; 4907 return "Invalid String Passed";
4905 v60 = strlen(lpsz); 4908
4906 a1[0] = 0; 4909 a1[0] = 0;
4907 pPlayer = &pParty->pPlayers[v6]; 4910 pPlayer = &pParty->pPlayers[v6];
4908 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155); 4911 v59 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(255, 255, 155);
4909 //v61 = pPlayer; 4912 //v61 = pPlayer;
4910 memset(pTmpBuf2, 0, 0x7D0u); 4913 memset(pTmpBuf2, 0, sizeof(pTmpBuf2));
4914
4915 NPCData *npc = nullptr;
4911 if ( dword_5C35D4 ) 4916 if ( dword_5C35D4 )
4912 { 4917 {
4913 __debugbreak(); // fix 4918 __debugbreak(); // fix
4914 v9 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)]; 4919 npc = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)];
4915 } 4920 }
4916 else 4921 else
4917 v9 = GetNPCData(uDialogue_SpeakingActorNPC_ID); 4922 npc = GetNPCData(uDialogue_SpeakingActorNPC_ID);
4918 v65 = v9; 4923 //v65 = v9;
4919 //v10 = 0; 4924 //v10 = 0;
4920 v64 = 0; 4925 //v64 = 0;
4921 4926
4922 int i = 0; 4927 //int i = 0;
4923 if ( (signed int)v60 > 0 ) 4928 //if ( (signed int)v60 > 0 )
4924 { 4929 v11 = a4;
4925 v11 = a4; 4930
4926 v12 = v64; 4931 auto len = strlen(lpsz);
4927 v13 = a3; 4932 for (int i = 0, dst = 0; i < len; ++i)
4928 while ( 1 ) 4933 {
4929 { 4934 //v12 = v64;
4930 v14 = lpsz[v12]; 4935 //v13 = a3;
4931 if ( v14 == '%' ) 4936 //while ( 1 )
4932 break; 4937 //{
4933 pTmpBuf2[i++] = v14; 4938 char c = lpsz[i];
4934 LABEL_119: 4939 if (c != '%')
4935 ++v12; 4940 pTmpBuf2[dst++] = c;
4936 v64 = v12; 4941 else
4937 if ( v12 >= (signed int)v60 ) 4942 {
4938 return pTmpBuf2; 4943 //v15 = &lpsz[v12 + 1];
4939 } 4944 //v16 = (unsigned __int8)lpsz[v12 + 2];
4940 v15 = &lpsz[v12 + 1]; 4945 //packed = 10 * (int)lpsz[v12 + 1] + lpsz[v12 + 2];
4941 v16 = (unsigned __int8)lpsz[v12 + 2]; 4946 //v17 = packed - 528;// 10 * '0' + '0'
4942 v17 = v16 + 10 * (unsigned __int8)*v15 - 528; 4947 v17 = 10 * (int)(lpsz[i + 1] - '0') + lpsz[i + 2] - '0';
4943 4948
4944 if ( v17 <= 15 ) 4949 switch ( v17 )
4945 { 4950 {
4946 if ( v17 != 15 ) 4951 case 1:
4947 { 4952 v11 = npc->pName;
4948 switch ( v16 + 10 * (unsigned __int8)*v15 ) 4953 goto _continue_strcat;
4949 { 4954 case 2:
4950 case 0x211:
4951 v11 = v65->pName;
4952 goto LABEL_118;
4953 case 0x212:
4954 v11 = pPlayer->pName; 4955 v11 = pPlayer->pName;
4955 goto LABEL_118; 4956 goto _continue_strcat;
4956 case 0x213: 4957 case 3:
4957 case 0x219: 4958 case 4:
4958 if ( v65->uSex ) 4959 v11 = a1;
4959 v11 = pGlobalTXT_LocalizationStrings[384];// "her" 4960 goto _continue_strcat;
4960 else 4961 case 5:
4961 v11 = pGlobalTXT_LocalizationStrings[383];// "his"
4962 goto LABEL_118;
4963 case 0x215:
4964 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24; 4962 v18 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed * 0.234375) / 60 / 60 % 24;
4965 v11 = pGlobalTXT_LocalizationStrings[397];// "evening" 4963 v11 = pGlobalTXT_LocalizationStrings[397];// "evening"
4966 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 ) 4964 if ( SHIDWORD(v18) <= 0 && SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 5 && SHIDWORD(v18) <= 0 )
4967 { 4965 {
4968 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB ) 4966 if ( SHIDWORD(v18) >= 0 && (unsigned int)v18 >= 0xB )
4973 else 4971 else
4974 { 4972 {
4975 v11 = pGlobalTXT_LocalizationStrings[395];// "morning" 4973 v11 = pGlobalTXT_LocalizationStrings[395];// "morning"
4976 } 4974 }
4977 } 4975 }
4978 goto LABEL_118; 4976 goto _continue_strcat;
4979 case 0x216: 4977 case 6:
4980 if ( pPlayer->uSex ) 4978 if ( pPlayer->uSex )
4981 v11 = pGlobalTXT_LocalizationStrings[387];// "lady" 4979 v11 = pGlobalTXT_LocalizationStrings[387];// "lady"
4982 else 4980 else
4983 v11 = pGlobalTXT_LocalizationStrings[385];// "sir" 4981 v11 = pGlobalTXT_LocalizationStrings[385];// "sir"
4984 goto LABEL_118; 4982 goto _continue_strcat;
4985 case 0x217: 4983 case 7:
4986 if ( pPlayer->uSex ) 4984 if ( pPlayer->uSex )
4987 goto LABEL_43; 4985 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady"
4988 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir" 4986 else
4989 goto LABEL_118; 4987 v11 = pGlobalTXT_LocalizationStrings[386];// "Sir"
4990 case 0x218: 4988 goto _continue_strcat;
4989 case 8:
4991 v19 = 0; 4990 v19 = 0;
4992 v63 = 0; 4991 v63 = 0;
4993 v20 = (unsigned __int8 *)pPlayer->field_152; 4992 v20 = (unsigned __int8 *)pPlayer->field_152;
4994 do 4993 do
4995 { 4994 {
5017 else 5016 else
5018 { 5017 {
5019 v11 = (char *)pNPCTopics[55].pText; 5018 v11 = (char *)pNPCTopics[55].pText;
5020 } 5019 }
5021 //pPlayer = v61; 5020 //pPlayer = v61;
5022 v13 = a3; 5021 //v13 = a3;
5023 goto LABEL_118; 5022 goto _continue_strcat;
5024 case 0x21A: 5023 case 9:
5024 if ( npc->uSex )
5025 v11 = pGlobalTXT_LocalizationStrings[384];// "her"
5026 else
5027 v11 = pGlobalTXT_LocalizationStrings[383];// "his"
5028 goto _continue_strcat;
5029 case 10:
5025 if ( pPlayer->uSex ) 5030 if ( pPlayer->uSex )
5026 LABEL_43:
5027 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady" 5031 v11 = pGlobalTXT_LocalizationStrings[389];// "Lady"
5028 else 5032 else
5029 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord" 5033 v11 = pGlobalTXT_LocalizationStrings[388];// "Lord"
5030 goto LABEL_118; 5034 goto _continue_strcat;
5031 case 0x21B: 5035 case 11:
5032 v25 = GetPartyReputation(); 5036 v25 = GetPartyReputation();
5033 goto LABEL_46; 5037 goto LABEL_46;
5034 case 0x21C: 5038 case 12:
5035 v25 = v65->rep; 5039 v25 = npc->rep;
5036 LABEL_46: 5040 LABEL_46:
5037 if ( v25 >= 25 ) 5041 if ( v25 >= 25 )
5038 { 5042 {
5039 v11 = pGlobalTXT_LocalizationStrings[379]; 5043 v11 = pGlobalTXT_LocalizationStrings[379];
5040 } 5044 }
5057 else 5061 else
5058 { 5062 {
5059 v11 = pGlobalTXT_LocalizationStrings[392]; 5063 v11 = pGlobalTXT_LocalizationStrings[392];
5060 } 5064 }
5061 } 5065 }
5062 goto LABEL_118; 5066 goto _continue_strcat;
5063 case 0x21D: 5067 case 13:
5064 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); 5068 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex);
5065 goto LABEL_118; 5069 goto _continue_strcat;
5066 case 0x21E: 5070 case 14:
5067 goto LABEL_93; 5071 {
5068 case 0x214: 5072 if ( npc->uSex )
5073 v11 = pGlobalTXT_LocalizationStrings[391];// "sister"
5074 else
5075 v11 = pGlobalTXT_LocalizationStrings[390];// "brother"
5076 goto _continue_strcat;
5077 }
5078
5079 case 15:
5080 {
5081 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter"
5082 _continue_strcat:
5083 strcat(pTmpBuf2, v11);
5084 dst = strlen(pTmpBuf2);
5085 //v64 += 2;
5086 i += 2;
5087 }
5088 break;
5089
5090 case 16:
5091 {
5092 if ( npc->uSex )
5093 v11 = pGlobalTXT_LocalizationStrings[391];// "sister"
5094 else
5095 v11 = pGlobalTXT_LocalizationStrings[390];// "brother"
5096 goto _continue_strcat;
5097 }
5098 case 17:
5099 {
5100 auto pay_percentage = pNPCStats->pProfessions[npc->uProfession - 1].uHirePrice / 100;
5101 if (!pay_percentage)
5102 pay_percentage = 1;
5103
5104 sprintf(a1, "%lu", pay_percentage);
5069 v11 = a1; 5105 v11 = a1;
5070 goto LABEL_118; 5106 goto _continue_strcat;
5071 default: 5107 }
5072 goto LABEL_108; 5108
5073 } 5109 case 18:
5074 goto LABEL_108; 5110 case 19:
5075 } 5111 case 20:
5076 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" 5112 case 21:
5077 LABEL_118: 5113 case 22:
5078 strcat(pTmpBuf2, v11); 5114 case 26:
5079 i = strlen(pTmpBuf2); 5115 _continue_strncpy:
5080 v64 += 2; 5116 strncpy(a1, lpsz + i + 1, 2);
5081 v12 = v64; 5117 v51 = atoi(a1);
5082 goto LABEL_119; 5118 sprintf(a1, "%lu", v51);
5083 }
5084 if ( v17 <= 29 )
5085 {
5086 if ( v17 == 29 )
5087 {
5088 //v34 = p2DEvents_minus1__20[13 * (signed int)a4];
5089 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
5090 }
5091 else
5092 {
5093 if ( v16 + 10 * (unsigned __int8)*v15 == 544 )
5094 {
5095 LABEL_93:
5096 if ( v65->uSex )
5097 v11 = pGlobalTXT_LocalizationStrings[391];// "sister"
5098 else
5099 v11 = pGlobalTXT_LocalizationStrings[390];// "brother"
5100 goto LABEL_118;
5101 }
5102 if ( v16 + 10 * (unsigned __int8)*v15 == 545 )
5103 {
5104 v29 = *(&pNPCStats->field_13A58 + 5 * v65->uProfession) / 100;
5105 goto LABEL_91;
5106 }
5107 if ( v16 + 10 * (unsigned __int8)*v15 == 551 )
5108 {
5109 v47 = pMapStats->GetMapInfo(pCurrentMapName);
5110 if ( v47 )
5111 v11 = pMapStats->pInfos[v47].pName;
5112 else
5113 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown"
5114 goto LABEL_118;
5115 }
5116 if ( v16 + 10 * (unsigned __int8)*v15 == 552 )
5117 {
5118 v46 = v13->GetDisplayName();
5119 sprintf(a1, format_4E2D80, v59, v46);
5120 v11 = a1; 5119 v11 = a1;
5121 goto LABEL_118; 5120 goto _continue_strcat;
5122 } 5121
5123 if ( v16 + 10 * (unsigned __int8)*v15 == 553 ) 5122 case 23:
5124 { 5123 {
5125 //v37 = &p2DEvents_minus1__20[13 * (signed int)a4]; 5124 v47 = pMapStats->GetMapInfo(pCurrentMapName);
5126 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; 5125 if ( v47 )
5127 v38 = *v37; 5126 v11 = pMapStats->pInfos[v47].pName;
5128 v39 = v13->GetValue(); 5127 else
5129 v29 = pPlayer->_4B8233(v39, v38); 5128 v11 = pGlobalTXT_LocalizationStrings[394];// "Unknown"
5129 goto _continue_strcat;
5130 }
5131 case 24:
5132 {
5133 v46 = a3->GetDisplayName();
5134 sprintf(a1, format_4E2D80, v59, v46);
5135 v11 = a1;
5136 goto _continue_strcat;
5137 }
5138
5139
5140 case 25:
5141 {
5142 v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
5143 v38 = *v37;
5144 v39 = a3->GetValue();
5145 v29 = pPlayer->_4B8233(v39, v38);
5130 switch ( a5 ) 5146 switch ( a5 )
5131 { 5147 {
5132 case 3: 5148 case 3:
5133 v44 = *v37; 5149 v44 = *v37;
5134 v45 = v13->GetValue(); 5150 v45 = a3->GetValue();
5135 v29 = pPlayer->_4B8213(v45, v44); 5151 v29 = pPlayer->_4B8213(v45, v44);
5136 break; 5152 break;
5137 case 4: 5153 case 4:
5138 v29 = pPlayer->_4B824B(*v37); 5154 v29 = pPlayer->_4B824B(*v37);
5139 break; 5155 break;
5140 case 5: 5156 case 5:
5141 v42 = *v37; 5157 v42 = *v37;
5142 v43 = v13->GetValue(); 5158 v43 = a3->GetValue();
5143 v29 = pPlayer->_4B8265(v43, v42); 5159 v29 = pPlayer->_4B8265(v43, v42);
5144 break; 5160 break;
5145 case 6: 5161 case 6:
5146 v40 = *v37; 5162 v40 = *v37;
5147 v41 = v13->GetValue(); 5163 v41 = a3->GetValue();
5148 v29 = pPlayer->_4B8213(v41, v40) / 2; 5164 v29 = pPlayer->_4B8213(v41, v40) / 2;
5149 break; 5165 break;
5166 }
5167 goto _continue_sprintf;
5150 } 5168 }
5151 goto LABEL_98; 5169
5152 } 5170 case 27:
5153 if ( v16 + 10 * (unsigned __int8)*v15 != 555 )
5154 {
5155 if ( v16 + 10 * (unsigned __int8)*v15 == 556 )
5156 { 5171 {
5157 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4]; 5172 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
5158 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle;
5159 goto LABEL_118;
5160 }
5161 LABEL_108:
5162 strncpy(a1, v15, 2u);
5163 v51 = atoi(a1);
5164 sprintf(a1, "%lu", v51);
5165 v11 = a1;
5166 goto LABEL_118;
5167 }
5168 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
5169 v27 = *v26; 5173 v27 = *v26;
5170 v28 = v13->GetValue(); 5174 v28 = a3->GetValue();
5171 v29 = pPlayer->_4B8142(v28, v27); 5175 v29 = pPlayer->_4B8142(v28, v27);
5172 if ( a5 == 3 ) 5176 if ( a5 == 3 )
5173 { 5177 {
5174 v35 = *v26; 5178 v35 = *v26;
5175 v36 = v13->GetValue(); 5179 v36 = a3->GetValue();
5176 v29 = pPlayer->_4B8102(v36, v35); 5180 v29 = pPlayer->_4B8102(v36, v35);
5177 if ( v13->uAttributes & 2 ) 5181 if ( a3->uAttributes & 2 )
5178 {
5179 LABEL_77:
5180 v29 = 1; 5182 v29 = 1;
5181 goto LABEL_98; 5183 goto _continue_sprintf;
5182 }
5183 goto LABEL_98;
5184 } 5184 }
5185 if ( a5 != 4 ) 5185 if ( a5 != 4 )
5186 { 5186 {
5187 if ( a5 == 5 ) 5187 if ( a5 == 5 )
5188 { 5188 {
5189 v32 = *v26; 5189 v32 = *v26;
5190 v33 = v13->GetValue(); 5190 v33 = a3->GetValue();
5191 v29 = pPlayer->_4B81C3(v33, v32); 5191 v29 = pPlayer->_4B81C3(v33, v32);
5192 } 5192 }
5193 else 5193 else
5194 { 5194 {
5195 if ( a5 == 6 ) 5195 if ( a5 == 6 )
5196 { 5196 {
5197 v30 = *v26; 5197 v30 = *v26;
5198 v31 = v13->GetValue(); 5198 v31 = a3->GetValue();
5199 v29 = pPlayer->_4B8102(v31, v30) / 2; 5199 v29 = pPlayer->_4B8102(v31, v30) / 2;
5200 if ( v13->uAttributes & 2 ) 5200 if ( a3->uAttributes & 2 )
5201 v29 = 1; 5201 v29 = 1;
5202 LABEL_91: 5202 if (!v29)
5203 if ( v29 >= 1 ) 5203 v29 = 1;
5204 goto LABEL_98; 5204 goto _continue_sprintf;
5205 goto LABEL_77;
5206 } 5205 }
5207 } 5206 }
5208 LABEL_98: 5207 _continue_sprintf:
5209 sprintf(a1, "%lu", v29); 5208 sprintf(a1, "%lu", v29);
5210 v11 = a1; 5209 v11 = a1;
5211 goto LABEL_118; 5210 goto _continue_strcat;
5212 } 5211 }
5213 v34 = *v26; 5212 v34 = *v26;
5214 } 5213
5215 v48 = v34; 5214 v48 = v34;
5216 v29 = pPlayer->_4B8179(v48); 5215 v29 = pPlayer->_4B8179(v48);
5217 goto LABEL_98; 5216 goto _continue_sprintf;
5218 } 5217 }
5219 if ( v17 != 30 ) 5218
5220 { 5219 case 28:
5221 switch ( v17 )
5222 {
5223 case 31:
5224 v52 = pPlayers[1];
5225 break;
5226 case 32:
5227 v52 = pPlayers[2];
5228 break;
5229 case 33:
5230 v52 = pPlayers[3];
5231 break;
5232 default:
5233 if ( v17 != 34 )
5234 { 5220 {
5221 //v11 = (char *)p2DEvents_minus1__10[13 * (signed int)a4];
5222 v11 = (char *)p2DEvents[(signed int)a4 - 1].pProprieterTitle;
5223 goto _continue_strcat;
5224 }
5225
5226 case 29:
5227 {
5228 //v34 = p2DEvents_minus1__20[13 * (signed int)a4];
5229 v34 = p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
5230 v48 = v34;
5231 v29 = pPlayer->_4B8179(v48);
5232 goto _continue_sprintf;
5233 }
5234
5235 case 30:
5236 {
5237 if ( !a6 )
5238 goto _continue_strcat;
5239 sub_493F79(&v57, *a6);
5240 v54 = v57.field_18;
5241 v53 = v57.field_C + 1;
5242 v50 = v57.field_14;
5243 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
5244 v11 = a1;
5245 goto _continue_strcat;
5246 }
5247
5248 case 31:
5249 case 32:
5250 case 33:
5251 case 34:
5252 v52 = &pParty->pPlayers[v17 - 31];
5253 v11 = v52->pName;
5254 goto _continue_strcat;
5255
5256 default:
5235 if ( v17 <= 50 || v17 > 70 ) 5257 if ( v17 <= 50 || v17 > 70 )
5236 goto LABEL_108; 5258 goto _continue_strncpy;
5237 if ( v16 + 10 * (unsigned __int8)*v15 - 579 >= 20 ) 5259 if ( v17 - 51 >= 20 )
5238 goto LABEL_118; 5260 goto _continue_strcat;
5239 HIDWORD(v49) = pParty->field_3C.field_440[2 * v17 + 1]; 5261 HIDWORD(v49) = pParty->field_3C.field_440[2 * v17 + 1];
5240 LODWORD(v49) = pParty->field_3C.field_440[2 * v17]; 5262 LODWORD(v49) = pParty->field_3C.field_440[2 * v17];
5241 sub_493F79(&v56, v49); 5263 sub_493F79(&v56, v49);
5242 v54 = v56.field_18; 5264 v54 = v56.field_18;
5243 v53 = v56.field_C + 1; 5265 v53 = v56.field_C + 1;
5244 v50 = v56.field_14; 5266 v50 = v56.field_14;
5245 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); 5267 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
5246 v11 = a1; 5268 v11 = a1;
5247 goto LABEL_118; 5269 goto _continue_strcat;
5248 } 5270 }
5249 v52 = pPlayers[4]; 5271 }
5250 break;
5251 }
5252 v11 = v52->pName;
5253 goto LABEL_118;
5254 }
5255 if ( !a6 )
5256 goto LABEL_118;
5257 sub_493F79(&v57, *a6);
5258 v54 = v57.field_18;
5259 v53 = v57.field_C + 1;
5260 v50 = v57.field_14;
5261 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
5262 v11 = a1;
5263 goto LABEL_118;
5264 } 5272 }
5265 return pTmpBuf2; 5273 return pTmpBuf2;
5266 } 5274 }
5267 5275
5268 //----- (00495B39) -------------------------------------------------------- 5276 //----- (00495B39) --------------------------------------------------------
9433 else 9441 else
9434 { 9442 {
9435 if ( a1 == 13 ) 9443 if ( a1 == 13 )
9436 { 9444 {
9437 ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); 9445 ptr_F8B1E8 = (char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession);
9438 ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); 9446 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0);
9439 sub_4B40E6(); 9447 sub_4B40E6();
9440 dialogue_show_profession_details = false; 9448 dialogue_show_profession_details = false;
9441 goto _return; 9449 goto _return;
9442 } 9450 }
9443 switch ( a1 ) 9451 switch ( a1 )
9507 if (dialogue_show_profession_details) 9515 if (dialogue_show_profession_details)
9508 v17 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText; 9516 v17 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText;
9509 else 9517 else
9510 v17 = pNPCStats->pProfessions[v2->uProfession - 1].pBenefits; 9518 v17 = pNPCStats->pProfessions[v2->uProfession - 1].pBenefits;
9511 ptr_F8B1E8 = v17; 9519 ptr_F8B1E8 = v17;
9512 v18 = sub_495461(v17, uActiveCharacter - 1, 0, 0, 0, 0); 9520 v18 = BuilDialogueString(v17, uActiveCharacter - 1, 0, 0, 0, 0);
9513 dialogue_show_profession_details = ~dialogue_show_profession_details; 9521 dialogue_show_profession_details = ~dialogue_show_profession_details;
9514 ptr_F8B1E8 = v18; 9522 ptr_F8B1E8 = v18;
9515 } 9523 }
9516 else 9524 else
9517 { 9525 {
9634 { 9642 {
9635 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); 9643 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);
9636 dialogue_show_profession_details = false; 9644 dialogue_show_profession_details = false;
9637 uDialogueType = 13; 9645 uDialogueType = 13;
9638 ptr_F8B1E8 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText; 9646 ptr_F8B1E8 = pNPCStats->pProfessions[v2->uProfession - 1].pJoinText;
9639 ptr_F8B1E8 = sub_495461((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); 9647 ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0);
9640 if ( uActiveCharacter ) 9648 if ( uActiveCharacter )
9641 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0); 9649 pPlayers[uActiveCharacter]->PlaySound(SPEECH_NotEnoughGold, 0);
9642 v19 = pGlobalTXT_LocalizationStrings[155]; 9650 v19 = pGlobalTXT_LocalizationStrings[155];
9643 goto LABEL_77; 9651 goto LABEL_77;
9644 } 9652 }
12277 v96 = 0; 12285 v96 = 0;
12278 v94 = 4; 12286 v94 = 4;
12279 v4 = (char *)&_this->pInventoryItems[result-1]; 12287 v4 = (char *)&_this->pInventoryItems[result-1];
12280 if ( v4[20] & 1 ) 12288 if ( v4[20] & 1 )
12281 { 12289 {
12282 v5 = sub_495461("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)ptr_507BC0->ptr_1C, 4, 0); 12290 v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)ptr_507BC0->ptr_1C, 4, 0);
12283 v97 = 3; 12291 v97 = 3;
12284 v95 = v5; 12292 v95 = v5;
12285 v92 = white; 12293 v92 = white;
12286 v6 = (212 - pFontArrus->CalcTextHeight(v5, &v112, 0, 0)) / 2 + 101; 12294 v6 = (212 - pFontArrus->CalcTextHeight(v5, &v112, 0, 0)) / 2 + 101;
12287 return (int)v112.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); 12295 return (int)v112.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97);
12321 uPlayerID = uActiveCharacter - 1; 12329 uPlayerID = uActiveCharacter - 1;
12322 v13 = _this->_490EEE(v90, 3, v12, 3); 12330 v13 = _this->_490EEE(v90, 3, v12, 3);
12323 v9 = uPlayerID; 12331 v9 = uPlayerID;
12324 v10 = (char *)pMerchantsSellPhrases[v13]; 12332 v10 = (char *)pMerchantsSellPhrases[v13];
12325 LABEL_35: 12333 LABEL_35:
12326 v30 = sub_495461(v10, v9, v90, (char *)v93, v94, v96); 12334 v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96);
12327 v97 = 3; 12335 v97 = 3;
12328 v95 = v30; 12336 v95 = v30;
12329 v92 = white; 12337 v92 = white;
12330 v91 = v3; 12338 v91 = v3;
12331 v89 = v3; 12339 v89 = v3;
13070 v17 = v1->_490EEE( 13078 v17 = v1->_490EEE(
13071 (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 13079 (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14,
13072 3, 13080 3,
13073 v16, 13081 v16,
13074 2); 13082 2);
13075 v18 = sub_495461((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0); 13083 v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0);
13076 v44 = 3; 13084 v44 = 3;
13077 v43 = v18; 13085 v43 = v18;
13078 v42 = v56; 13086 v42 = v56;
13079 v41 = 0; 13087 v41 = 0;
13080 v40 = 0; 13088 v40 = 0;