diff mm7_1.cpp @ 501:6fa3ff8ef729

SubtractVariables
author Ritor1
date Fri, 01 Mar 2013 17:37:47 +0600
parents 63b171359be2
children 7c86030324a5
line wrap: on
line diff
--- a/mm7_1.cpp	Thu Feb 28 10:36:37 2013 +0600
+++ b/mm7_1.cpp	Fri Mar 01 17:37:47 2013 +0600
@@ -5075,88 +5075,90 @@
   int a4; // [sp+44h] [bp-4h]@2
 
   v0 = pPlayers[uActiveCharacter];
-  if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] != 103
-    || (pMouse->GetClickPos(&pX, &pY),
-        v1 = pY - 17,
-        v2 = pX - 14,
-        pY = v1,
-        pX = v2,
-        v3 = 14 * (v1 >> 5),
-        v2 >>= 5,
-        v4 = v2 + v3 < 0,
-        v5 = v2 + v3,
-        a4 = v5,
-        v4)
-    || v5 > 126
-    || pMouse->GetCursorPos(&a2)->x >= 462
-    || pMouse->GetCursorPos(&a2)->x < 14 )
-    return;
-  if ( unk_50C9A0 )
+  if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )
   {
-    v6 = v0->GetItemIDAtInventoryIndex(&a4);
-    if ( v6 )
+    pMouse->GetClickPos(&pX, &pY);
+    pY = pY - 17;
+    v2 =pX - 14;
+    pX = v2;
+    v3 = 14 * (pY >> 5);
+    v2 >>= 5;
+    v4 = v2 + v3 < 0;
+    v5 = v2 + v3;
+    a4 = v5;
+    if ( !v4 )
     {
-      *((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) = a4;
-      ptr_50C9A4 = (ItemGen *)&v0->pInventoryItems[v6-1];
-      unk_50C9A0 = 0;
-      if ( pMessageQueue_50CBD0->uNumMessages )
-        pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
-      pMouse->SetCursorBitmap("MICON1");
-      dword_50C9D0 = 113;
-      dword_50C9D4 = 0;
-      dword_50C9D8 = 256;
-    }
-    return;
-  }
-  if ( ptr_50C9A4 )
-    return;
-  v7 = pParty->pPickedItem.uItemID;
-  v8 = v0->GetItemIDAtInventoryIndex(&a4);
-  if ( !v7 )
-  {
-    if ( !v8 )
-      return;
-    memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem));
-    v0->RemoveItemAtInventoryIndex(a4);
-    v9 = pParty->pPickedItem.uItemID;
-    goto LABEL_24;
-  }
-  v13 = v8;
-  if ( v8 )
-  {
-    a2.y = (LONG)&v0->pInventoryItems[v8-1];
-    memcpy(&this_, (const void *)a2.y, sizeof(this_));
-    v0->RemoveItemAtInventoryIndex(a4);
-    pX = v0->AddItem2(a4, &pParty->pPickedItem);
-    if ( !pX )
-    {
-      pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem);
-      if ( !pX )
+      if ( v5 <= 126 && pMouse->GetCursorPos(&a2)->x < 462
+            && pMouse->GetCursorPos(&a2)->x >= 14 )
       {
-        v0->_49298B(&this_, v13 - 1, a4);
-        memcpy((void *)a2.y, &this_, sizeof(ItemGen));
-        return;
+        if ( unk_50C9A0 )
+        {
+          v6 = v0->GetItemIDAtInventoryIndex(&a4);
+          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) = a4;
+            ptr_50C9A4 = (ItemGen *)&v0->pInventoryItems[v6-1];
+            unk_50C9A0 = 0;
+            if ( pMessageQueue_50CBD0->uNumMessages )
+              pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
+            pMouse->SetCursorBitmap("MICON1");
+            dword_50C9D0 = 113;
+            dword_50C9D4 = 0;
+            dword_50C9D8 = 256;
+          }
+          return;
+        }
+        if ( ptr_50C9A4 )
+          return;
+        v7 = pParty->pPickedItem.uItemID;
+        v8 = v0->GetItemIDAtInventoryIndex(&a4);
+        if ( !v7 )
+        {
+          if ( !v8 )
+            return;
+          memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem));
+          v0->RemoveItemAtInventoryIndex(a4);
+          v9 = pParty->pPickedItem.uItemID;
+          goto LABEL_24;
+        }
+        v13 = v8;
+        if ( v8 )
+        {
+          a2.y = (LONG)&v0->pInventoryItems[v8-1];
+          memcpy(&this_, (const void *)a2.y, sizeof(this_));
+          v0->RemoveItemAtInventoryIndex(a4);
+          pX = v0->AddItem2(a4, &pParty->pPickedItem);
+          if ( !pX )
+          {
+            pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem);
+            if ( !pX )
+            {
+              v0->_49298B(&this_, v13 - 1, a4);
+              memcpy((void *)a2.y, &this_, sizeof(ItemGen));
+              return;
+            }
+          }
+          v9 = this_.uItemID;
+          memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem));
+LABEL_24:
+          pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName);
+          return;
+        }
+        v10 = v0->AddItem(a4, v7);
+        pX = v10;
+        if ( v10 || (v10 = v0->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID), (pX = v10) != 0) )
+        {
+          memcpy(&v0->pInventoryItems[v10-1], &pParty->pPickedItem, 0x24u);
+          pMouse->RemoveHoldingItem();
+        }
       }
     }
-    v9 = this_.uItemID;
-    memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem));
-LABEL_24:
-    pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName);
-    return;
-  }
-  v10 = v0->AddItem(a4, v7);
-  pX = v10;
-  if ( v10 || (v10 = v0->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID), (pX = v10) != 0) )
-  {
-    memcpy(&v0->pInventoryItems[v10-1], &pParty->pPickedItem, 0x24u);
-    pMouse->RemoveHoldingItem();
   }
 }
 
-
 //----- (0042213C) --------------------------------------------------------
 void __cdecl OnGameViewportClick()
 {