comparison mm7_2.cpp @ 532:a4fe569c0d63

TownHallDialog clean
author zipi
date Sun, 03 Mar 2013 12:22:14 +0000
parents 72a92f0ec766
children 0193f10fecbf
comparison
equal deleted inserted replaced
531:72a92f0ec766 532:a4fe569c0d63
148 _this.uFrameZ = 334; 148 _this.uFrameZ = 334;
149 v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 149 v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
150 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 150 v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
151 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine); 151 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine);
152 _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u); 152 _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u);
153 if ( dword_F8B19C == 1 ) 153 switch(dword_F8B19C)
154 { 154 {
155 v11 = 1; 155 case 1:
156 pOutString = 0; 156 {
157 pShopOptions[0] = pGlobalTXT_LocalizationStrings[604]; 157 v11 = 1;
158 if ( pParty->uFine ) 158 pOutString = 0;
159 { 159 pShopOptions[0] = pGlobalTXT_LocalizationStrings[604];
160 pShopOptions[1] = pGlobalTXT_LocalizationStrings[603]; 160 if ( pParty->uFine )
161 v11 = 2; 161 {
162 } 162 pShopOptions[1] = pGlobalTXT_LocalizationStrings[603];
163 for ( i = 0; i < v11; ++i ) 163 v11 = 2;
164 { 164 }
165 v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0); 165 for ( i = 0; i < v11; ++i )
166 pOutString = (GUIFont *)((char *)pOutString + v13); 166 {
167 } 167 v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0);
168 v29 = (100 - (signed int)pOutString) / v11; 168 pOutString = (GUIFont *)((char *)pOutString + v13);
169 v14 = pDialogueWindow; 169 }
170 v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString; 170 v29 = (100 - (signed int)pOutString) / v11;
171 v16 = v15 - HIDWORD(v15); 171 v14 = pDialogueWindow;
172 LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem; 172 v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString;
173 HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton; 173 v16 = v15 - HIDWORD(v15);
174 v17 = (v16 >> 1) - v29 / 2 + 158; 174 LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem;
175 v18 = -pDialogueWindow->pNumPresenceButton < 0; 175 HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton;
176 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; 176 v17 = (v16 >> 1) - v29 / 2 + 158;
177 if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) ) 177 v18 = -pDialogueWindow->pNumPresenceButton < 0;
178 { 178 pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem;
179 v31 = 2; 179 if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) )
180 v19 = pShopOptions; 180 {
181 do 181 v31 = 2;
182 { 182 v19 = pShopOptions;
183 v20 = v14->GetControl((unsigned int)pOutString); 183 do
184 v21 = v20; 184 {
185 v20->uY = v29 + v17; 185 v20 = v14->GetControl((unsigned int)pOutString);
186 v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0); 186 v21 = v20;
187 v23 = v21->uY; 187 v20->uY = v29 + v17;
188 v21->uHeight = v22; 188 v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0);
189 v17 = v23 + v22 - 1; 189 v23 = v21->uY;
190 v21->uW = v17; 190 v21->uHeight = v22;
191 v24 = v30; 191 v17 = v23 + v22 - 1;
192 if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) 192 v21->uW = v17;
193 v24 = v28; 193 v24 = v30;
194 _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u); 194 if ( pDialogueWindow->pCurrentPosActiveItem != v31 )
195 v14 = pDialogueWindow; 195 v24 = v28;
196 ++v31; 196 _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u);
197 ++v19; 197 v14 = pDialogueWindow;
198 pOutString = (GUIFont *)((char *)pOutString + 1); 198 ++v31;
199 } 199 ++v19;
200 while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); 200 pOutString = (GUIFont *)((char *)pOutString + 1);
201 } 201 }
202 } 202 while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
203 else 203 }
204 { 204 break;
205 if ( dword_F8B19C != 99 ) 205 }
206 { 206 case 99:
207 if ( dword_F8B19C != 100 ) 207 {
208 return; 208 v5 = &pMonsterStats->pInfos[word_F8B1A0];
209 v0 = window_SpeakInHouse; 209 v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
210 if ( window_SpeakInHouse->field_40 == 1 ) 210 v7 = v5->pName;
211 { 211 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
212 sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); 212 sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6);
213 _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u); 213 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel);
214 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); 214 ptr_F8B1E8 = pTmpBuf2;
215 v3 = pFontArrus; 215 memcpy(&a1, pDialogueWindow, sizeof(a1));
216 v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); 216 w.uFrameWidth = 458;
217 _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3); 217 w.uFrameZ = 457;
218 return; 218 pOutString = pFontArrus;
219 } 219 v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7;
220 if ( window_SpeakInHouse->field_40 == 2 ) 220 if ( 352 - v9 < 8 )
221 { 221 {
222 v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); 222 pOutString = pFontCreate;
223 v2 = v1; 223 v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7;
224 if ( v1 <= 0 ) 224 }
225 { 225
226 LABEL_8: 226 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0);
227 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); 227 pRenderer->_4A6A68(8u, 352 - v9, pTex, (pTex ? pTex->uTextureHeight : 26) - v9);
228 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 228 pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428);
229 { 229 v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0);
230 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; 230 a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0);
231 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; 231 break;
232 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; 232 }
233 ++pMessageQueue_50CBD0->uNumMessages; 233 case 100:
234 }*/ 234 {
235 return; 235 v0 = window_SpeakInHouse;
236 } 236 if ( window_SpeakInHouse->field_40 == 1 )
237 if ( v1 > pParty->uNumGold ) 237 {
238 { 238 sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]);
239 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 239 _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u);
240 v2 = pParty->uNumGold; 240 _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u);
241 } 241 v3 = pFontArrus;
242 if ( v2 > pParty->uFine ) 242 v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer);
243 v2 = pParty->uFine; 243 _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3);
244 Party::TakeGold(v2); 244 return;
245 pParty->uFine -= v2; 245 }
246 if ( pParty->uFine < 0 ) 246 if ( window_SpeakInHouse->field_40 == 2 )
247 pParty->uFine = 0; 247 {
248 if ( uActiveCharacter ) 248 v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer);
249 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); 249 v2 = v1;
250 v0 = window_SpeakInHouse; 250 if ( v1 <= 0 )
251 } 251 {
252 else 252 //LABEL_8:
253 { 253 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
254 if ( window_SpeakInHouse->field_40 != 3 ) 254 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
255 return; 255 {
256 } 256 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
257 v0->field_40 = 0; 257 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1;
258 goto LABEL_8; 258 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
259 } 259 ++pMessageQueue_50CBD0->uNumMessages;
260 v5 = &pMonsterStats->pInfos[word_F8B1A0]; 260 }*/
261 v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 261 return;
262 v7 = v5->pName; 262 }
263 v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 263 if ( v1 > pParty->uNumGold )
264 sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6); 264 {
265 sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel); 265 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
266 ptr_F8B1E8 = pTmpBuf2; 266 v2 = pParty->uNumGold;
267 memcpy(&a1, pDialogueWindow, sizeof(a1)); 267 }
268 w.uFrameWidth = 458; 268 if ( v2 > pParty->uFine )
269 w.uFrameZ = 457; 269 v2 = pParty->uFine;
270 pOutString = pFontArrus; 270 Party::TakeGold(v2);
271 v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7; 271 pParty->uFine -= v2;
272 if ( 352 - v9 < 8 ) 272 if ( pParty->uFine < 0 )
273 { 273 pParty->uFine = 0;
274 pOutString = pFontCreate; 274 if ( uActiveCharacter )
275 v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; 275 pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0);
276 } 276 v0 = window_SpeakInHouse;
277 277 }
278 auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); 278 if ( window_SpeakInHouse->field_40 == 3 )
279 pRenderer->_4A6A68( 279 {
280 8u, 280 v0->field_40 = 0;
281 352 - v9, 281 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0);
282 pTex, 282 }
283 (pTex ? pTex->uTextureHeight : 26) - v9); 283 break;
284 pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428); 284 }
285 v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0); 285 default:
286 a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0); 286 {
287 } 287 break;
288 }
289 }
290 return;
288 } 291 }
289 // F8B19C: using guessed type int dword_F8B19C; 292 // F8B19C: using guessed type int dword_F8B19C;
290 // F8B1A0: using guessed type __int16 word_F8B1A0; 293 // F8B1A0: using guessed type __int16 word_F8B1A0;
291 294
292 //----- (004B7D7E) -------------------------------------------------------- 295 //----- (004B7D7E) --------------------------------------------------------