From df013784fcefb208a23c8e339e099ab2795a4f91 Mon Sep 17 00:00:00 2001 From: Martin Michelsen Date: Mon, 11 Sep 2023 11:24:35 -0700 Subject: [PATCH] document map_category field in MapDefinition --- src/Episode3/DataIndexes.cc | 6 +++--- src/Episode3/DataIndexes.hh | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/Episode3/DataIndexes.cc b/src/Episode3/DataIndexes.cc index 8c786431..60ba0fc7 100644 --- a/src/Episode3/DataIndexes.cc +++ b/src/Episode3/DataIndexes.cc @@ -1521,7 +1521,7 @@ string MapDefinition::str(const CardIndex* card_index) const { lines.emplace_back(string_printf(" level_overrides=[win=%" PRId32 ", loss=%" PRId32 "]", this->win_level_override.load(), this->loss_level_override.load())); lines.emplace_back(string_printf(" a9=[%04hX %04hX]", this->unknown_a9_c.load(), this->unknown_a9_d.load())); - lines.emplace_back(string_printf(" a10=%02hhX", this->unknown_a10)); + lines.emplace_back(string_printf(" map_category=%02hhX", this->map_category)); lines.emplace_back(string_printf(" cyber_block_type=%02hhX", this->cyber_block_type)); lines.emplace_back(string_printf(" a11=%02hhX%02hhX", this->unknown_a11[0], this->unknown_a11[1])); static const array sc_card_entry_names = { @@ -1647,7 +1647,7 @@ MapDefinitionTrial::MapDefinitionTrial(const MapDefinition& map) loss_level_override(map.loss_level_override), unknown_a9_c(map.unknown_a9_c), unknown_a9_d(map.unknown_a9_d), - unknown_a10(map.unknown_a10), + map_category(map.map_category), cyber_block_type(map.cyber_block_type), unknown_a11(map.unknown_a11), unknown_t12(0xFF) { @@ -2075,7 +2075,7 @@ const string& MapIndex::get_compressed_list(size_t num_players) const { strings_w.write(map.description.data(), map.description.len()); strings_w.put_u8(0); - e.unknown_a1 = map_it.second->is_quest ? 0x00 : 0xFF; + e.map_category = map_it.second->is_quest ? 0x00 : 0xFF; entries_w.put(e); num_maps++; diff --git a/src/Episode3/DataIndexes.hh b/src/Episode3/DataIndexes.hh index b66ffbd1..e704e4e9 100644 --- a/src/Episode3/DataIndexes.hh +++ b/src/Episode3/DataIndexes.hh @@ -803,6 +803,8 @@ struct MapList { be_uint32_t total_size; // Including header, entries, and strings struct Entry { + // The fields in this structure have the same meanings as the corresponding + // fields in MapDefinition. /* 0000 */ be_uint16_t map_x; /* 0002 */ be_uint16_t map_y; /* 0004 */ be_uint16_t environment_number; @@ -817,9 +819,7 @@ struct MapList { /* 001A */ be_uint16_t height; /* 001C */ parray, 0x10> map_tiles; /* 011C */ parray, 0x10> modification_tiles; - // This appears to be 0xFF for free battle maps, and 0 for quests. - // TODO: Figure out what this field's meaning actually is - /* 021C */ uint8_t unknown_a1; + /* 021C */ uint8_t map_category; /* 021D */ parray unused; /* 0220 */ } __attribute__((packed)); @@ -984,7 +984,15 @@ struct MapDefinition { // .mnmd format; also the format of (decompressed) quests /* 59D8 */ be_uint16_t unknown_a9_c; /* 59DA */ be_uint16_t unknown_a9_d; - /* 59DC */ uint8_t unknown_a10; + + // map_category appears to specify where in the menu the map should appear in + // offline mode. (In online mode, this is ignored, and the map's location in + // the menu is determined by the corresponding field in the compressed map + // list instead.) If this is FF, the map appears in the Free Battle section; + // if it's a small positive number (usually 0 or 2), the map appears in the + // Quest section instead. It's not known if this controls anything else; the + // values 0, 1, and 2 appear to all do the same thing here. + /* 59DC */ uint8_t map_category; // This field determines block graphics to be used in the Cyber environment. // There are 10 block types (0-9); if this value is > 9, type 0 is used. @@ -1082,7 +1090,7 @@ struct MapDefinitionTrial { /* 416C */ be_uint32_t loss_level_override; /* 4170 */ be_uint16_t unknown_a9_c; /* 4172 */ be_uint16_t unknown_a9_d; - /* 4174 */ uint8_t unknown_a10; + /* 4174 */ uint8_t map_category; /* 4175 */ uint8_t cyber_block_type; /* 4176 */ parray unknown_a11; // TODO: This field may contain some version of unavailable_sc_cards and/or