9namespace draw_routines {
16 if (ctx.
tiles.size() < 24) {
24 for (
int row = 0; row < 6; ++row) {
25 const auto& first = ctx.
tiles[row];
26 auto first_mirrored = first;
27 first_mirrored.horizontal_mirror_ =
true;
28 for (
int column : {0, 4, 8, 14, 18, 22}) {
32 for (
int column : {1, 5, 9, 15, 19, 23}) {
34 ctx.
object.
y_ + row, first_mirrored);
36 const auto& second = ctx.
tiles[6 + row];
37 auto second_mirrored = second;
38 second_mirrored.horizontal_mirror_ =
true;
39 for (
int column : {2, 6, 16, 20}) {
43 for (
int column : {3, 7, 17, 21}) {
45 ctx.
object.
y_ + row, second_mirrored);
51 for (
int column = 0; column < 4; ++column) {
52 for (
int row = 0; row < 3; ++row) {
55 ctx.
tiles[12 + column * 3 + row]);
71 if (ctx.
tiles.empty()) {
80 for (
int row = 0; row < side; ++row) {
82 int last_column = side - row - 1;
86 case DiagonalCeilingAnchor::kTopLeft:
88 case DiagonalCeilingAnchor::kBottomLeft:
91 case DiagonalCeilingAnchor::kTopRight:
93 last_column = side - 1;
95 case DiagonalCeilingAnchor::kBottomRight:
97 last_column = side - 1;
102 for (
int column = first_column; column <= last_column; ++column) {
118 if (ctx.
tiles.size() >= 16) {
121 for (
int xx = 0; xx < 4; xx++) {
122 for (
int yy = 0; yy < 4; yy++) {
127 }
else if (ctx.
tiles.size() >= 8) {
130 for (
int xx = 0; xx < 2; xx++) {
131 for (
int yy = 0; yy < 4; yy++) {
136 }
else if (ctx.
tiles.size() >= 4) {
139 for (
int xx = 0; xx < 2; xx++) {
140 for (
int yy = 0; yy < 2; yy++) {
152 if (ctx.
tiles.size() >= 16) {
154 }
else if (ctx.
tiles.size() >= 8) {
157 for (
int xx = 0; xx < 2; xx++) {
158 for (
int yy = 0; yy < 4; yy++) {
163 }
else if (ctx.
tiles.size() >= 4) {
173 if (ctx.
tiles.size() >= 12) {
175 for (
int xx = 0; xx < 3; xx++) {
176 for (
int yy = 0; yy < 4; yy++) {
181 }
else if (ctx.
tiles.size() >= 8) {
184 for (
int xx = 0; xx < 2; xx++) {
185 for (
int yy = 0; yy < 4; yy++) {
190 }
else if (ctx.
tiles.size() >= 4) {
199 if (ctx.
tiles.size() >= 12) {
201 for (
int xx = 0; xx < 4; xx++) {
202 for (
int yy = 0; yy < 3; yy++) {
207 }
else if (ctx.
tiles.size() >= 8) {
210 for (
int xx = 0; xx < 2; xx++) {
211 for (
int yy = 0; yy < 4; yy++) {
216 }
else if (ctx.
tiles.size() >= 4) {
222 DrawDiagonalCeiling(ctx, DiagonalCeilingAnchor::kTopLeft);
226 DrawDiagonalCeiling(ctx, DiagonalCeilingAnchor::kBottomLeft);
230 DrawDiagonalCeiling(ctx, DiagonalCeilingAnchor::kTopRight);
234 DrawDiagonalCeiling(ctx, DiagonalCeilingAnchor::kBottomRight);
243 .name =
"SanctuaryWall",
244 .function = DrawSanctuaryWall,
245 .draws_to_both_bgs =
false,
257 .draws_to_both_bgs =
true,
266 .name =
"4x4Corner_BothBG",
268 .draws_to_both_bgs =
true,
277 .name =
"WeirdCornerBottom_BothBG",
279 .draws_to_both_bgs =
true,
288 .name =
"WeirdCornerTop_BothBG",
290 .draws_to_both_bgs =
true,
299 .name =
"DiagonalCeilingTopLeft",
301 .draws_to_both_bgs =
false,
310 .name =
"DiagonalCeilingBottomLeft",
312 .draws_to_both_bgs =
false,
321 .name =
"DiagonalCeilingTopRight",
323 .draws_to_both_bgs =
false,
332 .name =
"DiagonalCeilingBottomRight",
334 .draws_to_both_bgs =
false,
SNES 16-bit tile metadata container.
constexpr int kSanctuaryWall
constexpr int kDiagonalCeilingBottomRight
constexpr int kDiagonalCeilingBottomLeft
constexpr int kDiagonalCeilingTopRight
constexpr int kDiagonalCeilingTopLeft
void WriteTile8(gfx::BackgroundBuffer &bg, int tile_x, int tile_y, const gfx::TileInfo &tile_info)
Write an 8x8 tile to the background buffer.
void DrawDiagonalCeiling(const DrawContext &ctx, DiagonalCeilingAnchor anchor)
void DrawSanctuaryWall(const DrawContext &ctx)
void DrawWeirdCornerTop_BothBG(const DrawContext &ctx)
Draw a weird corner top pattern for both BG layers.
void DrawDiagonalCeilingTopLeft(const DrawContext &ctx)
Draw diagonal ceiling triangle anchored at top-left.
void RegisterCornerRoutines(std::vector< DrawRoutineInfo > ®istry)
Register all corner draw routines to the registry.
void DrawCorner4x4(const DrawContext &ctx)
Draw a 4x4 grid corner pattern.
void DrawWaterFace(const DrawContext &ctx)
Draw a generic 2x2 water-face helper pattern.
void DrawWeirdCornerBottom_BothBG(const DrawContext &ctx)
Draw a weird corner bottom pattern for both BG layers.
void DrawDiagonalCeilingBottomLeft(const DrawContext &ctx)
Draw diagonal ceiling triangle anchored at bottom-left.
void DrawDiagonalCeilingTopRight(const DrawContext &ctx)
Draw diagonal ceiling triangle anchored at top-right.
void Draw4x4Corner_BothBG(const DrawContext &ctx)
Draw a 4x4 corner for both BG layers.
void DrawDiagonalCeilingBottomRight(const DrawContext &ctx)
Draw diagonal ceiling triangle anchored at bottom-right.
Context passed to draw routines containing all necessary state.
std::span< const gfx::TileInfo > tiles
gfx::BackgroundBuffer & target_bg
const RoomObject & object
gfx::BackgroundBuffer * secondary_bg
Metadata about a draw routine.