remove deprecated graphics_bin

This commit is contained in:
scawful
2024-08-13 21:22:02 -04:00
parent aae103d8f5
commit 164ae60f5a
6 changed files with 17 additions and 35 deletions

View File

@@ -57,6 +57,7 @@ class Controller : public ExperimentFlags {
}
auto window() -> SDL_Window * { return window_.get(); }
void init_test_editor(editor::Editor *editor) { test_editor_ = editor; }
void set_active(bool active) { active_ = active; }
private:
friend int ::main(int argc, char **argv);

View File

@@ -367,7 +367,6 @@ absl::Status Tile16Editor::UpdateTransferTileCanvas() {
// TODO: Implement tile16 transfer
if (transfer_started_ && !transfer_blockset_loaded_) {
PRINT_IF_ERROR(transfer_rom_.LoadAllGraphicsData())
graphics_bin_ = transfer_rom_.graphics_bin();
// Load the Link to the Past overworld.
PRINT_IF_ERROR(transfer_overworld_.Load(transfer_rom_))

View File

@@ -123,20 +123,19 @@ absl::Status Rom::LoadAllGraphicsData() {
graphics_manager_.LoadBitmap(i, converted_sheet, core::kTilesheetWidth,
core::kTilesheetHeight,
core::kTilesheetDepth);
if (i > 115) {
// Apply sprites palette
RETURN_IF_ERROR(graphics_manager_[i].ApplyPaletteWithTransparent(
palette_groups_.global_sprites[0], 0));
} else {
RETURN_IF_ERROR(graphics_manager_[i].ApplyPaletteWithTransparent(
palette_groups_.dungeon_main[0], 0));
if (graphics_manager_[i].is_active()) {
if (i > 115) {
// Apply sprites palette
RETURN_IF_ERROR(graphics_manager_[i].ApplyPaletteWithTransparent(
palette_groups_.global_sprites[0], 0));
} else {
RETURN_IF_ERROR(graphics_manager_[i].ApplyPaletteWithTransparent(
palette_groups_.dungeon_main[0], 0));
}
graphics_manager_[i].CreateTexture(Renderer::GetInstance().renderer());
}
graphics_manager_[i].CreateTexture(Renderer::GetInstance().renderer());
}
graphics_bin_[i] =
gfx::Bitmap(core::kTilesheetWidth, core::kTilesheetHeight,
core::kTilesheetDepth, converted_sheet);
graphics_bin_.at(i).CreateTexture(Renderer::GetInstance().renderer());
if (flags()->kUseBitmapManager) {
for (int j = 0; j < graphics_manager_[i].size(); ++j) {
@@ -144,7 +143,7 @@ absl::Status Rom::LoadAllGraphicsData() {
}
}
} else {
for (int j = 0; j < graphics_bin_[0].size(); ++j) {
for (int j = 0; j < graphics_manager_[0].size(); ++j) {
graphics_buffer_.push_back(0xFF);
}
}

View File

@@ -409,10 +409,6 @@ class Rom : public core::ExperimentFlags {
// Full graphical data for the game
Bytes graphics_buffer() const { return graphics_buffer_; }
[[deprecated]] gfx::BitmapTable graphics_bin() const { return graphics_bin_; }
[[deprecated]] gfx::Bitmap* mutable_graphics_sheet(int index) {
return &graphics_bin_.at(index);
}
[[deprecated]] auto bitmap_manager() { return graphics_manager_; }
[[deprecated]] auto mutable_bitmap_manager() { return &graphics_manager_; }
@@ -524,7 +520,6 @@ class Rom : public core::ExperimentFlags {
std::array<gfx::Bitmap, kNumGfxSheets> graphics_sheets_;
Z3_Version version_ = Z3_Version::US;
gfx::BitmapTable graphics_bin_;
[[deprecated("BitmapManager has unpredictable destructor behavior.")]] gfx::
BitmapManager graphics_manager_;

View File

@@ -106,7 +106,6 @@ void DungeonObjectRenderer::RenderObject(const SubtypeInfo& info) {
uint8_t opcode = cpu.ReadByte(cpu.PB << 16 | cpu.PC);
cpu.ExecuteInstruction(opcode);
i++;
}
@@ -138,10 +137,11 @@ void DungeonObjectRenderer::UpdateObjectBitmap() {
int x = column * 8;
int y = row * 8;
auto sheet = rom()->mutable_graphics_sheet(vram_.sheets[sheet_number]);
auto sheet =
rom()->mutable_bitmap_manager()->at(vram_.sheets[sheet_number]);
// Copy the tile from VRAM using the read tile_id
sheet->Get8x8Tile(tile_id, x, y, tilemap_, tilemap_offset);
sheet.Get8x8Tile(tile_id, x, y, tilemap_, tilemap_offset);
}
bitmap_.Create(256, 256, 8, tilemap_);

View File

@@ -191,21 +191,9 @@ class Decompress : public CommandHandler {
std::string sheet_input;
std::cin >> sheet_input;
// Batch Mode
// if (arg_vec.size() == 1) {
// auto rom_filename = arg_vec[1];
// RETURN_IF_ERROR(rom_.LoadFromFile(arg, true))
// RETURN_IF_ERROR(rom_.LoadAllGraphicsData())
// for (auto& graphic_sheet : rom_.graphics_bin()) {
// const auto filename =
// absl::StrCat(rom_.filename(), graphic_sheet.first);
// graphic_sheet.second.SaveSurfaceToFile(filename);
// }
// }
std::cout << "Decompress selected with argument: " << arg_vec[0]
<< std::endl;
return absl::OkStatus();
return absl::UnimplementedError("Decompress not implemented");
}
};