This commit is contained in:
@@ -87,6 +87,22 @@ namespace game::resource::xml
|
||||
query_sound_entry_collection(element, "Dispose", archive, soundRootPath, sounds.dispose);
|
||||
query_sound_entry_collection(element, "Return", archive, soundRootPath, sounds.return_);
|
||||
query_sound_entry_collection(element, "Summon", archive, soundRootPath, sounds.summon);
|
||||
query_sound_entry_collection(element, "Upgrade", archive, soundRootPath, sounds.upgrade);
|
||||
query_sound_entry_collection(element, "UpgradeFail", archive, soundRootPath, sounds.upgradeFail);
|
||||
}
|
||||
|
||||
if (auto element = root->FirstChildElement("Items"))
|
||||
{
|
||||
int id{};
|
||||
|
||||
for (auto child = element->FirstChildElement("Item"); child; child = child->NextSiblingElement("Item"))
|
||||
{
|
||||
std::string name{};
|
||||
query_string_attribute(child, "Name", &name);
|
||||
stringToIDMap[name] = id;
|
||||
idToStringMap[id] = name;
|
||||
id++;
|
||||
}
|
||||
}
|
||||
|
||||
if (auto element = root->FirstChildElement("Items"))
|
||||
@@ -108,7 +124,24 @@ namespace game::resource::xml
|
||||
query_float_optional_attribute(child, "DigestionBonus", item.digestionBonus);
|
||||
query_float_optional_attribute(child, "EatSpeedBonus", item.eatSpeedBonus);
|
||||
query_float_optional_attribute(child, "Gravity", item.gravity);
|
||||
|
||||
query_int_optional_attribute(child, "ChewCount", item.chewCount);
|
||||
|
||||
if (child->FindAttribute("UpgradeID"))
|
||||
{
|
||||
std::string upgradeIDString{};
|
||||
query_string_attribute(child, "UpgradeID", &upgradeIDString);
|
||||
|
||||
if (!upgradeIDString.empty() && stringToIDMap.contains(upgradeIDString))
|
||||
item.upgradeID = stringToIDMap[upgradeIDString];
|
||||
else if (upgradeIDString.empty())
|
||||
logger.warning(std::format("Empty UpgradeID ({})", item.name));
|
||||
else
|
||||
logger.warning(std::format("Could not find item ID for UpgradeID: {} ({})", upgradeIDString, item.name));
|
||||
|
||||
query_int_optional_attribute(child, "UpgradeCount", item.upgradeCount);
|
||||
}
|
||||
|
||||
query_bool_attribute(child, "IsPlayReward", &item.isPlayReward);
|
||||
query_bool_attribute(child, "IsToggleSpritesheet", &item.isToggleSpritesheet);
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ namespace game::resource::xml
|
||||
std::string description{UNDEFINED};
|
||||
int categoryID{};
|
||||
int rarityID{};
|
||||
std::optional<int> upgradeCount{};
|
||||
std::optional<int> upgradeID{};
|
||||
std::optional<int> flavorID;
|
||||
std::optional<float> calories{};
|
||||
std::optional<float> eatSpeedBonus{};
|
||||
@@ -63,11 +65,15 @@ namespace game::resource::xml
|
||||
SoundEntryCollection return_{};
|
||||
SoundEntryCollection dispose{};
|
||||
SoundEntryCollection summon{};
|
||||
SoundEntryCollection upgrade{};
|
||||
SoundEntryCollection upgradeFail{};
|
||||
};
|
||||
|
||||
std::unordered_map<std::string, int> categoryMap{};
|
||||
std::unordered_map<std::string, int> rarityMap{};
|
||||
std::unordered_map<std::string, int> flavorMap{};
|
||||
std::unordered_map<std::string, int> stringToIDMap{};
|
||||
std::unordered_map<int, std::string> idToStringMap{};
|
||||
|
||||
using Pool = std::vector<int>;
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@ namespace game::resource::xml
|
||||
query_sound_entry_collection(element, "Close", archive, soundRootPath, sounds.close);
|
||||
query_sound_entry_collection(element, "Hover", archive, soundRootPath, sounds.hover);
|
||||
query_sound_entry_collection(element, "Select", archive, soundRootPath, sounds.select);
|
||||
query_sound_entry_collection(element, "CheatsActivated", archive, soundRootPath, sounds.cheatsActivated);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ namespace game::resource::xml
|
||||
SoundEntryCollection close{};
|
||||
SoundEntryCollection hover{};
|
||||
SoundEntryCollection select{};
|
||||
SoundEntryCollection cheatsActivated{};
|
||||
};
|
||||
|
||||
Sounds sounds{};
|
||||
|
||||
Reference in New Issue
Block a user