Mercurial > mm7
changeset 1709:8251e59fd7c1
ITEM_ENCHANTED to ITEM_HARDENED, created helper functions to get params from itemtable for ItemGens
author | Grumpy7 |
---|---|
date | Tue, 24 Sep 2013 07:29:55 +0200 |
parents | f8414042db1f |
children | 0f6cd60ca987 |
files | Actor.cpp CastSpellInfo.cpp Chest.cpp GUIWindow.cpp Items.cpp Items.h Mouse.cpp Party.cpp Player.cpp UI/UICharacter.cpp UI/UIHouses.cpp UI/UIPopup.cpp Viewport.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp |
diffstat | 16 files changed, 206 insertions(+), 170 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/Actor.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -5020,7 +5020,7 @@ v59 = 1; if ( player->HasItemEquipped(EQUIP_MAIN_HAND) ) { - auto main_hand_skill = pItemsTable->pItems[player->pInventoryItemList[main_hand_idx - 1].uItemID].uSkillType; + auto main_hand_skill = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType(); //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]);
--- a/CastSpellInfo.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/CastSpellInfo.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -1884,7 +1884,7 @@ break; v240 = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItemList[a2]; - if ( pItemsTable->pItems[v240->uItemID].uEquipType != 12 || v240->uAttributes & 2 ) + if ( v240->GetItemEquipType() != 12 || v240->uAttributes & 2 ) { _50C9D0_AfterEnchClickEventId = 113; _50C9D4_AfterEnchClickEventSecondParam = 0; @@ -1972,9 +1972,9 @@ v295 = rand() % 10;// pItemsTable->field_116D8[pItemsTable->pItems[_this->uItemID].uEquipType]; v245->uEnchantmentType = 0; __debugbreak(); // castspellinfo.cpp(1971): warning C4700: uninitialized local variable 'v294' used - for ( kk = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1]; + for ( kk = pItemsTable->pEnchantments[0].to_item[v245->GetItemEquipType() + 1]; ; - kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[pItemsTable->pItems[v245->uItemID].uEquipType + 1] ) + kk += pItemsTable->pEnchantments[v294->uEnchantmentType].to_item[v245->GetItemEquipType() + 1] ) { ++v245->uEnchantmentType; if ( kk >= v295 ) @@ -2002,7 +2002,7 @@ v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); if ( !v259 || v259 == 1 ) { - v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[v245->GetItemEquipType() + 4] + v258 * 28); LODWORD(v725) += v260; @@ -2021,7 +2021,7 @@ v262 = rand() % SLODWORD(v725); v263 = v679; v245->uSpecEnchantmentType = v679[0]; - v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; + v264 = pItemsTable->pSpecialEnchantments[*v263].to_item_apply[v245->GetItemEquipType() + 4]; v265 = v262 + 1; if ( v264 < v265 ) { @@ -2031,7 +2031,7 @@ v732 = v267; v268 = *(int *)v267; *(int *)(v245 + 12) = v268; - v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[v245->GetItemEquipType() + 4]; if ( v264 >= v265 ) break; @@ -2050,7 +2050,7 @@ v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278].pBonusStatement); if ( !v279 || v279 == 1 ) { - v280 = *(&pItemsTable->pSpecialEnchantments[v278].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType]); + v280 = *(&pItemsTable->pSpecialEnchantments[v278].to_item_apply[v245->GetItemEquipType()]); _v733 += v280; if ( v280 ) { @@ -2067,12 +2067,12 @@ v282 = rand() % _v733; v283 = v679; v245->uSpecEnchantmentType = v679[0]; - v284 = pItemsTable->pSpecialEnchantments[*v283].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType ]; + v284 = pItemsTable->pSpecialEnchantments[*v283].to_item_apply[v245->GetItemEquipType() ]; v285 = v282 + 1; for ( l = v679; v284 < v285; ++l ) { v245->uSpecEnchantmentType = *(l+1); - v284 += pItemsTable->pSpecialEnchantments[*(l+1)].to_item_apply[pItemsTable->pItems[v245->uItemID].uEquipType]; + v284 += pItemsTable->pSpecialEnchantments[*(l+1)].to_item_apply[v245->GetItemEquipType()]; } ++v245->uSpecEnchantmentType; v245->uAttributes |= 0x20u; @@ -2676,7 +2676,7 @@ { v420 = 0; v421 = _v730->array_000234; - while ( !v421->uItemID || pItemsTable->pItems[v421->uItemID].uEquipType == 18 ) + while ( !v421->uItemID || v421->GetItemEquipType() == 18 ) { ++v420; ++v421;
--- a/Chest.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/Chest.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -265,7 +265,7 @@ { item_texture_id = pIcons_LOD->LoadTexture( //pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName, - pItemsTable->pItems[pChests[uChestID].igChestItems[chest_item_index - 1].uItemID].pIconName, TEXTURE_16BIT_PALETTE); + pChests[uChestID].igChestItems[chest_item_index - 1].GetIconName(), TEXTURE_16BIT_PALETTE); item_texture = pIcons_LOD->GetTexture(item_texture_id); itemPixelWidth = item_texture->uTextureWidth; itemPixelHeght = item_texture->uTextureHeight; @@ -430,7 +430,7 @@ pPlayers[uActiveCharacter]->PlaySound(SPEECH_NoRoom, 0); return 0; } - v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + v7 = pIcons_LOD->LoadTexture(v4->GetIconName(), TEXTURE_16BIT_PALETTE); HIWORD(v8) = 0; v9 = pIcons_LOD->GetTexture(v7); v10 = v9->uTextureWidth; @@ -751,7 +751,7 @@ v3 = &pChests[v20].igChestItems[a1]; //v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)]; v17 = pChestWidthsByType[pChests[v20].uChestBitmapID]; - v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v3->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + v4 = pIcons_LOD->LoadTexture(v3->GetIconName(), TEXTURE_16BIT_PALETTE); v5 = pIcons_LOD->GetTexture(v4); v6 = v5->uTextureWidth; if ( v6 < 14 ) @@ -833,7 +833,7 @@ else v3 = -1; v4 = pChests[chest_id].pInventoryIndices[v3] - 1; - if ( pItemsTable->pItems[pChests[chest_id].igChestItems[v4].uItemID].uEquipType == EQUIP_GOLD ) + if ( pChests[chest_id].igChestItems[v4].GetItemEquipType() == EQUIP_GOLD ) { party_finds_gold(pChests[chest_id].igChestItems[v4].uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1;
--- a/GUIWindow.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/GUIWindow.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -2026,7 +2026,7 @@ ItemGen2.uItemID = v26; if ( pItemsTable->pItems[v26].uEquipType == 12 ) { - ItemGen2.uNumCharges = rand() % 6 + pItemsTable->pItems[ItemGen2.uItemID].uDamageMod + 1; + ItemGen2.uNumCharges = rand() % 6 + ItemGen2.GetDamageMod() + 1; ItemGen2.uMaxCharges = LOBYTE(ItemGen2.uNumCharges); } else
--- a/Items.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/Items.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -1479,7 +1479,7 @@ const char *nameModificator; const char *format_str; - equip_type = pItemsTable->pItems[uItemID].uEquipType; + equip_type = GetItemEquipType(); if ( (equip_type == EQUIP_REAGENT) || (equip_type == EQUIP_POTION) || (equip_type == EQUIP_GOLD) ) { sprintf(item__getname_buffer.data(), "%s", pItemsTable->pItems[uItemID].pName); @@ -1699,7 +1699,7 @@ while ( tmp_chance < current_chance ); } - if (pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE ) + if (out_item->GetItemEquipType() == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE ) {// if it potion set potion spec out_item->uEnchantmentType = 0; for (int i=0; i<2; ++i) @@ -1742,7 +1742,7 @@ out_item->uItemID = 1; if ( !out_item->uItemID ) out_item->uItemID = 1; - if (pItems[out_item->uItemID].uEquipType == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE ) + if (out_item->GetItemEquipType() == EQUIP_POTION && out_item->uItemID != ITEM_POTION_BOTTLE ) {// if it potion set potion spec out_item->uEnchantmentType = 0; for (int i=0; i<2; ++i) @@ -1760,13 +1760,13 @@ else out_item->uAttributes = 1; - if ( pItems[out_item->uItemID].uEquipType != EQUIP_POTION ) + if ( out_item->GetItemEquipType() != EQUIP_POTION ) { out_item->uSpecEnchantmentType = 0; out_item->uEnchantmentType = 0; } //try get special enhansment - switch (pItems[out_item->uItemID].uEquipType) + switch (out_item->GetItemEquipType()) { case EQUIP_OFF_HAND: case EQUIP_MAIN_HAND : @@ -1790,15 +1790,15 @@ special_chance = rand() % 100; if ( special_chance < uBonusChanceStandart[v6]) { - v26 = rand() %pEnchantmentsSumm[pItems[out_item->uItemID].uEquipType-3]; + v26 = rand() %pEnchantmentsSumm[out_item->GetItemEquipType()-3]; out_item->uEnchantmentType = 0; - v27=pEnchantments[out_item->uEnchantmentType].to_item[pItems[out_item->uItemID].uEquipType-3]; + v27=pEnchantments[out_item->uEnchantmentType].to_item[out_item->GetItemEquipType()-3]; if (v26>v27 ) { do { ++out_item->uEnchantmentType; - v27+=pEnchantments[out_item->uEnchantmentType].to_item[pItems[out_item->uItemID].uEquipType-3]; + v27+=pEnchantments[out_item->uEnchantmentType].to_item[out_item->GetItemEquipType()-3]; } while (v26>v27); } ++out_item->uEnchantmentType; @@ -1820,7 +1820,7 @@ return; break; case EQUIP_WAND: - out_item->uNumCharges = rand() % 6 + pItemsTable->pItems[out_item->uItemID].uDamageMod + 1; + out_item->uNumCharges = rand() % 6 + out_item->GetDamageMod() + 1; out_item->uMaxCharges = out_item->uNumCharges; default: return; @@ -1838,7 +1838,7 @@ case 2: if ((tr_lv==1)||(tr_lv==0)) { - spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc=pSpecialEnchantments[i].to_item_apply[out_item->GetItemEquipType()]; spc_sum+=spc; if(spc) { @@ -1849,7 +1849,7 @@ case 3: if ((tr_lv==2)||(tr_lv==1)||(tr_lv==0)) { - spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc=pSpecialEnchantments[i].to_item_apply[out_item->GetItemEquipType()]; spc_sum+=spc; if(spc) { @@ -1860,7 +1860,7 @@ case 4: if ((tr_lv==3)||(tr_lv==2)||(tr_lv==1)) { - spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc=pSpecialEnchantments[i].to_item_apply[out_item->GetItemEquipType()]; spc_sum+=spc; if(spc) { @@ -1871,7 +1871,7 @@ case 5: if (tr_lv==3) { - spc=pSpecialEnchantments[i].to_item_apply[pItems[out_item->uItemID].uEquipType]; + spc=pSpecialEnchantments[i].to_item_apply[out_item->GetItemEquipType()]; spc_sum+=spc; if(spc) { @@ -1885,14 +1885,14 @@ v46 = rand()%spc_sum+1; j=0; out_item->uSpecEnchantmentType =val_list[j]; - v45=pSpecialEnchantments[val_list[j]].to_item_apply[pItems[out_item->uItemID].uEquipType]; + v45=pSpecialEnchantments[val_list[j]].to_item_apply[out_item->GetItemEquipType()]; if (v45<v46) { do { ++j; out_item->uSpecEnchantmentType=val_list[j]; - v45+=pSpecialEnchantments[val_list[j]].to_item_apply[pItems[out_item->uItemID].uEquipType]; + v45+=pSpecialEnchantments[val_list[j]].to_item_apply[out_item->GetItemEquipType()]; } while (v45<v46); } ++out_item->uSpecEnchantmentType; @@ -2398,6 +2398,35 @@ return false; } +ITEM_EQUIP_TYPE ItemGen::GetItemEquipType() +{ + return pItemsTable->pItems[this->uItemID].uEquipType; +} + +unsigned char ItemGen::GetPlayerSkillType() +{ + return pItemsTable->pItems[this->uItemID].uSkillType; +} + +char* ItemGen::GetIconName() +{ + return pItemsTable->pItems[this->uItemID].pIconName; +} + +unsigned __int8 ItemGen::GetDamageDice() +{ + return pItemsTable->pItems[this->uItemID].uDamageDice; +} + +unsigned __int8 ItemGen::GetDamageRoll() +{ + return pItemsTable->pItems[this->uItemID].uDamageRoll; +} + +unsigned __int8 ItemGen::GetDamageMod() +{ + return pItemsTable->pItems[this->uItemID].uDamageMod; +} //----- (004B8E3D) -------------------------------------------------------- void GenerateStandartShopItems() {
--- a/Items.h Mon Sep 23 07:07:06 2013 +0200 +++ b/Items.h Tue Sep 24 07:29:55 2013 +0200 @@ -30,7 +30,7 @@ ITEM_AURA_EFFECT_GREEN = 0x40,//64 ITEM_AURA_EFFECT_PURPLE = 0x80,//128 ITEM_STOLEN = 0x100, - ITEM_ENCHANTED = 0x200, + ITEM_HARDENED = 0x200, }; @@ -243,7 +243,12 @@ void Reset(); int _439DF3_get_additional_damage(int *a2, bool *vampiyr); - + ITEM_EQUIP_TYPE GetItemEquipType(); + unsigned char GetPlayerSkillType(); + char* GetIconName(); + unsigned __int8 GetDamageDice(); + unsigned __int8 GetDamageRoll(); + unsigned __int8 GetDamageMod(); int uItemID; //0 int uEnchantmentType; //4
--- a/Mouse.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/Mouse.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -374,7 +374,7 @@ //v1 = this; if ( pParty->pPickedItem.uItemID ) { - pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); + pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); pTexture = (Texture *)(pTextureID != -1 ? (int)&pIcons_LOD->pTextures[pTextureID] : 0); v4 = pMouse->uMouseClickX;
--- a/Party.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/Party.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -1422,7 +1422,7 @@ if ( !pParty->pPickedItem.uItemID ) return 1; v0 = pIcons_LOD->LoadTexture( - pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, + pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); v1 = pIcons_LOD->GetTexture(v0); v11 = areWeLoadingTexture;
--- a/Player.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/Player.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -507,15 +507,15 @@ { for ( i = 0; i < enchant_count; ++i ) { - if (!(pInventoryItemList[item_index_tabl[i]].uAttributes&ITEM_ENCHANTED)) - pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_ENCHANTED; + if (!(pInventoryItemList[item_index_tabl[i]].uAttributes&ITEM_HARDENED)) + pInventoryItemList[item_index_tabl[rand() % avalible_items]].uAttributes |= ITEM_HARDENED; } } else { for ( i = 0; i < avalible_items; ++i ) { - pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_ENCHANTED; + pInventoryItemList[item_index_tabl[i]].uAttributes |= ITEM_HARDENED; } } } @@ -1008,7 +1008,7 @@ unsigned int slot_width; // [sp+14h] [bp+4h]@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_texture = pIcons_LOD->LoadTexturePtr(item_in_slot->GetIconName(), TEXTURE_16BIT_PALETTE); item_in_slot->Reset(); slot_width = GetSizeInInventorySlots(item_texture->uTextureWidth); slot_height = GetSizeInInventorySlots(item_texture->uTextureHeight); @@ -1041,7 +1041,7 @@ merchantLevel = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); idemId = pItem->uItemID; - equipType = pItemsTable->pItems[idemId].uEquipType; + equipType = pItem->GetItemEquipType(); itemValue = pItem->GetValue(); switch (building_type) @@ -1160,10 +1160,10 @@ unsigned __int16 v2; // ax@1 int v5; // edi@7 - ItemDesc* v7 = &pItemsTable->pItems[pItem->uItemID]; - if (CheckHiredNPCSpeciality(Smith) && v7->uEquipType <= 2 || - CheckHiredNPCSpeciality(Armorer) && v7->uEquipType >= 3 && v7->uEquipType <= 9 || - CheckHiredNPCSpeciality(Alchemist) && v7->uEquipType >= 9 ) + ITEM_EQUIP_TYPE equipType = pItem->GetItemEquipType(); + if (CheckHiredNPCSpeciality(Smith) && equipType <= 2 || + CheckHiredNPCSpeciality(Armorer) && equipType >= 3 && equipType <= 9 || + CheckHiredNPCSpeciality(Alchemist) && equipType >= 9 ) return true; v2 = GetActualSkillLevel(PLAYER_SKILL_REPAIR); @@ -1172,7 +1172,7 @@ int multiplier = GetMultiplierForSkillLevel(v2, 1, 2, 3, 5); v5 = multiplier * (v2 & 0x3F); - return v5 >= v7->uItemID_Rep_St; + return v5 >= pItemsTable->pItems[pItem->uItemID].uItemID_Rep_St; } //----- (004911F3) -------------------------------------------------------- @@ -1620,8 +1620,7 @@ if ( this->HasItemEquipped(EQUIP_OFF_HAND) ) { ItemGen *offHandItemGen = (ItemGen *)&this->pInventoryItemList[this->pEquipment.uShield - 1]; - int itemId = offHandItemGen->uItemID; - if ( pItemsTable->pItems[itemId].uEquipType != EQUIP_SHIELD ) + if ( offHandItemGen->GetItemEquipType() != EQUIP_SHIELD ) { offHndWpnDmg = CalculateMeleeDmgToEnemyWithWeapon(offHandItemGen, uTargetActorID, false); } @@ -1957,13 +1956,13 @@ //----- (0048D62C) -------------------------------------------------------- ITEM_EQUIP_TYPE Player::GetEquippedItemEquipType(ITEM_EQUIP_TYPE uEquipSlot) { - return pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uEquipType; + return pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].GetItemEquipType(); } //----- (0048D651) -------------------------------------------------------- PLAYER_SKILL_TYPE Player::GetEquippedItemSkillType(ITEM_EQUIP_TYPE uEquipSlot) { - return (PLAYER_SKILL_TYPE)pItemsTable->pItems[pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].uItemID].uSkillType; + return (PLAYER_SKILL_TYPE)pInventoryItemList[pEquipment.pIndices[uEquipSlot] - 1].GetPlayerSkillType(); } //----- (0048D676) -------------------------------------------------------- @@ -1978,7 +1977,7 @@ { auto i = pEquipment.pIndices[uEquipIndex]; if (i) - return (~(pOwnItems[i - 1].uAttributes & ITEM_BROKEN)) != 0; + return !pOwnItems[i - 1].IsBroken(); else return false; } @@ -2039,7 +2038,7 @@ v7 = v6 & 0x3F; v8 = SkillToMastery(v6); itemvalue = itemToSteal->GetValue(); - v10 = pItemsTable->pItems[itemToSteal->uItemID].uEquipType; + v10 = itemToSteal->GetItemEquipType(); if ( v10 == EQUIP_OFF_HAND || v10 == EQUIP_MAIN_HAND || v10 == EQUIP_BOW ) itemvalue *= 3; currMaxItemValue = StealingRandomBonuses[rand() % 5] + v7 * StealingMasteryBonuses[v8]; @@ -2125,7 +2124,7 @@ { enchBonusSum += rand() % StealingEnchantmentBonusForSkill[stealingMastery] + 1; } - if ( pItemsTable->pItems[actroPtr->array_000234[3].uItemID].uEquipType != EQUIP_GOLD ) + if ( actroPtr->array_000234[3].GetItemEquipType() != EQUIP_GOLD ) return 2; enchTypePtr = &actroPtr->array_000234[3].uSpecEnchantmentType; if ( (int)enchBonusSum >= *enchTypePtr ) @@ -2156,7 +2155,7 @@ int i; for (i = 0; i < 4; i++) { - if ( actroPtr->array_000234[i].uItemID != 0 && pItemsTable->pItems[actroPtr->array_000234[i].uItemID].uEquipType != EQUIP_GOLD ) + if ( actroPtr->array_000234[i].uItemID != 0 && actroPtr->array_000234[i].GetItemEquipType() != EQUIP_GOLD ) break; } if (i == 4) @@ -2181,17 +2180,20 @@ itemToSteal->Reset(); carriedItemId = tempItem.uItemID; } - sub_421B2C_PlaceInInventory_or_DropPickedItem(); - sprintf( - pTmpBuf2.data(), - pGlobalTXT_LocalizationStrings[304], // Official //TODO: add a normal "%d stole %d" message - this->pName, - pItemsTable->pItems[carriedItemId].pUnidentifiedName); - ShowStatusBarString(pTmpBuf2.data(), 2u); - sub_421B2C_PlaceInInventory_or_DropPickedItem(); - memcpy(&pParty->pPickedItem, &tempItem, sizeof(ItemGen)); - pMouse->SetCursorBitmapFromItemID(carriedItemId); - return 2; + if (carriedItemId != 0) // looks odd in current context, but avoids accessing zeroth element of pItemsTable->pItems + { + sub_421B2C_PlaceInInventory_or_DropPickedItem(); + sprintf( + pTmpBuf2.data(), + pGlobalTXT_LocalizationStrings[304], // Official //TODO: add a normal "%d stole %d" message + this->pName, + pItemsTable->pItems[carriedItemId].pUnidentifiedName); + ShowStatusBarString(pTmpBuf2.data(), 2u); + sub_421B2C_PlaceInInventory_or_DropPickedItem(); + memcpy(&pParty->pPickedItem, &tempItem, sizeof(ItemGen)); + pMouse->SetCursorBitmapFromItemID(carriedItemId); + return 2; + } } } sprintfex(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[377], this->pName); //%s failed to steal anything @@ -2255,7 +2257,7 @@ armor_indx = pEquipment.uArmor; if ( armor_indx ) { - if ( !(pOwnItems[armor_indx-1].uAttributes & ITEM_ENCHANTED)) + if ( !(pOwnItems[armor_indx-1].uAttributes & ITEM_HARDENED)) { pOwnItems[armor_indx-1].SetBroken(); } @@ -2334,7 +2336,7 @@ if ( !v4 ) return 0; v48 = &this->pInventoryItemList[v46[rand() % v4]]; - v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + pItemsTable->pItems[v48->uItemID].uDamageMod); + v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + v48->GetDamageMod()); break; case SPECIAL_ATTACK_BREAK_ARMOR: for (int i = 0; i < 16; i++ ) @@ -2350,7 +2352,7 @@ if ( !v4 ) return 0; v48 = &this->pInventoryItemList[v46[rand() % v4]]; - v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + pItemsTable->pItems[v48->uItemID].uDamageMod); + v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + v48->GetDamageMod()); break; case SPECIAL_ATTACK_BREAK_WEAPON: for (int i = 0; i < 16; i++ ) @@ -2367,7 +2369,7 @@ if ( !v4 ) return 0; v48 = &this->pInventoryItemList[v46[rand() % v4]]; - v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + pItemsTable->pItems[v48->uItemID].uDamageMod); + v11 = 3 * (pItemsTable->pItems[v48->uItemID].uMaterial + v48->GetDamageMod()); break; case SPECIAL_ATTACK_STEAL: for ( int i = 0; i < 126; i++ ) @@ -2507,7 +2509,7 @@ case SPECIAL_ATTACK_BREAK_ANY: case SPECIAL_ATTACK_BREAK_ARMOR: case SPECIAL_ATTACK_BREAK_WEAPON: - if ( !(v48->uAttributes & ITEM_ENCHANTED) ) + if ( !(v48->uAttributes & ITEM_HARDENED) ) { PlaySound(SPEECH_40, 0); v48->SetBroken(); @@ -2609,14 +2611,14 @@ { weapon = &pInventoryItemList[pEquipment.uShield - 1]; weapon_desc = &pItemsTable->pItems[weapon->uItemID]; - weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; + weapon_recovery = base_recovery_times_per_weapon_type[weapon->GetPlayerSkillType()]; } } uint armour_recovery = 0; if ( HasItemEquipped(EQUIP_ARMOUR) ) { - auto armour_skill_type = pItemsTable->pItems[pInventoryItemList[pEquipment.uArmor - 1].uItemID].uSkillType; + auto armour_skill_type = pInventoryItemList[pEquipment.uArmor - 1].GetPlayerSkillType(); uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; float multiplier; @@ -2645,7 +2647,7 @@ if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) == EQUIP_SHIELD) { auto shield = &pInventoryItemList[pEquipment.uShield - 1]; - auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; + auto skill_type = shield->GetPlayerSkillType(); uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; float multiplier = GetArmorRecoveryMultiplierFromSkillLevel(skill_type, 1.0f, 0, 0, 0); @@ -3100,7 +3102,7 @@ case CHARACTER_ATTRIBUTE_RANGED_DMG_BONUS: case CHARACTER_ATTRIBUTE_RANGED_ATTACK: if ( HasItemEquipped(EQUIP_BOW) ) - v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uBow-1].uItemID].uDamageMod; + v5 = this->pOwnItems[this->pEquipment.uBow-1].GetDamageMod(); return v5; break; @@ -3177,7 +3179,7 @@ v17 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); if ( v17 >= 0 && v17 <= 2) { - v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand-1].uItemID].uDamageMod; + v5 = this->pOwnItems[this->pEquipment.uMainHand-1].GetDamageMod(); } } if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (this->GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0) || this->GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2 ) @@ -3200,9 +3202,9 @@ v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); if ( v9 >= 0 && v9 <= 2) { - v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand - 1].uItemID].uDamageDice + - pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand - 1].uItemID].uDamageMod; - if ( !this->pEquipment.uShield && pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand - 1].uItemID].uSkillType == 4) + v5 = this->pOwnItems[this->pEquipment.uMainHand - 1].GetDamageDice() + + this->pOwnItems[this->pEquipment.uMainHand - 1].GetDamageMod(); + if ( !this->pEquipment.uShield && this->pOwnItems[this->pEquipment.uMainHand - 1].GetPlayerSkillType() == 4) { ++v5; } @@ -3215,8 +3217,8 @@ } else { - v14 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageMod; - v15 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uShield].uItemID].uDamageDice; + v14 = this->pOwnItems[this->pEquipment.uShield].GetDamageMod(); + v15 = this->pOwnItems[this->pEquipment.uShield].GetDamageDice(); return v5 + v15 + v14; } break; @@ -3741,7 +3743,7 @@ { if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { - PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID].uSkillType; + PLAYER_SKILL_TYPE currentItemSkillType = (PLAYER_SKILL_TYPE)this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].GetPlayerSkillType(); int currentItemSkillLevel = this->GetActualSkillLevel(currentItemSkillType); if ( currentItemSkillType == PLAYER_SKILL_BOW ) { @@ -3773,10 +3775,10 @@ { if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { - int currItemId = this->pInventoryItemList[this->pEquipment.pIndices[i] - 1].uItemID; - if ( pItemsTable->pItems[currItemId].uEquipType == EQUIP_MAIN_HAND || pItemsTable->pItems[currItemId].uEquipType == EQUIP_OFF_HAND ) + ItemGen* currItemPtr = &this->pInventoryItemList[this->pEquipment.pIndices[i] - 1]; + if ( currItemPtr->GetItemEquipType() == EQUIP_MAIN_HAND || currItemPtr->GetItemEquipType() == EQUIP_OFF_HAND ) { - PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)pItemsTable->pItems[currItemId].uSkillType; + PLAYER_SKILL_TYPE currItemSkillType = (PLAYER_SKILL_TYPE)currItemPtr->GetPlayerSkillType(); int currItemSkillLevel = this->GetActualSkillLevel(currItemSkillType); int baseSkillBonus; int multiplier; @@ -4378,7 +4380,7 @@ v73 = 1; if ( pParty->bTurnBasedModeOn == 1 && (pTurnEngine->turn_stage == 1 || pTurnEngine->turn_stage == 3) ) return; - if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_REAGENT ) + if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_REAGENT ) { if ( pParty->pPickedItem.uItemID == 160 ) { @@ -4428,7 +4430,7 @@ return; } - if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) + if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_POTION ) { switch ( pParty->pPickedItem.uItemID ) { @@ -4724,7 +4726,7 @@ } - if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_SPELL_SCROLL ) + if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_SPELL_SCROLL ) { if ( pCurrentScreen == SCREEN_CASTING ) return; @@ -4768,7 +4770,7 @@ return; } - if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_BOOK ) + if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_BOOK ) { v15 = pParty->pPickedItem.uItemID - 400; v72 = playerAffected->spellbook.bHaveSpell[pParty->pPickedItem.uItemID-400];//(char *)&v3->pConditions[0] + pParty->pPickedItem.uItemID + 2; @@ -4840,7 +4842,7 @@ return; } - if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) + if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_MESSAGE_SCROLL ) { if ( playerAffected->CanAct() ) { @@ -6238,7 +6240,7 @@ pParty->pIsArtifactFound[val-500] = 1; if ( val >= ITEM_WAND_FIRE && val <= ITEM_WAND_INCENERATION ) { - item.uNumCharges = rand() % 6 + pItemsTable->pItems[item.uItemID].uDamageMod + 1; + item.uNumCharges = rand() % 6 + item.GetDamageMod() + 1; item.uMaxCharges = LOBYTE(item.uNumCharges); } pParty->SetHoldingItem(&item); @@ -7406,8 +7408,8 @@ if ( !v8 || playerPtr->pInventoryItemList[v8 - 1].IsBroken() || - (pItemsTable->pItems[playerPtr->pInventoryItemList[v8 - 1].uItemID].uSkillType != PLAYER_SKILL_CHAIN - && pItemsTable->pItems[playerPtr->pInventoryItemList[v8 - 1].uItemID].uSkillType != PLAYER_SKILL_PLATE + (playerPtr->pInventoryItemList[v8 - 1].GetPlayerSkillType() != PLAYER_SKILL_CHAIN + && playerPtr->pInventoryItemList[v8 - 1].GetPlayerSkillType() != PLAYER_SKILL_PLATE ) ) { @@ -7792,7 +7794,7 @@ } v9 = tmpItem.uItemID; memcpy(&pParty->pPickedItem, &tmpItem, sizeof(ItemGen)); - pMouse->SetCursorBitmap(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName); + pMouse->SetCursorBitmap(pParty->pPickedItem.GetIconName()); return; } else
--- a/UI/UICharacter.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/UI/UICharacter.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -777,8 +777,8 @@ pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor); //Рука не занята или ... if ( !player->pEquipment.uMainHand - || ( pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].uItemID].uEquipType != EQUIP_MAIN_HAND) - && (pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].uItemID].uSkillType != PLAYER_SKILL_SPEAR + || ( pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].GetItemEquipType() != EQUIP_MAIN_HAND) + && (pPlayers[uPlayerID]->pInventoryItemList[player->pEquipment.uMainHand - 1].GetItemEquipType() != PLAYER_SKILL_SPEAR || 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])); @@ -791,7 +791,7 @@ if ( item->uItemID == 64 ) //blaster v166 = "item64v1"; else - v166 = pItemsTable->pItems[item->uItemID].pIconName; + v166 = item->GetIconName(); if ( !( item->uAttributes & 0xF0 ) ) { if ( item->uAttributes & 2 ) @@ -839,13 +839,13 @@ if ( !(item->uAttributes & 0xF0) )// если не применён закл { if ( item->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE))); + pRenderer->DrawTransparentRedShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE))); else { if ( !(item->uAttributes & 1) )//не опознанный лук зелёный - pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE))); + pRenderer->DrawTransparentGreenShade(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE))); else // опознанный лук - pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE))); + pRenderer->DrawTextureTransparent(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE))); } } else @@ -865,12 +865,12 @@ item->uAttributes &= 0xFFFFFF0Fu; ptr_50C9A4_ItemToEnchant = 0; } - pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)), + pRenderer->DrawAura(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)), pIcons_LOD->LoadTexturePtr(container, TEXTURE_16BIT_PALETTE), GetTickCount() * 0.1, 0, 255); } if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)), + pRenderer->DrawMaskToZBuffer(item_X, item_Y, pIcons_LOD->GetTexture(pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE)), pPlayers[uPlayerID]->pEquipment.uBow); } //-----------------------------(Cloak/Плащ)--------------------------------------------------------- @@ -1062,8 +1062,8 @@ } //--------------------------------------------(Hand/Рука)------------------------------------------------------ if ( !pPlayers[uPlayerID]->pEquipment.uMainHand - || ( pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].uItemID].uEquipType != EQUIP_MAIN_HAND) - && (pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].uItemID].uSkillType != PLAYER_SKILL_SPEAR + || ( pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].GetItemEquipType() != EQUIP_MAIN_HAND) + && (pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand -1].GetItemEquipType() != PLAYER_SKILL_SPEAR || 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])); @@ -1130,8 +1130,8 @@ //---------------------------------------------(Hand2/Рука2)-------------------------------------------------- if ( pPlayers[uPlayerID]->pEquipment.uMainHand ) { - if ( pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].uItemID].uEquipType == EQUIP_MAIN_HAND - || pItemsTable->pItems[pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].uItemID].uSkillType == PLAYER_SKILL_SPEAR + if ( pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].GetItemEquipType() == EQUIP_MAIN_HAND + || pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1].GetItemEquipType() == PLAYER_SKILL_SPEAR && !pPlayers[uPlayerID]->pEquipment.uShield ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], pIcons_LOD->GetTexture(papredoll_dlaus[uPlayerID - 1])); @@ -1407,7 +1407,7 @@ if ( item->uItemID == 64 ) v181 = "item64v1"; else - v181 = pItemsTable->pItems[item->uItemID].pIconName; + v181 = item->GetIconName(); if ( !(item->uAttributes & 0xF0) ) { if ( item->uAttributes & 2 ) @@ -1448,8 +1448,8 @@ if ( pPlayers[uPlayerID]->pEquipment.uShield ) { item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uShield - 1]; - if ( pItemsTable->pItems[item->uItemID].uSkillType == PLAYER_SKILL_DAGGER - || pItemsTable->pItems[item->uItemID].uSkillType == PLAYER_SKILL_SWORD ) + if ( item->GetPlayerSkillType() == PLAYER_SKILL_DAGGER + || item->GetPlayerSkillType() == PLAYER_SKILL_SWORD ) { //v151 = item->uItemID - 400; item_X = 596; @@ -1478,7 +1478,7 @@ item_X = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item->uItemID].uEquipX; item_Y = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item->uItemID].uEquipY; } - v153 = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + v153 = pIcons_LOD->LoadTexture(item->GetIconName(), TEXTURE_16BIT_PALETTE); if ( !(item->uAttributes & 0xF0) ) { if ( item->uAttributes & 2 ) @@ -1525,8 +1525,8 @@ if ( pPlayers[uPlayerID]->pEquipment.uMainHand ) { item = &pPlayers[uPlayerID]->pInventoryItemList[pPlayers[uPlayerID]->pEquipment.uMainHand - 1]; - if ( pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_MAIN_HAND - || pItemsTable->pItems[item->uItemID].uSkillType == PLAYER_SKILL_SPEAR + if ( item->GetItemEquipType() == EQUIP_MAIN_HAND + || item->GetItemEquipType() == PLAYER_SKILL_SPEAR && !pPlayers[uPlayerID]->pEquipment.uShield ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], @@ -1558,7 +1558,7 @@ continue; uCellY = 32 * (i / 14) + 17; uCellX = 32 * (i % 14) + 14; - uint item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[player->pInventoryItemList[player->pInventoryMatrix[i] - 1].uItemID].pIconName, TEXTURE_16BIT_PALETTE); + uint item_texture_id = pIcons_LOD->LoadTexture(player->pInventoryItemList[player->pInventoryMatrix[i] - 1].GetIconName(), TEXTURE_16BIT_PALETTE); pTexture = pIcons_LOD->GetTexture(item_texture_id); if (pTexture->uTextureWidth < 14) pTexture->uTextureWidth = 14; @@ -1608,7 +1608,7 @@ static void CharacterUI_DrawItem(int x, int y, ItemGen *item, int id) { - auto item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + auto item_texture = pIcons_LOD->LoadTexturePtr(item->GetIconName(), TEXTURE_16BIT_PALETTE); if (item->uAttributes & 0xF0) // enchant animation { @@ -2342,13 +2342,13 @@ _this.Reset(); v1 = pPlayers[uActiveCharacter]->pEquipment.uMainHand; v2 = pPlayers[uActiveCharacter]->pEquipment.uShield; - if ( v1 && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1]].uEquipType == EQUIP_MAIN_HAND ) + if ( v1 && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetItemEquipType() == EQUIP_MAIN_HAND ) v51 = v1; v3 = pParty->pPickedItem.uItemID; if ( pParty->pPickedItem.uItemID ) { - pEquipType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType; - pSkillType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSkillType; + pEquipType = pParty->pPickedItem.GetItemEquipType(); + pSkillType = pParty->pPickedItem.GetItemEquipType(); if ( pSkillType == 4 ) { if ( v2 ) @@ -2366,7 +2366,7 @@ { if ( (pSkillType == 8 || pSkillType == 1 || pSkillType == 2) && v1 - && pItemsTable->pItems[*(int *)&pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1]].uSkillType == 4 ) + && pPlayers[uActiveCharacter]->pInventoryItemList[v1 - 1].GetPlayerSkillType() == 4 ) { LOBYTE(v5) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_SPEAR); if ( (signed int)SkillToMastery(v5) < 3 ) @@ -2672,7 +2672,7 @@ { v36 = v34 - 1; v38 = &pPlayers[uActiveCharacter]->pInventoryItemList[v36]; - pEquipType = pItemsTable->pItems[v38->uItemID].uEquipType; + pEquipType = v38->GetItemEquipType(); if ( v38->uItemID == ITEM_WETSUIT ) { if ( bUnderwater )
--- a/UI/UIHouses.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/UI/UIHouses.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -1097,7 +1097,7 @@ { if ( pParty->SpellBooksInGuilds[v8->par1C-139][i].uItemID ) { - v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpellBooksInGuilds[v8->par1C-139][i].uItemID].pIconName, TEXTURE_16BIT_PALETTE); + v34 = pIcons_LOD->LoadTexture(pParty->SpellBooksInGuilds[v8->par1C-139][i].GetIconName(), TEXTURE_16BIT_PALETTE); v8 = window_SpeakInHouse; ItemsInShopTexture[i] = &pIcons_LOD->pTextures[v34]; } @@ -1617,7 +1617,7 @@ { if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID ) { - v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); + v46 = pIcons_LOD->LoadTexture(pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].GetIconName(), TEXTURE_16BIT_PALETTE); ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; } } @@ -1645,7 +1645,7 @@ { if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID ) { - v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); + v51 = pIcons_LOD->LoadTexture(pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].GetIconName(), TEXTURE_16BIT_PALETTE); ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; } }
--- a/UI/UIPopup.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/UI/UIPopup.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -135,8 +135,8 @@ else v2 = pMouse->GetCursorPos(&a2)->x - iteminfo_window.uFrameWidth - 30; iteminfo_window.uFrameX = v2; - v78 = 100 - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureWidth; - v81 = 144 - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureHeight; + v78 = 100 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureWidth; + v81 = 144 - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight; if ( v78 > 0 ) v78 = v78 / 2; if ( v81 <= 0 ) @@ -146,7 +146,7 @@ if ( !pItemsTable->pItems[inspect_item->uItemID].uItemID_Rep_St ) inspect_item->SetIdentified(); v77 = 0; - if (pItemsTable->pItems[inspect_item->uItemID].uEquipType == EQUIP_GOLD) + if (inspect_item->GetItemEquipType() == EQUIP_GOLD) v77 = inspect_item->uSpecEnchantmentType; if ( uActiveCharacter ) { @@ -198,7 +198,7 @@ iteminfo_window.uFrameHeight -= 12; iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; - pRenderer->DrawTransparentRedShade(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)); + pRenderer->DrawTransparentRedShade(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); if ( inspect_item->IsIdentified()) pText = (char *)inspect_item->GetIdentifiedName(); else @@ -209,7 +209,7 @@ pRenderer->ResetTextureClipRect(); if ( !areWeLoadingTexture ) { - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release(); + pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); pIcons_LOD->SyncLoadedFilesCount(); } return; @@ -223,14 +223,14 @@ iteminfo_window.uFrameHeight -= 12; iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; - pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)); + pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, v81 + iteminfo_window.uFrameY + 30, pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); iteminfo_window.DrawTitleText(pFontArrus, 0, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName, 3); iteminfo_window.DrawTitleText(pFontArrus, 0x64u, ((signed int)iteminfo_window.uFrameHeight >> 1) - pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &iteminfo_window, 0, 0) / 2, TargetColor(0xFFu, 0x19u, 0x19u), pGlobalTXT_LocalizationStrings[232], 3);//"Not Identified" pRenderer->ResetTextureClipRect(); if ( !areWeLoadingTexture ) { - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release(); + pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); pIcons_LOD->SyncLoadedFilesCount(); } return; @@ -238,29 +238,29 @@ sprintfex(out_text, pGlobalTXT_LocalizationStrings[463], pItemsTable->pItems[inspect_item->uItemID].pUnidentifiedName); //"Type: %s" out_text[100] = 0; out_text[200] = 0; - switch (pItemsTable->pItems[inspect_item->uItemID].uEquipType) + switch (inspect_item->GetItemEquipType()) { case EQUIP_OFF_HAND: case EQUIP_MAIN_HAND: sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[LOCSTR_ATTACK], - (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod, pGlobalTXT_LocalizationStrings[53], - (int)pItemsTable->pItems[inspect_item->uItemID].uDamageDice, (int)pItemsTable->pItems[inspect_item->uItemID].uDamageRoll); //"Damage" - if (pItemsTable->pItems[inspect_item->uItemID].uDamageMod) + (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], + (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); //"Damage" + if (inspect_item->GetDamageMod()) { char mod[16]; - sprintf(mod, "+%d", (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod); + sprintf(mod, "+%d", (int)inspect_item->GetDamageMod()); strcat(out_text + 100, mod); } break; case EQUIP_BOW: sprintfex(out_text + 100, "%s: +%d %s: %dd%d", pGlobalTXT_LocalizationStrings[203], //"Shoot" - (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod, pGlobalTXT_LocalizationStrings[53], //"Damage" - (int)pItemsTable->pItems[inspect_item->uItemID].uDamageDice, (int)pItemsTable->pItems[inspect_item->uItemID].uDamageRoll); - if (pItemsTable->pItems[inspect_item->uItemID].uDamageMod) + (int)inspect_item->GetDamageMod(), pGlobalTXT_LocalizationStrings[53], //"Damage" + (int)inspect_item->GetDamageDice(), (int)inspect_item->GetDamageRoll()); + if (inspect_item->GetDamageMod()) { char mod[16]; - sprintf(mod, "+%d", (int)pItemsTable->pItems[inspect_item->uItemID].uDamageMod); + sprintf(mod, "+%d", (int)inspect_item->GetDamageMod()); strcat(out_text + 100, mod); } break; @@ -274,21 +274,21 @@ case EQUIP_BOOTS: case EQUIP_RING: case EQUIP_AMULET: - if (pItemsTable->pItems[inspect_item->uItemID].uDamageDice) //"Armor" + if (inspect_item->GetDamageDice()) //"Armor" sprintfex(out_text + 100, "%s: +%d", pGlobalTXT_LocalizationStrings[11], - pItemsTable->pItems[inspect_item->uItemID].uDamageDice + pItemsTable->pItems[inspect_item->uItemID].uDamageMod); + inspect_item->GetDamageDice() + inspect_item->GetDamageMod()); break; } if ( !v77 ) { - if (pItemsTable->pItems[inspect_item->uItemID].uEquipType ==EQUIP_POTION) //this is CORRECT! do not move to switch! + if (inspect_item->GetItemEquipType() ==EQUIP_POTION) //this is CORRECT! do not move to switch! { if ( inspect_item->uEnchantmentType ) sprintf(out_text + 200, "%s: %d",pGlobalTXT_LocalizationStrings[449] , inspect_item->uEnchantmentType); //"Power" } - else if (pItemsTable->pItems[inspect_item->uItemID].uEquipType == EQUIP_REAGENT) - sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], pItemsTable->pItems[inspect_item->uItemID].uDamageDice); //"Power" + else if (inspect_item->GetItemEquipType() == EQUIP_REAGENT) + sprintf(out_text + 200, "%s: %d", pGlobalTXT_LocalizationStrings[449], inspect_item->GetDamageDice()); //"Power" else if ( inspect_item->uEnchantmentType ) sprintf(out_text + 200, "%s: %s +%d", pGlobalTXT_LocalizationStrings[210], pItemsTable->pEnchantments[inspect_item->uEnchantmentType-1].pBonusStat, inspect_item->m_enchantmentStrength); //"Special" else if ( inspect_item->uSpecEnchantmentType ) @@ -310,7 +310,7 @@ v28 = pItemsTable->pItems[inspect_item->uItemID].pDescription; if ( *v28 ) Str += pFontSmallnum->CalcTextHeight(pItemsTable->pItems[inspect_item->uItemID].pDescription, &iteminfo_window, 100, 0); - iteminfo_window.uFrameHeight = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, + iteminfo_window.uFrameHeight = pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight + v81 + 54; if ( (signed int)Str > (signed int)iteminfo_window.uFrameHeight ) iteminfo_window.uFrameHeight = (unsigned int)Str; @@ -337,8 +337,8 @@ iteminfo_window.uFrameZ = iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 1; iteminfo_window.uFrameW = iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 1; pRenderer->DrawTextureTransparent(iteminfo_window.uFrameX + v78, - iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2, - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)); + iteminfo_window.uFrameY + (signed int)(iteminfo_window.uFrameHeight - pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->uTextureHeight) / 2, + pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)); v34 = (int)(v85 + 35); Str = out_text; @@ -403,7 +403,7 @@ pRenderer->ResetTextureClipRect(); if ( !areWeLoadingTexture ) { - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release(); + pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); pIcons_LOD->SyncLoadedFilesCount(); } return; @@ -417,7 +417,7 @@ } if ( !areWeLoadingTexture ) { - pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->Release(); + pIcons_LOD->LoadTexturePtr(inspect_item->GetIconName(), TEXTURE_16BIT_PALETTE)->Release(); pIcons_LOD->SyncLoadedFilesCount(); } return;
--- a/Viewport.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/Viewport.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -287,7 +287,7 @@ if ( !(pObjectList->pObjects[pSpriteObjects[v21].uObjectDescID].uFlags & 0x10) && a2.y < 1000 && pSpriteObjects[v21].uObjectDescID && (unsigned int)v0 < 0x2000000 ) { - if ( pItemsTable->pItems[pSpriteObjects[v21].stru_24.uItemID].uEquipType == 18 ) + if ( pSpriteObjects[v21].stru_24.GetItemEquipType() == 18 ) { party_finds_gold(pSpriteObjects[v21].stru_24.uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1; @@ -342,7 +342,7 @@ extern int UnprojectX(int); v9 = UnprojectX(v1->x); a1.Create(pParty->sRotationY + v9, 184, 200, 0); - pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); + pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release(); pMouse->RemoveHoldingItem(); @@ -396,7 +396,7 @@ extern int UnprojectX(int); v9 = UnprojectX(v1->x); a1.Create(pParty->sRotationY + v9, 184, 200, 0); - pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); + pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release(); pMouse->RemoveHoldingItem(); @@ -445,7 +445,7 @@ extern int UnprojectX(int); v9 = UnprojectX(v1->x); a1.Create(pParty->sRotationY + v9, 184, 200, 0); - pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); + pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release(); pMouse->RemoveHoldingItem(); @@ -531,7 +531,7 @@ extern int UnprojectX(int); v9 = UnprojectX(v1->x); a1.Create(pParty->sRotationY + v9, 184, 200, 0); - pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); + pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release(); pMouse->RemoveHoldingItem(); @@ -597,7 +597,7 @@ extern int UnprojectX(int); v9 = UnprojectX(v1->x); a1.Create(pParty->sRotationY + v9, 184, 200, 0); - pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); + pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release(); pMouse->RemoveHoldingItem(); @@ -650,7 +650,7 @@ extern int UnprojectX(int); v9 = UnprojectX(v1->x); a1.Create(pParty->sRotationY + v9, 184, 200, 0); - pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); + pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release(); pMouse->RemoveHoldingItem(); @@ -700,7 +700,7 @@ extern int UnprojectX(int); v9 = UnprojectX(v1->x); a1.Create(pParty->sRotationY + v9, 184, 200, 0); - pTextureID = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); + pTextureID = pIcons_LOD->LoadTexture(pParty->pPickedItem.GetIconName(), TEXTURE_16BIT_PALETTE); if (pTextureID != -1) pIcons_LOD->pTextures[pTextureID].Release(); pMouse->RemoveHoldingItem();
--- a/mm7_4.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/mm7_4.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -3640,23 +3640,23 @@ { case BuildingType_WeaponShop: { - test = pItemsTable->pItems[item->uItemID].uEquipType <= 2; + test = item->GetItemEquipType() <= 2; break; } case BuildingType_ArmorShop: { - test = pItemsTable->pItems[item->uItemID].uEquipType >= 3; + test = item->GetItemEquipType() >= 3; break; } case BuildingType_MagicShop: { - test = pItemsTable->pItems[item->uItemID].uSkillType == 38 || pItemsTable->pItems[item->uItemID].uEquipType == 16; + test = item->GetPlayerSkillType() == 38 || item->GetItemEquipType() == 16; break; } case BuildingType_AlchemistShop: { - test = pItemsTable->pItems[item->uItemID].uEquipType == 13 || pItemsTable->pItems[item->uItemID].uEquipType == 14 - || (pItemsTable->pItems[item->uItemID].uEquipType > 14 && !(pItemsTable->pItems[item->uItemID].uEquipType != 17 + test = item->GetItemEquipType() == 13 || item->GetItemEquipType() == 14 + || (item->GetItemEquipType() > 14 && !(item->GetItemEquipType() != 17 || (signed int)item->uItemID < 740) && item->uItemID != 771); break; }
--- a/mm7_5.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/mm7_5.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -5030,7 +5030,7 @@ item->uItemID < ITEM_POTION_CATALYST && // cant recharge item->uItemID > ITEM_POTION_REJUVENATION) // all potions { - if (pItemsTable->pItems[item->uItemID].uEquipType != EQUIP_WAND) // can recharge only wands + if (item->GetItemEquipType() != EQUIP_WAND) // can recharge only wands { pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); return; @@ -5058,11 +5058,11 @@ { if (item->IsBroken() || // cant harden broken items item->uItemID >= ITEM_ARTIFACT_PUCK || // cant harden artifacts - pItemsTable->pItems[item->uItemID].uEquipType < EQUIP_OFF_HAND || - pItemsTable->pItems[item->uItemID].uEquipType > EQUIP_WAND) + item->GetItemEquipType() < EQUIP_OFF_HAND || + item->GetItemEquipType() > EQUIP_WAND) goto __invalid_item; - item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_ENCHANTED; + item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; _50C9A8_item_enchantment_timer = 256; pMouse->RemoveHoldingItem(); @@ -5085,7 +5085,7 @@ item->IsBroken() || item->uSpecEnchantmentType || item->uEnchantmentType || - pItemsTable->pItems[item->uItemID].uEquipType >= EQUIP_ARMOUR) // only melee weapons and bows + item->GetItemEquipType() >= EQUIP_ARMOUR) // only melee weapons and bows goto __invalid_item; item->UpdateTempBonus(pParty->uTimePlayed); @@ -5326,7 +5326,7 @@ // end alchemy - player->pInventoryItemList[item_pid].uEnchantmentType = v9 + pItemsTable->pItems[pParty->pPickedItem.uItemID].uDamageDice; + player->pInventoryItemList[item_pid].uEnchantmentType = v9 + pParty->pPickedItem.GetDamageDice(); switch ( pParty->pPickedItem.uItemID ) { case 0xC8u:
--- a/mm7_6.cpp Mon Sep 23 07:07:06 2013 +0200 +++ b/mm7_6.cpp Tue Sep 24 07:29:55 2013 +0200 @@ -251,7 +251,7 @@ } else { - if ( pItemsTable->pItems[pActor->array_000234[3].uItemID].uEquipType == 18 ) + if ( pActor->array_000234[3].GetItemEquipType() == 18 ) { v14 = pActor->array_000234[3].uSpecEnchantmentType; pActor->array_000234[3].Reset(); @@ -275,10 +275,10 @@ ShowStatusBarString(pTmpBuf2.data(), 2u); v4 = Dst.uItemID; v5 = Dst.uItemID; - if ( pItemsTable->pItems[Dst.uItemID].uEquipType == 12 ) + if ( Dst.GetItemEquipType() == 12 ) { v5 = Dst.uItemID; - v6 = rand() % 6 + pItemsTable->pItems[Dst.uItemID].uDamageMod + 1; + v6 = rand() % 6 + Dst.GetDamageMod() + 1; Dst.uNumCharges = v6; Dst.uMaxCharges = v6; v4 = Dst.uItemID; @@ -1103,7 +1103,7 @@ { //v28b = &v1->pInventoryItems[v4].uItemID; //v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); - if (pItemsTable->pItems[item->uItemID].uEquipType == EQUIP_WAND) + if (item->GetItemEquipType() == EQUIP_WAND) { if (item->uNumCharges <= 0) player->pEquipment.uMainHand = 0; // wand discharged - unequip @@ -1213,7 +1213,7 @@ { int main_hand_idx = player->pEquipment.uMainHand; if (player->HasItemEquipped(EQUIP_MAIN_HAND)) - v34 = pItemsTable->pItems[*(int *)&player->pInventoryItemList[main_hand_idx - 1]].uSkillType; + v34 = player->pInventoryItemList[main_hand_idx - 1].GetPlayerSkillType(); pTurnEngine->ApplyPlayerAction(); }