GBAlatro
A Demake of Balatro for the GBA
Loading...
Searching...
No Matches
shop.c File Reference

Shop state functions implementation. More...

#include "game/shop.h"
#include "audio_utils.h"
#include "background_shop_gfx.h"
#include "bitset.h"
#include "button.h"
#include "game.h"
#include "game/blind_select.h"
#include "game/joker_row.h"
#include "game_variables.h"
#include "joker.h"
#include "layout.h"
#include "list.h"
#include "mgba_logger.h"
#include "random.h"
#include "save.h"
#include "skip_tag.h"
#include "soundbank.h"
#include "state_machine.h"
#include "timer.h"
#include "util.h"
#include <string.h>

Go to the source code of this file.

Macros

#define TM_END_GAME_SHOP_INTRO   12
 
#define TM_CREATE_SHOP_ITEMS_WAIT   1
 
#define TM_SHIFT_SHOP_ICON_WAIT   7
 
#define TM_SHOW_ITEM_DESC_WAIT   12
 
#define TM_HIDE_DECK_WAIT   5
 
#define ITEM_SHOP_Y   71
 
#define OWNED_ITEMS_HIDE_Y_OFFSET   50
 
#define REROLL_BASE_COST   5
 
#define NEXT_ROUND_BTN_SEL_X   0
 
#define REROLL_BTN_PAL_IDX   3
 
#define NEXT_ROUND_BTN_SELECTED_BORDER_PAL_IDX   5
 
#define SHOP_PANEL_SHADOW_PAL_IDX   6
 
#define REROLL_BTN_SELECTED_BORDER_PAL_IDX   7
 
#define SHOP_LIGHTS_1_PAL_IDX   8
 
#define SHOP_LIGHTS_2_PAL_IDX   14
 
#define NEXT_ROUND_BTN_PAL_IDX   16
 
#define SHOP_LIGHTS_3_PAL_IDX   17
 
#define SHOP_LIGHTS_4_PAL_IDX   22
 
#define SHOP_BOTTOM_PANEL_BORDER_PAL_IDX   26
 
#define SHOP_DESC_RARITY_MAIN_COLOR_PAL_IDX   27
 
#define SHOP_DESC_RARITY_SHADOW_COLOR_PAL_IDX   28
 
#define SHOP_LIGHTS_1_CLR   0xFFFF
 
#define SHOP_LIGHTS_2_CLR   0x32BE
 
#define SHOP_LIGHTS_3_CLR   0x4B5F
 
#define SHOP_LIGHTS_4_CLR   0x5F9F
 
#define SHOP_GRID_OWNED_ROW   0
 
#define SHOP_GRID_FOR_SALE_ROW   1
 

Enumerations

enum  GameShopStates {
  GAME_SHOP_SKIP_TAGS , GAME_SHOP_INTRO , GAME_SHOP_ACTIVE , GAME_SHOP_SHOW_ITEM_DESC ,
  GAME_SHOP_HIDE_ITEM_DESC , GAME_SHOP_EXIT , GAME_SHOP_MAX
}
 

Functions

static void shop_redeem_skip_tags (void)
 
static void shop_intro ()
 Intro sequence (menu and shop icon coming into frame)
 
static void shop_process_user_input (void)
 Handle user inputs logic in the Shop though a SelectionGrid.
 
static void shop_show_item_desc_on_init (void)
 
static void shop_show_item_desc_on_update (void)
 
static void shop_hide_item_desc_on_init (void)
 
static void shop_hide_item_desc_on_update (void)
 
static void shop_hide_item_desc_on_exit (void)
 
static void shop_outro (void)
 Outro sequence substate update. This makes the menu and shop icon go out of frame.
 
static int shop_top_row_get_size (void)
 Computes the number of Jokers up for sale, aka the number of "buttons" there are on the top row of the Shop.
 
static bool shop_top_row_on_selection_changed (SelectionGrid *selection_grid, int row_idx, const Selection *prev_selection, const Selection *new_selection)
 Handle d-pad inputs for the "Next Round" button and shop Jokers' row.
 
