1#ifndef YAZE_APP_ZELDA3_DUNGEON_OBJECT_DRAWER_H
2#define YAZE_APP_ZELDA3_DUNGEON_OBJECT_DRAWER_H
5#include <unordered_map>
8#include "absl/status/status.h"
34 explicit ObjectDrawer(
Rom* rom,
const uint8_t* room_gfx_buffer =
nullptr);
57 absl::Status
DrawObjectList(
const std::vector<RoomObject>& objects,
84 int pixel_x,
int pixel_y,
const uint8_t* tiledata);
89 std::span<const gfx::TileInfo>)>;
93 std::span<const gfx::TileInfo> tiles);
95 std::span<const gfx::TileInfo> tiles);
97 std::span<const gfx::TileInfo> tiles);
99 std::span<const gfx::TileInfo> tiles);
101 std::span<const gfx::TileInfo> tiles);
103 std::span<const gfx::TileInfo> tiles);
105 std::span<const gfx::TileInfo> tiles);
107 std::span<const gfx::TileInfo> tiles);
109 std::span<const gfx::TileInfo> tiles);
111 std::span<const gfx::TileInfo> tiles);
113 std::span<const gfx::TileInfo> tiles);
115 std::span<const gfx::TileInfo> tiles);
117 std::span<const gfx::TileInfo> tiles);
119 std::span<const gfx::TileInfo> tiles);
121 std::span<const gfx::TileInfo> tiles);
123 std::span<const gfx::TileInfo> tiles);
125 std::span<const gfx::TileInfo> tiles);
127 std::span<const gfx::TileInfo> tiles);
129 std::span<const gfx::TileInfo> tiles);
131 std::span<const gfx::TileInfo> tiles);
133 std::span<const gfx::TileInfo> tiles);
135 std::span<const gfx::TileInfo> tiles);
137 std::span<const gfx::TileInfo> tiles);
139 std::span<const gfx::TileInfo> tiles);
143 std::span<const gfx::TileInfo> tiles);
145 std::span<const gfx::TileInfo> tiles);
147 std::span<const gfx::TileInfo> tiles);
149 std::span<const gfx::TileInfo> tiles);
151 std::span<const gfx::TileInfo> tiles);
153 std::span<const gfx::TileInfo> tiles);
155 std::span<const gfx::TileInfo> tiles);
157 std::span<const gfx::TileInfo> tiles);
159 std::span<const gfx::TileInfo> tiles);
The Rom class is used to load, save, and modify Rom data.
Represents a bitmap image optimized for SNES ROM hacking.
SNES 16-bit tile metadata container.
Draws dungeon objects to background buffers using game patterns.
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 DrawRightwardsPillar2x4spaced4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
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 DrawDiagonalAcute_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawRightwards2x4spaced4_1to16_BothBG(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
std::vector< DrawRoutine > draw_routines_
void DrawDownwardsRightCorners2x1_1to16_plus12(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)
void DrawRightwards2x4_1to15or26(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawRightwards4x4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawDiagonalGrave_1to16_BothBG(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawRightwardsHasEdge1x1_1to16_plus2(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawRightwardsHasEdge1x1_1to16_plus3(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
absl::Status DrawObjectList(const std::vector< RoomObject > &objects, gfx::BackgroundBuffer &bg1, gfx::BackgroundBuffer &bg2, const gfx::PaletteGroup &palette_group)
Draw all objects in a room.
const uint8_t * room_gfx_buffer_
void DrawRightwards1x2_1to16_plus2(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawDownwardsDecor4x2spaced4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawDownwardsEdge1x1_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
absl::Status DrawObject(const RoomObject &object, gfx::BackgroundBuffer &bg1, gfx::BackgroundBuffer &bg2, const gfx::PaletteGroup &palette_group)
Draw a room object to background buffers.
void DrawRightwards2x2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawDiagonalAcute_1to16_BothBG(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)
void DrawRightwards2x2_1to15or32(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawDownwardsHasEdge1x1_1to16_plus3(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
std::unordered_map< int16_t, int > object_to_routine_map_
void DrawDoorSwitcherer(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
static constexpr int kMaxTilesX
void DrawRightwardsStatue2x3spaced2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawDownwards4x2_1to16_BothBG(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawRightwardsBottomCorners1x2_1to16_plus13(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawDiagonalGrave_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
bool routines_initialized_
void DrawRightwards2x4spaced4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawRightwardsDecor4x4spaced2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawRightwardsDecor2x2spaced12_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawDownwards2x2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
static constexpr int kMaxTilesY
void DrawDownwards2x2_1to15or32(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawRightwardsDecor4x3spaced4_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void CustomDraw(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
bool IsValidTilePosition(int tile_x, int tile_y) const
void DrawDownwards4x2_1to15or26(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
void DrawRightwardsTopCorners1x2_1to16_plus13(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
std::function< void(ObjectDrawer *, const RoomObject &, gfx::BackgroundBuffer &, std::span< const gfx::TileInfo >)> DrawRoutine
void DrawRightwardsDoubled2x2spaced2_1to16(const RoomObject &obj, gfx::BackgroundBuffer &bg, std::span< const gfx::TileInfo > tiles)
Main namespace for the application.
Represents a group of palettes.