diff --git a/src/Bin/CodeGen/CodeGen.cpp b/src/Bin/CodeGen/CodeGen.cpp index b8c20feb7480..e51e27984495 100644 --- a/src/Bin/CodeGen/CodeGen.cpp +++ b/src/Bin/CodeGen/CodeGen.cpp @@ -117,11 +117,11 @@ int runItemIdCodeGen(CodeGenOptions options, GameResourceManager *resourceManage enumName = "GEM_" + enumName; } - if (desc.uMaterial == MATERIAL_ARTIFACT) { + if (desc.uMaterial == RARITY_ARTIFACT) { enumName = "ARTIFACT_" + enumName; - } else if (desc.uMaterial == MATERIAL_RELIC) { + } else if (desc.uMaterial == RARITY_RELIC) { enumName = "RELIC_" + enumName; - } else if (desc.uMaterial == MATERIAL_SPECIAL) { + } else if (desc.uMaterial == RARITY_SPECIAL) { enumName = "RARE_" + enumName; } else if (description.starts_with("Quest")) { enumName = "QUEST_" + enumName; diff --git a/src/Engine/Objects/ItemEnums.h b/src/Engine/Objects/ItemEnums.h index ace2a3626464..6956279308c3 100644 --- a/src/Engine/Objects/ItemEnums.h +++ b/src/Engine/Objects/ItemEnums.h @@ -129,10 +129,11 @@ enum class ItemEnchantment : unsigned int { using enum ItemEnchantment; enum class ItemRarity : uint8_t { - MATERIAL_COMMON = 0, - MATERIAL_ARTIFACT = 1, - MATERIAL_RELIC = 2, - MATERIAL_SPECIAL = 3 // TODO(captainurist): RARE + RARITY_COMMON = 0, + RARITY_ARTIFACT = 1, // Artifacts always give positive bonuses. + RARITY_RELIC = 2, // Relics can be more powerful than artifacts but carry a penalty (have a negative bonus). + RARITY_SPECIAL = 3, // Pretty much just weak artifacts, and often quest items. Not in the loot table, so can + // only be found where the level designers have put them. }; using enum ItemRarity; @@ -700,7 +701,7 @@ enum class ItemId : int32_t { ITEM_ARTIFACT_FORGE_GAUNTLETS = 534, ITEM_ARTIFACT_HEROS_BELT = 535, ITEM_ARTIFACT_LADYS_ESCORT = 536, - ITEM_RARE_CLANKERS_AMULET = 537, + ITEM_RARE_CLANKERS_AMULET = 537, // TODO(captainurist): RARE -> SPECIAL ITEM_RARE_LIEUTENANTS_CUTLASS = 538, ITEM_RARE_MEDUSAS_MIRROR = 539, ITEM_RARE_LADY_CARMINES_DAGGER = 540, diff --git a/src/Engine/Objects/Items.h b/src/Engine/Objects/Items.h index c5b1e18ace5c..a3399928631e 100644 --- a/src/Engine/Objects/Items.h +++ b/src/Engine/Objects/Items.h @@ -137,7 +137,7 @@ struct ItemDesc { // 30h uint8_t uDamageDice = 0; // 1e 22 uint8_t uDamageRoll = 0; // 1f 23 uint8_t uDamageMod = 0; // 20 24 - ItemRarity uMaterial = MATERIAL_COMMON; // 21 25 + ItemRarity uMaterial = RARITY_COMMON; // 21 25 ItemEnchantment _additional_value = ITEM_ENCHANTMENT_NULL; // 22 26 std::optional _bonus_type; char _bonus_strength = 0; // 24 28 diff --git a/src/Engine/Tables/ItemTable.cpp b/src/Engine/Tables/ItemTable.cpp index 91b9879b8969..e3cc75a4e3c7 100644 --- a/src/Engine/Tables/ItemTable.cpp +++ b/src/Engine/Tables/ItemTable.cpp @@ -68,9 +68,9 @@ void ItemTable::Initialize(GameResourceManager *resourceManager) { equipSkillMap["club"] = CHARACTER_SKILL_CLUB; std::map materialMap; - materialMap["artifact"] = MATERIAL_ARTIFACT; - materialMap["relic"] = MATERIAL_RELIC; - materialMap["special"] = MATERIAL_SPECIAL; + materialMap["artifact"] = RARITY_ARTIFACT; + materialMap["relic"] = RARITY_RELIC; + materialMap["special"] = RARITY_SPECIAL; char *lineContent; @@ -161,14 +161,14 @@ void ItemTable::Initialize(GameResourceManager *resourceManager) { pItems[item_counter].uDamageRoll = 0; } pItems[item_counter].uDamageMod = atoi(tokens[7]); - pItems[item_counter].uMaterial = valueOr(materialMap, tokens[8], MATERIAL_COMMON); + pItems[item_counter].uMaterial = valueOr(materialMap, tokens[8], RARITY_COMMON); pItems[item_counter].uItemID_Rep_St = atoi(tokens[9]); pItems[item_counter].pUnidentifiedName = removeQuotes(tokens[10]); pItems[item_counter].uSpriteID = static_cast(atoi(tokens[11])); pItems[item_counter]._additional_value = ITEM_ENCHANTMENT_NULL; pItems[item_counter]._bonus_type = {}; - if (pItems[item_counter].uMaterial == MATERIAL_SPECIAL) { + if (pItems[item_counter].uMaterial == RARITY_SPECIAL) { for (CharacterAttributeType ii : allEnchantableAttributes()) { if (iequals(tokens[12], standardEnchantments[ii].pOfName)) { pItems[item_counter]._bonus_type = ii; @@ -184,7 +184,7 @@ void ItemTable::Initialize(GameResourceManager *resourceManager) { } } - if ((pItems[item_counter].uMaterial == MATERIAL_SPECIAL) && + if ((pItems[item_counter].uMaterial == RARITY_SPECIAL) && (pItems[item_counter]._bonus_type)) { char b_s = atoi(tokens[13]); if (b_s) @@ -262,7 +262,7 @@ void ItemTable::Initialize(GameResourceManager *resourceManager) { //----- (00456D17) -------------------------------------------------------- void ItemTable::SetSpecialBonus(ItemGen *pItem) { - if (pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL) { + if (pItems[pItem->uItemID].uMaterial == RARITY_SPECIAL) { pItem->attributeEnchantment = pItems[pItem->uItemID]._bonus_type; pItem->special_enchantment = (ItemEnchantment)pItems[pItem->uItemID]._additional_value; @@ -272,14 +272,14 @@ void ItemTable::SetSpecialBonus(ItemGen *pItem) { //----- (00456D43) -------------------------------------------------------- bool ItemTable::IsMaterialSpecial(const ItemGen *pItem) { - return this->pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL; + return this->pItems[pItem->uItemID].uMaterial == RARITY_SPECIAL; } //----- (00456D5E) -------------------------------------------------------- bool ItemTable::IsMaterialNonCommon(const ItemGen *pItem) { - return pItems[pItem->uItemID].uMaterial == MATERIAL_SPECIAL || - pItems[pItem->uItemID].uMaterial == MATERIAL_RELIC || - pItems[pItem->uItemID].uMaterial == MATERIAL_ARTIFACT; + return pItems[pItem->uItemID].uMaterial == RARITY_SPECIAL || + pItems[pItem->uItemID].uMaterial == RARITY_RELIC || + pItems[pItem->uItemID].uMaterial == RARITY_ARTIFACT; } //----- (00453B3C) --------------------------------------------------------