housekeeping

This commit is contained in:
Justin Scofield
2022-07-20 21:40:18 -04:00
parent d9e986d769
commit d2da16b47d
5 changed files with 19 additions and 20 deletions

View File

@@ -233,7 +233,11 @@ void OverworldEditor::DrawTileSelector() {
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Current Graphics")) {
DrawAreaGraphics();
if (ImGui::BeginChild("#Tile16Child", ImGui::GetContentRegionAvail(),
true, ImGuiWindowFlags_NoScrollbar)) {
DrawAreaGraphics();
}
ImGui::EndChild();
ImGui::EndTabItem();
}
ImGui::EndTabBar();

View File

@@ -54,7 +54,14 @@ class OverworldEditor {
bool all_gfx_loaded_ = false;
bool map_blockset_loaded_ = false;
std::unordered_map<unsigned int, SDL_Texture *> all_texture_sheet_;
ImVec4 current_palette_[8];
ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit;
ImGuiTableFlags ow_map_flags = ImGuiTableFlags_Borders;
ImGuiTableFlags ow_edit_flags = ImGuiTableFlags_Reorderable |
ImGuiTableFlags_Resizable |
ImGuiTableFlags_SizingStretchSame;
std::unordered_map<unsigned int, gfx::Bitmap> graphics_bin_;
ROM rom_;
@@ -69,14 +76,6 @@ class OverworldEditor {
gui::Canvas current_gfx_canvas_;
gui::Canvas blockset_canvas_;
gui::Canvas graphics_bin_canvas_;
ImVec4 current_palette_[8];
ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit;
ImGuiTableFlags ow_map_flags = ImGuiTableFlags_Borders;
ImGuiTableFlags ow_edit_flags = ImGuiTableFlags_Reorderable |
ImGuiTableFlags_Resizable |
ImGuiTableFlags_SizingStretchSame;
};
} // namespace editor
} // namespace app

View File

@@ -76,17 +76,16 @@ void ROM::LoadAllGraphicsData() {
data = Decompress(gfx_addr, core::UncompressedSheetSize);
}
auto converted_sheet = SNES3bppTo8bppSheet(data);
gfx::Bitmap tilesheet_bmp(core::kTilesheetWidth, core::kTilesheetHeight,
core::kTilesheetDepth, converted_sheet);
core::kTilesheetDepth, SNES3bppTo8bppSheet(data));
tilesheet_bmp.CreateTexture(sdl_renderer_);
graphics_bin_[i] = tilesheet_bmp;
for (int j = 0; j < sizeof(converted_sheet); j++) {
buffer[j + buffer_pos] = converted_sheet[j];
for (int j = 0; j < sizeof(data); j++) {
buffer[j + buffer_pos] = data[j];
}
buffer_pos += sizeof(converted_sheet);
buffer_pos += sizeof(data);
}
master_gfx_bin_ = buffer;

View File

@@ -14,16 +14,14 @@ void Overworld::Load(ROM &rom, uchar *ow_blockset, uchar *current_gfx) {
AssembleMap16Tiles();
DecompressAllMapTiles();
// Map Initialization
for (int i = 0; i < core::NumberOfOWMaps; i++) {
overworld_maps_.emplace_back(i, rom_, tiles16);
}
FetchLargeMaps();
auto size = tiles16.size();
for (int i = 0; i < core::NumberOfOWMaps; i++) {
overworld_maps_[i].BuildMap(size, game_state_, map_parent_, ow_blockset,
current_gfx, map_tiles_);
overworld_maps_[i].BuildMap(tiles16.size(), game_state_, map_parent_,
ow_blockset, current_gfx, map_tiles_);
}
is_loaded_ = true;

View File

@@ -207,7 +207,6 @@ void OverworldMap::BuildTileset(int game_state, uchar* current_gfx) {
}
auto all_gfx_data = rom_.GetMasterGraphicsBin();
for (int i = 0; i < 16; i++) {
for (int j = 0; j < 2048; j++) {
uchar mapByte = all_gfx_data[j + (static_graphics_[i] * 2048)];