Refactor Inventory class to remove inheritance from SharedRom and add ROM pointer management. Update LoadDungeonMapGfxFromBinary to simplify palette setting logic, enhancing code clarity and maintainability.
This commit is contained in:
@@ -34,7 +34,7 @@ absl::Status LoadDungeonMapGfxFromBinary(Rom &rom,
|
||||
gfx_sheets.emplace_back(converted_bin.begin() + (i * 0x1000),
|
||||
converted_bin.begin() + ((i + 1) * 0x1000));
|
||||
sheets[i] = gfx::Bitmap(128, 32, 8, gfx_sheets[i]);
|
||||
RETURN_IF_ERROR(sheets[i].SetPalette(*rom.mutable_dungeon_palette(3)));
|
||||
sheets[i].SetPalette(*rom.mutable_dungeon_palette(3));
|
||||
core::Renderer::GetInstance().RenderBitmap(&sheets[i]);
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace zelda3 {
|
||||
constexpr int kInventoryStart = 0x6564A;
|
||||
constexpr int kBowItemPos = 0x6F631;
|
||||
|
||||
class Inventory : public SharedRom {
|
||||
class Inventory {
|
||||
public:
|
||||
absl::Status Create();
|
||||
|
||||
@@ -21,6 +21,9 @@ class Inventory : public SharedRom {
|
||||
auto &tilesheet() { return tilesheets_bmp_; }
|
||||
auto &palette() { return palette_; }
|
||||
|
||||
void LoadRom(Rom *rom) { rom_ = rom; }
|
||||
auto rom() { return rom_; }
|
||||
|
||||
private:
|
||||
absl::Status BuildTileset();
|
||||
|
||||
@@ -32,6 +35,7 @@ class Inventory : public SharedRom {
|
||||
gfx::Bitmap tilesheets_bmp_;
|
||||
gfx::SnesPalette palette_;
|
||||
|
||||
Rom *rom_;
|
||||
gui::Canvas canvas_;
|
||||
std::vector<gfx::TileInfo> tiles_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user