static void shop_top_row_on_key_transit (SelectionGrid *selection_grid, Selection *selection)
 Handle button inputs for the "Next Round" button and shop Jokers.
 
static int shop_reroll_row_get_size ()
 Get size of the row with the "Reroll" button.
 
static bool shop_reroll_row_on_selection_changed (SelectionGrid *selection_grid, int row_idx, const Selection *prev_selection, const Selection *new_selection)
 Handle d-pad inputs for the "Reroll" button's row.
 
static void shop_reroll_row_on_key_transit (SelectionGrid *selection_grid, Selection *selection)
 Handle button inputs for the "Reroll" button's row.
 
static void next_round_on_pressed (void)
 
static void reroll_on_pressed (void)
 
static bool reroll_can_be_pressed (void)
 
Item * shop_get_description_item (void)
 Get a pointer to the Card we are currently showing the description of.
 
int shop_get_reroll_cost (void)
 Get the current cost to reroll the items sold in the shop.
 
void shop_set_reroll_cost (int cost)
 Set the current cost to reroll the items sold in the shop to the given value.
 
void shop_reset (void)
 Initialize the shop for a run. Resets all the shop data for the run, needs to be called once per run.
 
void shop_change_background (void)
 Change to the shop background.
 
void shop_on_init (void)
 Shop state initialization.
 
static Item * shop_create_top_row_item (void)
 Create a shop top row item - jokers, consumables, and possibly playing cards Currently only jokers are implemented.
 
static void shop_create_top_row_items (void)
 Setup for the lists of items we can purchase in the top row of the Shop. i.e. Jokers and consumables and possibly playing cards.
 
static void shop_buy_item (int shop_item_idx)
 Called when pressing A on a Shop Joker to buy it.
 
static void shop_reroll (void)
 Reroll items up for sale in the Shop. Reroll cost will go up by a rate that increases by 1 each reroll.
 
static void shop_lights_anim_frame (void)
 Cycling shop lights animation substate update.
 
void shop_on_update (void)
 Shop state update.
 
void shop_on_exit (void)
 Shop cleanup.
 

Variables

static const Rect SHOP_ICON_FROM_RECT = { 0, 26, 8, 26}
 
static const BG_POINT SHOP_ICON_TO_POS = { 0, 0}
 
static const BG_POINT OWNED_ITEMS_PANEL_3X3_SRC_POS = { 29, 21}
 
static const Rect OWNED_JOKERS_PANEL_RECT = { 9, 1, 21, 5}
 
static const Rect OWNED_CONSUMABLES_PANEL_RECT = { 23, 1, 28, 5}
 
static const Rect OWNED_ITEMS_PANEL_RECT = { 9, 1, 28, 5}
 
static const Rect OWNED_ITEMS_PANEL_ANIM_CLEAR = { 9, 0, 28, 1}
 
static const Rect ITEM_DESC_9_PTCH_TO_RECT = { 9, 6, 28, 18}
 
static const NinePatchRect ITEM_DESC_9_PTCH_SRC
 
static const int ITEM_DESC_MAX_TEXT_HEIGHT
 
static const Rect ITEM_DESC_TEXT_RECT = { 11, 9, 26, 18}
 
static const Rect ITEM_NAME_TEXT_RECT = { 10, 7, 27, 7}
 
static const BG_POINT SHOP_JOKER_SPRITES_INIT_POS = {120, 160}
 
static const BG_POINT ITEM_DESCRIPTION_SPRITE_POS = {135, 9}
 
static const Rect SHOP_PRICES_TEXT_RECT = { 72, 56, 192, 160 }
 
static const Rect SHOP_REROLL_RECT = { 88, 96, UNDEFINED, UNDEFINED }
 
static List s_shop_items_list = LIST_DEFAULT
 
static StateInfo shop_state_actions [GAME_SHOP_MAX]
 
static StateMachine shop_sm = STATE_MACHINE_DEFINE(shop_state_actions, GAME_SHOP_MAX)
 
static SelectionGridRow shop_selection_rows []
 
static const Selection SHOP_INIT_SEL = {-1, 1}
 
static SelectionGrid shop_selection_grid
 
static Button next_round_button
 
static Button reroll_button
 
static int s_timer
 
