document materialize-map command
This commit is contained in:
+7
-1
@@ -3065,7 +3065,13 @@ Action a_check_supermaps(
|
|||||||
});
|
});
|
||||||
|
|
||||||
Action a_materialize_map(
|
Action a_materialize_map(
|
||||||
"materialize-map", nullptr,
|
"materialize-map", "\
|
||||||
|
materialize-map [OPTIONS] [INPUT-FILENAME [OUTPUT-FILENAME]]\n\
|
||||||
|
Runs the Challenge Mode random enemy generation algorithm on the input map\n\
|
||||||
|
file, producing a new map file with no random sections. A version option\n\
|
||||||
|
is required, and the --seed=SEED option is also required (SEED is a 32-bit\n\
|
||||||
|
hex integer). The resulting map file is disassembled immediately, and the\n\
|
||||||
|
disassembly is written to the output file.\n",
|
||||||
+[](phosg::Arguments& args) {
|
+[](phosg::Arguments& args) {
|
||||||
if (args.get<bool>("debug")) {
|
if (args.get<bool>("debug")) {
|
||||||
static_game_data_log.min_level = phosg::LogLevel::L_DEBUG;
|
static_game_data_log.min_level = phosg::LogLevel::L_DEBUG;
|
||||||
|
|||||||
+18
-7
@@ -3328,7 +3328,7 @@ string MapFile::RandomEnemyLocationSection::str() const {
|
|||||||
if (count > 0x20) {
|
if (count > 0x20) {
|
||||||
count_warning_str = " /* warning: count is too large */";
|
count_warning_str = " /* warning: count is too large */";
|
||||||
}
|
}
|
||||||
return std::format("[RandomEnemyLocationSection room={:04X} count={:04X}{} offset={:08X} index={}]",
|
return std::format("[RandomEnemyLocationSection room={:04X} count={:04X}{} offset={:08X}(index={:04X})]",
|
||||||
this->room, this->count, count_warning_str, this->offset, this->offset / sizeof(RandomEnemyLocation));
|
this->room, this->count, count_warning_str, this->offset, this->offset / sizeof(RandomEnemyLocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3445,6 +3445,10 @@ const array<uint32_t, 41> MapFile::RAND_ENEMY_BASE_TYPES = {
|
|||||||
0xE0, 0xE0, 0xE1};
|
0xE0, 0xE0, 0xE1};
|
||||||
|
|
||||||
MapFile::MapFile(std::shared_ptr<const std::string> data) {
|
MapFile::MapFile(std::shared_ptr<const std::string> data) {
|
||||||
|
for (uint8_t z = 0; z < this->sections_for_floor.size(); z++) {
|
||||||
|
this->sections_for_floor[z].floor = z;
|
||||||
|
}
|
||||||
|
|
||||||
this->quest_data = data;
|
this->quest_data = data;
|
||||||
this->link_data(data);
|
this->link_data(data);
|
||||||
|
|
||||||
@@ -3492,6 +3496,9 @@ MapFile::MapFile(
|
|||||||
std::shared_ptr<const std::string> objects_data,
|
std::shared_ptr<const std::string> objects_data,
|
||||||
std::shared_ptr<const std::string> enemies_data,
|
std::shared_ptr<const std::string> enemies_data,
|
||||||
std::shared_ptr<const std::string> events_data) {
|
std::shared_ptr<const std::string> events_data) {
|
||||||
|
for (uint8_t z = 0; z < this->sections_for_floor.size(); z++) {
|
||||||
|
this->sections_for_floor[z].floor = z;
|
||||||
|
}
|
||||||
if (objects_data) {
|
if (objects_data) {
|
||||||
this->link_data(objects_data);
|
this->link_data(objects_data);
|
||||||
this->set_object_sets_for_floor(floor, 0, objects_data->data(), objects_data->size());
|
this->set_object_sets_for_floor(floor, 0, objects_data->data(), objects_data->size());
|
||||||
@@ -3508,7 +3515,11 @@ MapFile::MapFile(
|
|||||||
}
|
}
|
||||||
|
|
||||||
MapFile::MapFile(uint32_t generated_with_random_seed)
|
MapFile::MapFile(uint32_t generated_with_random_seed)
|
||||||
: generated_with_random_seed(generated_with_random_seed) {}
|
: generated_with_random_seed(generated_with_random_seed) {
|
||||||
|
for (uint8_t z = 0; z < this->sections_for_floor.size(); z++) {
|
||||||
|
this->sections_for_floor[z].floor = z;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MapFile::link_data(std::shared_ptr<const string> data) {
|
void MapFile::link_data(std::shared_ptr<const string> data) {
|
||||||
if (this->linked_data.emplace(data).second) {
|
if (this->linked_data.emplace(data).second) {
|
||||||
@@ -4037,7 +4048,7 @@ string MapFile::disassemble(bool reassembly, Version version) const {
|
|||||||
if (reassembly) {
|
if (reassembly) {
|
||||||
ret.emplace_back(ev.str());
|
ret.emplace_back(ev.str());
|
||||||
} else {
|
} else {
|
||||||
ret.emplace_back(std::format("/* index {} */ {}", z, ev.str()));
|
ret.emplace_back(std::format("/* index {:04X} */ {}", z, ev.str()));
|
||||||
}
|
}
|
||||||
if (ev.action_stream_offset >= sf.event_action_stream_bytes) {
|
if (ev.action_stream_offset >= sf.event_action_stream_bytes) {
|
||||||
ret.emplace_back(std::format(
|
ret.emplace_back(std::format(
|
||||||
@@ -4062,7 +4073,7 @@ string MapFile::disassemble(bool reassembly, Version version) const {
|
|||||||
if (reassembly) {
|
if (reassembly) {
|
||||||
ret.emplace_back(sec.str());
|
ret.emplace_back(sec.str());
|
||||||
} else {
|
} else {
|
||||||
ret.emplace_back(std::format("/* section index {} */ {}", z, sec.str()));
|
ret.emplace_back(std::format("/* section index {:04X} */ {}", z, sec.str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t z = 0; z < sf.random_enemy_location_count; z++) {
|
for (size_t z = 0; z < sf.random_enemy_location_count; z++) {
|
||||||
@@ -4070,7 +4081,7 @@ string MapFile::disassemble(bool reassembly, Version version) const {
|
|||||||
if (reassembly) {
|
if (reassembly) {
|
||||||
ret.emplace_back(ent.str());
|
ret.emplace_back(ent.str());
|
||||||
} else {
|
} else {
|
||||||
ret.emplace_back(std::format("/* entry index {} */ {}", z, ent.str()));
|
ret.emplace_back(std::format("/* entry index {:04X} */ {}", z, ent.str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret.emplace_back();
|
ret.emplace_back();
|
||||||
@@ -4088,7 +4099,7 @@ string MapFile::disassemble(bool reassembly, Version version) const {
|
|||||||
if (reassembly) {
|
if (reassembly) {
|
||||||
ret.emplace_back(def.str());
|
ret.emplace_back(def.str());
|
||||||
} else {
|
} else {
|
||||||
ret.emplace_back(std::format("/* definition index {} */ {}", z, def.str()));
|
ret.emplace_back(std::format("/* definition index {:04X} */ {}", z, def.str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (size_t z = 0; z < sf.random_enemy_definition_weight_count; z++) {
|
for (size_t z = 0; z < sf.random_enemy_definition_weight_count; z++) {
|
||||||
@@ -4096,7 +4107,7 @@ string MapFile::disassemble(bool reassembly, Version version) const {
|
|||||||
if (reassembly) {
|
if (reassembly) {
|
||||||
ret.emplace_back(weight.str());
|
ret.emplace_back(weight.str());
|
||||||
} else {
|
} else {
|
||||||
ret.emplace_back(std::format("/* weight index {} */ {}", z, weight.str()));
|
ret.emplace_back(std::format("/* weight index {:04X} */ {}", z, weight.str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret.emplace_back();
|
ret.emplace_back();
|
||||||
|
|||||||
@@ -380,6 +380,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct FloorSections {
|
struct FloorSections {
|
||||||
|
uint8_t floor = 0xFF;
|
||||||
|
|
||||||
size_t object_sets_file_offset = 0;
|
size_t object_sets_file_offset = 0;
|
||||||
size_t object_sets_file_size = 0;
|
size_t object_sets_file_size = 0;
|
||||||
const ObjectSetEntry* object_sets = nullptr;
|
const ObjectSetEntry* object_sets = nullptr;
|
||||||
|
|||||||
Reference in New Issue
Block a user