9namespace draw_routines {
24 if (ctx.
tiles.empty()) {
31 const bool mirror_x = anchor == DiagonalCeilingAnchor::kTopRight ||
32 anchor == DiagonalCeilingAnchor::kBottomRight;
33 const bool mirror_y = anchor == DiagonalCeilingAnchor::kBottomLeft ||
34 anchor == DiagonalCeilingAnchor::kBottomRight;
36 const int base_x = ctx.
object.
x_ - (mirror_x ? (side - 1) : 0);
37 const int base_y = ctx.
object.
y_ - (mirror_y ? (side - 1) : 0);
40 for (
int row = 0; row < side; ++row) {
41 const int span = side - row;
42 for (
int col = 0; col < span; ++col) {
43 const int x = mirror_x ? (side - 1 - col) : col;
44 const int y = mirror_y ? (side - 1 - row) : row;
61 if (ctx.
tiles.size() >= 16) {
64 for (
int xx = 0; xx < 4; xx++) {
65 for (
int yy = 0; yy < 4; yy++) {
70 }
else if (ctx.
tiles.size() >= 8) {
74 for (
int xx = 0; xx < 2; xx++) {
75 for (
int yy = 0; yy < 4; yy++) {
80 }
else if (ctx.
tiles.size() >= 4) {
83 for (
int xx = 0; xx < 2; xx++) {
84 for (
int yy = 0; yy < 2; yy++) {
96 if (ctx.
tiles.size() >= 16) {
98 }
else if (ctx.
tiles.size() >= 8) {
101 for (
int xx = 0; xx < 2; xx++) {
102 for (
int yy = 0; yy < 4; yy++) {
107 }
else if (ctx.
tiles.size() >= 4) {
117 if (ctx.
tiles.size() >= 12) {
119 for (
int xx = 0; xx < 3; xx++) {
120 for (
int yy = 0; yy < 4; yy++) {
125 }
else if (ctx.
tiles.size() >= 8) {
128 for (
int xx = 0; xx < 2; xx++) {
129 for (
int yy = 0; yy < 4; yy++) {
134 }
else if (ctx.
tiles.size() >= 4) {
143 if (ctx.
tiles.size() >= 12) {
145 for (
int xx = 0; xx < 4; xx++) {
146 for (
int yy = 0; yy < 3; yy++) {
151 }
else if (ctx.
tiles.size() >= 8) {
154 for (
int xx = 0; xx < 2; xx++) {
155 for (
int yy = 0; yy < 4; yy++) {
160 }
else if (ctx.
tiles.size() >= 4) {
166 DrawDiagonalCeiling(ctx, DiagonalCeilingAnchor::kTopLeft);
170 DrawDiagonalCeiling(ctx, DiagonalCeilingAnchor::kBottomLeft);
174 DrawDiagonalCeiling(ctx, DiagonalCeilingAnchor::kTopRight);
178 DrawDiagonalCeiling(ctx, DiagonalCeilingAnchor::kBottomRight);
190 .draws_to_both_bgs =
true,
199 .name =
"4x4Corner_BothBG",
201 .draws_to_both_bgs =
true,
210 .name =
"WeirdCornerBottom_BothBG",
212 .draws_to_both_bgs =
true,
221 .name =
"WeirdCornerTop_BothBG",
223 .draws_to_both_bgs =
true,
232 .name =
"DiagonalCeilingTopLeft",
234 .draws_to_both_bgs =
false,
243 .name =
"DiagonalCeilingBottomLeft",
245 .draws_to_both_bgs =
false,
254 .name =
"DiagonalCeilingTopRight",
256 .draws_to_both_bgs =
false,
265 .name =
"DiagonalCeilingBottomRight",
267 .draws_to_both_bgs =
false,
SNES 16-bit tile metadata container.
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 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
Metadata about a draw routine.