Mercurial > mm7
changeset 1712:c70d526669ec
Merge
author | Ritor1 |
---|---|
date | Tue, 24 Sep 2013 23:18:57 +0600 |
parents | 69efd5d1ab5c (current diff) 0f6cd60ca987 (diff) |
children | e013b92030e3 |
files | |
diffstat | 23 files changed, 553 insertions(+), 579 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/Actor.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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/Actor.h Tue Sep 24 23:18:38 2013 +0600 +++ b/Actor.h Tue Sep 24 23:18:57 2013 +0600 @@ -39,10 +39,26 @@ /* 361 */ enum ACTOR_BUFF_INDEX { - ACTOR_BUFF_CHARM = 1, // an assumption - ACTOR_BUFF_SHRINK = 3, // an assumption + ACTOR_BUFF_CHARM = 1, + ACTOR_BUFF_SUMMONED = 2, + ACTOR_BUFF_SHRINK = 3, + ACTOR_BUFF_AFRAID = 4, ACTOR_BUFF_STONED = 5, - ACTOR_BUFF_PARALYZED = 6 + ACTOR_BUFF_PARALYZED = 6, + + ACTOR_BUFF_BERSERK = 8, + + ACTOR_BUFF_FATE = 10, + ACTOR_BUFF_ENSLAVED = 11, + ACTOR_BUFF_DAY_OF_PROTECTION = 12, + ACTOR_BUFF_HOUR_OF_POWER = 13, + ACTOR_BUFF_SHIELD = 14, + ACTOR_BUFF_STONESKIN = 15, + ACTOR_BUFF_BLESS = 16, + ACTOR_BUFF_HEROISM = 17, + ACTOR_BUFF_HASTE = 18, + ACTOR_BUFF_PAIN_REFLECTION = 19, + ACTOR_BUFF_PAIN_HAMMERHANDS = 20, };
--- a/CastSpellInfo.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/CastSpellInfo.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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 Tue Sep 24 23:18:38 2013 +0600 +++ b/Chest.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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 Tue Sep 24 23:18:38 2013 +0600 +++ b/GUIWindow.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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/Indoor.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/Indoor.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -5396,7 +5396,7 @@ int v_4c; // [sp+8Ch] [bp+10h]@141 int v_8; // [sp+90h] [bp+14h]@53 - __debugbreak(); + //__debugbreak(); v4 = stru_5C6E00->Atan2(v.x - x, v.y - z); v114 = 0;
--- a/Items.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/Items.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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 Tue Sep 24 23:18:38 2013 +0600 +++ b/Items.h Tue Sep 24 23:18:57 2013 +0600 @@ -1,6 +1,7 @@ #pragma once #include <array> #include <map> +#include "NZIArray.h" enum DAMAGE_TYPE:unsigned int { @@ -29,7 +30,7 @@ ITEM_AURA_EFFECT_GREEN = 0x40,//64 ITEM_AURA_EFFECT_PURPLE = 0x80,//128 ITEM_STOLEN = 0x100, - ITEM_ENCHANTED = 0x200, + ITEM_HARDENED = 0x200, }; @@ -242,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 @@ -380,7 +386,7 @@ void Release(); int uAllItemsCount; - ItemDesc pItems[800]; //4-9604h + NZIArray<ItemDesc, 800> pItems; //4-9604h ItemEnchantment pEnchantments[24]; //9604h ItemSpecialEnchantment pSpecialEnchantments[72]; //97E4h -9FC4h char field_9FC4[5000];
--- a/Mouse.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/Mouse.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/NZIArray.h Tue Sep 24 23:18:57 2013 +0600 @@ -0,0 +1,43 @@ +#pragma once +#include <array> +#include <assert.h> + + +template<class _Ty, + size_t _Size> +class NZIArray : std::array<_Ty, _Size> +{ +public: + reference ZerothIndex() + { + return std::array<_Ty, _Size>::operator [](0); + } + + reference operator[](size_type _Pos) + { // subscript nonmutable sequence +#if _ITERATOR_DEBUG_LEVEL == 2 + assert(_Pos != 0 && "not allowed to access zeroth element"); + +#elif _ITERATOR_DEBUG_LEVEL == 1 + _SCL_SECURE_VALIDATE_RANGE(_Pos != 0); +#endif /* _ITERATOR_DEBUG_LEVEL */ + + __analysis_assume(_Pos != 0); + + return std::array<_Ty, _Size>::operator [](_Pos); + } + + const_reference operator[](size_type _Pos) const + { // subscript nonmutable sequence +#if _ITERATOR_DEBUG_LEVEL == 2 + assert(_Pos != 0 && "not allowed to access zeroth element"); + +#elif _ITERATOR_DEBUG_LEVEL == 1 + _SCL_SECURE_VALIDATE_RANGE(_Pos != 0); +#endif /* _ITERATOR_DEBUG_LEVEL */ + + __analysis_assume(_Pos != 0); + + return std::array<_Ty, _Size>::operator [](_Pos); + } +};
--- a/Party.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/Party.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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 Tue Sep 24 23:18:38 2013 +0600 +++ b/Player.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -60,9 +60,9 @@ -std::array<int, 5> StealingMasteryBonuses = {0, 100, 200, 300, 500}; //dword_4EDEA0 +std::array<int, 5> StealingMasteryBonuses = {0, 100, 200, 300, 500}; //dword_4EDEA0 //the zeroth element isn't accessed, it just helps avoid -1 indexing, originally 4 element array off by one std::array<int, 5> StealingRandomBonuses = {-200, -100, 0, 100, 200}; //dword_4EDEB4 -std::array<int, 5> StealingEnchantmentBonusForSkill = {0, 2, 4, 6, 10}; //dword_4EDEC4 +std::array<int, 5> StealingEnchantmentBonusForSkill = {0, 2, 4, 6, 10}; //dword_4EDEC4 //the zeroth element isn't accessed, it just helps avoid -1 indexing, originally 4 element array off by one @@ -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]; @@ -2068,8 +2067,6 @@ } } } -// 4EDEA0: using guessed type int dword_4EDEA0[]; -// 4EDEB4: using guessed type int dword_4EDEB4[]; //----- (0048D88B) -------------------------------------------------------- int Player::StealFromActor(unsigned int uActorID, int _steal_perm, int reputation) @@ -2125,7 +2122,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 +2153,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 +2178,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 +2255,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 +2334,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 +2350,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 +2367,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 +2507,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 +2609,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 +2645,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 +3100,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; @@ -3139,7 +3139,7 @@ v22 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); if ( v22 >= 0 && v22 <= 2) { - v23 = this->pOwnItems[this->pEquipment.uMainHand].uItemID; + v23 = this->pOwnItems[this->pEquipment.uMainHand - 1].uItemID; v26 = pItemsTable->pItems[v23].uDamageRoll; if ( this->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) { @@ -3152,13 +3152,13 @@ v5 = pItemsTable->pItems[v23].uDamageMod + v25 * v26; } } - if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0 && GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2)) + if ( getOnlyMainHandDmg || !this->HasItemEquipped(EQUIP_OFF_HAND) || (GetEquippedItemEquipType(EQUIP_OFF_HAND) < 0 || GetEquippedItemEquipType(EQUIP_OFF_HAND) > 2)) { return v5; } else { - v23 = this->pOwnItems[this->pEquipment.uShield].uItemID; + v23 = this->pOwnItems[this->pEquipment.uShield - 1].uItemID; v15 = pItemsTable->pItems[v23].uDamageMod; v14 = pItemsTable->pItems[v23].uDamageDice * pItemsTable->pItems[v23].uDamageRoll; return v5 + v15 + v14; @@ -3177,7 +3177,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 +3200,9 @@ v9 = this->GetEquippedItemEquipType(EQUIP_MAIN_HAND); if ( v9 >= 0 && v9 <= 2) { - v5 = pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageDice + - pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].uItemID].uDamageMod; - if ( !this->pEquipment.uShield && pItemsTable->pItems[this->pOwnItems[this->pEquipment.uMainHand].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 +3215,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 +3741,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 +3773,10 @@ { if ( this->HasItemEquipped((ITEM_EQUIP_TYPE)i) ) { - int currItemId = this->pInventoryItemList[this->pEquipment.pIndices[i]].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 +4378,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 +4428,7 @@ return; } - if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) + if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_POTION ) { switch ( pParty->pPickedItem.uItemID ) { @@ -4724,7 +4724,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 +4768,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 +4840,7 @@ return; } - if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) + if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_MESSAGE_SCROLL ) { if ( playerAffected->CanAct() ) { @@ -6238,7 +6238,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 +7406,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 +7792,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 Tue Sep 24 23:18:38 2013 +0600 +++ b/UI/UICharacter.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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 ) @@ -2702,7 +2702,7 @@ if ( !ptr_50C9A4_ItemToEnchant )//снять вещь { pParty->SetHoldingItem(v38); - pPlayers[uActiveCharacter]->pEquipment.pIndices[pPlayers[uActiveCharacter]->pInventoryItemList[v36].uBodyAnchor] = 0; + pPlayers[uActiveCharacter]->pEquipment.pIndices[pPlayers[uActiveCharacter]->pInventoryItemList[v36].uBodyAnchor - 1] = 0; v38->Reset(); } }
--- a/UI/UIGuilds.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/UI/UIGuilds.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -26,9 +26,7 @@ const char *statusbar_string; // ecx@26 POINT *v12; // esi@30 int v13; // ecx@30 - //void *v14; // ST1C_4@31 ItemGen *v15; // ST18_4@31 - //int v16; // ST10_4@31 int v17; // eax@31 char *v18; // edx@31 int pActiveItem; // esi@35 @@ -59,7 +57,6 @@ int pColorWhite; // [sp+2CCh] [bp-20h]@1 int pColorYellow; // [sp+2D0h] [bp-1Ch]@1 int v58; // [sp+2D4h] [bp-18h]@1 - //unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 bool pSkillFlag; // [sp+2DCh] [bp-10h]@35 int v61; // [sp+2E0h] [bp-Ch]@35 unsigned int v62; // [sp+2E4h] [bp-8h]@13
--- a/UI/UIHouses.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/UI/UIHouses.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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 Tue Sep 24 23:18:38 2013 +0600 +++ b/UI/UIPopup.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -107,22 +107,22 @@ //----- (0041D895) -------------------------------------------------------- void GameUI_DrawItemInfo( struct ItemGen* inspect_item ) { - unsigned int v2; // eax@3 - const char *v28; // edi@69 - int v34; // esi@81 - char *pText; // [sp-14h] [bp-28Ch]@110 - char out_text[300]; // [sp+8h] [bp-270h]@40 - char v65[120]; // [sp+134h] [bp-144h]@92 - stru351_summoned_item v67; - int v77; // [sp+200h] [bp-78h]@12 - int v78; // [sp+204h] [bp-74h]@5 - GUIWindow iteminfo_window; // [sp+208h] [bp-70h]@2 - POINT a2; // [sp+25Ch] [bp-1Ch]@2 - int v81; // [sp+264h] [bp-14h]@5 - PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18 - char* v84; - int v85; - char *Str; // [sp+270h] [bp-8h]@65 + unsigned int v2; // eax@3 + const char *v28; // edi@69 + int v34; // esi@81 + char *pText; // [sp-14h] [bp-28Ch]@110 + char out_text[300]; // [sp+8h] [bp-270h]@40 + char v65[120]; // [sp+134h] [bp-144h]@92 + stru351_summoned_item v67; + int v77; // [sp+200h] [bp-78h]@12 + int v78; // [sp+204h] [bp-74h]@5 + GUIWindow iteminfo_window; // [sp+208h] [bp-70h]@2 + POINT a2; // [sp+25Ch] [bp-1Ch]@2 + int v81; // [sp+264h] [bp-14h]@5 + PlayerSpeech v83; // [sp+26Ch] [bp-Ch]@18 + char* v84; + int v85; + char *Str; // [sp+270h] [bp-8h]@65 if (!inspect_item->uItemID) return; @@ -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,14 +146,13 @@ 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 ) { //try to identify if (!inspect_item->IsIdentified()) { - //v11 = inspect_item; if ( pPlayers[uActiveCharacter]->CanIdentify(inspect_item) == 1 ) inspect_item->SetIdentified(); v83 = SPEECH_9; @@ -198,7 +197,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 +208,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 +222,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 +237,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 +273,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 +309,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; @@ -332,13 +331,12 @@ pRenderer->SetTextureClipRect(iteminfo_window.uFrameX + 12, iteminfo_window.uFrameY + 12, iteminfo_window.uFrameX + iteminfo_window.uFrameWidth - 12, iteminfo_window.uFrameY + iteminfo_window.uFrameHeight - 12); iteminfo_window.uFrameWidth -= 12; - //v32 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[inspect_item->uItemID].pIconName, TEXTURE_16BIT_PALETTE)->uTextureHeight; 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, - 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 +401,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 +415,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; @@ -447,53 +445,28 @@ int v43; // eax@62 int v44; // eax@63 signed int v45; // edi@65 - int v50; // edi@90 - SpellBuff *v51; // eax@91 - char *v52; // ecx@98 - char *v53; // ecx@101 - char *v54; // ST0C_4@118 - unsigned int v55; // eax@118 - GUIFont *v56; // edi@124 - unsigned __int8 v57; // al@128 - int v58; // eax@132 - Actor *v59; // ecx@133 - unsigned __int8 v60; // dl@138 - char *v62; // eax@147 - int v63; // eax@152 - int v65; // eax@155 - const char *v67; // [sp-10h] [bp-1FCh]@125 - const char *v68; // [sp-10h] [bp-1FCh]@142 - char *v70; // [sp-Ch] [bp-1F8h]@125 - char *v71; // [sp-Ch] [bp-1F8h]@142 - char *v72; // [sp-8h] [bp-1F4h]@54 + int pTextHeight; // edi@90 int v73; // [sp-8h] [bp-1F4h]@79 - int v75; // [sp-8h] [bp-1F4h]@125 - int v76; // [sp-8h] [bp-1F4h]@142 - size_t v77; // [sp-4h] [bp-1F0h]@54 - unsigned int v79; // [sp-4h] [bp-1F0h]@125 - char *v80; // [sp-4h] [bp-1F0h]@142 - char *v81; // [sp-4h] [bp-1F0h]@148 DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18 DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18 RECT v84; // [sp+ECh] [bp-100h]@26 - char *v85[10]; // [sp+FCh] [bp-F0h]@145 - char *v95[11]; // [sp+124h] [bp-C8h]@127 + char *string_name[10]; // [sp+FCh] [bp-F0h]@145 + char *content[11]; // [sp+124h] [bp-C8h]@127 RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3 unsigned int v107; // [sp+1A0h] [bp-4Ch]@18 unsigned __int16 *v108; // [sp+1A4h] [bp-48h]@34 unsigned int v109; // [sp+1A8h] [bp-44h]@32 LPVOID v110; // [sp+1ACh] [bp-40h]@28 - int v112; // [sp+1B4h] [bp-38h]@3 - int v222; // [sp+1B8h] [bp-34h]@18 - unsigned __int8 v114; // [sp+1BFh] [bp-2Dh]@133 int v115; // [sp+1C0h] [bp-2Ch]@3 - unsigned int v116; // [sp+1C4h] [bp-28h]@18 - int i; // [sp+1C8h] [bp-24h]@18 - int v119; // [sp+1D0h] [bp-1Ch]@18 - SpellBuff *v120; // [sp+1D4h] [bp-18h]@18 - int v124; // [sp+1E4h] [bp-8h]@18 + bool normal_level; // [sp+1D0h] [bp-1Ch]@18 + bool expert_level; // [sp+1C4h] [bp-28h]@18 + bool master_level; // [sp+1C8h] [bp-24h]@18 + bool grandmaster_level; // [sp+1B4h] [bp-38h]@3 + char *pText; // [sp+1D4h] [bp-18h]@18 + int pTextColorID; // [sp+1E4h] [bp-8h]@18 int a4; // [sp+1E8h] [bp-4h]@18 + bool monster_full_informations = true; static Actor pMonsterInfoUI_Doll; /*if ( !(bMonsterInfoUI_bDollInitialized & 1) ) { @@ -563,7 +536,7 @@ pDesc.dwSize = 124; pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].pTextureSurface->GetSurfaceDesc(&pDesc); v107 = 0; - i = 0; + uint i = 0; int dst_x = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2; int dst_y = v106.uScreenSpaceY + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaY - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferHeight; uint dst_z = v106.uScreenSpaceX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaX + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uAreaWidth + pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth / 2 - pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]].uBufferWidth; @@ -600,7 +573,6 @@ { v20 = (char *)dst_y; v110 = pDesc.lpSurface; - //a2 = dst_y; if (dst_y < dst_w) { v21 = dst_x; @@ -672,58 +644,53 @@ if ( v10->pHwSpriteIDs[0] >= 0 ) pSprites_LOD->pSpriteHeaders[v10->pHwSpriteIDs[0]].DrawSprite_sw(&v106, 0); } - +//name and profession if ( pActors[uActorID].sNPC_ID ) { if (GetNPCData(pActors[uActorID].sNPC_ID)->uProfession) sprintfex(pTmpBuf.data(), pGlobalTXT_LocalizationStrings[429], GetNPCData(pActors[uActorID].sNPC_ID)->pName, aNPCProfessionNames[GetNPCData(pActors[uActorID].sNPC_ID)->uProfession]); // "%s the %s" / ^Pi[%s] %s else - { - v77 = 2000; - v72 = GetNPCData(pActors[uActorID].sNPC_ID)->pName; - } + strncpy(pTmpBuf.data(), GetNPCData(pActors[uActorID].sNPC_ID)->pName, 2000); } else { - v77 = 2000; if ( pActors[uActorID].dword_000334_unique_name ) - v72 = pMonsterStats->pPlaceStrings[pActors[uActorID].dword_000334_unique_name]; + strncpy(pTmpBuf.data(), pMonsterStats->pPlaceStrings[pActors[uActorID].dword_000334_unique_name], 2000); else - v72 = pMonsterStats->pInfos[pActors[uActorID].pMonsterInfo.uID].pName; + strncpy(pTmpBuf.data(), pMonsterStats->pInfos[pActors[uActorID].pMonsterInfo.uID].pName, 2000); } - if(!pActors[uActorID].sNPC_ID || (pActors[uActorID].sNPC_ID && !GetNPCData(pActors[uActorID].sNPC_ID)->uProfession)) - strncpy(pTmpBuf.data(), v72, v77); window->DrawTitleText(pFontComic, 0, 0xCu, TargetColor(0xFFu, 0xFFu, 0x9Bu), pTmpBuf.data(), 3); + //health bar Actor::DrawHealthBar(&pActors[uActorID], window); - v119 = 0; + + normal_level = 0; + expert_level = 0; + master_level = 0; + grandmaster_level = 0; pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed; v115 = 0; - v116 = 0; - i = 0; - v112 = 0; if ( !uActiveCharacter ) v45 = 1; else { - LOBYTE(v40) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); - v120 = v40; - if ( !v40 ) + int i = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); + if ( !i ) v45 = 1; else { - v41 = (unsigned __int8)v40 & 0x3F; - v42 = SkillToMastery((unsigned __int16)v40) - 1; - if ( !v42 ) + v41 = (unsigned __int8)i & 0x3F; + v42 = SkillToMastery(i) - 1; + if ( !v42 )//not master { if ( v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) { v45 = 1; - v119 = 1; + normal_level = 1; } else v45 = 1; } - else + else//he is master { v43 = v42 - 1; if ( !v43 ) @@ -731,8 +698,8 @@ if ( 2 * v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) { v45 = 1; - v119 = 1; - v116 = 1; + normal_level = 1; + expert_level = 1; } else v45 = 1; @@ -745,9 +712,9 @@ if ( 3 * v41 + 10 >= pActors[uActorID].pMonsterInfo.uLevel ) { v45 = 1; - v119 = 1; - v116 = 1; - i = 1; + normal_level = 1; + expert_level = 1; + master_level = 1; } else v45 = 1; @@ -759,10 +726,10 @@ else { v45 = 1; - v119 = 1; - v116 = 1; - i = 1; - v112 = 1; + normal_level = 1; + expert_level = 1; + master_level = 1; + grandmaster_level = 1; } } } @@ -770,9 +737,9 @@ } if ( pActors[uActorID].uAIState != Dead && pActors[uActorID].uAIState != Dying - && !dword_507BF0_is_there_popup_onscreen && v120 ) + && !dword_507BF0_is_there_popup_onscreen && i ) { - if ( v119 | v116 | i | (unsigned int)v112 ) + if ( normal_level | expert_level | master_level | grandmaster_level ) { if ( pActors[uActorID].pMonsterInfo.uLevel >= pPlayers[uActiveCharacter]->uLevel - 5 ) v73 = SPEECH_105; @@ -785,193 +752,164 @@ } } - for (uint i = 0; i < 4; ++i) + if ( (signed int)SkillToMastery(pParty->pPlayers[uActiveCharacter].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 ) + v115 = v45; + + if ( monster_full_informations == true ) { - v120 = (SpellBuff *)138; - do - { - if ( (signed int)SkillToMastery(pParty->pPlayers[i].GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID)) >= 3 ) - v115 = v45; - v120 = (SpellBuff *)((char *)v120 - 1); - } - while ( v120 ); + normal_level = 1;// + expert_level = 1;// + master_level = 1;// + grandmaster_level = 1;// + v115 = 1; } - window->DrawText(pFontSmallnum, 12, 196, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0); + window->DrawText(pFontSmallnum, 12, 196, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[631], 0, 0, 0);//Effects if ( !v115 ) - window->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0); + window->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[630], 0, 0, 0);//? else { - a4 = 0; - v51 = &pActors[uActorID].pActorBuffs[1]; - v222 = 0; - v120 = &pActors[uActorID].pActorBuffs[1]; - do - { - if ( (signed __int64)v51->uExpireTime > 0 ) - { - switch ( (int)v51 ) - { - case 0u: - v124 = 60; - a4 = (int)pGlobalTXT_LocalizationStrings[591]; - break; - case 1u: - v124 = 82; - a4 = (int)pGlobalTXT_LocalizationStrings[649]; - break; - case 2u: - v124 = 92; - a4 = (int)pGlobalTXT_LocalizationStrings[592]; - break; - case 3u: - v124 = 63; - a4 = (int)pGlobalTXT_LocalizationStrings[4]; - break; - case 4u: - v52 = pGlobalTXT_LocalizationStrings[220]; - a4 = (int)v52; - v124 = 81; - break; - case 5u: - v52 = pGlobalTXT_LocalizationStrings[162]; - a4 = (int)v52; - v124 = 81; - break; - case 6u: - v53 = pGlobalTXT_LocalizationStrings[593]; - v124 = 35; - a4 = (int)v53; - break; - case 8u: - v53 = pGlobalTXT_LocalizationStrings[608]; - v124 = 62; - a4 = (int)v53; - break; - case 7u: - case 9u: - a4 = 0; - v124 = 0; - ++v51; - v222 = v222 + 1; - v120 = v51; - __debugbreak(); // fix condition - continue; - case 0xAu: - v124 = 47; - a4 = (int)pGlobalTXT_LocalizationStrings[221]; - break; - case 0xBu: - v124 = 66; - a4 = (int)pGlobalTXT_LocalizationStrings[607]; - break; - case 0xCu: - v124 = 85; - a4 = (int)pGlobalTXT_LocalizationStrings[610]; - break; - case 0xDu: - v124 = 86; - a4 = (int)pGlobalTXT_LocalizationStrings[609]; - break; - case 0xEu: - v124 = 17; - a4 = (int)pGlobalTXT_LocalizationStrings[279]; - break; - case 0xFu: - v124 = 38; - a4 = (int)pGlobalTXT_LocalizationStrings[442]; - break; - case 0x10u: - v124 = 46; - a4 = (int)pGlobalTXT_LocalizationStrings[443]; - break; - case 0x11u: - v124 = 51; - a4 = (int)pGlobalTXT_LocalizationStrings[440]; - break; - case 0x12u: - v124 = 5; - a4 = (int)pGlobalTXT_LocalizationStrings[441]; - break; - case 0x13u: - v124 = 95; - a4 = (int)pGlobalTXT_LocalizationStrings[229]; - break; - case 0x14u: - v124 = 73; - a4 = (int)pGlobalTXT_LocalizationStrings[228]; - break; - default: - a4 = 0; - break; - } - if ( a4 ) - { - v54 = (char *)a4; - v55 = GetSpellColor(v124); - window->DrawText(pFontSmallnum, 28, LOBYTE(pFontSmallnum->uFontHeight) + 193, v55, v54, 0, 0, 0); - v50 = (LOBYTE(pFontSmallnum->uFontHeight) + 193) + *(char *)((int)pFontSmallnum + 5) - 3; - v51 = v120; - } - } + pText = ""; + pTextHeight = LOBYTE(pFontSmallnum->uFontHeight) + 193; + for ( uint i = 1; i <= 21; ++i ) + { + if ( pActors[uActorID].pActorBuffs[i].uExpireTime > 0 ) + { + switch ( i - 1 ) + { + case 0: + pTextColorID = 60; + pText = pGlobalTXT_LocalizationStrings[591];//Charmed + break; + case 1: + pTextColorID = 82; + pText = pGlobalTXT_LocalizationStrings[649];//Summoned + break; + case 2: + pTextColorID = 92; + pText = pGlobalTXT_LocalizationStrings[592];//Shrunk + break; + case 3: + pTextColorID = 63; + pText = pGlobalTXT_LocalizationStrings[4];//Afraid + break; + case 4: + pText = pGlobalTXT_LocalizationStrings[220];//Stoned + pTextColorID = 81; + break; + case 5: + pText = pGlobalTXT_LocalizationStrings[162];//Paralyzed + pTextColorID = 81; + break; + case 6: + pText = pGlobalTXT_LocalizationStrings[593];//Slowed + pTextColorID = 35; + break; + case 8: + pText = pGlobalTXT_LocalizationStrings[608];//Berserk + pTextColorID = 62; + break; + case 7: + case 9: + pText = ""; + pTextColorID = 0; + continue; + case 10: + pTextColorID = 47; + pText = pGlobalTXT_LocalizationStrings[221];//Fate + break; + case 11: + pTextColorID = 66; + pText = pGlobalTXT_LocalizationStrings[607];//Enslaved + break; + case 12: + pTextColorID = 85; + pText = pGlobalTXT_LocalizationStrings[610];//Day of Protection + break; + case 13: + pTextColorID = 86; + pText = pGlobalTXT_LocalizationStrings[609];//Hour of Power + break; + case 14: + pTextColorID = 17; + pText = pGlobalTXT_LocalizationStrings[279];//Shield + break; + case 15: + pTextColorID = 38; + pText = pGlobalTXT_LocalizationStrings[442];//Stoneskin + break; + case 16: + pTextColorID = 46; + pText = pGlobalTXT_LocalizationStrings[443];//Bless + break; + case 17: + pTextColorID = 51; + pText = pGlobalTXT_LocalizationStrings[440];//Heroism + break; + case 18: + pTextColorID = 5; + pText = pGlobalTXT_LocalizationStrings[441];//Haste + break; + case 19: + pTextColorID = 95; + pText = pGlobalTXT_LocalizationStrings[229];//Pain Reflection + break; + case 20: + pTextColorID = 73; + pText = pGlobalTXT_LocalizationStrings[228];//Hammerhands + break; + default: + pText = ""; + break; + } + if ( pText != "" ) + { + window->DrawText(pFontSmallnum, 28, pTextHeight, GetSpellColor(pTextColorID), pText, 0, 0, 0); + pTextHeight = pTextHeight + *(char *)((int)pFontSmallnum + 5) - 3; + } + } + } + if ( pText == "" ) + window->DrawText(pFontSmallnum, 28, pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[153], 0, 0, 0);//Нет + } - ++v51; - v222 = v222 + 1; - v120 = v51; - - __debugbreak(); // fix condition - } - //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 ); - while (true); - - if ( !a4 ) - window->DrawText(pFontSmallnum, 28, v50, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[153], 0, 0, 0); - } - v56 = pFontSmallnum; - a4 = v106.uViewportY; - if ( v119 ) + if ( normal_level ) { sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[108], 0, pActors[uActorID].pMonsterInfo.uHP); - window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - a4 = a4 + LOBYTE(v56->uFontHeight) - 3; - v79 = pActors[uActorID].pMonsterInfo.uAC; - v75 = 0; - v70 = pGlobalTXT_LocalizationStrings[12]; - v67 = "%s\f%05u\t100%d\n"; + window->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; + sprintf(pTmpBuf.data(), "%s\f%05u\t100%d\n", pGlobalTXT_LocalizationStrings[12], 0, pActors[uActorID].pMonsterInfo.uAC);//Armor Class } else { - sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]); - window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630]; - v75 = 0; - v70 = pGlobalTXT_LocalizationStrings[12]; - a4 = a4 + LOBYTE(v56->uFontHeight) - 3; - v67 = "%s\f%05u\t100%s\n"; + sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]);//? + window->DrawText(pFontSmallnum, 150, (int)v106.uViewportY, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = v106.uViewportY + LOBYTE(pFontSmallnum->uFontHeight) - 3; + sprintf(pTmpBuf.data(), "%s\f%05u\t100%s\n", pGlobalTXT_LocalizationStrings[12], 0, (unsigned int)pGlobalTXT_LocalizationStrings[630]);//? } - sprintf(pTmpBuf.data(), v67, v70, v75, v79); - window->DrawText(v56, 150, a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - a4 = a4 + LOBYTE(v56->uFontHeight) - 6 + LOBYTE(v56->uFontHeight); - v95[0] = pGlobalTXT_LocalizationStrings[87]; - v95[1] = pGlobalTXT_LocalizationStrings[6]; - v95[2] = pGlobalTXT_LocalizationStrings[240]; - v95[3] = pGlobalTXT_LocalizationStrings[70]; - v95[4] = pGlobalTXT_LocalizationStrings[624]; - v95[5] = pGlobalTXT_LocalizationStrings[138]; - v95[6] = pGlobalTXT_LocalizationStrings[214]; - v95[7] = pGlobalTXT_LocalizationStrings[142]; - v95[8] = pGlobalTXT_LocalizationStrings[29]; - v95[9] = pGlobalTXT_LocalizationStrings[133]; - v95[10] = pGlobalTXT_LocalizationStrings[54]; - if ( v116 ) + window->DrawText(pFontSmallnum, 150, pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight); + + content[0] = pGlobalTXT_LocalizationStrings[87]; + content[1] = pGlobalTXT_LocalizationStrings[6]; + content[2] = pGlobalTXT_LocalizationStrings[240]; + content[3] = pGlobalTXT_LocalizationStrings[70]; + content[4] = pGlobalTXT_LocalizationStrings[624]; + content[5] = pGlobalTXT_LocalizationStrings[138]; + content[6] = pGlobalTXT_LocalizationStrings[214]; + content[7] = pGlobalTXT_LocalizationStrings[142]; + content[8] = pGlobalTXT_LocalizationStrings[29]; + content[9] = pGlobalTXT_LocalizationStrings[133]; + content[10] = pGlobalTXT_LocalizationStrings[54]; + + if ( expert_level ) { - sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, v95[pActors[uActorID].pMonsterInfo.uAttack1Type]); - window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - a4 = a4 + LOBYTE(v56->uFontHeight) - 3; - v57 = pActors[uActorID].pMonsterInfo.uAttack1DamageBonus; - if ( v57 ) + sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, content[pActors[uActorID].pMonsterInfo.uAttack1Type]);//Attack + window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + if ( pActors[uActorID].pMonsterInfo.uAttack1DamageBonus ) sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d+%d\n", pGlobalTXT_LocalizationStrings[53], - 0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides, v57); + 0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides, pActors[uActorID].pMonsterInfo.uAttack1DamageBonus); else sprintf(pTmpBuf.data(), "%s\f%05u\t080%dd%d\n", pGlobalTXT_LocalizationStrings[53], 0, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceRolls, pActors[uActorID].pMonsterInfo.uAttack1DamageDiceSides); @@ -979,124 +917,101 @@ else { sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); - window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - a4 = a4 + LOBYTE(v56->uFontHeight) - 3; + window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]); } - window->DrawText(v56, 150, a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - v58 = LOBYTE(v56->uFontHeight); - a4 = a4 + v58 - 6 + v58; - if ( !i ) + window->DrawText(pFontSmallnum, 150, pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 6 + LOBYTE(pFontSmallnum->uFontHeight); + + if ( !master_level ) { - v80 = pGlobalTXT_LocalizationStrings[630]; - v76 = 0; - v71 = pGlobalTXT_LocalizationStrings[628]; - v68 = "%s\f%05u\t080%s\n"; - sprintf(pTmpBuf.data(), v68, v71, v76, v80); - window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - v58 = LOBYTE(v56->uFontHeight); - a4 = a4 + v58 - 3; + sprintf(pTmpBuf.data(), "%s\f%05u\t080%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[630]);//"Spell" "?" + window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; } else { - v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[628]; - v59 = &pActors[uActorID]; - v114 = pActors[uActorID].pMonsterInfo.uSpell1ID; - if ( v114 && pActors[uActorID].pMonsterInfo.uSpell2ID ) - v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629]; - if ( v114 ) - { - sprintf(pTmpBuf.data(), "%s\f%05u\t060%s\n", v120, 0, pSpellStats->pInfos[v114].pShortName); - window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - v58 = LOBYTE(v56->uFontHeight); - a4 = a4 + v58 - 3; - v59 = &pActors[uActorID]; - } - v60 = v59->pMonsterInfo.uSpell2ID; - if ( v60 ) - { - sprintf(pTmpBuf.data(), "\f%05u\t060%s\n", 0, pSpellStats->pInfos[v60].pShortName); - window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - v58 = LOBYTE(v56->uFontHeight); - a4 = a4 + v58 - 3; - v59 = &pActors[uActorID]; - } - if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID ) - { - v80 = pGlobalTXT_LocalizationStrings[153]; - v76 = 0; - v71 = pGlobalTXT_LocalizationStrings[628]; - v68 = "%s\f%05u\t060%s\n"; - sprintf(pTmpBuf.data(), v68, v71, v76, v80); - window->DrawText(v56, 150, (int)a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - v58 = LOBYTE(v56->uFontHeight); - a4 = a4 + v58 - 3; - } + pText = pGlobalTXT_LocalizationStrings[628];//Spell + if ( pActors[uActorID].pMonsterInfo.uSpell1ID && pActors[uActorID].pMonsterInfo.uSpell2ID ) + pText = pGlobalTXT_LocalizationStrings[629];//Spells + if ( pActors[uActorID].pMonsterInfo.uSpell1ID ) + { + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pText, 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell1ID].pShortName); + window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + } + if ( pActors[uActorID].pMonsterInfo.uSpell2ID ) + { + sprintf(pTmpBuf.data(), "\f%05u\t070%s\n", 0, pSpellStats->pInfos[pActors[uActorID].pMonsterInfo.uSpell2ID].pShortName); + window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + } + if ( !pActors[uActorID].pMonsterInfo.uSpell1ID && !pActors[uActorID].pMonsterInfo.uSpell2ID ) + { + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", pGlobalTXT_LocalizationStrings[628], 0, pGlobalTXT_LocalizationStrings[153]); + window->DrawText(pFontSmallnum, 150, (int)pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + } } - a4 = a4 + v58 - 3; - window->DrawText(v56, 150, a4, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[626], 0, 0, 0); - a4 = a4 + LOBYTE(v56->uFontHeight) - 3; - v85[0] = pGlobalTXT_LocalizationStrings[87]; - v85[1] = pGlobalTXT_LocalizationStrings[6]; - v85[2] = pGlobalTXT_LocalizationStrings[240]; - v85[3] = pGlobalTXT_LocalizationStrings[70]; - v85[4] = pGlobalTXT_LocalizationStrings[142]; - v85[5] = pGlobalTXT_LocalizationStrings[214]; - v85[6] = pGlobalTXT_LocalizationStrings[29]; - v85[7] = pGlobalTXT_LocalizationStrings[133]; - v85[8] = pGlobalTXT_LocalizationStrings[54]; - v85[9] = pGlobalTXT_LocalizationStrings[624]; - v95[1] = (char *)pActors[uActorID].pMonsterInfo.uResFire; - v95[2] = (char *)pActors[uActorID].pMonsterInfo.uResAir; - v95[3] = (char *)pActors[uActorID].pMonsterInfo.uResWater; - v95[4] = (char *)pActors[uActorID].pMonsterInfo.uResEarth; - v95[5] = (char *)pActors[uActorID].pMonsterInfo.uResMind; - v95[6] = (char *)pActors[uActorID].pMonsterInfo.uResSpirit; - v95[7] = (char *)pActors[uActorID].pMonsterInfo.uResBody; - v95[8] = (char *)pActors[uActorID].pMonsterInfo.uResLight; - v95[9] = (char *)pActors[uActorID].pMonsterInfo.uResPhysical; - v95[10] = (char *)pActors[uActorID].pMonsterInfo.uResDark; - if ( v112 ) + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + window->DrawText(pFontSmallnum, 150, pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pGlobalTXT_LocalizationStrings[626], 0, 0, 0);//Immune + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; + + string_name[0] = pGlobalTXT_LocalizationStrings[87];//Fire + string_name[1] = pGlobalTXT_LocalizationStrings[6];//Air + string_name[2] = pGlobalTXT_LocalizationStrings[240]; + string_name[3] = pGlobalTXT_LocalizationStrings[70]; + string_name[4] = pGlobalTXT_LocalizationStrings[142]; + string_name[5] = pGlobalTXT_LocalizationStrings[214]; + string_name[6] = pGlobalTXT_LocalizationStrings[29]; + string_name[7] = pGlobalTXT_LocalizationStrings[133]; + string_name[8] = pGlobalTXT_LocalizationStrings[54]; + string_name[9] = pGlobalTXT_LocalizationStrings[624]; + + content[0] = (char *)pActors[uActorID].pMonsterInfo.uResFire; + content[1] = (char *)pActors[uActorID].pMonsterInfo.uResAir; + content[2] = (char *)pActors[uActorID].pMonsterInfo.uResWater; + content[3] = (char *)pActors[uActorID].pMonsterInfo.uResEarth; + content[4] = (char *)pActors[uActorID].pMonsterInfo.uResMind; + content[5] = (char *)pActors[uActorID].pMonsterInfo.uResSpirit; + content[6] = (char *)pActors[uActorID].pMonsterInfo.uResBody; + content[7] = (char *)pActors[uActorID].pMonsterInfo.uResLight; + content[8] = (char *)pActors[uActorID].pMonsterInfo.uResPhysical; + content[9] = (char *)pActors[uActorID].pMonsterInfo.uResDark; + + if ( grandmaster_level ) { - v124 = 0; - do + for ( uint i = 0; i < 10; i++ ) { - v62 = v95[v124+1]; - if ( v62 == (char *)200 ) + if ( content[i] == (char *)200 ) { - v81 = pGlobalTXT_LocalizationStrings[625]; + pText = pGlobalTXT_LocalizationStrings[625];//Immune } else { - if ( v62 ) - v81 = pGlobalTXT_LocalizationStrings[627]; + if ( content[i] ) + pText = pGlobalTXT_LocalizationStrings[627];//Resistant else - v81 = pGlobalTXT_LocalizationStrings[153]; + pText = pGlobalTXT_LocalizationStrings[153];//None } - sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", v85[v124], 0, v81); - window->DrawText(v56, 170, a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - v63 = LOBYTE(v56->uFontHeight); - v124 += 4; - a4 = a4 + v63 - 3; + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pText); + window->DrawText(pFontSmallnum, 170, pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; } - while ( v124 < 40 ); } else { - i = 0; - do + for ( uint i = 0; i < 10; ++i ) { - sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", v85[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?" - window->DrawText(v56, 170, a4, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); - v65 = LOBYTE(v56->uFontHeight); - ++i; - a4 = a4 + v65 - 3; + sprintf(pTmpBuf.data(), "%s\f%05u\t070%s\n", string_name[i], 0, pGlobalTXT_LocalizationStrings[630]); // "?" + window->DrawText(pFontSmallnum, 170, pTextHeight, TargetColor(0xE1u, 255, 0x9Bu), pTmpBuf.data(), 0, 0, 0); + pTextHeight = pTextHeight + LOBYTE(pFontSmallnum->uFontHeight) - 3; } - while ( i < 10 ); } if ( (signed __int64)pParty->pPartyBuffs[PARTY_BUFF_DETECT_LIFE].uExpireTime > 0 ) { - sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], pActors[uActorID].sCurrentHP); + sprintf(pTmpBuf.data(), "%s: %d", pGlobalTXT_LocalizationStrings[650], pActors[uActorID].sCurrentHP);//Current Hit Points pFontSmallnum->GetLineWidth(pTmpBuf.data()); window->DrawTitleText(pFontSmallnum, 0, window->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf.data(), 3); }
--- a/Viewport.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/Viewport.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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_2.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/mm7_2.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -4295,6 +4295,10 @@ int window_total_width = client_width + window_borders_width, window_total_height = client_height + window_borders_height; + + if (GetMenu(hwnd)) + window_total_height += GetSystemMetrics(SM_CYMENU); + MoveWindow(hWnd, (GetSystemMetrics(SM_CXSCREEN) - window_total_width) / 2, (GetSystemMetrics(SM_CYSCREEN) - window_total_height) / 2, window_total_width, @@ -5111,6 +5115,7 @@ bool MM_Main(const wchar_t *pCmdLine) { IntegrityTest(); + char test[1024]; sprintfex(test, "^Pi[%s]: знахар^R[ь;ка;]", "Золтан");
--- a/mm7_4.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/mm7_4.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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 Tue Sep 24 23:18:38 2013 +0600 +++ b/mm7_5.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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 Tue Sep 24 23:18:38 2013 +0600 +++ b/mm7_6.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -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(); }
--- a/mm7_data.h Tue Sep 24 23:18:38 2013 +0600 +++ b/mm7_data.h Tue Sep 24 23:18:57 2013 +0600 @@ -4,6 +4,7 @@ #include "OSAPI.h" #include <array> #include <assert.h> +#include "NZIArray.h" typedef char _UNKNOWN; typedef unsigned int uint; @@ -283,44 +284,6 @@ return uint64(x) > uint64(x+y); } -template<class _Ty, - size_t _Size> -class NZIArray : std::array<_Ty, _Size> -{ -public: - reference ZerothIndex() - { - return std::array<_Ty, _Size>::operator [](0); - } - - reference operator[](size_type _Pos) - { // subscript nonmutable sequence -#if _ITERATOR_DEBUG_LEVEL == 2 - assert(_Pos != 0 && "not allowed to access zeroth element"); - -#elif _ITERATOR_DEBUG_LEVEL == 1 - _SCL_SECURE_VALIDATE_RANGE(_Pos != 0); -#endif /* _ITERATOR_DEBUG_LEVEL */ - - __analysis_assume(_Pos != 0); - - return std::array<_Ty, _Size>::operator [](_Pos); - } - - const_reference operator[](size_type _Pos) const - { // subscript nonmutable sequence -#if _ITERATOR_DEBUG_LEVEL == 2 - assert(_Pos != 0 && "not allowed to access zeroth element"); - -#elif _ITERATOR_DEBUG_LEVEL == 1 - _SCL_SECURE_VALIDATE_RANGE(_Pos != 0); -#endif /* _ITERATOR_DEBUG_LEVEL */ - - __analysis_assume(_Pos != 0); - - return std::array<_Ty, _Size>::operator [](_Pos); - } -}; //------------------------------------------------------------------------- // Data declarations
--- a/stru6.cpp Tue Sep 24 23:18:38 2013 +0600 +++ b/stru6.cpp Tue Sep 24 23:18:57 2013 +0600 @@ -918,7 +918,7 @@ if ( result < 545 ) { - __debugbreak(); // find out what kind of spells are these + //__debugbreak(); // find out what kind of spells are these // when summoned light elemental attacks //cast spell from trees in Avlee result -= 500;