ow housekeeping

This commit is contained in:
Justin Scofield
2022-06-20 21:48:55 -04:00
parent 4188513ebb
commit 0bdda2c84c
3 changed files with 25 additions and 18 deletions

View File

@@ -107,15 +107,16 @@ void Overworld::AssembleMap32Tiles() {
void Overworld::AssembleMap16Tiles() { void Overworld::AssembleMap16Tiles() {
int tpos = core::constants::map16Tiles; int tpos = core::constants::map16Tiles;
auto rom_data = rom_.GetRawData();
for (int i = 0; i < 4096; i += 1) // 3760 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; tpos += 2;
TileInfo t1 = GetTilesInfo((uintptr_t)rom_.GetRawData() + tpos); TileInfo t1 = GetTilesInfo((uintptr_t)(rom_data + tpos));
tpos += 2; tpos += 2;
TileInfo t2 = GetTilesInfo((uintptr_t)rom_.GetRawData() + tpos); TileInfo t2 = GetTilesInfo((uintptr_t)(rom_data + tpos));
tpos += 2; tpos += 2;
TileInfo t3 = GetTilesInfo((uintptr_t)rom_.GetRawData() + tpos); TileInfo t3 = GetTilesInfo((uintptr_t)(rom_data + tpos));
tpos += 2; tpos += 2;
tiles16.push_back(Tile16(t0, t1, t2, t3)); tiles16.push_back(Tile16(t0, t1, t2, t3));
} }

View File

@@ -449,6 +449,13 @@ void OverworldEditor::DrawChangelist() {
} }
void OverworldEditor::LoadBlockset() { 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); rom_.CreateAllGraphicsData(allGfx16Ptr);
auto tiles = overworld_.GetTiles16(); auto tiles = overworld_.GetTiles16();
app::gfx::BuildTiles16Gfx(overworld_.GetMapBlockset16Ptr(), app::gfx::BuildTiles16Gfx(overworld_.GetMapBlockset16Ptr(),

View File

@@ -33,32 +33,31 @@ class OverworldEditor {
void LoadBlockset(); void LoadBlockset();
void LoadGraphics(); void LoadGraphics();
app::rom::ROM rom_;
app::zelda3::Overworld overworld_; 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 allgfxBitmap;
app::gfx::Bitmap mapblockset16Bitmap; app::gfx::Bitmap mapblockset16Bitmap;
app::gfx::SNESPalette palette_;
app::gfx::TilePreset current_set_;
std::unordered_map<unsigned int, SDL_Texture *> all_texture_sheet_; std::unordered_map<unsigned int, SDL_Texture *> all_texture_sheet_;
SDL_Texture *gfx_texture = nullptr;
int allgfx_width = 0;
int allgfx_height = 0;
uchar *allGfx16Ptr = new uchar[(128 * 7136) / 2]; uchar *allGfx16Ptr = new uchar[(128 * 7136) / 2];
float canvas_table_ratio = 30.f; int current_world_ = 0;
char map_gfx_[3] = ""; char map_gfx_[3] = "";
char map_palette_[3] = ""; char map_palette_[3] = "";
char spr_gfx_[3] = ""; char spr_gfx_[3] = "";
char spr_palette_[3] = ""; char spr_palette_[3] = "";
char message_id_[5] = ""; char message_id_[5] = "";
int current_world_ = 0;
bool isLoaded = false; bool isLoaded = false;
bool doneLoaded = false; bool doneLoaded = false;
bool opt_enable_grid = true; bool opt_enable_grid = true;
@@ -68,9 +67,9 @@ class OverworldEditor {
constexpr static int kByteSize = 3; constexpr static int kByteSize = 3;
constexpr static int kMessageIdSize = 5; constexpr static int kMessageIdSize = 5;
constexpr static float kInputFieldSize = 30.f;
constexpr static int kNumSheetsToLoad = 100; constexpr static int kNumSheetsToLoad = 100;
constexpr static int kTile8DisplayHeight = 64; constexpr static int kTile8DisplayHeight = 64;
constexpr static float kInputFieldSize = 30.f;
ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit; ImGuiTableFlags toolset_table_flags = ImGuiTableFlags_SizingFixedFit;
ImGuiTableFlags ow_map_settings_flags = ImGuiTableFlags_Borders; ImGuiTableFlags ow_map_settings_flags = ImGuiTableFlags_Borders;