Refactor uses of PaintAddImageAsParent in Maze.cpp

This commit is contained in:
Matt 2021-03-08 17:52:49 +02:00
parent b7b5cb4f67
commit 5b2655fe7e
No known key found for this signature in database
GPG Key ID: 18CE582C71A225B0
1 changed files with 28 additions and 26 deletions

View File

@ -54,7 +54,7 @@ static void maze_paint_setup(
uint32_t rotation = session->CurrentRotation;
// draw ground
int32_t image_id = SPR_TERRAIN_DIRT | session->TrackColours[SCHEME_MISC];
PaintAddImageAsParent(session, image_id, 0, 0, 32, 32, 0, height);
PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 32, 32, 0 });
wooden_a_supports_paint_setup(session, (rotation & 1) ? 0 : 1, 0, height, session->TrackColours[SCHEME_3], nullptr);
@ -81,92 +81,94 @@ static void maze_paint_setup(
image_id = base_image_id + SPR_MAZE_OFFSET_WALL_CENTRE;
if (maze_entry & MAZE_ENTRY_FLAG_3)
PaintAddImageAsParent(session, image_id, 2, 2, 10, 10, 9, height, 3, 3, height + 2);
PaintAddImageAsParent(session, image_id, { 2, 2, height }, { 10, 10, 9 }, { 3, 3, height + 2 });
if (maze_entry & MAZE_ENTRY_FLAG_7)
PaintAddImageAsParent(session, image_id, 2, 18, 10, 10, 9, height, 3, 19, height + 2);
PaintAddImageAsParent(session, image_id, { 2, 18, height }, { 10, 10, 9 }, { 3, 19, height + 2 });
if (maze_entry & MAZE_ENTRY_FLAG_11)
PaintAddImageAsParent(session, image_id, 18, 18, 10, 10, 9, height, 19, 19, height + 2);
PaintAddImageAsParent(session, image_id, { 18, 18, height }, { 10, 10, 9 }, { 19, 19, height + 2 });
if (maze_entry & MAZE_ENTRY_FLAG_15)
PaintAddImageAsParent(session, image_id, 18, 2, 10, 10, 9, height, 19, 3, height + 2);
PaintAddImageAsParent(session, image_id, { 18, 2, height }, { 10, 10, 9 }, { 19, 3, height + 2 });
image_id = base_image_id + SPR_MAZE_OFFSET_WALL_TOP_LEFT;
if (maze_entry & MAZE_ENTRY_FLAG_0)
PaintAddImageAsParent(session, image_id, 2, 0, 10, 1, 9, height, 3, 1, height + 2);
PaintAddImageAsParent(session, image_id, { 2, 0, height }, { 10, 1, 9 }, { 3, 1, height + 2 });
if (maze_entry & MAZE_ENTRY_FLAG_13)
PaintAddImageAsParent(session, image_id, 18, 0, 10, 1, 9, height, 19, 1, height + 2);
PaintAddImageAsParent(session, image_id, { 18, 0, height }, { 10, 1, 9 }, { 19, 1, height + 2 });
image_id = base_image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_RIGHT;
if (maze_entry & MAZE_ENTRY_FLAG_5)
PaintAddImageAsParent(session, image_id, 2, 30, 10, 1, 9, height, 3, 30, height + 2);
PaintAddImageAsParent(session, image_id, { 2, 30, height }, { 10, 1, 9 }, { 3, 30, height + 2 });
if (maze_entry & MAZE_ENTRY_FLAG_8)
PaintAddImageAsParent(session, image_id, 18, 30, 10, 1, 9, height, 19, 30, height + 2);
PaintAddImageAsParent(session, image_id, { 18, 30, height }, { 10, 1, 9 }, { 19, 30, height + 2 });
image_id = base_image_id + SPR_MAZE_OFFSET_WALL_TOP_RIGHT;
if (maze_entry & MAZE_ENTRY_FLAG_1)
PaintAddImageAsParent(session, image_id, 0, 2, 1, 10, 9, height, 1, 3, height + 2);
PaintAddImageAsParent(session, image_id, { 0, 2, height }, { 1, 10, 9 }, { 1, 3, height + 2 });
if (maze_entry & MAZE_ENTRY_FLAG_4)
PaintAddImageAsParent(session, image_id, 0, 18, 1, 10, 9, height, 1, 19, height + 2);
PaintAddImageAsParent(session, image_id, { 0, 18, height }, { 1, 10, 9 }, { 1, 19, height + 2 });
image_id = base_image_id + SPR_MAZE_OFFSET_WALL_BOTTOM_LEFT;
if (maze_entry & MAZE_ENTRY_FLAG_12)
PaintAddImageAsParent(session, image_id, 30, 2, 1, 10, 9, height, 30, 3, height + 2);
PaintAddImageAsParent(session, image_id, { 30, 2, height }, { 1, 10, 9 }, { 30, 3, height + 2 });
if (maze_entry & MAZE_ENTRY_FLAG_9)
PaintAddImageAsParent(session, image_id, 30, 18, 1, 10, 9, height, 30, 19, height + 2);
PaintAddImageAsParent(session, image_id, { 30, 18, height }, { 1, 10, 9 }, { 30, 19, height + 2 });
image_id = base_image_id + SPR_MAZE_OFFSET_WALL_INNER_NE_SW;
if (maze_entry & MAZE_ENTRY_FLAG_2)
PaintAddImageAsParent(session, image_id, 2, 14, 10, 4, 9, height, 3, 14, height + 2);
PaintAddImageAsParent(session, image_id, { 2, 14, height }, { 10, 4, 9 }, { 3, 14, height + 2 });
if (maze_entry & MAZE_ENTRY_FLAG_10)
PaintAddImageAsParent(session, image_id, 18, 14, 10, 4, 9, height, 19, 14, height + 2);
PaintAddImageAsParent(session, image_id, { 18, 14, height }, { 10, 4, 9 }, { 19, 14, height + 2 });
image_id = base_image_id + SPR_MAZE_OFFSET_WALL_INNER_NW_SE;
if (maze_entry & MAZE_ENTRY_FLAG_14)
PaintAddImageAsParent(session, image_id, 14, 2, 4, 10, 9, height, 14, 3, height + 2);
PaintAddImageAsParent(session, image_id, { 14, 2, height }, { 4, 10, 9 }, { 14, 3, height + 2 });
if (maze_entry & MAZE_ENTRY_FLAG_6)
PaintAddImageAsParent(session, image_id, 14, 18, 4, 10, 9, height, 14, 19, height + 2);
PaintAddImageAsParent(session, image_id, { 14, 18, height }, { 4, 10, 9 }, { 14, 19, height + 2 });
image_id = base_image_id + SPR_MAZE_OFFSET_COLUMN_CORNER;
if (maze_entry & (MAZE_ENTRY_FLAG_0 | MAZE_ENTRY_FLAG_1))
PaintAddImageAsParent(session, image_id, 0, 0, 1, 1, 9, height, 1, 1, height + 2);
PaintAddImageAsParent(session, image_id, { 0, 0, height }, { 1, 1, 9 }, { 1, 1, height + 2 });
if (maze_entry & (MAZE_ENTRY_FLAG_4 | MAZE_ENTRY_FLAG_5))
PaintAddImageAsParent(session, image_id, 0, 30, 1, 1, 9, height, 1, 30, height + 2);
PaintAddImageAsParent(session, image_id, { 0, 30, height }, { 1, 1, 9 }, { 1, 30, height + 2 });
if (maze_entry & (MAZE_ENTRY_FLAG_8 | MAZE_ENTRY_FLAG_9))
PaintAddImageAsParent(session, image_id, 30, 30, 1, 1, 9, height, 30, 30, height + 2);
PaintAddImageAsParent(session, image_id, { 30, 30, height }, { 1, 1, 9 }, { 30, 30, height + 2 });
if (maze_entry & (MAZE_ENTRY_FLAG_12 | MAZE_ENTRY_FLAG_13))
PaintAddImageAsParent(session, image_id, 30, 0, 1, 1, 9, height, 30, 1, height + 2);
PaintAddImageAsParent(session, image_id, { 30, 0, height }, { 1, 1, 9 }, { 30, 1, height + 2 });
if (maze_entry & (MAZE_ENTRY_FLAG_0 | MAZE_ENTRY_FLAG_13 | MAZE_ENTRY_FLAG_14))
PaintAddImageAsParent(
session, base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_LEFT, 14, 0, 2, 1, 9, height, 15, 1, height + 2);
session, base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_LEFT, { 14, 0, height }, { 2, 1, 9 }, { 15, 1, height + 2 });
if (maze_entry & (MAZE_ENTRY_FLAG_5 | MAZE_ENTRY_FLAG_6 | MAZE_ENTRY_FLAG_8))
PaintAddImageAsParent(
session, base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_RIGHT, 14, 30, 2, 1, 9, height, 15, 30, height + 2);
session, base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_RIGHT, { 14, 30, height }, { 2, 1, 9 },
{ 15, 30, height + 2 });
if (maze_entry & (MAZE_ENTRY_FLAG_1 | MAZE_ENTRY_FLAG_2 | MAZE_ENTRY_FLAG_4))
PaintAddImageAsParent(
session, base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_RIGHT, 0, 14, 1, 2, 9, height, 1, 15, height + 2);
session, base_image_id + SPR_MAZE_OFFSET_COLUMN_TOP_RIGHT, { 0, 14, height }, { 1, 2, 9 }, { 1, 15, height + 2 });
if (maze_entry & (MAZE_ENTRY_FLAG_9 | MAZE_ENTRY_FLAG_10 | MAZE_ENTRY_FLAG_12))
PaintAddImageAsParent(
session, base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_LEFT, 30, 14, 1, 2, 9, height, 30, 15, height + 2);
session, base_image_id + SPR_MAZE_OFFSET_COLUMN_BOTTOM_LEFT, { 30, 14, height }, { 1, 2, 9 },
{ 30, 15, height + 2 });
if (maze_entry & (MAZE_ENTRY_FLAG_2 | MAZE_ENTRY_FLAG_6 | MAZE_ENTRY_FLAG_10 | MAZE_ENTRY_FLAG_14))
{
PaintAddImageAsParent(
session, base_image_id + SPR_MAZE_OFFSET_COLUMN_CENTRE, 14, 14, 2, 2, 8, height, 15, 15, height + 2);
session, base_image_id + SPR_MAZE_OFFSET_COLUMN_CENTRE, { 14, 14, height }, { 2, 2, 8 }, { 15, 15, height + 2 });
paint_util_set_segment_support_height(session, SEGMENT_C4, height + 12, 0x20);
}