# HG changeset patch # User Grumpy7 # Date 1371274226 -7200 # Node ID f1165128837194a6d1cd512f8d49f8aed143d3ba # Parent 7569c88d9cb041e7485abce7d4ffd11a28c7695a changed sub_467E7F_EquipBody to Player::EquipBody, some more header file stuff diff -r 7569c88d9cb0 -r f11651288371 MM7.h --- 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 -#include -#include -#include +#include 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 diff -r 7569c88d9cb0 -r f11651288371 Outdoor.h --- 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 diff -r 7569c88d9cb0 -r f11651288371 Player.cpp --- 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 diff -r 7569c88d9cb0 -r f11651288371 Player.h --- 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;} diff -r 7569c88d9cb0 -r f11651288371 mm7_2.cpp --- 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; diff -r 7569c88d9cb0 -r f11651288371 mm7_data.h --- 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 -#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();