Mercurial > mm7
comparison Player.cpp @ 1683:96d567a7d15f
moving OnInventoryLeftClick to Player::
author | Grumpy7 |
---|---|
date | Fri, 20 Sep 2013 10:34:07 +0200 |
parents | 3c451fd02fcf |
children | f84b8b2a875c |
comparison
equal
deleted
inserted
replaced
1682:3c451fd02fcf | 1683:96d567a7d15f |
---|---|
7792 return; | 7792 return; |
7793 } | 7793 } |
7794 } | 7794 } |
7795 } | 7795 } |
7796 //----- (00421EA6) -------------------------------------------------------- | 7796 //----- (00421EA6) -------------------------------------------------------- |
7797 void OnInventoryLeftClick() | 7797 void Player::OnInventoryLeftClick() |
7798 { | 7798 { |
7799 Player *v0; // ebx@1 | |
7800 signed int v2; // ecx@2 | 7799 signed int v2; // ecx@2 |
7801 int v3; // eax@2 | 7800 int v3; // eax@2 |
7802 int invMatrixIndex; // eax@2 | 7801 int invMatrixIndex; // eax@2 |
7803 unsigned int v6; // eax@7 | 7802 unsigned int v6; // eax@7 |
7804 unsigned int pickedItemId; // esi@12 | 7803 unsigned int pickedItemId; // esi@12 |
7808 ItemGen tmpItem; // [sp+Ch] [bp-3Ch]@1 | 7807 ItemGen tmpItem; // [sp+Ch] [bp-3Ch]@1 |
7809 POINT a2; // [sp+30h] [bp-18h]@4 | 7808 POINT a2; // [sp+30h] [bp-18h]@4 |
7810 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 | 7809 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 |
7811 unsigned int pX; // [sp+40h] [bp-8h]@2 | 7810 unsigned int pX; // [sp+40h] [bp-8h]@2 |
7812 | 7811 |
7813 v0 = pPlayers[uActiveCharacter]; | |
7814 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) | 7812 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) |
7815 { | 7813 { |
7816 pMouse->GetClickPos(&pX, &pY); | 7814 pMouse->GetClickPos(&pX, &pY); |
7817 v3 = Player::INVETORYSLOTSWIDTH * ((pY - 17) / 32); | 7815 v3 = Player::INVETORYSLOTSWIDTH * ((pY - 17) / 32); |
7818 v2 = (pX - 14) / 32; | 7816 v2 = (pX - 14) / 32; |
7822 if ( invMatrixIndex <= 126 && pMouse->GetCursorPos(&a2)->x < 462 | 7820 if ( invMatrixIndex <= 126 && pMouse->GetCursorPos(&a2)->x < 462 |
7823 && pMouse->GetCursorPos(&a2)->x >= 14 ) | 7821 && pMouse->GetCursorPos(&a2)->x >= 14 ) |
7824 { | 7822 { |
7825 if ( _50C9A0_IsEnchantingInProgress ) | 7823 if ( _50C9A0_IsEnchantingInProgress ) |
7826 { | 7824 { |
7827 v6 = v0->GetItemIDAtInventoryIndex(&invMatrixIndex); | 7825 v6 = this->GetItemIDAtInventoryIndex(&invMatrixIndex); |
7828 if ( v6 ) | 7826 if ( v6 ) |
7829 { | 7827 { |
7830 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; | 7828 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; |
7831 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; | 7829 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; |
7832 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; | 7830 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; |
7833 *((short *)pGUIWindow_Settings->ptr_1C + 3) = invMatrixIndex; | 7831 *((short *)pGUIWindow_Settings->ptr_1C + 3) = invMatrixIndex; |
7834 ptr_50C9A4_ItemToEnchant = &v0->pInventoryItemList[v6-1]; | 7832 ptr_50C9A4_ItemToEnchant = &this->pInventoryItemList[v6-1]; |
7835 _50C9A0_IsEnchantingInProgress = 0; | 7833 _50C9A0_IsEnchantingInProgress = 0; |
7836 if ( pMessageQueue_50CBD0->uNumMessages ) | 7834 if ( pMessageQueue_50CBD0->uNumMessages ) |
7837 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; | 7835 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; |
7838 pMouse->SetCursorBitmap("MICON1"); | 7836 pMouse->SetCursorBitmap("MICON1"); |
7839 _50C9D0_AfterEnchClickEventId = 113; | 7837 _50C9D0_AfterEnchClickEventId = 113; |
7843 return; | 7841 return; |
7844 } | 7842 } |
7845 if ( ptr_50C9A4_ItemToEnchant ) | 7843 if ( ptr_50C9A4_ItemToEnchant ) |
7846 return; | 7844 return; |
7847 pickedItemId = pParty->pPickedItem.uItemID; | 7845 pickedItemId = pParty->pPickedItem.uItemID; |
7848 invItemIndex = v0->GetItemIDAtInventoryIndex(&invMatrixIndex); | 7846 invItemIndex = this->GetItemIDAtInventoryIndex(&invMatrixIndex); |
7849 if (!pickedItemId) | 7847 if (!pickedItemId) |
7850 { | 7848 { |
7851 if ( !invItemIndex ) | 7849 if ( !invItemIndex ) |
7852 return; | 7850 return; |
7853 else | 7851 else |
7854 { | 7852 { |
7855 memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[invItemIndex-1], sizeof(pParty->pPickedItem)); | 7853 memcpy(&pParty->pPickedItem, &this->pInventoryItemList[invItemIndex-1], sizeof(pParty->pPickedItem)); |
7856 v0->RemoveItemAtInventoryIndex(invMatrixIndex); | 7854 this->RemoveItemAtInventoryIndex(invMatrixIndex); |
7857 v9 = pParty->pPickedItem.uItemID; | 7855 v9 = pParty->pPickedItem.uItemID; |
7858 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); | 7856 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); |
7859 return; | 7857 return; |
7860 } | 7858 } |
7861 } | 7859 } |
7862 else | 7860 else |
7863 { | 7861 { |
7864 if ( invItemIndex ) | 7862 if ( invItemIndex ) |
7865 { | 7863 { |
7866 ItemGen* invItemPtr = &v0->pInventoryItemList[invItemIndex-1]; | 7864 ItemGen* invItemPtr = &this->pInventoryItemList[invItemIndex-1]; |
7867 memcpy(&tmpItem, invItemPtr, sizeof(tmpItem)); | 7865 memcpy(&tmpItem, invItemPtr, sizeof(tmpItem)); |
7868 v0->RemoveItemAtInventoryIndex(invMatrixIndex); | 7866 this->RemoveItemAtInventoryIndex(invMatrixIndex); |
7869 int emptyIndex = v0->AddItem2(invMatrixIndex, &pParty->pPickedItem); | 7867 int emptyIndex = this->AddItem2(invMatrixIndex, &pParty->pPickedItem); |
7870 if ( !emptyIndex ) | 7868 if ( !emptyIndex ) |
7871 { | 7869 { |
7872 emptyIndex = v0->AddItem2(-1, &pParty->pPickedItem); | 7870 emptyIndex = this->AddItem2(-1, &pParty->pPickedItem); |
7873 if ( !emptyIndex ) | 7871 if ( !emptyIndex ) |
7874 { | 7872 { |
7875 v0->PutItemArInventoryIndex(tmpItem.uItemID, invItemIndex - 1, invMatrixIndex); | 7873 this->PutItemArInventoryIndex(tmpItem.uItemID, invItemIndex - 1, invMatrixIndex); |
7876 memcpy(invItemPtr, &tmpItem, sizeof(ItemGen)); | 7874 memcpy(invItemPtr, &tmpItem, sizeof(ItemGen)); |
7877 return; | 7875 return; |
7878 } | 7876 } |
7879 } | 7877 } |
7880 v9 = tmpItem.uItemID; | 7878 v9 = tmpItem.uItemID; |
7882 pMouse->SetCursorBitmap(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName); | 7880 pMouse->SetCursorBitmap(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName); |
7883 return; | 7881 return; |
7884 } | 7882 } |
7885 else | 7883 else |
7886 { | 7884 { |
7887 v10 = v0->AddItem(invMatrixIndex, pickedItemId); | 7885 v10 = this->AddItem(invMatrixIndex, pickedItemId); |
7888 if ( v10 ) | 7886 if ( v10 ) |
7889 { | 7887 { |
7890 memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen)); | 7888 memcpy(&this->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen)); |
7891 pMouse->RemoveHoldingItem(); | 7889 pMouse->RemoveHoldingItem(); |
7892 return; | 7890 return; |
7893 } | 7891 } |
7894 v10 = v0->AddItem(-1, pickedItemId); | 7892 v10 = this->AddItem(-1, pickedItemId); |
7895 if ( v10 ) | 7893 if ( v10 ) |
7896 { | 7894 { |
7897 memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen)); | 7895 memcpy(&this->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen)); |
7898 pMouse->RemoveHoldingItem(); | 7896 pMouse->RemoveHoldingItem(); |
7899 return; | 7897 return; |
7900 } | 7898 } |
7901 } | 7899 } |
7902 } | 7900 } |