yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
object_drawer.h
Go to the documentation of this file.
1#ifndef YAZE_APP_ZELDA3_DUNGEON_OBJECT_DRAWER_H
2#define YAZE_APP_ZELDA3_DUNGEON_OBJECT_DRAWER_H
3
4#include <functional>
5#include <unordered_map>
6#include <vector>
7
8#include "absl/status/status.h"
12#include "rom/rom.h"
18
19namespace yaze {
20namespace zelda3 {
21
37 public:
38 explicit ObjectDrawer(Rom* rom, int room_id, const uint8_t* room_gfx_buffer = nullptr);
39
49 absl::Status DrawObject(const RoomObject& object, gfx::BackgroundBuffer& bg1,
51 const gfx::PaletteGroup& palette_group,
52 const DungeonState* state = nullptr,
53 gfx::BackgroundBuffer* layout_bg1 = nullptr);
54
55 struct DoorDef {
58 uint8_t position;
59
60 // Helper to get position coordinates using DoorPositionManager
61 std::pair<int, int> GetTileCoords() const {
63 }
64
65 // Helper to get door dimensions
69 };
70
71 // Chest index tracking for state queries
73
80 void DrawDoor(const DoorDef& door, int door_index, gfx::BackgroundBuffer& bg1,
81 gfx::BackgroundBuffer& bg2, const DungeonState* state = nullptr);
82
90 void DrawPotItem(uint8_t item_id, int x, int y, gfx::BackgroundBuffer& bg);
91
101 absl::Status DrawObjectList(const std::vector<RoomObject>& objects,
104 const gfx::PaletteGroup& palette_group,
105 const DungeonState* state = nullptr,
106 gfx::BackgroundBuffer* layout_bg1 = nullptr);
107
113 int GetDrawRoutineId(int16_t object_id) const;
114
120
129 void DrawTileToBitmap(gfx::Bitmap& bitmap, const gfx::TileInfo& tile_info,
130 int pixel_x, int pixel_y, const uint8_t* tiledata);
131
137 std::pair<int, int> CalculateObjectDimensions(const RoomObject& object);
138
139 protected:
140 // Draw routine function type
141 using DrawRoutine = std::function<void(ObjectDrawer*, const RoomObject&,
143 std::span<const gfx::TileInfo>,
144 const DungeonState*)>;
145
146 // Core draw routines (based on ZScream's subtype1_routines table)
147 void DrawChest(const RoomObject& obj, gfx::BackgroundBuffer& bg,
148 std::span<const gfx::TileInfo> tiles,
149 const DungeonState* state = nullptr);
150
151 void DrawNothing(const RoomObject& obj, gfx::BackgroundBuffer& bg,
152 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
155 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
158 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
159 void DrawRightwards2x4_1to16(const RoomObject& obj,
161 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
163 const RoomObject& obj, gfx::BackgroundBuffer& bg,
164 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
166 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
168 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
170 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
173 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
176 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
179 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
181 const RoomObject& obj, gfx::BackgroundBuffer& bg,
182 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
184 const RoomObject& obj, gfx::BackgroundBuffer& bg,
185 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
187 const RoomObject& obj, gfx::BackgroundBuffer& bg,
188 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
190 const RoomObject& obj, gfx::BackgroundBuffer& bg,
191 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
192 void CustomDraw(const RoomObject& obj, gfx::BackgroundBuffer& bg,
193 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
195 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
198 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
200 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
202 const RoomObject& obj, gfx::BackgroundBuffer& bg,
203 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
205 const RoomObject& obj, gfx::BackgroundBuffer& bg,
206 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
208 const RoomObject& obj, gfx::BackgroundBuffer& bg,
209 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
211 const RoomObject& obj, gfx::BackgroundBuffer& bg,
212 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
214 const RoomObject& obj, gfx::BackgroundBuffer& bg,
215 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
217 const RoomObject& obj, gfx::BackgroundBuffer& bg,
218 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
220 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
222 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
224 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
225
226 // Additional Rightwards draw routines (0x47-0x5E range)
228 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
230 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
232 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
234 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
236 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
237
238 // Corner draw routines
240 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
241
242 // Downwards draw routines
245 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
248 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
251 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
254 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
256 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
258 const RoomObject& obj, gfx::BackgroundBuffer& bg,
259 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
261 const RoomObject& obj, gfx::BackgroundBuffer& bg,
262 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
265 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
267 const RoomObject& obj, gfx::BackgroundBuffer& bg,
268 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
270 const RoomObject& obj, gfx::BackgroundBuffer& bg,
271 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
272
273 // Additional Downwards draw routines (0x70-0x7F range)
276 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
279 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
282 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
285 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
288 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
291 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
294 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
297 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
298
299 // Phase 4 Step 2: Simple Variant Routines (0x80-0x96, 0xB0-0xBD range)
302 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
305 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
308 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
311 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
314 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
317 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
320 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
323 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
326 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
329 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
330
331 // Phase 4 Step 3: Diagonal Ceiling Routines (0xA0-0xAC range)
334 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
337 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
340 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
343 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
344
345 // Phase 4 Step 5: Special Routines (0xC1, 0xCD, 0xCE, 0xDC)
347 std::span<const gfx::TileInfo> tiles);
349 std::span<const gfx::TileInfo> tiles);
351 std::span<const gfx::TileInfo> tiles);
353 std::span<const gfx::TileInfo> tiles);
354
355 // Type 3 / Special Routines
357 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
359 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
361 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
364 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
367 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
369 std::span<const gfx::TileInfo> tiles, int width,
370 int height);
371
372 // Type 2 Special Object Routines (0x122, 0x12C, 0x13E, etc.)
373 void DrawBed4x5(const RoomObject& obj, gfx::BackgroundBuffer& bg,
374 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
376 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
378 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
380 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
381
382 // Type 3 Special Object Routines (pipes, shells, lighting, etc.)
384 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
386 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
388 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
390 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
392 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
394 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
396 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
398 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
400 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
402 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
404 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
406 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
408 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
409
410 // Custom Object Routine
412 std::span<const gfx::TileInfo> tiles, const DungeonState* state = nullptr);
413
414 // Utility methods
415 void WriteTile8(gfx::BackgroundBuffer& bg, int tile_x, int tile_y,
416 const gfx::TileInfo& tile_info);
417 bool IsValidTilePosition(int tile_x, int tile_y) const;
418
419 // Check if a draw routine should render to both BG1 and BG2
420 // Uses metadata instead of hardcoded routine IDs
421 static bool RoutineDrawsToBothBGs(int routine_id);
422
435 void MarkBG1Transparent(gfx::BackgroundBuffer& bg1, int tile_x, int tile_y,
436 int pixel_width, int pixel_height);
437
438 // Door indicator fallback when graphics unavailable
439 void DrawDoorIndicator(gfx::Bitmap& bitmap, int tile_x, int tile_y,
440 int width, int height, DoorType type, DoorDirection direction);
441
442 // Draw routine registry
443 std::unordered_map<int16_t, int> object_to_routine_map_;
444 std::vector<DrawRoutine> draw_routines_;
446
449 mutable int current_chest_index_ = 0;
450 const uint8_t*
451 room_gfx_buffer_; // Room-specific graphics buffer (current_gfx16_)
452
453 // Canvas dimensions in tiles (64x64 = 512x512 pixels)
454 static constexpr int kMaxTilesX = 64;
455 static constexpr int kMaxTilesY = 64;
456};
457
458} // namespace zelda3
459} // namespace yaze
460
461#endif // YAZE_APP_ZELDA3_DUNGEON_OBJECT_DRAWER_H
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
Represents a bitmap image optimized for SNES ROM hacking.
Definition bitmap.h:67
SNES 16-bit tile metadata container.
Definition snes_tile.h:50
static std::pair< int, int > PositionToTileCoords(uint8_t position, DoorDirection direction)
Convert encoded position to tile coordinates.
Interface for accessing dungeon game state.
Draws dungeon objects to background buffers using game patterns.
void DrawDiagonalAcute_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
int GetDrawRoutineId(int16_t object_id) const
Get draw routine ID for an object.
void WriteTile8(gfx::BackgroundBuffer &bg, int tile_x, int tile_y, const gfx::TileInfo &tile_info)
void DrawDiagonalGrave_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawBed4x5(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawClosedChestPlatform(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawRightwards2x4_1to15or26(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwards2x4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawTileToBitmap(gfx::Bitmap &bitmap, const gfx::TileInfo &tile_info, int pixel_x, int pixel_y, const uint8_t *tiledata)
Draw a single tile directly to bitmap.
void InitializeDrawRoutines()
Initialize draw routine registry Must be called before drawing objects.
void DrawRightwardsPillar2x4spaced4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsBottomCorners1x2_1to16_plus13(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwards4x4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawUtility6x3(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsEdge1x1_1to16plus7(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
std::vector< DrawRoutine > draw_routines_
void DrawRightwardsDecor4x2spaced8_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsHammerPegs2x2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsPillar2x4spaced2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawHorizontalTurtleRockPipe(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwards2x2_1to15or32(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDiagonalCeilingBottomRight(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsBlock2x2spaced2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawSingle2x2(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
std::pair< int, int > CalculateObjectDimensions(const RoomObject &object)
Calculate the dimensions (width, height) of an object in pixels.
void DrawDoorSwitcherer(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwards2x2_1to15or32(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
const uint8_t * room_gfx_buffer_
void DrawUtility3x5(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawSingle4x3(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRupeeFloor(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsEdge1x1_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsBar2x3_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
static bool RoutineDrawsToBothBGs(int routine_id)
void DrawDownwardsDecor2x4spaced8_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawNothing(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
absl::Status DrawObjectList(const std::vector< RoomObject > &objects, gfx::BackgroundBuffer &bg1, gfx::BackgroundBuffer &bg2, const gfx::PaletteGroup &palette_group, const DungeonState *state=nullptr, gfx::BackgroundBuffer *layout_bg1=nullptr)
Draw all objects in a room.
void DrawDownwardsDecor4x2spaced4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsLine1x1_1to16plus1(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDoor(const DoorDef &door, int door_index, gfx::BackgroundBuffer &bg1, gfx::BackgroundBuffer &bg2, const DungeonState *state=nullptr)
Draw a door to background buffers.
void DrawDiagonalCeilingTopLeft(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsTopCorners1x2_1to16_plus13(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsHasEdge1x1_1to16_plus3(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDiagonalAcute_1to16_BothBG(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwards2x2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawPotItem(uint8_t item_id, int x, int y, gfx::BackgroundBuffer &bg)
Draw a pot item visualization.
void DrawLargeCanvasObject(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, int width, int height)
void Draw4x4Corner_BothBG(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawBigLightBeam(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsCannonHole3x6_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwards2x2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsLine1x1_1to16plus1(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawVerticalTurtleRockPipe(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwards4x2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawCorner4x4(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsHasEdge1x1_1to16_plus3(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsHammerPegs2x2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwards2x4_1to16_BothBG(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawCustomObject(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsStatue2x3spaced2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDiagonalCeilingTopRight(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawWaterFace(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsDecor4x3spaced4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsShelf4x4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDiagonalGrave_1to16_BothBG(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawMovingWallEast(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawDownwardsPots2x2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
std::unordered_map< int16_t, int > object_to_routine_map_
void DrawDownwardsFloor4x4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsDecor3x4spaced2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
static constexpr int kMaxTilesX
void DrawRightwardsPots2x2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawActual4x4(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawOpenChestPlatform(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawRightwards1x1Solid_1to16_plus3(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void MarkBG1Transparent(gfx::BackgroundBuffer &bg1, int tile_x, int tile_y, int pixel_width, int pixel_height)
Mark BG1 pixels as transparent where BG2 overlay objects are drawn.
void DrawChest(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsDecor4x4spaced2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void CustomDraw(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawSolidWallDecor3x4(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDiagonalCeilingBottomLeft(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsCannonHole4x3_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawWeirdCornerBottom_BothBG(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwards3x6(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsHasEdge1x1_1to16_plus2(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwards4x2_1to15or26(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
ObjectDrawer(Rom *rom, int room_id, const uint8_t *room_gfx_buffer=nullptr)
void DrawRightwardsDecor4x4spaced2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawSingle4x4(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawLightBeam(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
absl::Status DrawObject(const RoomObject &object, gfx::BackgroundBuffer &bg1, gfx::BackgroundBuffer &bg2, const gfx::PaletteGroup &palette_group, const DungeonState *state=nullptr, gfx::BackgroundBuffer *layout_bg1=nullptr)
Draw a room object to background buffers.
void DrawWeirdCornerTop_BothBG(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwards4x2_1to16_BothBG(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsDecor3x4spaced4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsRightCorners2x1_1to16_plus12(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
static constexpr int kMaxTilesY
void DrawRightwardsDoubled2x2spaced2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawBossShell4x4(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwards1x2_1to16_plus2(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawGanonTriforceFloorDecor(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsBar4x3_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
bool IsValidTilePosition(int tile_x, int tile_y) const
void DrawRightwardsDecor2x2spaced12_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsBlock2x2spaced2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDoorIndicator(gfx::Bitmap &bitmap, int tile_x, int tile_y, int width, int height, DoorType type, DoorDirection direction)
void DrawDownwardsHasEdge1x1_1to16_plus23(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
std::function< void(ObjectDrawer *, const RoomObject &, gfx::BackgroundBuffer &, std::span< const gfx::TileInfo >, const DungeonState *)> DrawRoutine
void DrawDownwards1x1Solid_1to16_plus3(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawSomariaLine(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawArcheryGameTargetDoor(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawRightwardsBigRail1x3_1to16plus5(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawMovingWallWest(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawDownwardsLeftCorners2x1_1to16_plus12(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsDecor2x2spaced12_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
void DrawDownwardsBigRail3x1_1to16plus5(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles, const DungeonState *state=nullptr)
constexpr DoorDimensions GetDoorDimensions(DoorDirection dir)
Get door dimensions based on direction.
Definition door_types.h:192
DoorType
Door types from ALTTP.
Definition door_types.h:33
DoorDirection
Door direction on room walls.
Definition door_types.h:18
Represents a group of palettes.
Door dimensions in tiles (8x8 pixel tiles)
Definition door_types.h:178
std::pair< int, int > GetTileCoords() const
DoorDimensions GetDimensions() const