static int s_reroll_cost = REROLL_BASE_COST
 
static Item * s_description_item = NULL
 
static FIXED s_description_item_original_x_pos = UNDEFINED
 
static FIXED s_description_item_original_y_pos = UNDEFINED
 
static int s_show_description_anim_progress = 0
 

Detailed Description

Shop state functions implementation.

Definition in file shop.c.

Macro Definition Documentation

◆ ITEM_SHOP_Y

#define ITEM_SHOP_Y   71

Definition at line 39 of file shop.c.

◆ NEXT_ROUND_BTN_PAL_IDX

#define NEXT_ROUND_BTN_PAL_IDX   16

Definition at line 53 of file shop.c.

◆ NEXT_ROUND_BTN_SEL_X

#define NEXT_ROUND_BTN_SEL_X   0

Definition at line 44 of file shop.c.

◆ NEXT_ROUND_BTN_SELECTED_BORDER_PAL_IDX

#define NEXT_ROUND_BTN_SELECTED_BORDER_PAL_IDX   5

Definition at line 48 of file shop.c.

◆ OWNED_ITEMS_HIDE_Y_OFFSET

#define OWNED_ITEMS_HIDE_Y_OFFSET   50

Definition at line 40 of file shop.c.

◆ REROLL_BASE_COST

#define REROLL_BASE_COST   5

Definition at line 43 of file shop.c.

◆ REROLL_BTN_PAL_IDX

#define REROLL_BTN_PAL_IDX   3

Definition at line 47 of file shop.c.

◆ REROLL_BTN_SELECTED_BORDER_PAL_IDX

#define REROLL_BTN_SELECTED_BORDER_PAL_IDX   7

Definition at line 50 of file shop.c.

◆ SHOP_BOTTOM_PANEL_BORDER_PAL_IDX

#define SHOP_BOTTOM_PANEL_BORDER_PAL_IDX   26

Definition at line 56 of file shop.c.

◆ SHOP_DESC_RARITY_MAIN_COLOR_PAL_IDX

#define SHOP_DESC_RARITY_MAIN_COLOR_PAL_IDX   27

Definition at line 57 of file shop.c.

◆ SHOP_DESC_RARITY_SHADOW_COLOR_PAL_IDX

#define SHOP_DESC_RARITY_SHADOW_COLOR_PAL_IDX   28

Definition at line 58 of file shop.c.

◆ SHOP_GRID_FOR_SALE_ROW

#define SHOP_GRID_FOR_SALE_ROW   1

Definition at line 136 of file shop.c.

◆ SHOP_GRID_OWNED_ROW

#define SHOP_GRID_OWNED_ROW   0

Definition at line 135 of file shop.c.

◆ SHOP_LIGHTS_1_CLR

#define SHOP_LIGHTS_1_CLR   0xFFFF

Definition at line 60 of file shop.c.

◆ SHOP_LIGHTS_1_PAL_IDX

#define SHOP_LIGHTS_1_PAL_IDX   8

Definition at line 51 of file shop.c.

◆ SHOP_LIGHTS_2_CLR

#define SHOP_LIGHTS_2_CLR   0x32BE

Definition at line 61 of file shop.c.

◆ SHOP_LIGHTS_2_PAL_IDX

#define SHOP_LIGHTS_2_PAL_IDX   14

Definition at line 52 of file shop.c.

◆ SHOP_LIGHTS_3_CLR

#define SHOP_LIGHTS_3_CLR   0x4B5F

Definition at line 62 of file shop.c.

◆ SHOP_LIGHTS_3_PAL_IDX

#define SHOP_LIGHTS_3_PAL_IDX   17

Definition at line 54 of file shop.c.

◆ SHOP_LIGHTS_4_CLR

#define SHOP_LIGHTS_4_CLR   0x5F9F

Definition at line 63 of file shop.c.

◆ SHOP_LIGHTS_4_PAL_IDX

#define SHOP_LIGHTS_4_PAL_IDX   22

Definition at line 55 of file shop.c.

◆ SHOP_PANEL_SHADOW_PAL_IDX

#define SHOP_PANEL_SHADOW_PAL_IDX   6

