Setup Run menu state functions implementation. More...
#include "game/run_setup.h"#include "background_run_setup_gfx.h"#include "button.h"#include "card.h"#include "game.h"#include "game_variables.h"#include "graphic_utils.h"#include "save.h"#include "selection_grid.h"#include "sprite.h"#include "state_machine.h"#include "util.h"#include <string.h>#include <tonc.h>Go to the source code of this file.
Functions | |
| static void | choose_deck_substate_init (void) |
| Initializes the Deck changing substate. | |
| static void | choose_deck_substate_update (void) |
| Update the deck changing substate by handling user input though its corresponding SelectionGrid. | |
| static void | seed_keyboard_substate_init (void) |
| Initialize the Choose Seed substate. | |
| static void | seed_keyboard_substate_update (void) |
Update the Choose Seed substate by handling user inputs though the corresponding choose_seed_selection_grid SelectionGrid. | |
| static void | resume_substate_init (void) |
| Initialize the "Resume Previous Run" substate. | |
| static void | tab_set_highlight (enum RunSetupTab tab_sel) |
Highlights the tab_sel Tab at the top of the screen, and removes highlight from all the others. | |
| static void | run_setup_tabs_update (void) |
| Handle user input in regards to the Tabs. Tabs are cycled through using the L/R buttons. | |
| static int | back_row_get_size () |
| Retuns the width of the Back button's row. | |
| static void | back_row_on_key_transit (SelectionGrid *selection_grid, Selection *selection) |
| static void | toggle_seed_enabled (bool enable) |
| Toggle whether or not we will use the seed chosen by the user. Changes the looks of the Seed button to signal if it is clickable or not, and that of the checkbox next to it. | |
| static void | use_seed_on_pressed (void) |
| Seed checkbox Button Callback. Toggles custom seed usage. | |
| static void | seed_on_pressed (void) |
| Seed Button Callback. Opens the seed input keyboard. | |
| static void | deck_on_pressed (void) |
| Deck Button Callback. | |
| static void | play_on_pressed (void) |
| Play Button Callback. Applies the chosen seed if enabled and starts a new run. | |
| static void | back_on_pressed (void) |
| Back Button Callback. Goes back to the Main Menu. | |
| static int | change_deck_get_row_size (void) |
| Returns the width of the Change Deck Button's row. | |
| static bool | choose_deck_row_on_selection_changed (SelectionGrid *selection_grid, int row_idx, const Selection *prev_selection, const Selection *new_selection) |
Handle directional input in choose_deck_selection_grid | |
| static int | seed_play_get_row_size (void) |
| Returns the width of the Seed checkbox/Seed/Play buttons' row. | |
| static void | seed_play_row_on_key_transit (SelectionGrid *selection_grid, Selection *selection) |
Handle button inputs for choose_deck_selection_grid | |
| static void | change_deck_on_pressed (void) |
| Button Callback used for cycling through the Decks. | |
| static int | choose_seed_get_keyboard_row_size (void) |
| Returns the width of the 3 top keyboard rows. | |
| static int | choose_seed_get_keyboard_short_row_size (void) |
| Returns the width of the bottom keyboard row, the shortest one. | |
| static int | choose_seed_get_bottom_row_size (void) |
| Returns the width of the Deck/Play buttons' row. | |
| static void | choose_seed_row_on_key_transit (SelectionGrid *selection_grid, Selection *selection) |
Handle button imputs in choose_seed_selection_grid | |
| static bool | choose_seed_row_on_selection_changed (SelectionGrid *selection_grid, int row_idx, const Selection *prev_selection, const Selection *new_selection) |
Handle directional imputs in choose_seed_selection_grid | |
| static void | keyboard_button_on_pressed (void) |
| Keyboard key Button callback. | |
| void | run_setup_change_background (void) |
| Change to the Run Setup menu background. | |
| void | run_setup_on_init (void) |
| Run Setup menu state initialization. | |
| void | run_setup_on_update (void) |
| Run Setup menu state update. | |
| void | run_setup_on_exit (void) |
| Run Setup menu cleanup. | |
| static Button * | change_deck_get_button_from_sel (const Selection *sel) |
Gets the Button corresponding to the current Selection in choose_deck_selection_grid | |
| static void | update_seed_text (void) |
| Prints the string representing the chosen seed in base-36. | |
| static void | reroll_seed_str (void) |
| Deletes the last char in the seed string base-36 representation. | |
| static void | delete_seed_char (void) |
| Deletes the last char in the seed string base-36 representation. | |
| static void | type_seed_char (enum RunSetupKeyboardButtons key) |
| Add a new char at the end of the seed string. | |
| static enum RunSetupKeyboardButtons | get_keyboard_index_from_sel (const Selection *sel) |
| Get the keyboard key index from a SelectionGrid's Selection. The returned value is valid only if the Selection is within the keyboard Rows. | |
| static Button * | choose_seed_get_button_from_sel (const Selection *sel) |
Get the Button corresponding to a Selection within choose_seed_selection_grid | |
Setup Run menu state functions implementation.
Definition in file run_setup.c.
| #define BACK_BTN_MAIN_COLOR_PAL_IDX 14 |
Definition at line 31 of file run_setup.c.
| #define BACK_BTN_OUTLINE_COLOR_PAL_IDX 36 |
Definition at line 39 of file run_setup.c.
| #define BLUE_BTN_MAIN_COLOR_PAL_IDX 12 |
Definition at line 29 of file run_setup.c.
| #define BLUE_DISABLED_BTN_MAIN_COLOR_PAL_IDX 13 |
Definition at line 30 of file run_setup.c.
| #define CHANGE_DECK_BTN_MAIN_COLOR_PAL_IDX 1 |
Definition at line 26 of file run_setup.c.
| #define CHANGE_DECK_BTN_OUTLINE_COLOR_PAL_IDX 32 |
Definition at line 35 of file run_setup.c.
| #define DEF_SEED_KEYBOARD_BUTTON_OBJECT | ( | key | ) |
Definition at line 481 of file run_setup.c.
| #define KEYBOARD_0_BTN_OUTLINE_COLOR_PAL_IDX 49 |
Definition at line 50 of file run_setup.c.
| #define KEYBOARD_1_BTN_OUTLINE_COLOR_PAL_IDX 40 |
Definition at line 41 of file run_setup.c.
| #define KEYBOARD_2_BTN_OUTLINE_COLOR_PAL_IDX 41 |
Definition at line 42 of file run_setup.c.
| #define KEYBOARD_3_BTN_OUTLINE_COLOR_PAL_IDX 42 |
Definition at line 43 of file run_setup.c.
| #define KEYBOARD_4_BTN_OUTLINE_COLOR_PAL_IDX 43 |
Definition at line 44 of file run_setup.c.
| #define KEYBOARD_5_BTN_OUTLINE_COLOR_PAL_IDX 44 |
Definition at line 45 of file run_setup.c.
| #define KEYBOARD_6_BTN_OUTLINE_COLOR_PAL_IDX 45 |
Definition at line 46 of file run_setup.c.
| #define KEYBOARD_7_BTN_OUTLINE_COLOR_PAL_IDX 46 |
Definition at line 47 of file run_setup.c.
| #define KEYBOARD_8_BTN_OUTLINE_COLOR_PAL_IDX 47 |
Definition at line 48 of file run_setup.c.
| #define KEYBOARD_9_BTN_OUTLINE_COLOR_PAL_IDX 48 |
Definition at line 49 of file run_setup.c.
| #define KEYBOARD_A_BTN_OUTLINE_COLOR_PAL_IDX 50 |
Definition at line 52 of file run_setup.c.
| #define KEYBOARD_B_BTN_OUTLINE_COLOR_PAL_IDX 51 |
Definition at line 53 of file run_setup.c.
| #define KEYBOARD_C_BTN_OUTLINE_COLOR_PAL_IDX 52 |
Definition at line 54 of file run_setup.c.
| #define KEYBOARD_D_BTN_OUTLINE_COLOR_PAL_IDX 53 |
Definition at line 55 of file run_setup.c.
| #define KEYBOARD_DEL_BTN_OUTLINE_COLOR_PAL_IDX 77 |
Definition at line 81 of file run_setup.c.
| #define KEYBOARD_E_BTN_OUTLINE_COLOR_PAL_IDX 54 |
Definition at line 56 of file run_setup.c.
| #define KEYBOARD_F_BTN_OUTLINE_COLOR_PAL_IDX 55 |
Definition at line 57 of file run_setup.c.
| #define KEYBOARD_G_BTN_OUTLINE_COLOR_PAL_IDX 56 |
Definition at line 58 of file run_setup.c.
| #define KEYBOARD_H_BTN_OUTLINE_COLOR_PAL_IDX 57 |
Definition at line 59 of file run_setup.c.
| #define KEYBOARD_HEIGHT 4 |
Definition at line 341 of file run_setup.c.
| #define KEYBOARD_I_BTN_OUTLINE_COLOR_PAL_IDX 58 |
Definition at line 60 of file run_setup.c.
| #define KEYBOARD_J_BTN_OUTLINE_COLOR_PAL_IDX 59 |
Definition at line 61 of file run_setup.c.
| #define KEYBOARD_K_BTN_OUTLINE_COLOR_PAL_IDX 60 |
Definition at line 63 of file run_setup.c.
| #define KEYBOARD_L_BTN_OUTLINE_COLOR_PAL_IDX 61 |
Definition at line 64 of file run_setup.c.
| #define KEYBOARD_M_BTN_OUTLINE_COLOR_PAL_IDX 62 |
Definition at line 65 of file run_setup.c.
| #define KEYBOARD_N_BTN_OUTLINE_COLOR_PAL_IDX 63 |
Definition at line 66 of file run_setup.c.
| #define KEYBOARD_O_BTN_OUTLINE_COLOR_PAL_IDX 64 |
Definition at line 67 of file run_setup.c.
| #define KEYBOARD_P_BTN_OUTLINE_COLOR_PAL_IDX 65 |
Definition at line 68 of file run_setup.c.
| #define KEYBOARD_Q_BTN_OUTLINE_COLOR_PAL_IDX 66 |
Definition at line 69 of file run_setup.c.
| #define KEYBOARD_R_BTN_OUTLINE_COLOR_PAL_IDX 67 |
Definition at line 70 of file run_setup.c.
| #define KEYBOARD_RAND_BTN_OUTLINE_COLOR_PAL_IDX 70 |
Definition at line 74 of file run_setup.c.
| #define KEYBOARD_S_BTN_OUTLINE_COLOR_PAL_IDX 68 |
Definition at line 71 of file run_setup.c.
| #define KEYBOARD_T_BTN_OUTLINE_COLOR_PAL_IDX 69 |
Definition at line 72 of file run_setup.c.
| #define KEYBOARD_U_BTN_OUTLINE_COLOR_PAL_IDX 71 |
Definition at line 75 of file run_setup.c.
| #define KEYBOARD_V_BTN_OUTLINE_COLOR_PAL_IDX 72 |
Definition at line 76 of file run_setup.c.
| #define KEYBOARD_W_BTN_OUTLINE_COLOR_PAL_IDX 73 |
Definition at line 77 of file run_setup.c.
| #define KEYBOARD_WIDTH 10 |
Definition at line 340 of file run_setup.c.
| #define KEYBOARD_X_BTN_OUTLINE_COLOR_PAL_IDX 74 |
Definition at line 78 of file run_setup.c.
| #define KEYBOARD_Y_BTN_OUTLINE_COLOR_PAL_IDX 75 |
Definition at line 79 of file run_setup.c.
| #define KEYBOARD_Z_BTN_OUTLINE_COLOR_PAL_IDX 76 |
Definition at line 80 of file run_setup.c.
| #define NEW_RUN_BTN_OUTLINE_COLOR_PAL_IDX 30 |
Definition at line 33 of file run_setup.c.
| #define PLAY_BTN_OUTLINE_COLOR_PAL_IDX 35 |
Definition at line 38 of file run_setup.c.
| #define RED_BTN_MAIN_COLOR_PAL_IDX 10 |
Definition at line 27 of file run_setup.c.
| #define RED_DISABLED_BTN_MAIN_COLOR_PAL_IDX 11 |
Definition at line 28 of file run_setup.c.
| #define RESUME_BTN_OUTLINE_COLOR_PAL_IDX 31 |
Definition at line 34 of file run_setup.c.
| #define RUN_SETUP_DECK_SPRITE_T_X 48 |
Definition at line 161 of file run_setup.c.
| #define RUN_SETUP_DECK_SPRITE_T_Y 54 |
Definition at line 162 of file run_setup.c.
| #define SEED_CHECK_BTN_OUTLINE_COLOR_PAL_IDX 33 |
Definition at line 36 of file run_setup.c.
| #define SEED_DECK_BTN_OUTLINE_COLOR_PAL_IDX 34 |
Definition at line 37 of file run_setup.c.
| enum RunSetupDeckBottomButtons |
Definition at line 250 of file run_setup.c.
| enum RunSetupDeckRows |
Definition at line 242 of file run_setup.c.
| enum RunSetupKeyboardButtons |
Definition at line 354 of file run_setup.c.
| enum RunSetupResumeRows |
Definition at line 562 of file run_setup.c.
| enum RunSetupSeedBottomButtons |
Definition at line 402 of file run_setup.c.
| enum RunSetupSeedRows |
Definition at line 343 of file run_setup.c.
| enum RunSetupSubstate |
Definition at line 83 of file run_setup.c.
| enum RunSetupTab |
Definition at line 182 of file run_setup.c.
|
static |
Back Button Callback. Goes back to the Main Menu.
Definition at line 1201 of file run_setup.c.
|
static |
Retuns the width of the Back button's row.
Definition at line 1274 of file run_setup.c.
|
static |
Definition at line 1279 of file run_setup.c.
|
inlinestatic |
Gets the Button corresponding to the current Selection in choose_deck_selection_grid
| sel | Selection within choose_deck_selection_grid |
Definition at line 739 of file run_setup.c.
|
static |
Returns the width of the Change Deck Button's row.
Definition at line 728 of file run_setup.c.
|
static |
Button Callback used for cycling through the Decks.
Definition at line 1209 of file run_setup.c.
|
static |
Handle directional input in choose_deck_selection_grid
| selection_grid | pointer to choose_deck_selection_grid |
| row_idx | row index in choose_deck_selection_grid this function is being called for |
| prev_selection | previous selection in selection_grid |
| new_selection | new selection in selection_grid |
Definition at line 766 of file run_setup.c.
|
static |
Initializes the Deck changing substate.
Definition at line 662 of file run_setup.c.
|
static |
Update the deck changing substate by handling user input though its corresponding SelectionGrid.
Definition at line 718 of file run_setup.c.
|
static |
Returns the width of the Deck/Play buttons' row.
Definition at line 906 of file run_setup.c.
|
inlinestatic |
Get the Button corresponding to a Selection within choose_seed_selection_grid
| sel | Selection in choose_seed_selection_grid |
sel in grid Definition at line 1013 of file run_setup.c.
|
static |
Returns the width of the 3 top keyboard rows.
KEYBOARD_WIDTH = 10 Definition at line 886 of file run_setup.c.
|
static |
Returns the width of the bottom keyboard row, the shortest one.
KEYBOARD_WIDTH - 2 = 8 Definition at line 896 of file run_setup.c.
|
static |
Handle button imputs in choose_seed_selection_grid
Always register A press, but only B press when we are on a keyboard row
| selection_grid | pointer to choose_seed_selection_grid |
| selection | Selected button in choose_seed_selection_grid |
Definition at line 1040 of file run_setup.c.
|
static |
Handle directional imputs in choose_seed_selection_grid
| selection_grid | pointer to choose_seed_selection_grid |
| row_idx | index of the row in selection_grid the function is being called for |
| prev_selection | previous Selection in choose_seed_selection_grid |
| new_selection | new selection in choose_seed_selection_grid |
Definition at line 1058 of file run_setup.c.
|
static |
Deck Button Callback.
Definition at line 1105 of file run_setup.c.
|
inlinestatic |
Deletes the last char in the seed string base-36 representation.
Definition at line 929 of file run_setup.c.
|
inlinestatic |
Get the keyboard key index from a SelectionGrid's Selection. The returned value is valid only if the Selection is within the keyboard Rows.
| sel | the Selection within the choose_seed_selection_grid |
Definition at line 959 of file run_setup.c.
|
static |
Keyboard key Button callback.
Definition at line 967 of file run_setup.c.
|
static |
Play Button Callback. Applies the chosen seed if enabled and starts a new run.
Definition at line 1184 of file run_setup.c.
|
inlinestatic |
Deletes the last char in the seed string base-36 representation.
Definition at line 914 of file run_setup.c.
|
static |
Initialize the "Resume Previous Run" substate.
Definition at line 1118 of file run_setup.c.
| void run_setup_change_background | ( | void | ) |
Change to the Run Setup menu background.
Definition at line 580 of file run_setup.c.
| void run_setup_on_exit | ( | void | ) |
Run Setup menu cleanup.
Definition at line 640 of file run_setup.c.
| void run_setup_on_init | ( | void | ) |
Run Setup menu state initialization.
Definition at line 588 of file run_setup.c.
| void run_setup_on_update | ( | void | ) |
Run Setup menu state update.
Definition at line 635 of file run_setup.c.
|
static |
Handle user input in regards to the Tabs. Tabs are cycled through using the L/R buttons.
Definition at line 1230 of file run_setup.c.
|
static |
Initialize the Choose Seed substate.
Definition at line 824 of file run_setup.c.
|
static |
Update the Choose Seed substate by handling user inputs though the corresponding choose_seed_selection_grid SelectionGrid.
Definition at line 876 of file run_setup.c.
|
static |
Seed Button Callback. Opens the seed input keyboard.
Definition at line 1175 of file run_setup.c.
|
static |
Returns the width of the Seed checkbox/Seed/Play buttons' row.
Definition at line 787 of file run_setup.c.
|
static |
Handle button inputs for choose_deck_selection_grid
| selection_grid | pointer to choose_deck_selection_grid |
| selection | current Selection in selection_grid |
Definition at line 798 of file run_setup.c.
|
static |
Highlights the tab_sel Tab at the top of the screen, and removes highlight from all the others.
| tab_sel | index of the selected tab |
Definition at line 1219 of file run_setup.c.
|
inlinestatic |
Toggle whether or not we will use the seed chosen by the user. Changes the looks of the Seed button to signal if it is clickable or not, and that of the checkbox next to it.
| enable | whether the seed is enabled or not |
Definition at line 1135 of file run_setup.c.
|
inlinestatic |
Add a new char at the end of the seed string.
| key | index of the keyboard key corresponding to the char we want to add |
Definition at line 943 of file run_setup.c.
|
inlinestatic |
Prints the string representing the chosen seed in base-36.
Definition at line 809 of file run_setup.c.
|
static |
Seed checkbox Button Callback. Toggles custom seed usage.
Definition at line 1167 of file run_setup.c.
|
static |
Definition at line 229 of file run_setup.c.
|
static |
Definition at line 307 of file run_setup.c.
|
static |
Definition at line 316 of file run_setup.c.
|
static |
Definition at line 271 of file run_setup.c.
|
static |
Definition at line 297 of file run_setup.c.
|
static |
Definition at line 533 of file run_setup.c.
|
static |
Definition at line 469 of file run_setup.c.
|
static |
Definition at line 423 of file run_setup.c.
|
static |
Definition at line 189 of file run_setup.c.
|
static |
Definition at line 488 of file run_setup.c.
|
static |
Definition at line 543 of file run_setup.c.
|
static |
Definition at line 169 of file run_setup.c.
|
static |
Definition at line 134 of file run_setup.c.
|
static |
Definition at line 135 of file run_setup.c.
|
static |
Definition at line 140 of file run_setup.c.
|
static |
Definition at line 141 of file run_setup.c.
|
static |
Definition at line 294 of file run_setup.c.
|
static |
Definition at line 147 of file run_setup.c.
|
static |
Definition at line 149 of file run_setup.c.
|
static |
Definition at line 148 of file run_setup.c.
|
static |
Definition at line 295 of file run_setup.c.
|
static |
Definition at line 145 of file run_setup.c.
|
static |
Definition at line 143 of file run_setup.c.
|
static |
Definition at line 144 of file run_setup.c.
|
static |
Definition at line 157 of file run_setup.c.
|
static |
Definition at line 158 of file run_setup.c.
|
static |
Definition at line 155 of file run_setup.c.
|
static |
Definition at line 153 of file run_setup.c.
|
static |
Definition at line 151 of file run_setup.c.
|
static |
Definition at line 467 of file run_setup.c.
|
static |
Definition at line 154 of file run_setup.c.
|
static |
Definition at line 152 of file run_setup.c.
|
static |
Definition at line 331 of file run_setup.c.
|
static |
Definition at line 164 of file run_setup.c.
|
static |
Definition at line 165 of file run_setup.c.
|
static |
Definition at line 163 of file run_setup.c.
|
static |
Definition at line 132 of file run_setup.c.
|
static |
Definition at line 168 of file run_setup.c.
|
static |
Definition at line 167 of file run_setup.c.
|
static |
Definition at line 166 of file run_setup.c.
|
static |
Definition at line 117 of file run_setup.c.
|
static |
Definition at line 553 of file run_setup.c.
|
static |
Definition at line 552 of file run_setup.c.
|
static |
Definition at line 100 of file run_setup.c.
|
static |
Definition at line 195 of file run_setup.c.
|
static |
Definition at line 330 of file run_setup.c.