From b6280bc051dfc0508a8b774e337f13292a26c694 Mon Sep 17 00:00:00 2001 From: Justin Scofield <47263509+scawful@users.noreply.github.com> Date: Fri, 5 Aug 2022 20:09:22 -0400 Subject: [PATCH] Create Script class --- src/app/asm/script.cc | 4 ++-- src/app/asm/script.h | 8 +++++--- src/app/editor/screen_editor.cc | 2 +- src/app/editor/screen_editor.h | 7 +++++-- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/app/asm/script.cc b/src/app/asm/script.cc index 1533d54c..30535443 100644 --- a/src/app/asm/script.cc +++ b/src/app/asm/script.cc @@ -14,8 +14,8 @@ namespace yaze { namespace app { namespace snes_asm { -absl::StatusOr GenerateMosaicChangeAssembly( - MosaicArray mosaic_tiles) { +absl::StatusOr Script::GenerateMosaicChangeAssembly( + std::array mosaic_tiles) { std::fstream file("assets/asm/mosaic_change.asm", std::ios::out | std::ios::in); if (!file.is_open()) { diff --git a/src/app/asm/script.h b/src/app/asm/script.h index ccf66655..49212e35 100644 --- a/src/app/asm/script.h +++ b/src/app/asm/script.h @@ -15,11 +15,13 @@ namespace yaze { namespace app { namespace snes_asm { -using MosaicArray = std::array; constexpr char kDefaultMosaicHook[] = "$02AADB"; -absl::StatusOr GenerateMosaicChangeAssembly( - MosaicArray mosaic_tiles); +class Script { + public: + absl::StatusOr GenerateMosaicChangeAssembly( + std::array mosaic_tiles); +}; } // namespace snes_asm } // namespace app diff --git a/src/app/editor/screen_editor.cc b/src/app/editor/screen_editor.cc index 92096ed7..14e533fb 100644 --- a/src/app/editor/screen_editor.cc +++ b/src/app/editor/screen_editor.cc @@ -38,7 +38,7 @@ void ScreenEditor::Update() { void ScreenEditor::DrawMosaicEditor() { TAB_ITEM("Mosaic Transitions") if (ImGui::Button("GenerateMosaicChangeAssembly")) { - auto mosaic = snes_asm::GenerateMosaicChangeAssembly(mosaic_tiles_); + auto mosaic = mosaic_script_.GenerateMosaicChangeAssembly(mosaic_tiles_); if (!mosaic.ok()) { std::cout << "Failed to generate mosaic change assembly"; } else { diff --git a/src/app/editor/screen_editor.h b/src/app/editor/screen_editor.h index be92104a..bd9a900c 100644 --- a/src/app/editor/screen_editor.h +++ b/src/app/editor/screen_editor.h @@ -3,7 +3,10 @@ #include +#include + #include "app/asm/script.h" +#include "app/core/constants.h" #include "app/gfx/bitmap.h" #include "app/gfx/snes_tile.h" #include "app/zelda3/screen.h" @@ -32,8 +35,8 @@ class ScreenEditor { void DrawCanvas(); void DrawToolset(); - snes_asm::MosaicArray mosaic_tiles_; - + std::array mosaic_tiles_; + snes_asm::Script mosaic_script_; zelda3::Screen current_screen_; gui::Canvas screen_canvas_; };