comparison mm7_4.cpp @ 471:c43f156a95c9

ArmorShopDialog crash fixed. All shops show its items
author Gloval
date Mon, 25 Feb 2013 23:33:15 +0400
parents fcdaa804074f
children 7f1b00901cf7
comparison
equal deleted inserted replaced
470:fcdaa804074f 471:c43f156a95c9
10888 } 10888 }
10889 10889
10890 10890
10891 10891
10892 //----- (004B46A5) -------------------------------------------------------- 10892 //----- (004B46A5) --------------------------------------------------------
10893 char __fastcall sub_4B46A5(const char *Str, int a5) 10893 char __fastcall DrawTextAtStatusBar(const char *sText, int font_color)
10894 { 10894 {
10895 const char *v2; // esi@1
10896 int v3; // edi@1
10897 int v4; // eax@1 10895 int v4; // eax@1
10898 10896 pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar);
10899 v2 = Str; 10897 v4 = pFontLucida->AlignText_Center(450, sText);
10900 v3 = a5; 10898 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0);
10901 pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar);
10902 v4 = pFontLucida->AlignText_Center(0x1C2u, v2);
10903 return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, v3, v2, 0, 0, 0);
10904 } 10899 }
10905 10900
10906 //----- (004B46F8) -------------------------------------------------------- 10901 //----- (004B46F8) --------------------------------------------------------
10907 int __fastcall sub_4B46F8(int a1) 10902 int __fastcall sub_4B46F8(int a1)
10908 { 10903 {
11608 { 11603 {
11609 if ( dword_F8B19C == 5 ) 11604 if ( dword_F8B19C == 5 )
11610 { 11605 {
11611 draw_leather(); 11606 draw_leather();
11612 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 11607 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
11613 sub_4B46A5(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" 11608 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair"
11614 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 11609 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
11615 if ( !result 11610 if ( !result
11616 || (v27 = pMouse->GetCursorPos(&v110)->x - 14, 11611 || (v27 = pMouse->GetCursorPos(&v110)->x - 14,
11617 v117 = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5), 11612 v117 = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5),
11618 result = (int)pMouse->GetCursorPos(&v106), 11613 result = (int)pMouse->GetCursorPos(&v106),
11694 result = dword_F8B19C - 4; 11689 result = dword_F8B19C - 4;
11695 if ( dword_F8B19C == 4 ) 11690 if ( dword_F8B19C == 4 )
11696 { 11691 {
11697 draw_leather(); 11692 draw_leather();
11698 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 11693 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
11699 sub_4B46A5(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" 11694 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify"
11700 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 11695 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
11701 if ( result ) 11696 if ( result )
11702 { 11697 {
11703 v2 = pMouse->GetCursorPos(&a2)->x - 14; 11698 v2 = pMouse->GetCursorPos(&a2)->x - 14;
11704 v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5); 11699 v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5);
11739 } 11734 }
11740 return result; 11735 return result;
11741 } 11736 }
11742 draw_leather(); 11737 draw_leather();
11743 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); 11738 CharacterUI_InventoryTab_Draw(uActiveCharacter, 1);
11744 sub_4B46A5(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" 11739 DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell"
11745 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); 11740 result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win();
11746 if ( !result 11741 if ( !result
11747 || (v11 = pMouse->GetCursorPos(&v107)->x - 14, 11742 || (v11 = pMouse->GetCursorPos(&v107)->x - 14,
11748 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5), 11743 v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5),
11749 result = (int)pMouse->GetCursorPos(&v105), 11744 result = (int)pMouse->GetCursorPos(&v105),
11782 do 11777 do
11783 { 11778 {
11784 // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) 11779 // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] )
11785 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID); 11780 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID);
11786 { 11781 {
11787 v50 = dword_F8B168[v49]; 11782 v50 = ItemsInShopTexture[v49];
11788 v51 = 152 - v50->uTextureHeight; 11783 v51 = 152 - v50->uTextureHeight;
11789 if ( (signed int)v51 < 1 ) 11784 if ( (signed int)v51 < 1 )
11790 v51 = 0; 11785 v51 = 0;
11791 v52 = 75 * v49 - v50->uTextureWidth / 2 + 40; 11786 v52 = 75 * v49 - v50->uTextureWidth / 2 + 40;
11792 if ( v122 ) 11787 if ( v122 )
11793 { 11788 {
11794 if ( v122 == 5 ) 11789 if ( v122 == 5 )
11795 { 11790 {
11796 v53 = dword_F8B168[5]->uTextureWidth; 11791 v53 = ItemsInShopTexture[5]->uTextureWidth;
11797 if ( (signed int)v52 > 457 - v53 ) 11792 if ( (signed int)v52 > 457 - v53 )
11798 v52 = 457 - v53; 11793 v52 = 457 - v53;
11799 } 11794 }
11800 } 11795 }
11801 else 11796 else
11802 { 11797 {
11803 if ( (signed int)v52 < 18 ) 11798 if ( (signed int)v52 < 18 )
11804 v52 = 18; 11799 v52 = 18;
11805 } 11800 }
11806 pRenderer->DrawTextureTransparent(v52, v51, v50); 11801 pRenderer->DrawTextureTransparent(v52, v51, v50);
11807 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], dword_F8B168[v122], v122 + 1); 11802 sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1);
11808 v49 = v122; 11803 v49 = v122;
11809 } 11804 }
11810 ++v49; 11805 ++v49;
11811 v122 = v49; 11806 v122 = v49;
11812 } 11807 }
11815 do 11810 do
11816 { 11811 {
11817 //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) 11812 //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] )
11818 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID); 11813 if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID);
11819 { 11814 {
11820 v54 = dword_F8B168[v122 + 6]; 11815 v54 = ItemsInShopTexture[v122 + 6];
11821 v55 = 306 - v54->uTextureHeight; 11816 v55 = 306 - v54->uTextureHeight;
11822 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; 11817 v56 = 75 * v122 - v54->uTextureWidth / 2 + 40;
11823 if ( v122 ) 11818 if ( v122 )
11824 { 11819 {
11825 if ( v122 == 5 ) 11820 if ( v122 == 5 )
11826 { 11821 {
11827 v57 = dword_F8B168[11]->uTextureWidth; 11822 v57 = ItemsInShopTexture[11]->uTextureWidth;
11828 if ( (signed int)v56 > 457 - v57 ) 11823 if ( (signed int)v56 > 457 - v57 )
11829 v56 = 457 - v57; 11824 v56 = 457 - v57;
11830 } 11825 }
11831 } 11826 }
11832 else 11827 else
11833 { 11828 {
11834 if ( (signed int)v56 < 18 ) 11829 if ( (signed int)v56 < 18 )
11835 v56 = 18; 11830 v56 = 18;
11836 } 11831 }
11837 pRenderer->DrawTextureTransparent(v56, v55, v54); 11832 pRenderer->DrawTextureTransparent(v56, v55, v54);
11838 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], dword_F8B168[v122 + 6], v122 + 7); 11833 sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7);
11839 } 11834 }
11840 ++v122; 11835 ++v122;
11841 } 11836 }
11842 while ( v122 < 6 ); 11837 while ( v122 < 6 );
11843 } 11838 }
11846 do 11841 do
11847 { 11842 {
11848 // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) 11843 // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] )
11849 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) 11844 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID)
11850 { 11845 {
11851 v58 = dword_F8B168[v49]; 11846 v58 = ItemsInShopTexture[v49];
11852 v59 = 152 - v58->uTextureHeight; 11847 v59 = 152 - v58->uTextureHeight;
11853 if ( (signed int)v59 < 1 ) 11848 if ( (signed int)v59 < 1 )
11854 v59 = 0; 11849 v59 = 0;
11855 v60 = 75 * v49 - v58->uTextureWidth / 2 + 40; 11850 v60 = 75 * v49 - v58->uTextureWidth / 2 + 40;
11856 if ( v122 ) 11851 if ( v122 )
11857 { 11852 {
11858 if ( v122 == 5 ) 11853 if ( v122 == 5 )
11859 { 11854 {
11860 v61 = dword_F8B168[5]->uTextureWidth; 11855 v61 = ItemsInShopTexture[5]->uTextureWidth;
11861 if ( (signed int)v60 > 457 - v61 ) 11856 if ( (signed int)v60 > 457 - v61 )
11862 v60 = 457 - v61; 11857 v60 = 457 - v61;
11863 } 11858 }
11864 } 11859 }
11865 else 11860 else
11866 { 11861 {
11867 if ( (signed int)v60 < 18 ) 11862 if ( (signed int)v60 < 18 )
11868 v60 = 18; 11863 v60 = 18;
11869 } 11864 }
11870 pRenderer->DrawTextureTransparent(v60, v59, v58); 11865 pRenderer->DrawTextureTransparent(v60, v59, v58);
11871 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], dword_F8B168[v122], v122 + 1); 11866 sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1);
11872 v49 = v122; 11867 v49 = v122;
11873 } 11868 }
11874 ++v49; 11869 ++v49;
11875 v122 = v49; 11870 v122 = v49;
11876 } 11871 }
11879 do 11874 do
11880 { 11875 {
11881 //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] ) //weak 11876 //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] ) //weak
11882 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes) 11877 if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes)
11883 { 11878 {
11884 v62 = dword_F8B168[v122 + 6]; 11879 v62 = ItemsInShopTexture[v122 + 6];
11885 v63 = 306 - v62->uTextureHeight; 11880 v63 = 306 - v62->uTextureHeight;
11886 if ( (signed int)v63 < 1 ) 11881 if ( (signed int)v63 < 1 )
11887 v63 = 0; 11882 v63 = 0;
11888 v64 = 75 * v122 - v62->uTextureWidth / 2 + 40; 11883 v64 = 75 * v122 - v62->uTextureWidth / 2 + 40;
11889 if ( v122 ) 11884 if ( v122 )
11890 { 11885 {
11891 if ( v122 == 5 ) 11886 if ( v122 == 5 )
11892 { 11887 {
11893 v65 = dword_F8B168[11]->uTextureWidth; 11888 v65 = ItemsInShopTexture[11]->uTextureWidth;
11894 if ( (signed int)v64 > 457 - v65 ) 11889 if ( (signed int)v64 > 457 - v65 )
11895 v64 = 457 - v65; 11890 v64 = 457 - v65;
11896 } 11891 }
11897 } 11892 }
11898 else 11893 else
11899 { 11894 {
11900 if ( (signed int)v64 < 18 ) 11895 if ( (signed int)v64 < 18 )
11901 v64 = 18; 11896 v64 = 18;
11902 } 11897 }
11903 pRenderer->DrawTextureTransparent(v64, v63, v62); 11898 pRenderer->DrawTextureTransparent(v64, v63, v62);
11904 sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], dword_F8B168[v122 + 6], v122 + 7); 11899 sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7);
11905 } 11900 }
11906 ++v122; 11901 ++v122;
11907 } 11902 }
11908 while ( v122 < 6 ); 11903 while ( v122 < 6 );
11909 } 11904 }
11944 { 11939 {
11945 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" 11940 v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy"
11946 if ( dword_F8B19C != 2 ) 11941 if ( dword_F8B19C != 2 )
11947 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" 11942 v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy"
11948 } 11943 }
11949 sub_4B46A5(v69, 0); 11944 DrawTextAtStatusBar(v69, 0);
11950 if ( !v117 ) 11945 if ( !v117 )
11951 return (int)v112._4B1854( 11946 {
11952 __PAIR__( 11947 v112.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed);
11953 pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C + 1], 11948 return 0;
11954 pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) 11949 }
11955 - pParty->uTimePlayed);
11956 v70 = pMouse->GetCursorPos(&v102); 11950 v70 = pMouse->GetCursorPos(&v102);
11957 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; 11951 result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y];
11958 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) 11952 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
11959 { 11953 {
11960 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; 11954 v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1;
12454 v63 = 32; 12448 v63 = 32;
12455 do 12449 do
12456 { 12450 {
12457 if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) 12451 if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
12458 { 12452 {
12459 pRenderer->DrawTextureTransparent(v63, 0x5Au, dword_F8B168[v6]); 12453 pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]);
12460 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), dword_F8B168[v6], v6 + 1); 12454 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1);
12461 v1 = v58; 12455 v1 = v58;
12462 } 12456 }
12463 v63 += 70; 12457 v63 += 70;
12464 v62 += 280; 12458 v62 += 280;
12465 ++v6; 12459 ++v6;
12470 v63 = 32; 12464 v63 = 32;
12471 do 12465 do
12472 { 12466 {
12473 if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) 12467 if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) )
12474 { 12468 {
12475 pRenderer->DrawTextureTransparent(v63, 0xFAu, dword_F8B168[v7]); 12469 pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]);
12476 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), dword_F8B168[v7], v7 + 1); 12470 ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1);
12477 v1 = v58; 12471 v1 = v58;
12478 } 12472 }
12479 v63 += 70; 12473 v63 += 70;
12480 v62 += 280; 12474 v62 += 280;
12481 ++v7; 12475 ++v7;
12497 while ( v9 ); 12491 while ( v9 );
12498 GetAsyncKeyState(17); 12492 GetAsyncKeyState(17);
12499 v11 = pGlobalTXT_LocalizationStrings[195]; 12493 v11 = pGlobalTXT_LocalizationStrings[195];
12500 if ( dword_F8B19C != 2 ) 12494 if ( dword_F8B19C != 2 )
12501 v11 = pGlobalTXT_LocalizationStrings[196]; 12495 v11 = pGlobalTXT_LocalizationStrings[196];
12502 sub_4B46A5(v11, 0); 12496 DrawTextAtStatusBar(v11, 0);
12503 if ( !v8 ) 12497 if ( !v8 )
12504 return (int)v52._4B1854( 12498 {
12499 v52.DrawCurrentTime(
12505 __PAIR__( 12500 __PAIR__(
12506 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472], 12501 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472],
12507 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) 12502 *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468])
12508 - pParty->uTimePlayed); 12503 - pParty->uTimePlayed);
12504 return 0;
12505 }
12509 v12 = pMouse->GetCursorPos(&v51); 12506 v12 = pMouse->GetCursorPos(&v51);
12510 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; 12507 result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y];
12511 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; 12508 v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF;
12512 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) 12509 if ( pRenderer->pActiveZBuffer[result] & 0xFFFF )
12513 { 12510 {