Definition at line 49 of file shop.c.

◆ TM_CREATE_SHOP_ITEMS_WAIT

#define TM_CREATE_SHOP_ITEMS_WAIT   1

Definition at line 33 of file shop.c.

◆ TM_END_GAME_SHOP_INTRO

#define TM_END_GAME_SHOP_INTRO   12

Definition at line 32 of file shop.c.

◆ TM_HIDE_DECK_WAIT

#define TM_HIDE_DECK_WAIT   5

Definition at line 36 of file shop.c.

◆ TM_SHIFT_SHOP_ICON_WAIT

#define TM_SHIFT_SHOP_ICON_WAIT   7

Definition at line 34 of file shop.c.

◆ TM_SHOW_ITEM_DESC_WAIT

#define TM_SHOW_ITEM_DESC_WAIT   12

Definition at line 35 of file shop.c.

Enumeration Type Documentation

◆ GameShopStates

enum GameShopStates

Definition at line 95 of file shop.c.

Function Documentation

◆ next_round_on_pressed()

static void next_round_on_pressed ( void  )
static

Definition at line 566 of file shop.c.

◆ reroll_can_be_pressed()

static bool reroll_can_be_pressed ( void  )
static

Definition at line 582 of file shop.c.

◆ reroll_on_pressed()

static void reroll_on_pressed ( void  )
static

Definition at line 576 of file shop.c.

◆ shop_buy_item()

static void shop_buy_item ( int  shop_item_idx)
inlinestatic

Called when pressing A on a Shop Joker to buy it.

Definition at line 376 of file shop.c.

◆ shop_change_background()

void shop_change_background ( void  )

Change to the shop background.

Definition at line 218 of file shop.c.

◆ shop_create_top_row_item()

static Item * shop_create_top_row_item ( void  )
static

Create a shop top row item - jokers, consumables, and possibly playing cards Currently only jokers are implemented.

Definition at line 272 of file shop.c.

◆ shop_create_top_row_items()

static void shop_create_top_row_items ( void  )
static

Setup for the lists of items we can purchase in the top row of the Shop. i.e. Jokers and consumables and possibly playing cards.

Definition at line 282 of file shop.c.

◆ shop_get_description_item()

Item * shop_get_description_item ( void  )

Get a pointer to the Card we are currently showing the description of.

Returns
Item pointer, NULL if no description is currently being shown

Definition at line 196 of file shop.c.

◆ shop_get_reroll_cost()

int shop_get_reroll_cost ( void  )

Get the current cost to reroll the items sold in the shop.

Returns
int

Definition at line 201 of file shop.c.

◆ shop_hide_item_desc_on_exit()

static void shop_hide_item_desc_on_exit ( void  )
static

Definition at line 805 of file shop.c.

◆ shop_hide_item_desc_on_init()

static void shop_hide_item_desc_on_init ( void  )
static

Definition at line 738 of file shop.c.

◆ shop_hide_item_desc_on_update()

static void shop_hide_item_desc_on_update ( void  )
static

Definition at line 783 of file shop.c.

◆ shop_intro()

static void shop_intro ( void  )
static

Intro sequence (menu and shop icon coming into frame)

Definition at line 320 of file shop.c.

◆ shop_lights_anim_frame()

static void shop_lights_anim_frame ( void  )
inlinestatic

Cycling shop lights animation substate update.

Definition at line 897 of file shop.c.

◆ shop_on_exit()

void shop_on_exit ( void  )

Shop cleanup.

Definition at line 933 of file shop.c.

◆ shop_on_init()

void shop_on_init ( void  )

Shop state initialization.

Definition at line 242 of file shop.c.

◆ shop_on_update()

void shop_on_update ( void  )

Shop state update.

Definition at line 923 of file shop.c.

◆ shop_outro()

static void shop_outro ( void  )
static

Outro sequence substate update. This makes the menu and shop icon go out of frame.

Definition at line 855 of file shop.c.

◆ shop_process_user_input()

static void shop_process_user_input ( void  )
static

Handle user inputs logic in the Shop though a SelectionGrid.

Definition at line 590 of file shop.c.

◆ shop_redeem_skip_tags()

