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 MAX_SELECTION_SIZE 5
15#define FRAMES(x) (((x) + (g_game_vars.game_speed) - 1) / (g_game_vars.game_speed))
16
17// TODO: Can make these dynamic to support interest-related jokers and vouchers
18#define MAX_INTEREST 5
19#define INTEREST_PER_5 1
20
21// Input bindings
22#define SELECT_CARD KEY_A
23#define DESELECT_CARDS KEY_B
24#define PEEK_DECK KEY_L // Not implemented
25#define SORT_HAND KEY_R
26#define PAUSE_GAME KEY_START // Not implemented
27#define SELL_KEY KEY_L
28#define TAB_LEFT KEY_L
29#define TAB_RIGHT KEY_R
30
31// Matching the position of the on-screen buttons
32#define PLAY_HAND_KEY KEY_L
33// Same value as SELL_KEY - activated on the joker row, while this is activated on the hand row
34
35#define DISCARD_HAND_KEY KEY_R
36
37struct List;
38typedef struct List List;
39
40// Utility functions for other files
41typedef struct CardObject CardObject;
42typedef struct Card Card;
43typedef struct JokerObject JokerObject;
44
45// Enum value names in ../include/def_state_info_table.h
46enum GameState
47{
48#define DEF_STATE_INFO(stateEnum, on_init, on_update, on_exit) stateEnum,
49#include "def_state_info_table.h"
50#undef DEF_STATE_INFO
51 GAME_STATE_MAX,
52 GAME_STATE_UNDEFINED
53};
54
55// Game functions
56void game_init(void);
57
66void game_reset(void);
67
68void game_update(void);
69void game_change_state(enum GameState new_game_state);
70enum GameState game_get_state(void);
71
72bool is_joker_owned(int joker_id);
73bool joker_object_can_acquire(Item* item);
74bool card_is_face(Card* card);
75void add_joker(JokerObject* joker_object);
76void remove_owned_joker(int owned_joker_idx);
77List* get_jokers_list(void);
78List* get_expired_jokers_list(void);
79List* get_discarded_jokers_list(void);
80
81int deck_get_size(void);
82int get_deck_top(void);
83void deck_push(Card* card);
84Card* deck_pop(void);
85void deck_shuffle(void);
86int get_num_discards_remaining(void);
87int get_num_hands_remaining(void);
88
89void display_deck_size_max(void);
90void display_chips(void);
91void display_mult(void);
92void display_money(void);
93void display_ante(void);
94
95// joker specific functions
96bool is_shortcut_joker_active(void);
97int get_straight_and_flush_size(void);
98
99void game_start(void);
100
101void display_round(void);
102void display_hands(void);
103void display_discards(void);
104void display_temp_score(u32 value);
105void erase_temp_score(void);
106void display_score(u32 value);
107
108#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:50
A generic interface for all items that can appear in the shop or be in the inventory....
Definition item.h:76
A doubly-linked list.
Definition list.h:61