comparison mm7_4.cpp @ 250:83f85ab6079a

sprintfex fix
author Nomad
date Mon, 18 Feb 2013 07:26:48 +0200
parents 9a8d37c07e50
children d1af3319bc44 2d6dda2e0405
comparison
equal deleted inserted replaced
249:9a8d37c07e50 250:83f85ab6079a
4839 char *__fastcall sub_495461(char *lpsz, unsigned __int8 uPlayerID, ItemGen *a3, char *a4, int a5, __int64 *a6) 4839 char *__fastcall sub_495461(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
4914 v9 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)]; 4914 v9 = array_5913D8[(unsigned int)((char *)array_5913D8[6] + -(dword_591080 != 0) - 1)];
4915 } 4915 }
4916 else 4916 else
4917 v9 = GetNPCData(uDialogue_SpeakingActorNPC_ID); 4917 v9 = GetNPCData(uDialogue_SpeakingActorNPC_ID);
4918 v65 = v9; 4918 v65 = v9;
4919 v10 = 0; 4919 //v10 = 0;
4920 v64 = 0; 4920 v64 = 0;
4921
4922 int i = 0;
4921 if ( (signed int)v60 > 0 ) 4923 if ( (signed int)v60 > 0 )
4922 { 4924 {
4923 v11 = a4; 4925 v11 = a4;
4924 v12 = v64; 4926 v12 = v64;
4925 v13 = a3; 4927 v13 = a3;
4926 while ( 1 ) 4928 while ( 1 )
4927 { 4929 {
4928 v14 = lpsz[v12]; 4930 v14 = lpsz[v12];
4929 if ( v14 == 37 ) 4931 if ( v14 == '%' )
4930 break; 4932 break;
4931 pTmpBuf2[v10++] = v14; 4933 pTmpBuf2[i++] = v14;
4932 LABEL_119: 4934 LABEL_119:
4933 ++v12; 4935 ++v12;
4934 v64 = v12; 4936 v64 = v12;
4935 if ( v12 >= (signed int)v60 ) 4937 if ( v12 >= (signed int)v60 )
4936 return pTmpBuf2; 4938 return pTmpBuf2;
4937 } 4939 }
4938 v15 = &lpsz[v12 + 1]; 4940 v15 = &lpsz[v12 + 1];
4939 v16 = (unsigned __int8)lpsz[v12 + 2]; 4941 v16 = (unsigned __int8)lpsz[v12 + 2];
4940 v17 = v16 + 10 * (unsigned __int8)*v15 - 528; 4942 v17 = v16 + 10 * (unsigned __int8)*v15 - 528;
4943
4941 if ( v17 <= 15 ) 4944 if ( v17 <= 15 )
4942 { 4945 {
4943 if ( v17 != 15 ) 4946 if ( v17 != 15 )
4944 { 4947 {
4945 switch ( v16 + 10 * (unsigned __int8)*v15 ) 4948 switch ( v16 + 10 * (unsigned __int8)*v15 )
5061 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex); 5064 v11 = sub_495366(pPlayer->pName[0], pPlayer->uSex);
5062 goto LABEL_118; 5065 goto LABEL_118;
5063 case 0x21E: 5066 case 0x21E:
5064 goto LABEL_93; 5067 goto LABEL_93;
5065 case 0x214: 5068 case 0x214:
5066 goto LABEL_117; 5069 v11 = a1;
5070 goto LABEL_118;
5067 default: 5071 default:
5068 goto LABEL_108; 5072 goto LABEL_108;
5069 } 5073 }
5070 goto LABEL_108; 5074 goto LABEL_108;
5071 } 5075 }
5072 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter" 5076 v11 = pGlobalTXT_LocalizationStrings[393];// "daughter"
5073 LABEL_118: 5077 LABEL_118:
5074 strcat(pTmpBuf2, v11); 5078 strcat(pTmpBuf2, v11);
5075 v10 = strlen(pTmpBuf2); 5079 i = strlen(pTmpBuf2);
5076 v64 += 2; 5080 v64 += 2;
5077 v12 = v64; 5081 v12 = v64;
5078 goto LABEL_119; 5082 goto LABEL_119;
5079 } 5083 }
5080 if ( v17 <= 29 ) 5084 if ( v17 <= 29 )
5111 } 5115 }
5112 if ( v16 + 10 * (unsigned __int8)*v15 == 552 ) 5116 if ( v16 + 10 * (unsigned __int8)*v15 == 552 )
5113 { 5117 {
5114 v46 = v13->GetDisplayName(); 5118 v46 = v13->GetDisplayName();
5115 sprintf(a1, format_4E2D80, v59, v46); 5119 sprintf(a1, format_4E2D80, v59, v46);
5116 LABEL_117:
5117 v11 = a1; 5120 v11 = a1;
5118 goto LABEL_118; 5121 goto LABEL_118;
5119 } 5122 }
5120 if ( v16 + 10 * (unsigned __int8)*v15 == 553 ) 5123 if ( v16 + 10 * (unsigned __int8)*v15 == 553 )
5121 { 5124 {
5157 } 5160 }
5158 LABEL_108: 5161 LABEL_108:
5159 strncpy(a1, v15, 2u); 5162 strncpy(a1, v15, 2u);
5160 v51 = atoi(a1); 5163 v51 = atoi(a1);
5161 sprintf(a1, "%lu", v51); 5164 sprintf(a1, "%lu", v51);
5162 goto LABEL_117; 5165 v11 = a1;
5166 goto LABEL_118;
5163 } 5167 }
5164 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier; 5168 v26 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
5165 v27 = *v26; 5169 v27 = *v26;
5166 v28 = v13->GetValue(); 5170 v28 = v13->GetValue();
5167 v29 = pPlayer->_4B8142(v28, v27); 5171 v29 = pPlayer->_4B8142(v28, v27);
5201 goto LABEL_77; 5205 goto LABEL_77;
5202 } 5206 }
5203 } 5207 }
5204 LABEL_98: 5208 LABEL_98:
5205 sprintf(a1, "%lu", v29); 5209 sprintf(a1, "%lu", v29);
5206 goto LABEL_117; 5210 v11 = a1;
5211 goto LABEL_118;
5207 } 5212 }
5208 v34 = *v26; 5213 v34 = *v26;
5209 } 5214 }
5210 v48 = v34; 5215 v48 = v34;
5211 v29 = pPlayer->_4B8179(v48); 5216 v29 = pPlayer->_4B8179(v48);
5235 LODWORD(v49) = pParty->field_3C.field_440[2 * v17]; 5240 LODWORD(v49) = pParty->field_3C.field_440[2 * v17];
5236 sub_493F79(&v56, v49); 5241 sub_493F79(&v56, v49);
5237 v54 = v56.field_18; 5242 v54 = v56.field_18;
5238 v53 = v56.field_C + 1; 5243 v53 = v56.field_C + 1;
5239 v50 = v56.field_14; 5244 v50 = v56.field_14;
5240 LABEL_116:
5241 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54); 5245 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
5242 goto LABEL_117; 5246 v11 = a1;
5247 goto LABEL_118;
5243 } 5248 }
5244 v52 = pPlayers[4]; 5249 v52 = pPlayers[4];
5245 break; 5250 break;
5246 } 5251 }
5247 v11 = v52->pName; 5252 v11 = v52->pName;
5251 goto LABEL_118; 5256 goto LABEL_118;
5252 sub_493F79(&v57, *a6); 5257 sub_493F79(&v57, *a6);
5253 v54 = v57.field_18; 5258 v54 = v57.field_18;
5254 v53 = v57.field_C + 1; 5259 v53 = v57.field_C + 1;
5255 v50 = v57.field_14; 5260 v50 = v57.field_14;
5256 goto LABEL_116; 5261 sprintf(a1, pGlobalTXT_LocalizationStrings[378], aMonthNames[v50], v53, v54);
5262 v11 = a1;
5263 goto LABEL_118;
5257 } 5264 }
5258 return pTmpBuf2; 5265 return pTmpBuf2;
5259 } 5266 }
5260 5267
5261 //----- (00495B39) -------------------------------------------------------- 5268 //----- (00495B39) --------------------------------------------------------