Mercurial > mm7
comparison mm7_6.cpp @ 1406:d071e0e9ba75
Explosion Traps fix
author | Ritor1 |
---|---|
date | Tue, 23 Jul 2013 15:41:45 +0600 |
parents | cc9a3a24d61d |
children | 9a1adf08f4ed |
comparison
equal
deleted
inserted
replaced
1405:c0b273d33338 | 1406:d071e0e9ba75 |
---|---|
1605 } | 1605 } |
1606 | 1606 |
1607 //----- (0042F7EB) -------------------------------------------------------- | 1607 //----- (0042F7EB) -------------------------------------------------------- |
1608 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9) | 1608 bool __fastcall sub_42F7EB_DropItemAt(unsigned int uSpriteID, int x, int y, int z, int a4, int count, int a7, unsigned __int16 attributes, ItemGen *a9) |
1609 { | 1609 { |
1610 unsigned int v9; // edi@1 | 1610 unsigned __int16 pObjectDescID; // ax@7 |
1611 signed int v10; // edx@3 | 1611 SpriteObject pSpellObject; // [sp+Ch] [bp-78h]@1 |
1612 char *v11; // ecx@4 | 1612 |
1613 unsigned __int16 v12; // ax@7 | 1613 pSpellObject.stru_24.Reset(); |
1614 unsigned int v13; // edx@9 | |
1615 char *v14; // ecx@10 | |
1616 int v15; // esi@17 | |
1617 int v16; // eax@18 | |
1618 int v17; // edi@20 | |
1619 int v18; // esi@20 | |
1620 //SpriteObject a1a; // [sp+Ch] [bp-78h]@1 | |
1621 int v21; // [sp+7Ch] [bp-8h]@1 | |
1622 unsigned int v22; // [sp+80h] [bp-4h]@1 | |
1623 | |
1624 v9 = uSpriteID; | |
1625 v21 = x; | |
1626 v22 = uSpriteID; | |
1627 | |
1628 SpriteObject a1a; // [sp+Ch] [bp-78h]@1 | |
1629 //SpriteObject::SpriteObject(&a1a); | |
1630 a1a.stru_24.Reset(); | |
1631 | |
1632 if ( a9 ) | 1614 if ( a9 ) |
1633 { | 1615 memcpy(&pSpellObject.stru_24, a9, sizeof(pSpellObject.stru_24)); |
1634 memcpy(&a1a.stru_24, a9, sizeof(a1a.stru_24)); | 1616 pSpellObject.spell_skill = 0; |
1635 v9 = v22; | 1617 pSpellObject.spell_level = 0; |
1636 } | 1618 pSpellObject.spell_id = 0; |
1637 v10 = 0; | 1619 pSpellObject.field_54 = 0; |
1638 a1a.spell_skill = 0; | 1620 pSpellObject.uType = uSpriteID; |
1639 a1a.spell_level = 0; | |
1640 a1a.spell_id = 0; | |
1641 a1a.field_54 = 0; | |
1642 a1a.uType = v9; | |
1643 if ( (signed int)pObjectList->uNumObjects <= 0 ) | 1621 if ( (signed int)pObjectList->uNumObjects <= 0 ) |
1644 { | 1622 pObjectDescID = 0; |
1645 LABEL_7: | |
1646 v12 = 0; | |
1647 } | |
1648 else | 1623 else |
1649 { | 1624 { |
1650 v11 = (char *)&pObjectList->pObjects->uObjectID; | 1625 pObjectDescID = 0; |
1651 while ( (short)v9 != *(short *)v11 ) | 1626 for ( uint i = 0; i < (signed int)pObjectList->uNumObjects; ++i ) |
1652 { | 1627 { |
1653 ++v10; | 1628 if ( (short)uSpriteID == pObjectList->pObjects[i].uObjectID ) |
1654 v11 += 56; | 1629 pObjectDescID = i; |
1655 if ( v10 >= (signed int)pObjectList->uNumObjects ) | 1630 } |
1656 goto LABEL_7; | 1631 } |
1657 } | 1632 pSpellObject.uObjectDescID = pObjectDescID; |
1658 v12 = v10; | 1633 pSpellObject.vPosition.x = x; |
1659 } | 1634 pSpellObject.vPosition.y = y; |
1660 a1a.uObjectDescID = v12; | 1635 pSpellObject.vPosition.z = z; |
1661 a1a.vPosition.z = z; | 1636 pSpellObject.uSoundID = 0; |
1662 a1a.vPosition.x = v21; | 1637 pSpellObject.uAttributes = attributes; |
1663 a1a.vPosition.y = y; | 1638 pSpellObject.uSectorID = pIndoor->GetSector(x, y, z); |
1664 a1a.uSoundID = 0; | 1639 pSpellObject.uSpriteFrameID = 0; |
1665 a1a.uAttributes = attributes; | 1640 pSpellObject.spell_caster_pid = 0; |
1666 a1a.uSectorID = pIndoor->GetSector(v21, y, z); | 1641 pSpellObject.spell_target_pid = 0; |
1667 a1a.uSpriteFrameID = 0; | 1642 if ( !(pSpellObject.uAttributes & 0x10) ) |
1668 a1a.spell_caster_pid = 0; | 1643 { |
1669 a1a.spell_target_pid = 0; | 1644 if ( pItemsTable->uAllItemsCount ) |
1670 if ( !(a1a.uAttributes & 0x10) ) | 1645 { |
1671 { | 1646 for ( uint i = 0; i < pItemsTable->uAllItemsCount; ++i ) |
1672 v13 = 0; | 1647 { |
1673 if ( (signed int)pItemsTable->uAllItemsCount > 0 ) | 1648 if ( pItemsTable->pItems[i].uSpriteID == uSpriteID ) |
1674 { | 1649 pSpellObject.stru_24.uItemID = i; |
1675 v14 = (char *)&pItemsTable->pItems[0].uSpriteID; | 1650 } |
1676 while ( *(short *)v14 != v9 ) | 1651 } |
1677 { | 1652 } |
1678 ++v13; | |
1679 v14 += 48; | |
1680 if ( (signed int)v13 >= (signed int)pItemsTable->uAllItemsCount ) | |
1681 goto LABEL_16; | |
1682 } | |
1683 a1a.stru_24.uItemID = v13; | |
1684 } | |
1685 } | |
1686 LABEL_16: | |
1687 if ( a7 ) | 1653 if ( a7 ) |
1688 { | 1654 { |
1689 v15 = count; | |
1690 if ( count > 0 ) | 1655 if ( count > 0 ) |
1691 { | 1656 { |
1692 do | 1657 for ( uint i = count; i; --i ) |
1693 { | 1658 { |
1694 a1a.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; | 1659 pSpellObject.uFacing = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; |
1695 v16 = rand(); | 1660 pSpellObject.Create((signed __int16)pSpellObject.uFacing, |
1696 a1a.Create( | 1661 ((signed int)stru_5C6E00->uIntegerHalfPi / 2) + (rand() % ((signed int)stru_5C6E00->uIntegerHalfPi / 2)), a4, 0); |
1697 (signed __int16)a1a.uFacing, | 1662 |
1698 ((signed int)stru_5C6E00->uIntegerHalfPi >> 1) + (v16 % (signed int)stru_5C6E00->uIntegerHalfPi >> 1), | 1663 } |
1699 a4, | |
1700 0); | |
1701 --v15; | |
1702 } | |
1703 while ( v15 ); | |
1704 } | 1664 } |
1705 } | 1665 } |
1706 else | 1666 else |
1707 { | 1667 { |
1708 v17 = count; | 1668 pSpellObject.uFacing = 0; |
1709 v18 = stru_5C6E00->uIntegerHalfPi; | |
1710 a1a.uFacing = 0; | |
1711 if ( count > 0 ) | 1669 if ( count > 0 ) |
1712 { | 1670 { |
1713 do | 1671 for ( uint i = count; i; --i ) |
1714 { | 1672 { |
1715 a1a.Create((signed __int16)a1a.uFacing, v18, a4, 0); | 1673 pSpellObject.Create((signed __int16)pSpellObject.uFacing, stru_5C6E00->uIntegerHalfPi, a4, 0); |
1716 --v17; | 1674 } |
1717 } | 1675 } |
1718 while ( v17 ); | 1676 } |
1719 } | 1677 return true; |
1720 } | |
1721 return 1; | |
1722 } | 1678 } |
1723 | 1679 |
1724 //----- (0042F960) -------------------------------------------------------- | 1680 //----- (0042F960) -------------------------------------------------------- |
1725 void __fastcall sub_42F960_create_object(int x, int y, int z) | 1681 void __fastcall sub_42F960_create_object(int x, int y, int z) |
1726 { | 1682 { |