8namespace draw_routines {
18 for (
int s = 0; s < size; s++) {
19 if (ctx.
tiles.size() >= 4) {
45 for (
int s = 0; s < size; s++) {
46 if (ctx.
tiles.size() >= 8) {
66 }
else if (ctx.
tiles.size() >= 4) {
87 for (
int s = 0; s < count; s++) {
88 if (ctx.
tiles.size() >= 8) {
108 }
else if (ctx.
tiles.size() >= 4) {
132 int count = size + 1;
134 constexpr int kStepTiles = 6;
136 for (
int s = 0; s < count; s++) {
137 const int base_x = ctx.
object.
x_ + (s * kStepTiles);
139 if (ctx.
tiles.size() >= 8) {
159 }
else if (ctx.
tiles.size() >= 4) {
180 int count = size + 1;
182 for (
int s = 0; s < count; s++) {
183 if (ctx.
tiles.size() >= 4) {
201 if (ctx.
tiles.size() >= 9) {
202 auto draw_column = [&](
int x,
int base) {
204 ctx.
tiles[base + 0]);
206 ctx.
tiles[base + 1]);
208 ctx.
tiles[base + 2]);
213 int mid_cols = (size + 1) * 2;
214 for (
int s = 0; s < mid_cols; s++) {
215 draw_column(ctx.
object.
x_ + 1 + s, 3);
218 draw_column(ctx.
object.
x_ + 1 + mid_cols, 6);
222 int count = (size * 2) + 1;
223 for (
int s = 0; s < count; s++) {
224 if (ctx.
tiles.size() >= 2) {
237 int count = size + 2;
238 if (ctx.
tiles.size() < 3)
return;
243 for (
int s = 0; s < count; s++) {
254 int count = size + 1;
255 if (ctx.
tiles.size() < 3)
return;
260 for (
int s = 0; s < count; s++) {
270 int count = size + 21;
271 if (ctx.
tiles.size() < 3)
return;
276 for (
int s = 0; s < count; s++) {
288 int count = size + 10;
290 for (
int s = 0; s < count; s++) {
291 if (ctx.
tiles.size() >= 2) {
306 int count = size + 10;
308 for (
int s = 0; s < count; s++) {
309 if (ctx.
tiles.size() >= 2) {
324 int count = size + 1;
326 for (
int s = 0; s < count; s++) {
327 if (ctx.
tiles.size() >= 16) {
330 for (
int x = 0; x < 4; ++x) {
331 for (
int y = 0; y < 4; ++y) {
345 int count = size + 4;
347 for (
int s = 0; s < count; s++) {
348 if (ctx.
tiles.size() >= 1) {
361 int count = size + 1;
363 for (
int s = 0; s < count; s++) {
364 if (ctx.
tiles.size() >= 16) {
366 for (
int x = 0; x < 4; ++x) {
367 for (
int y = 0; y < 4; ++y) {
382 int count = size + 1;
384 for (
int s = 0; s < count; s++) {
385 if (ctx.
tiles.size() >= 6) {
387 for (
int x = 0; x < 2; ++x) {
388 for (
int y = 0; y < 3; ++y) {
403 int count = size + 1;
405 for (
int s = 0; s < count; s++) {
406 if (ctx.
tiles.size() >= 8) {
408 for (
int x = 0; x < 2; ++x) {
409 for (
int y = 0; y < 4; ++y) {
424 int count = size + 1;
426 for (
int s = 0; s < count; s++) {
427 if (ctx.
tiles.size() >= 12) {
429 for (
int x = 0; x < 4; ++x) {
430 for (
int y = 0; y < 3; ++y) {
445 int count = size + 1;
447 for (
int s = 0; s < count; s++) {
448 if (ctx.
tiles.size() >= 8) {
450 for (
int x = 0; x < 4; ++x) {
451 for (
int y = 0; y < 2; ++y) {
465 int count = size + 1;
467 for (
int s = 0; s < count; s++) {
468 if (ctx.
tiles.size() >= 4) {
493 .name =
"Rightwards2x2_1to15or32",
498 .draws_to_both_bgs =
false,
507 .name =
"Rightwards2x4_1to15or26",
511 .draws_to_both_bgs =
false,
520 .name =
"Rightwards2x4_1to16",
524 .draws_to_both_bgs =
true,
533 .name =
"Rightwards2x4_1to16_BothBG",
537 .draws_to_both_bgs =
false,
546 .name =
"Rightwards2x2_1to16",
548 .draws_to_both_bgs =
false,
557 .name =
"Rightwards1x2_1to16_plus2",
559 .draws_to_both_bgs =
false,
568 .name =
"RightwardsHasEdge1x1_1to16_plus3",
570 .draws_to_both_bgs =
false,
579 .name =
"RightwardsHasEdge1x1_1to16_plus2",
581 .draws_to_both_bgs =
false,
590 .name =
"RightwardsHasEdge1x1_1to16_plus23",
592 .draws_to_both_bgs =
false,
601 .name =
"RightwardsTopCorners1x2_1to16_plus13",
603 .draws_to_both_bgs =
false,
612 .name =
"RightwardsBottomCorners1x2_1to16_plus13",
614 .draws_to_both_bgs =
false,
623 .name =
"Rightwards4x4_1to16",
625 .draws_to_both_bgs =
false,
634 .name =
"Rightwards1x1Solid_1to16_plus3",
636 .draws_to_both_bgs =
false,
645 .name =
"RightwardsDecor4x4spaced2_1to16",
647 .draws_to_both_bgs =
false,
656 .name =
"RightwardsStatue2x3spaced2_1to16",
658 .draws_to_both_bgs =
false,
667 .name =
"RightwardsPillar2x4spaced4_1to16",
669 .draws_to_both_bgs =
false,
678 .name =
"RightwardsDecor4x3spaced4_1to16",
680 .draws_to_both_bgs =
false,
689 .name =
"RightwardsDoubled2x2spaced2_1to16",
691 .draws_to_both_bgs =
false,
700 .name =
"RightwardsDecor2x2spaced12_1to16",
702 .draws_to_both_bgs =
false,
constexpr int kRightwards2x2_1to16
constexpr int kRightwardsHasEdge1x1_1to16_plus2
constexpr int kRightwardsDecor4x4spaced2_1to16
constexpr int kRightwardsDecor2x2spaced12_1to16
constexpr int kRightwardsStatue2x3spaced2_1to16
constexpr int kRightwards4x4_1to16
constexpr int kRightwardsBottomCorners1x2_1to16_plus13
constexpr int kRightwards2x4_1to16_BothBG
constexpr int kRightwards2x2_1to15or32
constexpr int kRightwardsHasEdge1x1_1to16_plus23
constexpr int kRightwardsHasEdge1x1_1to16_plus3
constexpr int kRightwards1x2_1to16_plus2
constexpr int kRightwardsPillar2x4spaced4_1to16
constexpr int kRightwardsTopCorners1x2_1to16_plus13
constexpr int kRightwards2x4_1to16
constexpr int kRightwards2x4_1to15or26
constexpr int kRightwardsDecor4x3spaced4_1to16
constexpr int kRightwards1x1Solid_1to16_plus3
constexpr int kRightwardsDoubled2x2spaced2_1to16
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 DrawRightwardsStatue2x3spaced2_1to16(const DrawContext &ctx)
Draw 2x3 statue with spacing.
void DrawRightwards2x4_1to15or26(const DrawContext &ctx)
Draw 2x4 tiles rightward (1-15 or 26 repetitions)
void DrawRightwards2x2_1to15or32(const DrawContext &ctx)
Draw 2x2 tiles rightward (1-15 or 32 repetitions)
void DrawRightwardsHasEdge1x1_1to16_plus23(const DrawContext &ctx)
Draw 1x1 tiles with edge detection +23.
void DrawRightwardsBottomCorners1x2_1to16_plus13(const DrawContext &ctx)
Draw bottom corner 1x2 tiles with +13 offset.
void DrawRightwardsTopCorners1x2_1to16_plus13(const DrawContext &ctx)
Draw top corner 1x2 tiles with +13 offset.
void DrawRightwardsHasEdge1x1_1to16_plus2(const DrawContext &ctx)
Draw 1x1 tiles with edge detection +2.
void DrawRightwardsDecor2x2spaced12_1to16(const DrawContext &ctx)
Draw 2x2 decoration with large spacing.
void DrawRightwards1x1Solid_1to16_plus3(const DrawContext &ctx)
Draw 1x1 solid tiles +3 offset.
void DrawRightwards1x2_1to16_plus2(const DrawContext &ctx)
Draw 1x3 tiles rightward with caps.
void DrawRightwards4x4_1to16(const DrawContext &ctx)
Draw 4x4 block rightward.
void DrawRightwardsHasEdge1x1_1to16_plus3(const DrawContext &ctx)
Draw 1x1 tiles with edge detection +3.
void DrawRightwards2x2_1to16(const DrawContext &ctx)
Draw 2x2 tiles rightward (1-16 repetitions)
void DrawRightwardsDoubled2x2spaced2_1to16(const DrawContext &ctx)
Draw doubled 2x2 with spacing.
void DrawRightwards2x4_1to16(const DrawContext &ctx)
Draw 2x4 tiles rightward with adjacent spacing (1-16 repetitions)
void RegisterRightwardsRoutines(std::vector< DrawRoutineInfo > ®istry)
Register all rightwards draw routines to the registry.
void DrawRightwardsDecor4x3spaced4_1to16(const DrawContext &ctx)
Draw 4x3 decoration with spacing.
void DrawRightwards2x4_1to16_BothBG(const DrawContext &ctx)
Draw 2x4 tiles rightward with adjacent spacing to both BG layers.
void DrawRightwardsPillar2x4spaced4_1to16(const DrawContext &ctx)
Draw 2x4 pillar with spacing.
void DrawRightwardsDecor4x4spaced2_1to16(const DrawContext &ctx)
Draw 4x4 decoration with spacing.
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.