mirror of https://github.com/OpenRCT2/OpenRCT2.git
Expose paint_arrange_structs_helper for testing
This commit is contained in:
parent
999d979fcb
commit
941607053a
|
@ -734,7 +734,7 @@ void paint_generate_structs(rct_drawpixelinfo * dpi)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static paint_struct * paint_arrange_structs_helper(paint_struct * ps_next, uint16 quadrantIndex, uint8 flag)
|
paint_struct * paint_arrange_structs_helper(paint_struct * ps_next, uint16 quadrantIndex, uint8 flag)
|
||||||
{
|
{
|
||||||
paint_struct * ps;
|
paint_struct * ps;
|
||||||
paint_struct * ps_temp;
|
paint_struct * ps_temp;
|
||||||
|
@ -777,16 +777,7 @@ static paint_struct * paint_arrange_structs_helper(paint_struct * ps_next, uint1
|
||||||
ps_next->quadrant_flags &= ~PAINT_QUADRANT_FLAG_IDENTICAL;
|
ps_next->quadrant_flags &= ~PAINT_QUADRANT_FLAG_IDENTICAL;
|
||||||
ps_temp = ps;
|
ps_temp = ps;
|
||||||
|
|
||||||
typedef struct bound_box {
|
const paint_struct_bound_box initialBBox = {
|
||||||
uint16 x;
|
|
||||||
uint16 y;
|
|
||||||
uint16 z;
|
|
||||||
uint16 x_end;
|
|
||||||
uint16 y_end;
|
|
||||||
uint16 z_end;
|
|
||||||
} bound_box;
|
|
||||||
|
|
||||||
bound_box initialBBox = {
|
|
||||||
.x = ps_next->bound_box_x,
|
.x = ps_next->bound_box_x,
|
||||||
.y = ps_next->bound_box_y,
|
.y = ps_next->bound_box_y,
|
||||||
.z = ps_next->bound_box_z,
|
.z = ps_next->bound_box_z,
|
||||||
|
@ -803,26 +794,35 @@ static paint_struct * paint_arrange_structs_helper(paint_struct * ps_next, uint1
|
||||||
if (ps_next->quadrant_flags & PAINT_QUADRANT_FLAG_BIGGER) break;
|
if (ps_next->quadrant_flags & PAINT_QUADRANT_FLAG_BIGGER) break;
|
||||||
if (!(ps_next->quadrant_flags & PAINT_QUADRANT_FLAG_NEXT)) continue;
|
if (!(ps_next->quadrant_flags & PAINT_QUADRANT_FLAG_NEXT)) continue;
|
||||||
|
|
||||||
|
const paint_struct_bound_box currentBBox = {
|
||||||
|
.x = ps_next->bound_box_x,
|
||||||
|
.y = ps_next->bound_box_y,
|
||||||
|
.z = ps_next->bound_box_z,
|
||||||
|
.x_end = ps_next->bound_box_x_end,
|
||||||
|
.y_end = ps_next->bound_box_y_end,
|
||||||
|
.z_end = ps_next->bound_box_z_end
|
||||||
|
};
|
||||||
|
|
||||||
sint32 yes = 0;
|
sint32 yes = 0;
|
||||||
switch (rotation) {
|
switch (rotation) {
|
||||||
case 0:
|
case 0:
|
||||||
if (initialBBox.z_end >= ps_next->bound_box_z && initialBBox.y_end >= ps_next->bound_box_y && initialBBox.x_end >= ps_next->bound_box_x
|
if (initialBBox.z_end >= currentBBox.z && initialBBox.y_end >= currentBBox.y && initialBBox.x_end >= currentBBox.x
|
||||||
&& !(initialBBox.z < ps_next->bound_box_z_end && initialBBox.y < ps_next->bound_box_y_end && initialBBox.x < ps_next->bound_box_x_end))
|
&& !(initialBBox.z < currentBBox.z_end && initialBBox.y < currentBBox.y_end && initialBBox.x < currentBBox.x_end))
|
||||||
yes = 1;
|
yes = 1;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (initialBBox.z_end >= ps_next->bound_box_z && initialBBox.y_end >= ps_next->bound_box_y && initialBBox.x_end < ps_next->bound_box_x
|
if (initialBBox.z_end >= currentBBox.z && initialBBox.y_end >= currentBBox.y && initialBBox.x_end < currentBBox.x
|
||||||
&& !(initialBBox.z < ps_next->bound_box_z_end && initialBBox.y < ps_next->bound_box_y_end && initialBBox.x >= ps_next->bound_box_x_end))
|
&& !(initialBBox.z < currentBBox.z_end && initialBBox.y < currentBBox.y_end && initialBBox.x >= currentBBox.x_end))
|
||||||
yes = 1;
|
yes = 1;
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (initialBBox.z_end >= ps_next->bound_box_z && initialBBox.y_end < ps_next->bound_box_y && initialBBox.x_end < ps_next->bound_box_x
|
if (initialBBox.z_end >= currentBBox.z && initialBBox.y_end < currentBBox.y && initialBBox.x_end < currentBBox.x
|
||||||
&& !(initialBBox.z < ps_next->bound_box_z_end && initialBBox.y >= ps_next->bound_box_y_end && initialBBox.x >= ps_next->bound_box_x_end))
|
&& !(initialBBox.z < currentBBox.z_end && initialBBox.y >= currentBBox.y_end && initialBBox.x >= currentBBox.x_end))
|
||||||
yes = 1;
|
yes = 1;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (initialBBox.z_end >= ps_next->bound_box_z && initialBBox.y_end < ps_next->bound_box_y && initialBBox.x_end >= ps_next->bound_box_x
|
if (initialBBox.z_end >= currentBBox.z && initialBBox.y_end < currentBBox.y && initialBBox.x_end >= currentBBox.x
|
||||||
&& !(initialBBox.z < ps_next->bound_box_z_end && initialBBox.y >= ps_next->bound_box_y_end && initialBBox.x < ps_next->bound_box_x_end))
|
&& !(initialBBox.z < currentBBox.z_end && initialBBox.y >= currentBBox.y_end && initialBBox.x < currentBBox.x_end))
|
||||||
yes = 1;
|
yes = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ assert_struct_size(paint_string_struct, 0x1e);
|
||||||
#endif
|
#endif
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
union paint_entry{
|
union paint_entry {
|
||||||
paint_struct basic;
|
paint_struct basic;
|
||||||
attached_paint_struct attached;
|
attached_paint_struct attached;
|
||||||
paint_string_struct string;
|
paint_string_struct string;
|
||||||
|
@ -120,6 +120,15 @@ typedef struct sprite_bb {
|
||||||
rct_xyz16 bb_size;
|
rct_xyz16 bb_size;
|
||||||
} sprite_bb;
|
} sprite_bb;
|
||||||
|
|
||||||
|
typedef struct paint_struct_bound_box {
|
||||||
|
uint16 x;
|
||||||
|
uint16 y;
|
||||||
|
uint16 z;
|
||||||
|
uint16 x_end;
|
||||||
|
uint16 y_end;
|
||||||
|
uint16 z_end;
|
||||||
|
} paint_struct_bound_box;
|
||||||
|
|
||||||
enum PAINT_STRUCT_FLAGS {
|
enum PAINT_STRUCT_FLAGS {
|
||||||
PAINT_STRUCT_FLAG_IS_MASKED = (1 << 0)
|
PAINT_STRUCT_FLAG_IS_MASKED = (1 << 0)
|
||||||
};
|
};
|
||||||
|
@ -220,6 +229,7 @@ void paint_floating_money_effect(money32 amount, rct_string_id string_id, sint16
|
||||||
void paint_init(rct_drawpixelinfo * dpi);
|
void paint_init(rct_drawpixelinfo * dpi);
|
||||||
void paint_generate_structs(rct_drawpixelinfo * dpi);
|
void paint_generate_structs(rct_drawpixelinfo * dpi);
|
||||||
paint_struct paint_arrange_structs();
|
paint_struct paint_arrange_structs();
|
||||||
|
paint_struct * paint_arrange_structs_helper(paint_struct * ps_next, uint16 quadrantIndex, uint8 flag);
|
||||||
void paint_draw_structs(rct_drawpixelinfo * dpi, paint_struct * ps, uint32 viewFlags);
|
void paint_draw_structs(rct_drawpixelinfo * dpi, paint_struct * ps, uint32 viewFlags);
|
||||||
void paint_draw_money_structs(rct_drawpixelinfo * dpi, paint_string_struct * ps);
|
void paint_draw_money_structs(rct_drawpixelinfo * dpi, paint_string_struct * ps);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue