comparison mm7_2.cpp @ 615:8a0ec99a5177

Слияние
author Ritor1
date Fri, 08 Mar 2013 18:00:43 +0600
parents 5bf285f56fa8 cfca6297e4ae
children 574cc56e05e9
comparison
equal deleted inserted replaced
614:7cb26ceb7107 615:8a0ec99a5177
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 switch(dword_F8B19C) 153 switch(dialog_menu_id)
154 { 154 {
155 case 1: 155 case 1:
156 { 156 {
157 v11 = 1; 157 v11 = 1;
158 pOutString = 0; 158 pOutString = 0;
317 _this.uFrameZ = 334; 317 _this.uFrameZ = 334;
318 *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 318 *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
319 *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); 319 *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
320 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); 320 sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank);
321 _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); 321 _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u);
322 switch(dword_F8B19C) 322 switch(dialog_menu_id)
323 { 323 {
324 case 1: 324 case 1:
325 { 325 {
326 v8 = v14[0]; 326 v8 = v14[0];
327 if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) 327 if ( pDialogueWindow->pCurrentPosActiveItem != 2 )
568 if ( v7 <= 0 ) 568 if ( v7 <= 0 )
569 { 569 {
570 v7 = 1; 570 v7 = 1;
571 v83 = 1; 571 v83 = 1;
572 } 572 }
573 switch(dword_F8B19C) 573 switch(dialog_menu_id)
574 { 574 {
575 case 102: 575 case 102:
576 { 576 {
577 v65 = pFontArrus; 577 v65 = pFontArrus;
578 pOutString = pFontArrus; 578 pOutString = pFontArrus;
648 if ( pParty->uNumGold >= (unsigned int)pOutString ) 648 if ( pParty->uNumGold >= (unsigned int)pOutString )
649 { 649 {
650 Party::TakeGold((unsigned int)pOutString); 650 Party::TakeGold((unsigned int)pOutString);
651 v27 = (int)window_SpeakInHouse->ptr_1C; 651 v27 = (int)window_SpeakInHouse->ptr_1C;
652 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); 652 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2);
653 dword_F8B19C = 0; 653 dialog_menu_id = 0;
654 while ( sub_4BD8B5() ) 654 while ( sub_4BD8B5() )
655 ; 655 ;
656 sub_4B1D27(); 656 sub_4B1D27();
657 pVideoPlayer->Unload(); 657 pVideoPlayer->Unload();
658 window_SpeakInHouse->Release(); 658 window_SpeakInHouse->Release();
1096 v101.uFrameX = 483; 1096 v101.uFrameX = 483;
1097 v101.uFrameWidth = 148; 1097 v101.uFrameWidth = 148;
1098 v101.uFrameZ = 334; 1098 v101.uFrameZ = 334;
1099 v105 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 1099 v105 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
1100 v104 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 1100 v104 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
1101 switch(dword_F8B19C) 1101 switch(dialog_menu_id)
1102 { 1102 {
1103 case 94: 1103 case 94:
1104 { 1104 {
1105 draw_leather(); 1105 draw_leather();
1106 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 1106 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
1307 v58 = pGlobalTXT_LocalizationStrings[185]; 1307 v58 = pGlobalTXT_LocalizationStrings[185];
1308 } 1308 }
1309 else 1309 else
1310 { 1310 {
1311 v58 = pGlobalTXT_LocalizationStrings[195]; 1311 v58 = pGlobalTXT_LocalizationStrings[195];
1312 if ( dword_F8B19C != 2 ) 1312 if ( dialog_menu_id != 2 )
1313 v58 = pGlobalTXT_LocalizationStrings[196]; 1313 v58 = pGlobalTXT_LocalizationStrings[196];
1314 } 1314 }
1315 DrawTextAtStatusBar(v58, 0); 1315 DrawTextAtStatusBar(v58, 0);
1316 if ( v106.x ) 1316 if ( v106.x )
1317 { 1317 {
1322 v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; 1322 v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1;
1323 v106.x = v60; 1323 v106.x = v60;
1324 v61 = (int)window_SpeakInHouse->ptr_1C; 1324 v61 = (int)window_SpeakInHouse->ptr_1C;
1325 // v62 = 9 * (v60 + 12 * v61); 1325 // v62 = 9 * (v60 + 12 * v61);
1326 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; 1326 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
1327 if ( dword_F8B19C != 2 ) 1327 if ( dialog_menu_id != 2 )
1328 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; 1328 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
1329 if ( !v56 || !Str ) 1329 if ( !v56 || !Str )
1330 { 1330 {
1331 v85 = 0; 1331 v85 = 0;
1332 v83 = 2; 1332 v83 = 2;
1420 v58 = pGlobalTXT_LocalizationStrings[185]; 1420 v58 = pGlobalTXT_LocalizationStrings[185];
1421 } 1421 }
1422 else 1422 else
1423 { 1423 {
1424 v58 = pGlobalTXT_LocalizationStrings[195]; 1424 v58 = pGlobalTXT_LocalizationStrings[195];
1425 if ( dword_F8B19C != 2 ) 1425 if ( dialog_menu_id != 2 )
1426 v58 = pGlobalTXT_LocalizationStrings[196]; 1426 v58 = pGlobalTXT_LocalizationStrings[196];
1427 } 1427 }
1428 DrawTextAtStatusBar(v58, 0); 1428 DrawTextAtStatusBar(v58, 0);
1429 if ( v106.x ) 1429 if ( v106.x )
1430 { 1430 {
1435 v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; 1435 v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1;
1436 v106.x = v60; 1436 v106.x = v60;
1437 v61 = (int)window_SpeakInHouse->ptr_1C; 1437 v61 = (int)window_SpeakInHouse->ptr_1C;
1438 // v62 = 9 * (v60 + 12 * v61); 1438 // v62 = 9 * (v60 + 12 * v61);
1439 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; 1439 v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60];
1440 if ( dword_F8B19C != 2 ) 1440 if ( dialog_menu_id != 2 )
1441 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; 1441 v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724];
1442 if ( !v56 || !Str ) 1442 if ( !v56 || !Str )
1443 { 1443 {
1444 v85 = 0; 1444 v85 = 0;
1445 v83 = 2; 1445 v83 = 2;
1647 } 1647 }
1648 break; 1648 break;
1649 } 1649 }
1650 default: 1650 default:
1651 { 1651 {
1652 if( dword_F8B19C > 5 ) 1652 if( dialog_menu_id > 5 )
1653 result = (char *)(dword_F8B19C - 96); 1653 result = (char *)(dialog_menu_id - 96);
1654 else 1654 else
1655 result = (char *)(dword_F8B19C - 4); 1655 result = (char *)(dialog_menu_id - 4);
1656 break; 1656 break;
1657 } 1657 }
1658 } 1658 }
1659 return result; 1659 return result;
1660 } 1660 }
1785 v104.uFrameX = 483; 1785 v104.uFrameX = 483;
1786 v104.uFrameWidth = 148; 1786 v104.uFrameWidth = 148;
1787 v104.uFrameZ = 334; 1787 v104.uFrameZ = 334;
1788 v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 1788 v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
1789 v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 1789 v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
1790 switch(dword_F8B19C) 1790 switch(dialog_menu_id)
1791 { 1791 {
1792 case 1: 1792 case 1:
1793 { 1793 {
1794 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 1794 result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
1795 if ( result ) 1795 if ( result )
2054 Str = (char *)v64; 2054 Str = (char *)v64;
2055 if ( v63 && v64 ) 2055 if ( v63 && v64 )
2056 { 2056 {
2057 v65 = pGlobalTXT_LocalizationStrings[185]; 2057 v65 = pGlobalTXT_LocalizationStrings[185];
2058 } 2058 }
2059 else if ( dword_F8B19C == 2 ) 2059 else if ( dialog_menu_id == 2 )
2060 { 2060 {
2061 v65 = pGlobalTXT_LocalizationStrings[195]; 2061 v65 = pGlobalTXT_LocalizationStrings[195];
2062 } 2062 }
2063 else 2063 else
2064 { 2064 {
2077 v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; 2077 v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1;
2078 v109 = v67; 2078 v109 = v67;
2079 v68 = (int)window_SpeakInHouse->ptr_1C; 2079 v68 = (int)window_SpeakInHouse->ptr_1C;
2080 // v69 = 9 * (v67 + 12 * v68); 2080 // v69 = 9 * (v67 + 12 * v68);
2081 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; 2081 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
2082 if ( dword_F8B19C != 2 ) 2082 if ( dialog_menu_id != 2 )
2083 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; 2083 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
2084 if ( !v63 || !Str ) 2084 if ( !v63 || !Str )
2085 { 2085 {
2086 v93 = 0; 2086 v93 = 0;
2087 v91 = 2; 2087 v91 = 2;
2201 v65 = pGlobalTXT_LocalizationStrings[185]; 2201 v65 = pGlobalTXT_LocalizationStrings[185];
2202 } 2202 }
2203 else 2203 else
2204 { 2204 {
2205 v65 = pGlobalTXT_LocalizationStrings[195]; 2205 v65 = pGlobalTXT_LocalizationStrings[195];
2206 if ( dword_F8B19C != 2 ) 2206 if ( dialog_menu_id != 2 )
2207 v65 = pGlobalTXT_LocalizationStrings[196]; 2207 v65 = pGlobalTXT_LocalizationStrings[196];
2208 } 2208 }
2209 DrawTextAtStatusBar(v65, 0); 2209 DrawTextAtStatusBar(v65, 0);
2210 if ( !v109 ) 2210 if ( !v109 )
2211 { 2211 {
2219 v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; 2219 v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1;
2220 v109 = v67; 2220 v109 = v67;
2221 v68 = (int)window_SpeakInHouse->ptr_1C; 2221 v68 = (int)window_SpeakInHouse->ptr_1C;
2222 // v69 = 9 * (v67 + 12 * v68); 2222 // v69 = 9 * (v67 + 12 * v68);
2223 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; 2223 v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67];
2224 if ( dword_F8B19C != 2 ) 2224 if ( dialog_menu_id != 2 )
2225 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; 2225 v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724];
2226 if ( !v63 || !Str ) 2226 if ( !v63 || !Str )
2227 { 2227 {
2228 v93 = 0; 2228 v93 = 0;
2229 v91 = 2; 2229 v91 = 2;
2351 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); 2351 v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86);
2352 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); 2352 return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92);
2353 } 2353 }
2354 default: 2354 default:
2355 { 2355 {
2356 return (POINT *)dword_F8B19C - 96; 2356 return (POINT *)dialog_menu_id - 96;
2357 } 2357 }
2358 } 2358 }
2359 } 2359 }
2360 2360
2361 2361
2362 //----- (004BA928) -------------------------------------------------------- 2362 //----- (004BA928) --------------------------------------------------------
2363 void __cdecl ArmorShopDialog() 2363 void __cdecl ArmorShopDialog()
2364 { 2364 {
2365 Player *v0; // ebx@1 2365 Player *v0; // ebx@1
2366 signed int v1; // esi@8 2366 signed int v1; // esi@8
2367 unsigned int v2; // eax@10 2367 unsigned int v2; // eax@10
2368 ItemGen *v3; // eax@11 2368 ItemGen *v3; // eax@11
2369 unsigned __int8 v4; // dl@12 2369 unsigned __int8 v4; // dl@12
2370 char *v5; // ecx@12 2370 char *v5; // ecx@12
2371 char *v6; // eax@13 2371 char *v6; // eax@13
2372 int v7; // ST08_4@15 2372 int v7; // ST08_4@15
2373 int v8; // eax@15 2373 int v8; // eax@15
2374 signed int v9; // esi@17 2374 signed int v9; // esi@17
2375 unsigned int v10; // eax@19 2375 unsigned int v10; // eax@19
2376 char *v11; // edi@19 2376 char *v11; // edi@19
2377 int v12; // ST08_4@20 2377 int v12; // ST08_4@20
2378 int v13; // eax@20 2378 int v13; // eax@20
2379 unsigned __int8 v14; // dl@20 2379 unsigned __int8 v14; // dl@20
2380 char *v15; // ecx@20 2380 char *v15; // ecx@20
2381 char **v16; // edi@22 2381 char **v16; // edi@22
2382 int v17; // ebx@22 2382 int all_text_height; // ebx@22
2383 char **v18; // esi@22 2383 char **v18; // esi@22
2384 int v19; // eax@23 2384 int v19; // eax@23
2385 GUIWindow *v20; // ecx@24 2385 GUIWindow *v20; // ecx@24
2386 int v21; // eax@24 2386 int v21; // eax@24
2387 int v22; // edx@24 2387 int v22; // edx@24
2388 int v23; // ebx@24 2388 int v23; // ebx@24
2389 unsigned __int8 v24; // sf@24 2389 unsigned __int8 v24; // sf@24
2390 GUIButton *v25; // eax@26 2390 GUIButton *control_button; // eax@26
2391 GUIButton *v26; // esi@26 2391 GUIButton *v26; // esi@26
2392 int v27; // eax@26 2392 int v27; // eax@26
2393 unsigned int v28; // ecx@26 2393 unsigned int v28; // ecx@26
2394 int v29; // edx@26 2394 int v29; // edx@26
2395 unsigned __int16 v30; // ax@26 2395
2396 signed int v31; // esi@31 2396 signed int v31; // esi@31
2397 unsigned int v32; // eax@33 2397 unsigned int v32; // eax@33
2398 int v33; // eax@34 2398 int v33; // eax@34
2399 int v34; // ST08_4@35 2399 int v34; // ST08_4@35
2400 int v35; // eax@35 2400 int v35; // eax@35
2401 char *v36; // edx@36 2401 char *v36; // edx@36
2402 GUIWindow *v37; // edi@42 2402 GUIWindow *v37; // edi@42
2403 signed int v38; // esi@42 2403 signed int v38; // esi@42
2404 unsigned int v39; // esi@44 2404 unsigned int v39; // esi@44
2405 int v40; // eax@44 2405 int v40; // eax@44
2406 unsigned int v41; // eax@45 2406 unsigned int v41; // eax@45
2407 int v42; // eax@47 2407 int v42; // eax@47
2408 int v43; // ecx@52 2408 int v43; // ecx@52
2409 GUIButton *v44; // eax@54 2409 GUIButton *v44; // eax@54
2410 GUIButton *v45; // esi@54 2410 GUIButton *v45; // esi@54
2411 int v46; // eax@54 2411 int v46; // eax@54
2412 char *v47; // eax@56 2412 char *v47; // eax@56
2413 int v48; // eax@56 2413 int v48; // eax@56
2414 unsigned int v49; // ecx@56 2414 unsigned int v49; // ecx@56
2415 int v50; // edx@56 2415 int v50; // edx@56
2416 int v51; // eax@56 2416 int v51; // eax@56
2417 unsigned __int16 v52; // ax@56 2417 unsigned __int16 v52; // ax@56
2418 int v53; // eax@60 2418 int v53; // eax@60
2419 int v54; // eax@60 2419 int textureH; // eax@60
2420 signed int v55; // ebx@65 2420 signed int textureW; // ebx@65
2421 Texture *v56; // eax@67 2421 Texture *v56; // eax@67
2422 unsigned int v57; // edi@68 2422 unsigned int v57; // edi@68
2423 Texture *v58; // ST1C_4@68 2423 Texture *v58; // ST1C_4@68
2424 int v59; // eax@68 2424 int v59; // eax@68
2425 int v60; // edi@69 2425 int v60; // edi@69
2426 signed int v61; // ebx@73 2426 signed int v61; // ebx@73
2427 Texture *v62; // eax@75 2427 Texture *v62; // eax@75
2428 int v63; // edi@76 2428 int v63; // edi@76
2429 Texture *v64; // ST1C_4@76 2429 Texture *v64; // ST1C_4@76
2430 unsigned int v65; // ST18_4@76 2430 unsigned int v65; // ST18_4@76
2431 int v66; // eax@76 2431 int v66; // eax@76
2432 int v67; // edi@77 2432 int v67; // edi@77
2433 signed int v68; // ecx@81 2433 signed int v68; // ecx@81
2434 SHORT v69; // bx@89 2434 SHORT v69; // bx@89
2435 bool v70; // eax@89 2435 bool v70; // eax@89
2436 const char *v71; // ecx@91 2436 const char *v71; // ecx@91
2437 void *v72; // eax@95 2437 void *v72; // eax@95
2438 POINT *v73; // esi@97 2438 POINT *v73; // esi@97
2439 int v74; // ecx@97 2439 int v74; // ecx@97
2440 int v75; // eax@98 2440 int v75; // eax@98
2441 int v76; // ecx@98 2441 int v76; // ecx@98
2442 ItemGen *v77; // ecx@99 2442 ItemGen *selected_item; // ecx@99
2443 unsigned __int8 v78; // bl@104 2443 unsigned __int8 v78; // bl@104
2444 char **v79; // edi@105 2444 char **v79; // edi@105
2445 int v80; // ebx@105 2445 int v80; // ebx@105
2446 char **v81; // esi@105 2446 char **v81; // esi@105
2447 int v82; // eax@106 2447 int v82; // eax@106
2448 GUIWindow *v83; // ecx@107 2448 GUIWindow *v83; // ecx@107
2449 int v84; // eax@107 2449 int v84; // eax@107
2450 int v85; // edx@107 2450 int v85; // edx@107
2451 int v86; // ebx@107 2451 int v86; // ebx@107
2452 GUIButton *v87; // eax@109 2452 GUIButton *v87; // eax@109
2453 GUIButton *v88; // esi@109 2453 GUIButton *v88; // esi@109
2454 int v89; // eax@109 2454 int v89; // eax@109
2455 unsigned int v90; // ecx@109 2455 unsigned int v90; // ecx@109
2456 int v91; // edx@109 2456 int v91; // edx@109
2457 unsigned __int16 v92; // ax@109 2457 unsigned __int16 v92; // ax@109
2458 signed int v93; // edx@114 2458 signed int v93; // edx@114
2459 POINT *v94; // edi@120 2459 POINT *v94; // edi@120
2460 __int32 v95; // ecx@120 2460 __int32 v95; // ecx@120
2461 void *v96; // ST14_4@122 2461 void *v96; // ST14_4@122
2462 unsigned __int8 v97; // bl@122 2462 unsigned __int8 v97; // bl@122
2463 ItemGen *v98; // ST10_4@122 2463 ItemGen *v98; // ST10_4@122
2464 int v99; // eax@122 2464 int v99; // eax@122
2465 char *v100; // eax@122 2465 char *v100; // eax@122
2466 const char *v101; // ST18_4@122 2466 const char *v101; // ST18_4@122
2467 unsigned __int16 v102; // ST14_2@122 2467 unsigned __int16 v102; // ST14_2@122
2468 int v103; // eax@122 2468 int v103; // eax@122
2469 signed int v104; // edi@123 2469 signed int v104; // edi@123
2470 Texture *v105; // eax@125 2470 Texture *v105; // eax@125
2471 int v106; // ebx@126 2471 int v106; // ebx@126
2472 Texture *v107; // ST1C_4@126 2472 Texture *v107; // ST1C_4@126
2473 unsigned int v108; // ST18_4@126 2473 unsigned int v108; // ST18_4@126
2474 int v109; // eax@126 2474 int v109; // eax@126
2475 int v110; // ebx@127 2475 int v110; // ebx@127
2476 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 2476 GUIWindow *v111; // [sp-18h] [bp-11Ch]@36
2477 unsigned int v112; // [sp-14h] [bp-118h]@13 2477 unsigned int v112; // [sp-14h] [bp-118h]@13
2478 int v113; // [sp-14h] [bp-118h]@36 2478 int v113; // [sp-14h] [bp-118h]@36
2479 ItemGen *v114; // [sp-10h] [bp-114h]@12 2479 ItemGen *v114; // [sp-10h] [bp-114h]@12
2480 unsigned int v115; // [sp-10h] [bp-114h]@13 2480 unsigned int v115; // [sp-10h] [bp-114h]@13
2481 ItemGen *v116; // [sp-10h] [bp-114h]@20 2481 ItemGen *v116; // [sp-10h] [bp-114h]@20
2482 int v117; // [sp-10h] [bp-114h]@36 2482 int v117; // [sp-10h] [bp-114h]@36
2483 void *v118; // [sp-Ch] [bp-110h]@12 2483 void *v118; // [sp-Ch] [bp-110h]@12
2484 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 2484 unsigned __int16 v119; // [sp-Ch] [bp-110h]@13
2485 void *v120; // [sp-Ch] [bp-110h]@20 2485 void *v120; // [sp-Ch] [bp-110h]@20
2486 char *v121; // [sp-8h] [bp-10Ch]@13 2486 char *v121; // [sp-8h] [bp-10Ch]@13
2487 int v122; // [sp-8h] [bp-10Ch]@20 2487 int v122; // [sp-8h] [bp-10Ch]@20
2488 unsigned int v123; // [sp-4h] [bp-108h]@13 2488 unsigned int v123; // [sp-4h] [bp-108h]@13
2489 __int64 *v124; // [sp-4h] [bp-108h]@20 2489 __int64 *v124; // [sp-4h] [bp-108h]@20
2490 int v125; // [sp-4h] [bp-108h]@68 2490 int v125; // [sp-4h] [bp-108h]@68
2491 int v126; // [sp-4h] [bp-108h]@76 2491 int v126; // [sp-4h] [bp-108h]@76
2492 int v127; // [sp-4h] [bp-108h]@126 2492 int v127; // [sp-4h] [bp-108h]@126
2493 POINT v128; // [sp+Ch] [bp-F8h]@8 2493 POINT v128; // [sp+Ch] [bp-F8h]@8
2494 POINT v129; // [sp+14h] [bp-F0h]@18 2494 POINT v129; // [sp+14h] [bp-F0h]@18
2495 char v130; // [sp+1Ch] [bp-E8h]@120 2495 char v130; // [sp+1Ch] [bp-E8h]@120
2496 POINT a2; // [sp+24h] [bp-E0h]@8 2496 POINT a2; // [sp+24h] [bp-E0h]@8
2497 POINT v132; // [sp+2Ch] [bp-D8h]@120 2497 POINT v132; // [sp+2Ch] [bp-D8h]@120
2498 POINT v133; // [sp+34h] [bp-D0h]@17 2498 POINT v133; // [sp+34h] [bp-D0h]@17
2499 POINT v134; // [sp+3Ch] [bp-C8h]@97 2499 POINT v134; // [sp+3Ch] [bp-C8h]@97
2500 POINT v135; // [sp+44h] [bp-C0h]@31 2500 POINT v135; // [sp+44h] [bp-C0h]@31
2501 POINT v136; // [sp+4Ch] [bp-B8h]@97 2501 POINT v136; // [sp+4Ch] [bp-B8h]@97
2502 POINT v137; // [sp+54h] [bp-B0h]@17 2502 POINT v137; // [sp+54h] [bp-B0h]@17
2503 POINT v138; // [sp+5Ch] [bp-A8h]@32 2503 POINT v138; // [sp+5Ch] [bp-A8h]@32
2504 POINT v139; // [sp+64h] [bp-A0h]@17 2504 POINT v139; // [sp+64h] [bp-A0h]@17
2505 POINT v140; // [sp+6Ch] [bp-98h]@31 2505 POINT v140; // [sp+6Ch] [bp-98h]@31
2506 POINT v141; // [sp+74h] [bp-90h]@8 2506 POINT v141; // [sp+74h] [bp-90h]@8
2507 POINT v142; // [sp+7Ch] [bp-88h]@31 2507 POINT v142; // [sp+7Ch] [bp-88h]@31
2508 POINT v143; // [sp+84h] [bp-80h]@9 2508 POINT v143; // [sp+84h] [bp-80h]@9
2509 GUIWindow v144; // [sp+8Ch] [bp-78h]@1 2509 GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1
2510 char *Str; // [sp+E0h] [bp-24h]@56 2510 char *Str; // [sp+E0h] [bp-24h]@56
2511 int v146; // [sp+E4h] [bp-20h]@24 2511 int v146; // [sp+E4h] [bp-20h]@24
2512 int v147; // [sp+E8h] [bp-1Ch]@1 2512 int hilight_color; // [sp+E8h] [bp-1Ch]@1
2513 int v148; // [sp+ECh] [bp-18h]@1 2513 int m_text_color; // [sp+ECh] [bp-18h]@1
2514 __int32 v149; // [sp+F0h] [bp-14h]@8 2514 __int32 v149; // [sp+F0h] [bp-14h]@8
2515 Player* _this; // [sp+F4h] [bp-10h]@1 2515 Player* _this; // [sp+F4h] [bp-10h]@1
2516 unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15 2516 unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15
2517 int v152; // [sp+FCh] [bp-8h]@24 2517 int v152; // [sp+FCh] [bp-8h]@24
2518 int v153; // [sp+100h] [bp-4h]@44 2518 int v153; // [sp+100h] [bp-4h]@44
2519 int th; 2519 int th;
2520 2520 short text_color;
2521 v0 = pPlayers[uActiveCharacter]; 2521
2522 _this = pPlayers[uActiveCharacter]; 2522 v0 = pPlayers[uActiveCharacter];
2523 memcpy(&v144, window_SpeakInHouse, sizeof(v144)); 2523 _this = pPlayers[uActiveCharacter];
2524 v144.uFrameX = 483; 2524 memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window));
2525 v144.uFrameWidth = 148; 2525 dialog_window.uFrameX = 483;
2526 v144.uFrameZ = 334; 2526 dialog_window.uFrameWidth = 148;
2527 v148 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); 2527 dialog_window.uFrameZ = 334;
2528 v147 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); 2528 m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
2529 switch (dword_F8B19C) 2529 hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u);
2530 { 2530 switch (dialog_menu_id)
2531 case 1: //prepare shop text 2531 {
2532 { 2532 case 1: //main shop text
2533 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 2533 {
2534 { 2534 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
2535 v16 = pShopOptions; 2535 return;
2536 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; 2536 pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard"
2537 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; 2537 pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special"
2538 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; 2538 pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory"
2539 v17 = 0; 2539 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];
2540 pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; 2540
2541 for(int i=0;i<4;++i) 2541 all_text_height = 0;
2542 { 2542 for(int i=0;i<4;++i)
2543 v19 = pFontArrus->CalcTextHeight(pShopOptions[i], &v144, 0, 0); 2543 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
2544 v17 += v19; 2544 v146 = (174 - all_text_height) / 4;
2545 } 2545
2546 v20 = pDialogueWindow; 2546 v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138;
2547 v146 = (174 - v17) / 4; 2547 int j=0;
2548 v21 = pDialogueWindow->pStartingPosActiveItem; 2548 if ( pDialogueWindow->pNumPresenceButton>=0 )
2549 v22 = v21 + pDialogueWindow->pNumPresenceButton; 2549 {
2550 v23 = (174 - 4 * (174 - v17) / 4 - v17) / 2 - (174 - v17) / 4 / 2 + 138; 2550 th = 2;
2551 v24 = -pDialogueWindow->pNumPresenceButton < 0; 2551 for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152)
2552 v152 = pDialogueWindow->pStartingPosActiveItem; 2552 {
2553 if ( v24 ^ __OFSUB__(v21, v22) ) 2553 control_button = pDialogueWindow->GetControl(v152);
2554 { 2554 control_button->uY = v146 + v23;
2555 th = 2; 2555 v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0);
2556 do 2556 control_button->uHeight = v27;
2557 { 2557 v23 = control_button->uY + control_button->uHeight - 1;
2558 v25 = v20->GetControl(v152); 2558 control_button->uW = v23;
2559 v26 = v25; 2559 text_color = hilight_color;
2560 v25->uY = v146 + v23; 2560 if ( pDialogueWindow->pCurrentPosActiveItem != th )
2561 v27 = pFontArrus->CalcTextHeight(*v16, &v144, 0, 0); 2561 text_color = m_text_color;
2562 v28 = v26->uY; 2562 dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3);
2563 v29 = th; 2563 ++th;
2564 v26->uHeight = v27; 2564 ++j;
2565 v23 = v28 + v27 - 1; 2565 }
2566 v26->uW = v23; 2566 }
2567 v30 = v147; 2567 }
2568 if ( pDialogueWindow->pCurrentPosActiveItem != v29 ) 2568 break;
2569 v30 = v148; 2569 case 2: //buy standart
2570 v144.DrawTitleText(pFontArrus, 0, v28, v30, *v16, 3u); 2570 {
2571 v20 = pDialogueWindow; 2571 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
2572 ++th; 2572 textureW = 0;
2573 ++v16; 2573 v153 = 0;
2574 ++v152; 2574 for(int i=0; i<8; ++i)
2575 } 2575 {
2576 while ( v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); 2576 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID);
2577 } 2577 {
2578 } 2578 textureW = ItemsInShopTexture[i]->uTextureWidth;
2579 } 2579 textureH = ItemsInShopTexture[i]->uTextureHeight;
2580 break; 2580 if ( i >= 4 ) //low row
2581 case 2: //buy standart 2581 {
2582 { 2582 v60 = 90 - (textureW/2);
2583 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); 2583 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]);
2584 v55 = 0; 2584 v59 = v60 + v153 + 80220;
2585 v153 = 0; 2585 }
2586 for(int i=0; i<8; ++i) 2586 else
2587 { 2587 {
2588 // if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) 2588 v57 = 98 - textureH;
2589 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID); 2589 v152 = 86 - (textureW/2);
2590 { 2590 pRenderer->DrawTextureTransparent(v153 + v152, v57, ItemsInShopTexture[i]);
2591 v56 = ItemsInShopTexture[v55]; 2591 v59 = v153 + v152 + 640 * v57;
2592 if ( i >= 4 ) 2592 }
2593 { 2593 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1);
2594 v60 = 90 - ((signed int)v56->uTextureWidth >> 1); 2594 }
2595 pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); 2595 v153 += 105;
2596 v59 = v60 + v153 + 80220; 2596
2597 } 2597 }
2598 else 2598
2599 { 2599 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
2600 v57 = 98 - v56->uTextureHeight; 2600 return;
2601 v58 = ItemsInShopTexture[i]; 2601
2602 v152 = 86 - ((signed int)v56->uTextureWidth >> 1); 2602 v149 = 0;
2603 pRenderer->DrawTextureTransparent(v153 + v152, v57, v58); 2603 for(int i=0; i<8; ++i)
2604 v59 = v153 + v152 + 640 * v57; 2604 {
2605 } 2605 if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID);
2606 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1); 2606 ++v149;
2607 } 2607
2608 v153 += 105; 2608 }
2609 2609
2610 } 2610 v69 = GetAsyncKeyState(17);
2611 2611 v70 = _this->CanSteal();
2612 v11 = 0; 2612 //Str = (char *)v70;
2613 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 2613 if ( v69 == 0 || v70 == 0 )
2614 return; 2614 {
2615 2615 v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy"
2616 v149 = 0; 2616 }
2617 for(int i=0; i<6; ++i) 2617 else
2618 { 2618 {
2619 // if ( (char *)pParty->field_777C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] != v11 ) 2619 v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item"
2620 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID); 2620 }
2621 ++v149; 2621 DrawTextAtStatusBar(v71, 0);
2622 2622 if ( v149 != 0 )
2623 } 2623 {
2624 2624 v73 = pMouse->GetCursorPos(&v136);
2625 v69 = GetAsyncKeyState(17); 2625 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF;
2626 v70 = _this->CanSteal(); 2626 if ( !v74 )
2627 //Str = (char *)v70; 2627 return;
2628 if ( v69 == 0 || v70 == 0 ) 2628 v149 = v74 - 1;
2629 { 2629 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
2630 v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" 2630 if ( v69 ==0 || v70 == 0)
2631 } 2631 {
2632 else 2632 v120 = window_SpeakInHouse->ptr_1C;
2633 { 2633 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
2634 v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item" 2634 }
2635 } 2635 else
2636 DrawTextAtStatusBar(v71, 0); 2636 {
2637 if ( v149 != 0 ) 2637 v120 = window_SpeakInHouse->ptr_1C;
2638 { 2638 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
2639 v73 = pMouse->GetCursorPos(&v136); 2639 }
2640 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; 2640 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0);
2641 if ( !v74 ) 2641 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
2642 return; 2642 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
2643 v149 = v74 - 1; 2643 return;
2644 v75 = (int)window_SpeakInHouse->ptr_1C; 2644 }
2645 v77 = &pParty->StandartItemsInShops[(int)v75][v74-1]; 2645 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
2646 if ( v69 ==0 || v70 == 0) 2646 return;
2647 { 2647 }
2648 v120 = window_SpeakInHouse->ptr_1C; 2648 break;
2649 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(v77, 2, v75, 2)]; 2649 case 3: //sell
2650 } 2650 {
2651 else 2651 draw_leather();
2652 { 2652 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
2653 v120 = window_SpeakInHouse->ptr_1C; 2653 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell"
2654 v15 = pGlobalTXT_LocalizationStrings[181]; 2654 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
2655 } 2655 return;
2656 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v77, (char *)v120, 2, 0); 2656
2657 v115 = (174 - pFontArrus->CalcTextHeight(v36, &v144, 0, 0)) / 2 + 138; 2657 if((v9 = pMouse->GetCursorPos(&v139)->x - 14,
2658 v144.DrawTitleText(pFontArrus, 0, v115, v148, v36, 3); 2658 v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5),
2659 return; 2659 pMouse->GetCursorPos(&v137)->x <= 13)
2660 } 2660 || pMouse->GetCursorPos(&v129)->x >= 462
2661 v72 = window_SpeakInHouse->ptr_1C; 2661 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) )
2662 v144.DrawCurrentTime( pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); 2662 return;
2663 return; 2663
2664 } 2664 v116 = (ItemGen *)&v0->pInventoryItems[v10-1];
2665 break; 2665
2666 case 3: 2666 v13 = v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3);
2667 { 2667
2668 draw_leather(); 2668 v15 = (char *)pMerchantsSellPhrases[v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)];
2669 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 2669 v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0);
2670 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); 2670
2671 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() 2671 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
2672 || (v9 = pMouse->GetCursorPos(&v139)->x - 14, 2672 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
2673 v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), 2673 return;
2674 pMouse->GetCursorPos(&v137)->x <= 13) 2674 }
2675 || pMouse->GetCursorPos(&v129)->x >= 462 2675 break;
2676 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) 2676 case 4: //identify
2677 return; 2677 {
2678 v124 = 0; 2678 draw_leather();
2679 v122 = 3; 2679 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
2680 v120 = window_SpeakInHouse->ptr_1C; 2680 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify"
2681 v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; 2681 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
2682 v12 = (int)window_SpeakInHouse->ptr_1C; 2682 {
2683 uPlayerID = uActiveCharacter - 1; 2683 v1 = pMouse->GetCursorPos(&a2)->x - 14;
2684 v13 = v0->_490EEE(v116, 2, v12, 3); 2684 v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5);
2685 v14 = uPlayerID; 2685 if ( pMouse->GetCursorPos(&v141)->x > 13 )
2686 v15 = (char *)pMerchantsSellPhrases[v13]; 2686 {
2687 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); 2687 if ( pMouse->GetCursorPos(&v143)->x < 462 )
2688 v123 = 3; 2688 {
2689 v121 = v36; 2689 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149);
2690 v119 = v148; 2690 if ( v2 )
2691 v117 = (int)v11; 2691 {
2692 v113 = (int)v11; 2692 v3 = (ItemGen *)&v0->pInventoryItems[v2-1];
2693 v111 = &v144; 2693 if (v3->Identified())
2694 v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; 2694 {
2695 v112 = (unsigned int)v11; 2695 v118 = window_SpeakInHouse->ptr_1C;
2696 v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); 2696 v4 = uActiveCharacter - 1;
2697 return; 2697 v5 = "%24";
2698 } 2698 v114 = v3;
2699 break; 2699 }
2700 case 4: 2700 else
2701 { 2701 {
2702 draw_leather(); 2702 v118 = window_SpeakInHouse->ptr_1C;
2703 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 2703 v114 = v3;
2704 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); 2704 v7 = (int)window_SpeakInHouse->ptr_1C;
2705 if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 2705 uPlayerID = uActiveCharacter - 1;
2706 { 2706 v8 = v0->_490EEE(v3, 2, v7, 4);
2707 v1 = pMouse->GetCursorPos(&a2)->x - 14; 2707 v4 = uPlayerID;
2708 v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); 2708 v5 = (char *)pMerchantsIdentifyPhrases[v8];
2709 if ( pMouse->GetCursorPos(&v141)->x > 13 ) 2709 }
2710 { 2710 v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0);
2711 if ( pMouse->GetCursorPos(&v143)->x < 462 ) 2711 v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138;
2712 { 2712 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v6, 3);
2713 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); 2713 return;
2714 if ( v2 ) 2714 }
2715 { 2715 }
2716 v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; 2716 }
2717 if (v3->Identified()) 2717 }
2718 { 2718 }
2719 v118 = window_SpeakInHouse->ptr_1C; 2719 break;
2720 v4 = uActiveCharacter - 1; 2720 case 5: //repair
2721 v5 = "%24"; 2721 {
2722 v114 = v3; 2722 draw_leather();
2723 } 2723 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
2724 else 2724 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);
2725 { 2725 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win())
2726 v118 = window_SpeakInHouse->ptr_1C; 2726 return;
2727 v114 = v3; 2727
2728 v7 = (int)window_SpeakInHouse->ptr_1C; 2728 if( (v31 = pMouse->GetCursorPos(&v135)->x - 14,
2729 uPlayerID = uActiveCharacter - 1; 2729 v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5),
2730 v8 = v0->_490EEE(v3, 2, v7, 4); 2730 pMouse->GetCursorPos(&v140)->x <= 13)
2731 v4 = uPlayerID; 2731 || pMouse->GetCursorPos(&v138)->x >= 462
2732 v5 = (char *)pMerchantsIdentifyPhrases[v8]; 2732 || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32)
2733 } 2733 || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) )
2734 v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0); 2734 return;
2735 v123 = 3; 2735
2736 v121 = v6; 2736
2737 v119 = v148; 2737 v120 = window_SpeakInHouse->ptr_1C;
2738 v115 = (174 - pFontArrus->CalcTextHeight(v6, &v144, 0, 0)) / 2 + 138; 2738 v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5];
2739 v112 = 0; 2739 v34 = (int)window_SpeakInHouse->ptr_1C;
2740 v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); 2740 uPlayerID = uActiveCharacter - 1;
2741 return; 2741 v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5);
2742 } 2742 v14 = uPlayerID;
2743 } 2743 v15 = (char *)pMerchantsRepairPhrases[v35];
2744 } 2744 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, 5, 0);
2745 } 2745 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
2746 } 2746 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
2747 break; 2747 return;
2748 case 5: 2748 }
2749 { 2749 break;
2750 draw_leather(); 2750 case 6: //buy standart
2751 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 2751 {
2752 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); 2752 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture);
2753 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() 2753 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy"
2754 || (v31 = pMouse->GetCursorPos(&v135)->x - 14, 2754 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
2755 v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), 2755 return;
2756 pMouse->GetCursorPos(&v140)->x <= 13) 2756 v149 = 0;
2757 || pMouse->GetCursorPos(&v138)->x >= 462 2757 for(int i=0;i<6;++i)
2758 || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32) 2758 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID)
2759 || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) ) 2759 ++v149;
2760 return; 2760
2761 v124 = 0; 2761
2762 v122 = 5; 2762 if ( v149 )
2763 v120 = window_SpeakInHouse->ptr_1C; 2763 {
2764 v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5]; 2764 v94 = pMouse->GetCursorPos(&v132);
2765 v34 = (int)window_SpeakInHouse->ptr_1C; 2765 v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]];
2766 uPlayerID = uActiveCharacter - 1; 2766 v95 = v149;
2767 v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5); 2767 if ( v149 && v149 != -65536 )
2768 v14 = uPlayerID; 2768 {
2769 v15 = (char *)pMerchantsRepairPhrases[v35]; 2769 --v149;
2770 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); 2770
2771 v123 = 3; 2771 v97 = uActiveCharacter - 1;
2772 v121 = v36; 2772
2773 v119 = v148; 2773 v99 = _this->_490EEE(
2774 v117 = (int)v11; 2774 &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2);
2775 v113 = (int)v11; 2775 v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0);
2776 v111 = &v144; 2776 v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0);
2777 v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; 2777 dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, m_text_color, v100, 3);
2778 v112 = (unsigned int)v11; 2778 }
2779 v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); 2779 v104 = 0;
2780 return; 2780 v153 = 0;
2781 } 2781 do
2782 break; 2782 {
2783 case 6: 2783 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
2784 { 2784 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID)
2785 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); 2785 {
2786 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); 2786 v105 = ItemsInShopTexture[v104];
2787 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 2787 if ( v104 >= 4 )
2788 return; 2788 {
2789 v149 = 0; 2789 v110 = 90 - ((signed int)v105->uTextureWidth >> 1);
2790 v93 = 0; 2790 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]);
2791 do 2791 v127 = v104 + 1;
2792 { 2792 v109 = v153 + v110 + 80220;
2793 // if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) 2793 }
2794 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID) 2794 else
2795 ++v149; 2795 {
2796 ++v93; 2796 v106 = 98 - v105->uTextureHeight;
2797 } 2797 v107 = ItemsInShopTexture[v104];
2798 while ( v93 < 8 ); 2798 v108 = 98 - v105->uTextureHeight;
2799 if ( v149 ) 2799 v152 = 86 - ((signed int)v105->uTextureWidth >> 1);
2800 { 2800 pRenderer->DrawTextureTransparent(v152 + v153, v108, v107);
2801 v94 = pMouse->GetCursorPos(&v132); 2801 v127 = v104 + 1;
2802 v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; 2802 v109 = v152 + v153 + 640 * v106;
2803 v95 = v149; 2803 }
2804 if ( v149 && v149 != -65536 ) 2804 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127);
2805 { 2805 }
2806 --v149; 2806 v153 += 105;
2807 v96 = window_SpeakInHouse->ptr_1C; 2807 ++v104;
2808 v97 = uActiveCharacter - 1; 2808 }
2809 // v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724]; 2809 while ( v104 < 8 );
2810 v99 = _this->_490EEE( 2810 return;
2811 &pParty->SpecialItemsInShops[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724], 2811 }
2812 2, 2812 dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
2813 (int)window_SpeakInHouse->ptr_1C, 2813 return;
2814 2); 2814 }
2815 v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], v97, v98, (char *)v96, 2, 0); 2815 break;
2816 v101 = v100; 2816 case 94: //character inventory
2817 v102 = v148; 2817 {
2818 v103 = pFontArrus->CalcTextHeight(v100, &v144, 0, 0); 2818 draw_leather();
2819 v144.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, v102, v101, 3u); 2819 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
2820 } 2820 v79 = pShopOptions;
2821 v104 = 0; 2821 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell"
2822 v153 = 0; 2822 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify"
2823 do 2823 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair"
2824 { 2824
2825 //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) 2825 all_text_height = 0;
2826 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID) 2826 for(int i=0;i<3;++i)
2827 { 2827 all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0);
2828 v105 = ItemsInShopTexture[v104]; 2828 v83 = pDialogueWindow;
2829 if ( v104 >= 4 ) 2829 v152 = (174 - all_text_height) / 3;
2830 { 2830 v84 = pDialogueWindow->pStartingPosActiveItem;
2831 v110 = 90 - ((signed int)v105->uTextureWidth >> 1); 2831 v85 = v84 + pDialogueWindow->pNumPresenceButton;
2832 pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); 2832 v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138;
2833 v127 = v104 + 1; 2833 v24 = -pDialogueWindow->pNumPresenceButton < 0;
2834 v109 = v153 + v110 + 80220; 2834 _this = (Player *)pDialogueWindow->pStartingPosActiveItem;
2835 } 2835 if ( v24 ^ __OFSUB__(v84, v85) )
2836 else 2836 {
2837 { 2837 v153 = 2;
2838 v106 = 98 - v105->uTextureHeight; 2838 do
2839 v107 = ItemsInShopTexture[v104]; 2839 {
2840 v108 = 98 - v105->uTextureHeight; 2840 v87 = v83->GetControl((unsigned int)_this);
2841 v152 = 86 - ((signed int)v105->uTextureWidth >> 1); 2841 v88 = v87;
2842 pRenderer->DrawTextureTransparent(v152 + v153, v108, v107); 2842 v87->uY = v152 + v86;
2843 v127 = v104 + 1; 2843 v89 = pFontArrus->CalcTextHeight(*v79, &dialog_window, 0, 0);
2844 v109 = v152 + v153 + 640 * v106; 2844 v90 = v88->uY;
2845 } 2845 v91 = v153;
2846 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); 2846 v88->uHeight = v89;
2847 } 2847 v86 = v90 + v89 - 1;
2848 v153 += 105; 2848 v88->uW = v86;
2849 ++v104; 2849 v92 = hilight_color;
2850 } 2850 if ( pDialogueWindow->pCurrentPosActiveItem != v91 )
2851 while ( v104 < 8 ); 2851 v92 = m_text_color;
2852 return; 2852 dialog_window.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u);
2853 } 2853 v83 = pDialogueWindow;
2854 v72 = window_SpeakInHouse->ptr_1C; 2854 ++v153;
2855 v144.DrawCurrentTime(pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); 2855 ++v79;
2856 return; 2856 _this = (Player *)((char *)_this + 1);
2857 } 2857 }
2858 break; 2858 while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem );
2859 case 94: 2859 }
2860 { 2860 return;
2861 draw_leather(); 2861 }
2862 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 2862 break;
2863 v79 = pShopOptions; 2863 case 95: //buy spesial
2864 pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; 2864 {
2865 pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; 2865
2866 pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; 2866 pRenderer->DrawTextureIndexed(8, 8, ShopTexture);
2867 v80 = 0; 2867
2868 v81 = pShopOptions; 2868 v11 = 0;
2869 do 2869 v61 = 0;
2870 { 2870 v153 = 0;
2871 v82 = pFontArrus->CalcTextHeight(*v81, &v144, 0, 0); 2871 do
2872 ++v81; 2872 {
2873 v80 += v82; 2873 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID)
2874 } 2874 {
2875 while ( (signed int)v81 < (signed int)&pShopOptions[3] ); 2875 v62 = ItemsInShopTexture[v61];
2876 v83 = pDialogueWindow; 2876 if ( v61 >= 4 )
2877 v152 = (174 - v80) / 3; 2877 {
2878 v84 = pDialogueWindow->pStartingPosActiveItem; 2878 v67 = 90 - ((signed int)v62->uTextureWidth >> 1);
2879 v85 = v84 + pDialogueWindow->pNumPresenceButton; 2879 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]);
2880 v86 = (3 * (58 - v152) - v80) / 2 - v152 / 2 + 138; 2880 v66 = v153 + v67 + 80220;
2881 v24 = -pDialogueWindow->pNumPresenceButton < 0; 2881 }
2882 _this = (Player *)pDialogueWindow->pStartingPosActiveItem; 2882 else
2883 if ( v24 ^ __OFSUB__(v84, v85) ) 2883 {
2884 { 2884 v63 = 98 - v62->uTextureHeight;
2885 v153 = 2; 2885 v64 = ItemsInShopTexture[v61];
2886 do 2886 v65 = 98 - v62->uTextureHeight;
2887 { 2887 v152 = 86 - ((signed int)v62->uTextureWidth >> 1);
2888 v87 = v83->GetControl((unsigned int)_this); 2888 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64);
2889 v88 = v87; 2889 v66 = v152 + v153 + 640 * v63;
2890 v87->uY = v152 + v86; 2890 }
2891 v89 = pFontArrus->CalcTextHeight(*v79, &v144, 0, 0); 2891 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1);
2892 v90 = v88->uY; 2892 }
2893 v91 = v153; 2893 v153 += 105;
2894 v88->uHeight = v89; 2894 ++v61;
2895 v86 = v90 + v89 - 1; 2895 }
2896 v88->uW = v86; 2896 while ( v61 < 8 );
2897 v92 = v147; 2897
2898 if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) 2898 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
2899 v92 = v148; 2899 return;
2900 v144.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u); 2900 v68 = 0;
2901 v83 = pDialogueWindow; 2901 v149 = 0;
2902 ++v153; 2902
2903 ++v79; 2903 do
2904 _this = (Player *)((char *)_this + 1); 2904 {
2905 } 2905 // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 )
2906 while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); 2906 if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID)
2907 } 2907 ++v149;
2908 return; 2908 ++v68;
2909 } 2909 }
2910 break; 2910 while ( v68 < 6 );
2911 case 95: //buy spesial 2911
2912 { 2912 v69 = GetAsyncKeyState(17);
2913 2913 v70 = _this->CanSteal();
2914 pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); 2914 Str = (char *)v70;
2915 2915 if ( v69 == 0 || (char *)v70 == 0 )
2916 v11 = 0; 2916 {
2917 v61 = 0; 2917 v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy"
2918 v153 = 0; 2918 }
2919 do 2919 else
2920 { 2920 {
2921 // if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) 2921 v71 = pGlobalTXT_LocalizationStrings[185];
2922 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID) 2922 }
2923 { 2923 DrawTextAtStatusBar(v71, 0);
2924 v62 = ItemsInShopTexture[v61]; 2924 if ( (char *)v149 != 0 )
2925 if ( v61 >= 4 ) 2925 {
2926 { 2926 v73 = pMouse->GetCursorPos(&v136);
2927 v67 = 90 - ((signed int)v62->uTextureWidth >> 1); 2927 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF;
2928 pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); 2928 if ( !v74 )
2929 v126 = v61 + 1; 2929 return;
2930 v66 = v153 + v67 + 80220; 2930 v149 = v74 - 1;
2931 } 2931
2932 else 2932 if ( dialog_menu_id == 2 )
2933 { 2933 selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1];
2934 v63 = 98 - v62->uTextureHeight; 2934 else
2935 v64 = ItemsInShopTexture[v61]; 2935 selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724];
2936 v65 = 98 - v62->uTextureHeight; 2936 if ( v69 == 0 || Str == 0 )
2937 v152 = 86 - ((signed int)v62->uTextureWidth >> 1); 2937 {
2938 pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); 2938 v120 = window_SpeakInHouse->ptr_1C;
2939 v126 = v61 + 1; 2939 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)];
2940 v66 = v152 + v153 + 640 * v63; 2940 }
2941 } 2941 else
2942 ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v126); 2942 {
2943 v11 = 0; 2943 v120 = window_SpeakInHouse->ptr_1C;
2944 } 2944 v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24"
2945 v153 += 105; 2945 }
2946 ++v61; 2946 v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0);
2947 } 2947 v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138;
2948 while ( v61 < 8 ); 2948 dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3);
2949 2949 return;
2950 if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 2950 }
2951 return; 2951 dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed);
2952 v68 = 0; 2952 return;
2953 v149 = (__int32)v11; 2953 }
2954 2954
2955 do 2955 break;
2956 { 2956 case 96: //skills
2957 // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) 2957 {
2958 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID) 2958
2959 ++v149; 2959 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() )
2960 ++v68; 2960 return;
2961 } 2961 v152 = 0;
2962 while ( v68 < 6 ); 2962 v37 = pDialogueWindow;
2963 2963 //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
2964 v69 = GetAsyncKeyState(17); 2964 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
2965 v70 = _this->CanSteal(); 2965 _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100);
2966 Str = (char *)v70; 2966 if ( (signed int)_this < v38 / 3 )
2967 if ( v69 == (short)v11 || (char *)v70 == v11 ) 2967 _this = (Player *)(v38 / 3);
2968 { 2968 v39 = v37->pStartingPosActiveItem;
2969 v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" 2969 v40 = v37->pNumPresenceButton;
2970 } 2970 v153 = 0;
2971 else 2971 if ( (signed int)v39 < (signed int)(v39 + v40) )
2972 { 2972 {
2973 v71 = pGlobalTXT_LocalizationStrings[185]; 2973 do
2974 } 2974 {
2975 DrawTextAtStatusBar(v71, 0); 2975 v41 = v37->GetControl(v39)->uControlParam - 36;
2976 if ( (char *)v149 != v11 ) 2976 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] )
2977 { 2977 {
2978 v73 = pMouse->GetCursorPos(&v136); 2978 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0);
2979 v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; 2979 v152 += v42;
2980 if ( !v74 ) 2980 ++v153;
2981 return; 2981 }
2982 v149 = v74 - 1; 2982 ++v39;
2983 v75 = (int)window_SpeakInHouse->ptr_1C; 2983 }
2984 v76 = 9 * (v74 - 1 + 12 * v75); 2984 while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem );
2985 if ( dword_F8B19C == 2 ) 2985 if ( v153 )
2986 v77 = (ItemGen *)&pParty->StandartItemsInShops[(int)75][v74-1]; 2986 {
2987 else 2987 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this);
2988 v77 = &pParty->SpecialItemsInShops[(int)v75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; 2988 dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
2989 if ( v69 == (short)v11 || Str == v11 ) 2989 _this = (Player *)((149 - v152) / v153);
2990 { 2990 if ( (149 - v152) / v153 > 32 )
2991 v124 = (__int64 *)v11; 2991 _this = (Player *)32;
2992 v122 = 2; 2992 v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162;
2993 v120 = window_SpeakInHouse->ptr_1C; 2993 v152 = v37->pStartingPosActiveItem;
2994 v116 = v77; 2994 v146 = v43;
2995 v78 = uActiveCharacter - 1; 2995 if ( v152 < v152 + v37->pNumPresenceButton )
2996 v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(v77, 2, v75, 2)]; 2996 {
2997 v14 = v78; 2997 v153 = 2;
2998 } 2998 do
2999 else 2999 {
3000 { 3000 v44 = v37->GetControl(v152);
3001 v124 = (__int64 *)v11; 3001 v45 = v44;
3002 v122 = 2; 3002 v46 = v44->uControlParam - 36;
3003 v120 = window_SpeakInHouse->ptr_1C; 3003 if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] )
3004 v116 = v77; 3004 {
3005 v15 = pGlobalTXT_LocalizationStrings[181]; 3005 v45->uW = 0;
3006 v14 = uActiveCharacter - 1; 3006 v45->uHeight = 0;
3007 } 3007 v45->uY = 0;
3008 v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); 3008 }
3009 v123 = 3; 3009 else
3010 v121 = v36; 3010 {
3011 v119 = v148; 3011 v47 = pSkillNames[v46];
3012 v117 = (int)v11; 3012 v45->uY = (unsigned int)((char *)_this + v146);
3013 v113 = (int)v11; 3013 Str = v47;
3014 v111 = &v144; 3014 v48 = pFontArrus->CalcTextHeight(v47, &dialog_window, 0, 0);
3015 v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; 3015 v49 = v45->uY;
3016 v112 = (unsigned int)v11; 3016 v50 = v153;
3017 v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); 3017 v45->uHeight = v48;
3018 return; 3018 v51 = v49 + v48 - 1;
3019 } 3019 v45->uW = v51;
3020 v72 = window_SpeakInHouse->ptr_1C; 3020 v146 = v51;
3021 v144.DrawCurrentTime( pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); 3021 v52 = hilight_color;
3022 return; 3022 if ( pDialogueWindow->pCurrentPosActiveItem != v50 )
3023 } 3023 v52 = m_text_color;
3024 3024 dialog_window.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u);
3025 break; 3025 }
3026 case 96: 3026 v53 = v37->pStartingPosActiveItem;
3027 if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) 3027 ++v152;
3028 return; 3028 textureH = v37->pNumPresenceButton + v53;
3029 v152 = 0; 3029 ++v153;
3030 v37 = pDialogueWindow; 3030 }
3031 //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); 3031 while ( v152 < textureH );
3032 v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); 3032 }
3033 _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100); 3033 return;
3034 if ( (signed int)_this < v38 / 3 ) 3034 }
3035 _this = (Player *)(v38 / 3); 3035 }
3036 v39 = v37->pStartingPosActiveItem; 3036 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); //"Seek knowledge elsewhere %s the %s"
3037 v40 = v37->pNumPresenceButton; 3037 strcat(pTmpBuf, "\n \n");
3038 v153 = 0; 3038 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further."
3039 if ( (signed int)v39 < (signed int)(v39 + v40) ) 3039 v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138;
3040 { 3040 dialog_window.DrawTitleText(pFontArrus, 0, v115, hilight_color, pTmpBuf, 3);
3041 do 3041 return;
3042 { 3042 }
3043 v41 = v37->GetControl(v39)->uControlParam - 36; 3043 break;
3044 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] ) 3044
3045 { 3045 }
3046 v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &v144, 0, 0); 3046
3047 v152 += v42; 3047 }
3048 ++v153;
3049 }
3050 ++v39;
3051 }
3052 while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem );
3053 if ( v153 )
3054 {
3055 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this);
3056 v144.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u);
3057 _this = (Player *)((149 - v152) / v153);
3058 if ( (149 - v152) / v153 > 32 )
3059 _this = (Player *)32;
3060 v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162;
3061 v152 = v37->pStartingPosActiveItem;
3062 v146 = v43;
3063 if ( v152 < v152 + v37->pNumPresenceButton )
3064 {
3065 v153 = 2;
3066 do
3067 {
3068 v44 = v37->GetControl(v152);
3069 v45 = v44;
3070 v46 = v44->uControlParam - 36;
3071 if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] )
3072 {
3073 v45->uW = 0;
3074 v45->uHeight = 0;
3075 v45->uY = 0;
3076 }
3077 else
3078 {
3079 v47 = pSkillNames[v46];
3080 v45->uY = (unsigned int)((char *)_this + v146);
3081 Str = v47;
3082 v48 = pFontArrus->CalcTextHeight(v47, &v144, 0, 0);
3083 v49 = v45->uY;
3084 v50 = v153;
3085 v45->uHeight = v48;
3086 v51 = v49 + v48 - 1;
3087 v45->uW = v51;
3088 v146 = v51;
3089 v52 = v147;
3090 if ( pDialogueWindow->pCurrentPosActiveItem != v50 )
3091 v52 = v148;
3092 v144.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u);
3093 }
3094 v53 = v37->pStartingPosActiveItem;
3095 ++v152;
3096 v54 = v37->pNumPresenceButton + v53;
3097 ++v153;
3098 }
3099 while ( v152 < v54 );
3100 }
3101 return;
3102 }
3103 }
3104 sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]);
3105 strcat(pTmpBuf, "\n \n");
3106 strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);
3107 v11 = 0;
3108 v36 = pTmpBuf;
3109 v123 = 3;
3110 v121 = pTmpBuf;
3111 v119 = v147;
3112 v117 = 0;
3113 v113 = 0;
3114 v111 = &v144;
3115 v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138;
3116 v112 = (unsigned int)v11;
3117 v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123);
3118 return;
3119 break;
3120
3121 }
3122
3123 }
3124 3048
3125 //----- (004BB756) -------------------------------------------------------- 3049 //----- (004BB756) --------------------------------------------------------
3126 signed int __fastcall sub_4BB756(signed int a1) 3050 signed int __fastcall sub_4BB756(signed int a1)
3127 { 3051 {
3128 unsigned int v1; // esi@8 3052 unsigned int v1; // esi@8
3362 pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel" 3286 pBtn_ExitCancel = pDialogueWindow->CreateButton(471u, 445u, 169u, 35u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[34],// "Cancel"
3363 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); 3287 (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0);
3364 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); 3288 pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0);
3365 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0); 3289 pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0);
3366 pDialogueWindow->_41D08F(1, 1, 0, 2); 3290 pDialogueWindow->_41D08F(1, 1, 0, 2);
3367 dword_F8B19C = -1; 3291 dialog_menu_id = -1;
3368 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); 3292 v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102);
3369 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) 3293 if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed )
3370 { 3294 {
3371 pParty->field_75A[v0] = 0; 3295 pParty->field_75A[v0] = 0;
3372 v1 = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) 3296 v1 = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015))
3950 //v55 = a1; 3874 //v55 = a1;
3951 if ( !pDialogueWindow->pNumPresenceButton ) 3875 if ( !pDialogueWindow->pNumPresenceButton )
3952 return; 3876 return;
3953 pRenderer->ClearZBuffer(0, 479); 3877 pRenderer->ClearZBuffer(0, 479);
3954 //v3 = dword_F8B198; 3878 //v3 = dword_F8B198;
3955 if ( dword_F8B19C != 1 ) 3879 if ( dialog_menu_id != 1 )
3956 { 3880 {
3957 v8 = window_SpeakInHouse; 3881 v8 = window_SpeakInHouse;
3958 } 3882 }
3959 else 3883 else
3960 { 3884 {
4008 return; 3932 return;
4009 v8 = window_SpeakInHouse; 3933 v8 = window_SpeakInHouse;
4010 } 3934 }
4011 } 3935 }
4012 //LABEL_11: 3936 //LABEL_11:
4013 dword_F8B19C = uMessageParam; 3937 dialog_menu_id = uMessageParam;
4014 if ( in_current_building_type < BildingType_19 ) 3938 if ( in_current_building_type < BildingType_19 )
4015 { 3939 {
4016 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); 3940 v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE);
4017 //v3 = dword_F8B198; 3941 //v3 = dword_F8B198;
4018 ShopTexture = &pIcons_LOD->pTextures[v9]; 3942 ShopTexture = &pIcons_LOD->pTextures[v9];
4022 } 3946 }
4023 if ( in_current_building_type > BildingType_Tavern ) 3947 if ( in_current_building_type > BildingType_Tavern )
4024 { 3948 {
4025 if ( in_current_building_type == BildingType_Bank ) 3949 if ( in_current_building_type == BildingType_Bank )
4026 { 3950 {
4027 if ( dword_F8B19C >= 7 && dword_F8B19C <= 8 ) 3951 if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 )
4028 pKeyActionMap->EnterText(1, 10, v8); 3952 pKeyActionMap->EnterText(1, 10, v8);
4029 return; 3953 return;
4030 } 3954 }
4031 if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training ) 3955 if ( in_current_building_type != BildingType_Temple && in_current_building_type != BildingType_Training )
4032 return; 3956 return;
4294 pDialogueWindow->eWindowType = WINDOW_MainMenu; 4218 pDialogueWindow->eWindowType = WINDOW_MainMenu;
4295 UI_CreateEndConversationButton(); 4219 UI_CreateEndConversationButton();
4296 sub_4B3A72(in_current_building_type); 4220 sub_4B3A72(in_current_building_type);
4297 break; 4221 break;
4298 case 102: 4222 case 102:
4299 dword_F8B19C = 102; 4223 dialog_menu_id = 102;
4300 break; 4224 break;
4301 case 103: 4225 case 103:
4302 dword_F8B19C = 103; 4226 dialog_menu_id = 103;
4303 break; 4227 break;
4304 case 104: 4228 case 104:
4305 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) 4229 /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
4306 { 4230 {
4307 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29; 4231 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29;
4308 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; 4232 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1;
4309 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; 4233 *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1;
4310 ++pMessageQueue_50CBD0->uNumMessages; 4234 ++pMessageQueue_50CBD0->uNumMessages;
4311 }*/ 4235 }*/
4312 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, v1, v1); 4236 pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, v1, v1);
4313 dword_F8B19C = 104; 4237 dialog_menu_id = 104;
4314 break; 4238 break;
4315 } 4239 }
4316 return; 4240 return;
4317 } 4241 }
4318 if ( uMessageParam != 95 && uMessageParam != 2 ) 4242 if ( uMessageParam != 95 && uMessageParam != 2 )
4319 { 4243 {
4320 if ( uMessageParam == 3 ) 4244 if ( uMessageParam == 3 )
4321 { 4245 {
4322 dword_F8B19C = 3; 4246 dialog_menu_id = 3;
4323 } 4247 }
4324 else 4248 else
4325 { 4249 {
4326 if ( uMessageParam == 4 ) 4250 if ( uMessageParam == 4 )
4327 { 4251 {
4328 dword_F8B19C = 4; 4252 dialog_menu_id = 4;
4329 } 4253 }
4330 else 4254 else
4331 { 4255 {
4332 if ( uMessageParam != 5 ) 4256 if ( uMessageParam != 5 )
4333 { 4257 {
4384 } 4308 }
4385 } 4309 }
4386 } 4310 }
4387 return; 4311 return;
4388 } 4312 }
4389 dword_F8B19C = 5; 4313 dialog_menu_id = 5;
4390 } 4314 }
4391 } 4315 }
4392 sub_421B2C_PlaceInInventory_or_DropPickedItem(); 4316 sub_421B2C_PlaceInInventory_or_DropPickedItem();
4393 return; 4317 return;
4394 } 4318 }
4515 pKeyActionMap->ResetKeys(); 4439 pKeyActionMap->ResetKeys();
4516 activeLevelDecoration = NULL; 4440 activeLevelDecoration = NULL;
4517 ptr_F8B1E8 = 0; 4441 ptr_F8B1E8 = 0;
4518 if ( pDialogueNPCCount ) 4442 if ( pDialogueNPCCount )
4519 { 4443 {
4520 v0 = dword_F8B19C; 4444 v0 = dialog_menu_id;
4521 if ( dword_F8B19C != 2 4445 if ( dialog_menu_id != 2
4522 && dword_F8B19C != 3 4446 && dialog_menu_id != 3
4523 && dword_F8B19C != 97 4447 && dialog_menu_id != 97
4524 && dword_F8B19C != 5 4448 && dialog_menu_id != 5
4525 && dword_F8B19C != 4 4449 && dialog_menu_id != 4
4526 && ShopTexture ) 4450 && ShopTexture )
4527 { 4451 {
4528 ShopTexture->Release(); 4452 ShopTexture->Release();
4529 v0 = dword_F8B19C; 4453 v0 = dialog_menu_id;
4530 ShopTexture = 0; 4454 ShopTexture = 0;
4531 } 4455 }
4532 if ( v0 && v0 != 1 ) 4456 if ( v0 && v0 != 1 )
4533 { 4457 {
4534 if ( v0 == -1 ) 4458 if ( v0 == -1 )
4541 if ( v0 != 94 && v0 != 96 && v0 != 101 ) 4465 if ( v0 != 94 && v0 != 96 && v0 != 101 )
4542 { 4466 {
4543 if ( v0 == 3 || v0 == 5 || v0 == 4 ) 4467 if ( v0 == 3 || v0 == 5 || v0 == 4 )
4544 { 4468 {
4545 UI_CreateEndConversationButton(); 4469 UI_CreateEndConversationButton();
4546 dword_F8B19C = 94; 4470 dialog_menu_id = 94;
4547 sub_4B3AD4(in_current_building_type); 4471 sub_4B3AD4(in_current_building_type);
4548 } 4472 }
4549 else 4473 else
4550 { 4474 {
4551 if ( v0 != 102 && v0 != 103 && v0 != 104 ) 4475 if ( v0 != 102 && v0 != 103 && v0 != 104 )
4552 { 4476 {
4553 pVideoPlayer->_4BF5B2(); 4477 pVideoPlayer->_4BF5B2();
4554 //LABEL_28: 4478 //LABEL_28:
4555 dword_F8B19C = 1; 4479 dialog_menu_id = 1;
4556 sub_4B3B42(in_current_building_type); 4480 sub_4B3B42(in_current_building_type);
4557 return 1; 4481 return 1;
4558 } 4482 }
4559 pVideoPlayer->_4BF5B2(); 4483 pVideoPlayer->_4BF5B2();
4560 UI_CreateEndConversationButton(); 4484 UI_CreateEndConversationButton();
4561 dword_F8B19C = 101; 4485 dialog_menu_id = 101;
4562 sub_4B3A72(in_current_building_type); 4486 sub_4B3A72(in_current_building_type);
4563 } 4487 }
4564 return 1; 4488 return 1;
4565 } 4489 }
4566 pVideoPlayer->_4BF5B2(); 4490 pVideoPlayer->_4BF5B2();
4567 UI_CreateEndConversationButton(); 4491 UI_CreateEndConversationButton();
4568 dword_F8B19C = 1; 4492 dialog_menu_id = 1;
4569 sub_4B3B42(in_current_building_type); 4493 sub_4B3B42(in_current_building_type);
4570 return 1; 4494 return 1;
4571 } 4495 }
4572 pDialogueNPCCount = 0; 4496 pDialogueNPCCount = 0;
4573 pDialogueWindow->Release(); 4497 pDialogueWindow->Release();
4574 dword_F8B19C = 0; 4498 dialog_menu_id = 0;
4575 pDialogueWindow = 0; 4499 pDialogueWindow = 0;
4576 pIcons_LOD->_40F9C5(); 4500 pIcons_LOD->_40F9C5();
4577 v1 = uNumDialogueNPCPortraits; 4501 v1 = uNumDialogueNPCPortraits;
4578 if ( uNumDialogueNPCPortraits != 1 ) 4502 if ( uNumDialogueNPCPortraits != 1 )
4579 { 4503 {
4706 v47 = 0; 4630 v47 = 0;
4707 v46 = 0; 4631 v46 = 0;
4708 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); 4632 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
4709 return; 4633 return;
4710 } 4634 }
4711 if ( dword_F8B19C > 18 ) 4635 if ( dialog_menu_id > 18 )
4712 { 4636 {
4713 if ( dword_F8B19C < 36 ) 4637 if ( dialog_menu_id < 36 )
4714 return; 4638 return;
4715 if ( dword_F8B19C <= 72 ) 4639 if ( dialog_menu_id <= 72 )
4716 { 4640 {
4717 v42 = dword_F8B19C - 36; 4641 v42 = dialog_menu_id - 36;
4718 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); 4642 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
4719 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); 4643 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
4720 v44 = v43 * (100 - v0->GetMerchant()) / 100; 4644 v44 = v43 * (100 - v0->GetMerchant()) / 100;
4721 if ( v44 < v43 / 3 ) 4645 if ( v44 < v43 / 3 )
4722 v44 = v43 / 3; 4646 v44 = v43 / 3;
4746 return; 4670 return;
4747 } 4671 }
4748 } 4672 }
4749 return; 4673 return;
4750 } 4674 }
4751 if ( dword_F8B19C != 94 ) 4675 if ( dialog_menu_id != 94 )
4752 { 4676 {
4753 if ( dword_F8B19C != 95 ) 4677 if ( dialog_menu_id != 95 )
4754 return; 4678 return;
4755 goto LABEL_49; 4679 goto LABEL_49;
4756 } 4680 }
4757 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; 4681 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
4758 //LABEL_73: 4682 //LABEL_73:
4759 sub_421EA6_OnInventoryLeftClick(); 4683 sub_421EA6_OnInventoryLeftClick();
4760 return; 4684 return;
4761 } 4685 }
4762 if ( dword_F8B19C == 18 ) 4686 if ( dialog_menu_id == 18 )
4763 { 4687 {
4764 v17 = pMouse->GetCursorPos(&v63); 4688 v17 = pMouse->GetCursorPos(&v63);
4765 v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF; 4689 v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF;
4766 if ( !v18 ) 4690 if ( !v18 )
4767 return; 4691 return;
4806 //LABEL_70: 4730 //LABEL_70:
4807 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" 4731 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!"
4808 ShowStatusBarString(v9, v54); 4732 ShowStatusBarString(v9, v54);
4809 return; 4733 return;
4810 } 4734 }
4811 if ( dword_F8B19C == 2 ) 4735 if ( dialog_menu_id == 2 )
4812 { 4736 {
4813 LABEL_49: 4737 LABEL_49:
4814 v28 = pMouse->GetCursorPos(&v59); 4738 v28 = pMouse->GetCursorPos(&v59);
4815 v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v57)->y]] & 0xFFFF; 4739 v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v57)->y]] & 0xFFFF;
4816 if ( !v29 ) 4740 if ( !v29 )
4817 return; 4741 return;
4818 v30 = window_SpeakInHouse->ptr_1C; 4742 v30 = window_SpeakInHouse->ptr_1C;
4819 // v31 = 9 * (v29 - 1 + 12 * (int)v30); 4743 // v31 = 9 * (v29 - 1 + 12 * (int)v30);
4820 if ( dword_F8B19C == 2 ) 4744 if ( dialog_menu_id == 2 )
4821 { 4745 {
4822 v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; 4746 v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29];
4823 _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; 4747 _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29];
4824 } 4748 }
4825 else 4749 else
4914 v54 = 2; 4838 v54 = 2;
4915 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!" 4839 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!"
4916 ShowStatusBarString(v9, v54); 4840 ShowStatusBarString(v9, v54);
4917 return; 4841 return;
4918 } 4842 }
4919 if ( dword_F8B19C == 3 ) 4843 if ( dialog_menu_id == 3 )
4920 { 4844 {
4921 v14 = pMouse->GetCursorPos(&v71)->x - 14; 4845 v14 = pMouse->GetCursorPos(&v71)->x - 14;
4922 v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5); 4846 v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5);
4923 if ( pMouse->GetCursorPos(&v67)->x <= 13 4847 if ( pMouse->GetCursorPos(&v67)->x <= 13
4924 || pMouse->GetCursorPos(&v65)->x >= 462 4848 || pMouse->GetCursorPos(&v65)->x >= 462
4947 v46 = 0; 4871 v46 = 0;
4948 //LABEL_87: 4872 //LABEL_87:
4949 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); 4873 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
4950 return; 4874 return;
4951 } 4875 }
4952 if ( dword_F8B19C == 4 ) 4876 if ( dialog_menu_id == 4 )
4953 { 4877 {
4954 v10 = pMouse->GetCursorPos(&v62)->x - 14; 4878 v10 = pMouse->GetCursorPos(&v62)->x - 14;
4955 v79 = (v10 >> 5) + 14 * ((pMouse->GetCursorPos(&v66)->y - 17) >> 5); 4879 v79 = (v10 >> 5) + 14 * ((pMouse->GetCursorPos(&v66)->y - 17) >> 5);
4956 if ( pMouse->GetCursorPos(&v58)->x > 13 ) 4880 if ( pMouse->GetCursorPos(&v58)->x > 13 )
4957 { 4881 {
5001 } 4925 }
5002 } 4926 }
5003 } 4927 }
5004 else 4928 else
5005 { 4929 {
5006 if ( dword_F8B19C == 5 ) 4930 if ( dialog_menu_id == 5 )
5007 { 4931 {
5008 v1 = pMouse->GetCursorPos(&a2)->x - 14; 4932 v1 = pMouse->GetCursorPos(&a2)->x - 14;
5009 v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5); 4933 v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5);
5010 if ( pMouse->GetCursorPos(&v60)->x > 13 ) 4934 if ( pMouse->GetCursorPos(&v60)->x > 13 )
5011 { 4935 {