From b1f9e2e253e4d4a2f7abfdcc7e994f1613930883 Mon Sep 17 00:00:00 2001 From: scawful Date: Fri, 10 Nov 2023 23:20:58 -0500 Subject: [PATCH] Prepare GraphicsEditor for Link gfx --- src/app/editor/graphics_editor.cc | 47 ++++++++++++++++++++++++++----- src/app/editor/graphics_editor.h | 33 +++++++++++++--------- 2 files changed, 60 insertions(+), 20 deletions(-) diff --git a/src/app/editor/graphics_editor.cc b/src/app/editor/graphics_editor.cc index 2f2f245f..f884d3c7 100644 --- a/src/app/editor/graphics_editor.cc +++ b/src/app/editor/graphics_editor.cc @@ -26,6 +26,39 @@ namespace app { namespace editor { absl::Status GraphicsEditor::Update() { + TAB_BAR("##TabBar") + status_ = UpdateScadView(); + status_ = UpdateLinkGfxView(); + END_TAB_BAR() + CLEAR_AND_RETURN_STATUS(status_) + return absl::OkStatus(); +} + +absl::Status GraphicsEditor::UpdateLinkGfxView() { + TAB_ITEM("Player Animations") + + const auto link_gfx_offset = 0x80000; + const auto link_gfx_length = 0x7000; + + // Load Links graphics from the ROM + RETURN_IF_ERROR(rom()->LoadLinkGraphics()); + + // Split it into the pose data frames + + // Create an animation step display for the poses + + // Allow the user to modify the frames used in an anim step + + // LinkOAM_AnimationSteps: + // #_0D85FB + + END_TAB_ITEM() + return absl::OkStatus(); +} + +absl::Status GraphicsEditor::UpdateScadView() { + TAB_ITEM("Prototype") + RETURN_IF_ERROR(DrawToolset()) if (open_memory_editor_) { @@ -74,12 +107,12 @@ absl::Status GraphicsEditor::Update() { cgx_loaded_, true, 5); } else { // Load the BIN/Clipboard Graphics - core::BitmapCanvasPipeline(import_canvas_, bitmap_, 0x100, 16384, 0x20, + core::BitmapCanvasPipeline(import_canvas_, bin_bitmap_, 0x100, 16384, 0x20, gfx_loaded_, true, 2); } END_TABLE() - CLEAR_AND_RETURN_STATUS(status_) + END_TAB_ITEM() return absl::OkStatus(); } @@ -352,20 +385,20 @@ absl::Status GraphicsEditor::DecompressImportData(int size) { temp_rom_.data(), current_offset_, size)) auto converted_sheet = gfx::SnesTo8bppSheet(import_data_, 3); - bitmap_.Create(core::kTilesheetWidth, 0x2000, core::kTilesheetDepth, - converted_sheet.data(), size); + bin_bitmap_.Create(core::kTilesheetWidth, 0x2000, core::kTilesheetDepth, + converted_sheet.data(), size); if (rom()->isLoaded()) { auto palette_group = rom()->GetPaletteGroup("ow_main"); z3_rom_palette_ = palette_group[current_palette_]; if (col_file_) { - bitmap_.ApplyPalette(col_file_palette_); + bin_bitmap_.ApplyPalette(col_file_palette_); } else { - bitmap_.ApplyPalette(z3_rom_palette_); + bin_bitmap_.ApplyPalette(z3_rom_palette_); } } - rom()->RenderBitmap(&bitmap_); + rom()->RenderBitmap(&bin_bitmap_); gfx_loaded_ = true; return absl::OkStatus(); diff --git a/src/app/editor/graphics_editor.h b/src/app/editor/graphics_editor.h index edd792ef..12975ea3 100644 --- a/src/app/editor/graphics_editor.h +++ b/src/app/editor/graphics_editor.h @@ -65,6 +65,9 @@ class GraphicsEditor : public SharedROM { absl::Status Update(); private: + absl::Status UpdateLinkGfxView(); + absl::Status UpdateScadView(); + absl::Status DrawToolset(); absl::Status DrawCgxImport(); @@ -130,6 +133,13 @@ class GraphicsEditor : public SharedROM { ROM temp_rom_; ROM tilemap_rom_; + zelda3::Overworld overworld_; + + MemoryEditor cgx_memory_editor_; + MemoryEditor col_memory_editor_; + + PaletteEditor palette_editor_; + Bytes import_data_; Bytes graphics_buffer_; @@ -141,31 +151,28 @@ class GraphicsEditor : public SharedROM { std::vector scr_data_; std::vector decoded_scr_data_; - zelda3::Overworld overworld_; - - MemoryEditor cgx_memory_editor_; - MemoryEditor col_memory_editor_; - - PaletteEditor palette_editor_; - gfx::Bitmap cgx_bitmap_; gfx::Bitmap scr_bitmap_; + gfx::Bitmap bin_bitmap_; - gfx::Bitmap bitmap_; - gui::Canvas import_canvas_; + gfx::Bitmap link_full_sheet_; - gui::Canvas scr_canvas_; - - gui::Canvas super_donkey_canvas_; gfx::BitmapTable graphics_bin_; - gfx::BitmapTable clipboard_graphics_bin_; + gfx::BitmapTable link_graphics_; + gfx::PaletteGroup col_file_palette_group_; gfx::SNESPalette z3_rom_palette_; gfx::SNESPalette col_file_palette_; + gfx::SNESPalette link_palette_; + + gui::Canvas import_canvas_; + gui::Canvas scr_canvas_; + gui::Canvas super_donkey_canvas_; + absl::Status status_; };