Refactor overworld editor to improve code organization and consolidate save logic
This commit is contained in:
@@ -701,32 +701,9 @@ void EditorManager::SaveRom() {
|
||||
status_ = screen_editor_.SaveDungeonMaps();
|
||||
RETURN_VOID_IF_ERROR(status_);
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldMaps) {
|
||||
RETURN_VOID_IF_ERROR(
|
||||
status_ = overworld_editor_.overworld()->CreateTile32Tilemap());
|
||||
status_ = overworld_editor_.overworld()->SaveMap32Tiles();
|
||||
RETURN_VOID_IF_ERROR(status_);
|
||||
status_ = overworld_editor_.overworld()->SaveMap16Tiles();
|
||||
RETURN_VOID_IF_ERROR(status_);
|
||||
status_ = overworld_editor_.overworld()->SaveOverworldMaps();
|
||||
RETURN_VOID_IF_ERROR(status_);
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldEntrances) {
|
||||
status_ = overworld_editor_.overworld()->SaveEntrances();
|
||||
RETURN_VOID_IF_ERROR(status_);
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldExits) {
|
||||
status_ = overworld_editor_.overworld()->SaveExits();
|
||||
RETURN_VOID_IF_ERROR(status_);
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldItems) {
|
||||
status_ = overworld_editor_.overworld()->SaveItems();
|
||||
RETURN_VOID_IF_ERROR(status_);
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldProperties) {
|
||||
status_ = overworld_editor_.overworld()->SaveMapProperties();
|
||||
RETURN_VOID_IF_ERROR(status_);
|
||||
}
|
||||
|
||||
status_ = overworld_editor_.Save();
|
||||
RETURN_VOID_IF_ERROR(status_);
|
||||
|
||||
status_ = rom()->SaveToFile(backup_rom_, save_new_auto_);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
|
||||
#include "app/core/constants.h"
|
||||
#include "app/core/platform/clipboard.h"
|
||||
#include "app/core/platform/renderer.h"
|
||||
@@ -988,6 +987,28 @@ void OverworldEditor::DrawOverworldSprites() {
|
||||
}
|
||||
}
|
||||
|
||||
absl::Status OverworldEditor::Save() {
|
||||
if (flags()->overworld.kSaveOverworldMaps) {
|
||||
RETURN_IF_ERROR(overworld_.CreateTile32Tilemap());
|
||||
RETURN_IF_ERROR(overworld_.SaveMap32Tiles());
|
||||
RETURN_IF_ERROR(overworld_.SaveMap16Tiles());
|
||||
RETURN_IF_ERROR(overworld_.SaveOverworldMaps());
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldEntrances) {
|
||||
RETURN_IF_ERROR(overworld_.SaveEntrances());
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldExits) {
|
||||
RETURN_IF_ERROR(overworld_.SaveExits());
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldItems) {
|
||||
RETURN_IF_ERROR(overworld_.SaveItems());
|
||||
}
|
||||
if (flags()->overworld.kSaveOverworldProperties) {
|
||||
RETURN_IF_ERROR(overworld_.SaveMapProperties());
|
||||
}
|
||||
return absl::OkStatus();
|
||||
}
|
||||
|
||||
absl::Status OverworldEditor::LoadGraphics() {
|
||||
// Load the Link to the Past overworld.
|
||||
RETURN_IF_ERROR(overworld_.Load(*rom()))
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/status/statusor.h"
|
||||
#include "absl/strings/str_format.h"
|
||||
|
||||
#include "app/editor/graphics/gfx_group_editor.h"
|
||||
#include "app/editor/graphics/palette_editor.h"
|
||||
#include "app/editor/graphics/tile16_editor.h"
|
||||
@@ -123,6 +122,7 @@ class OverworldEditor : public Editor,
|
||||
absl::Status Find() override {
|
||||
return absl::UnimplementedError("Find Unused Tiles");
|
||||
}
|
||||
absl::Status Save();
|
||||
|
||||
auto overworld() { return &overworld_; }
|
||||
|
||||
@@ -186,8 +186,6 @@ class OverworldEditor : public Editor,
|
||||
void DrawUsageGrid();
|
||||
void DrawDebugWindow();
|
||||
|
||||
auto gfx_group_editor() const { return gfx_group_editor_; }
|
||||
|
||||
enum class EditingMode {
|
||||
DRAW_TILE,
|
||||
ENTRANCES,
|
||||
|
||||
Reference in New Issue
Block a user