diff Player.cpp @ 1276:f11651288371

changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff
author Grumpy7
date Sat, 15 Jun 2013 07:30:26 +0200
parents 7569c88d9cb0
children ce8ea73e7678
line wrap: on
line diff
--- a/Player.cpp	Sat Jun 15 06:51:04 2013 +0200
+++ b/Player.cpp	Sat Jun 15 07:30:26 2013 +0200
@@ -9444,4 +9444,84 @@
   }
 }
 // 5B65C4: using guessed type int dword_5B65C4;
-// 5B65CC: using guessed type int dword_5B65CC;
\ No newline at end of file
+// 5B65CC: using guessed type int dword_5B65CC;
+
+
+//----- (00467E7F) --------------------------------------------------------
+void Player::EquipBody(ITEM_EQUIP_TYPE uEquipType)
+{
+  //unsigned int v1; // esi@1
+  int v2; // ebx@1
+  Player *v3; // eax@1
+  int v4; // edx@1
+  int v5; // esi@2
+  //int v6; // eax@2
+  unsigned int v7; // eax@3
+  ItemGen _this; // [sp+Ch] [bp-30h]@1
+  //Player *v9; // [sp+30h] [bp-Ch]@1
+  int v10; // [sp+34h] [bp-8h]@1
+  int *v11; // [sp+38h] [bp-4h]@1
+
+  static unsigned char byte_4E8398[200] = // 4E8398
+  {
+    1, // EQUIP_OFF_HAND
+    1, // EQUIP_MAIN_HAND
+    2, // EQUIP_BOW
+    3, // EQUIP_ARMOUR
+    0, // EQUIP_SHIELD
+    4, // EQUIP_HELMET
+    5, // EQUIP_BELT
+    6, // EQUIP_CLOAK
+    7, // EQUIP_GAUNTLETS
+    8, // EQUIP_BOOTS
+    10, // EQUIP_RING
+    9, // EQUIP_AMULET
+    1, // EQUIP_WAND
+    0, // EQUIP_REAGENT
+    0, // EQUIP_POTION
+    0, // EQUIP_SPELL_SCROLL
+    0, // EQUIP_BOOK
+    0, // EQUIP_MESSAGE_SCROLL
+    0, // EQUIP_GOLD
+    0, // EQUIP_GEM
+    0, // EQUIP_NONE
+    // ???
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0,
+    0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0,  0, 0, 0, 0, 1, 0, 1, 1, 1, 0, 0,
+    0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0,  0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,  1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0,  0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 3, 3, 3, 3, 3, 3, 1, 1, 1,
+    1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+    0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2,  2, 0, 0, 0, 0, 0
+  };
+
+  _this.Reset();
+  v2 = byte_4E8398[uEquipType];
+  v3 = pPlayers[uActiveCharacter];
+  v11 = (int *)&v3->pEquipment.pIndices[v2];
+  v4 = *v11;
+  v10 = *v11;
+  if ( v10 )
+  {
+    memcpy(&_this, &pParty->pPickedItem, sizeof(_this));
+    v5 = (int)((char *)v3 + 4 * (9 * v4 - 9));
+    *(char *)(v5 + 556) = 0;
+    pParty->pPickedItem.Reset();
+    pParty->SetHoldingItem((ItemGen *)(v5 + 532));
+    _this.uBodyAnchor = v2 + 1;
+    memcpy((void *)(v5 + 532), &_this, 0x24u);
+    *v11 = v10;
+  }
+  else
+  {
+    v7 = v3->FindFreeInventorySlot();
+    if (v7 >= 0)
+    {
+      pParty->pPickedItem.uBodyAnchor = v2 + 1;
+      memcpy(&v3->pInventoryItems[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItems[v7]));
+      *v11 = v7 + 1;
+      pMouse->RemoveHoldingItem();
+    }
+  }
+}
\ No newline at end of file