Mercurial > mm7
changeset 1721:1c072d19e397
Слияние
author | Ritor1 |
---|---|
date | Wed, 25 Sep 2013 09:03:56 +0600 |
parents | 5f2583a4fa7d (current diff) e013b92030e3 (diff) |
children | e1c451f4d5ba |
files | UI/UIPopup.cpp Viewport.cpp mm7_data.h |
diffstat | 20 files changed, 393 insertions(+), 386 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Wed Sep 25 08:59:01 2013 +0600 +++ b/Actor.cpp Wed Sep 25 09:03:56 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/CastSpellInfo.cpp Wed Sep 25 08:59:01 2013 +0600 +++ b/CastSpellInfo.cpp Wed Sep 25 09:03:56 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 Wed Sep 25 08:59:01 2013 +0600 +++ b/Chest.cpp Wed Sep 25 09:03:56 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 Wed Sep 25 08:59:01 2013 +0600 +++ b/GUIWindow.cpp Wed Sep 25 09:03:56 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/Items.cpp Wed Sep 25 08:59:01 2013 +0600 +++ b/Items.cpp Wed Sep 25 09:03:56 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 Wed Sep 25 08:59:01 2013 +0600 +++ b/Items.h Wed Sep 25 09:03:56 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 Wed Sep 25 08:59:01 2013 +0600 +++ b/Mouse.cpp Wed Sep 25 09:03:56 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 Wed Sep 25 09:03:56 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 Wed Sep 25 08:59:01 2013 +0600 +++ b/Party.cpp Wed Sep 25 09:03:56 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 Wed Sep 25 08:59:01 2013 +0600 +++ b/Player.cpp Wed Sep 25 09:03:56 2013 +0600 @@ -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]; @@ -2123,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 ) @@ -2154,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) @@ -2179,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 @@ -2253,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(); } @@ -2332,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++ ) @@ -2348,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++ ) @@ -2365,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++ ) @@ -2505,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(); @@ -2607,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; @@ -2643,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); @@ -3098,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; @@ -3137,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 ) { @@ -3150,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; @@ -3175,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 ) @@ -3198,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; } @@ -3213,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; @@ -3739,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 ) { @@ -3771,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; @@ -4376,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 ) { @@ -4426,7 +4428,7 @@ return; } - if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_POTION ) + if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_POTION ) { switch ( pParty->pPickedItem.uItemID ) { @@ -4722,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; @@ -4766,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; @@ -4838,7 +4840,7 @@ return; } - if ( pItemsTable->pItems[pParty->pPickedItem.uItemID].uEquipType == EQUIP_MESSAGE_SCROLL ) + if ( pParty->pPickedItem.GetItemEquipType() == EQUIP_MESSAGE_SCROLL ) { if ( playerAffected->CanAct() ) { @@ -6236,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); @@ -7404,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 ) ) { @@ -7790,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 Wed Sep 25 08:59:01 2013 +0600 +++ b/UI/UICharacter.cpp Wed Sep 25 09:03:56 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 )
--- a/UI/UIHouses.cpp Wed Sep 25 08:59:01 2013 +0600 +++ b/UI/UIHouses.cpp Wed Sep 25 09:03:56 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 Wed Sep 25 08:59:01 2013 +0600 +++ b/UI/UIPopup.cpp Wed Sep 25 09:03:56 2013 +0600 @@ -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 ) { @@ -197,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 @@ -208,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; @@ -222,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; @@ -237,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; @@ -273,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 ) @@ -309,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; @@ -335,8 +335,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; @@ -401,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; @@ -415,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;
--- a/UI/UIRest.cpp Wed Sep 25 08:59:01 2013 +0600 +++ b/UI/UIRest.cpp Wed Sep 25 09:03:56 2013 +0600 @@ -19,176 +19,150 @@ //----- (0041F6C1) -------------------------------------------------------- void RestUI_Load() { - Player *v0; // eax@10 - - if ( !dword_506F14 ) - pAudioPlayer->StopChannels(-1, -1); - if ( pCurrentScreen != SCREEN_GAME) + if ( !dword_506F14 ) + pAudioPlayer->StopChannels(-1, -1); + if ( pCurrentScreen != SCREEN_GAME) + { + pGUIWindow_CurrentMenu->Release(); + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = true; + } + pEventTimer->Pause(); + if ( dword_506F14 != 2 ) + GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0); + _506F18_num_minutes_to_sleep = 0; + dword_506F14 = 0; + uRestUI_FoodRequiredToRest = 2; + if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) + uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); + if ( PartyHasDragon() ) + { + for ( uint i = 0; i < 4; ++i ) { - pGUIWindow_CurrentMenu->Release(); - pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = true; + if (pParty->pPlayers[i].classType == PLAYER_CLASS_WARLOCK) + ++uRestUI_FoodRequiredToRest; } - pEventTimer->Pause(); - if ( dword_506F14 != 2 ) - GUIWindow::Create(518, 450, 0, 0, WINDOW_PressedButton2, (int)pBtn_Rest, 0); - _506F18_num_minutes_to_sleep = 0; - dword_506F14 = 0; - uRestUI_FoodRequiredToRest = 2; - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) - uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); - if ( PartyHasDragon() ) - { - v0 = pParty->pPlayers;//[0].uClass; - while ( v0 <= &pParty->pPlayers[3] ) - { - ++v0; - if ( v0 > &pParty->pPlayers[3] ) - break; - } - if(v0->classType == PLAYER_CLASS_WARLOCK) - ++uRestUI_FoodRequiredToRest; - } - if ( CheckHiredNPCSpeciality(Porter) ) - --uRestUI_FoodRequiredToRest; - if ( CheckHiredNPCSpeciality(QuarterMaster) ) - uRestUI_FoodRequiredToRest -= 2; - if ( CheckHiredNPCSpeciality(Gypsy) ) - --uRestUI_FoodRequiredToRest; - if ( uRestUI_FoodRequiredToRest < 1 ) - uRestUI_FoodRequiredToRest = 1; - if ( !_stricmp(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) ) - uRestUI_FoodRequiredToRest = 0; + } + if ( CheckHiredNPCSpeciality(Porter) ) + --uRestUI_FoodRequiredToRest; + if ( CheckHiredNPCSpeciality(QuarterMaster) ) + uRestUI_FoodRequiredToRest -= 2; + if ( CheckHiredNPCSpeciality(Gypsy) ) + --uRestUI_FoodRequiredToRest; + if ( uRestUI_FoodRequiredToRest < 1 ) + uRestUI_FoodRequiredToRest = 1; + if ( !_stricmp(pCurrentMapName, "d29.blv") && _449B57_test_bit(pParty->_quest_bits, 98) )// + uRestUI_FoodRequiredToRest = 0; + + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - - pCurrentScreen = SCREEN_REST; - _507CD4_RestUI_hourglass_anim_controller = 0; - uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE); - uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE); - uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE); - uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE); - uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE); - uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE); - - LoadActualSkyFrame(); - - pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Rest, 0, 0); - pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0); - pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0); - pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0); - pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0); - pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0); + pCurrentScreen = SCREEN_REST; + _507CD4_RestUI_hourglass_anim_controller = 0; + uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE); + uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE); + uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE); + uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE); + uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE); + uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE); + LoadActualSkyFrame(); + pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Rest, 0, 0); + pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton(280, 297, 154, 37, 1, 0, UIMSG_ExitRest, 0, 0, "", pIcons_LOD->GetTexture(uTextureID_RestUI_restexit), 0); + pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton( 24, 154, 225, 37, 1, 0, UIMSG_Rest8Hour, 0, 'R', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb4), 0); + pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61, 232, 154, 33, 1, 0, UIMSG_AlreadyResting, 0, 'D', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb1), 0); + pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton( 61, 264, 154, 33, 1, 0, UIMSG_Wait1Hour, 0, 'H', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb2), 0); + pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton( 61, 296, 154, 33, 1, 0, UIMSG_Wait5Minutes, 0, 'M', "", pIcons_LOD->GetTexture(uTextureID_RestUI_restb3), 0); } //----- (0041FA01) -------------------------------------------------------- void RestUI_Draw() { - int live_characters; // esi@1 - unsigned int v3; // eax@15 - //char v4; // al@17 - bool v5; // eax@21 - GUIButton tmp_button; // [sp+8h] [bp-DCh]@19 - //double v7; // [sp+C4h] [bp-20h]@17 - float v8; // [sp+CCh] [bp-18h]@17 - __int64 v9; // [sp+D0h] [bp-14h]@17 - unsigned int am_pm_hours; // [sp+D8h] [bp-Ch]@9 - __int16 shadow_color; // [sp+DCh] [bp-8h]@1 - int text_color; // [sp+E0h] [bp-4h]@1 + int live_characters; // esi@1 + unsigned int v3; // eax@15 + GUIButton tmp_button; // [sp+8h] [bp-DCh]@19 + unsigned int am_pm_hours; // [sp+D8h] [bp-Ch]@9 + + live_characters = 0; + for( int i = 1; i < 5; ++i ) + if ( !pPlayers[i]->IsDead() && !pPlayers[i]->IsEradicated() && pPlayers[i]->sHealth > 0 ) + ++live_characters; - live_characters = 0; - text_color = TargetColor(10, 0, 0); - shadow_color = TargetColor(230, 214, 193); - for(int i=1; i<5; ++i) - if ( !pPlayers[i]->IsDead() && !pPlayers[i]->IsEradicated() && pPlayers[i]->sHealth > 0 ) - ++live_characters; + if ( live_characters ) + { + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_RestUI_restmain)); + am_pm_hours = pParty->uCurrentHour; + dword_506F1C = pGUIWindow_CurrentMenu->pCurrentPosActiveItem; + if ( (signed int)pParty->uCurrentHour <= 12 ) + { + if ( !am_pm_hours ) + am_pm_hours = 12; + } + else + am_pm_hours -= 12; + pRenderer->DrawTextureIndexed(16, 26, pTexture_RestUI_CurrentSkyFrame); + if ( pTexture_RestUI_CurrentHourglassFrame ) + { + pTexture_RestUI_CurrentHourglassFrame->Release(); + pIcons_LOD->SyncLoadedFilesCount(); + } + v3 = pEventTimer->uTimeElapsed + _507CD4_RestUI_hourglass_anim_controller; + _507CD4_RestUI_hourglass_anim_controller += pEventTimer->uTimeElapsed; + if ( (unsigned int)_507CD4_RestUI_hourglass_anim_controller >= 512 ) + { + v3 = 0; + _507CD4_RestUI_hourglass_anim_controller = 0; + } + hourglass_icon_idx = (int)floorf(((double)v3 / 512.0 * 120.0) + 0.5f) % 256 + 1; + if (hourglass_icon_idx >= 120 ) + hourglass_icon_idx = 1; - if ( live_characters ) - { - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_RestUI_restmain)); - am_pm_hours = pParty->uCurrentHour; - dword_506F1C = pGUIWindow_CurrentMenu->pCurrentPosActiveItem; - if ( (signed int)pParty->uCurrentHour <= 12 ) - { - if ( !am_pm_hours ) - am_pm_hours = 12; - } - else - { - am_pm_hours -= 12; - } - pRenderer->DrawTextureIndexed(16u, 26u, pTexture_RestUI_CurrentSkyFrame); - if ( pTexture_RestUI_CurrentHourglassFrame ) - { - pTexture_RestUI_CurrentHourglassFrame->Release(); - pIcons_LOD->SyncLoadedFilesCount(); - } - v3 = pEventTimer->uTimeElapsed + _507CD4_RestUI_hourglass_anim_controller; - _507CD4_RestUI_hourglass_anim_controller += pEventTimer->uTimeElapsed; - if ( (unsigned int)_507CD4_RestUI_hourglass_anim_controller >= 512 ) - { - v3 = 0; - _507CD4_RestUI_hourglass_anim_controller = 0; - } - v9 = v3; - v8 = (double)v3 / 512.0 * 120.0; - //v7 = v8 + 6.7553994e15; - HIDWORD(v9) = floorf(v8 + 0.5f);//LODWORD(v7); - hourglass_icon_idx = (int)floorf(v8 + 0.5f) % 256 + 1;//LOBYTE(v7) + 1; - //hourglass_icon_idx = v4; - if (hourglass_icon_idx >= 120 ) - hourglass_icon_idx = 1; + sprintf(pTmpBuf.data(), "hglas%03d", hourglass_icon_idx); + pTexture_RestUI_CurrentHourglassFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); + pRenderer->DrawTextureIndexed(267, 159, pTexture_RestUI_CurrentHourglassFrame); + memset(&tmp_button, 0, sizeof(GUIButton)); + tmp_button.uX = 24; + tmp_button.uY = 154; + tmp_button.uZ = 194; + tmp_button.uW = 190; + tmp_button.uWidth = 171; + tmp_button.uHeight = 37; + tmp_button.pParent = pButton_RestUI_WaitUntilDawn->pParent; + tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, TargetColor(10, 0, 0), TargetColor(230, 214, 193));// 8 + tmp_button.pParent = 0; - sprintf(pTmpBuf.data(), "hglas%03d", hourglass_icon_idx); - pTexture_RestUI_CurrentHourglassFrame = pIcons_LOD->LoadTexturePtr(pTmpBuf.data(), TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(267, 159, pTexture_RestUI_CurrentHourglassFrame); - memset(&tmp_button, 0, sizeof(GUIButton)); - tmp_button.uX = 24; - tmp_button.uY = 154; + sprintf(pTmpBuf.data(), "\r408%d", uRestUI_FoodRequiredToRest); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, TargetColor(10, 0, 0), pTmpBuf.data(), 0, 0, TargetColor(230, 214, 193)); + + pButton_RestUI_WaitUntilDawn->DrawLabel(pGlobalTXT_LocalizationStrings[237], pFontCreate, TargetColor(10, 0, 0), TargetColor(230, 214, 193));// + pButton_RestUI_Wait1Hour->DrawLabel(pGlobalTXT_LocalizationStrings[239], pFontCreate, TargetColor(10, 0, 0), TargetColor(230, 214, 193));// 1 + pButton_RestUI_Wait5Minutes->DrawLabel(pGlobalTXT_LocalizationStrings[238], pFontCreate, TargetColor(10, 0, 0), TargetColor(230, 214, 193));// 5 + pButton_RestUI_Exit->DrawLabel(pGlobalTXT_LocalizationStrings[81], pFontCreate, TargetColor(10, 0, 0), TargetColor(230, 214, 193));// + memset(&tmp_button, 0, sizeof(GUIButton)); + tmp_button.uX = 45; + tmp_button.uY = 199; - tmp_button.uZ = 194; - tmp_button.uW = 190; - - tmp_button.uWidth = 171; - tmp_button.uHeight = 37; + tmp_button.uZ = 229; + tmp_button.uW = 228; - tmp_button.pParent = pButton_RestUI_WaitUntilDawn->pParent; - tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, text_color, shadow_color); - tmp_button.pParent = 0; - sprintf(pTmpBuf.data(), "\r408%d", uRestUI_FoodRequiredToRest); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, text_color, pTmpBuf.data(), 0, 0, shadow_color); - pButton_RestUI_WaitUntilDawn->DrawLabel(pGlobalTXT_LocalizationStrings[237], pFontCreate, text_color, shadow_color); - pButton_RestUI_Wait1Hour->DrawLabel(pGlobalTXT_LocalizationStrings[239], pFontCreate, text_color, shadow_color); - pButton_RestUI_Wait5Minutes->DrawLabel(pGlobalTXT_LocalizationStrings[238], pFontCreate, text_color, shadow_color); - pButton_RestUI_Exit->DrawLabel(pGlobalTXT_LocalizationStrings[81], pFontCreate, text_color, shadow_color); - memset(&tmp_button, 0, sizeof(GUIButton)); - tmp_button.uX = 45; - tmp_button.uY = 199; - - tmp_button.uZ = 229; - tmp_button.uW = 228; + tmp_button.uWidth = 185; + tmp_button.uHeight = 30; - tmp_button.uWidth = 185; - tmp_button.uHeight = 30; - - tmp_button.pParent = pButton_RestUI_WaitUntilDawn->pParent; - tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[236], pFontCreate, text_color, shadow_color); - tmp_button.pParent = 0; - v5 = (pParty->uCurrentHour >= 12 && pParty->uCurrentHour < 24)? 1:0; - sprintf(pTmpBuf.data(), "%d:%02d %s", am_pm_hours, pParty->uCurrentMinute, aAMPMNames[v5]); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 368, 168, text_color, pTmpBuf.data(), 0, 0, shadow_color); - sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[56], pParty->uDaysPlayed + 1); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, text_color, pTmpBuf.data(), 0, 0, shadow_color); - sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, text_color, pTmpBuf.data(), 0, 0, shadow_color); - sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); - pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, text_color, pTmpBuf.data(), 0, 0, shadow_color); - if ( dword_506F14 ) - Sleep6Hours(); - } - else - GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, + tmp_button.pParent = pButton_RestUI_WaitUntilDawn->pParent; + tmp_button.DrawLabel(pGlobalTXT_LocalizationStrings[236], pFontCreate, TargetColor(10, 0, 0), TargetColor(230, 214, 193));// + tmp_button.pParent = 0; + sprintf(pTmpBuf.data(), "%d:%02d %s", am_pm_hours, pParty->uCurrentMinute, aAMPMNames[(pParty->uCurrentHour >= 12 && pParty->uCurrentHour < 24)? 1:0]); + pGUIWindow_CurrentMenu->DrawText(pFontCreate, 368, 168, TargetColor(10, 0, 0), pTmpBuf.data(), 0, 0, TargetColor(230, 214, 193)); + sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[56], pParty->uDaysPlayed + 1);// + pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, TargetColor(10, 0, 0), pTmpBuf.data(), 0, 0, TargetColor(230, 214, 193)); + sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1);// + pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, TargetColor(10, 0, 0), pTmpBuf.data(), 0, 0, TargetColor(230, 214, 193)); + sprintf(pTmpBuf.data(), "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear);// + pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, TargetColor(10, 0, 0), pTmpBuf.data(), 0, 0, TargetColor(230, 214, 193)); + if ( dword_506F14 ) + Sleep6Hours(); + } + else + GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, WINDOW_CloseRestWindowBtn, (int)pButton_RestUI_Exit, pGlobalTXT_LocalizationStrings[81]); // "Exit Rest" - } \ No newline at end of file +} \ No newline at end of file
--- a/UI/UISaveLoad.cpp Wed Sep 25 08:59:01 2013 +0600 +++ b/UI/UISaveLoad.cpp Wed Sep 25 09:03:56 2013 +0600 @@ -21,7 +21,7 @@ //----- (004601B7) -------------------------------------------------------- static void UI_DrawSaveLoad(bool save) { - unsigned __int16 v1; // bx@1 + //unsigned __int16 v1; // bx@1 unsigned int v2; // edi@4 unsigned int v3; // eax@4 unsigned int v4; // eax@8 @@ -38,32 +38,23 @@ __int64 pOurHour; // qax@10 int v16; // edi@10 signed int pHour; // ebx@22 - //const char *v18; // ST14_4@32 int v19; // eax@32 const char *v20; // ST18_4@32 int v21; // eax@32 - //const char *v22; // ST14_4@32 int v23; // eax@32 const char *pSlotName; // edi@36 int v25; // eax@43 GUIWindow pWindow; // [sp+Ch] [bp-78h]@8 - /*unsigned int Dst; // [sp+Ch] [bp-78h]@8 - unsigned int v27; // [sp+10h] [bp-74h]@8 - int v28; // [sp+14h] [bp-70h]@8 - int v29; // [sp+18h] [bp-6Ch]@8 - unsigned int v30; // [sp+1Ch] [bp-68h]@8 - unsigned int v31; // [sp+20h] [bp-64h]@8*/ int pMinutes; // [sp+60h] [bp-24h]@10 int pMonthNum; // [sp+68h] [bp-1Ch]@10 unsigned int pSaveFiles; // [sp+70h] [bp-14h]@10 __int64 pAMPM2; // [sp+74h] [bp-10h]@10 int pYear; // [sp+7Ch] [bp-8h]@10 - //int a4; // [sp+80h] [bp-4h]@1 int pFilesID; - v1 = 255; - TargetColor(0xFF, 0xFF, 0xFF); - TargetColor(0xFF, 0xFF, 0x9B); + //v1 = 255; + //TargetColor(0xFF, 0xFF, 0xFF); + //TargetColor(0xFF, 0xFF, 0x9B); pRenderer->BeginScene(); if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LoadingProcInMainMenu ) { @@ -81,7 +72,6 @@ pRenderer->DrawTextureIndexed(241, 302, pIcons_LOD->GetTexture(v3)); pRenderer->DrawTextureIndexed( 18, 139, pIcons_LOD->GetTexture(v2)); pRenderer->DrawTextureIndexed(351, 302, pIcons_LOD->GetTexture(uTextureID_x_u)); - v1 = 255; } if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) { @@ -149,7 +139,7 @@ //sprintf(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", _d, v17, (int)32, _a, 3, _m, pFilesID); sprintfex(pTmpBuf.data(), "%s %d:%02d%s\n%d %s %d", day, pHour, pMinutes, ampm, 7 * v16 + HIDWORD(pOurHour) % 7 + 1, month, pYear); pWindow.DrawTitleText(pFontSmallnum, 0, 0, 0, pTmpBuf.data(), 3u); - v1 = 255; + //v1 = 255; } if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 == WINDOW_INPUT_CONFIRMED) { @@ -188,7 +178,7 @@ if ( pFilesID >= (signed int)pSaveFiles ) break; short clr; - HIDWORD(pAMPM2) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? TargetColor(v1, v1, 0x64) : 0); + HIDWORD(pAMPM2) = clr = (pFilesID == uLoadGameUI_SelectedSlot ? TargetColor(0xFF, 0xFF, 0x64) : 0); if ( pGUIWindow_CurrentMenu->receives_keyboard_input_2 != WINDOW_INPUT_IN_PROGRESS || pFilesID != uLoadGameUI_SelectedSlot ) { pGUIWindow_CurrentMenu->DrawTextInRect(pFontSmallnum, 0x1B, a4, clr, pSlotName, 185, 0);
--- a/Viewport.cpp Wed Sep 25 08:59:01 2013 +0600 +++ b/Viewport.cpp Wed Sep 25 09:03:56 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_4.cpp Wed Sep 25 08:59:01 2013 +0600 +++ b/mm7_4.cpp Wed Sep 25 09:03:56 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 Wed Sep 25 08:59:01 2013 +0600 +++ b/mm7_5.cpp Wed Sep 25 09:03:56 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 Wed Sep 25 08:59:01 2013 +0600 +++ b/mm7_6.cpp Wed Sep 25 09:03:56 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 Wed Sep 25 08:59:01 2013 +0600 +++ b/mm7_data.h Wed Sep 25 09:03:56 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