changeset 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 1803172dffd9
files MM7.h Outdoor.h Player.cpp Player.h mm7_2.cpp mm7_data.h
diffstat 6 files changed, 85 insertions(+), 99 deletions(-) [+]
line wrap: on
line diff
--- a/MM7.h	Sat Jun 15 06:51:04 2013 +0200
+++ b/MM7.h	Sat Jun 15 07:30:26 2013 +0200
@@ -1,8 +1,5 @@
 #pragma once
-#include <math.h>
-#include <stdio.h>
-#include <stdarg.h>
-#include <string>
+#include <array>
 
 typedef unsigned int uint;
 
@@ -15,15 +12,6 @@
 typedef unsigned __int64 _QWORD;
 
 
-#include "VectorTypes.h"
-#include "IndoorCameraD3D.h"
-
-
-
-
-
-
-
 /*  288 */
 /*#pragma pack(push, 1)
 struct CheckHRESULT_stru0
--- a/Outdoor.h	Sat Jun 15 06:51:04 2013 +0200
+++ b/Outdoor.h	Sat Jun 15 07:30:26 2013 +0200
@@ -2,7 +2,6 @@
 
 #include "Indoor.h"
 #include "TileFrameTable.h"
-#include "Outdoor_stuff.h"
 
 #define DAY_ATTRIB_FOG  1
 
--- 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
--- a/Player.h	Sat Jun 15 06:51:04 2013 +0200
+++ b/Player.h	Sat Jun 15 07:30:26 2013 +0200
@@ -592,6 +592,7 @@
   bool CanCastSpell(unsigned int uRequiredMana);
   void PlaySoundBasedOnCondition(int currPlayerId);
   void DrawPlayerBuffAnimBasedOnCondition(int currPlayerId);
+  void EquipBody(ITEM_EQUIP_TYPE uEquipType);
 
   inline bool Weak()       {return pConditions[Condition_Weak] != 0;}
   inline bool Dead()       {return pConditions[Condition_Dead] != 0;}
--- a/mm7_2.cpp	Sat Jun 15 06:51:04 2013 +0200
+++ b/mm7_2.cpp	Sat Jun 15 07:30:26 2013 +0200
@@ -7986,86 +7986,6 @@
   return uCurrentMenuID;
 }
 
-
-//----- (00467E7F) --------------------------------------------------------
-void sub_467E7F_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();
-    }
-  }
-}
-
 //----- (00467F48) --------------------------------------------------------
 void CreateMsgScrollWindow( signed int mscroll_id )
     {
@@ -8239,7 +8159,7 @@
     }
     if ( pParty->pPickedItem.uItemID == 604 )
     {
-      sub_467E7F_EquipBody((ITEM_EQUIP_TYPE)3);
+      pPlayers[uActiveCharacter]->EquipBody((ITEM_EQUIP_TYPE)3);
       WetsuitOn(uActiveCharacter);
       return;
     }
@@ -8264,7 +8184,7 @@
 			pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0);
 			return;
 		}
-        sub_467E7F_EquipBody((ITEM_EQUIP_TYPE)v6);
+        pPlayers[uActiveCharacter]->EquipBody((ITEM_EQUIP_TYPE)v6);
         if ( pParty->pPickedItem.uItemID == 604 )
           WetsuitOff(uActiveCharacter);
         return;
--- a/mm7_data.h	Sat Jun 15 06:51:04 2013 +0200
+++ b/mm7_data.h	Sat Jun 15 07:30:26 2013 +0200
@@ -3,7 +3,6 @@
 #include "VectorTypes.h"
 #include "OSAPI.h"
 #include <array>
-#include "Items.h"    //TODO: remove this once sub_467E7F_EquipBody if moved to a class or something
 typedef char _UNKNOWN;
 
 
@@ -1344,7 +1343,6 @@
 enum MENU_STATE GetCurrentMenuID();
 void *__thiscall output_debug_string(void *_this, std::string a2, const char *a3, int a4);
 std::string *__fastcall _4678E2_make_error_string(std::string *a1, int line, std::string file);
-void sub_467E7F_EquipBody(ITEM_EQUIP_TYPE uEquipType); // idb
 void  CreateMsgScrollWindow(signed int mscroll_id);
 void __cdecl free_book_subwindow();
 void  CreateScrollWindow();