comparison Items.cpp @ 245:f070b49d40dd

goto cleaning
author zipi
date Mon, 18 Feb 2013 00:39:18 +0000
parents a6a8fa73b4ec
children a672f297c163 640a176c030f
comparison
equal deleted inserted replaced
244:bb9e946cbcbf 245:f070b49d40dd
51 if ( !a1->uItemID ) 51 if ( !a1->uItemID )
52 return 0; 52 return 0;
53 UpdateTempBonus(pParty->uTimePlayed); 53 UpdateTempBonus(pParty->uTimePlayed);
54 if ( v4->uItemID == 501 ) 54 if ( v4->uItemID == 501 )
55 { 55 {
56 LABEL_45:
57 *v3 = 1; 56 *v3 = 1;
58 v10 = rand(); 57 v10 = rand();
59 v17 = 10; 58 v17 = 10;
60 return v10 % v17 + 6; 59 return v10 % v17 + 6;
61 } 60 }
71 *v3 = 2; 70 *v3 = 2;
72 v9 = rand() % 4; 71 v9 = rand() % 4;
73 return v9 + 9; 72 return v9 + 9;
74 } 73 }
75 if ( v4->uItemID == 517 ) 74 if ( v4->uItemID == 517 )
76 goto LABEL_36; 75 {
76 v5 = 8;
77 *v3 = v5;
78 return v5;
79 }
77 v8 = v4->uAdditionalValue; 80 v8 = v4->uAdditionalValue;
78 if ( v8 > 46 ) 81 if ( v8 > 46 )
79 { 82 {
80 LABEL_42:
81 v5 = 0; 83 v5 = 0;
82 goto LABEL_37; 84 *v3 = v5;
85 return v5;
83 } 86 }
84 if ( v8 == 46 ) 87 if ( v8 == 46 )
85 { 88 {
86 *v3 = 0; 89 *v3 = 0;
87 return rand() % 11 + 10; 90 return rand() % 11 + 10;
111 { 114 {
112 *v3 = 10; 115 *v3 = 10;
113 *a3 = 1; 116 *a3 = 1;
114 return v5; 117 return v5;
115 } 118 }
116 goto LABEL_42; 119 v5 = 0;
120 *v3 = v5;
121 return v5;
117 } 122 }
118 *v3 = 2; 123 *v3 = 2;
119 return 12; 124 return 12;
120 } 125 }
121 LABEL_36:
122 v5 = 8; 126 v5 = 8;
123 LABEL_37:
124 *v3 = v5; 127 *v3 = v5;
125 return v5; 128 return v5;
126 } 129 }
127 if ( v8 == 11 ) 130 if ( v8 == 11 )
128 { 131 {
158 { 161 {
159 *v3 = 1; 162 *v3 = 1;
160 return rand() % 7 + 4; 163 return rand() % 7 + 4;
161 } 164 }
162 if ( v8 == 9 ) 165 if ( v8 == 9 )
163 goto LABEL_45; 166 {
167 *v3 = 1;
168 v10 = rand();
169 v17 = 10;
170 return v10 % v17 + 6;
171 }
164 if ( v8 != 10 ) 172 if ( v8 != 10 )
165 goto LABEL_42; 173 {
174 v5 = 0;
175 *v3 = v5;
176 return v5;
177 }
166 *v3 = 0; 178 *v3 = 0;
167 v7 = 1; 179 v7 = 1;
168 return GetDiceResult(v7, 6u); 180 return GetDiceResult(v7, 6u);
169 } 181 }
170 182
1671 v4->_bonus_type += rand() % 4 + 1; 1683 v4->_bonus_type += rand() % 4 + 1;
1672 v15 = v4->_bonus_type; 1684 v15 = v4->_bonus_type;
1673 --v14; 1685 --v14;
1674 } 1686 }
1675 while ( v14 ); 1687 while ( v14 );
1676 LABEL_72:
1677 v4->_bonus_type = v15 * treasure_level; 1688 v4->_bonus_type = v15 * treasure_level;
1678 goto LABEL_73;
1679 } 1689 }
1680 } 1690 }
1681 else 1691 else
1682 { 1692 {
1683 v16 = 0; 1693 v16 = 0;
1716 v4->_bonus_type += rand() % 4 + 1; 1726 v4->_bonus_type += rand() % 4 + 1;
1717 v15 = v4->_bonus_type; 1727 v15 = v4->_bonus_type;
1718 --v19; 1728 --v19;
1719 } 1729 }
1720 while ( v19 ); 1730 while ( v19 );
1721 goto LABEL_72; 1731 v4->_bonus_type = v15 * treasure_level;
1722 } 1732 }
1723 } 1733 }
1724 LABEL_73:
1725 if ( v4->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION 1734 if ( v4->uItemID == ITEM_SPELLBOOK_LIGHT_DIVINE_INTERVENTION
1726 && !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, 239) ) 1735 && !(unsigned __int16)_449B57_test_bit(pParty->_award_bits, 239) )
1727 v4->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST; 1736 v4->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST;
1728 if ( pItemsTable->pItems[v4->uItemID + 1].uItemID_Rep_St ) 1737 if ( pItemsTable->pItems[v4->uItemID + 1].uItemID_Rep_St )
1729 v4->uAttributes = 0; 1738 v4->uAttributes = 0;
1760 if ( !*(unsigned int *)v22 ) 1769 if ( !*(unsigned int *)v22 )
1761 return; 1770 return;
1762 v23 = rand(); 1771 v23 = rand();
1763 v24 = *(unsigned int *)v22; 1772 v24 = *(unsigned int *)v22;
1764 v25 = v23 % 100; 1773 v25 = v23 % 100;
1765 if ( v23 % 100 < v24 ) 1774 if ( !uBonusChanceSpecial[v6] && !(v23 % 100 < v24))
1766 goto LABEL_127;
1767 if ( !uBonusChanceSpecial[v6] )
1768 return; 1775 return;
1769 if ( v25 < v24 ) 1776 if ( v25 < v24 || v23 % 100 < v24)
1770 { 1777 {
1771 LABEL_127:
1772 v26 = rand() % 10;//v5->field_116D8[v5->pItems[v4->uItemID].uEquipType]; 1778 v26 = rand() % 10;//v5->field_116D8[v5->pItems[v4->uItemID].uEquipType];
1773 v27 = v4->uItemID; 1779 v27 = v4->uItemID;
1774 v4->_bonus_type = 0; 1780 v4->_bonus_type = 0;
1775 for ( i = pEnchantments[0].to_item[pItems[v27].uEquipType + 1]; 1781 for ( i = pEnchantments[0].to_item[pItems[v27].uEquipType + 1];
1776 i < v26; 1782 i < v26;
1809 { 1815 {
1810 switch ( v6 ) 1816 switch ( v6 )
1811 { 1817 {
1812 case 2: 1818 case 2:
1813 if ( !*(unsigned char *)v40 ) 1819 if ( !*(unsigned char *)v40 )
1814 goto LABEL_117;
1815 v41 = *(unsigned char *)v40 == 1;
1816 break;
1817 case 3:
1818 v43 = *(unsigned char *)v40;
1819 if ( !*(unsigned char *)v40 || v43 == 1 )
1820 { 1820 {
1821 LABEL_117:
1822 v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType); 1821 v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType);
1823 if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) ) 1822 if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) )
1824 { 1823 {
1825 v44 = v58; 1824 v44 = v58;
1826 ++v58; 1825 ++v58;
1827 *v44 = a2b; 1826 *v44 = a2b;
1828 } 1827 }
1829 goto LABEL_119; 1828 ++a2b;
1829 v40 += 28;
1830 continue;
1831 }
1832 v41 = *(unsigned char *)v40 == 1;
1833 break;
1834 case 3:
1835 v43 = *(unsigned char *)v40;
1836 if ( !*(unsigned char *)v40 || v43 == 1 )
1837 {
1838 v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType);
1839 if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) )
1840 {
1841 v44 = v58;
1842 ++v58;
1843 *v44 = a2b;
1844 }
1845 ++a2b;
1846 v40 += 28;
1847 continue;
1830 } 1848 }
1831 v41 = v43 == 2; 1849 v41 = v43 == 2;
1832 break; 1850 break;
1833 case 4: 1851 case 4:
1834 v42 = *(unsigned char *)v40; 1852 v42 = *(unsigned char *)v40;
1835 if ( *(unsigned char *)v40 == 1 || v42 == 2 ) 1853 if ( *(unsigned char *)v40 == 1 || v42 == 2 )
1836 goto LABEL_117; 1854 {
1855 v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType);
1856 if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) )
1857 {
1858 v44 = v58;
1859 ++v58;
1860 *v44 = a2b;
1861 }
1862 ++a2b;
1863 v40 += 28;
1864 continue;
1865 }
1837 v41 = v42 == 3; 1866 v41 = v42 == 3;
1838 break; 1867 break;
1839 default: 1868 default:
1840 if ( v6 != 5 ) 1869 if ( v6 != 5 )
1841 goto LABEL_119; 1870 {
1871 ++a2b;
1872 v40 += 28;
1873 continue;
1874 }
1842 v41 = *(unsigned char *)v40 == 3; 1875 v41 = *(unsigned char *)v40 == 3;
1843 break; 1876 break;
1844 } 1877 }
1845 if ( v41 ) 1878 if ( v41 )
1846 goto LABEL_117; 1879 {
1880 v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType);
1881 if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) )
1882 {
1883 v44 = v58;
1884 ++v58;
1885 *v44 = a2b;
1886 }
1887 }
1847 LABEL_119: 1888 LABEL_119:
1848 ++a2b; 1889 ++a2b;
1849 v40 += 28; 1890 v40 += 28;
1850 } 1891 }
1851 while ( a2b < pSpecialEnchantments_count ); 1892 while ( a2b < pSpecialEnchantments_count );