5#include "background_blind_select_gfx.h"
25static const u8 BLIND_SELECT_BTN_MAIN_COLOR_PAL_IDX = 22;
26static const u8 BLIND_SELECT_BTN_OUTLINE_COLOR_PAL_IDX = 34;
28static const u8 BLIND_SKIP_BTN_MAIN_COLOR_PAL_IDX = 19;
29static const u8 BLIND_SKIP_BTN_OUTLINE_COLOR_PAL_IDX = 35;
31static const u8 BOSS_BLIND_PANEL_OUTLINE_PAL_IDX = 32;
32static const u8 BOSS_BLIND_PANEL_SHADOW_PAL_IDX = 33;
34static const u32 TM_DISP_BLIND_PANEL_FINISH = 7;
35static const u32 TM_DISP_BLIND_PANEL_START = 1;
36static const u32 TM_BOSS_BLIND_REROLL_DURATION = 13;
40static void blind_select_start_anim_seq(
void);
41static void blind_select_start_anim_seq_reposition_tag_sprites(
void);
42static void blind_select_handle_input(
void);
43static void blind_select_handle_immediate_tags_on_init(
void);
44static void blind_select_handle_immediate_tags_on_update(
void);
45static void blind_select_reroll_boss_anim_seq_on_init(
void);
46static void blind_select_reroll_boss_anim_seq_on_update(
void);
47static void blind_select_reroll_boss_anim_seq_on_exit(
void);
48static void blind_select_selected_anim_seq_on_init(
void);
49static void blind_select_selected_anim_seq_on_update(
void);
50static void blind_select_selected_anim_seq_on_exit(
void);
51static void blind_select_display_blind_panel(
void);
52static void blind_select_exit(
void);
53static Rect blind_select_get_req_score_rect(
enum BlindTokens blind);
54static void blind_select_print_blinds_reqs_and_rewards(
void);
56static void blind_tokens_init(
void);
57static void blind_skip_tags_init(
void);
65 BLIND_SELECTED_ANIM_SEQ,
73 [START_ANIM_SEQ] = STATE_INFO_UPDATE_FN_ONLY(blind_select_start_anim_seq),
74 [BLIND_SELECT] = STATE_INFO_UPDATE_FN_ONLY(blind_select_handle_input),
75 [APPLY_BLIND_TAGS] = STATE_INFO_INIT_UPDATE_FN(
76 blind_select_handle_immediate_tags_on_init,
77 blind_select_handle_immediate_tags_on_update),
78 [REROLL_BOSS_ANIM_SEQ] = STATE_INFO_ALL_FN(
79 blind_select_reroll_boss_anim_seq_on_init,
80 blind_select_reroll_boss_anim_seq_on_update,
81 blind_select_reroll_boss_anim_seq_on_exit),
82 [BLIND_SELECTED_ANIM_SEQ] = STATE_INFO_ALL_FN(
83 blind_select_selected_anim_seq_on_init,
84 blind_select_selected_anim_seq_on_update,
85 blind_select_selected_anim_seq_on_exit),
86 [DISPLAY_BLIND_PANEL] = STATE_INFO_UPDATE_FN_ONLY(blind_select_display_blind_panel),
87 [BLIND_SELECT_EXIT] = STATE_INFO_UPDATE_FN_ONLY(blind_select_exit),
91static StateMachine blind_select_sm = STATE_MACHINE_DEFINE(state_info, BLIND_SELECT_MAX);
95static const BG_POINT TOP_LEFT_PANEL_EMPTY_3W_ROW_POS = {29, 31};
96static const BG_POINT SMALL_BLIND_SKIP_TAG_INIT_POS = {75, 170};
97static const BG_POINT BIG_BLIND_SKIP_TAG_INIT_POS = {115, 170};
98static const BG_POINT SMALL_BLIND_SKIP_TAG_HIGH_POS = {75, 132};
99static const BG_POINT SMALL_BLIND_SKIP_TAG_LOW_POS = {75, 140};
100static const BG_POINT BIG_BLIND_SKIP_TAG_HIGH_POS = {115, 132};
101static const BG_POINT BIG_BLIND_SKIP_TAG_LOW_POS = {115, 140};
103static const Rect BLIND_SKIP_BTN_GRAY_RECT = {0, 24, 4, 27};
104static const Rect BLIND_SKIP_BTN_PREANIM_DEST_RECT = {9, 29, 19, 31};
105static const Rect SINGLE_BLIND_SEL_REQ_SCORE_RECT = {80, 120, 104, 128};
106static const Rect SINGLE_BLIND_SELECT_RECT = {9, 7, 13, 31};
107static const Rect BOSS_BLIND_PANEL_MOVE_DOWN_RECT = {19, 6, 24, 31};
108static const Rect BOSS_BLIND_PANEL_MOVE_UP_RECT = {19, 7, 24, 31};
109static const Rect BOSS_BLIND_REROLL_DUP_LINE_RECT = {19, 30, 24, 30};
112static const u32 TM_END_ANIM_SEQ = 12;
113static const u32 TM_SKIP_TAGS_ANIM_SEQ = 6;
115static const u32 BLIND_LEFT_X = 80;
116static const u32 BLIND_CENTER_X = 120;
117static const u32 BLIND_RIGHT_X = 160;
126static int blind_select_get_selection_row_size(
void);
127static void blind_select_row_on_key_transit(
SelectionGrid* selection_grid, Selection* selection);
128static bool blind_select_row_on_selection_changed(
131 const Selection* prev_selection,
132 const Selection* new_selection
139 blind_select_get_selection_row_size,
140 blind_select_row_on_selection_changed,
141 blind_select_row_on_key_transit,
146 blind_select_get_selection_row_size,
147 blind_select_row_on_selection_changed,
148 blind_select_row_on_key_transit,
154static const Selection BLIND_SELECT_INIT_SEL = {0, BLIND_ROW};
156 blind_select_selection_rows,
158 BLIND_SELECT_INIT_SEL
161static void select_on_pressed(
void);
162static void skip_on_pressed(
void);
164static Button blind_select_buttons[] = {
165 {BLIND_SELECT_BTN_OUTLINE_COLOR_PAL_IDX, BLIND_SELECT_BTN_MAIN_COLOR_PAL_IDX, select_on_pressed, NULL},
166 {BLIND_SKIP_BTN_OUTLINE_COLOR_PAL_IDX, BLIND_SKIP_BTN_MAIN_COLOR_PAL_IDX, skip_on_pressed, NULL}
169static Sprite* blind_select_tokens[NUM_BLINDS_PER_ANTE] = {NULL};
170static SkipTag* blind_skip_tags[NB_SKIPPABLE_BLINDS] = {NULL};
172static void blind_select_start_anim_seq()
176 for (
int i = 0; i < NUM_BLINDS_PER_ANTE; i++)
179 blind_select_tokens[i],
180 blind_select_tokens[i]->pos.x,
181 blind_select_tokens[i]->pos.y -
TILE_SIZE
185 if (s_timer == TM_SKIP_TAGS_ANIM_SEQ)
187 blind_select_start_anim_seq_reposition_tag_sprites();
190 if (s_timer == TM_END_ANIM_SEQ)
192 blind_select_print_blinds_reqs_and_rewards();
198static void blind_select_start_anim_seq_reposition_tag_sprites(
void)
202 static const BG_POINT tag_sprites_target_positions[NB_SKIPPABLE_BLINDS][NB_SKIPPABLE_BLINDS] = {
203 {SMALL_BLIND_SKIP_TAG_LOW_POS, SMALL_BLIND_SKIP_TAG_HIGH_POS},
204 {BIG_BLIND_SKIP_TAG_LOW_POS, BIG_BLIND_SKIP_TAG_HIGH_POS }
207 for (
int i = 0; i < NB_SKIPPABLE_BLINDS; i++)
209 if (blind_skip_tags[i] != NULL)
213 tag_sprites_target_positions[i][g_game_vars.current_blind == (
enum BlindType)i]
219static inline void blind_select_erase_blind_req_and_reward(
enum BlindTokens blind)
221 Rect blind_req_and_reward_rect = SINGLE_BLIND_SEL_REQ_SCORE_RECT;
224 blind_req_and_reward_rect.top -=
TILE_SIZE;
225 blind_req_and_reward_rect.bottom +=
TILE_SIZE;
228 blind_req_and_reward_rect.right +=
TILE_SIZE;
232 blind_req_and_reward_rect.left += score_rect_x_offset;
233 blind_req_and_reward_rect.right += score_rect_x_offset;
238static inline void blind_select_erase_all_blind_reqs_and_rewards(
void)
240 for (
enum BlindTokens curr_blind = SMALL_BLIND; curr_blind < NUM_BLINDS_PER_ANTE; curr_blind++)
242 blind_select_erase_blind_req_and_reward(curr_blind);
246void increment_blind(
enum BlindState increment_reason)
248 switch (g_game_vars.current_blind)
251 case BLIND_TYPE_SMALL:
252 g_game_vars.current_blind = BLIND_TYPE_BIG;
253 g_game_vars.blinds_states[SMALL_BLIND] = increment_reason;
254 g_game_vars.blinds_states[BIG_BLIND] = BLIND_STATE_CURRENT;
258 g_game_vars.current_blind = g_game_vars.next_boss_blind;
259 g_game_vars.blinds_states[BIG_BLIND] = increment_reason;
260 g_game_vars.blinds_states[BOSS_BLIND] = BLIND_STATE_CURRENT;
264 g_game_vars.current_blind = BLIND_TYPE_SMALL;
265 g_game_vars.blinds_states[SMALL_BLIND] = BLIND_STATE_CURRENT;
266 g_game_vars.blinds_states[BIG_BLIND] = BLIND_STATE_UPCOMING;
267 g_game_vars.blinds_states[BOSS_BLIND] = BLIND_STATE_UPCOMING;
272static void blind_select_handle_input(
void)
277static int blind_select_get_selection_row_size(
void)
282static void blind_select_row_on_key_transit(
SelectionGrid* selection_grid, Selection* selection)
284 if (key_hit(SELECT_CARD))
290static bool blind_select_row_on_selection_changed(
293 const Selection* prev_selection,
294 const Selection* new_selection
297 if (g_game_vars.current_blind >= BLIND_TYPE_BOSS && new_selection->y == SKIP_ROW)
300 if (prev_selection->y == row_idx)
303 if (new_selection->y == row_idx)
309static void select_on_pressed(
void)
311 blind_select_erase_all_blind_reqs_and_rewards();
320static void skip_on_pressed(
void)
322 blind_select_erase_all_blind_reqs_and_rewards();
324 g_game_vars.nb_skipped_rounds++;
325 add_skip_tag(&blind_skip_tags[g_game_vars.current_blind]);
326 if (blind_skip_tags[BLIND_TYPE_BIG])
327 blind_skip_tags[BLIND_TYPE_BIG]->ty -= int2fx(
TILE_SIZE);
329 increment_blind(BLIND_STATE_SKIPPED);
335 for (
int i = 0; i < 12; i++)
340 for (
int i = 0; i < NUM_BLINDS_PER_ANTE; i++)
343 blind_select_tokens[i],
344 blind_select_tokens[i]->pos.x,
345 blind_select_tokens[i]->pos.y - (
TILE_SIZE * 12)
349 blind_select_print_blinds_reqs_and_rewards();
357static void blind_select_handle_immediate_tags_on_init(
void)
362static void blind_select_handle_immediate_tags_on_update(
void)
381static inline void reroll_boss_blind(
void)
384 g_game_vars.next_boss_blind =
385 roll_blind_type((g_game_vars.ante % MAX_ANTE == 0) && (g_game_vars.ante > 0));
387 if (g_game_vars.current_blind >= BLIND_TYPE_BOSS)
389 g_game_vars.current_blind = g_game_vars.next_boss_blind;
393static void blind_select_reroll_boss_anim_seq_on_init(
void)
399 blind_select_erase_blind_req_and_reward(BOSS_BLIND);
402static inline void blind_select_move_boss_blind_panel(
enum ScreenVertDir dir)
405 dir == SCREEN_DOWN ? BOSS_BLIND_PANEL_MOVE_DOWN_RECT : BOSS_BLIND_PANEL_MOVE_UP_RECT,
409 blind_select_tokens[BOSS_BLIND],
410 blind_select_tokens[BOSS_BLIND]->pos.x,
411 blind_select_tokens[BOSS_BLIND]->pos.y + dir *
TILE_SIZE
415static inline void blind_select_reroll_boss_anim_do_reroll(
void)
419 pal_bg_mem[BOSS_BLIND_PANEL_OUTLINE_PAL_IDX] =
420 blind_get_color(g_game_vars.next_boss_blind, BLIND_BACKGROUND_MAIN_COLOR_INDEX);
421 pal_bg_mem[BOSS_BLIND_PANEL_SHADOW_PAL_IDX] =
422 blind_get_color(g_game_vars.next_boss_blind, BLIND_BACKGROUND_SHADOW_COLOR_INDEX);
425static void blind_select_reroll_boss_anim_seq_on_update(
void)
428 bool is_boss_selected = g_game_vars.current_blind >= BLIND_TYPE_BOSS;
429 int panel_move_duration = TM_BOSS_BLIND_REROLL_DURATION + (int)is_boss_selected;
431 if (s_timer < panel_move_duration)
432 blind_select_move_boss_blind_panel(SCREEN_DOWN);
435 else if (s_timer == MENU_POP_OUT_ANIM_FRAMES)
436 blind_select_reroll_boss_anim_do_reroll();
439 else if (s_timer > MENU_POP_OUT_ANIM_FRAMES &&
440 s_timer < (MENU_POP_OUT_ANIM_FRAMES + panel_move_duration))
442 blind_select_move_boss_blind_panel(SCREEN_UP);
446 if (s_timer == (MENU_POP_OUT_ANIM_FRAMES + 1) && is_boss_selected)
454 else if (s_timer >= (MENU_POP_OUT_ANIM_FRAMES + panel_move_duration))
461static void blind_select_reroll_boss_anim_seq_on_exit(
void)
464 blind_select_print_blinds_reqs_and_rewards();
467static void blind_select_selected_anim_seq_on_init(
void)
469 if (blind_skip_tags[0] != NULL)
473 if (blind_skip_tags[1] != NULL)
479static void blind_select_selected_anim_seq_on_update(
void)
483 Rect blinds_rect = POP_MENU_ANIM_RECT;
484 blinds_rect.top -= 1;
487 for (
int i = 0; i < NUM_BLINDS_PER_ANTE; i++)
490 blind_select_tokens[i],
491 blind_select_tokens[i]->pos.x,
492 blind_select_tokens[i]->pos.y +
TILE_SIZE
496 else if (s_timer >= MENU_POP_OUT_ANIM_FRAMES)
498 for (
int i = 0; i < NUM_BLINDS_PER_ANTE; i++)
508static void blind_select_selected_anim_seq_on_exit(
void)
510 for (
int i = 0; i < NUM_BLINDS_PER_ANTE; i++)
517 if (g_game_vars.current_blind <= BLIND_TYPE_BIG)
523static void blind_select_display_blind_panel()
525 if (s_timer >= TM_DISP_BLIND_PANEL_FINISH)
532 if (s_timer == TM_DISP_BLIND_PANEL_START)
541 if (g_game_vars.current_blind >= BLIND_TYPE_BOSS)
550 for (
int y = 0; y < s_timer; y++)
552 int y_from = 26 + y - s_timer;
555 Rect from = {0, y_from, 8, y_from};
556 BG_POINT to = {0, y_to};
562static void blind_select_exit(
void)
565 game_change_state(GAME_STATE_ROUND);
568static Rect blind_select_get_req_score_rect(
enum BlindTokens blind)
570 Rect blind_req_score_rect = SINGLE_BLIND_SEL_REQ_SCORE_RECT;
573 blind_req_score_rect.left += score_rect_x_offset;
574 blind_req_score_rect.right += score_rect_x_offset;
576 if (g_game_vars.blinds_states[blind] == BLIND_STATE_CURRENT)
580 blind_req_score_rect.bottom -=
TILE_SIZE;
583 return blind_req_score_rect;
592 blind_type = BLIND_TYPE_SMALL;
595 blind_type = BLIND_TYPE_BIG;
598 blind_type = g_game_vars.next_boss_blind;
604static inline void blind_select_print_blind_req(
enum BlindTokens blind)
606 Rect blind_req_score_rect = blind_select_get_req_score_rect(blind);
610 char blind_req_str_buff[UINT_MAX_DIGITS + 1];
620 "#{P:%d,%d; cx:0x%X000}%s",
621 blind_req_score_rect.left,
622 blind_req_score_rect.top,
628static inline void blind_select_print_blind_reward(
enum BlindTokens blind)
631 Rect blind_reward_rect = blind_select_get_req_score_rect(blind);
637 char blind_reward_str_buff[UINT_MAX_DIGITS + 2];
638 snprintf(blind_reward_str_buff,
sizeof(blind_reward_str_buff),
"$%d", blind_reward);
643 "#{P:%d,%d; cx:0x%X000}%s",
644 blind_reward_rect.left,
645 blind_reward_rect.top,
647 blind_reward_str_buff
651static void blind_select_print_blinds_reqs_and_rewards(
void)
653 for (
enum BlindTokens curr_blind = 0; curr_blind < NUM_BLINDS_PER_ANTE; curr_blind++)
655 blind_select_print_blind_req(curr_blind);
656 blind_select_print_blind_reward(curr_blind);
660static void blind_tokens_init()
662 if (g_game_vars.current_blind == BLIND_TYPE_SMALL)
671 CUR_BLIND_TOKEN_POS.x,
672 CUR_BLIND_TOKEN_POS.y,
673 SMALL_BLIND_TOKEN_LAYER
677 CUR_BLIND_TOKEN_POS.x,
678 CUR_BLIND_TOKEN_POS.y,
679 BIG_BLIND_TOKEN_LAYER
682 g_game_vars.next_boss_blind,
683 CUR_BLIND_TOKEN_POS.x,
684 CUR_BLIND_TOKEN_POS.y,
685 BOSS_BLIND_TOKEN_LAYER
688 for (
int i = 0; i < NUM_BLINDS_PER_ANTE; i++)
694static void blind_skip_tags_init(
void)
696 if (g_game_vars.current_blind != BLIND_TYPE_SMALL)
710 SMALL_BLIND_SKIP_TAG_INIT_POS.x,
711 SMALL_BLIND_SKIP_TAG_INIT_POS.y
715 BIG_BLIND_SKIP_TAG_INIT_POS.x,
716 BIG_BLIND_SKIP_TAG_INIT_POS.y
726 blind_select_selection_grid.selection = BLIND_SELECT_INIT_SEL;
730 if (g_game_vars.current_blind == BLIND_TYPE_SMALL)
731 blind_skip_tags_init();
766 for (
int i = 0; i < NUM_BLINDS_PER_ANTE; i++)
773 const int default_y = 89 + (
TILE_SIZE * 12);
775 sprite_position(blind_select_tokens[SMALL_BLIND], BLIND_LEFT_X, default_y);
776 sprite_position(blind_select_tokens[BIG_BLIND], BLIND_CENTER_X, default_y);
777 sprite_position(blind_select_tokens[BOSS_BLIND], BLIND_RIGHT_X, default_y);
781 GRIT_CPY(pal_bg_mem, background_blind_select_gfxPal);
782 GRIT_CPY(&tile_mem[MAIN_BG_CBB], background_blind_select_gfxTiles);
783 GRIT_CPY(&se_mem[MAIN_BG_SBB], background_blind_select_gfxMap);
786 pal_bg_mem[BOSS_BLIND_PANEL_OUTLINE_PAL_IDX] =
787 blind_get_color(g_game_vars.next_boss_blind, BLIND_BACKGROUND_MAIN_COLOR_INDEX);
788 pal_bg_mem[BOSS_BLIND_PANEL_SHADOW_PAL_IDX] =
789 blind_get_color(g_game_vars.next_boss_blind, BLIND_BACKGROUND_SHADOW_COLOR_INDEX);
791 for (
int i = 0; i < NUM_BLINDS_PER_ANTE; i++)
793 Rect curr_blind_rect = SINGLE_BLIND_SELECT_RECT;
796 curr_blind_rect.left += i *
rect_width(&SINGLE_BLIND_SELECT_RECT);
797 curr_blind_rect.right += i *
rect_width(&SINGLE_BLIND_SELECT_RECT);
799 if (g_game_vars.blinds_states[i] != BLIND_STATE_CURRENT &&
800 (i == BLIND_TYPE_SMALL || i == BLIND_TYPE_BIG))
802 BG_POINT skip_blind_btn_pos_dest = {
803 BLIND_SKIP_BTN_PREANIM_DEST_RECT.left,
804 BLIND_SKIP_BTN_PREANIM_DEST_RECT.top
806 skip_blind_btn_pos_dest.x = curr_blind_rect.left;
808 Rect skip_blind_btn_rect_src = BLIND_SKIP_BTN_GRAY_RECT;
809 skip_blind_btn_rect_src.top += i *
rect_height(&BLIND_SKIP_BTN_GRAY_RECT);
810 skip_blind_btn_rect_src.bottom += i *
rect_height(&BLIND_SKIP_BTN_GRAY_RECT);
815 switch (g_game_vars.blinds_states[i])
817 case BLIND_STATE_CURRENT:
825 int x_to = curr_blind_rect.left;
828 if (i == BLIND_TYPE_BIG)
832 else if (i > BLIND_TYPE_BIG)
841 {x_from, y_from, x_from +
rect_width(&SINGLE_BLIND_SELECT_RECT) - 1, y_from};
842 BG_POINT gap_fill_point = {x_to, y_to};
847 blind_select_tokens[i],
848 blind_select_tokens[i]->pos.x,
853 case BLIND_STATE_UPCOMING:
858 int x_to = 10 + (i *
rect_width(&SINGLE_BLIND_SELECT_RECT));
862 &se_mem[MAIN_BG_SBB][x_to + 32 * y_to],
863 &se_mem[MAIN_BG_SBB][x_from + 32 * y_from],
868 case BLIND_STATE_SKIPPED:
873 int x_to = 10 + (i * 5);
877 &se_mem[MAIN_BG_SBB][x_to + 32 * y_to],
878 &se_mem[MAIN_BG_SBB][x_from + 32 * y_from],
883 case BLIND_STATE_DEFEATED:
888 int x_to = 10 + (i * 5);
892 &se_mem[MAIN_BG_SBB][x_to + 32 * y_to],
893 &se_mem[MAIN_BG_SBB][x_from + 32 * y_from],
Utilities for affine background on GBA.
void affine_background_set_color(COLOR color)
Update the affine background color.
Utilities for using maxmod to play sound effects.
#define MM_BASE_PITCH_RATE
The default pitch rate for the sound effect played.
void play_sfx(mm_word id, mm_word rate, mm_byte volume)
Play a sound effect, wrapper for mmEffectEx() See https://maxmod.org/ref/functions/mm_sound_effect....
#define SFX_DEFAULT_VOLUME
Default volume for sound effects.
Data structures and functions relative to the behaviour and graphics of Blinds.
void apply_blind_tiles(enum BlindType type, enum BlindTokenLayers layer)
Change the tiles of the BlindToken Sprite at a given layer to that of the given BlindType.
enum BlindType roll_blind_type(bool showdown)
Choose a random Blind among the ones that haven't been beaten yet.
BlindType
All Blind types in the game are listed here.
BlindState
All the possible states an Ante's Blinds can be in when viewed in the "Blind Select" screen.
u16 blind_get_color(enum BlindType type, enum BlindColorIndex index)
Get the color associated with a given Blind.
u32 blind_get_requirement(enum BlindType type, int ante)
Get the score required to beat a certain blind (either the Small, Big, or any Boss/Showdown blind) at...
BlindTokens
The sprites that display the blinds when in "GAME_BLIND_SELECT" state. There are only 3 blinds per An...
Sprite * blind_token_new(enum BlindType type, int x, int y, enum BlindTokenLayers sprite_index)
Create a new BlindToken sprite.
int blind_get_reward(enum BlindType type)
Get the amount of money gained from beating a certain Blind.
Blind select state functions.
void blind_select_on_update(void)
Blind select state update.
void blind_select_reroll_boss_from_menu(void)
Reroll the Boss Blind from inside the menu. This function is made to be used for both Vouchers and th...
void blind_select_on_exit(void)
Blind select cleanup.
void blind_select_on_init(void)
Blind select state initialization.
void blind_select_change_background(void)
Change to the blind select background.
void change_background(enum BackgroundId id, bool force_redraw)
void reset_top_left_panel_bottom_row(void)
Restores the bottom row of the top-left panel from the background map.
Game global game variables struct definition.
Graphic utility functions.
void main_bg_se_move_rect_1_tile_vert(Rect se_rect, enum ScreenVertDir direction)
Moves a rect in the main background vertically in direction by a single tile.
INLINE int rect_height(const Rect *rect)
Get the height of a rectangle.
void main_bg_se_copy_rect_1_tile_vert(Rect se_rect, enum ScreenVertDir direction)
Copies a rect in the main background vertically in direction by a single tile.
void main_bg_se_copy_rect(Rect se_rect, BG_POINT dest_pos)
Copies a rect in the main background from se_rect to the position (x, y).
void toggle_windows(bool win0, bool win1)
Toggles the visibility of the window layers.
void update_text_rect_to_right_align_str(Rect *rect, const char *str, enum OverflowDir overflow_direction)
Changes rect->left so it fits the digits of num exactly when right aligned to rect->right....
#define TILE_SIZE
Tile size in pixels, both height and width as tiles are square.
#define TTE_CHAR_SIZE
By default TTE characters occupy a single tile.
void tte_erase_rect_wrapper(Rect rect)
A wrapper for tte_erase_rect that would use the rect struct.
void main_bg_se_copy_expand_3w_row(Rect se_dest_rect, BG_POINT src_row_left_pnt)
Copies a 3-width SE rect and expands it to fit a passed rect.
INLINE int rect_width(const Rect *rect)
Get the width of a rectangle.
Header of shared rects and points needed for ui.
An implementation for a selection grid that handles directional selection.
void selection_grid_move_selection_vert(SelectionGrid *selection_grid, int direction_tribool)
Moves the selection vertically within the selection grid.
void selection_grid_process_input(SelectionGrid *selection_grid)
Processes user input for the selection grid.
Data structures and functions related to the handling of Skip Tags.
void skip_tag_process_pause(void)
Suspend the processing of Skip Tags.
void skip_tag_set_sprite(SkipTag *tag, s16 layer)
Set the sprite for the given SkipTag, according to its internal ID.
void skip_tag_destroy(SkipTag **tag)
Destroy the given SkipTag, invalidate it in the corresponding memory pool and set the pointer provide...
SkipTag * roll_skip_tag(void)
Create a new SkipTag with a random ID, picked by taking the Ante into account, as some Tags only appe...
void skip_tag_process_start(enum SkipTagEvent checked_tag_event)
Start Skip Tag processing for the specified event.
enum SkipTagProcStage skip_tag_process_get_proc_stage(void)
Recover the current stage of the Tag processing.
void skip_tag_process_resume(void)
Resume the processing of Skip Tags.
void add_skip_tag(SkipTag **blind_tag)
Adds the SkipTag to the owned list, snaps it into position and sets the original pointer to NULL.
Sprite system for Gbalatro.
INLINE void sprite_position(Sprite *sprite, int x, int y)
Set sprite position. Inlined for efficiency.
void sprite_object_set_target(SpriteObject *sprite_object, BG_POINT to)
Set a SpriteObject's target position so that is slides across the screen between from the current pos...
INLINE void sprite_object_position(SpriteObject *sprite_object, int x, int y)
Set sprite_object position. Inlined for efficiency.
void sprite_destroy(Sprite **sprite)
Destroy Sprite.
void sprite_hide(Sprite *sprite)
Hides the sprite by manipulating ATTR0_HIDE in OAM.
void sprite_unhide(Sprite *sprite)
Unhides the sprite by manipulating ATTR0_HIDE in OAM. The sprite's ATTR0_MODE is maintained from the ...
void state_machine_remove(StateMachine *state_machine)
Remove a statemachine's update function.
void state_machine_register(StateMachine *state_machine)
Register a statemachine to run it's update function once per frame.
void state_machine_change_state(StateMachine *state_machine, int new_state)
Calls the current state's on_exit, the new state's on_init, and sets the active update fn.
The core selection grid struct, represents the grid itself and its state.
A sprite object is a sprite that is focusable and movable in animation.
Sprite struct for GBA hardware specifics.
POINT pos
Sprite position on screen in pixels.
Utilities relating around number string representation and protected arithmatic helper functions.
void truncate_uint_to_suffixed_str(uint32_t num, int num_req_chars, char out_str_buff[UINT_MAX_DIGITS+1])
Truncate an unsigned number into a suffixed string representation e.g. 12000 -> "12K" The least signi...