Mercurial > mm7
comparison Items.cpp @ 228:46ae2602aceb
Item generation doesn't crash (thou still generates weird stuff)
author | Nomad |
---|---|
date | Sun, 17 Feb 2013 15:45:46 +0200 |
parents | 9917d3b4925e |
children | b9f4ff2f6c45 |
comparison
equal
deleted
inserted
replaced
227:bcd55744c2f4 | 228:46ae2602aceb |
---|---|
1 #include <stdlib.h> | 1 #include <stdlib.h> |
2 #include <assert.h> | |
2 | 3 |
3 #include "Items.h" | 4 #include "Items.h" |
4 #include "MapInfo.h" | 5 #include "MapInfo.h" |
5 #include "FrameTableInc.h" | 6 #include "FrameTableInc.h" |
6 #include "Allocator.h" | 7 #include "Allocator.h" |
1502 return v4; | 1503 return v4; |
1503 } | 1504 } |
1504 | 1505 |
1505 | 1506 |
1506 //----- (00456620) -------------------------------------------------------- | 1507 //----- (00456620) -------------------------------------------------------- |
1507 void ItemsTable::GenerateItem(int a2, int a3, ItemGen *pItem) | 1508 void ItemsTable::GenerateItem(int treasure_level, int a3, ItemGen *out_item) |
1508 { | 1509 { |
1509 ItemGen *v4; // esi@1 | 1510 //ItemGen *v4; // esi@1 |
1510 ItemsTable *v5; // edi@1 | 1511 //ItemsTable *v5; // edi@1 |
1511 int v6; // ebx@3 | 1512 int v6; // ebx@3 |
1512 int *v7; // ecx@33 | 1513 int *v7; // ecx@33 |
1513 int v8; // eax@34 | 1514 //int v8; // eax@34 |
1514 int v9; // eax@39 | 1515 //int v9; // eax@39 |
1515 int v10; // ebx@43 | 1516 int v10; // ebx@43 |
1516 int v11; // ecx@47 | 1517 int v11; // ecx@47 |
1517 unsigned int *v12; // edx@48 | 1518 unsigned int *v12; // edx@48 |
1518 unsigned int v13; // eax@49 | 1519 unsigned int v13; // eax@49 |
1519 signed int v14; // ebx@52 | 1520 signed int v14; // ebx@52 |
1551 int v46; // edx@120 | 1552 int v46; // edx@120 |
1552 int *j; // eax@121 | 1553 int *j; // eax@121 |
1553 unsigned int v48; // ecx@123 | 1554 unsigned int v48; // ecx@123 |
1554 int v49; // eax@123 | 1555 int v49; // eax@123 |
1555 int v50; // eax@123 | 1556 int v50; // eax@123 |
1556 unsigned char Dst[0xC80]; // [sp+Ch] [bp-C88h]@33 | 1557 int Dst[800]; // [sp+Ch] [bp-C88h]@33 |
1557 int v52; // [sp+C8Ch] [bp-8h]@33 | 1558 int v52; // [sp+C8Ch] [bp-8h]@33 |
1558 int v53; // [sp+C90h] [bp-4h]@1 | 1559 //int v53; // [sp+C90h] [bp-4h]@1 |
1559 int v54; // [sp+C9Ch] [bp+8h]@3 | 1560 //int v54; // [sp+C9Ch] [bp+8h]@3 |
1560 int v55; // [sp+CA0h] [bp+Ch]@34 | 1561 //int v55; // [sp+CA0h] [bp+Ch]@34 |
1561 signed int v56; // [sp+CA0h] [bp+Ch]@55 | 1562 signed int v56; // [sp+CA0h] [bp+Ch]@55 |
1562 int v57; // [sp+CA0h] [bp+Ch]@62 | 1563 int v57; // [sp+CA0h] [bp+Ch]@62 |
1563 int *v58; // [sp+CA0h] [bp+Ch]@102 | 1564 int *v58; // [sp+CA0h] [bp+Ch]@102 |
1564 int v59; // [sp+CA0h] [bp+Ch]@123 | 1565 int v59; // [sp+CA0h] [bp+Ch]@123 |
1565 signed int a2a; // [sp+CA4h] [bp+10h]@33 | 1566 //signed int a2a; // [sp+CA4h] [bp+10h]@33 |
1566 int a2b; // [sp+CA4h] [bp+10h]@101 | 1567 int a2b; // [sp+CA4h] [bp+10h]@101 |
1567 int a2c; // [sp+CA4h] [bp+10h]@120 | 1568 int a2c; // [sp+CA4h] [bp+10h]@120 |
1568 | 1569 |
1569 v53 = -1; | 1570 //v53 = -1; |
1570 v4 = pItem; | 1571 //v4 = pItem; |
1571 v5 = this; | 1572 //v5 = this; |
1572 if ( !pItem ) | 1573 if (!out_item) |
1573 v4 = (ItemGen *)pAllocator->AllocNamedChunk(pItem, 0x24u, "newItemGen"); | 1574 out_item = (ItemGen *)pAllocator->AllocNamedChunk(out_item, sizeof(*out_item), "newItemGen"); |
1574 memset(v4, 0, 0x24u); | 1575 memset(out_item, 0, sizeof(*out_item)); |
1575 v6 = a2 - 1; | 1576 |
1576 v54 = a2 - 1; | 1577 auto v4 = out_item; |
1578 v6 = treasure_level - 1; | |
1579 //v54 = treasure_level - 1; | |
1577 if ( a3 ) | 1580 if ( a3 ) |
1578 { | 1581 { |
1579 switch ( a3 ) | 1582 ITEM_EQUIP_TYPE requested_equip; |
1583 PLAYER_SKILL_TYPE requested_skill = PLAYER_SKILL_INVALID; | |
1584 switch (a3) | |
1585 { | |
1586 case 20: requested_equip = EQUIP_ONE_OR_TWO_HANDS; break; | |
1587 case 21: requested_equip = EQUIP_ARMOUR; break; | |
1588 case 22: requested_skill = (PLAYER_SKILL_TYPE)38; __debugbreak();/*check this skill*/ break; | |
1589 case 23: requested_skill = PLAYER_SKILL_SWORD; break; | |
1590 case 24: requested_skill = PLAYER_SKILL_DAGGER; break; | |
1591 case 25: requested_skill = PLAYER_SKILL_AXE; break; | |
1592 case 26: requested_skill = PLAYER_SKILL_SPEAR; break; | |
1593 case 27: requested_skill = PLAYER_SKILL_BOW; break; | |
1594 case 28: requested_skill = PLAYER_SKILL_MACE; break; | |
1595 case 29: requested_skill = (PLAYER_SKILL_TYPE)37; __debugbreak();/*check this skill*/break; | |
1596 case 30: requested_skill = PLAYER_SKILL_STAFF; break; | |
1597 case 31: requested_skill = PLAYER_SKILL_LEATHER; break; | |
1598 case 32: requested_skill = PLAYER_SKILL_CHAIN; break; | |
1599 case 33: requested_skill = PLAYER_SKILL_PLATE; break; | |
1600 case 34: requested_equip = EQUIP_SHIELD; break; | |
1601 case 35: requested_equip = EQUIP_HELMET; break; | |
1602 case 36: requested_equip = EQUIP_BELT; break; | |
1603 case 37: requested_equip = EQUIP_CLOAK; break; | |
1604 case 38: requested_equip = EQUIP_GAUNTLETS; break; | |
1605 case 39: requested_equip = EQUIP_BOOTS; break; | |
1606 case 40: requested_equip = EQUIP_RING; break; | |
1607 case 41: requested_equip = EQUIP_AMULET; break; | |
1608 case 42: requested_equip = EQUIP_C; break; | |
1609 case 43: requested_equip = EQUIP_F; break; | |
1610 case 44: requested_equip = EQUIP_POTION; break; | |
1611 case 45: requested_equip = EQUIP_REAGENT; break; | |
1612 case 46: requested_equip = EQUIP_GEM; break; | |
1613 default: | |
1614 __debugbreak(); // check this condition | |
1615 requested_equip = (ITEM_EQUIP_TYPE)(a3 - 1); | |
1616 break; | |
1617 } | |
1618 memset(Dst, 0, sizeof(Dst)); | |
1619 v52 = 0; | |
1620 v7 = Dst; | |
1621 //a2a = 1; | |
1622 if (requested_skill == PLAYER_SKILL_INVALID) | |
1580 { | 1623 { |
1581 case 20: | 1624 for (uint i = 1; i < 500; ++i) |
1582 a3 = EQUIP_ONE_OR_TWO_HANDS; | |
1583 break; | |
1584 case 21: | |
1585 a3 = 3; | |
1586 break; | |
1587 case 22: | |
1588 v53 = 38; | |
1589 break; | |
1590 case 23: | |
1591 v53 = 1; | |
1592 break; | |
1593 case 24: | |
1594 v53 = 2; | |
1595 break; | |
1596 case 25: | |
1597 v53 = 3; | |
1598 break; | |
1599 case 26: | |
1600 v53 = 4; | |
1601 break; | |
1602 case 27: | |
1603 v53 = 5; | |
1604 break; | |
1605 case 28: | |
1606 v53 = 6; | |
1607 break; | |
1608 case 30: | |
1609 v53 = 0; | |
1610 break; | |
1611 case 31: | |
1612 v53 = 9; | |
1613 break; | |
1614 case 32: | |
1615 v53 = 10; | |
1616 break; | |
1617 case 33: | |
1618 v53 = 0xBu; | |
1619 break; | |
1620 case 34: | |
1621 a3 = 4; | |
1622 break; | |
1623 case 35: | |
1624 a3 = 5; | |
1625 break; | |
1626 case 36: | |
1627 a3 = 6; | |
1628 break; | |
1629 case 37: | |
1630 a3 = 7; | |
1631 break; | |
1632 case 38: | |
1633 a3 = 8; | |
1634 break; | |
1635 case 39: | |
1636 a3 = EQUIP_BOOTS; | |
1637 break; | |
1638 case 40: | |
1639 a3 = EQUIP_RING; | |
1640 break; | |
1641 case 41: | |
1642 a3 = 0xBu; | |
1643 break; | |
1644 case 42: | |
1645 a3 = EQUIP_C; | |
1646 break; | |
1647 case 43: | |
1648 a3 = EQUIP_F; | |
1649 break; | |
1650 case 44: | |
1651 a3 = EQUIP_POTION; | |
1652 break; | |
1653 case 45: | |
1654 a3 = EQUIP_REAGENT; | |
1655 break; | |
1656 case 46: | |
1657 a3 = EQUIP_GEM; | |
1658 break; | |
1659 case 29: | |
1660 v53 = 37; | |
1661 break; | |
1662 default: | |
1663 --a3; | |
1664 break; | |
1665 } | |
1666 memset(&Dst, 0, 0xC80u); | |
1667 v52 = 0; | |
1668 v7 = (int *)&Dst; | |
1669 a2a = 1; | |
1670 if ( v53 == -1 ) | |
1671 { | |
1672 v53 = (int)&v5->pItems[1].uEquipType; | |
1673 v9 = (int)(&v5->pItems[1].uChanceByTreasureLvl[0] + v6); | |
1674 do | |
1675 { | 1625 { |
1676 if ( *(unsigned char *)v53 == a3 ) | 1626 if (pItems[i].uEquipType == requested_equip) |
1677 { | 1627 { |
1678 *v7 = a2a; | 1628 *v7++ = i; |
1679 ++v7; | 1629 v52 += pItems[i].uChanceByTreasureLvl[v6]; |
1680 v52 += *(unsigned char *)v9; | |
1681 } | 1630 } |
1682 ++a2a; | |
1683 v53 += 48; | |
1684 v9 += 48; | |
1685 } | 1631 } |
1686 while ( a2a < 500 ); | |
1687 } | 1632 } |
1688 else | 1633 else |
1689 { | 1634 { |
1690 v55 = (int)&v5->pItems[1].uSkillType; | 1635 for (uint i = 1; i < 500; ++i) |
1691 v8 = (int)(&v5->pItems[1].uChanceByTreasureLvl[0] + v6); | |
1692 do | |
1693 { | 1636 { |
1694 if ( *(unsigned char *)v55 == v53 ) | 1637 if (pItems[i].uSkillType == requested_skill) |
1695 { | 1638 { |
1696 *v7 = a2a; | 1639 *v7++ = i; |
1697 ++v7; | 1640 v52 += pItems[i].uChanceByTreasureLvl[v6]; |
1698 v52 += *(unsigned char *)v8; | |
1699 } | 1641 } |
1700 ++a2a; | |
1701 v55 += 48; | |
1702 v8 += 48; | |
1703 } | 1642 } |
1704 while ( a2a < 500 ); | |
1705 } | 1643 } |
1644 | |
1706 v10 = 0; | 1645 v10 = 0; |
1707 if ( v52 ) | 1646 if ( v52 ) |
1708 v10 = rand() % v52; | 1647 v10 = rand() % v52; |
1709 v4->uItemID = *(uint *)Dst; | 1648 |
1710 if ( !Dst ) | 1649 v4->uItemID = *Dst; |
1650 if (!v4->uItemID) | |
1711 v4->uItemID = 1; | 1651 v4->uItemID = 1; |
1712 v11 = *(&v5->pItems[v4->uItemID].uChanceByTreasureLvl[0] + v54); | 1652 |
1653 v11 = pItems[v4->uItemID].uChanceByTreasureLvl[v6]; | |
1713 if ( v11 < v10 ) | 1654 if ( v11 < v10 ) |
1714 { | 1655 { |
1715 v12 = (uint *)Dst; | 1656 v12 = (uint *)Dst; |
1716 do | 1657 do |
1717 { | 1658 { |
1718 ++v12; | 1659 ++v12; |
1719 v13 = *v12; | 1660 v13 = *v12; |
1720 v4->uItemID = *v12; | 1661 v4->uItemID = *v12; |
1721 v11 += *(&v5->pItems[v13].uChanceByTreasureLvl[0] + v54); | 1662 v11 += pItems[v13].uChanceByTreasureLvl[v6]; |
1722 } | 1663 } |
1723 while ( v11 < v10 ); | 1664 while ( v11 < v10 ); |
1724 } | 1665 } |
1725 if ( v5->pItems[v4->uItemID].uEquipType == EQUIP_POTION && v4->uItemID != ITEM_POTION_BOTTLE ) | 1666 if (pItems[v4->uItemID].uEquipType == EQUIP_POTION && v4->uItemID != ITEM_POTION_BOTTLE ) |
1726 { | 1667 { |
1727 v4->_bonus_type = 0; | 1668 v4->_bonus_type = 0; |
1728 v14 = 2; | 1669 v14 = 2; |
1729 do | 1670 do |
1730 { | 1671 { |
1732 v15 = v4->_bonus_type; | 1673 v15 = v4->_bonus_type; |
1733 --v14; | 1674 --v14; |
1734 } | 1675 } |
1735 while ( v14 ); | 1676 while ( v14 ); |
1736 LABEL_72: | 1677 LABEL_72: |
1737 v4->_bonus_type = v15 * (v54 + 1); | 1678 v4->_bonus_type = v15 * treasure_level; |
1738 goto LABEL_73; | 1679 goto LABEL_73; |
1739 } | 1680 } |
1740 } | 1681 } |
1741 else | 1682 else |
1742 { | 1683 { |
1744 v56 = 0; | 1685 v56 = 0; |
1745 do | 1686 do |
1746 v56 += pParty->field_7BA[v16++]; | 1687 v56 += pParty->field_7BA[v16++]; |
1747 while ( v16 < 29 ); | 1688 while ( v16 < 29 ); |
1748 v17 = rand() % 29; | 1689 v17 = rand() % 29; |
1749 if ( v54 == 5 && rand() % 100 < 5 && !pParty->field_7BA[v17] && v56 < 13 ) | 1690 if ( v6 == 5 && rand() % 100 < 5 && !pParty->field_7BA[v17] && v56 < 13 ) |
1750 { | 1691 { |
1751 pParty->field_7BA[v17] = 1; | 1692 pParty->field_7BA[v17] = 1; |
1752 v4->uAttributes = 0; | 1693 v4->uAttributes = 0; |
1753 v4->uItemID = v17 + 500; | 1694 v4->uItemID = v17 + 500; |
1754 v5->SetSpecialBonus(v4); | 1695 SetSpecialBonus(v4); |
1755 return; | 1696 return; |
1756 } | 1697 } |
1757 v57 = 0; | 1698 v57 = 0; |
1758 v18 = rand() % 10;// v5->field_11684[v54]; | 1699 v18 = rand() % 10;// v5->field_11684[v54]; |
1759 v4->uItemID = 0; | 1700 v4->uItemID = 0; |
1760 if ( v18 > 0 ) | 1701 if ( v18 > 0 ) |
1761 { | 1702 { |
1762 do | 1703 do |
1763 v57 += *(&v5->pItems[v4->uItemID++ + 1].uChanceByTreasureLvl[0] + v54); | 1704 v57 += pItems[v4->uItemID++ + 1].uChanceByTreasureLvl[v6]; |
1764 while ( v57 < v18 ); | 1705 while ( v57 < v18 ); |
1765 } | 1706 } |
1766 if ( !v18 ) | 1707 if ( !v18 ) |
1767 v4->uItemID = 1; | 1708 v4->uItemID = 1; |
1768 if ( !v4->uItemID ) | 1709 if ( !v4->uItemID ) |
1769 v4->uItemID = 1; | 1710 v4->uItemID = 1; |
1770 if ( v5->pItems[v4->uItemID].uEquipType == EQUIP_POTION && v4->uItemID != ITEM_POTION_BOTTLE ) | 1711 if (pItems[v4->uItemID].uEquipType == EQUIP_POTION && v4->uItemID != ITEM_POTION_BOTTLE) |
1771 { | 1712 { |
1772 v4->_bonus_type = 0; | 1713 v4->_bonus_type = 0; |
1773 v19 = 2; | 1714 v19 = 2; |
1774 do | 1715 do |
1775 { | 1716 { |
1787 v4->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST; | 1728 v4->uItemID = ITEM_SPELLBOOK_LIGHT_SUN_BURST; |
1788 if ( pItemsTable->pItems[v4->uItemID + 1].uItemID_Rep_St ) | 1729 if ( pItemsTable->pItems[v4->uItemID + 1].uItemID_Rep_St ) |
1789 v4->uAttributes = 0; | 1730 v4->uAttributes = 0; |
1790 else | 1731 else |
1791 v4->uAttributes = 1; | 1732 v4->uAttributes = 1; |
1792 if ( v5->pItems[v4->uItemID].uEquipType != EQUIP_POTION ) | 1733 if ( pItems[v4->uItemID].uEquipType != EQUIP_POTION ) |
1793 { | 1734 { |
1794 v4->uAdditionalValue = 0; | 1735 v4->uAdditionalValue = 0; |
1795 v4->_bonus_type = 0; | 1736 v4->_bonus_type = 0; |
1796 } | 1737 } |
1797 v20 = v5->pItems[v4->uItemID].uEquipType; | 1738 v20 = pItems[v4->uItemID].uEquipType; |
1798 if ( v20 <= EQUIP_BOW ) | 1739 if ( v20 <= EQUIP_BOW ) |
1799 { | 1740 { |
1800 v37 = 10;//(int)&v5->field_1169C[4 * v54 + 48]; | 1741 v37 = 10;//(int)&v5->field_1169C[4 * v54 + 48]; |
1801 if ( !*(unsigned int *)v37 ) | 1742 if ( !*(unsigned int *)v37 ) |
1802 return; | 1743 return; |
1814 v4->uNumCharges = v21; | 1755 v4->uNumCharges = v21; |
1815 v4->uMaxCharges = v21; | 1756 v4->uMaxCharges = v21; |
1816 } | 1757 } |
1817 return; | 1758 return; |
1818 } | 1759 } |
1819 v22 = (int)&v5->uBonusChanceStandart[v54]; | 1760 v22 = (int)&uBonusChanceStandart[v6]; |
1820 if ( !*(unsigned int *)v22 ) | 1761 if ( !*(unsigned int *)v22 ) |
1821 return; | 1762 return; |
1822 v23 = rand(); | 1763 v23 = rand(); |
1823 v24 = *(unsigned int *)v22; | 1764 v24 = *(unsigned int *)v22; |
1824 v25 = v23 % 100; | 1765 v25 = v23 % 100; |
1825 if ( v23 % 100 < v24 ) | 1766 if ( v23 % 100 < v24 ) |
1826 goto LABEL_127; | 1767 goto LABEL_127; |
1827 if ( !v5->uBonusChanceSpecial[v54] ) | 1768 if ( !uBonusChanceSpecial[v6] ) |
1828 return; | 1769 return; |
1829 if ( v25 < v24 ) | 1770 if ( v25 < v24 ) |
1830 { | 1771 { |
1831 LABEL_127: | 1772 LABEL_127: |
1832 v26 = rand() % 10;//v5->field_116D8[v5->pItems[v4->uItemID].uEquipType]; | 1773 v26 = rand() % 10;//v5->field_116D8[v5->pItems[v4->uItemID].uEquipType]; |
1833 v27 = v4->uItemID; | 1774 v27 = v4->uItemID; |
1834 v4->_bonus_type = 0; | 1775 v4->_bonus_type = 0; |
1835 for ( i = v5->pEnchantments[0].to_item[v5->pItems[v27].uEquipType + 1]; | 1776 for ( i = pEnchantments[0].to_item[pItems[v27].uEquipType + 1]; |
1836 i < v26; | 1777 i < v26; |
1837 i += v5->pEnchantments[v4->_bonus_type].to_item[v5->pItems[v29].uEquipType + 1] ) | 1778 i += pEnchantments[v4->_bonus_type].to_item[pItems[v29].uEquipType + 1] ) |
1838 { | 1779 { |
1839 v29 = v4->uItemID; | 1780 v29 = v4->uItemID; |
1840 ++v4->_bonus_type; | 1781 ++v4->_bonus_type; |
1841 } | 1782 } |
1842 ++v4->_bonus_type; | 1783 ++v4->_bonus_type; |
1858 if ( !(v35 ^ v36) ) | 1799 if ( !(v35 ^ v36) ) |
1859 return; | 1800 return; |
1860 memset(&Dst, 0, 0xC80u); | 1801 memset(&Dst, 0, 0xC80u); |
1861 v39 = 0; | 1802 v39 = 0; |
1862 a2b = 0; | 1803 a2b = 0; |
1863 if ( v5->pSpecialEnchantments_count > 0 ) | 1804 if ( pSpecialEnchantments_count > 0 ) |
1864 { | 1805 { |
1865 v52 = -16 - (uint)v5; | 1806 v52 = -16 - (uint)this; |
1866 v58 = (int *)&Dst; | 1807 v58 = (int *)&Dst; |
1867 v40 = (int)&v5->pSpecialEnchantments[1]; | 1808 v40 = (int)&pSpecialEnchantments[1]; |
1868 do | 1809 do |
1869 { | 1810 { |
1870 switch ( v54 ) | 1811 switch ( v6 ) |
1871 { | 1812 { |
1872 case 2: | 1813 case 2: |
1873 if ( !*(unsigned char *)v40 ) | 1814 if ( !*(unsigned char *)v40 ) |
1874 goto LABEL_117; | 1815 goto LABEL_117; |
1875 v41 = *(unsigned char *)v40 == 1; | 1816 v41 = *(unsigned char *)v40 == 1; |
1877 case 3: | 1818 case 3: |
1878 v43 = *(unsigned char *)v40; | 1819 v43 = *(unsigned char *)v40; |
1879 if ( !*(unsigned char *)v40 || v43 == 1 ) | 1820 if ( !*(unsigned char *)v40 || v43 == 1 ) |
1880 { | 1821 { |
1881 LABEL_117: | 1822 LABEL_117: |
1882 v39 += *((unsigned char *)&v5->uAllItemsCount + v40 + v52 + v5->pItems[v4->uItemID].uEquipType); | 1823 v39 += *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType); |
1883 if ( *((unsigned char *)&v5->uAllItemsCount + v40 + v52 + v5->pItems[v4->uItemID].uEquipType) ) | 1824 if ( *((unsigned char *)&uAllItemsCount + v40 + v52 + pItems[v4->uItemID].uEquipType) ) |
1884 { | 1825 { |
1885 v44 = v58; | 1826 v44 = v58; |
1886 ++v58; | 1827 ++v58; |
1887 *v44 = a2b; | 1828 *v44 = a2b; |
1888 } | 1829 } |
1895 if ( *(unsigned char *)v40 == 1 || v42 == 2 ) | 1836 if ( *(unsigned char *)v40 == 1 || v42 == 2 ) |
1896 goto LABEL_117; | 1837 goto LABEL_117; |
1897 v41 = v42 == 3; | 1838 v41 = v42 == 3; |
1898 break; | 1839 break; |
1899 default: | 1840 default: |
1900 if ( v54 != 5 ) | 1841 if ( v6 != 5 ) |
1901 goto LABEL_119; | 1842 goto LABEL_119; |
1902 v41 = *(unsigned char *)v40 == 3; | 1843 v41 = *(unsigned char *)v40 == 3; |
1903 break; | 1844 break; |
1904 } | 1845 } |
1905 if ( v41 ) | 1846 if ( v41 ) |
1906 goto LABEL_117; | 1847 goto LABEL_117; |
1907 LABEL_119: | 1848 LABEL_119: |
1908 ++a2b; | 1849 ++a2b; |
1909 v40 += 28; | 1850 v40 += 28; |
1910 } | 1851 } |
1911 while ( a2b < v5->pSpecialEnchantments_count ); | 1852 while ( a2b < pSpecialEnchantments_count ); |
1912 } | 1853 } |
1913 v45 = rand(); | 1854 v45 = rand(); |
1914 v4->uAdditionalValue = *(uint *)Dst; | 1855 v4->uAdditionalValue = *(uint *)Dst; |
1915 v46 = v45 % v39 + 1; | 1856 v46 = v45 % v39 + 1; |
1916 a2c = *((unsigned char *)&v5->uAllItemsCount + 28 * (*(uint *)Dst + 1389) + v5->pItems[v4->uItemID].uEquipType); | 1857 a2c = *((unsigned char *)&uAllItemsCount + 28 * (*(uint *)Dst + 1389) + pItems[v4->uItemID].uEquipType); |
1917 if ( a2c < v46 ) | 1858 if ( a2c < v46 ) |
1918 { | 1859 { |
1919 for ( j = (int *)&Dst; ; j = (int *)v59 ) | 1860 for ( j = (int *)&Dst; ; j = (int *)v59 ) |
1920 { | 1861 { |
1921 v48 = v4->uItemID; | 1862 v48 = v4->uItemID; |
1922 v49 = (int)(j + 1); | 1863 v49 = (int)(j + 1); |
1923 v59 = v49; | 1864 v59 = v49; |
1924 v50 = *(unsigned int *)v49; | 1865 v50 = *(unsigned int *)v49; |
1925 v4->uAdditionalValue = v50; | 1866 v4->uAdditionalValue = v50; |
1926 a2c += *((unsigned char *)&v5->uAllItemsCount + 28 * (v50 + 1389) + v5->pItems[v48].uEquipType); | 1867 a2c += *((unsigned char *)&uAllItemsCount + 28 * (v50 + 1389) + pItems[v48].uEquipType); |
1927 if ( a2c >= v46 ) | 1868 if ( a2c >= v46 ) |
1928 break; | 1869 break; |
1929 } | 1870 } |
1930 } | 1871 } |
1931 ++v4->uAdditionalValue; | 1872 ++v4->uAdditionalValue; |