From c1ad23284e2aaa8f3fd4e9973051f5181151b423 Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 11 Nov 2023 20:17:34 -0500 Subject: [PATCH] housekeeping --- src/app/core/pipeline.cc | 8 ++++---- src/app/core/pipeline.h | 2 +- src/app/editor/overworld_editor.cc | 3 +-- src/app/editor/sprite_editor.h | 2 ++ src/app/gfx/bitmap.h | 4 +++- src/app/zelda3/sprite/sprite.cc | 4 ++-- src/app/zelda3/sprite/sprite.h | 2 +- 7 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/app/core/pipeline.cc b/src/app/core/pipeline.cc index 8220e8a3..5e6a3c7d 100644 --- a/src/app/core/pipeline.cc +++ b/src/app/core/pipeline.cc @@ -83,11 +83,11 @@ void ButtonPipe(absl::string_view button_text, std::function callback) { } } -void BitmapCanvasPipeline(gui::Canvas& canvas, gfx::Bitmap& bitmap, int width, - int height, int tile_size, bool is_loaded, +void BitmapCanvasPipeline(gui::Canvas& canvas, const gfx::Bitmap& bitmap, + int width, int height, int tile_size, bool is_loaded, bool scrollbar, int canvas_id) { - auto draw_canvas = [](gui::Canvas& canvas, gfx::Bitmap& bitmap, int width, - int height, int tile_size, bool is_loaded) { + auto draw_canvas = [](gui::Canvas& canvas, const gfx::Bitmap& bitmap, + int width, int height, int tile_size, bool is_loaded) { canvas.DrawBackground(ImVec2(width + 1, height + 1)); canvas.DrawContextMenu(); canvas.DrawBitmap(bitmap, 2, is_loaded); diff --git a/src/app/core/pipeline.h b/src/app/core/pipeline.h index ec2f887c..8424e0b2 100644 --- a/src/app/core/pipeline.h +++ b/src/app/core/pipeline.h @@ -29,7 +29,7 @@ void GraphicsBinCanvasPipeline(int width, int height, int tile_size, void ButtonPipe(absl::string_view button_text, std::function callback); -void BitmapCanvasPipeline(gui::Canvas& canvas, gfx::Bitmap& bitmap, int width, +void BitmapCanvasPipeline(gui::Canvas& canvas, const gfx::Bitmap& bitmap, int width, int height, int tile_size, bool is_loaded, bool scrollbar, int canvas_id); diff --git a/src/app/editor/overworld_editor.cc b/src/app/editor/overworld_editor.cc index 3e051122..b6ef9168 100644 --- a/src/app/editor/overworld_editor.cc +++ b/src/app/editor/overworld_editor.cc @@ -33,8 +33,7 @@ absl::Status OverworldEditor::Update() { if (rom()->isLoaded() && !all_gfx_loaded_) { RETURN_IF_ERROR(LoadGraphics()) tile16_editor_.InitBlockset(tile16_blockset_bmp_); - gfx_group_editor_.InitBlockset(tile16_blockset_bmp_, graphics_bin_, - palette_); + gfx_group_editor_.InitBlockset(tile16_blockset_bmp_); all_gfx_loaded_ = true; } diff --git a/src/app/editor/sprite_editor.h b/src/app/editor/sprite_editor.h index 7fe7af10..4bee1ae2 100644 --- a/src/app/editor/sprite_editor.h +++ b/src/app/editor/sprite_editor.h @@ -6,10 +6,12 @@ namespace yaze { namespace app { namespace editor { + class SpriteEditor { public: absl::Status Update(); }; + } // namespace editor } // namespace app } // namespace yaze diff --git a/src/app/gfx/bitmap.h b/src/app/gfx/bitmap.h index 33eaa008..3cf71470 100644 --- a/src/app/gfx/bitmap.h +++ b/src/app/gfx/bitmap.h @@ -6,12 +6,14 @@ #include #include +#include "absl/container/flat_hash_map.h" #include "absl/status/status.h" #include "absl/status/statusor.h" #include "absl/strings/str_cat.h" #include "app/core/constants.h" #include "app/gfx/snes_palette.h" + namespace yaze { namespace app { namespace gfx { @@ -113,7 +115,7 @@ class Bitmap { std::shared_ptr surface_ = nullptr; }; -using BitmapTable = std::unordered_map; +using BitmapTable = absl::flat_hash_map; } // namespace gfx } // namespace app diff --git a/src/app/zelda3/sprite/sprite.cc b/src/app/zelda3/sprite/sprite.cc index 96257a39..ba0562aa 100644 --- a/src/app/zelda3/sprite/sprite.cc +++ b/src/app/zelda3/sprite/sprite.cc @@ -11,8 +11,8 @@ Sprite::Sprite() { } } -void Sprite::InitSprite(Bytes& src, uchar mapid, uchar id, uchar x, uchar y, - int map_x, int map_y) { +void Sprite::InitSprite(const Bytes& src, uchar mapid, uchar id, uchar x, + uchar y, int map_x, int map_y) { current_gfx_ = src; overworld_ = true; map_id_ = mapid; diff --git a/src/app/zelda3/sprite/sprite.h b/src/app/zelda3/sprite/sprite.h index 770f65a4..81b876ad 100644 --- a/src/app/zelda3/sprite/sprite.h +++ b/src/app/zelda3/sprite/sprite.h @@ -23,7 +23,7 @@ class Sprite { Sprite(); Sprite(Bytes src, uchar mapid, uchar id, uchar x, uchar y, int map_x, int map_y); - void InitSprite(Bytes& src, uchar mapid, uchar id, uchar x, uchar y, + void InitSprite(const Bytes& src, uchar mapid, uchar id, uchar x, uchar y, int map_x, int map_y); void updateBBox();