The bat can inflict chicken TF

This commit is contained in:
2024-02-29 14:31:44 -08:00
parent 0a3a8cb8ab
commit 6c25396d4b
13 changed files with 308 additions and 58 deletions

View File

@ -167,6 +167,7 @@ void sys_oval_draw_ext(
if (x0 == x1 || y0 == y1) { return; }
if (x0 > x1) { sys_i32 tmp = x0; x0 = x1; x1 = tmp; }
if (y0 > y1) { sys_i32 tmp = y0; y0 = y1; y1 = tmp; }
// TODO: Offset by 1px so that x0/y0 is always included?
// alois' algorithm for this implies the bounds are inclusive
x1 -= 1; y1 -= 1;
@ -235,6 +236,43 @@ void sys_line_draw(
}
}
void sys_rect_draw(
sys_i32 x0, sys_i32 y0, sys_i32 x1, sys_i32 y1, sys_color c
) {
sys_rect_draw_ext(x0, y0, x1, y1, c, false);
}
void sys_rect_fill(
sys_i32 x0, sys_i32 y0, sys_i32 x1, sys_i32 y1, sys_color c
) {
sys_rect_draw_ext(x0, y0, x1, y1, c, true);
}
void sys_rect_draw_ext(
sys_i32 x0, sys_i32 y0, sys_i32 x1, sys_i32 y1, sys_color c, bool fill
) {
x0 += sys_cam_dx;
y0 += sys_cam_dy;
x1 += sys_cam_dx;
y1 += sys_cam_dy;
assert(sys_get_initialized());
if (x0 == x1 || y0 == y1) { return; }
if (x0 == x1 || y0 == y1) { return; }
if (x0 > x1) { sys_i32 tmp = x0; x0 = x1; x1 = tmp; }
if (y0 > y1) { sys_i32 tmp = y0; y0 = y1; y1 = tmp; }
// TODO: Offset by 1px so that x0/y0 is always included?
for (sys_i32 y = y0; y < y1; y++) {
bool whole_line = y == y0 || y == y1;
sys_scanline_internal_set(
x0, x1, y, c, whole_line || fill
);
}
}
void sys_spal_set(sys_color c0, sys_screen_color rc1) {
assert(sys_get_initialized());