diff --git a/src/Application/Game.cpp b/src/Application/Game.cpp index 4da292a8646..f3293dea269 100644 --- a/src/Application/Game.cpp +++ b/src/Application/Game.cpp @@ -539,7 +539,7 @@ void Game::processQueuedMessages() { } if (ptr_50C9A4_ItemToEnchant && ptr_50C9A4_ItemToEnchant->itemId != ITEM_NULL) { - ptr_50C9A4_ItemToEnchant->uAttributes &= ~ITEM_ENCHANT_ANIMATION_MASK; + ptr_50C9A4_ItemToEnchant->flags &= ~ITEM_ENCHANT_ANIMATION_MASK; ItemEnchantmentTimer = 0_ticks; ptr_50C9A4_ItemToEnchant = nullptr; } diff --git a/src/Engine/Engine.cpp b/src/Engine/Engine.cpp index c2a865ad995..514a19836d0 100644 --- a/src/Engine/Engine.cpp +++ b/src/Engine/Engine.cpp @@ -1426,7 +1426,7 @@ void RegeneratePartyHealthMana() { if (character.classType == CLASS_LICH) { bool lich_has_jar = false; for (const ItemGen &item : character.pInventoryItemList) - if (item.itemId == ITEM_QUEST_LICH_JAR_FULL && item.uHolderPlayer == character.getCharacterIndex()) + if (item.itemId == ITEM_QUEST_LICH_JAR_FULL && item.lichJarCharacterIndex == character.getCharacterIndex()) lich_has_jar = true; if (lich_has_jar) { diff --git a/src/Engine/Objects/Actor.cpp b/src/Engine/Objects/Actor.cpp index 88f95685540..dd87f19d48d 100644 --- a/src/Engine/Objects/Actor.cpp +++ b/src/Engine/Objects/Actor.cpp @@ -3579,8 +3579,8 @@ void Actor::LootActor() { StatusBarItemFound(foundGold, pItemTable->pItems[Dst.itemId].pUnidentifiedName); if (Dst.isWand()) { - Dst.uNumCharges = grng->random(6) + Dst.GetDamageMod() + 1; - Dst.uMaxCharges = Dst.uNumCharges; + Dst.numCharges = grng->random(6) + Dst.GetDamageMod() + 1; + Dst.maxCharges = Dst.numCharges; } if (Dst.isPotion() && Dst.itemId != ITEM_POTION_BOTTLE) { Dst.potionPower = 2 * grng->random(4) + 2; diff --git a/src/Engine/Objects/Character.cpp b/src/Engine/Objects/Character.cpp index af0d3292c8d..b5430d9622a 100644 --- a/src/Engine/Objects/Character.cpp +++ b/src/Engine/Objects/Character.cpp @@ -410,14 +410,14 @@ void Character::ItemsPotionDmgBreak(int enchant_count) { int indexbreak = item_index_tabl[grng->random(avalible_items)]; // random item - if (!(pInventoryItemList[indexbreak].uAttributes & + if (!(pInventoryItemList[indexbreak].flags & ITEM_HARDENED)) // if its not hardened - pInventoryItemList[indexbreak].uAttributes |= + pInventoryItemList[indexbreak].flags |= ITEM_BROKEN; // break it } } else { for (int i = 0; i < avalible_items; ++i) { // break everything - pInventoryItemList[item_index_tabl[i]].uAttributes |= + pInventoryItemList[item_index_tabl[i]].flags |= ITEM_BROKEN; } } @@ -676,7 +676,7 @@ void Character::WearItem(ItemId uItemID) { pInventoryItemList[item_indx].itemId = uItemID; ItemSlot item_body_anch = pEquipTypeToBodyAnchor[pItemTable->pItems[uItemID].uEquipType]; pEquipment[item_body_anch] = item_indx + 1; - pInventoryItemList[item_indx].uBodyAnchor = item_body_anch; + pInventoryItemList[item_indx].equippedSlot = item_body_anch; } } @@ -1544,8 +1544,8 @@ StealResult Character::StealFromActor(unsigned int uActorID, int _steal_perm, in actroPtr->carriedItemId = ITEM_NULL; tempItem.itemId = carriedItemId; if (pItemTable->pItems[carriedItemId].uEquipType == ITEM_TYPE_WAND) { - tempItem.uNumCharges = grng->random(6) + pItemTable->pItems[carriedItemId].uDamageMod + 1; - tempItem.uMaxCharges = tempItem.uNumCharges; + tempItem.numCharges = grng->random(6) + pItemTable->pItems[carriedItemId].uDamageMod + 1; + tempItem.maxCharges = tempItem.numCharges; } else if (pItemTable->pItems[carriedItemId].uEquipType == ITEM_TYPE_POTION && carriedItemId != ITEM_POTION_BOTTLE) { tempItem.potionPower = 2 * grng->random(4) + 2; } @@ -1608,7 +1608,7 @@ int Character::receiveDamage(signed int amount, DamageType dmg_type) { if (health <= -10) { // break armor if health has dropped below -10 ItemGen *equippedArmor = GetArmorItem(); if (equippedArmor != nullptr) { // check there is some armor - if (!(equippedArmor->uAttributes & + if (!(equippedArmor->flags & ITEM_HARDENED)) { // if its not hardened equippedArmor->SetBroken(); // break it } @@ -1902,7 +1902,7 @@ int Character::ReceiveSpecialAttackEffect(SpecialAttackType attType, Actor *pAct case SPECIAL_ATTACK_BREAK_ANY: case SPECIAL_ATTACK_BREAK_ARMOR: case SPECIAL_ATTACK_BREAK_WEAPON: - if (!(itemtobreak->uAttributes & ITEM_HARDENED)) { + if (!(itemtobreak->flags & ITEM_HARDENED)) { playReaction(SPEECH_ITEM_BROKEN); itemtobreak->SetBroken(); pAudioPlayer->playUISound(SOUND_metal_vs_metal03h); @@ -4377,7 +4377,7 @@ void Character::SetVariable(EvtVariable var_type, signed int var_value) { for (int i = 0; i < INVENTORY_SLOT_COUNT; i++) { if (this->pInventoryItemList[i].itemId == ITEM_QUEST_LICH_JAR_EMPTY) { this->pInventoryItemList[i].itemId = ITEM_QUEST_LICH_JAR_FULL; - this->pInventoryItemList[i].uHolderPlayer = getCharacterIndex(); + this->pInventoryItemList[i].lichJarCharacterIndex = getCharacterIndex(); } } if (this->sResFireBase < 20) this->sResFireBase = 20; @@ -4454,7 +4454,7 @@ void Character::SetVariable(EvtVariable var_type, signed int var_value) { case VAR_PlayerItemInHands: item.Reset(); item.itemId = ItemId(var_value); - item.uAttributes = ITEM_IDENTIFIED; + item.flags = ITEM_IDENTIFIED; pParty->setHoldingItem(&item); if (isSpawnableArtifact(ItemId(var_value))) pParty->pIsArtifactFound[ItemId(var_value)] = true; @@ -5063,13 +5063,13 @@ void Character::AddVariable(EvtVariable var_type, signed int val) { return; case VAR_PlayerItemInHands: item.Reset(); - item.uAttributes = ITEM_IDENTIFIED; + item.flags = ITEM_IDENTIFIED; item.itemId = ItemId(val); if (isSpawnableArtifact(ItemId(val))) { pParty->pIsArtifactFound[ItemId(val)] = true; } else if (isWand(ItemId(val))) { - item.uNumCharges = grng->random(6) + item.GetDamageMod() + 1; - item.uMaxCharges = item.uNumCharges; + item.numCharges = grng->random(6) + item.GetDamageMod() + 1; + item.maxCharges = item.numCharges; } pParty->setHoldingItem(&item); return; @@ -6101,16 +6101,16 @@ void Character::EquipBody(ItemType uEquipType) { itemInvLocation = pParty->activeCharacter().pEquipment[itemAnchor]; if (itemInvLocation) { //переодеться в другую вещь tempPickedItem = pParty->pPickedItem; - pParty->activeCharacter().pInventoryItemList[itemInvLocation - 1].uBodyAnchor = ITEM_SLOT_INVALID; + pParty->activeCharacter().pInventoryItemList[itemInvLocation - 1].equippedSlot = ITEM_SLOT_INVALID; pParty->pPickedItem.Reset(); pParty->setHoldingItem(&pParty->activeCharacter().pInventoryItemList[itemInvLocation - 1]); - tempPickedItem.uBodyAnchor = itemAnchor; + tempPickedItem.equippedSlot = itemAnchor; pParty->activeCharacter().pInventoryItemList[itemInvLocation - 1] = tempPickedItem; pParty->activeCharacter().pEquipment[itemAnchor] = itemInvLocation; } else { // одеть вещь freeSlot = pParty->activeCharacter().findFreeInventoryListSlot(); if (freeSlot >= 0) { - pParty->pPickedItem.uBodyAnchor = itemAnchor; + pParty->pPickedItem.equippedSlot = itemAnchor; pParty->activeCharacter().pInventoryItemList[freeSlot] = pParty->pPickedItem; pParty->activeCharacter().pEquipment[itemAnchor] = freeSlot + 1; mouse->RemoveHoldingItem(); @@ -6843,7 +6843,7 @@ void Character::_42ECB5_CharacterAttacksActor() { // v28b = &v1->pInventoryItems[v4].uItemID; // v6 = v1->pInventoryItems[v4].uItemID;//*((int *)v5 + 124); if (item->isWand()) { - if (item->uNumCharges <= 0) + if (item->numCharges <= 0) character->pEquipment[ITEM_SLOT_MAIN_HAND] = 0; // wand discharged - unequip else @@ -6898,7 +6898,7 @@ void Character::_42ECB5_CharacterAttacksActor() { pushSpellOrRangedAttack(spellForWand(character->pInventoryItemList[main_hand_idx - 1].itemId), pParty->activeCharacterIndex() - 1, WANDS_SKILL_VALUE, 0, pParty->activeCharacterIndex() + 8); - if (!--character->pInventoryItemList[main_hand_idx - 1].uNumCharges) + if (!--character->pInventoryItemList[main_hand_idx - 1].numCharges) character->pEquipment[ITEM_SLOT_MAIN_HAND] = 0; } else if (target_type == OBJECT_Actor && actor_distance <= 407.2) { melee_attack = true; diff --git a/src/Engine/Objects/Chest.cpp b/src/Engine/Objects/Chest.cpp index d92102fc2da..c7b0f941eff 100644 --- a/src/Engine/Objects/Chest.cpp +++ b/src/Engine/Objects/Chest.cpp @@ -340,10 +340,10 @@ int Chest::PutItemInChest(int position, ItemGen *put_item, int uChestID) { void Chest::PlaceItemAt(unsigned int put_cell_pos, unsigned int item_at_cell, int uChestID) { // only used for setup? ItemId uItemID = vChests[uChestID].igChestItems[item_at_cell].itemId; pItemTable->SetSpecialBonus(&vChests[uChestID].igChestItems[item_at_cell]); - if (isWand(uItemID) && !vChests[uChestID].igChestItems[item_at_cell].uNumCharges) { + if (isWand(uItemID) && !vChests[uChestID].igChestItems[item_at_cell].numCharges) { int v6 = grng->random(21) + 10; - vChests[uChestID].igChestItems[item_at_cell].uNumCharges = v6; - vChests[uChestID].igChestItems[item_at_cell].uMaxCharges = v6; + vChests[uChestID].igChestItems[item_at_cell].numCharges = v6; + vChests[uChestID].igChestItems[item_at_cell].maxCharges = v6; } auto img = assets->getImage_Alpha(pItemTable->pItems[uItemID].iconName); diff --git a/src/Engine/Objects/Items.cpp b/src/Engine/Objects/Items.cpp index 9490b3e7892..6153fbc1826 100644 --- a/src/Engine/Objects/Items.cpp +++ b/src/Engine/Objects/Items.cpp @@ -144,11 +144,11 @@ void ItemGen::Reset() { //----- (00458260) -------------------------------------------------------- void ItemGen::UpdateTempBonus(Time time) { - if (this->uAttributes & ITEM_TEMP_BONUS) { - if (time > this->uExpireTime) { + if (this->flags & ITEM_TEMP_BONUS) { + if (time > this->enchantmentExpirationTime) { this->attributeEnchantment = {}; this->specialEnchantment = ITEM_ENCHANTMENT_NULL; - this->uAttributes &= ~ITEM_TEMP_BONUS; + this->flags &= ~ITEM_TEMP_BONUS; } } } @@ -156,7 +156,7 @@ void ItemGen::UpdateTempBonus(Time time) { //----- (00456442) -------------------------------------------------------- int ItemGen::GetValue() const { int uBaseValue = pItemTable->pItems[this->itemId].uValue; - if (uAttributes & ITEM_TEMP_BONUS || pItemTable->IsMaterialNonCommon(this)) + if (flags & ITEM_TEMP_BONUS || pItemTable->IsMaterialNonCommon(this)) return uBaseValue; if (potionPower || attributeEnchantment) // TODO(captainurist): can drop potionPower? return uBaseValue + 100 * attributeEnchantmentStrength; @@ -190,8 +190,8 @@ std::string ItemGen::GetIdentifiedName() { } if (itemId == ITEM_QUEST_LICH_JAR_FULL) { // Lich Jar - if (uHolderPlayer >= 0 && uHolderPlayer < pParty->pCharacters.size()) { - const std::string &player_name = pParty->pCharacters[uHolderPlayer].name; + if (lichJarCharacterIndex >= 0 && lichJarCharacterIndex < pParty->pCharacters.size()) { + const std::string &player_name = pParty->pCharacters[lichJarCharacterIndex].name; if (player_name.back() == 's') return localization->FormatString(LSTR_FMT_JAR_2, player_name); else diff --git a/src/Engine/Objects/Items.h b/src/Engine/Objects/Items.h index 9a52975c605..1a0f7b34eae 100644 --- a/src/Engine/Objects/Items.h +++ b/src/Engine/Objects/Items.h @@ -24,31 +24,31 @@ struct ItemGen { // 0x24 void GetItemBonusArtifact(const Character *owner, CharacterAttribute attrToGet, int *bonusSum) const; void GetItemBonusSpecialEnchantment(const Character *owner, CharacterAttribute attrToGet, int *additiveBonus, int *halfSkillBonus) const; - inline void ResetEnchantAnimation() { uAttributes &= ~ITEM_ENCHANT_ANIMATION_MASK; } + inline void ResetEnchantAnimation() { flags &= ~ITEM_ENCHANT_ANIMATION_MASK; } inline bool ItemEnchanted() const { - return uAttributes & ITEM_ENCHANT_ANIMATION_MASK; + return flags & ITEM_ENCHANT_ANIMATION_MASK; } inline bool AuraEffectRed() const { - return (uAttributes & ITEM_ENCHANT_ANIMATION_MASK) == ITEM_AURA_EFFECT_RED; + return (flags & ITEM_ENCHANT_ANIMATION_MASK) == ITEM_AURA_EFFECT_RED; } inline bool AuraEffectBlue() const { - return (uAttributes & ITEM_ENCHANT_ANIMATION_MASK) == ITEM_AURA_EFFECT_BLUE; + return (flags & ITEM_ENCHANT_ANIMATION_MASK) == ITEM_AURA_EFFECT_BLUE; } inline bool AuraEffectGreen() const { - return (uAttributes & ITEM_ENCHANT_ANIMATION_MASK) == ITEM_AURA_EFFECT_GREEN; + return (flags & ITEM_ENCHANT_ANIMATION_MASK) == ITEM_AURA_EFFECT_GREEN; } inline bool AuraEffectPurple() const { - return (uAttributes & ITEM_ENCHANT_ANIMATION_MASK) == ITEM_AURA_EFFECT_PURPLE; + return (flags & ITEM_ENCHANT_ANIMATION_MASK) == ITEM_AURA_EFFECT_PURPLE; } bool IsRegularEnchanmentForAttribute(CharacterAttribute attrToGet); - inline bool IsBroken() const { return uAttributes & ITEM_BROKEN; } - inline void SetBroken() { uAttributes |= ITEM_BROKEN; } - inline bool IsIdentified() const { return uAttributes & ITEM_IDENTIFIED; } - inline void SetIdentified() { uAttributes |= ITEM_IDENTIFIED; } - inline bool IsStolen() const { return uAttributes & ITEM_STOLEN; } - inline void SetStolen() { uAttributes |= ITEM_STOLEN; } + inline bool IsBroken() const { return flags & ITEM_BROKEN; } + inline void SetBroken() { flags |= ITEM_BROKEN; } + inline bool IsIdentified() const { return flags & ITEM_IDENTIFIED; } + inline void SetIdentified() { flags |= ITEM_IDENTIFIED; } + inline bool IsStolen() const { return flags & ITEM_STOLEN; } + inline void SetStolen() { flags |= ITEM_STOLEN; } bool GenerateArtifact(); void generateGold(ItemTreasureLevel treasureLevel); @@ -111,20 +111,19 @@ struct ItemGen { // 0x24 // TODO(captainurist): introduce ATTRIBUTE_NULL? std::optional attributeEnchantment; // Attribute enchantment, if any. - int32_t attributeEnchantmentStrength = 0; // Attribute enchantment strength - bonus value for the attribute. - + int attributeEnchantmentStrength = 0; // Attribute enchantment strength - bonus value for the attribute. ItemEnchantment specialEnchantment = ITEM_ENCHANTMENT_NULL; // Special named enchantment, if any. - int32_t uNumCharges = 0; // Number of wand charges, wand disappears when this gets down to 0. - ItemFlags uAttributes = 0; // Item flags. - ItemSlot uBodyAnchor = ITEM_SLOT_INVALID; // For equipped items - where is it equipped. - uint8_t uMaxCharges = 0; // Max charges in a wand. This is used when recharging. - int8_t uHolderPlayer = -1; // Only for full lich jars. 0-based index of the character whose earthly remains are stored in it. - // Or whatever it is that's in the lich jar. + int numCharges = 0; // Number of wand charges, wand disappears when this gets down to 0. + int maxCharges = 0; // Max charges in a wand. This is used when recharging. + ItemFlags flags = 0; // Item flags. + ItemSlot equippedSlot = ITEM_SLOT_INVALID; // For equipped items - where is it equipped. + int lichJarCharacterIndex = -1; // Only for full lich jars. 0-based index of the character whose earthly remains are stored in it. + // Or whatever it is that's in the lich jar. bool placedInChest = false; // OE addition, whether the item was placed in the chest inventory area. Some chests // are generated with more items than chest space, and this flag is used to track it. - Time uExpireTime; // Enchantment expiration time, if this item is temporarily enchanted. Note that both special - // and attribute enchantments can be temporary, but in MM7 we only have special temporary - // enchantments. + Time enchantmentExpirationTime; // Enchantment expiration time, if this item is temporarily enchanted. Note that + // both special and attribute enchantments can be temporary, but in MM7 we only have + // special temporary enchantments. }; struct ItemDesc { // 30h diff --git a/src/Engine/Party.cpp b/src/Engine/Party.cpp index b34961d1fa7..c8b6426638f 100644 --- a/src/Engine/Party.cpp +++ b/src/Engine/Party.cpp @@ -815,7 +815,7 @@ void Party::restAndHeal() { if (pPlayer->classType == CLASS_LICH) { have_vessels_soul = false; for (unsigned i = 0; i < Character::INVENTORY_SLOT_COUNT; i++) { - if (pPlayer->pInventoryItemList[i].itemId == ITEM_QUEST_LICH_JAR_FULL && pPlayer->pInventoryItemList[i].uHolderPlayer == pPlayerID) + if (pPlayer->pInventoryItemList[i].itemId == ITEM_QUEST_LICH_JAR_FULL && pPlayer->pInventoryItemList[i].lichJarCharacterIndex == pPlayerID) have_vessels_soul = true; } if (!have_vessels_soul) { diff --git a/src/Engine/Snapshots/EntitySnapshots.cpp b/src/Engine/Snapshots/EntitySnapshots.cpp index e907a8441a1..ca4bdc6b934 100644 --- a/src/Engine/Snapshots/EntitySnapshots.cpp +++ b/src/Engine/Snapshots/EntitySnapshots.cpp @@ -446,7 +446,7 @@ void reconstruct(const SpellBuff_MM7 &src, SpellBuff *dst) { void snapshot(const ItemGen &src, ItemGen_MM7 *dst) { memzero(dst); - dst->itemID = std::to_underlying(src.itemId); + dst->itemId = std::to_underlying(src.itemId); if (isPotion(src.itemId)) { dst->attributeEnchantmentOrPotionPower = src.potionPower; } else if (src.attributeEnchantment) { @@ -454,23 +454,23 @@ void snapshot(const ItemGen &src, ItemGen_MM7 *dst) { } else { dst->attributeEnchantmentOrPotionPower = 0; } - dst->enchantmentStrength = src.attributeEnchantmentStrength; + dst->attributeEnchantmentStrength = src.attributeEnchantmentStrength; if (isGold(src.itemId)) { dst->specialEnchantmentOrGoldAmount = src.goldAmount; } else { dst->specialEnchantmentOrGoldAmount = std::to_underlying(src.specialEnchantment); } - dst->numCharges = src.uNumCharges; - dst->attributes = std::to_underlying(src.uAttributes); - dst->bodyAnchor = std::to_underlying(src.uBodyAnchor); - dst->maxCharges = src.uMaxCharges; - dst->holderPlayer = src.uHolderPlayer + 1; + dst->numCharges = src.numCharges; + dst->flags = std::to_underlying(src.flags); + dst->equippedSlot = std::to_underlying(src.equippedSlot); + dst->maxCharges = src.maxCharges; + dst->lichJarCharacterIndex = src.lichJarCharacterIndex + 1; dst->placedInChest = src.placedInChest; - snapshot(src.uExpireTime, &dst->expireTime); + snapshot(src.enchantmentExpirationTime, &dst->enchantmentExpirationTime); } void reconstruct(const ItemGen_MM7 &src, ItemGen *dst) { - dst->itemId = static_cast(src.itemID); + dst->itemId = static_cast(src.itemId); if (isPotion(dst->itemId)) { dst->potionPower = src.attributeEnchantmentOrPotionPower; dst->attributeEnchantment = {}; @@ -481,7 +481,7 @@ void reconstruct(const ItemGen_MM7 &src, ItemGen *dst) { dst->potionPower = 0; dst->attributeEnchantment = {}; } - dst->attributeEnchantmentStrength = src.enchantmentStrength; + dst->attributeEnchantmentStrength = src.attributeEnchantmentStrength; if (isGold(dst->itemId)) { dst->goldAmount = src.specialEnchantmentOrGoldAmount; dst->specialEnchantment = ITEM_ENCHANTMENT_NULL; @@ -489,13 +489,13 @@ void reconstruct(const ItemGen_MM7 &src, ItemGen *dst) { dst->goldAmount = 0; dst->specialEnchantment = static_cast(src.specialEnchantmentOrGoldAmount); } - dst->uNumCharges = src.numCharges; - dst->uAttributes = ItemFlags(src.attributes); - dst->uBodyAnchor = static_cast(src.bodyAnchor); - dst->uMaxCharges = src.maxCharges; - dst->uHolderPlayer = src.holderPlayer - 1; + dst->numCharges = src.numCharges; + dst->flags = ItemFlags(src.flags); + dst->equippedSlot = static_cast(src.equippedSlot); + dst->maxCharges = src.maxCharges; + dst->lichJarCharacterIndex = src.lichJarCharacterIndex - 1; dst->placedInChest = src.placedInChest; - reconstruct(src.expireTime, &dst->uExpireTime); + reconstruct(src.enchantmentExpirationTime, &dst->enchantmentExpirationTime); } void snapshot(const Party &src, Party_MM7 *dst) { diff --git a/src/Engine/Snapshots/EntitySnapshots.h b/src/Engine/Snapshots/EntitySnapshots.h index 4a7cf21ae87..d58eba6cf42 100644 --- a/src/Engine/Snapshots/EntitySnapshots.h +++ b/src/Engine/Snapshots/EntitySnapshots.h @@ -229,17 +229,17 @@ void reconstruct(const NPCData_MM7 &src, NPCData *dst); struct ItemGen_MM7 { - /* 00 */ int32_t itemID; + /* 00 */ int32_t itemId; /* 04 */ int32_t attributeEnchantmentOrPotionPower; // Potion power for potions, attribute index + 1 for attribute enchantments. - /* 08 */ int32_t enchantmentStrength; + /* 08 */ int32_t attributeEnchantmentStrength; /* 0C */ int32_t specialEnchantmentOrGoldAmount; // Gold amount for gold, otherwise special enchantment. /* 10 */ int32_t numCharges; - /* 14 */ uint32_t attributes; - /* 18 */ uint8_t bodyAnchor; + /* 14 */ uint32_t flags; + /* 18 */ uint8_t equippedSlot; /* 19 */ uint8_t maxCharges; - /* 1A */ uint8_t holderPlayer; // Only for full lich jars. 1-based index of the character whose essence it stored in it. - /* 1B */ uint8_t placedInChest; // unknown unused 8-bit field, was repurposed - /* 1C */ int64_t expireTime; + /* 1A */ uint8_t lichJarCharacterIndex; // Only for full lich jars. 1-based index of the character whose essence it stored in it. + /* 1B */ uint8_t placedInChest; // Unknown unused 8-bit field, was repurposed. + /* 1C */ int64_t enchantmentExpirationTime; }; static_assert(sizeof(ItemGen_MM7) == 0x24); MM_DECLARE_MEMCOPY_SERIALIZABLE(ItemGen_MM7) diff --git a/src/Engine/Spells/CastSpellInfo.cpp b/src/Engine/Spells/CastSpellInfo.cpp index 69797dcc9f8..0f991353c0e 100644 --- a/src/Engine/Spells/CastSpellInfo.cpp +++ b/src/Engine/Spells/CastSpellInfo.cpp @@ -720,19 +720,19 @@ void CastSpellInfoHelpers::castSpell() { assert(false); } - item->uAttributes |= ITEM_AURA_EFFECT_RED; + item->flags |= ITEM_AURA_EFFECT_RED; break; case SPELL_DARK_VAMPIRIC_WEAPON: item->specialEnchantment = ITEM_ENCHANTMENT_VAMPIRIC; - item->uAttributes |= ITEM_AURA_EFFECT_PURPLE; + item->flags |= ITEM_AURA_EFFECT_PURPLE; break; default: assert(false); } if (spell_mastery < CHARACTER_SKILL_MASTERY_GRANDMASTER) { - item->uExpireTime = pParty->GetPlayingTime() + Duration::fromHours(spell_level); - item->uAttributes |= ITEM_TEMP_BONUS; + item->enchantmentExpirationTime = pParty->GetPlayingTime() + Duration::fromHours(spell_level); + item->flags |= ITEM_TEMP_BONUS; } ItemEnchantmentTimer = Duration::fromRealtimeSeconds(2); @@ -1366,15 +1366,15 @@ void CastSpellInfoHelpers::castSpell() { spell_recharge_factor = 1.0; } - int uNewCharges = item->uMaxCharges * spell_recharge_factor; + int uNewCharges = item->maxCharges * spell_recharge_factor; // Disallow if wand will lose charges bool chargeFailed = false; - if (uNewCharges < item->uNumCharges) { + if (uNewCharges < item->numCharges) { chargeFailed = true; } else { - item->uMaxCharges = uNewCharges; - item->uNumCharges = uNewCharges; + item->maxCharges = uNewCharges; + item->numCharges = uNewCharges; } if (uNewCharges <= 0 || chargeFailed) { @@ -1387,7 +1387,7 @@ void CastSpellInfoHelpers::castSpell() { continue; } - item->uAttributes |= ITEM_AURA_EFFECT_GREEN; + item->flags |= ITEM_AURA_EFFECT_GREEN; ItemEnchantmentTimer = Duration::fromRealtimeSeconds(2); break; } @@ -1421,14 +1421,14 @@ void CastSpellInfoHelpers::castSpell() { // break items with low value if ((spell_item_to_enchant->GetValue() < 450 && !isWeapon(this_equip_type)) || // not weapons (spell_item_to_enchant->GetValue() < 250 && isWeapon(this_equip_type))) { // weapons - if (!(spell_item_to_enchant->uAttributes & ITEM_HARDENED)) { + if (!(spell_item_to_enchant->flags & ITEM_HARDENED)) { spell_item_to_enchant->SetBroken(); } item_not_broken = false; } else { // random item break if (rnd >= success_chance_percent) { - if (!(spell_item_to_enchant->uAttributes & ITEM_HARDENED)) { + if (!(spell_item_to_enchant->flags & ITEM_HARDENED)) { spell_item_to_enchant->SetBroken(); } } else { @@ -1477,7 +1477,7 @@ void CastSpellInfoHelpers::castSpell() { if (spell_mastery== CHARACTER_SKILL_MASTERY_GRANDMASTER) ench_power = grng->random(7) + 6; spell_item_to_enchant->attributeEnchantmentStrength = ench_power; - spell_item_to_enchant->uAttributes |= ITEM_AURA_EFFECT_BLUE; + spell_item_to_enchant->flags |= ITEM_AURA_EFFECT_BLUE; ItemEnchantmentTimer = Duration::fromRealtimeSeconds(2); spell_failed = false; } else { // weapons or we won the lottery for special enchantment @@ -1522,7 +1522,7 @@ void CastSpellInfoHelpers::castSpell() { // set item ench spell_item_to_enchant->specialEnchantment = ench_array[step]; - spell_item_to_enchant->uAttributes |= ITEM_AURA_EFFECT_BLUE; + spell_item_to_enchant->flags |= ITEM_AURA_EFFECT_BLUE; ItemEnchantmentTimer = Duration::fromRealtimeSeconds(2); spell_failed = false; } diff --git a/src/Engine/Tables/ItemTable.cpp b/src/Engine/Tables/ItemTable.cpp index 026bedf397f..5f65f167dd4 100644 --- a/src/Engine/Tables/ItemTable.cpp +++ b/src/Engine/Tables/ItemTable.cpp @@ -513,7 +513,7 @@ void ItemTable::generateItem(ItemTreasureLevel treasureLevel, RandomItemType uTr bool artifactLimitReached = (engine->config->gameplay.ArtifactLimit.value() != 0 && artifactsFound >= engine->config->gameplay.ArtifactLimit.value()); if ((grng->random(100) < 5) && !pParty->pIsArtifactFound[artifactRandomId] && !artifactLimitReached) { pParty->pIsArtifactFound[artifactRandomId] = true; - outItem->uAttributes = 0; + outItem->flags = 0; outItem->itemId = artifactRandomId; SetSpecialBonus(outItem); return; @@ -537,9 +537,9 @@ void ItemTable::generateItem(ItemTreasureLevel treasureLevel, RandomItemType uTr if (outItem->itemId == ITEM_SPELLBOOK_DIVINE_INTERVENTION && !pParty->_questBits[QBIT_DIVINE_INTERVENTION_RETRIEVED]) outItem->itemId = ITEM_SPELLBOOK_SUNRAY; if (pItemTable->pItems[outItem->itemId].uItemID_Rep_St) - outItem->uAttributes = 0; + outItem->flags = 0; else - outItem->uAttributes = ITEM_IDENTIFIED; + outItem->flags = ITEM_IDENTIFIED; if (!outItem->isPotion()) { outItem->specialEnchantment = ITEM_ENCHANTMENT_NULL; @@ -595,8 +595,8 @@ void ItemTable::generateItem(ItemTreasureLevel treasureLevel, RandomItemType uTr } break; case ITEM_TYPE_WAND: - outItem->uNumCharges = grng->random(6) + outItem->GetDamageMod() + 1; - outItem->uMaxCharges = outItem->uNumCharges; + outItem->numCharges = grng->random(6) + outItem->GetDamageMod() + 1; + outItem->maxCharges = outItem->numCharges; return; default: return; diff --git a/src/GUI/UI/Houses/Shops.cpp b/src/GUI/UI/Houses/Shops.cpp index a0a46b58b56..c3a10ff4dbe 100644 --- a/src/GUI/UI/Houses/Shops.cpp +++ b/src/GUI/UI/Houses/Shops.cpp @@ -363,7 +363,7 @@ void GUIWindow_Shop::repairDialogue() { if (pItemID == 0) return; - if (pParty->activeCharacter().pInventoryItemList[pItemID - 1].uAttributes & ITEM_BROKEN) { + if (pParty->activeCharacter().pInventoryItemList[pItemID - 1].flags & ITEM_BROKEN) { ItemGen *item = &pParty->activeCharacter().pInventoryItemList[pItemID - 1]; MerchantPhrase phrases_id = pParty->activeCharacter().SelectPhrasesTransaction(item, buildingType(), houseId(), SHOP_SCREEN_REPAIR); std::string str = BuildDialogueString(pMerchantsRepairPhrases[phrases_id], pParty->activeCharacterIndex() - 1, houseNpcs[currentHouseNpc].npc, item, houseId(), SHOP_SCREEN_REPAIR); @@ -941,12 +941,12 @@ void GUIWindow_Shop::houseScreenClick() { int uPriceItemService = PriceCalculator::itemIdentificationPriceForPlayer(&pParty->activeCharacter(), fPriceMultiplier); ItemGen &item = pParty->activeCharacter().pInventoryItemList[pItemID - 1]; - if (!(item.uAttributes & ITEM_IDENTIFIED)) { + if (!(item.flags & ITEM_IDENTIFIED)) { if (item.canSellRepairIdentifyAt(houseId())) { if (pParty->GetGold() >= uPriceItemService) { _transactionPerformed = true; pParty->TakeGold(uPriceItemService); - item.uAttributes |= ITEM_IDENTIFIED; + item.flags |= ITEM_IDENTIFIED; pParty->activeCharacter().playReaction(SPEECH_SHOP_IDENTIFY); engine->_statusBar->setEvent(LSTR_DONE); return; @@ -981,12 +981,12 @@ void GUIWindow_Shop::houseScreenClick() { float fPriceMultiplier = houseTable[houseId()].fPriceMultiplier; int uPriceItemService = PriceCalculator::itemRepairPriceForPlayer(&pParty->activeCharacter(), item.GetValue(), fPriceMultiplier); - if (item.uAttributes & ITEM_BROKEN) { + if (item.flags & ITEM_BROKEN) { if (item.canSellRepairIdentifyAt(houseId())) { if (pParty->GetGold() >= uPriceItemService) { _transactionPerformed = true; pParty->TakeGold(uPriceItemService); - item.uAttributes = (item.uAttributes & ~ITEM_BROKEN) | ITEM_IDENTIFIED; + item.flags = (item.flags & ~ITEM_BROKEN) | ITEM_IDENTIFIED; pParty->activeCharacter().playReaction(SPEECH_SHOP_REPAIR); engine->_statusBar->setEvent(LSTR_GOOD_AS_NEW); return; diff --git a/src/GUI/UI/NPCTopics.cpp b/src/GUI/UI/NPCTopics.cpp index dee4822de4b..ddc04b9fa7f 100644 --- a/src/GUI/UI/NPCTopics.cpp +++ b/src/GUI/UI/NPCTopics.cpp @@ -416,10 +416,10 @@ void oracleDialogue() { for (Character &player : pParty->pCharacters) { for (int idx = 0; idx < Character::INVENTORY_SLOT_COUNT; idx++) { if (player.pInventoryItemList[idx].itemId == ITEM_QUEST_LICH_JAR_FULL) { - if (player.pInventoryItemList[idx].uHolderPlayer == -1) { + if (player.pInventoryItemList[idx].lichJarCharacterIndex == -1) { item = &player.pInventoryItemList[idx]; } - if (player.pInventoryItemList[idx].uHolderPlayer == i) { + if (player.pInventoryItemList[idx].lichJarCharacterIndex == i) { have_vessels_soul = true; } } @@ -427,7 +427,7 @@ void oracleDialogue() { } if (item && !have_vessels_soul) { - item->uHolderPlayer = i; + item->lichJarCharacterIndex = i; break; } } diff --git a/src/GUI/UI/UICharacter.cpp b/src/GUI/UI/UICharacter.cpp index f76b158f5f7..60d0bc7769f 100644 --- a/src/GUI/UI/UICharacter.cpp +++ b/src/GUI/UI/UICharacter.cpp @@ -1857,7 +1857,7 @@ void OnPaperdollLeftClick() { if (!pParty->activeCharacter().pEquipment[equippos]) { freeslot = pParty->activeCharacter().findFreeInventoryListSlot(); if (freeslot >= 0) { // drop ring into free space - pParty->pPickedItem.uBodyAnchor = equippos; + pParty->pPickedItem.equippedSlot = equippos; pParty->activeCharacter().pInventoryItemList[freeslot] = pParty->pPickedItem; pParty->activeCharacter().pEquipment[equippos] = freeslot + 1; mouse->RemoveHoldingItem(); @@ -1869,10 +1869,10 @@ void OnPaperdollLeftClick() { // cant fit rings so swap out freeslot = pParty->activeCharacter().pEquipment[ringSlot(5)] - 1; // slot of last ring _this = pParty->pPickedItem; // copy hold item to this - pParty->activeCharacter().pInventoryItemList[freeslot].uBodyAnchor = ITEM_SLOT_INVALID; + pParty->activeCharacter().pInventoryItemList[freeslot].equippedSlot = ITEM_SLOT_INVALID; pParty->pPickedItem.Reset(); // drop holding item pParty->setHoldingItem(&pParty->activeCharacter().pInventoryItemList[freeslot]); // set holding item to ring to swap out - _this.uBodyAnchor = ITEM_SLOT_RING6; + _this.equippedSlot = ITEM_SLOT_RING6; pParty->activeCharacter().pInventoryItemList[freeslot] = _this; // swap from this in pParty->activeCharacter().pEquipment[ringSlot(5)] = freeslot + 1; // anchor return; @@ -1892,7 +1892,7 @@ void OnPaperdollLeftClick() { if (!pitem) { // no item in slot so just drop freeslot = pParty->activeCharacter().findFreeInventoryListSlot(); if (freeslot >= 0) { // drop ring into free space - pParty->pPickedItem.uBodyAnchor = pos; + pParty->pPickedItem.equippedSlot = pos; pParty->activeCharacter().pInventoryItemList[freeslot] = pParty->pPickedItem; pParty->activeCharacter().pEquipment[pos] = freeslot + 1; mouse->RemoveHoldingItem(); @@ -1901,10 +1901,10 @@ void OnPaperdollLeftClick() { } else { // item so swap out freeslot = pParty->activeCharacter().pEquipment[pos] - 1; // slot of ring selected _this = pParty->pPickedItem; // copy hold item to this - pParty->activeCharacter().pInventoryItemList[freeslot].uBodyAnchor = ITEM_SLOT_INVALID; + pParty->activeCharacter().pInventoryItemList[freeslot].equippedSlot = ITEM_SLOT_INVALID; pParty->pPickedItem.Reset(); // drop holding item pParty->setHoldingItem(&pParty->activeCharacter().pInventoryItemList[freeslot]); // set holding item to ring to swap out - _this.uBodyAnchor = pos; + _this.equippedSlot = pos; pParty->activeCharacter().pInventoryItemList[freeslot] = _this; // swap from this in pParty->activeCharacter().pEquipment[pos] = freeslot + 1; // anchor return; @@ -1929,10 +1929,10 @@ void OnPaperdollLeftClick() { if (shieldequip) { // смена щита щитом --shieldequip; _this = pParty->pPickedItem; - pParty->activeCharacter().pInventoryItemList[shieldequip].uBodyAnchor = ITEM_SLOT_INVALID; + pParty->activeCharacter().pInventoryItemList[shieldequip].equippedSlot = ITEM_SLOT_INVALID; pParty->pPickedItem.Reset(); pParty->setHoldingItem(&pParty->activeCharacter().pInventoryItemList[shieldequip]); - _this.uBodyAnchor = ITEM_SLOT_OFF_HAND; + _this.equippedSlot = ITEM_SLOT_OFF_HAND; pParty->activeCharacter().pInventoryItemList[shieldequip] = _this; pParty->activeCharacter().pEquipment[ITEM_SLOT_OFF_HAND] = shieldequip + 1; if (twohandedequip == 0) { @@ -1943,7 +1943,7 @@ void OnPaperdollLeftClick() { if (freeslot < 0) return; if (!twohandedequip) { // обычная установка щита на пустую // руку - pParty->pPickedItem.uBodyAnchor = ITEM_SLOT_OFF_HAND; + pParty->pPickedItem.equippedSlot = ITEM_SLOT_OFF_HAND; v17 = freeslot + 1; pParty->activeCharacter().pInventoryItemList[freeslot] = pParty->pPickedItem; pParty->activeCharacter().pEquipment[ITEM_SLOT_OFF_HAND] = v17; @@ -1952,10 +1952,10 @@ void OnPaperdollLeftClick() { } mainhandequip--; //ставим щит когда держит двуручный меч _this = pParty->pPickedItem; - pParty->activeCharacter().pInventoryItemList[mainhandequip].uBodyAnchor = ITEM_SLOT_INVALID; + pParty->activeCharacter().pInventoryItemList[mainhandequip].equippedSlot = ITEM_SLOT_INVALID; pParty->pPickedItem.Reset(); pParty->setHoldingItem(&pParty->activeCharacter().pInventoryItemList[mainhandequip]); - _this.uBodyAnchor = ITEM_SLOT_OFF_HAND; + _this.equippedSlot = ITEM_SLOT_OFF_HAND; pParty->activeCharacter().pInventoryItemList[freeslot] = _this; pParty->activeCharacter().pEquipment[ITEM_SLOT_OFF_HAND] = freeslot + 1; } @@ -1981,10 +1981,10 @@ void OnPaperdollLeftClick() { if (shieldequip) { --shieldequip; _this = pParty->pPickedItem; - pParty->activeCharacter().pInventoryItemList[shieldequip].uBodyAnchor = ITEM_SLOT_INVALID; + pParty->activeCharacter().pInventoryItemList[shieldequip].equippedSlot = ITEM_SLOT_INVALID; pParty->pPickedItem.Reset(); pParty->setHoldingItem(&pParty->activeCharacter().pInventoryItemList[shieldequip]); - _this.uBodyAnchor = ITEM_SLOT_OFF_HAND; + _this.equippedSlot = ITEM_SLOT_OFF_HAND; pParty->activeCharacter().pInventoryItemList[shieldequip] = _this; pParty->activeCharacter().pEquipment[ITEM_SLOT_OFF_HAND] = shieldequip + 1; if (pEquipType != ITEM_TYPE_WAND) { @@ -1995,7 +1995,7 @@ void OnPaperdollLeftClick() { } v23 = pParty->activeCharacter().findFreeInventoryListSlot(); if (v23 < 0) return; - pParty->pPickedItem.uBodyAnchor = ITEM_SLOT_OFF_HAND; + pParty->pPickedItem.equippedSlot = ITEM_SLOT_OFF_HAND; pParty->activeCharacter().pInventoryItemList[v23] = pParty->pPickedItem; pParty->activeCharacter().pEquipment[ITEM_SLOT_OFF_HAND] = v23 + 1; mouse->RemoveHoldingItem(); @@ -2008,7 +2008,7 @@ void OnPaperdollLeftClick() { if (!mainhandequip) { v26 = pParty->activeCharacter().findFreeInventoryListSlot(); if (v26 < 0) return; - pParty->pPickedItem.uBodyAnchor = ITEM_SLOT_MAIN_HAND; + pParty->pPickedItem.equippedSlot = ITEM_SLOT_MAIN_HAND; pParty->activeCharacter().pInventoryItemList[v26] = pParty->pPickedItem; pParty->activeCharacter().pEquipment[ITEM_SLOT_MAIN_HAND] = v26 + 1; mouse->RemoveHoldingItem(); @@ -2017,10 +2017,10 @@ void OnPaperdollLeftClick() { } --mainhandequip; _this = pParty->pPickedItem; - pParty->activeCharacter().pInventoryItemList[mainhandequip].uBodyAnchor = ITEM_SLOT_INVALID; + pParty->activeCharacter().pInventoryItemList[mainhandequip].equippedSlot = ITEM_SLOT_INVALID; pParty->pPickedItem.Reset(); pParty->setHoldingItem(&pParty->activeCharacter().pInventoryItemList[mainhandequip]); - _this.uBodyAnchor = ITEM_SLOT_MAIN_HAND; + _this.equippedSlot = ITEM_SLOT_MAIN_HAND; pParty->activeCharacter().pInventoryItemList[mainhandequip] = _this; pParty->activeCharacter().pEquipment[ITEM_SLOT_MAIN_HAND] = mainhandequip + 1; if (pEquipType == ITEM_TYPE_WAND) v50 = _this.itemId; @@ -2047,10 +2047,10 @@ void OnPaperdollLeftClick() { } --mainhandequip; _this = pParty->pPickedItem; - pParty->activeCharacter().pInventoryItemList[mainhandequip].uBodyAnchor = ITEM_SLOT_INVALID; + pParty->activeCharacter().pInventoryItemList[mainhandequip].equippedSlot = ITEM_SLOT_INVALID; pParty->pPickedItem.Reset(); pParty->setHoldingItem(&pParty->activeCharacter().pInventoryItemList[mainhandequip]); - _this.uBodyAnchor = ITEM_SLOT_MAIN_HAND; + _this.equippedSlot = ITEM_SLOT_MAIN_HAND; pParty->activeCharacter().pInventoryItemList[mainhandequip] = _this; pParty->activeCharacter().pEquipment[ITEM_SLOT_MAIN_HAND] = mainhandequip + 1; } else { @@ -2060,15 +2060,15 @@ void OnPaperdollLeftClick() { // щит(замещение щитом) shieldequip--; _this = pParty->pPickedItem; - pParty->activeCharacter().pInventoryItemList[shieldequip].uBodyAnchor = ITEM_SLOT_INVALID; + pParty->activeCharacter().pInventoryItemList[shieldequip].equippedSlot = ITEM_SLOT_INVALID; pParty->pPickedItem.Reset(); pParty->setHoldingItem(&pParty->activeCharacter().pInventoryItemList[shieldequip]); - _this.uBodyAnchor = ITEM_SLOT_MAIN_HAND; + _this.equippedSlot = ITEM_SLOT_MAIN_HAND; pParty->activeCharacter().pInventoryItemList[freeslot] = _this; pParty->activeCharacter().pEquipment[ITEM_SLOT_OFF_HAND] = 0; pParty->activeCharacter().pEquipment[ITEM_SLOT_MAIN_HAND] = freeslot + 1; } else { - pParty->pPickedItem.uBodyAnchor = ITEM_SLOT_MAIN_HAND; + pParty->pPickedItem.equippedSlot = ITEM_SLOT_MAIN_HAND; pParty->activeCharacter().pInventoryItemList[freeslot] = pParty->pPickedItem; pParty->activeCharacter().pEquipment[ITEM_SLOT_MAIN_HAND] = freeslot + 1; mouse->RemoveHoldingItem(); @@ -2146,7 +2146,7 @@ void OnPaperdollLeftClick() { } else { if (!ptr_50C9A4_ItemToEnchant) { // снять вещь pParty->setHoldingItem(pitem); - pParty->activeCharacter().pEquipment[pitem->uBodyAnchor] = 0; + pParty->activeCharacter().pEquipment[pitem->equippedSlot] = 0; pitem->Reset(); // pParty->setHoldingItem(&pParty->activeCharacter().pInventoryItemList[v34 @@ -2220,7 +2220,7 @@ void OnPaperdollLeftClick() { } else { if (!ptr_50C9A4_ItemToEnchant) { // снять вещь pParty->setHoldingItem(&pParty->activeCharacter().pInventoryItemList[v34 - 1]); - pParty->activeCharacter().pEquipment[pParty->activeCharacter().pInventoryItemList[v34 - 1].uBodyAnchor] = 0; + pParty->activeCharacter().pEquipment[pParty->activeCharacter().pInventoryItemList[v34 - 1].equippedSlot] = 0; pParty->activeCharacter().pInventoryItemList[v34 - 1].Reset(); } } diff --git a/src/GUI/UI/UIPopup.cpp b/src/GUI/UI/UIPopup.cpp index 7685a782413..5c66c1e7479 100644 --- a/src/GUI/UI/UIPopup.cpp +++ b/src/GUI/UI/UIPopup.cpp @@ -360,7 +360,7 @@ void GameUI_DrawItemInfo(ItemGen *inspect_item) { inspect_item->UpdateTempBonus(pParty->GetPlayingTime()); if (inspect_item->IsBroken()) { if (pParty->activeCharacter().CanRepair(inspect_item) == 1) - inspect_item->uAttributes = inspect_item->uAttributes & ~ITEM_BROKEN | ITEM_IDENTIFIED; + inspect_item->flags = inspect_item->flags & ~ITEM_BROKEN | ITEM_IDENTIFIED; CharacterSpeech speech = SPEECH_REPAIR_FAIL; if (!inspect_item->IsBroken()) speech = SPEECH_REPAIR_SUCCESS; @@ -503,8 +503,8 @@ void GameUI_DrawItemInfo(ItemGen *inspect_item) { } else if (inspect_item->isWand()) { text[2] = fmt::sprintf(localization->GetString(LSTR_FMT_S_U_OUT_OF_U), localization->GetString(LSTR_CHARGES), - inspect_item->uNumCharges, - inspect_item->uMaxCharges); + inspect_item->numCharges, + inspect_item->maxCharges); } } iteminfo_window.uFrameWidth -= 12; @@ -521,7 +521,7 @@ void GameUI_DrawItemInfo(ItemGen *inspect_item) { iteminfo_window.uFrameHeight = inspect_item_image->height() + itemYspacing + 54; if ((signed int)Str_int > (signed int)iteminfo_window.uFrameHeight) iteminfo_window.uFrameHeight = (unsigned int)Str_int; - if (inspect_item->uAttributes & ITEM_TEMP_BONUS && + if (inspect_item->flags & ITEM_TEMP_BONUS && (inspect_item->specialEnchantment != ITEM_ENCHANTMENT_NULL || inspect_item->attributeEnchantment)) iteminfo_window.uFrameHeight += assets->pFontComic->GetHeight(); v85 = 0; @@ -579,9 +579,9 @@ void GameUI_DrawItemInfo(ItemGen *inspect_item) { iteminfo_window.DrawText(assets->pFontComic.get(), {100, iteminfo_window.uFrameHeight - assets->pFontComic->GetHeight()}, colorTable.White, txt); render->ResetUIClipRect(); } else { - if ((inspect_item->uAttributes & ITEM_TEMP_BONUS) && + if ((inspect_item->flags & ITEM_TEMP_BONUS) && (inspect_item->specialEnchantment != ITEM_ENCHANTMENT_NULL || inspect_item->attributeEnchantment)) { - LongCivilDuration d = (inspect_item->uExpireTime - pParty->GetPlayingTime()).toLongCivilDuration(); + LongCivilDuration d = (inspect_item->enchantmentExpirationTime - pParty->GetPlayingTime()).toLongCivilDuration(); std::string txt4 = "Duration:"; bool formatting = false; @@ -619,10 +619,10 @@ void GameUI_DrawItemInfo(ItemGen *inspect_item) { iteminfo_window.DrawText(assets->pFontComic.get(), {100, iteminfo_window.uFrameHeight - assets->pFontComic->GetHeight()}, colorTable.White, txt2); std::string txt3; - if (inspect_item->uAttributes & ITEM_STOLEN) { + if (inspect_item->flags & ITEM_STOLEN) { txt3 = localization->GetString(LSTR_STOLEN); } else { - if (!(inspect_item->uAttributes & ITEM_HARDENED)) { + if (!(inspect_item->flags & ITEM_HARDENED)) { render->ResetUIClipRect(); return; } @@ -2271,19 +2271,19 @@ void Inventory_ItemPopupAndAlchemy() { } } if (!(pItemTable->pItems[item->itemId].uItemID_Rep_St)) { - item->uAttributes |= ITEM_IDENTIFIED; + item->flags |= ITEM_IDENTIFIED; } pParty->activeCharacter().playReaction(SPEECH_POTION_SUCCESS); mouse->RemoveHoldingItem(); rightClickItemActionPerformed = true; int bottleId = pParty->activeCharacter().AddItem(-1, ITEM_POTION_BOTTLE); if (bottleId) { - pParty->activeCharacter().pInventoryItemList[bottleId - 1].uAttributes = ITEM_IDENTIFIED; + pParty->activeCharacter().pInventoryItemList[bottleId - 1].flags = ITEM_IDENTIFIED; } else { // Can't fit bottle in inventory - place it in hand ItemGen bottle; bottle.itemId = ITEM_POTION_BOTTLE; - bottle.uAttributes = ITEM_IDENTIFIED; + bottle.flags = ITEM_IDENTIFIED; pParty->setHoldingItem(&bottle); } return; @@ -2298,16 +2298,16 @@ void Inventory_ItemPopupAndAlchemy() { } float invMaxChargesDecrease = (100 - maxChargesDecreasePercent) * 0.01; - int newCharges = item->uMaxCharges * invMaxChargesDecrease; + int newCharges = item->maxCharges * invMaxChargesDecrease; // Disallow if wand will lose charges - if (newCharges < item->uNumCharges) { + if (newCharges < item->numCharges) { engine->_statusBar->setEvent(LSTR_WAND_ALREADY_CHARGED); pAudioPlayer->playUISound(SOUND_spellfail0201); } else { - item->uMaxCharges = item->uNumCharges = newCharges; + item->maxCharges = item->numCharges = newCharges; // Effect and sound was not present previously - item->uAttributes |= ITEM_AURA_EFFECT_GREEN; + item->flags |= ITEM_AURA_EFFECT_GREEN; ItemEnchantmentTimer = Duration::fromRealtimeSeconds(2); pAudioPlayer->playSpellSound(SPELL_WATER_RECHARGE_ITEM, false, SOUND_MODE_UI); } @@ -2328,7 +2328,7 @@ void Inventory_ItemPopupAndAlchemy() { return; } if (item->isWeapon() || item->isPassiveEquipment() || item->isWand()) { - item->uAttributes |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; + item->flags |= ITEM_AURA_EFFECT_RED | ITEM_HARDENED; // Sound was missing previously pAudioPlayer->playSpellSound(SPELL_WATER_ENCHANT_ITEM, false, SOUND_MODE_UI); @@ -2360,9 +2360,9 @@ void Inventory_ItemPopupAndAlchemy() { Duration effectTime = Duration::fromMinutes(30 * pParty->pPickedItem.potionPower); item->UpdateTempBonus(pParty->GetPlayingTime()); item->specialEnchantment = potionEnchantment(pParty->pPickedItem.itemId); - item->uExpireTime = pParty->GetPlayingTime() + effectTime; + item->enchantmentExpirationTime = pParty->GetPlayingTime() + effectTime; // Sound was missing previously - item->uAttributes |= ITEM_TEMP_BONUS | ITEM_AURA_EFFECT_RED; + item->flags |= ITEM_TEMP_BONUS | ITEM_AURA_EFFECT_RED; pAudioPlayer->playSpellSound(SPELL_WATER_ENCHANT_ITEM, false, SOUND_MODE_UI); ItemEnchantmentTimer = Duration::fromRealtimeSeconds(2); diff --git a/src/Scripting/GameBindings.cpp b/src/Scripting/GameBindings.cpp index 807476e29b1..d07f3845fcf 100644 --- a/src/Scripting/GameBindings.cpp +++ b/src/Scripting/GameBindings.cpp @@ -157,7 +157,7 @@ void GameBindings::_registerPartyBindings(sol::state_view &solState, sol::table if (key == "id") { item.itemId = pair.second.as(); } else if (key == "holder") { - item.uHolderPlayer = pair.second.as() - 1; // character index in lua is 1-based + item.lichJarCharacterIndex = pair.second.as() - 1; // character index in lua is 1-based } } return character->AddItem2(-1, &item) != 0; diff --git a/test/Bin/GameTest/GameTests_0500.cpp b/test/Bin/GameTest/GameTests_0500.cpp index 79514786739..ddef9530643 100644 --- a/test/Bin/GameTest/GameTests_0500.cpp +++ b/test/Bin/GameTest/GameTests_0500.cpp @@ -152,7 +152,7 @@ GAME_TEST(Issues, Issue571) { GAME_TEST(Issues, Issue573) { // Make Recharge Item effect non-decreasing - auto chargeTape = tapes.custom([] { return pParty->pCharacters[1].pInventoryItemList[33].uNumCharges; }); + auto chargeTape = tapes.custom([] { return pParty->pCharacters[1].pInventoryItemList[33].numCharges; }); auto manaTape = tapes.custom([] { return pParty->pCharacters[0].mana; }); auto itemsTape = tapes.totalItemCount(); test.playTraceFromTestData("issue_573.mm7", "issue_573.json"); @@ -167,7 +167,7 @@ GAME_TEST(Issues, Issue574) { auto itemsTape = tapes.totalItemCount(); test.playTraceFromTestData("issue_574.mm7", "issue_574.json"); EXPECT_EQ(itemsTape.delta(), -1); // Minus potion. - EXPECT_EQ(pParty->pPickedItem.uMaxCharges, pParty->pPickedItem.uNumCharges); + EXPECT_EQ(pParty->pPickedItem.maxCharges, pParty->pPickedItem.numCharges); } GAME_TEST(Issues, Issue578) { @@ -528,7 +528,7 @@ GAME_TEST(Issues, Issue720) { GAME_TEST(Issues, Issue724) { // Test that item potion can be applied to equipped items. - auto hardenedTape = tapes.custom([] { return !!(pParty->pCharacters[3].GetItem(ITEM_SLOT_MAIN_HAND)->uAttributes & ITEM_HARDENED); }); + auto hardenedTape = tapes.custom([] { return !!(pParty->pCharacters[3].GetItem(ITEM_SLOT_MAIN_HAND)->flags & ITEM_HARDENED); }); test.playTraceFromTestData("issue_724.mm7", "issue_724.json"); EXPECT_EQ(hardenedTape, tape(false, true)); } diff --git a/test/Bin/GameTest/GameTests_1000.cpp b/test/Bin/GameTest/GameTests_1000.cpp index e4b41f9515e..54c13940a94 100644 --- a/test/Bin/GameTest/GameTests_1000.cpp +++ b/test/Bin/GameTest/GameTests_1000.cpp @@ -23,7 +23,7 @@ static bool characterHasJar(int charIndex, int jarIndex) { for (const ItemGen &item : pParty->pCharacters[charIndex].pInventoryItemList) - if (item.itemId == ITEM_QUEST_LICH_JAR_FULL && item.uHolderPlayer == jarIndex) + if (item.itemId == ITEM_QUEST_LICH_JAR_FULL && item.lichJarCharacterIndex == jarIndex) return true; return false; } diff --git a/test/Bin/GameTest/GameTests_1500.cpp b/test/Bin/GameTest/GameTests_1500.cpp index e1d2c6c2f94..bc3ede54b61 100644 --- a/test/Bin/GameTest/GameTests_1500.cpp +++ b/test/Bin/GameTest/GameTests_1500.cpp @@ -277,11 +277,11 @@ GAME_TEST(Issues, Issue1685) { ItemGen jar1; jar1.itemId = ItemId::ITEM_QUEST_LICH_JAR_FULL; - jar1.uHolderPlayer = 0; + jar1.lichJarCharacterIndex = 0; ItemGen jar2; jar2.itemId = ItemId::ITEM_QUEST_LICH_JAR_FULL; - jar2.uHolderPlayer = 1; + jar2.lichJarCharacterIndex = 1; game.runGameRoutine([&] { // This code needs to be run in game thread b/c AddItem2 is loading textures...