19 const Selection* prev_selection,
20 const Selection* new_selection
23 List* owned_jokers_list = get_jokers_list();
27 key_is_down(SELECT_CARD) && new_selection->y == row_idx && prev_selection->y == row_idx;
29 if (prev_selection->y == row_idx)
34 if (joker_object != NULL && !swapping)
41 if (new_selection->y == row_idx)
45 if (joker_object != NULL)
54 if (!key_is_down(SELECT_CARD))
58 joker_get_sell_value(joker_object->joker)
68 (
unsigned int)prev_selection->x,
69 (
unsigned int)new_selection->x
76static inline void joker_start_discard_animation(
JokerObject* joker_object)
78 joker_object->tx = int2fx(JOKER_DISCARD_TARGET.x);
79 joker_object->ty = int2fx(JOKER_DISCARD_TARGET.y);
83static inline void game_sell_joker(
int joker_idx)
85 List* owned_jokers_list = get_jokers_list();
87 if (joker_idx < 0 || joker_idx >=
list_get_len(owned_jokers_list))
91 g_game_vars.money += joker_get_sell_value(joker_object->joker);
95 remove_owned_joker(joker_idx);
97 joker_start_discard_animation(joker_object);
103 if (joker_object != NULL)
105 if (key_hit(SELECT_CARD))
109 else if (key_released(SELECT_CARD))
113 joker_get_sell_value(joker_object->joker)
118 if (key_hit(SELL_KEY))
120 int sold_joker_idx = selection->x;
126 game_sell_joker(sold_joker_idx);
Game global game variables struct definition.
Functions relative to the handling of Jokers.
All the functions used specifically to interact with Jokers. This includes browsing,...
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.
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.
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...
Header of shared rects and points needed for ui.
bool list_swap(List *list, unsigned int idx_a, unsigned int idx_b)
void * list_get_at_idx(List *list, unsigned int idx)
int list_get_len(const List *list)
void list_push_back(List *list, void *data)
void selection_grid_move_selection_vert(SelectionGrid *selection_grid, int direction_tribool)
Moves the selection vertically within the selection grid.
Sprite system for Gbalatro.
void sprite_object_set_focus(SpriteObject *sprite_object, bool focus)
Set the focus for SpriteObject Raises the object by SPRITE_FOCUS_RAISE_PX.
void sprite_object_print_price_under(SpriteObject *sprite_object, int price)
Print the price string directly beneath a SpriteObject. More specialized version of sprite_object_pri...
void sprite_object_erase_text_under(SpriteObject *sprite_object)
Erase the text within the Rect directly beneath a SpriteObject. This is used only for Cards for now.
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.
Utilities relating around number string representation and protected arithmatic helper functions.