From bbe76ac83c0df0701fe8b0d348ec9006fe2aff5a Mon Sep 17 00:00:00 2001 From: scawful Date: Mon, 20 Nov 2023 21:12:02 -0500 Subject: [PATCH] housekeeping, accessors, gui, etc --- src/app/editor/dungeon_editor.cc | 25 +++++--- src/app/editor/modules/gfx_group_editor.cc | 6 +- src/app/editor/modules/tile16_editor.cc | 2 +- src/app/editor/overworld_editor.cc | 74 ++++++++++++---------- src/app/editor/overworld_editor.h | 5 +- src/app/rom.h | 26 ++++---- src/app/zelda3/dungeon/room.cc | 7 +- src/app/zelda3/dungeon/room_object.h | 2 +- src/app/zelda3/overworld.cc | 14 ++-- src/app/zelda3/overworld.h | 3 + src/app/zelda3/overworld_map.cc | 18 +++--- src/cli/command_handler.h | 2 +- 12 files changed, 100 insertions(+), 84 deletions(-) diff --git a/src/app/editor/dungeon_editor.cc b/src/app/editor/dungeon_editor.cc index 66565177f..b4f4a3f17 100644 --- a/src/app/editor/dungeon_editor.cc +++ b/src/app/editor/dungeon_editor.cc @@ -14,6 +14,11 @@ namespace yaze { namespace app { namespace editor { +using ImGui::TableHeadersRow; +using ImGui::TableNextColumn; +using ImGui::TableNextRow; +using ImGui::TableSetupColumn; + absl::Status DungeonEditor::Update() { if (!is_loaded_ && rom()->isLoaded()) { for (int i = 0; i < 0x100; i++) { @@ -29,14 +34,14 @@ absl::Status DungeonEditor::Update() { ImGui::Separator(); if (ImGui::BeginTable("#DungeonEditTable", 3, toolset_table_flags_, ImVec2(0, 0))) { - ImGui::TableSetupColumn("Room Selector"); - - ImGui::TableSetupColumn("Canvas", ImGuiTableColumnFlags_WidthStretch, - ImGui::GetContentRegionAvail().x); - ImGui::TableSetupColumn("Object Selector"); - ImGui::TableHeadersRow(); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); + TableSetupColumn("Room Selector"); + + TableSetupColumn("Canvas", ImGuiTableColumnFlags_WidthStretch, + ImGui::GetContentRegionAvail().x); + TableSetupColumn("Object Selector"); + TableHeadersRow(); + TableNextRow(); + TableNextColumn(); if (rom()->isLoaded()) { if (ImGuiID child_id = ImGui::GetID((void*)(intptr_t)9); ImGui::BeginChild(child_id, ImGui::GetContentRegionAvail(), true, @@ -53,9 +58,9 @@ absl::Status DungeonEditor::Update() { ImGui::EndChild(); } - ImGui::TableNextColumn(); + TableNextColumn(); DrawDungeonTabView(); - ImGui::TableNextColumn(); + TableNextColumn(); DrawTileSelector(); ImGui::EndTable(); } diff --git a/src/app/editor/modules/gfx_group_editor.cc b/src/app/editor/modules/gfx_group_editor.cc index 57df667f8..78692c478 100644 --- a/src/app/editor/modules/gfx_group_editor.cc +++ b/src/app/editor/modules/gfx_group_editor.cc @@ -59,7 +59,7 @@ absl::Status GfxGroupEditor::Update() { ImGui::BeginGroup(); for (int i = 0; i < 8; i++) { int sheet_id = rom()->main_blockset_ids[selected_blockset_][i]; - auto &sheet = *rom()->BitmapManager()[sheet_id]; + auto &sheet = *rom()->bitmap_manager()[sheet_id]; if (sheet_id != last_sheet_id_) { last_sheet_id_ = sheet_id; auto palette_group = rom()->GetPaletteGroup("ow_main"); @@ -109,7 +109,7 @@ absl::Status GfxGroupEditor::Update() { ImGui::BeginGroup(); for (int i = 0; i < 4; i++) { int sheet_id = rom()->room_blockset_ids[selected_roomset_][i]; - auto &sheet = *rom()->BitmapManager()[sheet_id]; + auto &sheet = *rom()->bitmap_manager()[sheet_id]; core::BitmapCanvasPipeline(roomset_canvas_, sheet, 256, 0x10 * 0x04, 0x20, true, false, 23); } @@ -152,7 +152,7 @@ absl::Status GfxGroupEditor::Update() { ImGui::BeginGroup(); for (int i = 0; i < 4; i++) { int sheet_id = rom()->spriteset_ids[selected_spriteset_][i]; - auto sheet = *rom()->BitmapManager()[sheet_id]; + auto sheet = *rom()->bitmap_manager()[sheet_id]; core::BitmapCanvasPipeline(spriteset_canvas_, sheet, 256, 0x10 * 0x04, 0x20, true, false, 24); } diff --git a/src/app/editor/modules/tile16_editor.cc b/src/app/editor/modules/tile16_editor.cc index 711170298..41578aee8 100644 --- a/src/app/editor/modules/tile16_editor.cc +++ b/src/app/editor/modules/tile16_editor.cc @@ -120,7 +120,7 @@ absl::Status Tile16Editor::Update() { if (transfer_started_ && !transfer_blockset_loaded_) { PRINT_IF_ERROR(transfer_rom_.LoadAllGraphicsData()) - graphics_bin_ = transfer_rom_.GetGraphicsBin(); + graphics_bin_ = transfer_rom_.graphics_bin(); // Load the Link to the Past overworld. PRINT_IF_ERROR(transfer_overworld_.Load(transfer_rom_)) diff --git a/src/app/editor/overworld_editor.cc b/src/app/editor/overworld_editor.cc index 1801e66f4..02b4f7df8 100644 --- a/src/app/editor/overworld_editor.cc +++ b/src/app/editor/overworld_editor.cc @@ -27,6 +27,11 @@ namespace app { namespace editor { using ImGui::Separator; +using ImGui::TableHeadersRow; +using ImGui::TableNextColumn; +using ImGui::TableNextRow; +using ImGui::TableSetupColumn; +using ImGui::Text; absl::Status OverworldEditor::Update() { // Initialize overworld graphics, maps, and palettes @@ -43,14 +48,14 @@ absl::Status OverworldEditor::Update() { Separator(); if (ImGui::BeginTable(kOWEditTable.data(), 2, kOWEditFlags, ImVec2(0, 0))) { - ImGui::TableSetupColumn("Canvas", ImGuiTableColumnFlags_WidthStretch, - ImGui::GetContentRegionAvail().x); - ImGui::TableSetupColumn("Tile Selector"); - ImGui::TableHeadersRow(); - ImGui::TableNextRow(); - ImGui::TableNextColumn(); + TableSetupColumn("Canvas", ImGuiTableColumnFlags_WidthStretch, + ImGui::GetContentRegionAvail().x); + TableSetupColumn("Tile Selector"); + TableHeadersRow(); + TableNextRow(); + TableNextColumn(); DrawOverworldCanvas(); - ImGui::TableNextColumn(); + TableNextColumn(); DrawTileSelector(); ImGui::EndTable(); } @@ -103,22 +108,22 @@ absl::Status OverworldEditor::DrawToolset() { BUTTON_COLUMN(ICON_MD_ADD_LOCATION) // Transports BUTTON_COLUMN(ICON_MD_MUSIC_NOTE) // Music - ImGui::TableNextColumn(); + TableNextColumn(); if (ImGui::Button(ICON_MD_GRID_VIEW)) { show_tile16 = !show_tile16; } - ImGui::TableNextColumn(); + TableNextColumn(); if (ImGui::Button(ICON_MD_TABLE_CHART)) { show_gfx_group = !show_gfx_group; } TEXT_COLUMN(ICON_MD_MORE_VERT) // Separator - ImGui::TableNextColumn(); // Palette + TableNextColumn(); // Palette palette_editor_.DisplayPalette(palette_, overworld_.isLoaded()); TEXT_COLUMN(ICON_MD_MORE_VERT) // Separator - ImGui::TableNextColumn(); // Experimental + TableNextColumn(); // Experimental ImGui::Checkbox("Experimental", &show_experimental); ImGui::EndTable(); @@ -150,45 +155,46 @@ void OverworldEditor::DrawOverworldMapSettings() { for (const auto &name : kOverworldSettingsColumnNames) ImGui::TableSetupColumn(name.data()); - ImGui::TableNextColumn(); + TableNextColumn(); ImGui::SetNextItemWidth(100.f); ImGui::Combo("##world", ¤t_world_, kWorldList.data(), 3); - ImGui::TableNextColumn(); - ImGui::Text("GFX"); + TableNextColumn(); + Text("GFX"); ImGui::SameLine(); ImGui::SetNextItemWidth(kInputFieldSize); ImGui::InputText("##mapGFX", map_gfx_, kByteSize); - ImGui::TableNextColumn(); - ImGui::Text("Palette"); + TableNextColumn(); + Text("Palette"); ImGui::SameLine(); ImGui::SetNextItemWidth(kInputFieldSize); ImGui::InputText("##mapPal", map_palette_, kByteSize); - ImGui::TableNextColumn(); - ImGui::Text("Spr GFX"); + TableNextColumn(); + Text("Spr GFX"); ImGui::SameLine(); ImGui::SetNextItemWidth(kInputFieldSize); ImGui::InputText("##sprGFX", spr_gfx_, kByteSize); - ImGui::TableNextColumn(); - ImGui::Text("Spr Palette"); + TableNextColumn(); + Text("Spr Palette"); ImGui::SameLine(); ImGui::SetNextItemWidth(kInputFieldSize); ImGui::InputText("##sprPal", spr_palette_, kByteSize); - ImGui::TableNextColumn(); - ImGui::Text("Msg ID"); + TableNextColumn(); + Text("Msg ID"); ImGui::SameLine(); ImGui::SetNextItemWidth(50.f); ImGui::InputText("##msgid", spr_palette_, kMessageIdSize); - ImGui::TableNextColumn(); + TableNextColumn(); ImGui::SetNextItemWidth(100.f); - ImGui::Combo("##world", &game_state_, "Part 0\0Part 1\0Part 2\0", 3); + // ImGui::Combo("##world", &game_state_, "Part 0\0Part 1\0Part 2\0", 3); + ImGui::Combo("##World", &game_state_, kGamePartComboString, 3); - ImGui::TableNextColumn(); + TableNextColumn(); ImGui::Checkbox("Show grid", &opt_enable_grid); // TODO ImGui::EndTable(); } @@ -214,7 +220,7 @@ void OverworldEditor::DrawOverworldEntrances(ImVec2 canvas_p0, if (ImGui::BeginDragDropSource()) { ImGui::SetDragDropPayload("ENTRANCE_PAYLOAD", &each, sizeof(zelda3::OverworldEntrance)); - ImGui::Text("Moving Entrance ID: %s", str.c_str()); + Text("Moving Entrance ID: %s", str.c_str()); ImGui::EndDragDropSource(); } } else if (is_dragging_entrance_ && dragged_entrance_ == &each && @@ -412,7 +418,7 @@ void OverworldEditor::DrawTile8Selector() { graphics_bin_canvas_.DrawContextMenu(); if (all_gfx_loaded_) { // for (const auto &[key, value] : graphics_bin_) { - for (auto &[key, value] : rom()->BitmapManager()) { + for (auto &[key, value] : rom()->bitmap_manager()) { int offset = 0x40 * (key + 1); int top_left_y = graphics_bin_canvas_.GetZeroPoint().y + 2; if (key >= 1) { @@ -465,7 +471,7 @@ void OverworldEditor::DrawTileSelector() { absl::Status OverworldEditor::LoadGraphics() { // Load all of the graphics data from the game. PRINT_IF_ERROR(rom()->LoadAllGraphicsData()) - graphics_bin_ = rom()->GetGraphicsBin(); + graphics_bin_ = rom()->graphics_bin(); // Load the Link to the Past overworld. RETURN_IF_ERROR(overworld_.Load(*rom())) @@ -549,12 +555,12 @@ absl::Status OverworldEditor::DrawExperimentalModal() { ImGui::Begin("Experimental", &show_experimental); gui::TextWithSeparators("PROTOTYPE OVERWORLD TILEMAP LOADER"); - ImGui::Text("Please provide two files:"); - ImGui::Text("One based on MAPn.DAT, which represents the overworld tilemap"); - ImGui::Text("One based on MAPDATn.DAT, which is the tile32 configurations."); - ImGui::Text("Currently, loading CGX for this component is NOT supported. "); - ImGui::Text("Please load a US ROM of LTTP (JP ROM support coming soon)."); - ImGui::Text( + Text("Please provide two files:"); + Text("One based on MAPn.DAT, which represents the overworld tilemap"); + Text("One based on MAPDATn.DAT, which is the tile32 configurations."); + Text("Currently, loading CGX for this component is NOT supported. "); + Text("Please load a US ROM of LTTP (JP ROM support coming soon)."); + Text( "Once you've loaded the files, you can click the button below to load " "the tilemap into the editor"); diff --git a/src/app/editor/overworld_editor.h b/src/app/editor/overworld_editor.h index 005cdcba2..0b575be80 100644 --- a/src/app/editor/overworld_editor.h +++ b/src/app/editor/overworld_editor.h @@ -51,7 +51,10 @@ constexpr ImGuiTableFlags kOWEditFlags = ImGuiTableFlags_Reorderable | ImGuiTableFlags_Resizable | ImGuiTableFlags_SizingStretchSame; -constexpr absl::string_view kWorldList = "Light World\0Dark World\0Extra World"; +constexpr absl::string_view kWorldList = + "Light World\0Dark World\0Extra World\0"; + +constexpr char *const kGamePartComboString[] = {"Part 0", "Part 1", "Part 2"}; constexpr absl::string_view kTileSelectorTab = "##TileSelectorTabBar"; constexpr absl::string_view kOWEditTable = "##OWEditTable"; diff --git a/src/app/rom.h b/src/app/rom.h index 34c8ca565..838113484 100644 --- a/src/app/rom.h +++ b/src/app/rom.h @@ -399,14 +399,14 @@ class ROM : public core::ExperimentFlags { changes_.push(function); } - VersionConstants GetVersionConstants() const { + VersionConstants version_constants() const { return kVersionConstantsMap.at(version_); } int GetGraphicsAddress(const uchar* data, uint8_t addr) const { - auto part_one = data[GetVersionConstants().kOverworldGfxPtr1 + addr] << 16; - auto part_two = data[GetVersionConstants().kOverworldGfxPtr2 + addr] << 8; - auto part_three = data[GetVersionConstants().kOverworldGfxPtr3 + addr]; + auto part_one = data[version_constants().kOverworldGfxPtr1 + addr] << 16; + auto part_two = data[version_constants().kOverworldGfxPtr2 + addr] << 8; + auto part_three = data[version_constants().kOverworldGfxPtr3 + addr]; auto snes_addr = (part_one | part_two | part_three); return core::SnesToPc(snes_addr); } @@ -414,8 +414,10 @@ class ROM : public core::ExperimentFlags { gfx::PaletteGroup GetPaletteGroup(const std::string& group) { return palette_groups_[group]; } - Bytes GetGraphicsBuffer() const { return graphics_buffer_; } - gfx::BitmapTable GetGraphicsBin() const { return graphics_bin_; } + + Bytes graphics_buffer() const { return graphics_buffer_; } + + gfx::BitmapTable graphics_bin() const { return graphics_bin_; } auto title() const { return title_; } auto size() const { return size_; } @@ -477,7 +479,7 @@ class ROM : public core::ExperimentFlags { bitmap->UpdateTexture(renderer_); } - auto BitmapManager() { return graphics_manager_; } + auto bitmap_manager() { return graphics_manager_; } std::vector> main_blockset_ids; std::vector> room_blockset_ids; @@ -510,16 +512,14 @@ class ROM : public core::ExperimentFlags { for (int i = 0; i < 144; i++) { for (int j = 0; j < 4; j++) { spriteset_ids[i][j] = - rom_data_[GetVersionConstants().kSpriteBlocksetPointer + (i * 4) + - j]; + rom_data_[version_constants().kSpriteBlocksetPointer + (i * 4) + j]; } } for (int i = 0; i < 72; i++) { for (int j = 0; j < 4; j++) { paletteset_ids[i][j] = - rom_data_[GetVersionConstants().kDungeonPalettesGroups + (i * 4) + - j]; + rom_data_[version_constants().kDungeonPalettesGroups + (i * 4) + j]; } } } @@ -544,14 +544,14 @@ class ROM : public core::ExperimentFlags { for (int i = 0; i < 144; i++) { for (int j = 0; j < 4; j++) { - rom_data_[GetVersionConstants().kSpriteBlocksetPointer + (i * 4) + j] = + rom_data_[version_constants().kSpriteBlocksetPointer + (i * 4) + j] = spriteset_ids[i][j]; } } for (int i = 0; i < 72; i++) { for (int j = 0; j < 4; j++) { - rom_data_[GetVersionConstants().kDungeonPalettesGroups + (i * 4) + j] = + rom_data_[version_constants().kDungeonPalettesGroups + (i * 4) + j] = paletteset_ids[i][j]; } } diff --git a/src/app/zelda3/dungeon/room.cc b/src/app/zelda3/dungeon/room.cc index 58b3994eb..8a3326772 100644 --- a/src/app/zelda3/dungeon/room.cc +++ b/src/app/zelda3/dungeon/room.cc @@ -165,7 +165,7 @@ void Room::LoadRoomGraphics(uchar entrance_blockset) { blocks[12 + i] = (uchar)(spriteGfx[SpriteTileset + 64][i] + 115); } // 12-16 sprites - auto gfx_buffer_data = rom()->GetGraphicsBuffer(); + auto gfx_buffer_data = rom()->graphics_buffer(); // Into "room gfx16" 16 of them int sheetPos = 0; @@ -173,7 +173,6 @@ void Room::LoadRoomGraphics(uchar entrance_blockset) { int d = 0; int ioff = blocks[i] * 2048; while (d < 2048) { - // NOTE LOAD BLOCKSETS SOMEWHERE FIRST uchar mapByte = gfx_buffer_data[d + ioff]; if (i < 4) { mapByte += 0x88; @@ -191,9 +190,9 @@ void Room::LoadRoomGraphics(uchar entrance_blockset) { void Room::LoadAnimatedGraphics() { int gfx_ptr = - core::SnesToPc(rom()->GetVersionConstants().kGfxAnimatedPointer); + core::SnesToPc(rom()->version_constants().kGfxAnimatedPointer); - auto gfx_buffer_data = rom()->GetGraphicsBuffer(); + auto gfx_buffer_data = rom()->graphics_buffer(); auto rom_data = rom()->vector(); int data = 0; while (data < 512) { diff --git a/src/app/zelda3/dungeon/room_object.h b/src/app/zelda3/dungeon/room_object.h index c3f017378..5d0422484 100644 --- a/src/app/zelda3/dungeon/room_object.h +++ b/src/app/zelda3/dungeon/room_object.h @@ -26,7 +26,7 @@ class DungeonObjectRenderer { }; void CreateVramFromRoomBlockset() { - // auto bitmap_manager = rom()->BitmapManager(); + // auto bitmap_manager = rom()->bitmap_manager(); // uint16_t room_id = 0; // auto room_blockset = rom()->room_blockset_ids[room_id]; diff --git a/src/app/zelda3/overworld.cc b/src/app/zelda3/overworld.cc index 8ccc59474..71e15f94a 100644 --- a/src/app/zelda3/overworld.cc +++ b/src/app/zelda3/overworld.cc @@ -588,7 +588,7 @@ absl::Status Overworld::SaveMap32Tiles() { for (int i = 0; i < num_32x32_tiles; ++i) { int base_addr = - rom()->GetVersionConstants().kMap32TileTL + i * kQuadrantsPer32x32Tile; + rom()->version_constants().kMap32TileTL + i * kQuadrantsPer32x32Tile; auto write_quadrant_to_rom = [&](int quadrant, auto get_tile) -> absl::Status { @@ -630,10 +630,10 @@ absl::Status Overworld::SaveMap32Tiles() { uint16_t Overworld::GenerateTile32(int index, int quadrant, int dimension) { // The addresses of the four 32x32 pixel tiles in the ROM. - const uint32_t map32address[4] = {rom()->GetVersionConstants().kMap32TileTL, - rom()->GetVersionConstants().kMap32TileTR, - rom()->GetVersionConstants().kMap32TileBL, - rom()->GetVersionConstants().kMap32TileBR}; + const uint32_t map32address[4] = {rom()->version_constants().kMap32TileTL, + rom()->version_constants().kMap32TileTR, + rom()->version_constants().kMap32TileBL, + rom()->version_constants().kMap32TileBR}; return (ushort)(rom_[map32address[dimension] + quadrant + (index)] + (((rom_[map32address[dimension] + (index) + @@ -727,10 +727,10 @@ absl::Status Overworld::DecompressAllMapTiles() { for (int i = 0; i < 160; i++) { auto p1 = GetOwMapGfxHighPtr( rom()->data(), i, - rom()->GetVersionConstants().kCompressedAllMap32PointersHigh); + rom()->version_constants().kCompressedAllMap32PointersHigh); auto p2 = GetOwMapGfxLowPtr( rom()->data(), i, - rom()->GetVersionConstants().kCompressedAllMap32PointersLow); + rom()->version_constants().kCompressedAllMap32PointersLow); int ttpos = 0; if (p1 >= highest) { diff --git a/src/app/zelda3/overworld.h b/src/app/zelda3/overworld.h index 3c72c79ef..ed7b01712 100644 --- a/src/app/zelda3/overworld.h +++ b/src/app/zelda3/overworld.h @@ -209,6 +209,9 @@ class Overworld : public SharedROM, public core::ExperimentFlags { auto isLoaded() const { return is_loaded_; } void SetCurrentMap(int i) { current_map_ = i; } + auto MapTiles() const { return map_tiles_; } + auto mutable_map_tiles() { return &map_tiles_; } + absl::Status LoadPrototype(ROM &rom_, const std::string &tilemap_filename); private: diff --git a/src/app/zelda3/overworld_map.cc b/src/app/zelda3/overworld_map.cc index 07c209465..fb6e174fd 100644 --- a/src/app/zelda3/overworld_map.cc +++ b/src/app/zelda3/overworld_map.cc @@ -286,7 +286,7 @@ void OverworldMap::LoadSpritesBlocksets() { for (int i = 0; i < 4; i++) { static_graphics_[12 + i] = - (rom_[rom_.GetVersionConstants().kSpriteBlocksetPointer + + (rom_[rom_.version_constants().kSpriteBlocksetPointer + (sprite_graphics_[game_state_] * 4) + i] + static_graphics_base); } @@ -294,14 +294,14 @@ void OverworldMap::LoadSpritesBlocksets() { void OverworldMap::LoadMainBlocksets() { for (int i = 0; i < 8; i++) { - static_graphics_[i] = rom_[rom_.GetVersionConstants().kOverworldGfxGroups2 + + static_graphics_[i] = rom_[rom_.version_constants().kOverworldGfxGroups2 + (world_index_ * 8) + i]; } } void OverworldMap::LoadAreaGraphicsBlocksets() { for (int i = 0; i < 4; i++) { - uchar value = rom_[rom_.GetVersionConstants().kOverworldGfxGroups1 + + uchar value = rom_[rom_.version_constants().kOverworldGfxGroups1 + (area_graphics_ * 4) + i]; if (value != 0) { static_graphics_[3 + i] = value; @@ -330,7 +330,7 @@ void OverworldMap::LoadAreaGraphics() { gfx::SNESPalette OverworldMap::GetPalette(const std::string& group, int index, int previousIndex, int limit) { if (index == 255) { - index = rom_[rom_.GetVersionConstants().overworldMapPaletteGroup + + index = rom_[rom_.version_constants().overworldMapPaletteGroup + (previousIndex * 4)]; } if (index != 255) { @@ -351,11 +351,11 @@ void OverworldMap::LoadPalette() { area_palette_ = std::min(area_palette_, 0xA3); uchar pal0 = 0; - uchar pal1 = rom_[rom_.GetVersionConstants().overworldMapPaletteGroup + + uchar pal1 = rom_[rom_.version_constants().overworldMapPaletteGroup + (area_palette_ * 4)]; - uchar pal2 = rom_[rom_.GetVersionConstants().overworldMapPaletteGroup + + uchar pal2 = rom_[rom_.version_constants().overworldMapPaletteGroup + (area_palette_ * 4) + 1]; - uchar pal3 = rom_[rom_.GetVersionConstants().overworldMapPaletteGroup + + uchar pal3 = rom_[rom_.version_constants().overworldMapPaletteGroup + (area_palette_ * 4) + 2]; uchar pal4 = rom_[overworldSpritePaletteGroup + (sprite_palette_[game_state_] * 2)]; @@ -369,7 +369,7 @@ void OverworldMap::LoadPalette() { // Additional handling of `pal3` and `parent_` if (pal3 == 255) { - pal3 = rom_[rom_.GetVersionConstants().overworldMapPaletteGroup + + pal3 = rom_[rom_.version_constants().overworldMapPaletteGroup + (previousPalId * 4) + 2]; } if (parent_ < 0x40) { @@ -416,7 +416,7 @@ void OverworldMap::ProcessGraphicsBuffer(int index, int static_graphics_offset, } absl::Status OverworldMap::BuildTileset() { - all_gfx_ = rom_.GetGraphicsBuffer(); + all_gfx_ = rom_.graphics_buffer(); current_gfx_.resize(0x10000, 0x00); for (int i = 0; i < 0x10; i++) { diff --git a/src/cli/command_handler.h b/src/cli/command_handler.h index 5b40cad27..84eb78c34 100644 --- a/src/cli/command_handler.h +++ b/src/cli/command_handler.h @@ -171,7 +171,7 @@ class Decompress : public CommandHandler { // auto rom_filename = arg_vec[1]; // RETURN_IF_ERROR(rom_.LoadFromFile(arg, true)) // RETURN_IF_ERROR(rom_.LoadAllGraphicsData()) - // for (auto& graphic_sheet : rom_.GetGraphicsBin()) { + // for (auto& graphic_sheet : rom_.graphics_bin()) { // const auto filename = // absl::StrCat(rom_.filename(), graphic_sheet.first); // graphic_sheet.second.SaveSurfaceToFile(filename);