Update Overworld save function class visibility for MasterEditor
This commit is contained in:
@@ -349,16 +349,16 @@ void MasterEditor::DrawFileMenu() {
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
Checkbox("Enable console logging", &mutable_flags()->kLogToConsole);
|
||||
Checkbox("Enable Console Logging", &mutable_flags()->kLogToConsole);
|
||||
Checkbox("Enable Texture Streaming",
|
||||
&mutable_flags()->kLoadTexturesAsStreaming);
|
||||
Checkbox("Use Bitmap Manager", &mutable_flags()->kUseBitmapManager);
|
||||
Checkbox("Log Instructions to Debugger",
|
||||
&mutable_flags()->kLogInstructions);
|
||||
Checkbox("Use New ImGui Input", &mutable_flags()->kUseNewImGuiInput);
|
||||
Checkbox("Save All Palettes", &mutable_flags()->kSaveAllPalettes);
|
||||
Checkbox("Save With Change Queue",
|
||||
&mutable_flags()->kSaveWithChangeQueue);
|
||||
Checkbox("Use New ImGui Input", &mutable_flags()->kUseNewImGuiInput);
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
@@ -540,8 +540,18 @@ void MasterEditor::SaveRom() {
|
||||
PRINT_IF_ERROR(status_);
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldMaps) {
|
||||
status_ = overworld_editor_.overworld()->SaveOverworldMaps();
|
||||
PRINT_IF_ERROR(status_);
|
||||
if (overworld_editor_.overworld()->CreateTile32Tilemap()) {
|
||||
status_ = overworld_editor_.overworld()->SaveMap16Tiles();
|
||||
PRINT_IF_ERROR(status_);
|
||||
status_ = overworld_editor_.overworld()->SaveMap32Tiles();
|
||||
PRINT_IF_ERROR(status_);
|
||||
status_ = overworld_editor_.overworld()->SaveOverworldMaps();
|
||||
PRINT_IF_ERROR(status_);
|
||||
} else {
|
||||
status_ = absl::InternalError(
|
||||
"Failed to save Overworld maps, aborting ROM save.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldEntrances) {
|
||||
status_ = overworld_editor_.overworld()->SaveEntrances();
|
||||
|
||||
@@ -136,7 +136,7 @@ absl::Status Overworld::Load(ROM &rom) {
|
||||
RETURN_IF_ERROR(DecompressAllMapTiles())
|
||||
|
||||
for (int map_index = 0; map_index < kNumOverworldMaps; ++map_index)
|
||||
overworld_maps_.emplace_back(map_index, rom_, tiles16);
|
||||
overworld_maps_.emplace_back(map_index, rom_, tiles16_);
|
||||
|
||||
FetchLargeMaps();
|
||||
LoadEntrances();
|
||||
@@ -163,7 +163,7 @@ absl::Status Overworld::Save(ROM &rom) {
|
||||
}
|
||||
|
||||
absl::Status Overworld::LoadOverworldMaps() {
|
||||
auto size = tiles16.size();
|
||||
auto size = tiles16_.size();
|
||||
std::vector<std::future<absl::Status>> futures;
|
||||
for (int i = 0; i < kNumOverworldMaps; ++i) {
|
||||
int world_type = 0;
|
||||
@@ -214,9 +214,9 @@ absl::Status Overworld::SaveOverworldMaps() {
|
||||
|
||||
// Compress single_map_1 and single_map_2
|
||||
ASSIGN_OR_RETURN(
|
||||
auto a, gfx::lc_lz2::CompressOverworld(single_map_1.data(), 0, 256))
|
||||
auto a, gfx::lc_lz2::CompressOverworld(single_map_1, 0, 256))
|
||||
ASSIGN_OR_RETURN(
|
||||
auto b, gfx::lc_lz2::CompressOverworld(single_map_2.data(), 0, 256))
|
||||
auto b, gfx::lc_lz2::CompressOverworld(single_map_2, 0, 256))
|
||||
if (a.empty() || b.empty()) {
|
||||
return absl::AbortedError("Error compressing map gfx.");
|
||||
}
|
||||
@@ -557,13 +557,13 @@ absl::Status Overworld::SaveMap16Tiles() {
|
||||
int tpos = kMap16Tiles;
|
||||
// 3760
|
||||
for (int i = 0; i < NumberOfMap16; i += 1) {
|
||||
RETURN_IF_ERROR(rom()->WriteShort(tpos, TileInfoToShort(tiles16[i].tile0_)))
|
||||
RETURN_IF_ERROR(rom()->WriteShort(tpos, TileInfoToShort(tiles16_[i].tile0_)))
|
||||
tpos += 2;
|
||||
RETURN_IF_ERROR(rom()->WriteShort(tpos, TileInfoToShort(tiles16[i].tile1_)))
|
||||
RETURN_IF_ERROR(rom()->WriteShort(tpos, TileInfoToShort(tiles16_[i].tile1_)))
|
||||
tpos += 2;
|
||||
RETURN_IF_ERROR(rom()->WriteShort(tpos, TileInfoToShort(tiles16[i].tile2_)))
|
||||
RETURN_IF_ERROR(rom()->WriteShort(tpos, TileInfoToShort(tiles16_[i].tile2_)))
|
||||
tpos += 2;
|
||||
RETURN_IF_ERROR(rom()->WriteShort(tpos, TileInfoToShort(tiles16[i].tile3_)))
|
||||
RETURN_IF_ERROR(rom()->WriteShort(tpos, TileInfoToShort(tiles16_[i].tile3_)))
|
||||
tpos += 2;
|
||||
}
|
||||
return absl::OkStatus();
|
||||
@@ -683,7 +683,7 @@ void Overworld::AssembleMap16Tiles() {
|
||||
tpos += 2;
|
||||
auto t3 = gfx::GetTilesInfo(rom()->toint16(tpos));
|
||||
tpos += 2;
|
||||
tiles16.emplace_back(t0, t1, t2, t3);
|
||||
tiles16_.emplace_back(t0, t1, t2, t3);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1103,12 +1103,12 @@ absl::Status Overworld::LoadPrototype(ROM &rom,
|
||||
RETURN_IF_ERROR(DecompressProtoMapTiles(tilemap_filename))
|
||||
|
||||
for (int map_index = 0; map_index < kNumOverworldMaps; ++map_index)
|
||||
overworld_maps_.emplace_back(map_index, rom_, tiles16);
|
||||
overworld_maps_.emplace_back(map_index, rom_, tiles16_);
|
||||
|
||||
FetchLargeMaps();
|
||||
LoadEntrances();
|
||||
|
||||
auto size = tiles16.size();
|
||||
auto size = tiles16_.size();
|
||||
std::vector<std::future<absl::Status>> futures;
|
||||
for (int i = 0; i < kNumOverworldMaps; ++i) {
|
||||
futures.push_back(std::async(std::launch::async, [this, i, size]() {
|
||||
|
||||
@@ -130,14 +130,14 @@ class OverworldExit {
|
||||
}
|
||||
|
||||
// Overworld overworld
|
||||
void UpdateMapProperties(uchar map_id) {
|
||||
void UpdateMapProperties(uchar map_id, bool large_map = false) {
|
||||
map_id_ = map_id;
|
||||
|
||||
int large = 256;
|
||||
int mapid = map_id;
|
||||
|
||||
if (map_id < 128) {
|
||||
// large = overworld.overworld_map(map_id)->IsLargeMap() ? 768 : 256;
|
||||
large = large_map ? 768 : 256;
|
||||
// if (overworld.overworld_map(map_id)->Parent() != map_id) {
|
||||
// mapid = overworld.overworld_map(map_id)->Parent();
|
||||
// }
|
||||
@@ -365,6 +365,7 @@ class Overworld : public SharedROM, public core::ExperimentFlags {
|
||||
auto mutable_overworld_map(int i) { return &overworld_maps_[i]; }
|
||||
auto exits() const { return &all_exits_; }
|
||||
auto mutable_exits() { return &all_exits_; }
|
||||
std::vector<gfx::Tile16> tiles16() const { return tiles16_; }
|
||||
|
||||
auto Sprites(int state) const { return all_sprites_[state]; }
|
||||
auto AreaGraphics() const {
|
||||
@@ -421,7 +422,7 @@ class Overworld : public SharedROM, public core::ExperimentFlags {
|
||||
ROM rom_;
|
||||
OWMapTiles map_tiles_;
|
||||
|
||||
std::vector<gfx::Tile16> tiles16;
|
||||
std::vector<gfx::Tile16> tiles16_;
|
||||
std::vector<gfx::Tile32> tiles32;
|
||||
std::vector<gfx::Tile32> tiles32_unique_;
|
||||
std::vector<OverworldMap> overworld_maps_;
|
||||
|
||||
@@ -267,6 +267,8 @@ void OverworldMap::LoadAreaInfo() {
|
||||
}
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
void OverworldMap::LoadWorldIndex() {
|
||||
if (parent_ < 0x40) {
|
||||
world_index_ = 0x20;
|
||||
@@ -427,6 +429,9 @@ absl::Status OverworldMap::BuildTileset() {
|
||||
}
|
||||
|
||||
absl::Status OverworldMap::BuildTiles16Gfx(int count) {
|
||||
if (current_blockset_.size() != 0) {
|
||||
current_blockset_.clear();
|
||||
}
|
||||
current_blockset_.reserve(0x100000);
|
||||
for (int i = 0; i < 0x100000; i++) {
|
||||
current_blockset_.push_back(0x00);
|
||||
@@ -474,6 +479,9 @@ absl::Status OverworldMap::BuildTiles16Gfx(int count) {
|
||||
}
|
||||
|
||||
absl::Status OverworldMap::BuildBitmap(OWBlockset& world_blockset) {
|
||||
if (bitmap_data_.size() != 0) {
|
||||
bitmap_data_.clear();
|
||||
}
|
||||
bitmap_data_.reserve(0x40000);
|
||||
for (int i = 0; i < 0x40000; i++) {
|
||||
bitmap_data_.push_back(0x00);
|
||||
|
||||
@@ -30,6 +30,12 @@ class OverworldMap {
|
||||
absl::Status BuildMap(int count, int game_state, int world, uchar* map_parent,
|
||||
OWBlockset& world_blockset);
|
||||
|
||||
void LoadAreaGraphics();
|
||||
void LoadPalette();
|
||||
absl::Status BuildTileset();
|
||||
absl::Status BuildTiles16Gfx(int count);
|
||||
absl::Status BuildBitmap(OWBlockset& world_blockset);
|
||||
|
||||
auto Tile16Blockset() const { return current_blockset_; }
|
||||
auto AreaGraphics() const { return current_gfx_; }
|
||||
auto AreaPalette() const { return current_palette_; }
|
||||
@@ -38,6 +44,8 @@ class OverworldMap {
|
||||
auto IsLargeMap() const { return large_map_; }
|
||||
auto IsInitialized() const { return initialized_; }
|
||||
auto Parent() const { return parent_; }
|
||||
|
||||
auto mutable_current_palette() { return ¤t_palette_; }
|
||||
|
||||
auto area_graphics() const { return area_graphics_; }
|
||||
auto area_palette() const { return area_palette_; }
|
||||
@@ -55,6 +63,14 @@ class OverworldMap {
|
||||
auto mutable_area_music(int i) { return &area_music_[i]; }
|
||||
auto mutable_static_graphics(int i) { return &static_graphics_[i]; }
|
||||
|
||||
auto set_area_graphics(uint8_t value) { area_graphics_ = value; }
|
||||
auto set_area_palette(uint8_t value) { area_palette_ = value; }
|
||||
auto set_sprite_graphics(int i, uint8_t value) {
|
||||
sprite_graphics_[i] = value;
|
||||
}
|
||||
auto set_sprite_palette(int i, uint8_t value) { sprite_palette_[i] = value; }
|
||||
auto set_message_id(uint16_t value) { message_id_ = value; }
|
||||
|
||||
private:
|
||||
void LoadAreaInfo();
|
||||
|
||||
@@ -63,18 +79,11 @@ class OverworldMap {
|
||||
void LoadMainBlocksets();
|
||||
void LoadAreaGraphicsBlocksets();
|
||||
void LoadDeathMountainGFX();
|
||||
void LoadAreaGraphics();
|
||||
|
||||
void LoadPalette();
|
||||
|
||||
void ProcessGraphicsBuffer(int index, int static_graphics_offset, int size);
|
||||
gfx::SNESPalette GetPalette(const std::string& group, int index,
|
||||
int previousIndex, int limit);
|
||||
|
||||
absl::Status BuildTileset();
|
||||
absl::Status BuildTiles16Gfx(int count);
|
||||
absl::Status BuildBitmap(OWBlockset& world_blockset);
|
||||
|
||||
bool built_ = false;
|
||||
bool large_map_ = false;
|
||||
bool initialized_ = false;
|
||||
|
||||
Reference in New Issue
Block a user