static void shop_redeem_skip_tags ( void  )
static

Definition at line 259 of file shop.c.

◆ shop_reroll()

static void shop_reroll ( void  )
inlinestatic

Reroll items up for sale in the Shop. Reroll cost will go up by a rate that increases by 1 each reroll.

Definition at line 508 of file shop.c.

◆ shop_reroll_row_get_size()

static int shop_reroll_row_get_size ( void  )
static

Get size of the row with the "Reroll" button.

Returns
Always 1, because there is only the "Reroll" button on that row.

Definition at line 470 of file shop.c.

◆ shop_reroll_row_on_key_transit()

static void shop_reroll_row_on_key_transit ( SelectionGrid *  selection_grid,
Selection *  selection 
)
static

Handle button inputs for the "Reroll" button's row.

Definition at line 556 of file shop.c.

◆ shop_reroll_row_on_selection_changed()

static bool shop_reroll_row_on_selection_changed ( SelectionGrid *  selection_grid,
int  row_idx,
const Selection *  prev_selection,
const Selection *  new_selection 
)
static

Handle d-pad inputs for the "Reroll" button's row.

Definition at line 478 of file shop.c.

◆ shop_reset()

void shop_reset ( void  )

Initialize the shop for a run. Resets all the shop data for the run, needs to be called once per run.

Definition at line 211 of file shop.c.

◆ shop_set_reroll_cost()

void shop_set_reroll_cost ( int  cost)

Set the current cost to reroll the items sold in the shop to the given value.

Parameters
costnew reroll price for the shop

Definition at line 206 of file shop.c.

◆ shop_show_item_desc_on_init()

static void shop_show_item_desc_on_init ( void  )
static

Definition at line 638 of file shop.c.

◆ shop_show_item_desc_on_update()

static void shop_show_item_desc_on_update ( void  )
static

Definition at line 675 of file shop.c.

◆ shop_top_row_get_size()

static int shop_top_row_get_size ( void  )
static

Computes the number of Jokers up for sale, aka the number of "buttons" there are on the top row of the Shop.

Definition at line 367 of file shop.c.

◆ shop_top_row_on_key_transit()

static void shop_top_row_on_key_transit ( SelectionGrid *  selection_grid,
Selection *  selection 
)
static

Handle button inputs for the "Next Round" button and shop Jokers.

Definition at line 392 of file shop.c.

◆ shop_top_row_on_selection_changed()

static bool shop_top_row_on_selection_changed ( SelectionGrid *  selection_grid,
int  row_idx,
const Selection *  prev_selection,
const Selection *  new_selection 
)
static

Handle d-pad inputs for the "Next Round" button and shop Jokers' row.

Definition at line 418 of file shop.c.

Variable Documentation

◆ ITEM_DESC_9_PTCH_SRC

const NinePatchRect ITEM_DESC_9_PTCH_SRC
static
Initial value:
= {
.patch_rect = { 27, 25, 31, 31},
.margins = { 2, 3, 2, 3}
}

Definition at line 75 of file shop.c.

◆ ITEM_DESC_9_PTCH_TO_RECT

const Rect ITEM_DESC_9_PTCH_TO_RECT = { 9, 6, 28, 18}
static

Definition at line 74 of file shop.c.

◆ ITEM_DESC_MAX_TEXT_HEIGHT

const int ITEM_DESC_MAX_TEXT_HEIGHT
static
Initial value:
= ITEM_DESC_9_PTCH_TO_RECT.bottom -
ITEM_DESC_9_PTCH_TO_RECT.top + 1 -
ITEM_DESC_9_PTCH_SRC.margins.top -
ITEM_DESC_9_PTCH_SRC.margins.bottom

Definition at line 79 of file shop.c.

◆ ITEM_DESC_TEXT_RECT

const Rect ITEM_DESC_TEXT_RECT = { 11, 9, 26, 18}
static

Definition at line 83 of file shop.c.

◆ ITEM_DESCRIPTION_SPRITE_POS

const BG_POINT ITEM_DESCRIPTION_SPRITE_POS = {135, 9}
static

Definition at line 88 of file shop.c.

