Refactor loading methods in EditorManager and OverworldEditor for improved clarity and consistency; add checks for loaded ROM in GfxGroupEditor and MessageEditor

This commit is contained in:
scawful
2025-03-12 14:28:53 -04:00
parent 4bb087f2c5
commit 806885824a
4 changed files with 18 additions and 7 deletions

View File

@@ -111,7 +111,9 @@ void GfxGroupEditor::DrawBlocksetViewer(bool sheet_only) {
BeginGroup();
for (int i = 0; i < 8; i++) {
int sheet_id = rom()->main_blockset_ids[selected_blockset_][i];
auto &sheet = GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(sheet_id);
auto &sheet =
GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(
sheet_id);
gui::BitmapCanvasPipeline(blockset_canvas_, sheet, 256, 0x10 * 0x04,
0x20, true, false, 22);
}
@@ -164,7 +166,9 @@ void GfxGroupEditor::DrawRoomsetViewer() {
BeginGroup();
for (int i = 0; i < 4; i++) {
int sheet_id = rom()->room_blockset_ids[selected_roomset_][i];
auto &sheet = GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(sheet_id);
auto &sheet =
GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(
sheet_id);
gui::BitmapCanvasPipeline(roomset_canvas_, sheet, 256, 0x10 * 0x04,
0x20, true, false, 23);
}
@@ -202,7 +206,9 @@ void GfxGroupEditor::DrawSpritesetViewer(bool sheet_only) {
BeginGroup();
for (int i = 0; i < 4; i++) {
int sheet_id = rom()->spriteset_ids[selected_spriteset_][i];
auto &sheet = GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(115 + sheet_id);
auto &sheet =
GraphicsSheetManager::GetInstance().mutable_gfx_sheets()->at(
115 + sheet_id);
gui::BitmapCanvasPipeline(spriteset_canvas_, sheet, 256, 0x10 * 0x04,
0x20, true, false, 24);
}
@@ -234,6 +240,9 @@ void DrawPaletteFromPaletteGroup(gfx::SnesPalette &palette) {
} // namespace
void GfxGroupEditor::DrawPaletteViewer() {
if (!rom()->is_loaded()) {
return;
}
gui::InputHexByte("Selected Paletteset", &selected_paletteset_);
if (selected_paletteset_ >= 71) {
selected_paletteset_ = 71;