Mercurial > mm7
comparison mm7_2.cpp @ 232:c879446b4a22
inventory indexing fixed
author | zipi |
---|---|
date | Sun, 17 Feb 2013 15:04:56 +0100 |
parents | 0c64754c7fd4 |
children | 47e06334c564 |
comparison
equal
deleted
inserted
replaced
231:a69fc44061d5 | 232:c879446b4a22 |
---|---|
2867 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) | 2867 || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) |
2868 return; | 2868 return; |
2869 v124 = 0; | 2869 v124 = 0; |
2870 v122 = 3; | 2870 v122 = 3; |
2871 v120 = ptr_507BC0->ptr_1C; | 2871 v120 = ptr_507BC0->ptr_1C; |
2872 v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5]; | 2872 v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; |
2873 v12 = (int)ptr_507BC0->ptr_1C; | 2873 v12 = (int)ptr_507BC0->ptr_1C; |
2874 uPlayerID = uActiveCharacter - 1; | 2874 uPlayerID = uActiveCharacter - 1; |
2875 v13 = v0->_490EEE(v116, 2, v12, 3); | 2875 v13 = v0->_490EEE(v116, 2, v12, 3); |
2876 v14 = uPlayerID; | 2876 v14 = uPlayerID; |
2877 v15 = (char *)pMerchantsSellPhrases[v13]; | 2877 v15 = (char *)pMerchantsSellPhrases[v13]; |
2891 if ( pMouse->GetCursorPos(&v143)->x < 462 ) | 2891 if ( pMouse->GetCursorPos(&v143)->x < 462 ) |
2892 { | 2892 { |
2893 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); | 2893 v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); |
2894 if ( v2 ) | 2894 if ( v2 ) |
2895 { | 2895 { |
2896 v3 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5]; | 2896 v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; |
2897 if ( v3->uAttributes & 1 ) | 2897 if ( v3->uAttributes & 1 ) |
2898 { | 2898 { |
2899 v118 = ptr_507BC0->ptr_1C; | 2899 v118 = ptr_507BC0->ptr_1C; |
2900 v4 = uActiveCharacter - 1; | 2900 v4 = uActiveCharacter - 1; |
2901 v5 = "%24"; | 2901 v5 = "%24"; |
4594 v25 = v0->AddItem(0xFFFFFFFFu, v20->uItemID); | 4594 v25 = v0->AddItem(0xFFFFFFFFu, v20->uItemID); |
4595 if ( v25 ) | 4595 if ( v25 ) |
4596 { | 4596 { |
4597 v26 = 1; | 4597 v26 = 1; |
4598 v20->uAttributes |= 1u; | 4598 v20->uAttributes |= 1u; |
4599 memcpy(&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v25 + 5], v20, 0x24u); | 4599 memcpy(&v0->pInventoryItems[v25-1], v20, 0x24u); |
4600 goto LABEL_42; | 4600 goto LABEL_42; |
4601 } | 4601 } |
4602 v0->PlaySound(SPEECH_NoRoom, 0); | 4602 v0->PlaySound(SPEECH_NoRoom, 0); |
4603 v54 = 5; | 4603 v54 = 5; |
4604 LABEL_70: | 4604 LABEL_70: |
4705 if ( pMouse->GetCursorPos(&v67)->x <= 13 | 4705 if ( pMouse->GetCursorPos(&v67)->x <= 13 |
4706 || pMouse->GetCursorPos(&v65)->x >= 462 | 4706 || pMouse->GetCursorPos(&v65)->x >= 462 |
4707 || (v15 = v0->GetItemIDAtInventoryIndex((int *)&v79), (v77 = (Player *)v15) == 0) ) | 4707 || (v15 = v0->GetItemIDAtInventoryIndex((int *)&v79), (v77 = (Player *)v15) == 0) ) |
4708 return; | 4708 return; |
4709 v16 = ptr_507BC0; | 4709 v16 = ptr_507BC0; |
4710 if ( sub_4BDAAF((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v15 + 5], (int)ptr_507BC0->ptr_1C) ) | 4710 if ( sub_4BDAAF((ItemGen *)&v0->pInventoryItems[v15-1], (int)ptr_507BC0->ptr_1C) ) |
4711 { | 4711 { |
4712 dword_F8B1E4 = 1; | 4712 dword_F8B1E4 = 1; |
4713 v0->_4BE2DD(v79, (int)((char *)v77 - 1), (int)v16->ptr_1C); | 4713 v0->_4BE2DD(v79, (int)((char *)v77 - 1), (int)v16->ptr_1C); |
4714 viewparams->bRedrawGameUI = 1; | 4714 viewparams->bRedrawGameUI = 1; |
4715 pRenderer->ClearZBuffer(0, 479); | 4715 pRenderer->ClearZBuffer(0, 479); |
4740 v11 = v0->GetItemIDAtInventoryIndex((int *)&v79); | 4740 v11 = v0->GetItemIDAtInventoryIndex((int *)&v79); |
4741 if ( v11 ) | 4741 if ( v11 ) |
4742 { | 4742 { |
4743 //v80 = v0->_4B8179(p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]); | 4743 //v80 = v0->_4B8179(p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]); |
4744 v80 = v0->_4B8179(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier); | 4744 v80 = v0->_4B8179(p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier); |
4745 v12 = (int)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v11 + 5]; | 4745 v12 = (int)&v0->pInventoryItems[v11-1]; |
4746 if ( !(*(char *)(v12 + 20) & 1) ) | 4746 if ( !(*(char *)(v12 + 20) & 1) ) |
4747 { | 4747 { |
4748 _this = (ItemGen *)ptr_507BC0->ptr_1C; | 4748 _this = (ItemGen *)ptr_507BC0->ptr_1C; |
4749 if ( sub_4BDAAF((ItemGen *)v12, (int)_this) ) | 4749 if ( sub_4BDAAF((ItemGen *)v12, (int)_this) ) |
4750 { | 4750 { |
4782 if ( pMouse->GetCursorPos(&v72)->x < 462 ) | 4782 if ( pMouse->GetCursorPos(&v72)->x < 462 ) |
4783 { | 4783 { |
4784 v2 = v0->GetItemIDAtInventoryIndex((int *)&v79); | 4784 v2 = v0->GetItemIDAtInventoryIndex((int *)&v79); |
4785 if ( v2 ) | 4785 if ( v2 ) |
4786 { | 4786 { |
4787 v3 = (int)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5]; | 4787 v3 = (int)&v0->pInventoryItems[v2-1]; |
4788 //v4 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; | 4788 //v4 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; |
4789 v4 = p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier; | 4789 v4 = p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].fPriceMultiplier; |
4790 | 4790 |
4791 auto _v = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5]; | 4791 auto _v = (ItemGen *)&v0->pInventoryItems[v2-1]; |
4792 v5 = _v->GetValue(); | 4792 v5 = _v->GetValue(); |
4793 | 4793 |
4794 v6 = v0->_4B81C3(v5, v4); | 4794 v6 = v0->_4B81C3(v5, v4); |
4795 v7 = (*(char *)(v3 + 20) & 2) == 0; | 4795 v7 = (*(char *)(v3 + 20) & 2) == 0; |
4796 v80 = v6; | 4796 v80 = v6; |
14766 v0 = pPlayers[uActiveCharacter]; | 14766 v0 = pPlayers[uActiveCharacter]; |
14767 v1 = v0->pEquipment.uMainHand; | 14767 v1 = v0->pEquipment.uMainHand; |
14768 v2 = v0->pEquipment.uOffHand; | 14768 v2 = v0->pEquipment.uOffHand; |
14769 v54 = v0->pEquipment.uOffHand; | 14769 v54 = v0->pEquipment.uOffHand; |
14770 v53 = v1; | 14770 v53 = v1; |
14771 if ( v1 && pItemsTable->pItems[*(int *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v1 + 5]].uEquipType == 1 ) | 14771 if ( v1 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uEquipType == 1 ) |
14772 v51 = v1; | 14772 v51 = v1; |
14773 v3 = pParty->pPickedItem.uItemID; | 14773 v3 = pParty->pPickedItem.uItemID; |
14774 if ( pParty->pPickedItem.uItemID ) | 14774 if ( pParty->pPickedItem.uItemID ) |
14775 { | 14775 { |
14776 v52 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; | 14776 v52 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; |
14793 } | 14793 } |
14794 else | 14794 else |
14795 { | 14795 { |
14796 if ( (v4 == 8 || v4 == 1 || v4 == 2) | 14796 if ( (v4 == 8 || v4 == 1 || v4 == 2) |
14797 && v1 | 14797 && v1 |
14798 && pItemsTable->pItems[*(int *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v1 + 5]].uSkillType == 4 ) | 14798 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uSkillType == 4 ) |
14799 goto LABEL_7; | 14799 goto LABEL_7; |
14800 } | 14800 } |
14801 LABEL_16: | 14801 LABEL_16: |
14802 if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) ) | 14802 if ( !v0->CanEquip_RaceAndAlignmentCheck(v3) ) |
14803 goto LABEL_8; | 14803 goto LABEL_8; |
15138 else | 15138 else |
15139 { | 15139 { |
15140 v35 = v0->pEquipment.uBow; | 15140 v35 = v0->pEquipment.uBow; |
15141 if ( v35 ) | 15141 if ( v35 ) |
15142 { | 15142 { |
15143 auto _a = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v35 + 5]; | 15143 auto _a = (ItemGen *)&v0->pInventoryItems[v35-1]; |
15144 pParty->SetHoldingItem(_a); | 15144 pParty->SetHoldingItem(_a); |
15145 _a->Reset(); | 15145 _a->Reset(); |
15146 v0->pEquipment.uBow = 0; | 15146 v0->pEquipment.uBow = 0; |
15147 } | 15147 } |
15148 } | 15148 } |