◆ ITEM_NAME_TEXT_RECT

const Rect ITEM_NAME_TEXT_RECT = { 10, 7, 27, 7}
static

Definition at line 84 of file shop.c.

◆ next_round_button

Button next_round_button
static
Initial value:
=
{NEXT_ROUND_BTN_SELECTED_BORDER_PAL_IDX, NEXT_ROUND_BTN_PAL_IDX, next_round_on_pressed, NULL}

Definition at line 174 of file shop.c.

◆ OWNED_CONSUMABLES_PANEL_RECT

const Rect OWNED_CONSUMABLES_PANEL_RECT = { 23, 1, 28, 5}
static

Definition at line 71 of file shop.c.

◆ OWNED_ITEMS_PANEL_3X3_SRC_POS

const BG_POINT OWNED_ITEMS_PANEL_3X3_SRC_POS = { 29, 21}
static

Definition at line 69 of file shop.c.

◆ OWNED_ITEMS_PANEL_ANIM_CLEAR

const Rect OWNED_ITEMS_PANEL_ANIM_CLEAR = { 9, 0, 28, 1}
static

Definition at line 73 of file shop.c.

◆ OWNED_ITEMS_PANEL_RECT

const Rect OWNED_ITEMS_PANEL_RECT = { 9, 1, 28, 5}
static

Definition at line 72 of file shop.c.

◆ OWNED_JOKERS_PANEL_RECT

const Rect OWNED_JOKERS_PANEL_RECT = { 9, 1, 21, 5}
static

Definition at line 70 of file shop.c.

◆ reroll_button

Button reroll_button
static
Initial value:
= {
REROLL_BTN_SELECTED_BORDER_PAL_IDX,
REROLL_BTN_PAL_IDX,
reroll_on_pressed,
reroll_can_be_pressed
}

Definition at line 176 of file shop.c.

◆ s_description_item

Item* s_description_item = NULL
static

Definition at line 191 of file shop.c.

◆ s_description_item_original_x_pos

FIXED s_description_item_original_x_pos = UNDEFINED
static

Definition at line 192 of file shop.c.

◆ s_description_item_original_y_pos

FIXED s_description_item_original_y_pos = UNDEFINED
static

Definition at line 193 of file shop.c.

◆ s_reroll_cost

int s_reroll_cost = REROLL_BASE_COST
static

Definition at line 187 of file shop.c.

◆ s_shop_items_list

List s_shop_items_list = LIST_DEFAULT
static

Definition at line 93 of file shop.c.

◆ s_show_description_anim_progress

int s_show_description_anim_progress = 0
static

Definition at line 194 of file shop.c.

◆ s_timer

int s_timer
static

Definition at line 185 of file shop.c.

◆ SHOP_ICON_FROM_RECT

const Rect SHOP_ICON_FROM_RECT = { 0, 26, 8, 26}
static

Definition at line 67 of file shop.c.

◆ SHOP_ICON_TO_POS

const BG_POINT SHOP_ICON_TO_POS = { 0, 0}
static

Definition at line 68 of file shop.c.

◆ SHOP_INIT_SEL

const Selection SHOP_INIT_SEL = {-1, 1}
static

Definition at line 161 of file shop.c.

◆ SHOP_JOKER_SPRITES_INIT_POS

const BG_POINT SHOP_JOKER_SPRITES_INIT_POS = {120, 160}
static

Definition at line 87 of file shop.c.

◆ SHOP_PRICES_TEXT_RECT

const Rect SHOP_PRICES_TEXT_RECT = { 72, 56, 192, 160 }
static

Definition at line 89 of file shop.c.

◆ SHOP_REROLL_RECT

const Rect SHOP_REROLL_RECT = { 88, 96, UNDEFINED, UNDEFINED }
static

Definition at line 90 of file shop.c.

◆ shop_selection_grid

SelectionGrid shop_selection_grid
static
Initial value:
= {
shop_selection_rows,
NUM_ELEM_IN_ARR(shop_selection_rows),
SHOP_INIT_SEL
}
#define NUM_ELEM_IN_ARR(arr)
Get the number of elements in an array.
Definition util.h:55

Definition at line 163 of file shop.c.

