Refactor overworld editor to improve code organization and consolidate save logic
This commit is contained in:
@@ -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