# HG changeset patch # User Grumpy7 # Date 1379666047 -7200 # Node ID 96d567a7d15fd32ab1ce33878a7e7005b10b8b76 # Parent 3c451fd02fcfedee4f44f5aed9f406a3664ba097 moving OnInventoryLeftClick to Player:: diff -r 3c451fd02fcf -r 96d567a7d15f Player.cpp --- a/Player.cpp Fri Sep 20 10:23:54 2013 +0200 +++ b/Player.cpp Fri Sep 20 10:34:07 2013 +0200 @@ -7794,9 +7794,8 @@ } } //----- (00421EA6) -------------------------------------------------------- -void OnInventoryLeftClick() -{ - Player *v0; // ebx@1 +void Player::OnInventoryLeftClick() +{ signed int v2; // ecx@2 int v3; // eax@2 int invMatrixIndex; // eax@2 @@ -7810,7 +7809,6 @@ unsigned int pY; // [sp+3Ch] [bp-Ch]@2 unsigned int pX; // [sp+40h] [bp-8h]@2 - v0 = pPlayers[uActiveCharacter]; if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 ) { pMouse->GetClickPos(&pX, &pY); @@ -7824,14 +7822,14 @@ { if ( _50C9A0_IsEnchantingInProgress ) { - v6 = v0->GetItemIDAtInventoryIndex(&invMatrixIndex); + v6 = this->GetItemIDAtInventoryIndex(&invMatrixIndex); if ( v6 ) { *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; *((short *)pGUIWindow_Settings->ptr_1C + 3) = invMatrixIndex; - ptr_50C9A4_ItemToEnchant = &v0->pInventoryItemList[v6-1]; + ptr_50C9A4_ItemToEnchant = &this->pInventoryItemList[v6-1]; _50C9A0_IsEnchantingInProgress = 0; if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; @@ -7845,15 +7843,15 @@ if ( ptr_50C9A4_ItemToEnchant ) return; pickedItemId = pParty->pPickedItem.uItemID; - invItemIndex = v0->GetItemIDAtInventoryIndex(&invMatrixIndex); + invItemIndex = this->GetItemIDAtInventoryIndex(&invMatrixIndex); if (!pickedItemId) { if ( !invItemIndex ) return; else { - memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[invItemIndex-1], sizeof(pParty->pPickedItem)); - v0->RemoveItemAtInventoryIndex(invMatrixIndex); + memcpy(&pParty->pPickedItem, &this->pInventoryItemList[invItemIndex-1], sizeof(pParty->pPickedItem)); + this->RemoveItemAtInventoryIndex(invMatrixIndex); v9 = pParty->pPickedItem.uItemID; pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); return; @@ -7863,16 +7861,16 @@ { if ( invItemIndex ) { - ItemGen* invItemPtr = &v0->pInventoryItemList[invItemIndex-1]; + ItemGen* invItemPtr = &this->pInventoryItemList[invItemIndex-1]; memcpy(&tmpItem, invItemPtr, sizeof(tmpItem)); - v0->RemoveItemAtInventoryIndex(invMatrixIndex); - int emptyIndex = v0->AddItem2(invMatrixIndex, &pParty->pPickedItem); + this->RemoveItemAtInventoryIndex(invMatrixIndex); + int emptyIndex = this->AddItem2(invMatrixIndex, &pParty->pPickedItem); if ( !emptyIndex ) { - emptyIndex = v0->AddItem2(-1, &pParty->pPickedItem); + emptyIndex = this->AddItem2(-1, &pParty->pPickedItem); if ( !emptyIndex ) { - v0->PutItemArInventoryIndex(tmpItem.uItemID, invItemIndex - 1, invMatrixIndex); + this->PutItemArInventoryIndex(tmpItem.uItemID, invItemIndex - 1, invMatrixIndex); memcpy(invItemPtr, &tmpItem, sizeof(ItemGen)); return; } @@ -7884,17 +7882,17 @@ } else { - v10 = v0->AddItem(invMatrixIndex, pickedItemId); + v10 = this->AddItem(invMatrixIndex, pickedItemId); if ( v10 ) { - memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen)); + memcpy(&this->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen)); pMouse->RemoveHoldingItem(); return; } - v10 = v0->AddItem(-1, pickedItemId); + v10 = this->AddItem(-1, pickedItemId); if ( v10 ) { - memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen)); + memcpy(&this->pInventoryItemList[v10-1], &pParty->pPickedItem, sizeof(ItemGen)); pMouse->RemoveHoldingItem(); return; } diff -r 3c451fd02fcf -r 96d567a7d15f Player.h --- a/Player.h Fri Sep 20 10:23:54 2013 +0200 +++ b/Player.h Fri Sep 20 10:34:07 2013 +0200 @@ -597,6 +597,7 @@ void EquipBody(ITEM_EQUIP_TYPE uEquipType); bool HasUnderwaterSuitEquipped(); bool HasItem(unsigned int uItemID, char a3); + void OnInventoryLeftClick(); unsigned int GetMultiplierForSkillLevel(unsigned int skillValue, int mult1, int mult2, int mult3, int mult4); int CalculateMeleeDmgToEnemyWithWeapon( ItemGen * weapon, unsigned int uTargetActorID , bool addOneDice); diff -r 3c451fd02fcf -r 96d567a7d15f UI/UIShops.cpp --- a/UI/UIShops.cpp Fri Sep 20 10:23:54 2013 +0200 +++ b/UI/UIShops.cpp Fri Sep 20 10:34:07 2013 +0200 @@ -2317,7 +2317,7 @@ if ( pCurrentScreen == SCREEN_E ) { - OnInventoryLeftClick(); + pPlayers[uActiveCharacter]->OnInventoryLeftClick(); return; } if ( !HouseUI_CheckIfPlayerCanInteract() ) @@ -2331,7 +2331,7 @@ case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - OnInventoryLeftClick(); + pPlayers[uActiveCharacter]->OnInventoryLeftClick(); break; } case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: diff -r 3c451fd02fcf -r 96d567a7d15f mm7_5.cpp --- a/mm7_5.cpp Fri Sep 20 10:23:54 2013 +0200 +++ b/mm7_5.cpp Fri Sep 20 10:34:07 2013 +0200 @@ -3046,7 +3046,7 @@ case UIMSG_CHEST_ClickItem: if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) { - OnInventoryLeftClick(); + pPlayers[uActiveCharacter]->OnInventoryLeftClick(); continue; } OnChestLeftClick(); diff -r 3c451fd02fcf -r 96d567a7d15f mm7_data.h --- a/mm7_data.h Fri Sep 20 10:23:54 2013 +0200 +++ b/mm7_data.h Fri Sep 20 10:34:07 2013 +0200 @@ -1133,7 +1133,6 @@ void GameUI_WritePointedObjectStatusString(); bool sub_421B2C_PlaceInInventory_or_DropPickedItem(); void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb -void OnInventoryLeftClick(); void OnGameViewportClick(); bool PauseGameDrawing(); void SetUserInterface(enum PartyAlignment alignment, bool bReplace);