Fix gfx buffer bug in ROM::LoadAllGraphicsData

This commit is contained in:
scawful
2023-11-25 22:45:50 -05:00
parent fd43b27196
commit fed58b836c
3 changed files with 3 additions and 12 deletions

View File

@@ -252,7 +252,7 @@ absl::Status ROM::LoadAllGraphicsData() {
} }
graphics_bin_[i] = graphics_bin_[i] =
gfx::Bitmap(core::kTilesheetWidth, core::kTilesheetHeight, gfx::Bitmap(core::kTilesheetWidth, core::kTilesheetHeight,
core::kTilesheetDepth, converted_sheet.data(), 0x1000); core::kTilesheetDepth, converted_sheet);
graphics_bin_.at(i).CreateTexture(renderer_); graphics_bin_.at(i).CreateTexture(renderer_);
if (flags()->kUseBitmapManager) { if (flags()->kUseBitmapManager) {
@@ -260,16 +260,7 @@ absl::Status ROM::LoadAllGraphicsData() {
graphics_buffer_.push_back(graphics_manager_[i]->at(j)); graphics_buffer_.push_back(graphics_manager_[i]->at(j));
} }
} }
for (int j = 0; j < graphics_bin_[i].size(); ++j) {
graphics_buffer_.push_back(graphics_bin_.at(i).at(j));
}
} else { } else {
if (flags()->kUseBitmapManager) {
for (int j = 0; j < graphics_manager_[0].get()->size(); ++j) {
graphics_buffer_.push_back(0xFF);
}
}
for (int j = 0; j < graphics_bin_[0].size(); ++j) { for (int j = 0; j < graphics_bin_[0].size(); ++j) {
graphics_buffer_.push_back(0xFF); graphics_buffer_.push_back(0xFF);
} }

View File

@@ -62,7 +62,7 @@ void Inventory::Create() {
} }
} }
PRINT_IF_ERROR(bitmap_.InitializeFromData(256, 256, 8, data_)) bitmap_.Create(256, 256, 8, data_);
bitmap_.ApplyPalette(palette_); bitmap_.ApplyPalette(palette_);
rom()->RenderBitmap(&bitmap_); rom()->RenderBitmap(&bitmap_);
} }

View File

@@ -42,7 +42,7 @@ void TitleScreen::BuildTileset() {
staticgfx[15] = 112; staticgfx[15] = 112;
// Loaded gfx for the current screen (empty at this point) // Loaded gfx for the current screen (empty at this point)
uchar* currentmapgfx8Data = tiles8Bitmap.data(); uchar* currentmapgfx8Data = tiles8Bitmap.mutable_data().data();
// All gfx of the game pack of 2048 bytes (4bpp) // All gfx of the game pack of 2048 bytes (4bpp)
uchar* allgfxData = nullptr; // rom_.GetMasterGraphicsBin(); uchar* allgfxData = nullptr; // rom_.GetMasterGraphicsBin();