diff Player.cpp @ 1619:eceabd56f399

Player::EquipBody cleaned up
author Grumpy7
date Sat, 14 Sep 2013 19:09:44 +0200
parents f5b13e6be493
children 61ea994a1812
line wrap: on
line diff
--- a/Player.cpp	Sat Sep 14 07:21:56 2013 +0200
+++ b/Player.cpp	Sat Sep 14 19:09:44 2013 +0200
@@ -5652,6 +5652,7 @@
       {
         if ( (signed int)var_type >= 0xF5 )
         {
+          __debugbreak(); //how do I get here?
           *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44300] = LODWORD(pParty->uTimePlayed);
           *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44304] = HIDWORD(pParty->uTimePlayed);
         }
@@ -5660,9 +5661,11 @@
           switch ( var_type )
           {
             case VAR_MonthEquals|VAR_CurrentSP:
+              __debugbreak(); //how do I get here?
               _449B7E_toggle_bit((unsigned char *)field_1A50, var_value, 1u);
               break;
             case VAR_NPCs2:
+              __debugbreak(); //how do I get here?
               pParty->field_709 = 0;
               LOBYTE(pNPCStats->pNewNPCData[var_value].uFlags) |= 0x80u;
               pParty->CountHirelings();
@@ -5679,6 +5682,7 @@
         return;
       if ( (signed int)var_type <= 0x112 )
       {
+        __debugbreak(); //how do I get here?
         *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44532] = LODWORD(pParty->uTimePlayed);
         *(int *)&stru_AA1058[3].pSounds[8 * var_type + 44536] = HIDWORD(pParty->uTimePlayed);
       }
@@ -5701,6 +5705,7 @@
               v23 = pStorylineText->StoreLine[v22].pText == 0,//*(&pStorylineText->field_0 + 3 * v22) == 0,
               pParty->field_3C.field_4F0[2 * (var_type - 276) + 1] = HIDWORD(pParty->uTimePlayed),
               v23) )
+              __debugbreak(); //how do I get here?
           return;
         bFlashHistoryBook = 1;
       }
@@ -7324,35 +7329,27 @@
 //----- (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
   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
-
-
-  _this.Reset();
+  ItemGen tempPickedItem; // [sp+Ch] [bp-30h]@1
+  unsigned int *v11; // [sp+38h] [bp-4h]@1
+
+  tempPickedItem.Reset();
   v2 = pEquipTypeToBodyAnchor[uEquipType];
   v3 = pPlayers[uActiveCharacter];
-  v11 = (int *)&v3->pEquipment.pIndices[v2];
+  v11 = &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;
+  if ( v4 )
+  {
+    memcpy(&tempPickedItem, &pParty->pPickedItem, sizeof(tempPickedItem));
+    v3->pInventoryItemList[v4 - 1].uBodyAnchor = 0;
     pParty->pPickedItem.Reset();
-    pParty->SetHoldingItem((ItemGen *)(v5 + 532));
-    _this.uBodyAnchor = v2 + 1;
-    memcpy((void *)(v5 + 532), &_this, 0x24u);
-    *v11 = v10;
+    pParty->SetHoldingItem(&v3->pInventoryItemList[v4 - 1]);
+    tempPickedItem.uBodyAnchor = v2 + 1;
+    memcpy(&v3->pInventoryItemList[v4 - 1], &tempPickedItem, sizeof(ItemGen));
+    *v11 = v4;
   }
   else
   {
@@ -7360,7 +7357,7 @@
     if (v7 >= 0)
     {
       pParty->pPickedItem.uBodyAnchor = v2 + 1;
-      memcpy(&v3->pInventoryItemList[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItemList[v7]));
+      memcpy(&v3->pInventoryItemList[v7], &pParty->pPickedItem, sizeof(ItemGen));
       *v11 = v7 + 1;
       pMouse->RemoveHoldingItem();
     }