Merge branch 'main' of https://github.com/cellos51/balatro-gba into jokers

This commit is contained in:
cellos51
2025-07-22 20:00:15 -04:00
+9 -9
View File
@@ -26,7 +26,7 @@ static void clip_se_rect_to_screenblock(Rect* rect)
u16 main_bg_se_get_tile(BG_POINT pos) u16 main_bg_se_get_tile(BG_POINT pos)
{ {
return se_mem[MAIN_BG_SBB][pos.x + SE_ROW_LEN * pos.y]; return se_mat[MAIN_BG_SBB][pos.y][pos.x];
} }
// Clips a rect of screenblock entries to be within one step of // Clips a rect of screenblock entries to be within one step of
@@ -55,7 +55,7 @@ void main_bg_se_clear_rect(Rect se_rect)
for (int y = se_rect.top; y < se_rect.bottom; y++) 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, rect_width(&se_rect)); memset16(&(se_mat[MAIN_BG_SBB][y][se_rect.left]), 0x0000, rect_width(&se_rect));
} }
} }
@@ -77,14 +77,14 @@ static void main_bg_se_copy_or_move_rect_1_tile_vert(Rect se_rect, int direction
for (int y = start; y != end - direction; y -= direction) for (int y = start; y != end - direction; y -= direction)
{ {
memcpy16(&se_mem[MAIN_BG_SBB][se_rect.left + SE_ROW_LEN * (y + direction)], memcpy16(&(se_mat[MAIN_BG_SBB][y + direction][se_rect.left]),
&se_mem[MAIN_BG_SBB][se_rect.left + SE_ROW_LEN * y], &se_mat[MAIN_BG_SBB][y][se_rect.left],
rect_width(&se_rect)); rect_width(&se_rect));
} }
if (move) if (move)
{ {
memset16(&se_mem[MAIN_BG_SBB][se_rect.left + SE_ROW_LEN * (end)], 0x0000, rect_width(&se_rect)); memset16(&se_mat[MAIN_BG_SBB][end][se_rect.left], 0x0000, rect_width(&se_rect));
} }
} }
@@ -124,7 +124,7 @@ void main_bg_se_copy_rect(Rect se_rect, BG_POINT pos)
for (int sy = 0; sy < height; sy++) for (int sy = 0; sy < height; sy++)
{ {
memcpy16(&se_mem[MAIN_BG_SBB][pos.x + SE_ROW_LEN * (pos.y + sy)], memcpy16(&se_mat[MAIN_BG_SBB][pos.y + sy][pos.x],
&tile_map[sy][0], &tile_map[sy][0],
width); width);
} }
@@ -143,7 +143,7 @@ void main_bg_se_copy_tile_to_rect(u16 tile, Rect se_rect)
for (int sy = 0; sy < height; sy++) for (int sy = 0; sy < height; sy++)
{ {
memset16(&se_mem[MAIN_BG_SBB][se_rect.left + SE_ROW_LEN * (se_rect.top + sy)], tile, width); memset16(&se_mat[MAIN_BG_SBB][se_rect.top + sy][se_rect.left], tile, width);
} }
} }
@@ -155,11 +155,11 @@ void tte_erase_rect_wrapper(Rect rect)
void update_text_rect_to_right_align_num(Rect* rect, int num, int overflow_direction) void update_text_rect_to_right_align_num(Rect* rect, int num, int overflow_direction)
{ {
int num_digits = get_digits(num); int num_digits = get_digits(num);
if (overflow_direction == OVERFLOW_RIGHT) if (overflow_direction == OVERFLOW_LEFT)
{ {
rect->left = max(0, rect->right - num_digits * TILE_SIZE); rect->left = max(0, rect->right - num_digits * TILE_SIZE);
} }
else if (overflow_direction == OVERFLOW_LEFT) else if (overflow_direction == OVERFLOW_RIGHT)
{ {
int num_fitting_digits = rect_width(rect) / TILE_SIZE; int num_fitting_digits = rect_width(rect) / TILE_SIZE;
if (num_digits < num_fitting_digits) if (num_digits < num_fitting_digits)