◆ shop_selection_rows

SelectionGridRow shop_selection_rows[]
static
Initial value:
= {
{0, jokers_sel_row_get_size, jokers_sel_row_on_selection_changed, jokers_sel_row_on_key_transit, {.wrap = false, .has_h_exit_idx = false, .h_exit_idx = 0}},
{1, shop_top_row_get_size, shop_top_row_on_selection_changed, shop_top_row_on_key_transit, {.wrap = false, .has_h_exit_idx = false, .h_exit_idx = 0}},
{2, shop_reroll_row_get_size, shop_reroll_row_on_selection_changed, shop_reroll_row_on_key_transit, {.wrap = false, .has_h_exit_idx = true, .h_exit_idx = 1} },
}
bool jokers_sel_row_on_selection_changed(SelectionGrid *selection_grid, int row_idx, const Selection *prev_selection, const Selection *new_selection)
Handle directional inputs on the Jokers' row at the top of the game screen.
Definition joker_row.c:16
void jokers_sel_row_on_key_transit(SelectionGrid *selection_grid, Selection *selection)
Handle button inputs on the Jokers' row at the top of the game screen.
Definition joker_row.c:92
int jokers_sel_row_get_size(void)
Returns the size of the Jokers' row at the top of the game screen. Is equal to the number of Jokers o...
Definition joker_row.c:11
static bool shop_reroll_row_on_selection_changed(SelectionGrid *selection_grid, int row_idx, const Selection *prev_selection, const Selection *new_selection)
Handle d-pad inputs for the "Reroll" button's row.
Definition shop.c:478
static void shop_top_row_on_key_transit(SelectionGrid *selection_grid, Selection *selection)
Handle button inputs for the "Next Round" button and shop Jokers.
Definition shop.c:392
static bool shop_top_row_on_selection_changed(SelectionGrid *selection_grid, int row_idx, const Selection *prev_selection, const Selection *new_selection)
Handle d-pad inputs for the "Next Round" button and shop Jokers' row.
Definition shop.c:418
static int shop_reroll_row_get_size(void)
Get size of the row with the "Reroll" button.
Definition shop.c:470
static int shop_top_row_get_size(void)
Computes the number of Jokers up for sale, aka the number of "buttons" there are on the top row of th...
Definition shop.c:367
static void shop_reroll_row_on_key_transit(SelectionGrid *selection_grid, Selection *selection)
Handle button inputs for the "Reroll" button's row.
Definition shop.c:556

Definition at line 155 of file shop.c.

◆ shop_sm

StateMachine shop_sm = STATE_MACHINE_DEFINE(shop_state_actions, GAME_SHOP_MAX)
static

Definition at line 131 of file shop.c.

◆ shop_state_actions

StateInfo shop_state_actions[GAME_SHOP_MAX]
static
Initial value:
= {
[GAME_SHOP_SKIP_TAGS] = STATE_INFO_UPDATE_FN_ONLY(shop_redeem_skip_tags),
[GAME_SHOP_INTRO] = STATE_INFO_UPDATE_FN_ONLY(shop_intro),
[GAME_SHOP_ACTIVE] = STATE_INFO_UPDATE_FN_ONLY(shop_process_user_input),
[GAME_SHOP_SHOW_ITEM_DESC] = STATE_INFO_INIT_UPDATE_FN(
shop_show_item_desc_on_init,
shop_show_item_desc_on_update),
[GAME_SHOP_HIDE_ITEM_DESC] = {.on_init = shop_hide_item_desc_on_init,
.on_update = shop_hide_item_desc_on_update,
.on_exit = shop_hide_item_desc_on_exit},
[GAME_SHOP_EXIT] = STATE_INFO_UPDATE_FN_ONLY(shop_outro),
}
static void shop_outro(void)
Outro sequence substate update. This makes the menu and shop icon go out of frame.
Definition shop.c:855
static void shop_intro(void)
Intro sequence (menu and shop icon coming into frame)
Definition shop.c:320
static void shop_process_user_input(void)
Handle user inputs logic in the Shop though a SelectionGrid.
Definition shop.c:590

Definition at line 117 of file shop.c.