Added move version (...)se_move_rect_1_tile_vert(), switched to use it in down pop-out animations, updated copy version, and removed my POP_MENU_ANIM_RECT UP/DOWN hack
This commit is contained in:
@@ -72,6 +72,13 @@ void main_bg_se_clear_rect(Rect se_rect);
|
||||
*/
|
||||
void main_bg_se_copy_rect_1_tile_vert(Rect se_rect, int direction);
|
||||
|
||||
/* Moves a rect in the main background vertically in direction by a single tile.
|
||||
* Note that tiles in the previous location will be transparent (0x000)
|
||||
* direction must be either SE_UP or SE_DOWN.
|
||||
* se_rect dimensions are in number of tiles.
|
||||
*/
|
||||
void main_bg_se_move_rect_1_tile_vert(Rect se_rect, int direction);
|
||||
|
||||
/* Copies the rect in rect_from into rect_to.
|
||||
* Notice there may be overlaps and overwrites due to them.
|
||||
* Both ects must be the same size
|
||||
|
||||
+11
-12
@@ -120,15 +120,12 @@ static const Rect ROUND_END_MENU_RECT = {9, 7, 24, 21 };
|
||||
//static const Rect POP_MENU_ANIM_RECT_SRC = {9, 19, 24, 31 };
|
||||
//static const Rect POP_MENU_ANIM_RECT_DEST = {9, 7, 24, 19 };
|
||||
|
||||
static const Rect POP_MENU_ANIM_RECT_DOWN = {9, 6, 24, 31 };
|
||||
static const Rect POP_MENU_ANIM_RECT_UP = {9, 7, 24, 31 };
|
||||
// The rects for popping menu animations (round end, shop, blinds)
|
||||
static const Rect POP_MENU_ANIM_RECT = {9, 7, 24, 31 };
|
||||
// The rect for popping menu animations (round end, shop, blinds)
|
||||
// - extends beyond the visible screen to the end of the screenblock
|
||||
// It includes both the target and source position rects.
|
||||
// This is because when popping, the target position is blank so we just animate
|
||||
// the whole rect so we don't have to track its position
|
||||
//
|
||||
// In the down version we include another row above the menu assuming it's blank so it's copied into it
|
||||
|
||||
static const Rect SINGLE_BLIND_SELECT_RECT = {9, 7, 13, 31 };
|
||||
|
||||
@@ -430,7 +427,7 @@ void change_background(int id)
|
||||
|
||||
for (int i = 0; i <= 2; i++)
|
||||
{
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_UP, SE_DOWN);
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT, SE_DOWN);
|
||||
}
|
||||
|
||||
tte_erase_rect_wrapper(HAND_SIZE_RECT_SELECT);
|
||||
@@ -1949,7 +1946,7 @@ void game_round_end() // Writing this kind a made me want to kms. If somewone wa
|
||||
case 8: // Shift the round end panel back out of view and go to the next state
|
||||
{
|
||||
sequence_step++;
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_DOWN, SE_DOWN);
|
||||
main_bg_se_move_rect_1_tile_vert(POP_MENU_ANIM_RECT, SE_DOWN);
|
||||
|
||||
if (sequence_step >= 20)
|
||||
{
|
||||
@@ -2013,7 +2010,7 @@ void game_shop()
|
||||
{
|
||||
case 0: // Intro sequence (menu and shop icon coming into frame)
|
||||
{
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_UP, SE_UP);
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT, SE_UP);
|
||||
|
||||
if (timer >= 7) // Shift the shop icon
|
||||
{
|
||||
@@ -2112,7 +2109,7 @@ void game_shop()
|
||||
case 2: // Outro sequence (menu and shop icon going out of frame)
|
||||
{
|
||||
// Shift the shop panel
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_DOWN, SE_DOWN);
|
||||
main_bg_se_move_rect_1_tile_vert(POP_MENU_ANIM_RECT, SE_DOWN);
|
||||
|
||||
main_bg_se_copy_rect_1_tile_vert(TOP_LEFT_PANEL_ANIM_RECT, SE_UP);
|
||||
|
||||
@@ -2167,7 +2164,7 @@ void game_blind_select()
|
||||
{
|
||||
case 0: // Intro sequence (menu coming into frame)
|
||||
{
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_UP, SE_UP);
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT, SE_UP);
|
||||
|
||||
for (int i = 0; i < MAX_BLINDS; i++)
|
||||
{
|
||||
@@ -2209,7 +2206,7 @@ void game_blind_select()
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
{
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_UP, SE_UP);
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT, SE_UP);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_BLINDS; i++)
|
||||
@@ -2238,7 +2235,9 @@ void game_blind_select()
|
||||
{
|
||||
if (timer < 15)
|
||||
{
|
||||
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT_DOWN, SE_DOWN);
|
||||
Rect blinds_rect = POP_MENU_ANIM_RECT;
|
||||
blinds_rect.top -= 1; // Because of the raised blind
|
||||
main_bg_se_move_rect_1_tile_vert(blinds_rect, SE_DOWN);
|
||||
|
||||
for (int i = 0; i < MAX_BLINDS; i++)
|
||||
{
|
||||
|
||||
+29
-8
@@ -4,9 +4,10 @@
|
||||
|
||||
#include "graphic_utils.h"
|
||||
|
||||
const Rect FULL_SCREENBLOCK_RECT = { 0, 0, SE_ROW_LEN, SE_COL_LEN }; // TODO: LEN - 1 ...
|
||||
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,12 +18,20 @@ 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);
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
@@ -37,6 +46,8 @@ void main_bg_se_clear_rect(Rect se_rect)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void main_bg_se_copy_rect_1_tile_vert(Rect se_rect, int direction)
|
||||
{
|
||||
if (se_rect.left > se_rect.right
|
||||
@@ -46,10 +57,7 @@ void main_bg_se_copy_rect_1_tile_vert(Rect se_rect, int direction)
|
||||
}
|
||||
|
||||
// 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,11 +68,24 @@ void main_bg_se_copy_rect_1_tile_vert(Rect se_rect, int direction)
|
||||
&se_mem[MAIN_BG_SBB][se_rect.left + SE_ROW_LEN * y],
|
||||
rect_width(&se_rect));
|
||||
}
|
||||
}
|
||||
|
||||
if (direction == SE_DOWN)
|
||||
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))
|
||||
{
|
||||
memset16(&se_mem[MAIN_BG_SBB][se_rect.left + SE_ROW_LEN * (end)], 0x0000, rect_width(&se_rect)); // This clears the top row when going down, or the bottom row when going up.
|
||||
return;
|
||||
}
|
||||
|
||||
// Clip to avoid read/write overflow of the screenblock
|
||||
clip_se_rect_within_step_of_full_screen_vert(&se_rect);
|
||||
|
||||
int end = (direction == SE_UP) ? se_rect.bottom : se_rect.top;
|
||||
|
||||
main_bg_se_copy_rect_1_tile_vert(se_rect, direction);
|
||||
|
||||
memset16(&se_mem[MAIN_BG_SBB][se_rect.left + SE_ROW_LEN * (end)], 0x0000, rect_width(&se_rect));
|
||||
}
|
||||
|
||||
void main_bg_se_copy_rect(Rect rect_to, Rect rect_from)
|
||||
|
||||
Reference in New Issue
Block a user