GBAlatro
A Demake of Balatro for the GBA
Loading...
Searching...
No Matches
deck_types.c
Go to the documentation of this file.
1
6#include "deck_types.h"
7
8#include "game.h"
9
10#include <tonc.h>
11
12#define TTE_COLOR_TEXT_FORMAT "#{cx:0x%X000}%s"
13
17static const char DECK_NAMES[DECK_TYPE_MAX][DECK_NAME_LENGTH] = {
18 " Red Deck ",
19 " Blue Deck ",
20 " Yellow Deck ",
21 " Green Deck ",
22 " Black Deck ",
23 "Painted Deck "
24};
25
26static void print_desc_red_deck(BG_POINT pos);
27static void print_desc_blue_deck(BG_POINT pos);
28static void print_desc_yellow_deck(BG_POINT pos);
29static void print_desc_green_deck(BG_POINT pos);
30static void print_desc_black_deck(BG_POINT pos);
31static void print_desc_painted_deck(BG_POINT pos);
32
33typedef void (*PrintDescCallback)(BG_POINT);
34static const PrintDescCallback deck_description_functions[DECK_TYPE_MAX] = {
41};
42
43void print_deck_name(enum DeckType deck, BG_POINT pos)
44{
45 tte_printf("#{P:%d,%d; cx:0x%X000}%s", pos.x, pos.y, TTE_WHITE_PB, DECK_NAMES[deck]);
46}
47
48void print_deck_description(enum DeckType deck, BG_POINT pos)
49{
50 if (deck_description_functions[deck] == NULL)
51 return;
52
53 deck_description_functions[deck](pos);
54}
55
63static inline void print_empty_desc_line(int pos_x, int pos_y)
64{
65 tte_printf("#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT, pos_x, pos_y, TTE_BLACK_PB, " ");
66}
67
79static void print_desc_red_deck(BG_POINT pos)
80{
81 print_empty_desc_line(pos.x, pos.y);
82 tte_printf(
83 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT,
84 pos.x,
85 pos.y + TILE_SIZE,
86 TTE_RED_PB,
87 " +1 ",
88 TTE_BLACK_PB,
89 "discard "
90 );
91 tte_printf(
92 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT,
93 pos.x,
94 pos.y + 2 * TILE_SIZE,
95 TTE_BLACK_PB,
96 " every Round "
97 );
98 print_empty_desc_line(pos.x, pos.y + 3 * TILE_SIZE);
99 print_empty_desc_line(pos.x, pos.y + 4 * TILE_SIZE);
100}
101
113static void print_desc_blue_deck(BG_POINT pos)
114{
115 print_empty_desc_line(pos.x, pos.y);
116 tte_printf(
117 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT,
118 pos.x,
119 pos.y + TILE_SIZE,
120 TTE_BLUE_PB,
121 " +1 ",
122 TTE_BLACK_PB,
123 "hand "
124 );
125 tte_printf(
126 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT,
127 pos.x,
128 pos.y + 2 * TILE_SIZE,
129 TTE_BLACK_PB,
130 " every Round "
131 );
132 print_empty_desc_line(pos.x, pos.y + 3 * TILE_SIZE);
133 print_empty_desc_line(pos.x, pos.y + 4 * TILE_SIZE);
134}
135
147static void print_desc_yellow_deck(BG_POINT pos)
148{
149 print_empty_desc_line(pos.x, pos.y);
150 tte_printf(
151 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT,
152 pos.x,
153 pos.y + TILE_SIZE,
154 TTE_BLACK_PB,
155 " Start with "
156 );
157 tte_printf(
158 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT,
159 pos.x,
160 pos.y + 2 * TILE_SIZE,
161 TTE_BLACK_PB,
162 "an extra",
163 TTE_YELLOW_PB,
164 " $10 "
165 );
166 print_empty_desc_line(pos.x, pos.y + 3 * TILE_SIZE);
167 print_empty_desc_line(pos.x, pos.y + 4 * TILE_SIZE);
168}
169
181static void print_desc_green_deck(BG_POINT pos)
182{
183 tte_printf("#{P:%d,%d; cx:0x%X000}%s", pos.x, pos.y, TTE_BLACK_PB, "End of Round:");
184 print_empty_desc_line(pos.x, pos.y + TILE_SIZE);
185 tte_printf(
186 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT
187 TTE_COLOR_TEXT_FORMAT,
188 pos.x,
189 pos.y + 2 * TILE_SIZE,
190 TTE_BLACK_PB,
191 "-",
192 TTE_YELLOW_PB,
193 "$2 ",
194 TTE_BLACK_PB,
195 "per ",
196 TTE_RED_PB,
197 "Hand "
198 );
199 tte_printf(
200 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT
201 TTE_COLOR_TEXT_FORMAT,
202 pos.x,
203 pos.y + 3 * TILE_SIZE,
204 TTE_BLACK_PB,
205 "-",
206 TTE_YELLOW_PB,
207 "$1 ",
208 TTE_BLACK_PB,
209 "per ",
210 TTE_BLUE_PB,
211 "Disc."
212 );
213 tte_printf(
214 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT,
215 pos.x,
216 pos.y + 4 * TILE_SIZE,
217 TTE_BLACK_PB,
218 "-No ",
219 TTE_YELLOW_PB,
220 "Interest "
221 );
222}
223
235static void print_desc_black_deck(BG_POINT pos)
236{
237 tte_printf(
238 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT,
239 pos.x,
240 pos.y,
241 TTE_YELLOW_PB,
242 "+1 ",
243 TTE_BLACK_PB,
244 "Joker slot"
245 );
246 print_empty_desc_line(pos.x, pos.y + TILE_SIZE);
247 tte_printf(
248 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT,
249 pos.x,
250 pos.y + 2 * TILE_SIZE,
251 TTE_BLUE_PB,
252 " -1 ",
253 TTE_BLACK_PB,
254 "hand "
255 );
256 tte_printf(
257 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT,
258 pos.x,
259 pos.y + 3 * TILE_SIZE,
260 TTE_BLACK_PB,
261 " every Round "
262 );
263 print_empty_desc_line(pos.x, pos.y + 4 * TILE_SIZE);
264}
265
277static void print_desc_painted_deck(BG_POINT pos)
278{
279 print_empty_desc_line(pos.x, pos.y);
280 tte_printf(
281 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT,
282 pos.x,
283 pos.y + TILE_SIZE,
284 TTE_YELLOW_PB,
285 "+2 ",
286 TTE_BLACK_PB,
287 "Hand size "
288 );
289 tte_printf(
290 "#{P:%d,%d}" TTE_COLOR_TEXT_FORMAT TTE_COLOR_TEXT_FORMAT,
291 pos.x,
292 pos.y + 2 * TILE_SIZE,
293 TTE_RED_PB,
294 "-1 ",
295 TTE_BLACK_PB,
296 "Joker slot"
297 );
298 print_empty_desc_line(pos.x, pos.y + 3 * TILE_SIZE);
299 print_empty_desc_line(pos.x, pos.y + 4 * TILE_SIZE);
300}
static void print_desc_yellow_deck(BG_POINT pos)
Print the decription of the Yellow Deck.
Definition deck_types.c:147
void print_deck_name(enum DeckType deck, BG_POINT pos)
Prints the Deck name string to the screen at the given position.
Definition deck_types.c:43
static void print_desc_black_deck(BG_POINT pos)
Print the decription of the Black Deck.
Definition deck_types.c:235
static void print_empty_desc_line(int pos_x, int pos_y)
Print an empty string of 13 characters long at given coordinates. Reduces boilerplate in deck descrip...
Definition deck_types.c:63
static void print_desc_painted_deck(BG_POINT pos)
Print the decription of the Painted Deck.
Definition deck_types.c:277
static void print_desc_blue_deck(BG_POINT pos)
Print the decription of the Blue Deck.
Definition deck_types.c:113
static void print_desc_green_deck(BG_POINT pos)
Print the decription of the Green Deck.
Definition deck_types.c:181
static const char DECK_NAMES[DECK_TYPE_MAX][DECK_NAME_LENGTH]
List of DeckType names, all formatted to be centered in a string of 13 characters.
Definition deck_types.c:17
static void print_desc_red_deck(BG_POINT pos)
Print the decription of the Red Deck.
Definition deck_types.c:79
void print_deck_description(enum DeckType deck, BG_POINT pos)
Prints the Deck description string to the screen at the given position.
Definition deck_types.c:48
Functions related to the different types of Decks.
#define TILE_SIZE
Tile size in pixels, both height and width as tiles are square.