comparison mm7_2.cpp @ 669:fb87a8249794

some cleaning
author zipi
date Thu, 14 Mar 2013 20:44:54 +0000
parents 28109e4eee44
children 2bb0e9da8302
comparison
equal deleted inserted replaced
668:28109e4eee44 669:fb87a8249794
1218 } 1218 }
1219 } 1219 }
1220 } 1220 }
1221 if ( uMessageParam > 95 ) 1221 if ( uMessageParam > 95 )
1222 { 1222 {
1223 LABEL_196: 1223 //LABEL_196:
1224 switch ( uMessageParam ) 1224 switch ( uMessageParam )
1225 { 1225 {
1226 case 96: 1226 case 96:
1227 pDialogueWindow->eWindowType = WINDOW_MainMenu; 1227 pDialogueWindow->eWindowType = WINDOW_MainMenu;
1228 UI_CreateEndConversationButton(); 1228 UI_CreateEndConversationButton();
1644 v47 = 0; 1644 v47 = 0;
1645 v46 = 0; 1645 v46 = 0;
1646 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); 1646 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
1647 return; 1647 return;
1648 } 1648 }
1649 if ( dialog_menu_id > 18 ) 1649 switch(dialog_menu_id)
1650 { 1650 {
1651 if ( dialog_menu_id < 36 ) 1651 case 94:
1652 return;
1653 if ( dialog_menu_id <= 72 )
1654 {
1655 v42 = dialog_menu_id - 36;
1656 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
1657 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
1658 v44 = v43 * (100 - v0->GetMerchant()) / 100;
1659 if ( v44 < v43 / 3 )
1660 v44 = v43 / 3;
1661 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v42] )
1662 {
1663 pSkill = &v0->pActiveSkills[v42];
1664 if ( !*pSkill )
1665 {
1666 if ( pParty->uNumGold < v44 )
1667 {
1668 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
1669 v13 = window_SpeakInHouse->ptr_1C;
1670 if ( in_current_building_type == BildingType_Training )
1671 v55 = 4;
1672 else
1673 v55 = 2;
1674 HousePlaySomeSound((unsigned int)v13, v55);
1675 return;
1676 }
1677 Party::TakeGold(v44);
1678 v53 = 0;
1679 dword_F8B1E4 = 1;
1680 *pSkill = 1;
1681 v51 = 78;
1682 v27 = v0;
1683 v27->PlaySound((PlayerSpeech)v51, v53);
1684 return;
1685 }
1686 }
1687 return;
1688 }
1689 if ( dialog_menu_id != 94 )
1690 {
1691 if ( dialog_menu_id != 95 )
1692 return;
1693 goto LABEL_49;
1694 }
1695 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
1696 //LABEL_73:
1697 sub_421EA6_OnInventoryLeftClick();
1698 return;
1699 }
1700 if ( dialog_menu_id == 18 )
1701 {
1702 v17 = pMouse->GetCursorPos(&v63);
1703 v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF;
1704 if ( !v18 )
1705 return;
1706 v19 = window_SpeakInHouse->ptr_1C;
1707 v20 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)v19));
1708 //v21 = p2DEvents_minus1__20[13 * (signed int)v19];
1709 v21 = p2DEvents[(signed int)v19 - 1].fPriceMultiplier;
1710 _this = v20;
1711 v22 = v20->GetValue();
1712 v23 = v0->_4B8142(v22, v21);
1713 v80 = v23;
1714 GetAsyncKeyState(VK_CONTROL);
1715 if ( pParty->uNumGold < v23 )
1716 {
1717 v24 = 2;
1718 //LABEL_62:
1719 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24);
1720 v9 = pGlobalTXT_LocalizationStrings[155];
1721 v54 = 2;
1722 ShowStatusBarString(v9, v54);
1723 return;
1724 }
1725 v25 = v0->AddItem(0xFFFFFFFFu, v20->uItemID);
1726 if ( v25 )
1727 {
1728 v26 = 1;
1729 v20->SetIdentified();
1730 memcpy(&v0->pInventoryItems[v25-1], v20, 0x24u);
1731 dword_F8B1E4 = v26;
1732 Party::TakeGold(v80);
1733 viewparams->bRedrawGameUI = v26;
1734 _this->Reset();
1735 pRenderer->ClearZBuffer(0, 479);
1736 v27 = v77;
1737 v53 = 0;
1738 v51 = SPEECH_75;
1739 v27->PlaySound((PlayerSpeech)v51, v53);
1740 return;
1741 }
1742 v0->PlaySound(SPEECH_NoRoom, 0);
1743 v54 = 5;
1744 //LABEL_70:
1745 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!"
1746 ShowStatusBarString(v9, v54);
1747 return;
1748 }
1749 if ( dialog_menu_id == 2 )
1750 {
1751 LABEL_49:
1752 v28 = pMouse->GetCursorPos(&v59);
1753 v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v57)->y]] & 0xFFFF;
1754 if ( !v29 )
1755 return;
1756 v30 = window_SpeakInHouse->ptr_1C;
1757 // v31 = 9 * (v29 - 1 + 12 * (int)v30);
1758 if ( dialog_menu_id == 2 )
1759 {
1760 v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1];
1761 _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1];
1762 }
1763 else
1764 {
1765 _this =&pParty->SpecialItemsInShops[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724];
1766 v32 = &pParty->SpecialItemsInShops[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
1767 }
1768 //v33 = p2DEvents_minus1__20[13 * (signed int)v30];
1769 v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier;
1770 v34 = v32->GetValue();
1771 v80 = v0->_4B8142(v34, v33);
1772 LOWORD(v35) = GetAsyncKeyState(VK_CONTROL);
1773 v74 = v35;
1774 v36 = v0->CanSteal();
1775 uNumSeconds = 0;
1776 a3 = 0;
1777 v73 = v36;
1778 v37 = pMapStats->GetMapInfo(pCurrentMapName);
1779 if ( v37 )
1780 a3 = pMapStats->pInfos[v37]._steal_perm;
1781 v38 = GetPartyReputation();
1782 v26 = 1;
1783 if ( v73 == 1 )
1784 {
1785 if ( (short)v74 )
1786 {
1787 uNumSeconds = v0->StealFromShop(v32, a3, v38, 0, &a6);
1788 if ( !uNumSeconds )
1789 {
1790 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6);
1791 return;
1792 }
1793 }
1794 }
1795 if ( pParty->uNumGold < v80 )
1796 {
1797 v24 = 2;
1798 if ( uNumSeconds != 2 )
1799 {
1800 if ( uNumSeconds != 1 )
1801 { 1652 {
1802 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24); 1653 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
1803 v9 = pGlobalTXT_LocalizationStrings[155]; 1654 sub_421EA6_OnInventoryLeftClick();
1804 v54 = 2; 1655 break;
1805 ShowStatusBarString(v9, v54);
1806 return;
1807 } 1656 }
1808 } 1657 case 18:
1809 } 1658 {
1810 v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID); 1659 v17 = pMouse->GetCursorPos(&v63);
1811 if ( v39 ) 1660 v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF;
1812 { 1661 if ( !v18 )
1813 v32->SetIdentified(); 1662 return;
1814 v7 = v73 == 1; 1663 v19 = window_SpeakInHouse->ptr_1C;
1815 v40 = (int)((char *)v0 + 36 * v39); 1664 v20 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v18 + 12 * (int)v19));
1816 memcpy((void *)(v40 + 496), v32, 0x24u); 1665 //v21 = p2DEvents_minus1__20[13 * (signed int)v19];
1817 if ( v7 ) 1666 v21 = p2DEvents[(signed int)v19 - 1].fPriceMultiplier;
1818 { 1667 _this = v20;
1819 if ( (short)v74 ) 1668 v22 = v20->GetValue();
1820 { 1669 v23 = v0->_4B8142(v22, v21);
1821 v41 = uNumSeconds; 1670 v80 = v23;
1822 if ( uNumSeconds == 1 || uNumSeconds == 2 ) 1671 GetAsyncKeyState(VK_CONTROL);
1823 { 1672 if ( pParty->uNumGold < v23 )
1824 *(char *)(v40 + 517) |= 1u; 1673 {
1825 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6); 1674 v24 = 2;
1826 viewparams->bRedrawGameUI = v26; 1675 //LABEL_62:
1827 _this->Reset(); 1676 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24);
1828 pRenderer->ClearZBuffer(0, 479); 1677 v9 = pGlobalTXT_LocalizationStrings[155];
1829 v27 = v77; 1678 v54 = 2;
1830 v53 = 0; 1679 ShowStatusBarString(v9, v54);
1831 v51 = SPEECH_75; 1680 return;
1832 v27->PlaySound((PlayerSpeech)v51, v53);
1833 return;
1834 }
1835 }
1836 }
1837 //LABEL_42:
1838 dword_F8B1E4 = v26;
1839 Party::TakeGold(v80);
1840 //LABEL_43:
1841 viewparams->bRedrawGameUI = v26;
1842 _this->Reset();
1843 pRenderer->ClearZBuffer(0, 479);
1844 v27 = v77;
1845 v53 = 0;
1846 v51 = SPEECH_75;
1847 //LABEL_81:
1848 v27->PlaySound((PlayerSpeech)v51, v53);
1849 return;
1850 }
1851 v0->PlaySound(SPEECH_NoRoom, 0);
1852 v54 = 2;
1853 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!"
1854 ShowStatusBarString(v9, v54);
1855 return;
1856 }
1857 if ( dialog_menu_id == 3 )
1858 {
1859 v14 = pMouse->GetCursorPos(&v71)->x - 14;
1860 v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5);
1861 if ( pMouse->GetCursorPos(&v67)->x <= 13
1862 || pMouse->GetCursorPos(&v65)->x >= 462
1863 || (v15 = v0->GetItemIDAtInventoryIndex((int *)&v79), (v77 = (Player *)v15) == 0) )
1864 return;
1865 v16 = window_SpeakInHouse;
1866 if ( sub_4BDAAF((ItemGen *)&v0->pInventoryItems[v15-1], (int)window_SpeakInHouse->ptr_1C) )
1867 {
1868 dword_F8B1E4 = 1;
1869 v0->_4BE2DD(v79, (int)((char *)v77 - 1), (int)v16->ptr_1C);
1870 viewparams->bRedrawGameUI = 1;
1871 pRenderer->ClearZBuffer(0, 479);
1872 v53 = 0;
1873 v51 = 77;
1874 v27 = v0;
1875 v27->PlaySound((PlayerSpeech)v51, v53);
1876 return;
1877 }
1878 v0->PlaySound(SPEECH_79, 0);
1879 v56 = 0;
1880 v52 = 0;
1881 v50 = 0;
1882 v49 = 0;
1883 v48 = -1;
1884 v47 = 0;
1885 v46 = 0;
1886 //LABEL_87:
1887 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
1888 return;
1889 }
1890 if ( dialog_menu_id == 4 )
1891 {
1892 v10 = pMouse->GetCursorPos(&v62)->x - 14;
1893 v79 = (v10 >> 5) + 14 * ((pMouse->GetCursorPos(&v66)->y - 17) >> 5);
1894 if ( pMouse->GetCursorPos(&v58)->x > 13 )
1895 {
1896 if ( pMouse->GetCursorPos(&v64)->x < 462 )
1897 {
1898 v11 = v0->GetItemIDAtInventoryIndex((int *)&v79);
1899 if ( v11 )
1900 {
1901 //v80 = v0->_4B8179(p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]);
1902 v80 = v0->_4B8179(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
1903 v12 = (int)&v0->pInventoryItems[v11-1];
1904 if ( !(*(char *)(v12 + 20) & 1) )
1905 {
1906 _this = (ItemGen *)window_SpeakInHouse->ptr_1C;
1907 if ( sub_4BDAAF((ItemGen *)v12, (int)_this) )
1908 {
1909 if ( pParty->uNumGold >= v80 )
1910 {
1911 dword_F8B1E4 = 1;
1912 Party::TakeGold(v80);
1913 *(int *)(v12 + 20) |= 1u;
1914 v0->PlaySound(SPEECH_73, 0);
1915 v9 = pGlobalTXT_LocalizationStrings[569];
1916 v54 = 2;
1917 ShowStatusBarString(v9, v54);
1918 return;
1919 }
1920 v13 = _this;
1921 v55 = 2;
1922 HousePlaySomeSound((unsigned int)v13, v55);
1923 return;
1924 }
1925 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
1926 v53 = 0;
1927 v51 = 79;
1928 v27 = v0;
1929 v27->PlaySound((PlayerSpeech)v51, v53);
1930 return;
1931 }
1932 v53 = 0;
1933 //LABEL_30:
1934 v51 = 76;
1935 v27 = v0;
1936 v27->PlaySound((PlayerSpeech)v51, v53);
1937 return;
1938 } 1681 }
1939 } 1682 v25 = v0->AddItem(0xFFFFFFFFu, v20->uItemID);
1940 } 1683 if ( v25 )
1941 } 1684 {
1942 else 1685 v26 = 1;
1943 { 1686 v20->SetIdentified();
1944 if ( dialog_menu_id == 5 ) 1687 memcpy(&v0->pInventoryItems[v25-1], v20, 0x24u);
1945 { 1688 dword_F8B1E4 = v26;
1946 v1 = pMouse->GetCursorPos(&a2)->x - 14; 1689 Party::TakeGold(v80);
1947 v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5); 1690 viewparams->bRedrawGameUI = v26;
1948 if ( pMouse->GetCursorPos(&v60)->x > 13 ) 1691 _this->Reset();
1949 { 1692 pRenderer->ClearZBuffer(0, 479);
1950 if ( pMouse->GetCursorPos(&v72)->x < 462 ) 1693 v27 = v77;
1951 { 1694 v53 = 0;
1952 v2 = v0->GetItemIDAtInventoryIndex((int *)&v79); 1695 v51 = SPEECH_75;
1953 if ( v2 ) 1696 v27->PlaySound((PlayerSpeech)v51, v53);
1954 {
1955 v3 = (int)&v0->pInventoryItems[v2-1];
1956 //v4 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
1957 v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
1958
1959 auto _v = (ItemGen *)&v0->pInventoryItems[v2-1];
1960 v5 = _v->GetValue();
1961
1962 v6 = v0->_4B81C3(v5, v4);
1963 v7 = (*(char *)(v3 + 20) & 2) == 0;
1964 v80 = v6;
1965 if ( !v7 )
1966 {
1967 _this = (ItemGen *)window_SpeakInHouse->ptr_1C;
1968 if ( sub_4BDAAF((ItemGen *)v3, (int)_this) )
1969 {
1970 if ( pParty->uNumGold >= v80 )
1971 {
1972 dword_F8B1E4 = 1;
1973 Party::TakeGold(v80);
1974 v8 = *(int *)(v3 + 20);
1975 LOBYTE(v8) = v8 & 0xFD;
1976 *(int *)(v3 + 20) = v8 | 1;
1977 v0->PlaySound(SPEECH_74, 0);
1978 v9 = pGlobalTXT_LocalizationStrings[570];
1979 //LABEL_25:
1980 v54 = 2;
1981 //LABEL_71:
1982 ShowStatusBarString(v9, v54);
1983 return;
1984 }
1985 //LABEL_26:
1986 v13 = _this;
1987 v55 = 2;
1988 //LABEL_84:
1989 HousePlaySomeSound((unsigned int)v13, v55);
1990 return;
1991 }
1992 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
1993 v53 = 0;
1994 //LABEL_28:
1995 v51 = 79;
1996 //LABEL_80:
1997 v27 = v0;
1998 v27->PlaySound((PlayerSpeech)v51, v53);
1999 return; 1697 return;
2000 } 1698 }
2001 v53 = 0; 1699 v0->PlaySound(SPEECH_NoRoom, 0);
2002 v51 = 76; 1700 v54 = 5;
2003 v27 = v0; 1701 //LABEL_70:
2004 v27->PlaySound((PlayerSpeech)v51, v53); 1702 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!"
2005 return; 1703 ShowStatusBarString(v9, v54);
2006 } 1704 break;
2007 } 1705 }
2008 } 1706 case 3:
2009 } 1707 {
1708 v14 = pMouse->GetCursorPos(&v71)->x - 14;
1709 v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5);
1710 if ( pMouse->GetCursorPos(&v67)->x <= 13
1711 || pMouse->GetCursorPos(&v65)->x >= 462
1712 || (v15 = v0->GetItemIDAtInventoryIndex((int *)&v79), (v77 = (Player *)v15) == 0) )
1713 return;
1714 v16 = window_SpeakInHouse;
1715 if ( sub_4BDAAF((ItemGen *)&v0->pInventoryItems[v15-1], (int)window_SpeakInHouse->ptr_1C) )
1716 {
1717 dword_F8B1E4 = 1;
1718 v0->_4BE2DD(v79, (int)((char *)v77 - 1), (int)v16->ptr_1C);
1719 viewparams->bRedrawGameUI = 1;
1720 pRenderer->ClearZBuffer(0, 479);
1721 v53 = 0;
1722 v51 = 77;
1723 v27 = v0;
1724 v27->PlaySound((PlayerSpeech)v51, v53);
1725 return;
1726 }
1727 v0->PlaySound(SPEECH_79, 0);
1728 v56 = 0;
1729 v52 = 0;
1730 v50 = 0;
1731 v49 = 0;
1732 v48 = -1;
1733 v47 = 0;
1734 v46 = 0;
1735 //LABEL_87:
1736 pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56);
1737 break;
1738 }
1739 case 4:
1740 {
1741 v10 = pMouse->GetCursorPos(&v62)->x - 14;
1742 v79 = (v10 >> 5) + 14 * ((pMouse->GetCursorPos(&v66)->y - 17) >> 5);
1743 if ( pMouse->GetCursorPos(&v58)->x > 13 )
1744 {
1745 if ( pMouse->GetCursorPos(&v64)->x < 462 )
1746 {
1747 v11 = v0->GetItemIDAtInventoryIndex((int *)&v79);
1748 if ( v11 )
1749 {
1750 //v80 = v0->_4B8179(p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]);
1751 v80 = v0->_4B8179(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier);
1752 v12 = (int)&v0->pInventoryItems[v11-1];
1753 if ( !(*(char *)(v12 + 20) & 1) )
1754 {
1755 _this = (ItemGen *)window_SpeakInHouse->ptr_1C;
1756 if ( sub_4BDAAF((ItemGen *)v12, (int)_this) )
1757 {
1758 if ( pParty->uNumGold >= v80 )
1759 {
1760 dword_F8B1E4 = 1;
1761 Party::TakeGold(v80);
1762 *(int *)(v12 + 20) |= 1u;
1763 v0->PlaySound(SPEECH_73, 0);
1764 v9 = pGlobalTXT_LocalizationStrings[569];
1765 v54 = 2;
1766 ShowStatusBarString(v9, v54);
1767 return;
1768 }
1769 v13 = _this;
1770 v55 = 2;
1771 HousePlaySomeSound((unsigned int)v13, v55);
1772 return;
1773 }
1774 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
1775 v53 = 0;
1776 v51 = 79;
1777 v27 = v0;
1778 v27->PlaySound((PlayerSpeech)v51, v53);
1779 return;
1780 }
1781 v53 = 0;
1782 //LABEL_30:
1783 v51 = 76;
1784 v27 = v0;
1785 v27->PlaySound((PlayerSpeech)v51, v53);
1786 return;
1787 }
1788 }
1789 }
1790 break;
1791 }
1792 case 5:
1793 {
1794 v1 = pMouse->GetCursorPos(&a2)->x - 14;
1795 v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5);
1796 if ( pMouse->GetCursorPos(&v60)->x > 13 )
1797 {
1798 if ( pMouse->GetCursorPos(&v72)->x < 462 )
1799 {
1800 v2 = v0->GetItemIDAtInventoryIndex((int *)&v79);
1801 if ( v2 )
1802 {
1803 v3 = (int)&v0->pInventoryItems[v2-1];
1804 //v4 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C];
1805 v4 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier;
1806
1807 auto _v = (ItemGen *)&v0->pInventoryItems[v2-1];
1808 v5 = _v->GetValue();
1809
1810 v6 = v0->_4B81C3(v5, v4);
1811 v7 = (*(char *)(v3 + 20) & 2) == 0;
1812 v80 = v6;
1813 if ( !v7 )
1814 {
1815 _this = (ItemGen *)window_SpeakInHouse->ptr_1C;
1816 if ( sub_4BDAAF((ItemGen *)v3, (int)_this) )
1817 {
1818 if ( pParty->uNumGold >= v80 )
1819 {
1820 dword_F8B1E4 = 1;
1821 Party::TakeGold(v80);
1822 v8 = *(int *)(v3 + 20);
1823 LOBYTE(v8) = v8 & 0xFD;
1824 *(int *)(v3 + 20) = v8 | 1;
1825 v0->PlaySound(SPEECH_74, 0);
1826 v9 = pGlobalTXT_LocalizationStrings[570];
1827 //LABEL_25:
1828 v54 = 2;
1829 //LABEL_71:
1830 ShowStatusBarString(v9, v54);
1831 return;
1832 }
1833 //LABEL_26:
1834 v13 = _this;
1835 v55 = 2;
1836 //LABEL_84:
1837 HousePlaySomeSound((unsigned int)v13, v55);
1838 return;
1839 }
1840 pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
1841 v53 = 0;
1842 //LABEL_28:
1843 v51 = 79;
1844 //LABEL_80:
1845 v27 = v0;
1846 v27->PlaySound((PlayerSpeech)v51, v53);
1847 return;
1848 }
1849 v53 = 0;
1850 v51 = 76;
1851 v27 = v0;
1852 v27->PlaySound((PlayerSpeech)v51, v53);
1853 return;
1854 }
1855 }
1856 }
1857 break;
1858 }
1859 case 2:
1860 case 95:
1861 {
1862 //LABEL_49:
1863 v28 = pMouse->GetCursorPos(&v59);
1864 v29 = pRenderer->pActiveZBuffer[v28->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v57)->y]] & 0xFFFF;
1865 if ( !v29 )
1866 return;
1867 v30 = window_SpeakInHouse->ptr_1C;
1868 // v31 = 9 * (v29 - 1 + 12 * (int)v30);
1869 if ( dialog_menu_id == 2 )
1870 {
1871 v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1];
1872 _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29-1];
1873 }
1874 else
1875 {
1876 _this =&pParty->SpecialItemsInShops[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724];
1877 v32 = &pParty->SpecialItemsInShops[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724];
1878 }
1879 //v33 = p2DEvents_minus1__20[13 * (signed int)v30];
1880 v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier;
1881 v34 = v32->GetValue();
1882 v80 = v0->_4B8142(v34, v33);
1883 LOWORD(v35) = GetAsyncKeyState(VK_CONTROL);
1884 v74 = v35;
1885 v36 = v0->CanSteal();
1886 uNumSeconds = 0;
1887 a3 = 0;
1888 v73 = v36;
1889 v37 = pMapStats->GetMapInfo(pCurrentMapName);
1890 if ( v37 )
1891 a3 = pMapStats->pInfos[v37]._steal_perm;
1892 v38 = GetPartyReputation();
1893 v26 = 1;
1894 if ( v73 == 1 )
1895 {
1896 if ( (short)v74 )
1897 {
1898 uNumSeconds = v0->StealFromShop(v32, a3, v38, 0, &a6);
1899 if ( !uNumSeconds )
1900 {
1901 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, 0, a6);
1902 return;
1903 }
1904 }
1905 }
1906 if ( pParty->uNumGold < v80 )
1907 {
1908 v24 = 2;
1909 if ( uNumSeconds != 2 )
1910 {
1911 if ( uNumSeconds != 1 )
1912 {
1913 HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v24);
1914 v9 = pGlobalTXT_LocalizationStrings[155];
1915 v54 = 2;
1916 ShowStatusBarString(v9, v54);
1917 return;
1918 }
1919 }
1920 }
1921 v39 = v0->AddItem(0xFFFFFFFFu, v32->uItemID);
1922 if ( v39 )
1923 {
1924 v32->SetIdentified();
1925 v7 = v73 == 1;
1926 v40 = (int)((char *)v0 + 36 * v39);
1927 memcpy((void *)(v40 + 496), v32, 0x24u);
1928 if ( v7 )
1929 {
1930 if ( (short)v74 )
1931 {
1932 v41 = uNumSeconds;
1933 if ( uNumSeconds == 1 || uNumSeconds == 2 )
1934 {
1935 *(char *)(v40 + 517) |= 1u;
1936 sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, v41, a6);
1937 viewparams->bRedrawGameUI = v26;
1938 _this->Reset();
1939 pRenderer->ClearZBuffer(0, 479);
1940 v27 = v77;
1941 v53 = 0;
1942 v51 = SPEECH_75;
1943 v27->PlaySound((PlayerSpeech)v51, v53);
1944 return;
1945 }
1946 }
1947 }
1948 //LABEL_42:
1949 dword_F8B1E4 = v26;
1950 Party::TakeGold(v80);
1951 //LABEL_43:
1952 viewparams->bRedrawGameUI = v26;
1953 _this->Reset();
1954 pRenderer->ClearZBuffer(0, 479);
1955 v27 = v77;
1956 v53 = 0;
1957 v51 = SPEECH_75;
1958 //LABEL_81:
1959 v27->PlaySound((PlayerSpeech)v51, v53);
1960 return;
1961 }
1962 v0->PlaySound(SPEECH_NoRoom, 0);
1963 v54 = 2;
1964 v9 = pGlobalTXT_LocalizationStrings[563]; // "Pack is Full!"
1965 ShowStatusBarString(v9, v54);
1966 break;
1967 }
1968
1969 default:
1970 {
1971 if( dialog_menu_id >= 36 && dialog_menu_id <= 72 )
1972 {
1973 v42 = dialog_menu_id - 36;
1974 //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0);
1975 v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0);
1976 v44 = v43 * (100 - v0->GetMerchant()) / 100;
1977 if ( v44 < v43 / 3 )
1978 v44 = v43 / 3;
1979 if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v42] )
1980 {
1981 pSkill = &v0->pActiveSkills[v42];
1982 if ( !*pSkill )
1983 {
1984 if ( pParty->uNumGold < v44 )
1985 {
1986 ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold"
1987 v13 = window_SpeakInHouse->ptr_1C;
1988 if ( in_current_building_type == BildingType_Training )
1989 v55 = 4;
1990 else
1991 v55 = 2;
1992 HousePlaySomeSound((unsigned int)v13, v55);
1993 return;
1994 }
1995 Party::TakeGold(v44);
1996 v53 = 0;
1997 dword_F8B1E4 = 1;
1998 *pSkill = 1;
1999 v51 = 78;
2000 v27 = v0;
2001 v27->PlaySound((PlayerSpeech)v51, v53);
2002 return;
2003 }
2004 }
2005 }
2006 break;
2007 }
2010 } 2008 }
2011 } 2009 }
2012 2010
2013 2011
2014 2012