GBAlatro
A Demake of Balatro for the GBA
Loading...
Searching...
No Matches
game.h
1#ifndef GAME_H
2#define GAME_H
3
4#include "game/common_ui.h"
5#include "game_variables.h"
6#include "graphic_utils.h"
7#include "item.h"
8
9#include <tonc.h>
10
11#define MAX_DECK_SIZE 52
12#define MAX_JOKERS_HELD_SIZE 5 // This doesn't account for negatives right now.
13#define MAX_SHOP_ITEMS 2 // TODO: Make this dynamic
14#define FRAMES(x) (((x) + (g_game_vars.game_speed) - 1) / (g_game_vars.game_speed))
15
16// TODO: Can make these dynamic to support interest-related jokers and vouchers
17#define MAX_INTEREST 5
18#define INTEREST_PER_5 1
19
20// Input bindings
21#define SELECT_CARD KEY_A
22#define DESELECT_CARDS KEY_B
23#define PEEK_DECK KEY_L // Not implemented
24#define SORT_HAND KEY_R
25#define PAUSE_GAME KEY_START // Not implemented
26#define SELL_KEY KEY_L
27#define TAB_LEFT KEY_L
28#define TAB_RIGHT KEY_R
29
30// Matching the position of the on-screen buttons
31#define PLAY_HAND_KEY KEY_L
32// Same value as SELL_KEY - activated on the joker row, while this is activated on the hand row
33
34#define DISCARD_HAND_KEY KEY_R
35
36struct List;
37typedef struct List List;
38
39// Utility functions for other files
40typedef struct CardObject CardObject;
41typedef struct Card Card;
42typedef struct JokerObject JokerObject;
43
44// Enum value names in ../include/def_state_info_table.h
45enum GameState
46{
47#define DEF_STATE_INFO(stateEnum, on_init, on_update, on_exit) stateEnum,
48#include "def_state_info_table.h"
49#undef DEF_STATE_INFO
50 GAME_STATE_MAX,
51 GAME_STATE_UNDEFINED
52};
53
54// Game functions
55void game_init(void);
56
65void game_reset(void);
66
67void game_update(void);
68void game_change_state(enum GameState new_game_state);
69enum GameState game_get_state(void);
70
71bool is_joker_owned(int joker_id);
72bool joker_object_can_acquire(Item* item);
73bool card_is_face(Card* card);
74void add_joker(JokerObject* joker_object);
75void remove_owned_joker(int owned_joker_idx);
76List* get_jokers_list(void);
77List* get_expired_jokers_list(void);
78
83void item_start_discard_animation(Item* item);
84
85int deck_get_size(void);
86int get_deck_top(void);
87void deck_push(Card* card);
88Card* deck_pop(void);
89void deck_shuffle(void);
90int get_num_discards_remaining(void);
91int get_num_hands_remaining(void);
92
93void display_deck_size_max(void);
94void display_chips(void);
95void display_mult(void);
96void display_money(void);
97void display_ante(void);
98
99// joker specific functions
100bool is_shortcut_joker_active(void);
101int get_straight_and_flush_size(void);
102
103void game_start(void);
104
105void display_round(void);
106void display_hands(void);
107void display_discards(void);
108void display_temp_score(u32 value);
109void erase_temp_score(void);
110void display_score(u32 value);
111
112#endif // GAME_H
Common functions to render UI elements.
Game global game variables struct definition.
Graphic utility functions.
The core structure for items in the shop and inventory. Provides a common API for the shop and invent...
Definition card.h:46
A generic interface for all items that can appear in the shop or be in the inventory....
Definition item.h:83
A doubly-linked list.
Definition list.h:61