Mercurial > mm7
changeset 1389:4dc34f7acb0b
Merge
author | Grumpy7 |
---|---|
date | Wed, 17 Jul 2013 00:40:15 +0200 |
parents | 60d4885eb107 (diff) 729635c2bb40 (current diff) |
children | 613c77e51e38 |
files | |
diffstat | 14 files changed, 318 insertions(+), 500 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/Actor.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -5051,7 +5051,7 @@ v59 = 1; if ( player->HasItemEquipped(EQUIP_MAIN_HAND) ) { - auto main_hand_skill = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; + auto main_hand_skill = pItemsTable->pItems[player->pInventoryItemList[main_hand_idx - 1].uItemID].uSkillType; //v55 = pItemsTable->pItems[player->pInventoryItems[main_hand_idx - 1].uItemID].uSkillType; //v28 = SkillToMastery(player->pActiveSkills[v55]); auto main_hand_mastery = SkillToMastery(player->pActiveSkills[main_hand_skill]); @@ -5260,7 +5260,7 @@ { if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) { - auto _s = (ItemGen *)&player->pInventoryItems[v57->uShield - 1]; + auto _s = (ItemGen *)&player->pInventoryItemList[v57->uShield - 1]; a4 = _s->_439DF3_get_additional_damage(&a2, &v62); if ( v62 && pMonster->sCurrentHP > 0 ) {
--- a/CastSpellInfo.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/CastSpellInfo.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -467,7 +467,7 @@ pSpellSprite.uFacing = LOWORD(v715.uYawAngle); pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; - memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uBow-1], sizeof(pSpellSprite.stru_24)); + memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItemList[pPlayer->pEquipment.uBow-1], sizeof(pSpellSprite.stru_24)); pSpellSprite.uAttributes = 256; if ( pParty->bTurnBasedModeOn == 1 ) pSpellSprite.uAttributes = 260; @@ -501,7 +501,7 @@ pSpellSprite.uFacing = LOWORD(v715.uYawAngle); pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID]; - memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItems[pPlayer->pEquipment.uMainHand-1],sizeof(pSpellSprite.stru_24)); + memcpy(&pSpellSprite.stru_24, &pPlayer->pInventoryItemList[pPlayer->pEquipment.uMainHand-1],sizeof(pSpellSprite.stru_24)); // &pParty->pPlayers[pCastSpell->uPlayerID].spellbook.pDarkSpellbook.bIsSpellAvailable[36 // * pParty->pPlayers[pCastSpell->uPlayerID].pEquipment.uMainHand + 5], ); v23 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pSpellSprite.vPosition.z); @@ -991,7 +991,7 @@ if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; + v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; auto _itm = &pItemsTable->pItems[v730c->uItemID]; v730c->UpdateTempBonus(pParty->uTimePlayed); if ( v730c->uItemID < 64 || v730c->uItemID > 65 @@ -1879,7 +1879,7 @@ { if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; - v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; + v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; if ( pItemsTable->pItems[v240->uItemID].uEquipType != 12 || v240->uAttributes & 2 ) { @@ -1938,7 +1938,7 @@ amount = 10 * v2; v730 = 1; pPlayer = &pParty->pPlayers[pCastSpell->uPlayerID_2]; - v245 = &pPlayer->pInventoryItems[a2]; + v245 = &pPlayer->pInventoryItemList[a2]; ItemDesc *_v725 = &pItemsTable->pItems[v245->uItemID]; if ( v731 == 1 || v731 == 2 && _v725->uEquipType > 2 || @@ -3639,7 +3639,7 @@ break; __debugbreak(); //HIDWORD(v733) = (int)(char *)&pParty + 6972 * pCastSpell->uPlayerID_2 + 36 * a2 + 3040; - ItemGen *_v733 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; + ItemGen *_v733 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; ItemDesc *_v732 = &pItemsTable->pItems[_v733->uItemID]; _v733->UpdateTempBonus(pParty->uTimePlayed); if ( _v733->uItemID >= 64 && _v733->uItemID <= 65
--- a/Events.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/Events.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -956,10 +956,10 @@ v4 = v124; break; } - v67 = (int)pPlayers[uActiveCharacter]->pInventoryIndices; + v67 = (int)pPlayers[uActiveCharacter]->pInventoryMatrix; for ( v65 = 0; v65 < 126; ++v65 ) { - if ( (int)&pPlayers[uActiveCharacter]->pInventoryItems[v67] == pValue ) + if ( (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v67] == pValue ) { pPlayers[uActiveCharacter]->RemoveItemAtInventoryIndex(v65); ++curr_seq_num; @@ -972,7 +972,7 @@ v69 = (int)&pPlayers[uActiveCharacter]->pEquipment; for ( v68 = 0; v68 < 16; ++v68 ) { - if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItems[v69] == pValue ) + if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItemList[v69] == pValue ) { *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v68) = 0; ++curr_seq_num; @@ -983,10 +983,10 @@ } for (int i = 1; i < 5; i++) { - v72 = (int)pPlayers[i]->pInventoryIndices; + v72 = (int)pPlayers[i]->pInventoryMatrix; for ( int v71 = 0; v71 < 126; ++v71 ) { - if ( (int)&pPlayers[i]->pInventoryItems[v72] == pValue ) + if ( (int)&pPlayers[i]->pInventoryItemList[v72] == pValue ) { pPlayers[i]->RemoveItemAtInventoryIndex(v71); break; @@ -995,7 +995,7 @@ } v73 = 0; v74 = (int)&pPlayers[i]->pEquipment; - while ( !*(int *)v74 || (int)&pPlayer->pInventoryItems[v74] != pValue ) + while ( !*(int *)v74 || (int)&pPlayer->pInventoryItemList[v74] != pValue ) { ++v73; v74 += 4;
--- a/Items.h Tue Jul 16 14:26:13 2013 +0600 +++ b/Items.h Wed Jul 17 00:40:15 2013 +0200 @@ -112,6 +112,8 @@ ITEM_LICH_JAR_FULL = 601, ITEM_WETSUIT = 604, ITEM_LICH_JAR_EMPTY = 615, + ITEM_RECIPE_REJUVENATION = 740, + ITEM_RECIPE_BODY_RESISTANCE = 771, }; /* 331 */
--- a/Party.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/Party.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -252,7 +252,7 @@ while ( v2 <= &pParty->pPlayers[3] ) { v3 = 0; - v4 = v2->pInventoryItems; + v4 = v2->pInventoryItemList; do { if ( v4->uItemID == uItemID ) @@ -562,7 +562,7 @@ //v10 = uSkillIdx - 35 < 0; } //while (uSkillIdx < 36); - pItems = pCharacter->pInventoryItems; + pItems = pCharacter->pInventoryItemList; //v13 = 138; for (int i = 0; i < 138; i++) { @@ -1098,7 +1098,7 @@ if ( pPlayer->classType == PLAYER_CLASS_LICH ) { have_vessels_soul = false; - v7 = pPlayer->pInventoryItems;//[0].field_1A; + v7 = pPlayer->pInventoryItemList;//[0].field_1A; for ( uint i = 138; i; --i ) { if ( v7->uItemID == 601 && (unsigned __int8)v7->uHolderPlayer == pPlayerID + 1 ) @@ -1448,7 +1448,7 @@ if ( uActiveCharacter && (v2 = pPlayers[uActiveCharacter]->AddItem(-1, pParty->pPickedItem.uItemID)) != 0 ) { - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v2-1], &pParty->pPickedItem, 0x24u); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v2-1], &pParty->pPickedItem, 0x24u); pMouse->RemoveHoldingItem(); } else @@ -1460,7 +1460,7 @@ v4 = v3->AddItem(-1, pParty->pPickedItem.uItemID); if ( v4 ) { - memcpy(&pParty->pPlayers[v12].pInventoryItems[v4 - 1], &pParty->pPickedItem, 0x24u); + memcpy(&pParty->pPlayers[v12].pInventoryItemList[v4 - 1], &pParty->pPickedItem, 0x24u); pMouse->RemoveHoldingItem(); break; }
--- a/Player.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/Player.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -476,11 +476,11 @@ return 0; } - inv_index = this->pInventoryIndices[item_idx]; + inv_index = this->pInventoryMatrix[item_idx]; if ( inv_index < 0 ) { *pitem_index = -1 - inv_index; - inv_index = this->pInventoryIndices[-1 - inv_index]; + inv_index = this->pInventoryMatrix[-1 - inv_index]; } return inv_index; @@ -510,15 +510,15 @@ { for ( i = 0; i < enchant_count; ++i ) { - if (!(pInventoryItems[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) - pInventoryItems[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; + if (!(pInventoryItemList[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) + pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; } } else { for ( i = 0; i < avalible_items; ++i ) { - pInventoryItems[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; + pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; } } } @@ -849,7 +849,7 @@ int innerLoopPos = startOfInnerLoop; for (unsigned int x = 0; x < slotWidth; x++) { - if (pInventoryIndices[innerLoopPos] != 0) + if (pInventoryMatrix[innerLoopPos] != 0) { return false; } @@ -864,11 +864,11 @@ // 506128: using guessed type int areWeLoadingTexture; //----- (004925E6) -------------------------------------------------------- -int Player::FindFreeInventorySlot() +int Player::FindFreeInventoryListSlot() { for (int i = 0; i < 126; i++ ) { - if (pInventoryItems[i].uItemID == 0) + if (pInventoryItemList[i].uItemID == 0) { return i; } @@ -880,13 +880,9 @@ int Player::CreateItemInInventory(unsigned int uSlot, unsigned int uItemID) { int result; // eax@8 - Texture *texturePtr; // esi@10 - int *v9; // esi@13 - unsigned int widthInSlots; // [sp+0h] [bp-Ch]@10 signed int freeSlot; // [sp+8h] [bp-4h]@4 - unsigned int heightInSlots; // [sp+18h] [bp+Ch]@10 - - freeSlot = FindFreeInventorySlot(); + + freeSlot = FindFreeInventoryListSlot(); if ( freeSlot == -1 ) { if ( uActiveCharacter ) @@ -895,26 +891,9 @@ } else { - texturePtr = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); - widthInSlots = GetSizeInInventorySlots(texturePtr->uTextureWidth); - heightInSlots = GetSizeInInventorySlots(texturePtr->uTextureHeight); - if ( !areWeLoadingTexture ) - { - texturePtr->Release(); - pIcons_LOD->SyncLoadedFilesCount(); - } - if (widthInSlots > 0) - { - v9 = &this->pInventoryIndices[uSlot]; - for (unsigned int i = 0; i < heightInSlots; i++) - { - memset32(v9, -1 - uSlot, widthInSlots); //TODO: try to come up with a better solution. negative values are used when drawing the inventory - nothing is drawn - v9 += INVETORYSLOTSWIDTH; - } - } + PutItemArInventoryIndex(uItemID, freeSlot, uSlot); result = freeSlot + 1; - this->pInventoryIndices[uSlot] = freeSlot + 1; - this->pInventoryItems[freeSlot].uItemID = uItemID; + this->pInventoryItemList[freeSlot].uItemID = uItemID; } return result; } @@ -923,8 +902,6 @@ //----- (00492700) -------------------------------------------------------- int Player::HasSkill(unsigned int uSkillType) { - signed int result; // eax@3 - if ( uSkillType >= 37 || this->pActiveSkills[uSkillType] ) { return 1; @@ -938,170 +915,111 @@ } //----- (00492745) -------------------------------------------------------- -int Player::WearItem(unsigned int uItemID) +void Player::WearItem( unsigned int uItemID ) { int item_body_anch; // edi@6 int item_indx; - item_indx = FindFreeInventorySlot(); + item_indx = FindFreeInventoryListSlot(); if ( item_indx != -1 ) { - pInventoryItems[item_indx].uItemID = uItemID; + pInventoryItemList[item_indx].uItemID = uItemID; item_body_anch = pEquipTypeToBodyAnchor[pItemsTable->pItems[uItemID].uEquipType]; pEquipment.pIndices[item_body_anch] = item_indx + 1; - pInventoryItems[item_indx].uBodyAnchor = item_body_anch + 1; - } - return 0; + pInventoryItemList[item_indx].uBodyAnchor = item_body_anch + 1; + } } //----- (004927A8) -------------------------------------------------------- -int Player::AddItem(int uSlot, unsigned int uItemID) +int Player::AddItem(int index, unsigned int uItemID) { int xStartValue = 0; - - if ( uSlot == -1 ) + int startOfInnerLoop = 0; + + if ( index == -1 ) { for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) { - for (int xcoord = xStartValue; xcoord < INVETORYSLOTSWIDTH; xcoord++) - { - if ( CanFitItem(xcoord, uItemID) ) + int innerLoopPos = startOfInnerLoop; + for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) + { + if ( CanFitItem(innerLoopPos, uItemID) ) { - return CreateItemInInventory(xcoord, uItemID); + return CreateItemInInventory(innerLoopPos, uItemID); } - } - xStartValue += INVETORYSLOTSWIDTH; + innerLoopPos++; + } + startOfInnerLoop += INVETORYSLOTSWIDTH; } return 0; } - if ( !CanFitItem(uSlot, uItemID) ) + if ( !CanFitItem(index, uItemID) ) { pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); return 0; } - return CreateItemInInventory(uSlot, uItemID); + return CreateItemInInventory(index, uItemID); } //----- (00492826) -------------------------------------------------------- -int Player::AddItem2(int uSlot, ItemGen *Src) -{ - unsigned int v3; // ebx@1 - unsigned int v4; // esi@3 - signed int v5; // edi@3 - unsigned int v7; // [sp-8h] [bp-18h]@9 - ItemGen *v8; // [sp-4h] [bp-14h]@9 - Player *thisa; // [sp+Ch] [bp-4h]@1 - signed int uSlota; // [sp+18h] [bp+8h]@2 - - thisa = this; - v3 = Src->uItemID; +int Player::AddItem2(int index, ItemGen *Src) +{ + int xStartValue = 0; pItemsTable->SetSpecialBonus(Src); - if ( uSlot == -1 ) - { - uSlota = 0; - while ( true ) - { - v4 = uSlota; - v5 = 0; - do - { - if ( CanFitItem(v4, v3) ) + int startOfInnerLoop = 0; + + if ( index == -1 ) + { + for (int ycoord = 0; ycoord < INVETORYSLOTSHEIGHT; ycoord++) //TODO: change pInventoryMatrix to 2 dimensional array. + { + int innerLoopPos = startOfInnerLoop; + for (int xcoord = 0; xcoord < INVETORYSLOTSWIDTH; xcoord++) + { + if ( CanFitItem(innerLoopPos, Src->uItemID) ) { - v8 = Src; - v7 = v4; - return CreateItemInInventory2(v7, v8); + return CreateItemInInventory2(innerLoopPos, Src); } - ++v5; - v4 += 14; - } - while ( v5 < 14 ); - ++uSlota; - if ( uSlota < 9 ) - continue; - break; + innerLoopPos++; + } + startOfInnerLoop += INVETORYSLOTSWIDTH; } return 0; } - if ( !CanFitItem(uSlot, v3) ) + if ( !CanFitItem(index, Src->uItemID) ) return 0; - v8 = Src; - v7 = uSlot; - return CreateItemInInventory2(v7, v8); + return CreateItemInInventory2(index, Src); } //----- (0049289C) -------------------------------------------------------- -int Player::CreateItemInInventory2(unsigned int uSlot, ItemGen *Src) -{ - signed int v3; // ebx@1 - ItemGen *v4; // eax@1 +int Player::CreateItemInInventory2( unsigned int index, ItemGen *Src ) +{ + signed int freeSlot; // ebx@1 int result; // eax@6 - //unsigned int v6; // eax@7 - Texture *item_texture; // esi@7 - unsigned int v8; // edx@9 - int *pInvPos; // esi@10 - unsigned int slot_width; // [sp+4h] [bp-Ch]@7 - unsigned int slot_height; // [sp+8h] [bp-8h]@7 - Player *v12; // [sp+Ch] [bp-4h]@1 - - - v12 = this; - v3 = 0; - v4 = this->pInventoryItems; - while ( v4->uItemID ) - { - ++v3; - ++v4; - if ( v3 >= 126 ) - { - v3 = -1; - break; - } - } - if ( v3 == -1 ) + + freeSlot = FindFreeInventoryListSlot(); + if ( freeSlot == -1 ) { result = 0; } else { - item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); - slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); - if ( !areWeLoadingTexture ) - { - item_texture->Release(); - pIcons_LOD->SyncLoadedFilesCount(); - } - if ( slot_height > 0 ) - { - pInvPos = &pInventoryIndices[uSlot]; - do - { - if ( slot_width > 0 ) - memset32(pInvPos, -1 - uSlot, slot_width); - pInvPos +=14; - --slot_height; - } - while ( slot_height ); - } - pInventoryIndices[uSlot] = v3 + 1; - memcpy(&pInventoryItems[v3], Src, sizeof(ItemGen)); - result = v3 + 1; + PutItemArInventoryIndex(Src->uItemID, freeSlot, index); + memcpy(&pInventoryItemList[freeSlot], Src, sizeof(ItemGen)); + result = freeSlot + 1; } return result; } // 506128: using guessed type int areWeLoadingTexture; //----- (0049298B) -------------------------------------------------------- -int Player::PutItemArInventoryIndex( ItemGen *item, int item_id, int uSlot ) - { - //Player *v4; // ebx@1 - //unsigned int v5; // eax@1 +void Player::PutItemArInventoryIndex( int uItemID, int itemListPos, int index ) //originally accepted ItemGen* but needed only its uItemID +{ Texture *item_texture; // esi@1 int *pInvPos; // esi@4 unsigned int slot_width; // [sp+Ch] [bp-4h]@1 unsigned int slot_height; // [sp+18h] [bp+8h]@1 - item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); if ( !areWeLoadingTexture ) @@ -1109,35 +1027,30 @@ item_texture->Release(); pIcons_LOD->SyncLoadedFilesCount(); } - if ( (signed int)slot_height > 0 ) - { - pInvPos = &pInventoryIndices[uSlot]; //14x9 - do - { - if ( (signed int)slot_width > 0 ) - memset32(pInvPos, -1 - uSlot, slot_width); - pInvPos +=14; - --slot_height; - } - while ( slot_height ); - } - pInventoryIndices[uSlot] = item_id + 1; - return 1; + if ( slot_width > 0 ) + { + pInvPos = &pInventoryMatrix[index]; + for (unsigned int i = 0; i < slot_height; i++) + { + memset32(pInvPos, -1 - index, slot_width);//TODO: try to come up with a better solution. negative values are used when drawing the inventory - nothing is drawn + pInvPos += INVETORYSLOTSWIDTH; + } + } + pInventoryMatrix[index] = itemListPos + 1; } // 506128: using guessed type int areWeLoadingTexture; //----- (00492A36) -------------------------------------------------------- -void Player::RemoveItemAtInventoryIndex( unsigned int uSlot ) - { - +void Player::RemoveItemAtInventoryIndex( unsigned int index ) +{ ItemGen *item_in_slot; // ecx@1 Texture *item_texture; // esi@1 unsigned int slot_height; // ebp@1 int *pInvPos; // edx@4 unsigned int slot_width; // [sp+14h] [bp+4h]@1 - item_in_slot = &this->pInventoryItems[pInventoryIndices[uSlot]-1]; + item_in_slot = &this->pInventoryItemList[pInventoryMatrix[index]-1]; item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item_in_slot->uItemID].pIconName, TEXTURE_16BIT_PALETTE); item_in_slot->Reset(); slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); @@ -1147,201 +1060,103 @@ item_texture->Release(); pIcons_LOD->SyncLoadedFilesCount(); } - if ( slot_height > 0 ) - { - pInvPos = &pInventoryIndices[uSlot]; - do - { - if (slot_width > 0 ) - memset32(pInvPos, 0, slot_width); - pInvPos += 14; - --slot_height; - } - while ( slot_height ); - } - + if ( slot_width > 0 ) + { + pInvPos = &pInventoryMatrix[index]; + for (unsigned int i = 0; i < slot_height; i++) + { + memset32(pInvPos, 0, slot_width); + pInvPos += INVETORYSLOTSWIDTH; + } + } } // 506128: using guessed type int areWeLoadingTexture; -//identf //----- (00490EEE) -------------------------------------------------------- -int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) -{ - int pSkillLevel; // eax@1 - int NotBuy; // eax@1 - int result; - signed int pEquipType; // esi@1 - float *pPriceMultiplier; // esi@26 - int pPriceItemService; // edi@26 - - pSkillLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); - NotBuy = 4; - pEquipType = pItemsTable->pItems[pItem->uItemID].uEquipType; - if ( (building_type != 4 || (signed int)pItem->uItemID < 740 || (signed int)pItem->uItemID > 771) - && ((signed int)pItem->uItemID >= 600 || (signed int)pItem->uItemID >= 529 && (signed int)pItem->uItemID <= 599) ) - return 5; - if ( building_type == BildingType_WeaponShop ) - { - if ( pEquipType > EQUIP_BOW ) - return NotBuy; - if (pItem->Stolen()) - return 6; - } - if ( building_type == BildingType_ArmorShop ) - { - if ( pEquipType < 3 && pEquipType > 9 ) - return NotBuy; - if (pItem->Stolen()) - return 6; - } - if ( building_type == BildingType_MagicShop ) - { - if ( pItemsTable->pItems[pItem->uItemID].uSkillType == 38 ) - { - if (pItem->Stolen()) - return 6; - pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; - pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); - if ( ShopMenuType == 3 )//Sell - { - pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); - if (!pItem->Broken()) - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - pPriceItemService = 1; - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( ShopMenuType == 4 )//Identify - { - pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( ShopMenuType == 5 )//Repair - { - pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( ShopMenuType != 6 )//Buy and ??? - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; +int Player::SelectPhrasesTransaction(ItemGen *pItem, int building_type, int BuildID_2Events, int ShopMenuType) //TODO: probably move this somewhere else, not really Player:: stuff +{ + unsigned int idemId; // edx@1 + signed int equipType; // esi@1 + float multiplier; // ST04_4@26 + int price; // edi@26 + int merchantLevel; // [sp+10h] [bp-8h]@1 + int itemValue; + + merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); + idemId = pItem->uItemID; + equipType = pItemsTable->pItems[idemId].uEquipType; + itemValue = pItem->GetValue(); + + switch (building_type) + { + case BildingType_WeaponShop: + if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) + return 5; + if (equipType > EQUIP_BOW) + return 4; + break; + case BildingType_ArmorShop: + if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) + return 5; + if ( equipType < EQUIP_ARMOUR || equipType > EQUIP_BOOTS) + return 4; + break; + case BildingType_MagicShop: + if (idemId >= ITEM_ARTIFACT_HERMES_SANDALS) + return 5; + if ( pItemsTable->pItems[idemId].uSkillType != PLAYER_SKILL_MISC ) + return 4; + break; + case BildingType_AlchemistShop: + if ((idemId >= ITEM_ARTIFACT_HERMES_SANDALS && idemId < ITEM_RECIPE_REJUVENATION) || idemId > ITEM_RECIPE_BODY_RESISTANCE) + return 5; + if ( !(equipType == EQUIP_REAGENT || equipType == EQUIP_POTION || equipType == EQUIP_MESSAGE_SCROLL)) + return 4; + break; + default: + assert(false); + break; + } + if (pItem->Stolen()) + return 6; + + multiplier = p2DEvents[BuildID_2Events - 1].fPriceMultiplier; + switch (ShopMenuType) + { + case 2: + price = GetBuyingPrice(itemValue, multiplier); + break; + case 3: if (pItem->Broken()) - pPriceItemService = 1; - if ( pPriceItemService >= 1 ) - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - pPriceItemService = 1; - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( pEquipType != EQUIP_BOOK ) - return NotBuy; - } - if ( building_type == BildingType_AlchemistShop ) - { - if ( pEquipType < EQUIP_REAGENT ) - return NotBuy; - if ( pEquipType > EQUIP_POTION ) - { - if ( pEquipType != EQUIP_MESSAGE_SCROLL ) - return NotBuy; - } - if (pItem->Stolen()) - return 6; - } - pPriceMultiplier = &p2DEvents[BuildID_2Events - 1].fPriceMultiplier; - pPriceItemService = GetBuyingPrice(pItem->GetValue(), *pPriceMultiplier); - if ( ShopMenuType == 3 )//Sell - { - pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier); - if (!pItem->Broken()) - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; + price = 1; else - result = 1; - return result; - } - pPriceItemService = 1; - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( ShopMenuType == 4 )//Identify - { - pPriceItemService = this->GetPriceIdentification(*pPriceMultiplier); - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - if ( ShopMenuType == 5 )//Repair - { - pPriceItemService = this->GetPriceRepair(pItem->GetValue(), *pPriceMultiplier); - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; + price = this->GetPriceSell(itemValue, multiplier); + break; + case 4: + price = this->GetPriceIdentification(multiplier); + break; + case 5: + price = this->GetPriceRepair(itemValue, multiplier); + break; + default: + assert(false); + break; + } + if ( merchantLevel ) + { + if (price == itemValue) + { + return 3; + } else - result = 1; - return result; - } - if ( ShopMenuType != 6 )//Buy and ??? - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - pPriceItemService = this->GetPriceSell(pItem->GetValue(), *pPriceMultiplier) / 2; - if (pItem->Broken()) - pPriceItemService = 1; - if ( pPriceItemService >= 1 ) - { - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; - else - result = 1; - return result; - } - pPriceItemService = 1; - if ( pSkillLevel ) - result = (pPriceItemService == pItem->GetValue()) + 2; + { + return 2; + } + } else - result = 1; - return result; + { + return 1; + } } //----- (0049107D) -------------------------------------------------------- @@ -1644,9 +1459,9 @@ Player::Player() { memset(&pEquipment, 0, sizeof(PlayerEquipment)); - memset(pInventoryIndices, 0, 126 * sizeof(int)); + memset(pInventoryMatrix, 0, 126 * sizeof(int)); for (uint i = 0; i < 126; ++i) - pInventoryItems[i].Reset(); + pInventoryItemList[i].Reset(); for (uint i = 0; i < 12; ++i) pEquippedItems[i].Reset(); @@ -1677,6 +1492,7 @@ uLuck = uLuckBonus = 0; uLevel = sLevelModifier = 0; sAgeModifier = 0; + sACModifier = 0; // memset(field_1F5, 0, 30); pure_luck_used=0; @@ -1820,7 +1636,7 @@ goto LABEL_15; } } - memcpy(&v9->pInventoryItems[v10-1], pItem, 0x24u); + memcpy(&v9->pInventoryItemList[v10-1], pItem, 0x24u); pItem->Reset(); pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); v19->PlaySound(SPEECH_60, 0); @@ -2120,7 +1936,7 @@ } if ( HasItemEquipped(EQUIP_MAIN_HAND) ) { - v6 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uMainHand-1]; + v6 = (ItemGen *)&v5->pInventoryItemList[v5->pEquipment.uMainHand-1]; v7 = v6->uItemID; v8 = v6->uItemID; v9 = pItemsTable->pItems[v8].uDamageDice; @@ -2192,7 +2008,7 @@ { if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) { - v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; + v15 = (ItemGen *)&v5->pInventoryItemList[v5->pEquipment.uShield - 1]; v16 = v15->uItemID; v17 = v15->uItemID; if ( pItemsTable->pItems[v17].uEquipType != 4 ) @@ -2285,7 +2101,7 @@ int v7; // edi@4 v1 = this; - v2 = *(int *)&this->pInventoryItems[this->pEquipment.uMainHand-1]; + v2 = *(int *)&this->pInventoryItemList[this->pEquipment.uMainHand-1]; if ( v2 < 64 || v2 > 65 ) { v4 = GetActualAccuracy(); @@ -2375,7 +2191,7 @@ result = HasItemEquipped(EQUIP_BOW); if ( !result ) return result; - v4 = (ItemGen *)&v2->pInventoryItems[v2->pEquipment.uBow-1]; + v4 = (ItemGen *)&v2->pInventoryItemList[v2->pEquipment.uBow-1]; v5 = v4->uItemID; v6 = v4->uItemID; v15 = pItemsTable->pItems[v6].uDamageRoll; @@ -2625,13 +2441,13 @@ //----- (0048D62C) -------------------------------------------------------- ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) { - return pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; + return pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; } //----- (0048D651) -------------------------------------------------------- PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) { - return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItems[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; + return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; } //----- (0048D676) -------------------------------------------------------- @@ -2674,7 +2490,7 @@ { v6 = 0; while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) - || pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != item_id ) + || pInventoryItemList[pEquipment.pIndices[v6] - 1].uItemID != item_id ) { ++v6; if ( (signed int)v6 >= 16 ) @@ -2682,7 +2498,7 @@ } return 1; } - if ( HasItemEquipped(equip_type) && pInventoryItems[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) + if ( HasItemEquipped(equip_type) && pInventoryItemList[pEquipment.pIndices[equip_type - 1]].uItemID == item_id ) return 1; return 0; } @@ -3059,7 +2875,7 @@ break; case 17: v12 = 0; - v13 = this->pInventoryItems; + v13 = this->pInventoryItemList; do { if ( (signed int)v13->uItemID > 0 && (signed int)v13->uItemID <= 134 && !v13->Broken()) @@ -3102,17 +2918,17 @@ LABEL_36: if ( !v4 ) goto LABEL_87; - v48 = (int)&v5->pInventoryItems[(unsigned __int8)v46[rand() % v4]]; + v48 = (int)&v5->pInventoryItemList[(unsigned __int8)v46[rand() % v4]]; v11 = 3 * (pItemsTable->pItems[*(int *)v48].uMaterial + pItemsTable->pItems[*(int *)v48].uDamageMod); break; case 20: v19 = 0; - v20 = this->pInventoryIndices; + v20 = this->pInventoryMatrix; do { if ( *v20 > 0 ) { - v21 = *(int *)&v5->pInventoryItems[*v20-1]; + v21 = *(int *)&v5->pInventoryItemList[*v20-1]; if ( v21 > 0 ) { if ( v21 <= 134 ) @@ -3285,7 +3101,7 @@ goto LABEL_84; } v28 = v47; - memcpy(v27, &v5->pInventoryItems[v5->pInventoryIndices[v47]-1], 0x24u); + memcpy(v27, &v5->pInventoryItemList[v5->pInventoryMatrix[v47]-1], 0x24u); RemoveItemAtInventoryIndex(v28); LABEL_79: v42 = 0; @@ -3339,7 +3155,7 @@ { if ( !HasItemEquipped(EQUIP_BOW) ) goto LABEL_17; - weapon = &pInventoryItems[pEquipment.uBow - 1]; + weapon = &pInventoryItemList[pEquipment.uBow - 1]; weapon_desc = &pItemsTable->pItems[weapon->uItemID]; weapon_recovery = base_recovery_times_per_weapon_type[weapon_desc->uSkillType]; goto LABEL_17; @@ -3355,7 +3171,7 @@ if ( HasItemEquipped(EQUIP_MAIN_HAND) ) { - weapon = &pInventoryItems[pEquipment.uMainHand - 1]; + weapon = &pInventoryItemList[pEquipment.uMainHand - 1]; weapon_desc = &pItemsTable->pItems[weapon->uItemID]; if (weapon_desc->uEquipType == EQUIP_WAND) { @@ -3369,11 +3185,11 @@ if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) // ADD: shield check because shield recovery is added later and can be accidentally doubled { - auto v12 = &pInventoryItems[pEquipment.uShield - 1]; + auto v12 = &pInventoryItemList[pEquipment.uShield - 1]; auto v12_desc = &pItemsTable->pItems[v12->uItemID]; if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) { - weapon = &pInventoryItems[pEquipment.uShield - 1]; + weapon = &pInventoryItemList[pEquipment.uShield - 1]; weapon_desc = &pItemsTable->pItems[weapon->uItemID]; weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; } @@ -3383,7 +3199,7 @@ uint armour_recovery = 0; if ( HasItemEquipped(EQUIP_ARMOUR) ) { - auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; + auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType; uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; float armour_recovery_multipliers[4]; @@ -3426,7 +3242,7 @@ { float shield_recovery_multipliers[4] = {1, 0, 0, 0}; - auto shield = &pInventoryItems[pEquipment.uShield - 1]; + auto shield = &pInventoryItemList[pEquipment.uShield - 1]; auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; @@ -3859,12 +3675,12 @@ inv_indx = pEquipment.pIndices[i] - 1; if (a2==17) { - if ((pInventoryItems[inv_indx].uSpecEnchantmentType==17)||(pInventoryItems[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery + if ((pInventoryItemList[inv_indx].uSpecEnchantmentType==17)||(pInventoryItemList[inv_indx].uItemID==533)) //Elven Chainmail+Increases rate of Recovery return 50; } if (a2==24) { - if (pInventoryItems[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. + if (pInventoryItemList[inv_indx].uSpecEnchantmentType==24) //Increased Knockback. return 5; } } @@ -4026,7 +3842,7 @@ { if ( v32 <= 11 ) { - v33 = v6->pInventoryItems[v31].uItemID; + v33 = v6->pInventoryItemList[v31].uItemID; v5 += pItemsTable->pItems[v33].uDamageDice + pItemsTable->pItems[v33].uDamageMod; } } @@ -5326,7 +5142,7 @@ { if ( v2->HasItemEquipped(v71) ) { - v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItems[*(_DWORD *)v9].uItemID].uEquipType; + v11 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[v2->pInventoryItemList[*(_DWORD *)v9].uItemID].uEquipType; LOBYTE(v12) = this->GetActualSkillLevel(v11); a1 = v12; SkillToMastery(v12); @@ -5384,7 +5200,7 @@ { if ( v2->HasItemEquipped(v20) ) { - v22 = this->pInventoryItems[this->pEquipment.pIndices[v20]].uItemID; + v22 = this->pInventoryItemList[this->pEquipment.pIndices[v20]].uItemID; if ( pItemsTable->pItems[v22].uEquipType <= 1u ) break; } @@ -6756,7 +6572,7 @@ v23 = pParty->pPlayers;//[0].pInventoryItems; do { - v24 = v23->pInventoryItems; + v24 = v23->pInventoryItemList; v25 = 138; do { @@ -6845,7 +6661,7 @@ return v4 >= pValue; } while ( !v3->HasItemEquipped(v26) - || *(int *)&v3->pInventoryItems[*(int *)v27-1] != pValue ) + || *(int *)&v3->pInventoryItemList[*(int *)v27-1] != pValue ) { v26 = (ITEM_EQUIP_TYPE)((int)v26 + 1); v27 += 4; @@ -6942,7 +6758,7 @@ return false; case VAR_PlayerItemInHands: v15 = 0; - v16 = v3->pInventoryItems; + v16 = v3->pInventoryItemList; break; case VAR_FixedGold: v4 = pParty->uNumGold; @@ -7327,7 +7143,7 @@ v9 = NULL; for (int i = 0; i < 138; i++) { - v9 = &this->pInventoryItems[i]; + v9 = &this->pInventoryItemList[i]; if (v9->uItemID == ITEM_LICH_JAR_EMPTY) break; } @@ -8472,7 +8288,7 @@ pPlayers[v4 + 1]->PlaySound(SPEECH_96, 0); return true; case VAR_PlayerItemInHands: - v15 = this->pInventoryIndices; + v15 = this->pInventoryMatrix; break; case VAR_FixedGold: if ( (unsigned int)pValue > pParty->uNumGold ) @@ -8833,7 +8649,7 @@ } for (v3 = 1; v3 < 126; v3++) { - if ( *(&this->pInventoryItems[pInventoryIndices[v3] - 1].uItemID) == pValue ) + if ( *(&this->pInventoryItemList[pInventoryMatrix[v3] - 1].uItemID) == pValue ) { RemoveItemAtInventoryIndex(v3); return true; @@ -8887,11 +8703,11 @@ } else { - v7 = v3->FindFreeInventorySlot(); + v7 = v3->FindFreeInventoryListSlot(); if (v7 >= 0) { pParty->pPickedItem.uBodyAnchor = v2 + 1; - memcpy(&v3->pInventoryItems[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItems[v7])); + memcpy(&v3->pInventoryItemList[v7], &pParty->pPickedItem, sizeof(v3->pInventoryItemList[v7])); *v11 = v7 + 1; pMouse->RemoveHoldingItem(); } @@ -8993,9 +8809,9 @@ { for ( uint i = 0; i < 126; ++i ) { - if ( pPlayer->pInventoryIndices[i] > 0 ) - { - if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pInventoryIndices[i] - 1].uItemID == uItemID ) + if ( pPlayer->pInventoryMatrix[i] > 0 ) + { + if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pInventoryMatrix[i] - 1].uItemID == uItemID ) return true; } } @@ -9003,7 +8819,7 @@ { if ( pPlayer->pEquipment.pIndices[i] ) { - if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) + if ( (unsigned int)pPlayer->pInventoryItemList[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) return true; } } @@ -9421,7 +9237,7 @@ if ( v45->HasEnchantedItemEquipped(69) ) v77 >>= 1; if ( v45->HasItemEquipped(EQUIP_ARMOUR) - && *(_DWORD *)&v45->pInventoryItems[v45->pEquipment.uArmor-1] == 504 ) + && *(_DWORD *)&v45->pInventoryItemList[v45->pEquipment.uArmor-1] == 504 ) v77 >>= 1; v75 = 0; v47 = (int)&v45->pEquipment; @@ -9644,7 +9460,7 @@ *((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]; + ptr_50C9A4 = (ItemGen *)&v0->pInventoryItemList[v6-1]; unk_50C9A0 = 0; if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; @@ -9663,7 +9479,7 @@ { if ( !v8 ) return; - memcpy(&pParty->pPickedItem, &v0->pInventoryItems[v8-1], sizeof(pParty->pPickedItem)); + memcpy(&pParty->pPickedItem, &v0->pInventoryItemList[v8-1], sizeof(pParty->pPickedItem)); v0->RemoveItemAtInventoryIndex(a4); v9 = pParty->pPickedItem.uItemID; pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); @@ -9672,7 +9488,7 @@ v13 = v8; if ( v8 ) { - a2.y = (LONG)&v0->pInventoryItems[v8-1]; + a2.y = (LONG)&v0->pInventoryItemList[v8-1]; memcpy(&this_, (const void *)a2.y, sizeof(this_)); v0->RemoveItemAtInventoryIndex(a4); pX = v0->AddItem2(a4, &pParty->pPickedItem); @@ -9681,7 +9497,7 @@ pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); if ( !pX ) { - v0->PutItemArInventoryIndex(&this_, v13 - 1, a4); + v0->PutItemArInventoryIndex(this_.uItemID, v13 - 1, a4); memcpy((void *)a2.y, &this_, sizeof(ItemGen)); return; } @@ -9695,7 +9511,7 @@ pX = v10; if ( v10 || (v10 = v0->AddItem(-1, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) { - memcpy(&v0->pInventoryItems[v10-1], &pParty->pPickedItem, 0x24u); + memcpy(&v0->pInventoryItemList[v10-1], &pParty->pPickedItem, 0x24u); pMouse->RemoveHoldingItem(); } }
--- a/Player.h Tue Jul 16 14:26:13 2013 +0600 +++ b/Player.h Wed Jul 17 00:40:15 2013 +0200 @@ -540,14 +540,14 @@ int GetDisarmTrap(); char GetLearningPercent(); bool CanFitItem(unsigned int uSlot, unsigned int uItemID); - int FindFreeInventorySlot(); + int FindFreeInventoryListSlot(); int CreateItemInInventory(unsigned int uSlot, unsigned int uItemID); int HasSkill(unsigned int uSkillType); - int WearItem(unsigned int uItemID); + void WearItem(unsigned int uItemID); int AddItem(int uSlot, unsigned int uItemID); int AddItem2(int uSlot, ItemGen *Src); - int CreateItemInInventory2(unsigned int uSlot, ItemGen *Src); - int PutItemArInventoryIndex(ItemGen *item, int item_id, int uSlot); + int CreateItemInInventory2(unsigned int index, ItemGen *Src); + void PutItemArInventoryIndex(int uItemID, int itemListPos, int uSlot); void RemoveItemAtInventoryIndex(unsigned int uSlot); bool CanAct(); bool CanSteal(); @@ -710,13 +710,13 @@ { struct { - ItemGen pInventoryItems[126]; + ItemGen pInventoryItemList[126]; ItemGen pEquippedItems[12]; }; ItemGen pOwnItems[138]; }; - int pInventoryIndices[126]; + int pInventoryMatrix[126]; __int16 sResFireBase; __int16 sResAirBase; __int16 sResWaterBase;
--- a/SaveLoad.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/SaveLoad.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -185,7 +185,7 @@ uint uEquipIdx = pParty->pPlayers[i].pEquipment.pIndices[j]; if (uEquipIdx) { - auto uItemID = pParty->pPlayers[i].pInventoryItems[uEquipIdx - 1].uItemID; + auto uItemID = pParty->pPlayers[i].pInventoryItemList[uEquipIdx - 1].uItemID; if (pItemsTable->pItems[uItemID].uEquipType == 12) { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5
--- a/UI/UICharacter.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/UI/UICharacter.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -928,14 +928,14 @@ if ( !bRingsShownInCharScreen ) pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor); v6 = player->pEquipment.uMainHand; - if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[v6-1], pItemsTable->pItems[v7].uEquipType != 1) + if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItemList[v6-1], pItemsTable->pItems[v7].uEquipType != 1) && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlads[uPlayerID - 1])); pMainHandNum4 = pPlayers[uPlayerID]->pEquipment.uMainHand; if ( pMainHandNum4 ) { - item_MainHand4 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum4 - 1]; + item_MainHand4 = &pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum4 - 1]; pX_MainHand4 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipX; pY_MainHand4 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipY; if ( item_MainHand4->uItemID == 64 ) //blaster @@ -987,7 +987,7 @@ pBowNum = pPlayers[uPlayerID]->pEquipment.uBow; //сначала рисуется лук if ( pBowNum ) { - itemBow = &pPlayers[uPlayerID]->pInventoryItems[pBowNum - 1]; + itemBow = &pPlayers[uPlayerID]->pInventoryItemList[pBowNum - 1]; pX_Bow = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[itemBow->uItemID].uEquipX; pY_Bow = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[itemBow->uItemID].uEquipY; pBowTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[itemBow->uItemID].pIconName, TEXTURE_16BIT_PALETTE); @@ -1031,7 +1031,7 @@ pCloakNum = pPlayers[uPlayerID]->pEquipment.uCloak;// потом плащ if ( pCloakNum ) { - item_Cloak = &pPlayers[uPlayerID]->pInventoryItems[pCloakNum - 1]; + item_Cloak = &pPlayers[uPlayerID]->pInventoryItemList[pCloakNum - 1]; switch ( item_Cloak->uItemID ) { case ITEM_RELIC_TWILIGHT: @@ -1096,7 +1096,7 @@ pArmorNum = pPlayers[uPlayerID]->pEquipment.uArmor;// потом броня if ( pArmorNum ) { - item_Armor = &pPlayers[uPlayerID]->pInventoryItems[pArmorNum - 1]; + item_Armor = &pPlayers[uPlayerID]->pInventoryItemList[pArmorNum - 1]; switch ( item_Armor->uItemID ) { case 504: @@ -1265,7 +1265,7 @@ pBootNum = pPlayers[uPlayerID]->pEquipment.uBoot;//далее обувь if ( pBootNum ) { - item_Boot = &pPlayers[uPlayerID]->pInventoryItems[pBootNum - 1]; + item_Boot = &pPlayers[uPlayerID]->pInventoryItemList[pBootNum - 1]; switch ( item_Boot->uItemID ) { case 529: @@ -1325,7 +1325,7 @@ } } pMainHandNum = pPlayers[uPlayerID]->pEquipment.uMainHand; - if ( !pMainHandNum || (v70 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[pMainHandNum -1], pItemsTable->pItems[v70].uEquipType != 1) + if ( !pMainHandNum || (v70 = *(int *)&pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum -1], pItemsTable->pItems[v70].uEquipType != 1) && (pItemsTable->pItems[v70].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], @@ -1333,7 +1333,7 @@ pBeltNum = pPlayers[uPlayerID]->pEquipment.uBelt;// далее пояс if ( pBeltNum ) { - item_Belt = &pPlayers[uPlayerID]->pInventoryItems[pBeltNum - 1]; + item_Belt = &pPlayers[uPlayerID]->pInventoryItemList[pBeltNum - 1]; switch ( item_Belt->uItemID ) { case ITEM_RILIC_TITANS_BELT: @@ -1396,7 +1396,7 @@ pMainHandNum2 = pPlayers[uPlayerID]->pEquipment.uMainHand; if ( pMainHandNum2 ) { - v83 = pPlayers[uPlayerID]->pInventoryItems[pMainHandNum2 - 1].uItemID; + v83 = pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum2 - 1].uItemID; if ( pItemsTable->pItems[v83].uEquipType == 1 || pItemsTable->pItems[v83].uSkillType == PLAYER_SKILL_SPEAR && !pPlayers[uPlayerID]->pEquipment.uShield ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], @@ -1406,7 +1406,7 @@ pCloakCollarNum = pPlayers[uPlayerID]->pEquipment.uCloak;//далее воротник плаща if ( pCloakCollarNum ) { - item_CloakCollar = &pPlayers[uPlayerID]->pInventoryItems[pCloakCollarNum - 1]; + item_CloakCollar = &pPlayers[uPlayerID]->pInventoryItemList[pCloakCollarNum - 1]; switch ( item_CloakCollar->uItemID ) { case 525: @@ -1480,7 +1480,7 @@ pHelmNum = pPlayers[uPlayerID]->pEquipment.uHelm;//далее шлем if ( pHelmNum ) { - item_Helm = &pPlayers[uPlayerID]->pInventoryItems[pHelmNum-1]; + item_Helm = &pPlayers[uPlayerID]->pInventoryItemList[pHelmNum-1]; switch ( item_Helm->uItemID ) { case 521: @@ -1551,7 +1551,7 @@ pMainHandNum3 = pPlayers[uPlayerID]->pEquipment.uMainHand;//weapon in right hand if ( pMainHandNum3 ) { - item_MainHand3 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum3 - 1]; + item_MainHand3 = &pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum3 - 1]; pX_MainHand3 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipX; pY_MainHand3 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipY; if ( item_MainHand3->uItemID == 64 ) @@ -1600,7 +1600,7 @@ pShieldNum = pPlayers[uPlayerID]->pEquipment.uShield;// далее щит if ( pShieldNum ) { - item_Shield = &pPlayers[uPlayerID]->pInventoryItems[pShieldNum - 1]; + item_Shield = &pPlayers[uPlayerID]->pInventoryItemList[pShieldNum - 1]; v149 = pItemsTable->pItems[item_Shield->uItemID].uSkillType; if ( v149 == 2 || v149 == 1 ) { @@ -1677,7 +1677,7 @@ pMainHandNum5 = pPlayers[uPlayerID]->pEquipment.uMainHand; if ( pMainHandNum5 ) { - item_MainHand5 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum5 - 1]; + item_MainHand5 = &pPlayers[uPlayerID]->pInventoryItemList[pMainHandNum5 - 1]; if ( pItemsTable->pItems[item_MainHand5->uItemID].uEquipType == 1 || pItemsTable->pItems[item_MainHand5->uItemID].uSkillType == PLAYER_SKILL_SPEAR && !pPlayers[uPlayerID]->pEquipment.uShield ) @@ -1716,13 +1716,13 @@ int i = 0; for (uint i = 0; i < 126; ++i) { - int v26 = (int)(player->pInventoryIndices + i); + int v26 = (int)(player->pInventoryMatrix + i); - if (player->pInventoryIndices[i] <= 0) + if (player->pInventoryMatrix[i] <= 0) continue; - int item_idx = player->pInventoryIndices[i]; - auto item = &player->pInventoryItems[item_idx - 1]; + int item_idx = player->pInventoryMatrix[i]; + auto item = &player->pInventoryItemList[item_idx - 1]; if (!item->uItemID) continue; @@ -1845,7 +1845,7 @@ CharacterUI_DrawItem(pPaperdollRingsX[i], pPaperdollRingsY[i], - &player->pInventoryItems[player->pEquipment.uRings[i] - 1], + &player->pInventoryItemList[player->pEquipment.uRings[i] - 1], player->pEquipment.uRings[i]); } @@ -1853,14 +1853,14 @@ if (player->pEquipment.uAmulet) { CharacterUI_DrawItem(493, 91, - &player->pInventoryItems[player->pEquipment.uAmulet - 1], + &player->pInventoryItemList[player->pEquipment.uAmulet - 1], player->pEquipment.uAmulet); } if (player->pEquipment.uGlove) { CharacterUI_DrawItem(586, 88, - &player->pInventoryItems[player->pEquipment.uGlove - 1], + &player->pInventoryItemList[player->pEquipment.uGlove - 1], player->pEquipment.uGlove); } } @@ -2688,7 +2688,7 @@ v2 = pPlayers[uActiveCharacter]->pEquipment.uShield; //v54 = pPlayers[uActiveCharacter]->pEquipment.uShield; //v53 = v1; - if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1 - 1]].uEquipType == 1 ) + if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1]].uEquipType == 1 ) v51 = v1; v3 = pParty->pPickedItem.uItemID; if ( pParty->pPickedItem.uItemID ) @@ -2712,7 +2712,7 @@ { if ( (pSkillType == 8 || pSkillType == 1 || pSkillType == 2) && v1 - && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItems[v1-1]].uSkillType == 4 ) + && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1-1]].uSkillType == 4 ) { LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); if ( (signed int)SkillToMastery(v5) < 3 ) @@ -2771,12 +2771,12 @@ { if ( !*(int *)v7 ) { - v8 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); + v8 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v8 >= 0 ) { v9 = v52; pParty->pPickedItem.uBodyAnchor = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v8])); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v8], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v8])); *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v9) = v8 + 1; pMouse->RemoveHoldingItem(); break; @@ -2830,14 +2830,14 @@ } else { - v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); + v52 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v52 < 0 ) return; if ( !v51 ) { pParty->pPickedItem.uBodyAnchor = 1; v17 = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52])); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); pPlayers[uActiveCharacter]->pEquipment.uShield = v17; pMouse->RemoveHoldingItem(); return; @@ -2849,7 +2849,7 @@ pParty->SetHoldingItem((ItemGen *)(v15 + 532)); _this.uBodyAnchor = 1; v16 = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52])); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); pPlayers[uActiveCharacter]->pEquipment.uShield = v16; } pPlayers[uActiveCharacter]->pEquipment.uMainHand = 0; @@ -2905,12 +2905,12 @@ } break; } - v23 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); + v23 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v23 < 0 ) return; pParty->pPickedItem.uBodyAnchor = 1; - v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v23]; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v23])); + v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItemList[v23]; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v23], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v23])); pPlayers[uActiveCharacter]->pEquipment.uShield = v23 + 1; pMouse->RemoveHoldingItem(); if ( v52 != 12 ) @@ -2928,12 +2928,12 @@ } if ( !v1 ) { - v26 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); + v26 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v26 < 0 ) return; pParty->pPickedItem.uBodyAnchor = 2; - v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItems[v26]; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v26])); + v50 = (unsigned int)&pPlayers[uActiveCharacter]->pInventoryItemList[v26]; + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v26], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v26])); pPlayers[uActiveCharacter]->pEquipment.uMainHand = v26 + 1; pMouse->RemoveHoldingItem(); if ( v52 != 12 ) @@ -2999,7 +2999,7 @@ } else { - v52 = pPlayers[uActiveCharacter]->FindFreeInventorySlot(); + v52 = pPlayers[uActiveCharacter]->FindFreeInventoryListSlot(); if ( v52 >= 0 ) { if ( v2 ) @@ -3011,7 +3011,7 @@ pParty->SetHoldingItem((ItemGen *)(v29 + 532)); _this.uBodyAnchor = 2; v30 = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52])); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &_this, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); pPlayers[uActiveCharacter]->pEquipment.uShield = 0; pPlayers[uActiveCharacter]->pEquipment.uMainHand = v30; } @@ -3019,7 +3019,7 @@ { pParty->pPickedItem.uBodyAnchor = 2; v31 = v52 + 1; - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItems[v52])); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v52], &pParty->pPickedItem, sizeof(pPlayers[uActiveCharacter]->pInventoryItemList[v52])); pPlayers[uActiveCharacter]->pEquipment.uMainHand = v31; pMouse->RemoveHoldingItem(); } @@ -3085,7 +3085,7 @@ v35 = pPlayers[uActiveCharacter]->pEquipment.uBow; if ( v35 ) { - auto _a = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v35 - 1]; + auto _a = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v35 - 1]; pParty->SetHoldingItem(_a); _a->Reset(); pPlayers[uActiveCharacter]->pEquipment.uBow = 0;
--- a/UI/UIShops.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/UI/UIShops.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -266,7 +266,7 @@ pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) return; - v79 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v79 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; v13 = pPlayer->SelectPhrasesTransaction(v79, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 3); v7 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0); pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0); @@ -285,7 +285,7 @@ pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) ) return; - v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v4 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; if (!v4->Identified()) { v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_WeaponShop, (int)window_SpeakInHouse->ptr_1C, 4); @@ -314,7 +314,7 @@ || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), !pNumActiveItem) || (!(pPlayer->pOwnItems[pNumActiveItem-1].uAttributes& 2)) ) return; - v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v4 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; v10 = pPlayer->SelectPhrasesTransaction(v4, BildingType_ArmorShop, (int)window_SpeakInHouse->ptr_1C, 5); v7 = BuilDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0); pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138; @@ -892,7 +892,7 @@ pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) ) return; - v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v10 - 1]; + v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v10 - 1]; v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BildingType_ArmorShop, window_SpeakInHouse->par1C, 3); v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->SelectPhrasesTransaction(v116, BildingType_ArmorShop, window_SpeakInHouse->par1C, 3)]; v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); @@ -917,7 +917,7 @@ v2 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount); if ( v2 ) { - v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v2-1]; + v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v2-1]; if (v3->Identified()) v5 = "%24"; else @@ -949,8 +949,8 @@ || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32) || (!(pPlayers[uActiveCharacter]->pOwnItems[v32-1].uAttributes& 2)) ) return; - v116 = &pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1]; - v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[v32 - 1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 5); + v116 = &pPlayers[uActiveCharacter]->pInventoryItemList[v33 - 1]; + v35 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[v32 - 1], BildingType_ArmorShop, window_SpeakInHouse->par1C, 5); v15 = (char *)pMerchantsRepairPhrases[v35]; v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; @@ -1386,7 +1386,7 @@ pMouse->GetCursorPos(&v102)->x <= 13) || pMouse->GetCursorPos(&v100)->x >= 462 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) return; - v87 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v87 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; v45 = pPlayer->SelectPhrasesTransaction(v87, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 3); v21 = BuilDialogueString((char *)pMerchantsSellPhrases[v45], uActiveCharacter - 1, v87, (char *)window_SpeakInHouse->ptr_1C, 3, 0); pTextHeight = pFontArrus->CalcTextHeight(v21, &dialog_window, 0, 0); @@ -1404,7 +1404,7 @@ pMouse->GetCursorPos(&v101)->x <= 13) || pMouse->GetCursorPos(&v97)->x >= 462 || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v109), !pNumActiveItem) ) return; - v37 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v37 = (ItemGen *)&pPlayer->pInventoryItemList[pNumActiveItem - 1]; if (!v37->Identified()) { v42 = pPlayer->SelectPhrasesTransaction(v37, BildingType_AlchemistShop, (int)window_SpeakInHouse->ptr_1C, 4); @@ -2137,7 +2137,7 @@ || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) return; - item = &pPlayers[uActiveCharacter]->pInventoryItems[result - 1]; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; v13 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(item, BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 3); v30 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 3, 0); v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; @@ -2162,7 +2162,7 @@ result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117); if ( result ) { - item = &pPlayers[uActiveCharacter]->pInventoryItems[result-1]; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[result-1]; if ( item->uAttributes & 1 ) { v5 = BuilDialogueString("%24", uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 4, 0); @@ -2196,8 +2196,8 @@ // || (result *= 9, !(pPlayers[uActiveCharacter]->field_1F5[4 * result + 15] & 2)) ) || (!(pPlayers[uActiveCharacter]->pOwnItems[result-1].uAttributes& 2)) ) return; - item = &pPlayers[uActiveCharacter]->pInventoryItems[result - 1]; - v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItems[result - 1], BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); + item = &pPlayers[uActiveCharacter]->pInventoryItemList[result - 1]; + v29 = pPlayers[uActiveCharacter]->SelectPhrasesTransaction(&pPlayers[uActiveCharacter]->pInventoryItemList[result - 1], BildingType_MagicShop, (int)window_SpeakInHouse->ptr_1C, 5); v30 = BuilDialogueString((char *)pMerchantsRepairPhrases[v29], uActiveCharacter - 1, item, (char *)window_SpeakInHouse->ptr_1C, 5, 0); v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; dialog_window.DrawTitleText(pFontArrus, v3, v6, pWhiteColor, v30, 3); @@ -2352,7 +2352,7 @@ if ( taken_item ) { bought_item->SetIdentified(); - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[taken_item - 1], bought_item, 0x24u); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[taken_item - 1], bought_item, 0x24u); dword_F8B1E4 = 1; Party::TakeGold(uPriceItemService); viewparams->bRedrawGameUI = 1; @@ -2372,7 +2372,7 @@ || pMouse->GetCursorPos(&cursor)->x >= 462 || (v15 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79), !v15) ) return; - if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItems[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) + if ( MerchandiseTest(&pPlayers[uActiveCharacter]->pInventoryItemList[v15 - 1], (int)window_SpeakInHouse->ptr_1C) ) { dword_F8B1E4 = 1; pPlayers[uActiveCharacter]->SalesProcess(v79, v15 - 1, (int)window_SpeakInHouse->ptr_1C); @@ -2395,7 +2395,7 @@ if ( pItemID ) { uPriceItemService = pPlayers[uActiveCharacter]->GetPriceIdentification(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier); - item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; if ( !(item->uAttributes & 1) ) { if ( MerchandiseTest(item, (int)window_SpeakInHouse->ptr_1C) ) @@ -2432,9 +2432,9 @@ pItemID = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v79); if ( pItemID ) { - item = &pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; + item = &pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; pPriceMultiplier = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[pItemID - 1]; + auto _v = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[pItemID - 1]; uPriceItemService = pPlayers[uActiveCharacter]->GetPriceRepair(_v->GetValue(), pPriceMultiplier); if ( item->uAttributes & 2 ) { @@ -2510,14 +2510,14 @@ if ( v39 ) { bought_item->SetIdentified(); - memcpy(&pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1], bought_item, sizeof(ItemGen)); + memcpy(&pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1], bought_item, sizeof(ItemGen)); if ( pPlayers[uActiveCharacter]->CanSteal() ) { if ( GetAsyncKeyState(VK_CONTROL) ) { if ( uNumSeconds == 1 || uNumSeconds == 2 ) { - pPlayers[uActiveCharacter]->pInventoryItems[v39 - 1].SetStolen(); + pPlayers[uActiveCharacter]->pInventoryItemList[v39 - 1].SetStolen(); sub_4B1447_party_fine((int)window_SpeakInHouse->ptr_1C, uNumSeconds, a6); viewparams->bRedrawGameUI = 1; bought_item->Reset(); @@ -2614,7 +2614,7 @@ || pMouse->GetCursorPos(&v12)->x >= 462 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v5)) == 0 ) return; - GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItems[v9 - 1]); + GameUI_DrawItemInfo(&pPlayers[uActiveCharacter]->pInventoryItemList[v9 - 1]); return; } if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_SPECIAL )
--- a/UI/UiGame.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/UI/UiGame.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -60,7 +60,7 @@ //v3 = player; if (auto slot = player->AddItem(-1, pParty->pPickedItem.uItemID)) { - memcpy(&player->pInventoryItems[slot-1], &pParty->pPickedItem, 0x24u); + memcpy(&player->pInventoryItemList[slot-1], &pParty->pPickedItem, 0x24u); viewparams->bRedrawGameUI = true; pMouse->RemoveHoldingItem(); return; @@ -1969,7 +1969,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v14-1]; + pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItemList[v14-1]; //goto LABEL_49; v17 = pItemGen->GetDisplayName(); GameUI_SetFooterString(v17);
--- a/mm7_4.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/mm7_4.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -1302,7 +1302,7 @@ { //v23 = v21->pEquipment.pIndices; auto _idx = v21->pEquipment.pIndices[v22]; - v24 = v21->pInventoryItems[_idx].uItemID; + v24 = v21->pInventoryItemList[_idx].uItemID; if ( v24 > 134 ) { if ( v24 == 529 ) @@ -1321,7 +1321,7 @@ } else { - v25 = v21->pInventoryItems[_idx].uSpecEnchantmentType; + v25 = v21->pInventoryItemList[_idx].uSpecEnchantmentType; if ( v25 <= 50 ) { if ( v25 != 50 ) @@ -1369,7 +1369,7 @@ if ( v48 ) { v31 = 0; - v32 = (char *)v21->pInventoryItems; + v32 = (char *)v21->pInventoryItemList; while ( *(int *)v32 != 601 || (unsigned __int8)v32[26] != v49 + 1 ) { ++v31; @@ -5234,7 +5234,7 @@ v6 = pParty->pPlayers;//[0].pInventoryItems[0].field_1A; do { - v7 = v6->pInventoryItems; + v7 = v6->pInventoryItemList; v8 = 138; do {
--- a/mm7_5.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/mm7_5.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -5617,7 +5617,7 @@ if ( pParty->pPickedItem.uItemID == ITEM_POTION_BOTTLE ) { LABEL_116: - GameUI_DrawItemInfo(&v0->pInventoryItems[v10]); + GameUI_DrawItemInfo(&v0->pInventoryItemList[v10]); return; } if ( (signed int)pParty->pPickedItem.uItemID < 200 @@ -5634,7 +5634,7 @@ && pParty->pPickedItem.uItemID != 263 && pParty->pPickedItem.uItemID != 233 ) goto LABEL_116; - v27 = &v0->pInventoryItems[pOut.z]; + v27 = &v0->pInventoryItemList[pOut.z]; v28 = v27->uItemID; v51 = pItemsTable->pItems[v27->uItemID].uEquipType; v29 = (ItemGen *)(1800 * pParty->pPickedItem.uEnchantmentType); @@ -5774,7 +5774,7 @@ LABEL_54: pOut.y = 0; pOut.x = v10 + 1; - v17 = (int)v0->pInventoryIndices; + v17 = (int)v0->pInventoryMatrix; while ( *(int *)v17 != pOut.x ) { ++pOut.y; @@ -5836,9 +5836,9 @@ // *(int *)&v0->field_1F5[36 * v19 + 15] = 1; v0->pOwnItems[v19-1].uAttributes=ITEM_IDENTIFIED; v20 = v47 + 50 * v15; - v0->pInventoryItems[pOut.z].uItemID = v51; - v0->pInventoryItems[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType - + v0->pInventoryItems[pOut.z].uEnchantmentType) + v0->pInventoryItemList[pOut.z].uItemID = v51; + v0->pInventoryItemList[pOut.z].uEnchantmentType = (pParty->pPickedItem.uEnchantmentType + + v0->pInventoryItemList[pOut.z].uEnchantmentType) / 2; v0->SetVariable(VAR_AutoNotes, *(short *)&pItemsTable->potion_note[2 * v20 ]);//field_10168 + 388 LABEL_74: @@ -5903,28 +5903,28 @@ case 0xCAu: case 0xCBu: case 0xCCu: - v0->pInventoryItems[pOut.z].uItemID = 222; + v0->pInventoryItemList[pOut.z].uItemID = 222; break; case 0xCDu: case 0xCEu: case 0xCFu: case 0xD0u: case 0xD1u: - v0->pInventoryItems[pOut.z].uItemID = 223; + v0->pInventoryItemList[pOut.z].uItemID = 223; break; case 0xD2u: case 0xD3u: case 0xD4u: case 0xD5u: case 0xD6u: - v0->pInventoryItems[pOut.z].uItemID = 224; + v0->pInventoryItemList[pOut.z].uItemID = 224; break; case 0xD7u: case 0xD8u: case 0xD9u: case 0xDAu: case 0xDBu: - v0->pInventoryItems[pOut.z].uItemID = 221; + v0->pInventoryItemList[pOut.z].uItemID = 221; break; default: break;
--- a/mm7_6.cpp Tue Jul 16 14:26:13 2013 +0600 +++ b/mm7_6.cpp Wed Jul 17 00:40:15 2013 +0200 @@ -2073,7 +2073,7 @@ //v31 = player->pEquipment.uBow; int bow_idx = player->pEquipment.uBow; - if (bow_idx && player->pInventoryItems[bow_idx - 1].Broken()) + if (bow_idx && player->pInventoryItemList[bow_idx - 1].Broken()) bow_idx = 0; //v32 = 0; @@ -2085,7 +2085,7 @@ int main_hand_idx = player->pEquipment.uMainHand; if (main_hand_idx) { - auto item = &player->pInventoryItems[main_hand_idx - 1]; + auto item = &player->pInventoryItemList[main_hand_idx - 1]; //v5 = (char *)v1 + 36 * v4; if (!item->Broken()) { @@ -2144,9 +2144,9 @@ shooting_wand = true; int main_hand_idx = player->pEquipment.uMainHand; - _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItems[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); + _42777D_CastSpell_UseWand_ShootArrow(wand_spell_ids[player->pInventoryItemList[main_hand_idx - 1].uItemID - ITEM_WAND_FIRE], uActiveCharacter - 1, 8, 0, uActiveCharacter + 8); - if (!--player->pInventoryItems[main_hand_idx - 1].uNumCharges) + if (!--player->pInventoryItemList[main_hand_idx - 1].uNumCharges) player->pEquipment.uMainHand = 0; } else if (target_type == OBJECT_Actor && actor_distance <= 407.2) @@ -2201,7 +2201,7 @@ { int main_hand_idx = player->pEquipment.uMainHand; if (player->HasItemEquipped(EQUIP_MAIN_HAND)) - v34 = pItemsTable->pItems[*(int *)&player->pInventoryItems[main_hand_idx - 1]].uSkillType; + v34 = pItemsTable->pItems[*(int *)&player->pInventoryItemList[main_hand_idx - 1]].uSkillType; pTurnEngine->_40471C(); }