name Root structures appropriately
This commit is contained in:
@@ -703,7 +703,7 @@ CommonItemSet::Table::Table(const phosg::StringReader& r, bool is_big_endian, bo
|
||||
|
||||
template <bool BE>
|
||||
void CommonItemSet::Table::parse_itempt_t(const phosg::StringReader& r, bool is_v3) {
|
||||
const auto& offsets = r.pget<OffsetsT<BE>>(r.pget<U32T<BE>>(r.size() - 0x10));
|
||||
const auto& offsets = r.pget<RootT<BE>>(r.pget<U32T<BE>>(r.size() - 0x10));
|
||||
|
||||
this->base_weapon_type_prob_table = r.pget<parray<uint8_t, 0x0C>>(offsets.base_weapon_type_prob_table_offset);
|
||||
this->subtype_base_table = r.pget<parray<int8_t, 0x0C>>(offsets.subtype_base_table_offset);
|
||||
|
||||
@@ -69,7 +69,7 @@ public:
|
||||
void parse_itempt_t(const phosg::StringReader& r, bool is_v3);
|
||||
|
||||
template <bool BE>
|
||||
struct OffsetsT {
|
||||
struct RootT {
|
||||
// This data structure uses index probability tables in multiple places. An index probability table is a table
|
||||
// where each entry holds the probability that that entry's index is used. For example, if the armor slot count
|
||||
// probability table contains [77, 17, 5, 1, 0], this means there is a 77% chance of no slots, 17% chance of 1
|
||||
@@ -244,9 +244,9 @@ public:
|
||||
/* 50 */ U32T<BE> box_item_class_prob_table_offset;
|
||||
|
||||
// There are several unused fields here.
|
||||
} __packed_ws_be__(OffsetsT, 0x54);
|
||||
using Offsets = OffsetsT<false>;
|
||||
using OffsetsBE = OffsetsT<true>;
|
||||
} __packed_ws_be__(RootT, 0x54);
|
||||
using Root = RootT<false>;
|
||||
using RootBE = RootT<true>;
|
||||
};
|
||||
|
||||
bool operator==(const CommonItemSet& other) const = default;
|
||||
|
||||
+1
-1
@@ -154,7 +154,7 @@ using LevelStatsDeltaBE = LevelStatsDeltaT<true>;
|
||||
class LevelTable {
|
||||
// This is the base class for all the LevelTable implementations. The public interface here only defines functions
|
||||
// that the server needs to handle requests, but some subclasses implement more functionality. See the comments and
|
||||
// Offsets structures inside the subclasses' constructor implementations for more details on the file formats.
|
||||
// Root structures inside the subclasses' constructor implementations for more details on the file formats.
|
||||
public:
|
||||
virtual ~LevelTable() = default;
|
||||
|
||||
|
||||
+2
-2
@@ -89,7 +89,7 @@ RareItemSet::ExpandedDrop RareItemSet::ParsedRELData::PackedDrop::expand() const
|
||||
template <bool BE>
|
||||
void RareItemSet::ParsedRELData::parse_t(phosg::StringReader r, bool is_v1) {
|
||||
const auto& footer = r.pget<RELFileFooterT<BE>>(r.size() - sizeof(RELFileFooterT<BE>));
|
||||
const auto& root = r.pget<OffsetsT<BE>>(footer.root_offset);
|
||||
const auto& root = r.pget<RootT<BE>>(footer.root_offset);
|
||||
|
||||
phosg::StringReader monsters_r = r.sub(root.monster_rares_offset);
|
||||
for (size_t z = 0; z < (is_v1 ? 0x33 : 0x65); z++) {
|
||||
@@ -114,7 +114,7 @@ template <bool BE>
|
||||
std::string RareItemSet::ParsedRELData::serialize_t(bool is_v1) const {
|
||||
static const PackedDrop empty_drop;
|
||||
|
||||
OffsetsT<BE> root;
|
||||
RootT<BE> root;
|
||||
root.box_count = this->box_rares.size();
|
||||
|
||||
phosg::StringWriter w;
|
||||
|
||||
+4
-4
@@ -87,15 +87,15 @@ protected:
|
||||
} __packed_ws__(PackedDrop, 4);
|
||||
|
||||
template <bool BE>
|
||||
struct OffsetsT {
|
||||
struct RootT {
|
||||
/* 00 */ U32T<BE> monster_rares_offset; // -> parray<PackedDrop, 0x65> (or 0x33 on v1)
|
||||
/* 04 */ U32T<BE> box_count; // Usually 30 (0x1E)
|
||||
/* 08 */ U32T<BE> box_areas_offset; // -> parray<uint8_t, 0x1E>
|
||||
/* 0C */ U32T<BE> box_rares_offset; // -> parray<PackedDrop, 0x1E>
|
||||
/* 10 */
|
||||
} __packed_ws_be__(OffsetsT, 0x10);
|
||||
using Offsets = OffsetsT<false>;
|
||||
using OffsetsBE = OffsetsT<true>;
|
||||
} __packed_ws_be__(RootT, 0x10);
|
||||
using Root = RootT<false>;
|
||||
using RootBE = RootT<true>;
|
||||
|
||||
struct BoxRare {
|
||||
uint8_t area_norm_plus_1;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
// This file specifies how non-rare items should be generated. For details on how each field works, see the comments
|
||||
// in CommonItemSet::Table::OffsetsT (in CommonItemSet.hh).
|
||||
// in CommonItemSet::Table::RootT (in CommonItemSet.hh).
|
||||
// Each scenario has defaults which are automatically propagated from the previous scenario unless overridden. The
|
||||
// order of precedence is:
|
||||
// - If the section ID is not Viridia, the defaults are from the same episode, game mode, and difficulty, but
|
||||
|
||||
Reference in New Issue
Block a user