temporary overwrite of previous merge. I've been working on this for 10 hours today and really do not have the patience to resolve the conflicts right now. I'll do it later 😭
This commit is contained in:
+25
-7
@@ -7,6 +7,7 @@
|
||||
const Rect FULL_SCREENBLOCK_RECT = { 0, 0, SE_ROW_LEN, SE_COL_LEN };
|
||||
|
||||
// Clips a rect of screenblock entries to a specified rect
|
||||
// The bounding rect is not required to be within screenblock boundaries
|
||||
static void clip_se_rect_to_bounding_rect(Rect* rect, const Rect* bounding_rect)
|
||||
{
|
||||
rect->right = min(rect->right, bounding_rect->right);
|
||||
@@ -17,7 +18,6 @@ static void clip_se_rect_to_bounding_rect(Rect* rect, const Rect* bounding_rect)
|
||||
|
||||
// Can be unstaticed if needed
|
||||
// Clips a rect of screenblock entries to screenblock boundaries
|
||||
// The bounding rect is not required to be within screenblock boundaries
|
||||
static void clip_se_rect_to_screenblock(Rect* rect)
|
||||
{
|
||||
clip_se_rect_to_bounding_rect(rect, &FULL_SCREENBLOCK_RECT);
|
||||
@@ -28,6 +28,16 @@ u16 main_bg_se_get_tile(int x, int y)
|
||||
return se_mem[MAIN_BG_SBB][x + SE_ROW_LEN * y];
|
||||
}
|
||||
|
||||
// Clips a rect of screenblock entries to be within one step of
|
||||
// screenblock boundaries vertically (1 step from top, 1 step from bottom.
|
||||
static void clip_se_rect_within_step_of_full_screen_vert(Rect* se_rect)
|
||||
{
|
||||
Rect bounding_rect = FULL_SCREENBLOCK_RECT;
|
||||
bounding_rect.top += 1;
|
||||
bounding_rect.bottom -= -1;
|
||||
clip_se_rect_to_bounding_rect(se_rect, &bounding_rect);
|
||||
}
|
||||
|
||||
void main_bg_se_clear_rect(Rect se_rect)
|
||||
{
|
||||
if (se_rect.left > se_rect.right)
|
||||
@@ -37,7 +47,7 @@ void main_bg_se_clear_rect(Rect se_rect)
|
||||
|
||||
for (int y = se_rect.top; y < se_rect.bottom; y++)
|
||||
{
|
||||
memset16(&(se_mem[MAIN_BG_SBB][se_rect.left + SE_ROW_LEN * y]), 0x0000, se_rect.right - se_rect.left + 1);
|
||||
memset16(&(se_mem[MAIN_BG_SBB][se_rect.left + SE_ROW_LEN * y]), 0x0000, rect_width(&se_rect));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,13 +55,12 @@ void main_bg_se_copy_rect_1_tile_vert(Rect se_rect, int direction)
|
||||
{
|
||||
if (se_rect.left > se_rect.right
|
||||
|| (direction != SE_UP && direction != SE_DOWN))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Clip to avoid read/write overflow of the screenblock
|
||||
Rect bounding_rect = FULL_SCREENBLOCK_RECT;
|
||||
bounding_rect.top = 1;
|
||||
bounding_rect.bottom = SE_COL_LEN - 1;
|
||||
clip_se_rect_to_bounding_rect(&se_rect, &bounding_rect);
|
||||
clip_se_rect_within_step_of_full_screen_vert(&se_rect);
|
||||
|
||||
int start = (direction == SE_UP) ? se_rect.top : se_rect.bottom;
|
||||
int end = (direction == SE_UP) ? se_rect.bottom : se_rect.top;
|
||||
@@ -60,7 +69,16 @@ void main_bg_se_copy_rect_1_tile_vert(Rect se_rect, int direction)
|
||||
{
|
||||
memcpy16(&se_mem[MAIN_BG_SBB][se_rect.left + SE_ROW_LEN * (y + direction)],
|
||||
&se_mem[MAIN_BG_SBB][se_rect.left + SE_ROW_LEN * y],
|
||||
se_rect.right - se_rect.left + 1);
|
||||
rect_width(&se_rect));
|
||||
}
|
||||
}
|
||||
|
||||
void main_bg_se_move_rect_1_tile_vert(Rect se_rect, int direction)
|
||||
{
|
||||
if (se_rect.left > se_rect.right
|
||||
|| (direction != SE_UP && direction != SE_DOWN))
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user