Refactor AssembleMap32Tiles to report errors

This commit is contained in:
scawful
2024-08-29 19:10:02 -04:00
parent c774999f08
commit 93d7aa545c
5 changed files with 39 additions and 28 deletions

View File

@@ -970,7 +970,7 @@ void OverworldEditor::DrawOverworldSprites() {
int i = 0;
for (auto &sprite : *overworld_.mutable_sprites(game_state_)) {
if (!sprite.deleted()) {
int map_id = sprite.map_id();
// int map_id = sprite.map_id();
// map x and map y are relative to the map
// So we need to check if the map is large or small then add the offset
@@ -1063,10 +1063,10 @@ absl::Status OverworldEditor::LoadGraphics() {
// Copy the tile16 data into individual tiles.
auto tile16_data = overworld_.tile16_blockset_data();
tile16_individual_.reserve(kNumTile16Individual);
tile16_individual_.reserve(zelda3::overworld::kNumTile16Individual);
// Loop through the tiles and copy their pixel data into separate vectors
for (uint i = 0; i < kNumTile16Individual; i++) {
for (uint i = 0; i < zelda3::overworld::kNumTile16Individual; i++) {
std::vector<uint8_t> tile_data(kTile16Size * kTile16Size, 0x00);
// Copy the pixel data for the current tile into the vector

View File

@@ -34,7 +34,6 @@ constexpr uint kMessageIdSize = 5;
constexpr uint kNumSheetsToLoad = 223;
constexpr uint kTile8DisplayHeight = 64;
constexpr uint kOverworldMapSize = 0x200;
constexpr uint kNumTile16Individual = 4096;
constexpr float kInputFieldSize = 30.f;
constexpr ImVec2 kOverworldCanvasSize(kOverworldMapSize * 8,
kOverworldMapSize * 8);

View File

@@ -117,7 +117,7 @@ absl::Status OverworldEditor::RefreshTile16Blockset() {
std::vector<std::future<void>> futures;
// Loop through the tiles and copy their pixel data into separate vectors
for (uint i = 0; i < kNumTile16Individual; i++) {
for (uint i = 0; i < zelda3::overworld::kNumTile16Individual; i++) {
futures.push_back(std::async(
std::launch::async,
[&](int index) {
@@ -141,7 +141,7 @@ absl::Status OverworldEditor::RefreshTile16Blockset() {
}
// Render the bitmaps of each tile.
for (uint id = 0; id < kNumTile16Individual; id++) {
for (uint id = 0; id < zelda3::overworld::kNumTile16Individual; id++) {
RETURN_IF_ERROR(tile16_individual_[id].ApplyPalette(palette_));
Renderer::GetInstance().UpdateBitmap(&tile16_individual_[id]);
}