refactor: Update Dungeon Rendering Logic for Enhanced Tile Management (WIP)

- Refactored DungeonCanvasViewer to utilize LoadLayoutTilesToBuffer for rendering layout tiles, improving the separation of concerns in the rendering process.
- Updated ObjectDrawer to draw using 8x8 tiles instead of 16x16, enhancing tile rendering accuracy and efficiency.
- Modified Room and RoomLayoutObject classes to support room-specific graphics buffers, ensuring correct tile usage during rendering.
- Removed legacy methods and classes related to tile handling, streamlining the codebase and improving maintainability.
This commit is contained in:
scawful
2025-10-09 23:50:12 -04:00
parent 3f2ef7f523
commit 8481cd9366
9 changed files with 348 additions and 362 deletions

View File

@@ -31,7 +31,7 @@ namespace zelda3 {
*/
class ObjectDrawer {
public:
explicit ObjectDrawer(Rom* rom);
explicit ObjectDrawer(Rom* rom, const uint8_t* room_gfx_buffer = nullptr);
/**
* @brief Draw a room object to background buffers
@@ -139,8 +139,8 @@ class ObjectDrawer {
const std::vector<gfx::Tile16>& tiles);
// Utility methods
void WriteTile16(gfx::BackgroundBuffer& bg, int tile_x, int tile_y,
const gfx::Tile16& tile);
void WriteTile8(gfx::BackgroundBuffer& bg, int tile_x, int tile_y,
const gfx::TileInfo& tile_info);
bool IsValidTilePosition(int tile_x, int tile_y) const;
// Draw routine registry
@@ -149,6 +149,7 @@ class ObjectDrawer {
bool routines_initialized_ = false;
Rom* rom_;
const uint8_t* room_gfx_buffer_; // Room-specific graphics buffer (current_gfx16_)
// Canvas dimensions in tiles (64x64 = 512x512 pixels)
static constexpr int kMaxTilesX = 64;