use EnemyType in ItemCreator; fix incorrect drop tables

This commit is contained in:
Martin Michelsen
2026-03-08 20:37:57 -07:00
parent 3cbf64dda2
commit 4e3549ba6b
33 changed files with 735 additions and 607 deletions
+15 -6
View File
@@ -22,6 +22,9 @@ public:
uint32_t probability = 0;
ItemData data;
bool operator==(const ExpandedDrop& other) const = default;
bool operator!=(const ExpandedDrop& other) const = default;
std::string str() const;
std::string str(std::shared_ptr<const ItemNameIndex> name_index) const;
};
@@ -34,7 +37,7 @@ public:
~RareItemSet() = default;
std::vector<ExpandedDrop> get_enemy_specs(
GameMode mode, Episode episode, Difficulty difficulty, uint8_t secid, uint8_t rt_index) const;
GameMode mode, Episode episode, Difficulty difficulty, uint8_t secid, EnemyType enemy_type) const;
std::vector<ExpandedDrop> get_box_specs(
GameMode mode, Episode episode, Difficulty difficulty, uint8_t secid, uint8_t area_norm) const;
@@ -60,11 +63,17 @@ public:
uint8_t section_id,
std::shared_ptr<const ItemNameIndex> name_index = nullptr) const;
void print_all_collections(FILE* stream, std::shared_ptr<const ItemNameIndex> name_index = nullptr) const;
void print_diff(FILE* stream, const RareItemSet& other) const;
protected:
struct SpecCollection {
std::vector<std::vector<ExpandedDrop>> rt_index_to_specs;
std::vector<std::vector<ExpandedDrop>> box_area_norm_to_specs;
std::unordered_map<EnemyType, std::vector<ExpandedDrop>> enemy_specs;
std::vector<std::vector<ExpandedDrop>> box_specs; // Indexed by area_norm
bool operator==(const SpecCollection& other) const = default;
bool operator!=(const SpecCollection& other) const = default;
void print_diff(FILE* stream, const SpecCollection& other) const;
};
struct ParsedRELData {
@@ -95,8 +104,8 @@ protected:
ExpandedDrop drop;
};
std::vector<ExpandedDrop> monster_rares;
std::vector<BoxRare> box_rares;
std::vector<ExpandedDrop> monster_rares; // Indexed by rt_index
std::vector<BoxRare> box_rares; // Not indexed (area_norm + 1 is in the struct)
ParsedRELData() = default;
ParsedRELData(phosg::StringReader r, bool big_endian, bool is_v1);
@@ -108,7 +117,7 @@ protected:
template <bool BE>
std::string serialize_t(bool is_v1) const;
SpecCollection as_collection() const;
SpecCollection as_collection(Episode episode) const;
};
std::unordered_map<uint16_t, SpecCollection> collections;