comparison mm7_1.cpp @ 501:6fa3ff8ef729

SubtractVariables
author Ritor1
date Fri, 01 Mar 2013 17:37:47 +0600
parents 63b171359be2
children 7c86030324a5
comparison
equal deleted inserted replaced
500:63b171359be2 501:6fa3ff8ef729
5073 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 5073 unsigned int pY; // [sp+3Ch] [bp-Ch]@2
5074 unsigned int pX; // [sp+40h] [bp-8h]@2 5074 unsigned int pX; // [sp+40h] [bp-8h]@2
5075 int a4; // [sp+44h] [bp-4h]@2 5075 int a4; // [sp+44h] [bp-4h]@2
5076 5076
5077 v0 = pPlayers[uActiveCharacter]; 5077 v0 = pPlayers[uActiveCharacter];
5078 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] != 103 5078 if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )
5079 || (pMouse->GetClickPos(&pX, &pY), 5079 {
5080 v1 = pY - 17, 5080 pMouse->GetClickPos(&pX, &pY);
5081 v2 = pX - 14, 5081 pY = pY - 17;
5082 pY = v1, 5082 v2 =pX - 14;
5083 pX = v2, 5083 pX = v2;
5084 v3 = 14 * (v1 >> 5), 5084 v3 = 14 * (pY >> 5);
5085 v2 >>= 5, 5085 v2 >>= 5;
5086 v4 = v2 + v3 < 0, 5086 v4 = v2 + v3 < 0;
5087 v5 = v2 + v3, 5087 v5 = v2 + v3;
5088 a4 = v5, 5088 a4 = v5;
5089 v4) 5089 if ( !v4 )
5090 || v5 > 126 5090 {
5091 || pMouse->GetCursorPos(&a2)->x >= 462 5091 if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462
5092 || pMouse->GetCursorPos(&a2)->x < 14 ) 5092 && pMouse->GetCursorPos(&a2)->x >= 14 )
5093 return; 5093 {
5094 if ( unk_50C9A0 ) 5094 if ( unk_50C9A0 )
5095 { 5095 {
5096 v6 = v0->GetItemIDAtInventoryIndex(&a4); 5096 v6 = v0->GetItemIDAtInventoryIndex(&a4);
5097 if ( v6 ) 5097 if ( v6 )
5098 { 5098 {
5099 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; 5099 *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu;
5100 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; 5100 *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1;
5101 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; 5101 *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1;
5102 *((short *)pGUIWindow_Settings->ptr_1C + 3) = a4; 5102 *((short *)pGUIWindow_Settings->ptr_1C + 3) = a4;
5103 ptr_50C9A4 = (ItemGen *)&v0->pInventoryItems[v6-1]; 5103 ptr_50C9A4 = (ItemGen *)&v0->pInventoryItems[v6-1];
5104 unk_50C9A0 = 0; 5104 unk_50C9A0 = 0;
5105 if ( pMessageQueue_50CBD0->uNumMessages ) 5105 if ( pMessageQueue_50CBD0->uNumMessages )
5106 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 5106 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
5107 pMouse->SetCursorBitmap("MICON1"); 5107 pMouse->SetCursorBitmap("MICON1");
5108 dword_50C9D0 = 113; 5108 dword_50C9D0 = 113;
5109 dword_50C9D4 = 0; 5109 dword_50C9D4 = 0;
5110 dword_50C9D8 = 256; 5110 dword_50C9D8 = 256;
5111 } 5111 }
5112 return; 5112 return;
5113 } 5113 }
5114 if ( ptr_50C9A4 ) 5114 if ( ptr_50C9A4 )
5115 return; 5115 return;
5116 v7 = pParty->pPickedItem.uItemID; 5116 v7 = pParty->pPickedItem.uItemID;
5117 v8 = v0->GetItemIDAtInventoryIndex(&a4); 5117 v8 = v0->GetItemIDAtInventoryIndex(&a4);
5118 if ( !v7 ) 5118 if ( !v7 )
5119 { 5119 {
5120 if ( !v8 ) 5120 if ( !v8 )
5121 return; 5121 return;
5122 memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem)); 5122 memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem));
5123 v0->RemoveItemAtInventoryIndex(a4); 5123 v0->RemoveItemAtInventoryIndex(a4);
5124 v9 = pParty->pPickedItem.uItemID; 5124 v9 = pParty->pPickedItem.uItemID;
5125 goto LABEL_24; 5125 goto LABEL_24;
5126 } 5126 }
5127 v13 = v8; 5127 v13 = v8;
5128 if ( v8 ) 5128 if ( v8 )
5129 { 5129 {
5130 a2.y = (LONG)&v0->pInventoryItems[v8-1]; 5130 a2.y = (LONG)&v0->pInventoryItems[v8-1];
5131 memcpy(&this_, (const void *)a2.y, sizeof(this_)); 5131 memcpy(&this_, (const void *)a2.y, sizeof(this_));
5132 v0->RemoveItemAtInventoryIndex(a4); 5132 v0->RemoveItemAtInventoryIndex(a4);
5133 pX = v0->AddItem2(a4, &pParty->pPickedItem); 5133 pX = v0->AddItem2(a4, &pParty->pPickedItem);
5134 if ( !pX ) 5134 if ( !pX )
5135 { 5135 {
5136 pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); 5136 pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem);
5137 if ( !pX ) 5137 if ( !pX )
5138 { 5138 {
5139 v0->_49298B(&this_, v13 - 1, a4); 5139 v0->_49298B(&this_, v13 - 1, a4);
5140 memcpy((void *)a2.y, &this_, sizeof(ItemGen)); 5140 memcpy((void *)a2.y, &this_, sizeof(ItemGen));
5141 return; 5141 return;
5142 } 5142 }
5143 } 5143 }
5144 v9 = this_.uItemID; 5144 v9 = this_.uItemID;
5145 memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); 5145 memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem));
5146 LABEL_24: 5146 LABEL_24:
5147 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); 5147 pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName);
5148 return; 5148 return;
5149 } 5149 }
5150 v10 = v0->AddItem(a4, v7); 5150 v10 = v0->AddItem(a4, v7);
5151 pX = v10; 5151 pX = v10;
5152 if ( v10 || (v10 = v0->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) 5152 if ( v10 || (v10 = v0->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID), (pX = v10) != 0) )
5153 { 5153 {
5154 memcpy(&v0->pInventoryItems[v10-1], &pParty->pPickedItem, 0x24u); 5154 memcpy(&v0->pInventoryItems[v10-1], &pParty->pPickedItem, 0x24u);
5155 pMouse->RemoveHoldingItem(); 5155 pMouse->RemoveHoldingItem();
5156 }
5157 }
5158 }
5156 } 5159 }
5157 } 5160 }
5158
5159 5161
5160 //----- (0042213C) -------------------------------------------------------- 5162 //----- (0042213C) --------------------------------------------------------
5161 void __cdecl OnGameViewportClick() 5163 void __cdecl OnGameViewportClick()
5162 { 5164 {
5163 signed int v0; // ebx@2 5165 signed int v0; // ebx@2