diff --git a/src/app/zelda3/overworld.cc b/src/app/zelda3/overworld.cc index e6ef8551..63fadfae 100644 --- a/src/app/zelda3/overworld.cc +++ b/src/app/zelda3/overworld.cc @@ -107,15 +107,16 @@ void Overworld::AssembleMap32Tiles() { void Overworld::AssembleMap16Tiles() { int tpos = core::constants::map16Tiles; + auto rom_data = rom_.GetRawData(); for (int i = 0; i < 4096; i += 1) // 3760 { - TileInfo t0 = GetTilesInfo((uintptr_t)rom_.GetRawData() + tpos); + TileInfo t0 = GetTilesInfo((uintptr_t)(rom_data + tpos)); tpos += 2; - TileInfo t1 = GetTilesInfo((uintptr_t)rom_.GetRawData() + tpos); + TileInfo t1 = GetTilesInfo((uintptr_t)(rom_data + tpos)); tpos += 2; - TileInfo t2 = GetTilesInfo((uintptr_t)rom_.GetRawData() + tpos); + TileInfo t2 = GetTilesInfo((uintptr_t)(rom_data + tpos)); tpos += 2; - TileInfo t3 = GetTilesInfo((uintptr_t)rom_.GetRawData() + tpos); + TileInfo t3 = GetTilesInfo((uintptr_t)(rom_data + tpos)); tpos += 2; tiles16.push_back(Tile16(t0, t1, t2, t3)); } diff --git a/src/gui/editor/overworld_editor.cc b/src/gui/editor/overworld_editor.cc index 78924570..f41fd56b 100644 --- a/src/gui/editor/overworld_editor.cc +++ b/src/gui/editor/overworld_editor.cc @@ -449,6 +449,13 @@ void OverworldEditor::DrawChangelist() { } void OverworldEditor::LoadBlockset() { + + current_gfx_bmp_.Create(128, 512, 64, current_gfx_ptr_); + current_gfx_bmp_.CreateTexture(rom_.Renderer()); + + tile16_blockset_bmp_.Create(128, 8192, 8, tile16_blockset_ptr_); + tile16_blockset_bmp_.CreateTexture(rom_.Renderer()); + rom_.CreateAllGraphicsData(allGfx16Ptr); auto tiles = overworld_.GetTiles16(); app::gfx::BuildTiles16Gfx(overworld_.GetMapBlockset16Ptr(), diff --git a/src/gui/editor/overworld_editor.h b/src/gui/editor/overworld_editor.h index 1062d946..ee2e0a1d 100644 --- a/src/gui/editor/overworld_editor.h +++ b/src/gui/editor/overworld_editor.h @@ -33,32 +33,31 @@ class OverworldEditor { void LoadBlockset(); void LoadGraphics(); - app::rom::ROM rom_; app::zelda3::Overworld overworld_; + app::gfx::SNESPalette palette_; + app::gfx::TilePreset current_set_; + + app::rom::ROM rom_; + + app::gfx::Bitmap tile16_blockset_bmp_; + uchar *tile16_blockset_ptr_ = new uchar[1048576]; + + app::gfx::Bitmap current_gfx_bmp_; + uchar *current_gfx_ptr_ = new uchar[(128 * 512) / 2]; + app::gfx::Bitmap allgfxBitmap; app::gfx::Bitmap mapblockset16Bitmap; - app::gfx::SNESPalette palette_; - app::gfx::TilePreset current_set_; std::unordered_map all_texture_sheet_; - SDL_Texture *gfx_texture = nullptr; - - int allgfx_width = 0; - int allgfx_height = 0; - uchar *allGfx16Ptr = new uchar[(128 * 7136) / 2]; - float canvas_table_ratio = 30.f; - + int current_world_ = 0; char map_gfx_[3] = ""; char map_palette_[3] = ""; char spr_gfx_[3] = ""; char spr_palette_[3] = ""; char message_id_[5] = ""; - - int current_world_ = 0; - bool isLoaded = false; bool doneLoaded = false; bool opt_enable_grid = true; @@ -68,9 +67,9 @@ class OverworldEditor { constexpr static int kByteSize = 3; constexpr static int kMessageIdSize = 5; - constexpr static float kInputFieldSize = 30.f; constexpr static int kNumSheetsToLoad = 100; constexpr static int kTile8DisplayHeight = 64; + constexpr static float kInputFieldSize = 30.f; ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit; ImGuiTableFlags ow_map_settings_flags = ImGuiTableFlags_Borders;