diff --git a/affine__background_8c_source.html b/affine__background_8c_source.html index 417f03a5..7d069604 100644 --- a/affine__background_8c_source.html +++ b/affine__background_8c_source.html @@ -151,10 +151,10 @@ $(document).ready(function(){initNavTree('affine__background_8c_source.html','')
11// done in VBLANK so the HBLANK code can just fetch the values quickly.
12static IWRAM_CODE void s_affine_background_prep_bgaff_arr();
13
-
14static BG_AFFINE _bgaff_arr[SCREEN_HEIGHT + 1];
-
15static AFF_SRC_EX _asx = {0};
-
16static enum AffineBackgroundID _background = AFFINE_BG_NONE;
-
17static uint _timer = 0;
+
14static BG_AFFINE s_bgaff_arr[SCREEN_HEIGHT + 1];
+
15static AFF_SRC_EX s_asx = {0};
+
16static enum AffineBackgroundID s_background = AFFINE_BG_NONE;
+
17static uint s_timer = 0;
18
19void affine_background_init()
@@ -176,7 +176,7 @@ $(document).ready(function(){initNavTree('affine__background_8c_source.html','')
33 }
34
35 // See comment in affine_background_prep_bgaff_arr()
-
36 REG_BG_AFFINE[AFFINE_BG_IDX] = _bgaff_arr[vcount + 1];
+
36 REG_BG_AFFINE[AFFINE_BG_IDX] = s_bgaff_arr[vcount + 1];
37}
38
@@ -189,21 +189,21 @@ $(document).ready(function(){initNavTree('affine__background_8c_source.html','')
44 }
45 else // Low quality mode without HBLANK interrupt
46 {
-
47 _asx.scr_x = 0;
-
48 _asx.scr_y = 0;
-
49 _asx.tex_x += 5;
-
50 _asx.tex_y += 12;
+
47 s_asx.scr_x = 0;
+
48 s_asx.scr_y = 0;
+
49 s_asx.tex_x += 5;
+
50 s_asx.tex_y += 12;
51 // Scale the sine value to fit in a s16
-
52 _asx.sx = ((lu_sin(_timer * 100)) >> 8) + 256;
+
52 s_asx.sx = ((lu_sin(s_timer * 100)) >> 8) + 256;
53 // Scale the sine value to fit in a s16
-
54 _asx.sy = ((lu_sin(_timer * 100 + 0x4000)) >> 8) + 256;
-
55 _asx.alpha = 0;
+
54 s_asx.sy = ((lu_sin(s_timer * 100 + 0x4000)) >> 8) + 256;
+
55 s_asx.alpha = 0;
56
-
57 bg_rotscale_ex(&_bgaff_arr[0], &_asx);
-
58 REG_BG_AFFINE[AFFINE_BG_IDX] = _bgaff_arr[0];
+
57 bg_rotscale_ex(&s_bgaff_arr[0], &s_asx);
+
58 REG_BG_AFFINE[AFFINE_BG_IDX] = s_bgaff_arr[0];
59 }
60
-
61 _timer++;
+
61 s_timer++;
62}
63
@@ -213,7 +213,7 @@ $(document).ready(function(){initNavTree('affine__background_8c_source.html','')
66 // Reload the palette to reset any previous color scaling.
67 // Take source color directly from `affine_background_gfxPal` to avoid excessive
68 // darkening in case this function is called twice by mistake.
-
69 affine_background_change_background(_background);
+
69 affine_background_change_background(s_background);
70 for (int i = 0; i < AFFINE_BG_PAL_LEN; i++)
71 {
72 clr_rgbscale(&pal_bg_mem[AFFINE_BG_PB] + i, affine_background_gfxPal + i, 1, color);
@@ -231,14 +231,14 @@ $(document).ready(function(){initNavTree('affine__background_8c_source.html','')
81void affine_background_change_background(enum AffineBackgroundID new_bg)
82{
-
83 if (_background == new_bg)
+
83 if (s_background == new_bg)
84 {
85 return;
86 }
87
-
88 _background = new_bg;
+
88 s_background = new_bg;
89
-
90 switch (_background)
+
90 switch (s_background)
91 {
92 case AFFINE_BG_MAIN_MENU:
93 REG_BG2CNT &= ~BG_AFF_32x32;
@@ -278,28 +278,28 @@ $(document).ready(function(){initNavTree('affine__background_8c_source.html','')
126{
127 for (u16 vcount = 0; vcount < SCREEN_HEIGHT; vcount++)
128 {
-
129 const s32 timer_s32 = _timer << 8;
+
129 const s32 timer_s32 = s_timer << 8;
130 const s32 vcount_s32 = vcount << 8;
131 const s16 vcount_s16 = vcount;
132 const s32 vcount_sine = lu_sin(vcount_s32 + timer_s32 / ANIMATION_SPEED_DIVISOR);
133
-
134 _asx.scr_x = (SCREEN_WIDTH / 2);
+
134 s_asx.scr_x = (SCREEN_WIDTH / 2);
135 // scr_y must equal vcount otherwise the background will have no vertical difference
-
136 _asx.scr_y = vcount_s16 - (SCREEN_HEIGHT / 2);
-
137 _asx.tex_x = (1000 * 1000) + (vcount_sine);
-
138 _asx.tex_y = (1000 * 1000);
-
139 _asx.sx = 128;
-
140 _asx.sy = 128;
-
141 _asx.alpha = vcount_sine + (timer_s32 / ANIMATION_SPEED_DIVISOR);
+
136 s_asx.scr_y = vcount_s16 - (SCREEN_HEIGHT / 2);
+
137 s_asx.tex_x = (1000 * 1000) + (vcount_sine);
+
138 s_asx.tex_y = (1000 * 1000);
+
139 s_asx.sx = 128;
+
140 s_asx.sy = 128;
+
141 s_asx.alpha = vcount_sine + (timer_s32 / ANIMATION_SPEED_DIVISOR);
142
-
143 bg_rotscale_ex(&_bgaff_arr[vcount], &_asx);
+
143 bg_rotscale_ex(&s_bgaff_arr[vcount], &s_asx);
144 }
145
146 /* HBLANK occurs after the scanline so REG_VCOUNT represents the
147 * the scanline that just passed, so when it's SCREEN_HEIGHT we will
148 * actually be updating the first line
149 */
-
150 _bgaff_arr[SCREEN_HEIGHT] = _bgaff_arr[0];
+
150 s_bgaff_arr[SCREEN_HEIGHT] = s_bgaff_arr[0];
151}
Utilities for affine background on GBA.
void affine_background_set_color(COLOR color)
Update the affine background color.
diff --git a/blind_8c_source.html b/blind_8c_source.html index 70cf7ec0..70523141 100644 --- a/blind_8c_source.html +++ b/blind_8c_source.html @@ -176,16 +176,16 @@ $(document).ready(function(){initNavTree('blind_8c_source.html',''); initResizab
36};
37
38// Bitfields storing blinds we have yet to beat during the current run
-
39static List unbeaten_boss_blinds;
-
40static List unbeaten_showdown_blinds;
+
39static List s_unbeaten_boss_blinds;
+
40static List s_unbeaten_showdown_blinds;
41
42// Maps the ante number to the base blind requirement for that ante.
43// The game starts at ante 1 which is at index 1 for base requirement 300.
44// Ante 0 is also there in case it is ever reached.
-
45static const u32 ante_lut[] = {100, 300, 800, 2000, 5000, 11000, 20000, 35000, 50000};
+
45static const u32 ANTE_LUT[] = {100, 300, 800, 2000, 5000, 11000, 20000, 35000, 50000};
46
47// clang-format off
-
48static Blind _blind_type_map[BLIND_TYPE_MAX] = {
+
48static Blind s_blind_type_map[BLIND_TYPE_MAX] = {
49 {BLIND_TYPE_SMALL, FIX_ONE, 3},
50 {BLIND_TYPE_BIG, (FIX_ONE * 3) / 2, 4},
51 {BLIND_TYPE_HOOK, FIX_ONE * 2, 5},
@@ -234,12 +234,12 @@ $(document).ready(function(){initNavTree('blind_8c_source.html',''); initResizab
94 if (ante < 0 || ante > MAX_ANTE)
95 ante = 0;
96
-
97 return fx2int(_blind_type_map[type].score_req_multipler * ante_lut[ante]);
+
97 return fx2int(s_blind_type_map[type].score_req_multipler * ANTE_LUT[ante]);
98}
99
100int blind_get_reward(enum BlindType type)
101{
-
102 return _blind_type_map[type].reward;
+
102 return s_blind_type_map[type].reward;
103}
104
105// Fills the unbeaten boss blinds lists
@@ -251,11 +251,11 @@ $(document).ready(function(){initNavTree('blind_8c_source.html',''); initResizab
111 if (!init)
112 {
113 init = true;
-
114 unbeaten_showdown_blinds = list_init();
-
115 unbeaten_boss_blinds = list_init();
+
114 s_unbeaten_showdown_blinds = list_init();
+
115 s_unbeaten_boss_blinds = list_init();
116 }
117
-
118 List* p_unbeaten_blinds = showdown ? &unbeaten_showdown_blinds : &unbeaten_boss_blinds;
+
118 List* p_unbeaten_blinds = showdown ? &s_unbeaten_showdown_blinds : &s_unbeaten_boss_blinds;
119
120 // empty the list just to be sure
121 list_clear(p_unbeaten_blinds);
@@ -265,13 +265,13 @@ $(document).ready(function(){initNavTree('blind_8c_source.html',''); initResizab
125
126 for (int i = lower_blind; i <= upper_blind; i++)
127 {
-
128 list_push_back(p_unbeaten_blinds, &_blind_type_map[i]);
+
128 list_push_back(p_unbeaten_blinds, &s_blind_type_map[i]);
129 }
130}
131
132enum BlindType roll_blind_type(bool showdown)
133{
-
134 List* p_unbeaten_blinds = showdown ? &unbeaten_showdown_blinds : &unbeaten_boss_blinds;
+
134 List* p_unbeaten_blinds = showdown ? &s_unbeaten_showdown_blinds : &s_unbeaten_boss_blinds;
135
136 // Fill the list with all blinds if it is empty
137 // (happens on startup or if we have beaten all blinds)
@@ -290,7 +290,7 @@ $(document).ready(function(){initNavTree('blind_8c_source.html',''); initResizab
150void set_blind_beaten(enum BlindType type)
151{
152 bool showdown = (type >= BLIND_TYPE_SHOWDOWN);
-
153 List* p_unbeaten_blinds = showdown ? &unbeaten_showdown_blinds : &unbeaten_boss_blinds;
+
153 List* p_unbeaten_blinds = showdown ? &s_unbeaten_showdown_blinds : &s_unbeaten_boss_blinds;
154
155 // find the beaten blind idx in the list
156 int beaten_idx = 0;
diff --git a/blind__select_8c_source.html b/blind__select_8c_source.html index 14435ba1..1efdf3d7 100644 --- a/blind__select_8c_source.html +++ b/blind__select_8c_source.html @@ -165,7 +165,7 @@ $(document).ready(function(){initNavTree('blind__select_8c_source.html',''); ini
25static const u32 TM_DISP_BLIND_PANEL_FINISH = 7;
26static const u32 TM_DISP_BLIND_PANEL_START = 1;
27
-
28static int timer;
+
28static int s_timer;
29
30static void game_blind_select_start_anim_seq(void);
31static void game_blind_select_handle_input(void);
@@ -237,11 +237,11 @@ $(document).ready(function(){initNavTree('blind__select_8c_source.html',''); ini
97 );
98 }
99
-
100 if (timer == TM_END_ANIM_SEQ)
+
100 if (s_timer == TM_END_ANIM_SEQ)
101 {
102 game_blind_select_print_blinds_reqs_and_rewards();
103 state_machine_change_state(&blind_select_sm, BLIND_SELECT);
-
104 timer = TM_ZERO; // Reset the timer
+
104 s_timer = TM_ZERO; // Reset the timer
105 }
106}
107
@@ -312,7 +312,7 @@ $(document).ready(function(){initNavTree('blind__select_8c_source.html',''); ini
172
173static void game_blind_select_handle_input()
174{
-
175 if (timer == TM_BLIND_SELECT_START && g_game_vars.current_blind == BLIND_TYPE_BOSS)
+
175 if (s_timer == TM_BLIND_SELECT_START && g_game_vars.current_blind == BLIND_TYPE_BOSS)
176 {
177 selection_y = BLIND_ROW;
178 }
@@ -337,7 +337,7 @@ $(document).ready(function(){initNavTree('blind__select_8c_source.html',''); ini
197 case BLIND_ROW:
198 play_sfx(SFX_BUTTON, MM_BASE_PITCH_RATE, BUTTON_SFX_VOLUME);
199 state_machine_change_state(&blind_select_sm, BLIND_SELECTED_ANIM_SEQ);
-
200 timer = TM_ZERO;
+
200 s_timer = TM_ZERO;
201 ++g_game_vars.round;
202 display_round();
203 break;
@@ -370,7 +370,7 @@ $(document).ready(function(){initNavTree('blind__select_8c_source.html',''); ini
230 game_blind_select_print_blinds_reqs_and_rewards();
231 highlight_select_button();
232
-
233 timer = TM_ZERO;
+
233 s_timer = TM_ZERO;
234 }
235 break;
236 default:
@@ -381,7 +381,7 @@ $(document).ready(function(){initNavTree('blind__select_8c_source.html',''); ini
241
242static void game_blind_select_selected_anim_seq()
243{
-
244 if (timer < 15)
+
244 if (s_timer < 15)
245 {
246 Rect blinds_rect = POP_MENU_ANIM_RECT;
247 blinds_rect.top -= 1; // Because of the raised blind
@@ -396,28 +396,28 @@ $(document).ready(function(){initNavTree('blind__select_8c_source.html',''); ini
256 );
257 }
258 }
-
259 else if (timer >= MENU_POP_OUT_ANIM_FRAMES)
+
259 else if (s_timer >= MENU_POP_OUT_ANIM_FRAMES)
260 {
261 for (int i = 0; i < NUM_BLINDS_PER_ANTE; i++)
262 {
263 obj_hide(blind_select_tokens[i]->obj);
264 }
265
-
266 timer = TM_ZERO;
+
266 s_timer = TM_ZERO;
267 state_machine_change_state(&blind_select_sm, DISPLAY_BLIND_PANEL);
268 }
269}
270
271static void game_blind_select_display_blind_panel()
272{
-
273 if (timer >= TM_DISP_BLIND_PANEL_FINISH)
+
273 if (s_timer >= TM_DISP_BLIND_PANEL_FINISH)
274 {
275 state_machine_change_state(&blind_select_sm, BLIND_SELECT_EXIT);
276 return;
277 }
278
279 // Switches to the selecting background and clears the blind panel area
-
280 if (timer == TM_DISP_BLIND_PANEL_START)
+
280 if (s_timer == TM_DISP_BLIND_PANEL_START)
281 {
282 change_background(BG_CARD_SELECTING, false);
283
@@ -435,9 +435,9 @@ $(document).ready(function(){initNavTree('blind__select_8c_source.html',''); ini
295 }
296
297 // Shift the blind panel down onto screen
-
298 for (int y = 0; y < timer; y++)
+
298 for (int y = 0; y < s_timer; y++)
299 {
-
300 int y_from = 26 + y - timer;
+
300 int y_from = 26 + y - s_timer;
301 int y_to = 0 + y;
302
303 Rect from = {0, y_from, 8, y_from};
@@ -592,7 +592,7 @@ $(document).ready(function(){initNavTree('blind__select_8c_source.html',''); ini
453{
-
454 timer = TM_ZERO;
+
454 s_timer = TM_ZERO;
455 state_machine_register(&blind_select_sm);
456 state_machine_change_state(&blind_select_sm, START_ANIM_SEQ);
457
@@ -615,7 +615,7 @@ $(document).ready(function(){initNavTree('blind__select_8c_source.html',''); ini
474{
-
475 timer++;
+
475 s_timer++;
476}
477
diff --git a/card_8c_source.html b/card_8c_source.html index c2b67303..667f7398 100644 --- a/card_8c_source.html +++ b/card_8c_source.html @@ -159,17 +159,17 @@ $(document).ready(function(){initNavTree('card_8c_source.html',''); initResizabl
19
20// Card sprites lookup table. First index is the suit, second index is the rank. The value is the
21// tile index.
-
22const static u16 _card_sprite_lut[NUM_SUITS][NUM_RANKS] = {
+
22const static u16 CARD_SPRITE_LUT[NUM_SUITS][NUM_RANKS] = {
23 {0, 16, 32, 48, 64, 80, 96, 112, 128, 144, 160, 176, 192},
24 {208, 224, 240, 256, 272, 288, 304, 320, 336, 352, 368, 384, 400},
25 {416, 432, 448, 464, 480, 496, 512, 528, 544, 560, 576, 592, 608},
26 {624, 640, 656, 672, 688, 704, 720, 736, 752, 768, 784, 800, 816}
27};
28// Deck sprites lookup table. Index is the deck Id. The value is the tile index.
-
29const static u16 _deck_sprite_lut[DECK_TYPE_MAX] = {0, 16, 32, 48, 64, 80};
+
29const static u16 DECK_SPRITE_LUT[DECK_TYPE_MAX] = {0, 16, 32, 48, 64, 80};
30
-
31bool high_contrast = DEFAULT_HIGH_CONTRAST;
-
32bool more_readable = DEFAULT_MORE_READABLE;
+
31static bool s_high_contrast = DEFAULT_HIGH_CONTRAST;
+
32static bool s_more_readable = DEFAULT_MORE_READABLE;
33
34void card_init()
35{
@@ -178,8 +178,8 @@ $(document).ready(function(){initNavTree('card_8c_source.html',''); initResizabl
38
39void set_cards_high_contrast(bool enable)
40{
-
41 high_contrast = enable;
-
42 if (high_contrast)
+
41 s_high_contrast = enable;
+
42 if (s_high_contrast)
43 {
44 GRIT_CPY(&pal_obj_mem[CARD_PB * PAL_ROW_LEN], high_contrast_deck_pal_gfxPal);
45 }
@@ -191,17 +191,17 @@ $(document).ready(function(){initNavTree('card_8c_source.html',''); initResizabl
51
52void set_cards_more_readable(bool enable)
53{
-
54 more_readable = enable;
+
54 s_more_readable = enable;
55}
56
57bool get_cards_high_contrast(void)
58{
-
59 return high_contrast;
+
59 return s_high_contrast;
60}
61
62bool get_cards_more_readable(void)
63{
-
64 return more_readable;
+
64 return s_more_readable;
65}
66
67// Card methods
@@ -264,10 +264,10 @@ $(document).ready(function(){initNavTree('card_8c_source.html',''); initResizabl
124void card_object_set_sprite(CardObject* card_object, int layer)
125{
126 int tile_index = CARD_TID + (layer * CARD_SPRITE_OFFSET);
-
127 const unsigned int* card_tiles = more_readable ? deck_big_gfxTiles : deck_gfxTiles;
+
127 const unsigned int* card_tiles = s_more_readable ? deck_big_gfxTiles : deck_gfxTiles;
128 memcpy32(
129 &tile_mem[TILE_MEM_OBJ_CHARBLOCK0_IDX][tile_index],
-
130 &card_tiles[_card_sprite_lut[card_object->card->suit][card_object->card->rank] * TILE_SIZE],
+
130 &card_tiles[CARD_SPRITE_LUT[card_object->card->suit][card_object->card->rank] * TILE_SIZE],
131 TILE_SIZE * CARD_SPRITE_OFFSET
132 );
133 Sprite* sprite = sprite_new(
@@ -285,7 +285,7 @@ $(document).ready(function(){initNavTree('card_8c_source.html',''); initResizabl
145 int tile_index = CARD_TID + (layer * CARD_SPRITE_OFFSET);
146 memcpy32(
147 &tile_mem[TILE_MEM_OBJ_CHARBLOCK0_IDX][tile_index],
-
148 &decks_face_down_gfxTiles[_deck_sprite_lut[deck] * TILE_SIZE],
+
148 &decks_face_down_gfxTiles[DECK_SPRITE_LUT[deck] * TILE_SIZE],
149 TILE_SIZE * CARD_SPRITE_OFFSET
150 );
151 Sprite* sprite = sprite_new(
diff --git a/common__ui_8c_source.html b/common__ui_8c_source.html index adbd3afb..9d4e1c6f 100644 --- a/common__ui_8c_source.html +++ b/common__ui_8c_source.html @@ -152,7 +152,7 @@ $(document).ready(function(){initNavTree('common__ui_8c_source.html',''); initRe
12
13typedef void (*BackgroundRenderCallback)(void);
14
-
15static enum BackgroundId background = BG_NONE;
+
15static enum BackgroundId s_background = BG_NONE;
16
17// Map to fill in for refactor
18static const BackgroundRenderCallback bgCallbacks[] = {
@@ -169,7 +169,7 @@ $(document).ready(function(){initNavTree('common__ui_8c_source.html',''); initRe
29
30enum BackgroundId get_current_background(void)
31{
-
32 return background;
+
32 return s_background;
33}
34
@@ -177,13 +177,13 @@ $(document).ready(function(){initNavTree('common__ui_8c_source.html',''); initRe
36{
37 if (force_redraw)
38 {
-
39 background = BG_NONE;
+
39 s_background = BG_NONE;
40 }
-
41 if (id != background && bgCallbacks[id] != NULL)
+
41 if (id != s_background && bgCallbacks[id] != NULL)
42 {
43 bgCallbacks[id]();
44 }
-
45 background = id;
+
45 s_background = id;
46}
47
diff --git a/deck__types_8c.html b/deck__types_8c.html index c52bd15b..ac73a8b3 100644 --- a/deck__types_8c.html +++ b/deck__types_8c.html @@ -189,9 +189,9 @@ Functions - - - + + +

Variables

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.
 
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.
 
static const PrintDescCallback deck_description_functions [DECK_TYPE_MAX]
 
@@ -644,8 +644,8 @@ Variables
- -

◆ deck_names

+ +

◆ DECK_NAMES

@@ -654,7 +654,7 @@ Variables - +
const char deck_names[DECK_TYPE_MAX][DECK_NAME_LENGTH]const char DECK_NAMES[DECK_TYPE_MAX][DECK_NAME_LENGTH]
diff --git a/deck__types_8c.js b/deck__types_8c.js index f90ea14d..da910415 100644 --- a/deck__types_8c.js +++ b/deck__types_8c.js @@ -9,5 +9,5 @@ var deck__types_8c = [ "print_desc_red_deck", "deck__types_8c.html#ae06a285687193be23c00a00b209eb521", null ], [ "print_desc_yellow_deck", "deck__types_8c.html#a0428dc33e219e8dd950bf541b57a4ef7", null ], [ "print_empty_desc_line", "deck__types_8c.html#a72695ce33b02b8163efcd58a1d3190c2", null ], - [ "deck_names", "deck__types_8c.html#aa69c0508a53c09b17c5283a1e5be751a", null ] + [ "DECK_NAMES", "deck__types_8c.html#aca3bc778faeef112f513ae0a84c5e378", null ] ]; \ No newline at end of file diff --git a/deck__types_8c_source.html b/deck__types_8c_source.html index 37330e4d..36ceebac 100644 --- a/deck__types_8c_source.html +++ b/deck__types_8c_source.html @@ -148,7 +148,7 @@ $(document).ready(function(){initNavTree('deck__types_8c_source.html',''); initR
12#define TTE_COLOR_TEXT_FORMAT "#{cx:0x%X000}%s"
13
-
17static const char deck_names[DECK_TYPE_MAX][DECK_NAME_LENGTH] = {
+
17static const char DECK_NAMES[DECK_TYPE_MAX][DECK_NAME_LENGTH] = {
18 " Red Deck ",
19 " Blue Deck ",
20 " Yellow Deck ",
@@ -178,7 +178,7 @@ $(document).ready(function(){initNavTree('deck__types_8c_source.html',''); initR
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]);
+
45 tte_printf("#{P:%d,%d; cx:0x%X000}%s", pos.x, pos.y, TTE_WHITE_PB, DECK_NAMES[deck]);
46}
47
@@ -384,8 +384,8 @@ $(document).ready(function(){initNavTree('deck__types_8c_source.html',''); initR
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 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_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.
diff --git a/def__state__info__table_8h_source.html b/def__state__info__table_8h_source.html index 73a176ae..782049d4 100644 --- a/def__state__info__table_8h_source.html +++ b/def__state__info__table_8h_source.html @@ -165,17 +165,17 @@ $(document).ready(function(){initNavTree('def__state__info__table_8h_source.html
void game_options_menu_on_exit(void)
Options menu cleanup (called when going back to main menu)
void game_options_menu_on_init(void)
Options menu state initialization.
void game_options_menu_on_update(void)
Options menu state update.
-
void game_round_on_init(void)
Round state initialization.
Definition round.c:1970
-
void game_round_on_update(void)
Round state update.
Definition round.c:2041
+
void game_round_on_init(void)
Round state initialization.
Definition round.c:1975
+
void game_round_on_update(void)
Round state update.
Definition round.c:2046
void game_round_end_on_exit(void)
Round end cleanup.
Definition round_end.c:461
void game_round_end_on_init(void)
Round end state initialization.
Definition round_end.c:449
void game_round_end_on_update(void)
Round end state update.
Definition round_end.c:456
void game_run_setup_on_exit(void)
Run Setup menu cleanup.
Definition run_setup.c:628
void game_run_setup_on_update(void)
Run Setup menu state update.
Definition run_setup.c:623
void game_run_setup_on_init(void)
Run Setup menu state initialization.
Definition run_setup.c:576
-
void game_shop_on_exit(void)
Shop cleanup.
Definition shop.c:892
+
void game_shop_on_exit(void)
Shop cleanup.
Definition shop.c:893
void game_shop_on_init(void)
Shop state initialization.
Definition shop.c:216
-
void game_shop_on_update(void)
Shop state update.
Definition shop.c:882
+
void game_shop_on_update(void)
Shop state update.
Definition shop.c:883
void splash_screen_on_exit(void)
Exit the splash screen.
void splash_screen_on_update(void)
Update splash screen timers and print the remaining time accordingly.
void splash_screen_on_init(void)
Initialize the splash screen by printing the splash screen text.
diff --git a/font_8c_source.html b/font_8c_source.html index 649f6d3a..350bc557 100644 --- a/font_8c_source.html +++ b/font_8c_source.html @@ -144,7 +144,7 @@ $(document).ready(function(){initNavTree('font_8c_source.html',''); initResizabl
4
5#include <stdlib.h>
6
-
7static const char* s_font_point_lookup[] = {
+
7static const char* FONT_POINT_LOOKUP[] = {
8 FP0_STR,
9 FP1_STR,
10 FP2_STR,
@@ -161,7 +161,7 @@ $(document).ready(function(){initNavTree('font_8c_source.html',''); initResizabl
20const char* get_font_point_str(int val)
21{
22 val = abs(val) % 10;
-
23 return s_font_point_lookup[val];
+
23 return FONT_POINT_LOOKUP[val];
24}
25
diff --git a/game_8c_source.html b/game_8c_source.html index f31024cc..969e2ec4 100644 --- a/game_8c_source.html +++ b/game_8c_source.html @@ -269,31 +269,31 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
129};
130// clang-format on
131
-
132static List _owned_jokers_list;
-
133static List _discarded_jokers_list;
-
134static List _expired_jokers_list;
+
132static List s_owned_jokers_list;
+
133static List s_discarded_jokers_list;
+
134static List s_expired_jokers_list;
135
136// Stacks
-
137static Card* deck[MAX_DECK_SIZE] = {NULL};
-
138static int deck_top = -1;
+
137static Card* s_deck[MAX_DECK_SIZE] = {NULL};
+
138static int s_deck_top = -1;
139
140// Joker Special Variables
-
141static int shortcut_joker_count = 0;
+
141static int s_shortcut_joker_count = 0;
142
-
143static int four_fingers_joker_count = 0;
+
143static int s_four_fingers_joker_count = 0;
144
145void deck_push(Card* card)
146{
-
147 if (deck_top >= MAX_DECK_SIZE - 1)
+
147 if (s_deck_top >= MAX_DECK_SIZE - 1)
148 return;
-
149 deck[++deck_top] = card;
+
149 s_deck[++s_deck_top] = card;
150}
151
152Card* deck_pop(void)
153{
-
154 if (deck_top < 0)
+
154 if (s_deck_top < 0)
155 return NULL;
-
156 return deck[deck_top--];
+
156 return s_deck[s_deck_top--];
157}
158
159void display_ante(void)
@@ -314,9 +314,9 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
174 state_machine_remove(&game_sm);
175 state_machine_register(&game_sm);
176 // Initialize all jokers list once
-
177 _owned_jokers_list = list_init();
-
178 _discarded_jokers_list = list_init();
-
179 _expired_jokers_list = list_init();
+
177 s_owned_jokers_list = list_init();
+
178 s_discarded_jokers_list = list_init();
+
179 s_expired_jokers_list = list_init();
180 // TODO: Move this to an initialization of the play scoring states
181
@@ -347,9 +347,9 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
207
208void game_reset()
209{
-
210 while (list_get_len(&_owned_jokers_list) > 0)
+
210 while (list_get_len(&s_owned_jokers_list) > 0)
211 {
-
212 JokerObject* joker_object = list_get_at_idx(&_owned_jokers_list, 0);
+
212 JokerObject* joker_object = list_get_at_idx(&s_owned_jokers_list, 0);
213 remove_owned_joker(0);
214 joker_object_destroy(&joker_object);
215 }
@@ -362,9 +362,9 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
222 sprite_destroy(&g_game_vars.playing_blind_token);
223 sprite_destroy(&g_game_vars.round_end_blind_token);
224
-
225 list_clear(&_owned_jokers_list);
-
226 list_clear(&_discarded_jokers_list);
-
227 list_clear(&_expired_jokers_list);
+
225 list_clear(&s_owned_jokers_list);
+
226 list_clear(&s_discarded_jokers_list);
+
227 list_clear(&s_expired_jokers_list);
228
229 game_init();
230
@@ -383,12 +383,12 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
243
244static inline void discarded_jokers_update_loop(void)
245{
-
246 if (list_is_empty(&_discarded_jokers_list))
+
246 if (list_is_empty(&s_discarded_jokers_list))
247 {
248 return;
249 }
250
-
251 ListItr itr = list_itr_create(&_discarded_jokers_list);
+
251 ListItr itr = list_itr_create(&s_discarded_jokers_list);
252 JokerObject* joker_object;
253
254 while ((joker_object = list_itr_next(&itr)))
@@ -404,7 +404,7 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
264
265static inline void held_jokers_update_loop(void)
266{
-
267 static const int spacing_lut[MAX_JOKERS_HELD_SIZE][MAX_JOKERS_HELD_SIZE] = {
+
267 static const int SPACING_LUT[MAX_JOKERS_HELD_SIZE][MAX_JOKERS_HELD_SIZE] = {
268 {0, 0, 0, 0, 0 },
269 {13, -13, 0, 0, 0 },
270 {26, 0, -26, 0, 0 },
@@ -414,15 +414,15 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
274
275 FIXED hand_x = int2fx(HELD_JOKERS_POS.x);
276
-
277 ListItr itr = list_itr_create(&_owned_jokers_list);
+
277 ListItr itr = list_itr_create(&s_owned_jokers_list);
278 JokerObject* joker;
-
279 int jokers_top = list_get_len(&_owned_jokers_list) - 1;
+
279 int jokers_top = list_get_len(&s_owned_jokers_list) - 1;
280 int i = 0;
281 while ((joker = list_itr_next(&itr)))
282 {
283 // Let the Shop handle the position of this Joker
284 if (joker != game_shop_get_description_card())
-
285 joker->tx = hand_x - int2fx(spacing_lut[jokers_top][i]);
+
285 joker->tx = hand_x - int2fx(SPACING_LUT[jokers_top][i]);
286 i++;
287 }
288}
@@ -435,12 +435,12 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
295
296static inline void expired_jokers_update_loop(void)
297{
-
298 if (list_is_empty(&_expired_jokers_list))
+
298 if (list_is_empty(&s_expired_jokers_list))
299 {
300 return;
301 }
302
-
303 ListItr itr = list_itr_create(&_expired_jokers_list);
+
303 ListItr itr = list_itr_create(&s_expired_jokers_list);
304 JokerObject* joker_object;
305
306 while ((joker_object = list_itr_next(&itr)))
@@ -450,7 +450,7 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
310 {
311 // get joker idx
312 int expired_joker_idx = 0;
-
313 ListItr joker_itr = list_itr_create(&_owned_jokers_list);
+
313 ListItr joker_itr = list_itr_create(&s_owned_jokers_list);
314 JokerObject* expired_joker;
315 while ((expired_joker = list_itr_next(&joker_itr)) && expired_joker != joker_object)
316 {
@@ -502,7 +502,7 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
362
363bool is_joker_owned(int joker_id)
364{
-
365 ListItr itr = list_itr_create(&_owned_jokers_list);
+
365 ListItr itr = list_itr_create(&s_owned_jokers_list);
366 JokerObject* joker;
367
368 while ((joker = list_itr_next(&itr)))
@@ -517,72 +517,72 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
377
378List* get_jokers_list(void)
379{
-
380 return &_owned_jokers_list;
+
380 return &s_owned_jokers_list;
381}
382
383List* get_expired_jokers_list(void)
384{
-
385 return &_expired_jokers_list;
+
385 return &s_expired_jokers_list;
386}
387
388List* get_discarded_jokers_list(void)
389{
-
390 return &_discarded_jokers_list;
+
390 return &s_discarded_jokers_list;
391}
392
393bool is_shortcut_joker_active(void)
394{
-
395 return shortcut_joker_count > 0;
+
395 return s_shortcut_joker_count > 0;
396}
397
398int get_straight_and_flush_size(void)
399{
-
400 return four_fingers_joker_count > 0 ? STRAIGHT_AND_FLUSH_SIZE_FOUR_FINGERS
-
401 : STRAIGHT_AND_FLUSH_SIZE_DEFAULT;
+
400 return s_four_fingers_joker_count > 0 ? STRAIGHT_AND_FLUSH_SIZE_FOUR_FINGERS
+
401 : STRAIGHT_AND_FLUSH_SIZE_DEFAULT;
402}
403
404void add_joker(JokerObject* joker_object)
405{
-
406 list_push_back(&_owned_jokers_list, joker_object);
+
406 list_push_back(&s_owned_jokers_list, joker_object);
407
408 // TODO: Extract to on_joker_added() callback
409 // In case the player gets multiple Four Fingers Jokers,
410 // only change size when the first one is added
411 if (joker_object->joker->id == FOUR_FINGERS_JOKER_ID)
412 {
-
413 four_fingers_joker_count++;
+
413 s_four_fingers_joker_count++;
414 }
415
416 if (joker_object->joker->id == SHORTCUT_JOKER_ID)
417 {
-
418 shortcut_joker_count++;
+
418 s_shortcut_joker_count++;
419 }
420}
421
422void remove_owned_joker(int owned_joker_idx)
423{
424 // TODO: Extract to on_joker_removed() callback
-
425 JokerObject* joker_object = list_get_at_idx(&_owned_jokers_list, owned_joker_idx);
+
425 JokerObject* joker_object = list_get_at_idx(&s_owned_jokers_list, owned_joker_idx);
426 // In case the player gets multiple Four Fingers Jokers,
427 // and only reset the size when all of them have been removed
428 if (joker_object->joker->id == FOUR_FINGERS_JOKER_ID)
429 {
-
430 four_fingers_joker_count--;
+
430 s_four_fingers_joker_count--;
431 }
432
433 if (joker_object->joker->id == SHORTCUT_JOKER_ID)
434 {
-
435 shortcut_joker_count--;
+
435 s_shortcut_joker_count--;
436 }
437
438 // TODO: Move to site of joker_destroy()?
439 joker_set_rollable(joker_object->joker->id, true);
-
440 list_remove_at_idx(&_owned_jokers_list, owned_joker_idx);
+
440 list_remove_at_idx(&s_owned_jokers_list, owned_joker_idx);
441}
442
443int get_deck_top(void)
444{
-
445 return deck_top;
+
445 return s_deck_top;
446}
447
448int get_num_discards_remaining(void)
@@ -775,23 +775,23 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
635
636int deck_get_size(void)
637{
-
638 return deck_top + 1;
+
638 return s_deck_top + 1;
639}
640
641static int deck_get_max_size(void)
642{
643 // This is the max amount of cards that the player currently has in their possession
-
644 return get_hand_top() + get_played_top() + deck_top + get_discard_top() + 4;
+
644 return get_hand_top() + get_played_top() + s_deck_top + get_discard_top() + 4;
645}
646
647void deck_shuffle(void)
648{
-
649 for (int i = deck_top; i > 0; i--)
+
649 for (int i = s_deck_top; i > 0; i--)
650 {
651 int j = rng_get_u32() % (i + 1);
-
652 Card* temp = deck[i];
-
653 deck[i] = deck[j];
-
654 deck[j] = temp;
+
652 Card* temp = s_deck[i];
+
653 s_deck[i] = s_deck[j];
+
654 s_deck[j] = temp;
655 }
656}
657
@@ -861,7 +861,7 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
Functions relative to manipulating and analyzing the contents of the Hand, a.k.a. the Cards we hold a...
int get_hand_top(void)
Get the position in hand array of the last card obtained.
Definition hand.c:105
Functions relative to the handling of Jokers.
-
void joker_set_rollable(int joker_id, bool rollable)
Set whether a Joker is available to be rolled for the shop, packs, etc.
Definition joker.c:308
+
void joker_set_rollable(int joker_id, bool rollable)
Set whether a Joker is available to be rolled for the shop, packs, etc.
Definition joker.c:309
All the functions used specifically to interact with Jokers. This includes browsing,...
Header of shared rects and points needed for ui.
A doubly-linked list.
@@ -878,11 +878,11 @@ $(document).ready(function(){initNavTree('game_8c_source.html',''); initResizabl
Main menu state functions.
Options menu state functions.
Common functions to handle RNG manipulation. Using this interface has three goals:
-
void rng_update(void)
Update the CPU cycles counter and accumulate it into a bigger u32 timer_acc variable.
Definition random.c:19
+
void rng_update(void)
Accumulates CPU cycles for RNG seed generation, call exaclty once per frame.
Definition random.c:19
u32 rng_get_u32(void)
Get the next "randomly" generated number in the sequence from the current seed.
Definition random.c:36
API relative to the Rounds we play.
int get_discard_top(void)
Get the index of the last discarded card.
Definition round.c:265
-
void toggle_flaming_score(void)
Checks whether the score that would result from the current Chips and Mult exceeds the current Blind'...
Definition round.c:1424
+
void toggle_flaming_score(void)
Checks whether the score that would result from the current Chips and Mult exceeds the current Blind'...
Definition round.c:1425
int get_played_top(void)
Get the index of the last played card.
Definition round.c:243
Round end game state functions.
Setup Run menu state functions.
diff --git a/game__over_8c_source.html b/game__over_8c_source.html index 172314a4..570f634c 100644 --- a/game__over_8c_source.html +++ b/game__over_8c_source.html @@ -266,17 +266,17 @@ $(document).ready(function(){initNavTree('game__over_8c_source.html',''); initRe
126
127// Internal Variables
128
-
129static enum EndCondition condition = END_CONDITION_NONE;
-
130static u32 timer = TM_ZERO;
-
131static bool reuse_seed = false;
-
132static bool continue_run = false;
+
129static enum EndCondition s_end_condition = END_CONDITION_NONE;
+
130static u32 s_timer = TM_ZERO;
+
131static bool s_reuse_seed = false;
+
132static bool s_continue_run = false;
133
134static void game_over_common_init(enum EndCondition init_condition)
135{
-
136 condition = init_condition;
-
137 timer = TM_ZERO;
-
138 reuse_seed = false;
-
139 continue_run = false;
+
136 s_end_condition = init_condition;
+
137 s_timer = TM_ZERO;
+
138 s_reuse_seed = false;
+
139 s_continue_run = false;
140
141 // Hide all Joker sprites
142 JokerObject* joker_object = NULL;
@@ -353,14 +353,14 @@ $(document).ready(function(){initNavTree('game__over_8c_source.html',''); initRe
210{
-
211 timer++;
+
211 s_timer++;
212
213 // Need to clear text here or the number of cards remaining in deck stays for some reason
-
214 if (timer == 1)
+
214 if (s_timer == 1)
215 tte_erase_screen();
216
217 // Move whole panel and Blind Token sprite up by a tile each frame
-
218 if (timer < GAME_OVER_ANIM_FRAMES)
+
218 if (s_timer < GAME_OVER_ANIM_FRAMES)
219 {
220 main_bg_se_move_rect_1_tile_vert(GAME_OVER_ANIM_RECT, SCREEN_UP);
221
@@ -372,7 +372,7 @@ $(document).ready(function(){initNavTree('game__over_8c_source.html',''); initRe
227 }
228
229 // Print values and buttons text
-
230 else if (timer == GAME_OVER_ANIM_FRAMES)
+
230 else if (s_timer == GAME_OVER_ANIM_FRAMES)
231 {
232 char best_hand_str[UINT_MAX_DIGITS + 1];
@@ -436,7 +436,7 @@ $(document).ready(function(){initNavTree('game__over_8c_source.html',''); initRe
291 );
292 }
293
-
294 if (timer >= GAME_OVER_ANIM_FRAMES)
+
294 if (s_timer >= GAME_OVER_ANIM_FRAMES)
295 selection_grid_process_input(&game_over_selection_grid);
296}
@@ -447,14 +447,14 @@ $(document).ready(function(){initNavTree('game__over_8c_source.html',''); initRe
300 toggle_windows(false, false);
301
-
303 condition = END_CONDITION_NONE;
+
303 s_end_condition = END_CONDITION_NONE;
304
305 u32 previous_seed = g_game_vars.rng_info.seed;
306
-
307 if (!continue_run)
+
307 if (!s_continue_run)
308 game_reset();
309
-
310 if (reuse_seed)
+
310 if (s_reuse_seed)
311 rng_set_seed(previous_seed);
312 else
313 g_game_vars.rng_info.seed = UNDEFINED;
@@ -494,9 +494,9 @@ $(document).ready(function(){initNavTree('game__over_8c_source.html',''); initRe
346
347static void reuse_seed_on_pressed(void)
348{
-
349 reuse_seed = !reuse_seed;
+
349 s_reuse_seed = !s_reuse_seed;
-
351 reuse_seed ? REUSE_SEED_BTN_ON_SRC_RECT : REUSE_SEED_BTN_OFF_SRC_RECT,
+
351 s_reuse_seed ? REUSE_SEED_BTN_ON_SRC_RECT : REUSE_SEED_BTN_OFF_SRC_RECT,
352 REUSE_SEED_BTN_DEST_POS
353 );
354}
diff --git a/globals_d.html b/globals_d.html index fd5dd456..964b53a5 100644 --- a/globals_d.html +++ b/globals_d.html @@ -133,7 +133,7 @@ $(document).ready(function(){initNavTree('globals_d.html',''); initResizable();
Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:

- d -

diff --git a/hand_8c_source.html b/hand_8c_source.html index a221b67a..c7517d0e 100644 --- a/hand_8c_source.html +++ b/hand_8c_source.html @@ -161,7 +161,7 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
25} HandValues;
26
-
27static const HandValues hand_base_values[] = {
+
27static const HandValues HAND_BASE_VALUES[] = {
28 {.chips = 0, .mult = 0, .display_name = NULL }, // NONE
29 {.chips = 5, .mult = 1, .display_name = "Hi-Card"}, // HIGH_CARD
30 {.chips = 10, .mult = 2, .display_name = "Pair" }, // PAIR
@@ -200,7 +200,7 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
62} Hand;
63
-
64static Hand hand = {
+
64static Hand s_hand = {
65 .cards = {NULL},
66 .hand_top = -1,
67 .hand_selections = 0,
@@ -221,7 +221,7 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
82 if (hand_type <= NONE || hand_type > FLUSH_FIVE)
83 return NULL;
84
-
85 return hand_base_values[hand_type].display_name;
+
85 return HAND_BASE_VALUES[hand_type].display_name;
86}
87
88// Hand Struct Manipulation
@@ -229,70 +229,70 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
90enum HandState get_hand_state(void)
91{
-
92 return hand.state;
+
92 return s_hand.state;
93}
94
95void set_hand_state(enum HandState new_hand_state)
96{
-
97 hand.state = new_hand_state;
+
97 s_hand.state = new_hand_state;
98}
99
100CardObject** get_hand_array(void)
101{
-
102 return hand.cards;
+
102 return s_hand.cards;
103}
104
105int get_hand_top(void)
106{
-
107 return hand.hand_top;
+
107 return s_hand.hand_top;
108}
109
110void set_hand_top(int new_hand_top)
111{
-
112 hand.hand_top = new_hand_top;
+
112 s_hand.hand_top = new_hand_top;
113}
114
115int hand_nb_held_cards(void)
116{
-
117 return hand.hand_top + 1;
+
117 return s_hand.hand_top + 1;
118}
119
120int hand_get_nb_selected_cards(void)
121{
-
122 return hand.hand_selections;
+
122 return s_hand.hand_selections;
123}
124
125void hand_set_nb_selected_cards(int new_selections)
126{
-
127 hand.hand_selections = new_selections;
+
127 s_hand.hand_selections = new_selections;
128}
129
130enum HandType get_hand_type(void)
131{
-
132 return hand.hand_type;
+
132 return s_hand.hand_type;
133}
134
135ContainedHandTypes* get_contained_hands(void)
136{
-
137 return &hand.contained_hands;
+
137 return &s_hand.contained_hands;
138}
139
@@ -316,10 +316,10 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
156void compute_hand_value_info(void)
157{
158 tte_erase_rect_wrapper(HAND_TYPE_RECT);
-
159 hand.contained_hands = compute_contained_hand_types();
-
160 hand.hand_type = compute_hand_type(hand.contained_hands);
+
159 s_hand.contained_hands = compute_contained_hand_types();
+
160 s_hand.hand_type = compute_hand_type(s_hand.contained_hands);
161
-
162 HandValues hand_values = hand_base_values[hand.hand_type];
+
162 HandValues hand_values = HAND_BASE_VALUES[s_hand.hand_type];
163
164 g_game_vars.chips = hand_values.chips;
165 g_game_vars.mult = hand_values.mult;
@@ -335,23 +335,23 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
174void swap_cards_in_hand(int idx_a, int idx_b)
175{
-
176 CardObject* temp = hand.cards[idx_a];
-
177 hand.cards[idx_a] = hand.cards[idx_b];
-
178 hand.cards[idx_b] = temp;
+
176 CardObject* temp = s_hand.cards[idx_a];
+
177 s_hand.cards[idx_a] = s_hand.cards[idx_b];
+
178 s_hand.cards[idx_b] = temp;
179}
180
181static inline void sort_hand_by_suit(void)
182{
-
183 for (int idx_a = 0; idx_a < hand.hand_top; idx_a++)
+
183 for (int idx_a = 0; idx_a < s_hand.hand_top; idx_a++)
184 {
-
185 for (int idx_b = idx_a + 1; idx_b <= hand.hand_top; idx_b++)
+
185 for (int idx_b = idx_a + 1; idx_b <= s_hand.hand_top; idx_b++)
186 {
-
187 if (hand.cards[idx_a] == NULL ||
-
188 (hand.cards[idx_b] != NULL &&
-
189 (hand.cards[idx_a]->card->suit > hand.cards[idx_b]->card->suit ||
-
190 (hand.cards[idx_a]->card->suit == hand.cards[idx_b]->card->suit &&
-
191 hand.cards[idx_a]->card->rank > hand.cards[idx_b]->card->rank))))
+
187 if (s_hand.cards[idx_a] == NULL ||
+
188 (s_hand.cards[idx_b] != NULL &&
+
189 (s_hand.cards[idx_a]->card->suit > s_hand.cards[idx_b]->card->suit ||
+
190 (s_hand.cards[idx_a]->card->suit == s_hand.cards[idx_b]->card->suit &&
+
191 s_hand.cards[idx_a]->card->rank > s_hand.cards[idx_b]->card->rank))))
192 {
193 swap_cards_in_hand(idx_a, idx_b);
194 }
@@ -361,13 +361,13 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
198
199static inline void sort_hand_by_rank(void)
200{
-
201 for (int idx_a = 0; idx_a < hand.hand_top; idx_a++)
+
201 for (int idx_a = 0; idx_a < s_hand.hand_top; idx_a++)
202 {
-
203 for (int idx_b = idx_a + 1; idx_b <= hand.hand_top; idx_b++)
+
203 for (int idx_b = idx_a + 1; idx_b <= s_hand.hand_top; idx_b++)
204 {
-
205 if (hand.cards[idx_a] == NULL ||
-
206 (hand.cards[idx_b] != NULL &&
-
207 hand.cards[idx_a]->card->rank > hand.cards[idx_b]->card->rank))
+
205 if (s_hand.cards[idx_a] == NULL ||
+
206 (s_hand.cards[idx_b] != NULL &&
+
207 s_hand.cards[idx_a]->card->rank > s_hand.cards[idx_b]->card->rank))
208 {
209 swap_cards_in_hand(idx_a, idx_b);
210 }
@@ -380,25 +380,25 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
217 // Start by searching any non NULL cards after the NULL one
218 // don't start at null_card_idx+1 to avoid potential illegal array access
219 int non_null_card_idx = null_card_idx;
-
220 for (; non_null_card_idx <= hand.hand_top; non_null_card_idx++)
+
220 for (; non_null_card_idx <= s_hand.hand_top; non_null_card_idx++)
221 {
-
222 if (hand.cards[non_null_card_idx] != NULL)
+
222 if (s_hand.cards[non_null_card_idx] != NULL)
223 {
224 break;
225 }
226 }
227
228 // return false if there are no non-NULL cards left/there are no more sprites to destroy
-
229 if (non_null_card_idx > hand.hand_top)
+
229 if (non_null_card_idx > s_hand.hand_top)
230 {
231 return false;
232 }
233
234 // If there is one, shift it and all the cards that follow forward
235 // This way we close the gap and ensure the next card is not NULL
-
236 for (int j = 0; j <= hand.hand_top - non_null_card_idx; j++)
+
236 for (int j = 0; j <= s_hand.hand_top - non_null_card_idx; j++)
237 {
-
238 hand.cards[null_card_idx + j] = hand.cards[non_null_card_idx + j];
+
238 s_hand.cards[null_card_idx + j] = s_hand.cards[non_null_card_idx + j];
239 }
240
241 return true;
@@ -409,11 +409,11 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
245{
246 // Update the sprites in the hand by destroying them and creating new ones in the correct order
247 // (This feels like a diabolical solution but like literally how else would you do this)
-
248 for (int i = 0; i <= hand.hand_top; i++)
+
248 for (int i = 0; i <= s_hand.hand_top; i++)
249 {
250 // a NULL card will only happen if we rearrange the sprites without having sorted them
251 // before. Any NULL CardObject will be sent to the end by shifting all elements forward
-
252 if (hand.cards[i] == NULL)
+
252 if (s_hand.cards[i] == NULL)
253 {
254 if (!shift_null_card_to_end(i))
255 {
@@ -422,20 +422,20 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
258 }
259
260 // card_object_get_sprite() will not work here since we need the address
-
261 sprite_destroy(&(hand.cards[i]->sprite));
+
261 sprite_destroy(&(s_hand.cards[i]->sprite));
262 }
263
264 // Recreate the sprites for the remaining non NULL cards, in order
-
265 for (int i = 0; i <= hand.hand_top; i++)
+
265 for (int i = 0; i <= s_hand.hand_top; i++)
266 {
-
267 if (hand.cards[i] != NULL)
+
267 if (s_hand.cards[i] != NULL)
268 {
269 // Set the sprite for the card object
-
270 card_object_set_sprite(hand.cards[i], i);
+
270 card_object_set_sprite(s_hand.cards[i], i);
271 sprite_position(
-
272 card_object_get_sprite(hand.cards[i]),
-
273 fx2int(hand.cards[i]->x),
-
274 fx2int(hand.cards[i]->y)
+
272 card_object_get_sprite(s_hand.cards[i]),
+
273 fx2int(s_hand.cards[i]->x),
+
274 fx2int(s_hand.cards[i]->y)
275 );
276 }
277 }
@@ -445,7 +445,7 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
280void sort_cards(void)
281{
-
282 if (hand.sort_by_suit)
+
282 if (s_hand.sort_by_suit)
283 {
284 sort_hand_by_suit();
285 }
@@ -461,9 +461,9 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
294void hand_change_sort(bool to_sort_by_suit)
295{
-
296 if (to_sort_by_suit != hand.sort_by_suit)
+
296 if (to_sort_by_suit != s_hand.sort_by_suit)
297 {
-
298 hand.sort_by_suit = to_sort_by_suit;
+
298 s_hand.sort_by_suit = to_sort_by_suit;
299 sort_cards();
300 }
301}
@@ -472,20 +472,20 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
303void hand_select_card(int index)
304{
-
305 if (index < 0 || index >= hand_nb_held_cards() || hand.state != HAND_SELECT ||
-
306 hand.cards[index] == NULL)
+
305 if (index < 0 || index >= hand_nb_held_cards() || s_hand.state != HAND_SELECT ||
+
306 s_hand.cards[index] == NULL)
307 return;
308
-
309 if (card_object_is_selected(hand.cards[index]))
+
309 if (card_object_is_selected(s_hand.cards[index]))
310 {
-
311 card_object_set_selected(hand.cards[index], false);
-
312 hand.hand_selections--;
+
311 card_object_set_selected(s_hand.cards[index], false);
+
312 s_hand.hand_selections--;
314 }
-
315 else if (hand.hand_selections < MAX_SELECTION_SIZE)
+
315 else if (s_hand.hand_selections < MAX_SELECTION_SIZE)
316 {
-
317 card_object_set_selected(hand.cards[index], true);
-
318 hand.hand_selections++;
+
317 card_object_set_selected(s_hand.cards[index], true);
+
318 s_hand.hand_selections++;
320 }
@@ -496,12 +496,12 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
325{
326 bool any_cards_deselected = false;
-
327 for (int i = 0; i <= hand.hand_top; i++)
+
327 for (int i = 0; i <= s_hand.hand_top; i++)
328 {
-
329 if (card_object_is_selected(hand.cards[i]))
+
329 if (card_object_is_selected(s_hand.cards[i]))
330 {
-
331 card_object_set_selected(hand.cards[i], false);
-
332 hand.hand_selections--;
+
331 card_object_set_selected(s_hand.cards[i], false);
+
332 s_hand.hand_selections--;
333 any_cards_deselected = true;
334 }
335 }
@@ -523,13 +523,13 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
356 for (int i = 0; i < NUM_SUITS; i++)
357 suits_out[i] = 0;
358
-
359 int top = hand.hand_top;
+
359 int top = s_hand.hand_top;
360 for (int i = 0; i <= top; i++)
361 {
-
362 if (hand.cards[i] && card_object_is_selected(hand.cards[i]))
+
362 if (s_hand.cards[i] && card_object_is_selected(s_hand.cards[i]))
363 {
-
364 ranks_out[hand.cards[i]->card->rank]++;
-
365 suits_out[hand.cards[i]->card->suit]++;
+
364 ranks_out[s_hand.cards[i]->card->rank]++;
+
365 suits_out[s_hand.cards[i]->card->suit]++;
366 }
367 }
368}
@@ -939,7 +939,7 @@ $(document).ready(function(){initNavTree('hand_8c_source.html',''); initResizabl
765 ContainedHandTypes hand_types = {0};
766
767 // Idk if this is how Balatro does it but this is how I'm doing it
-
768 if (hand.hand_selections == 0 || hand.state == HAND_DISCARD)
+
768 if (s_hand.hand_selections == 0 || s_hand.state == HAND_DISCARD)
769 {
770 return hand_types;
771 }
diff --git a/item__funcs_8c_source.html b/item__funcs_8c_source.html index cbfde503..50957076 100644 --- a/item__funcs_8c_source.html +++ b/item__funcs_8c_source.html @@ -208,10 +208,10 @@ $(document).ready(function(){initNavTree('item__funcs_8c_source.html',''); initR
An API for the item functions defined in item.h Separated module from item.c/.h so item_funcs....
ItemFuncs * get_item_type_funcs(enum ItemType type)
Returns the function table for a given item type.
Definition item_funcs.c:39
Functions relative to the handling of Jokers.
-
void joker_object_dispose(Item **joker_object)
Destroy a JokerObject item, free its resources, and make it available to be rolled.
Definition joker.c:271
-
Item * joker_object_roll_new(void)
Roll and create a new JokerObject item.
Definition joker.c:387
-
int joker_object_get_buy_price(Item *joker_object)
Returns the buy price of the joker object.
Definition joker.c:291
-
void joker_object_add_to_owned(Item *joker_object)
Add a Joker to the list of owned Jokers and place it in the joker row.
Definition joker.c:299
+
void joker_object_dispose(Item **joker_object)
Destroy a JokerObject item, free its resources, and make it available to be rolled.
Definition joker.c:272
+
Item * joker_object_roll_new(void)
Roll and create a new JokerObject item.
Definition joker.c:388
+
int joker_object_get_buy_price(Item *joker_object)
Returns the buy price of the joker object.
Definition joker.c:292
+
void joker_object_add_to_owned(Item *joker_object)
Add a Joker to the list of owned Jokers and place it in the joker row.
Definition joker.c:300
Shop state functions.
The set of functions that each item type implements.
Definition item.h:93
Item *(* roll_new)(void)
Definition item.h:98
diff --git a/joker_8c_source.html b/joker_8c_source.html index e23249ef..86837d87 100644 --- a/joker_8c_source.html +++ b/joker_8c_source.html @@ -178,605 +178,606 @@ $(document).ready(function(){initNavTree('joker_8c_source.html',''); initResizab
38#undef DEF_JOKER_GFX
39};
40
-
41const static u8 edition_price_lut[MAX_EDITIONS] = {
-
42 0, // BASE_EDITION
-
43 2, // FOIL_EDITION
-
44 3, // HOLO_EDITION
-
45 5, // POLY_EDITION
-
46 5, // NEGATIVE_EDITION
-
47};
-
48
-
49/* So for the card objects, I needed them to be properly sorted
-
50 which is why they let you specify the layer index when creating a new card object.
-
51 Since the cards would overlap a lot in your hand, If they weren't sorted properly, it would look
-
52 like a mess. The joker objects are functionally identical to card objects, so they use the same
-
53 logic. But I'm going to use a simpler approach for the joker objects since I'm lazy and sorting
-
54 them wouldn't look good enough to warrant the effort.
-
55*/
-
56static bool used_layers[MAX_JOKER_OBJECTS] = {false}; // Track used layers for joker sprites
-
57// TODO: Refactor sorting into SpriteObject?
-
58
-
59// Maps the spritesheet index to the palette bank index allocated to it.
-
60// Spritesheets that were not allocated are
-
61static int joker_spritesheet_pb_map[MAX_NUM_JOKERS_SPRITESHEETS];
-
62static int joker_pb_num_sprite_users[JOKER_LAST_PB - JOKER_BASE_PB + 1] = {0};
-
63
-
64BITSET_DEFINE(s_rollable_jokers_bitset, MAX_DEFINABLE_JOKERS)
-
65
-
66// See linked issue for context of maps
-
67// https://github.com/GBALATRO/balatro-gba/issues/274#issue-3685075538
-
68
-
69// clang-format off
-
70// Map of Joker ID -> Spritesheet idx
-
71static int joker_id_to_sprite_map[] = {
-
72 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-
73 1, 1,
-
74 2, 2,
-
75 3, 3, 3, 3, 3,
-
76 4, 4, 4, 4, 4,
-
77 5, 5, 5, 5,
-
78 6, 6, 6, 6,
-
79 7, 7,
-
80 8, 8,
-
81 9,
-
82 10,
-
83 11,
-
84 12,
-
85 13,
-
86 14,
-
87 15,
-
88 16,
-
89 17,
-
90};
-
91
-
92// Map of Spritesheet idx -> first Joker ID in sheet
-
93// This is used to determine the sprite index of a Joker's sprite
-
94// within its spritesheet by substracting its ID to this starting ID.
-
95// Notice how spritesheets with only one Joker have sequential starting IDs.
-
96static int spritesheet_idx_to_starting_joker_id[] = {
-
97 0, 18, 20, 22, 27, 32, 36, 40, 42, 44,
-
98 45, 46, 47, 48, 49, 50, 51, 52
-
99};
-
100
-
101// Lookup table of Joker Rarity strings. Used to display at the bottom of the description screen.
-
102static const char* joker_rarity_strings_lut[MAX_RARITIES] = {
-
103 "Common", "Uncommon", "Rare", "Legendary"
-
104};
-
105// clang-format on
-
106
-
107static int s_get_num_spritesheets(void);
-
108static int s_joker_get_spritesheet_idx(u8 joker_id);
-
109static int s_joker_get_sprite_idx_in_sheet(u8 joker_id, int spritesheet_idx);
-
110static void s_joker_pb_add_sprite_user(int pb);
-
111static void s_joker_pb_remove_sprite_user(int pb);
-
112static int s_joker_pb_get_num_sprite_users(int joker_pb);
-
113static int s_get_unused_joker_pb(void);
-
114static int s_allocate_pb_if_needed(u8 joker_id);
-
115
-
116void joker_init()
-
117{
-
118 // This should init once only so no need to free
-
119 int num_spritesheets = s_get_num_spritesheets();
-
120
-
121 for (int i = 0; i < num_spritesheets; i++)
-
122 {
-
123 joker_spritesheet_pb_map[i] = UNDEFINED;
-
124 }
-
125}
-
126
-
127Joker* joker_new(u8 id)
-
128{
-
129 if (id >= get_joker_registry_size())
-
130 return NULL;
-
131
-
132 Joker* joker = POOL_GET(Joker);
-
133 const JokerInfo* jinfo = get_joker_registry_entry(id);
-
134
-
135 joker->id = id;
-
136 joker->modifier = BASE_EDITION; // TODO: Make this a parameter
-
137 joker->value = jinfo->base_value + edition_price_lut[joker->modifier];
-
138 joker->rarity = jinfo->rarity;
-
139 joker->scoring_state = 0;
-
140 joker->persistent_state = 0;
-
141
-
142 // initialize persistent Joker data if needed
-
143 JokerEffect* joker_effect = NULL;
-
144 jinfo->joker_effect_func(joker, NULL, JOKER_EVENT_ON_JOKER_CREATED, &joker_effect);
-
145
-
146 return joker;
-
147}
-
148
-
149void joker_destroy(Joker** joker)
-
150{
-
151 POOL_FREE(Joker, *joker);
-
152 *joker = NULL;
-
153}
-
154
-
155u32 joker_get_score_effect(
-
156 Joker* joker,
-
157 Card* scored_card,
-
158 enum JokerEvent joker_event,
-
159 JokerEffect** joker_effect
-
160)
-
161{
-
162 const JokerInfo* jinfo = get_joker_registry_entry(joker->id);
-
163 if (!jinfo)
-
164 return JOKER_EFFECT_FLAG_NONE;
-
165
-
166 return jinfo->joker_effect_func(joker, scored_card, joker_event, joker_effect);
-
167}
-
168
-
169const char* joker_get_rarity_string(u8 rarity)
-
170{
-
171 if (rarity >= MAX_RARITIES)
-
172 return NULL;
-
173
-
174 return joker_rarity_strings_lut[rarity];
-
175}
-
176
-
-
177u16 joker_get_rarity_color(u8 rarity, bool main_color)
-
178{
-
179 if (rarity >= MAX_RARITIES)
-
180 return 0x0;
-
181
-
182 // +1 to account for the transparency
-
183 // odd indices are the main colors, even ones are the shadows
-
184 return card_rarity_pal_gfxPal[1 + 2 * rarity + (main_color ? 0 : 1)];
-
185}
+
41// TODO: Removed unplanned editions...
+
42const static u8 EDITION_PRICE_LUT[MAX_EDITIONS] = {
+
43 0, // BASE_EDITION
+
44 2, // FOIL_EDITION
+
45 3, // HOLO_EDITION
+
46 5, // POLY_EDITION
+
47 5, // NEGATIVE_EDITION
+
48};
+
49
+
50/* So for the card objects, I needed them to be properly sorted
+
51 which is why they let you specify the layer index when creating a new card object.
+
52 Since the cards would overlap a lot in your hand, If they weren't sorted properly, it would look
+
53 like a mess. The joker objects are functionally identical to card objects, so they use the same
+
54 logic. But I'm going to use a simpler approach for the joker objects since I'm lazy and sorting
+
55 them wouldn't look good enough to warrant the effort.
+
56*/
+
57static bool s_used_layers[MAX_JOKER_OBJECTS] = {false}; // Track used layers for joker sprites
+
58// TODO: Refactor sorting into SpriteObject?
+
59
+
60// Maps the spritesheet index to the palette bank index allocated to it.
+
61// Spritesheets that were not allocated are
+
62static int s_joker_spritesheet_pb_map[MAX_NUM_JOKERS_SPRITESHEETS];
+
63static int s_joker_pb_num_sprite_users[JOKER_LAST_PB - JOKER_BASE_PB + 1] = {0};
+
64
+
65BITSET_DEFINE(s_rollable_jokers_bitset, MAX_DEFINABLE_JOKERS)
+
66
+
67// See linked issue for context of maps
+
68// https://github.com/GBALATRO/balatro-gba/issues/274#issue-3685075538
+
69
+
70// clang-format off
+
71// Map of Joker ID -> Spritesheet idx
+
72static const int JOKER_ID_TO_SPRITE_MAP[] = {
+
73 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+
74 1, 1,
+
75 2, 2,
+
76 3, 3, 3, 3, 3,
+
77 4, 4, 4, 4, 4,
+
78 5, 5, 5, 5,
+
79 6, 6, 6, 6,
+
80 7, 7,
+
81 8, 8,
+
82 9,
+
83 10,
+
84 11,
+
85 12,
+
86 13,
+
87 14,
+
88 15,
+
89 16,
+
90 17,
+
91};
+
92
+
93// Map of Spritesheet idx -> first Joker ID in sheet
+
94// This is used to determine the sprite index of a Joker's sprite
+
95// within its spritesheet by substracting its ID to this starting ID.
+
96// Notice how spritesheets with only one Joker have sequential starting IDs.
+
97static const int SPRITESHEET_IDX_TO_STARTING_JOKER_ID[] = {
+
98 0, 18, 20, 22, 27, 32, 36, 40, 42, 44,
+
99 45, 46, 47, 48, 49, 50, 51, 52
+
100};
+
101
+
102// Lookup table of Joker Rarity strings. Used to display at the bottom of the description screen.
+
103static const char* JOKER_RARITY_STRINGS_LUT[MAX_RARITIES] = {
+
104 "Common", "Uncommon", "Rare", "Legendary"
+
105};
+
106// clang-format on
+
107
+
108static int s_get_num_spritesheets(void);
+
109static int s_joker_get_spritesheet_idx(u8 joker_id);
+
110static int s_joker_get_sprite_idx_in_sheet(u8 joker_id, int spritesheet_idx);
+
111static void s_joker_pb_add_sprite_user(int pb);
+
112static void s_joker_pb_remove_sprite_user(int pb);
+
113static int s_joker_pb_get_num_sprite_users(int joker_pb);
+
114static int s_get_unused_joker_pb(void);
+
115static int s_allocate_pb_if_needed(u8 joker_id);
+
116
+
117void joker_init()
+
118{
+
119 // This should init once only so no need to free
+
120 int num_spritesheets = s_get_num_spritesheets();
+
121
+
122 for (int i = 0; i < num_spritesheets; i++)
+
123 {
+
124 s_joker_spritesheet_pb_map[i] = UNDEFINED;
+
125 }
+
126}
+
127
+
128Joker* joker_new(u8 id)
+
129{
+
130 if (id >= get_joker_registry_size())
+
131 return NULL;
+
132
+
133 Joker* joker = POOL_GET(Joker);
+
134 const JokerInfo* jinfo = get_joker_registry_entry(id);
+
135
+
136 joker->id = id;
+
137 joker->modifier = BASE_EDITION; // TODO: Make this a parameter
+
138 joker->value = jinfo->base_value + EDITION_PRICE_LUT[joker->modifier];
+
139 joker->rarity = jinfo->rarity;
+
140 joker->scoring_state = 0;
+
141 joker->persistent_state = 0;
+
142
+
143 // initialize persistent Joker data if needed
+
144 JokerEffect* joker_effect = NULL;
+
145 jinfo->joker_effect_func(joker, NULL, JOKER_EVENT_ON_JOKER_CREATED, &joker_effect);
+
146
+
147 return joker;
+
148}
+
149
+
150void joker_destroy(Joker** joker)
+
151{
+
152 POOL_FREE(Joker, *joker);
+
153 *joker = NULL;
+
154}
+
155
+
156u32 joker_get_score_effect(
+
157 Joker* joker,
+
158 Card* scored_card,
+
159 enum JokerEvent joker_event,
+
160 JokerEffect** joker_effect
+
161)
+
162{
+
163 const JokerInfo* jinfo = get_joker_registry_entry(joker->id);
+
164 if (!jinfo)
+
165 return JOKER_EFFECT_FLAG_NONE;
+
166
+
167 return jinfo->joker_effect_func(joker, scored_card, joker_event, joker_effect);
+
168}
+
169
+
170const char* joker_get_rarity_string(u8 rarity)
+
171{
+
172 if (rarity >= MAX_RARITIES)
+
173 return NULL;
+
174
+
175 return JOKER_RARITY_STRINGS_LUT[rarity];
+
176}
+
177
+
+
178u16 joker_get_rarity_color(u8 rarity, bool main_color)
+
179{
+
180 if (rarity >= MAX_RARITIES)
+
181 return 0x0;
+
182
+
183 // +1 to account for the transparency
+
184 // odd indices are the main colors, even ones are the shadows
+
185 return card_rarity_pal_gfxPal[1 + 2 * rarity + (main_color ? 0 : 1)];
+
186}
-
186
-
187int joker_get_buy_price(const Joker* joker)
-
188{
-
189 GBAL_RETURN_IF_NULL_RET(joker, UNDEFINED);
-
190
-
191 return joker->value;
-
192}
-
193
-
194int joker_get_sell_value(const Joker* joker)
-
195{
-
196 GBAL_RETURN_IF_NULL_RET(joker, UNDEFINED);
-
197
-
198 return joker->value / 2;
-
199}
-
200
-
201// JokerObject methods
-
202JokerObject* joker_object_new(Joker* joker)
-
203{
-
204 JokerObject* joker_object = POOL_GET(JokerObject);
-
205
-
206 sprite_object_init((SpriteObject*)joker_object);
-
207
-
208 int layer = 0;
-
209 for (int i = 0; i < MAX_JOKER_OBJECTS; i++)
-
210 {
-
211 if (!used_layers[i])
-
212 {
-
213 layer = i;
-
214 used_layers[i] = true; // Mark this layer as used
-
215 break;
-
216 }
-
217 }
-
218
-
219 joker_object->joker = joker;
-
220
-
221 joker_object->type = ITEM_TYPE_JOKER;
-
222
-
223 int tile_index = JOKER_TID + layer * JOKER_SPRITE_OFFSET;
-
224
-
225 int joker_spritesheet_idx = s_joker_get_spritesheet_idx(joker->id);
-
226 int joker_idx = s_joker_get_sprite_idx_in_sheet(joker->id, joker_spritesheet_idx);
-
227 int joker_pb = s_allocate_pb_if_needed(joker->id);
-
228 s_joker_pb_add_sprite_user(joker_pb);
-
229
-
230 memcpy32(
-
231 &tile_mem[TILE_MEM_OBJ_CHARBLOCK0_IDX][tile_index],
-
232 &joker_gfxTiles[joker_spritesheet_idx][joker_idx * TILE_SIZE * JOKER_SPRITE_OFFSET],
-
233 TILE_SIZE * JOKER_SPRITE_OFFSET
-
234 );
-
235
- -
237 (SpriteObject*)joker_object,
- -
239 ATTR0_SQUARE | ATTR0_4BPP | ATTR0_AFF,
-
240 ATTR1_SIZE_32,
-
241 tile_index,
-
242 joker_pb,
-
243 JOKER_STARTING_LAYER + layer
-
244 )
-
245 );
-
246
-
247 return joker_object;
-
248}
-
249
-
250void joker_object_destroy(JokerObject** joker_object)
-
251{
-
252 if (joker_object == NULL || *joker_object == NULL)
-
253 return;
-
254
-
255 int layer = sprite_get_layer(joker_object_get_sprite(*joker_object)) - JOKER_STARTING_LAYER;
-
256 used_layers[layer] = false;
-
257 s_joker_pb_remove_sprite_user(sprite_get_pb(joker_object_get_sprite(*joker_object)));
-
258 if (s_joker_pb_get_num_sprite_users((sprite_get_pb(joker_object_get_sprite(*joker_object)))) ==
-
259 0)
-
260 {
-
261 joker_spritesheet_pb_map[s_joker_get_spritesheet_idx((*joker_object)->joker->id)] =
-
262 UNDEFINED;
-
263 }
-
264
-
265 sprite_object_destroy((SpriteObject*)(*joker_object));
-
266 joker_destroy(&(*joker_object)->joker);
-
267 POOL_FREE(JokerObject, *joker_object);
-
268 *joker_object = NULL;
-
269}
-
270
-
-
271void joker_object_dispose(Item** joker_object_item)
-
272{
-
273 GBAL_RETURN_IF_NULL_VOID(joker_object_item);
-
274 GBAL_RETURN_IF_NULL_VOID(*joker_object_item);
-
275 ITEM_RETURN_IF_UNEXPECTED_TYPE_VOID(*joker_object_item, ITEM_TYPE_JOKER);
-
276
-
277 JokerObject* joker_object = (JokerObject*)(*joker_object_item);
-
278 GBAL_RETURN_IF_NULL_VOID(joker_object->joker);
-
279
-
280 joker_set_rollable(joker_object->joker->id, true);
-
281
-
282 joker_object_destroy(&joker_object);
-
283 *joker_object_item = NULL;
-
284}
+
187
+
188int joker_get_buy_price(const Joker* joker)
+
189{
+
190 GBAL_RETURN_IF_NULL_RET(joker, UNDEFINED);
+
191
+
192 return joker->value;
+
193}
+
194
+
195int joker_get_sell_value(const Joker* joker)
+
196{
+
197 GBAL_RETURN_IF_NULL_RET(joker, UNDEFINED);
+
198
+
199 return joker->value / 2;
+
200}
+
201
+
202// JokerObject methods
+
203JokerObject* joker_object_new(Joker* joker)
+
204{
+
205 JokerObject* joker_object = POOL_GET(JokerObject);
+
206
+
207 sprite_object_init((SpriteObject*)joker_object);
+
208
+
209 int layer = 0;
+
210 for (int i = 0; i < MAX_JOKER_OBJECTS; i++)
+
211 {
+
212 if (!s_used_layers[i])
+
213 {
+
214 layer = i;
+
215 s_used_layers[i] = true; // Mark this layer as used
+
216 break;
+
217 }
+
218 }
+
219
+
220 joker_object->joker = joker;
+
221
+
222 joker_object->type = ITEM_TYPE_JOKER;
+
223
+
224 int tile_index = JOKER_TID + layer * JOKER_SPRITE_OFFSET;
+
225
+
226 int joker_spritesheet_idx = s_joker_get_spritesheet_idx(joker->id);
+
227 int joker_idx = s_joker_get_sprite_idx_in_sheet(joker->id, joker_spritesheet_idx);
+
228 int joker_pb = s_allocate_pb_if_needed(joker->id);
+
229 s_joker_pb_add_sprite_user(joker_pb);
+
230
+
231 memcpy32(
+
232 &tile_mem[TILE_MEM_OBJ_CHARBLOCK0_IDX][tile_index],
+
233 &joker_gfxTiles[joker_spritesheet_idx][joker_idx * TILE_SIZE * JOKER_SPRITE_OFFSET],
+
234 TILE_SIZE * JOKER_SPRITE_OFFSET
+
235 );
+
236
+ +
238 (SpriteObject*)joker_object,
+ +
240 ATTR0_SQUARE | ATTR0_4BPP | ATTR0_AFF,
+
241 ATTR1_SIZE_32,
+
242 tile_index,
+
243 joker_pb,
+
244 JOKER_STARTING_LAYER + layer
+
245 )
+
246 );
+
247
+
248 return joker_object;
+
249}
+
250
+
251void joker_object_destroy(JokerObject** joker_object)
+
252{
+
253 if (joker_object == NULL || *joker_object == NULL)
+
254 return;
+
255
+
256 int layer = sprite_get_layer(joker_object_get_sprite(*joker_object)) - JOKER_STARTING_LAYER;
+
257 s_used_layers[layer] = false;
+
258 s_joker_pb_remove_sprite_user(sprite_get_pb(joker_object_get_sprite(*joker_object)));
+
259 if (s_joker_pb_get_num_sprite_users((sprite_get_pb(joker_object_get_sprite(*joker_object)))) ==
+
260 0)
+
261 {
+
262 s_joker_spritesheet_pb_map[s_joker_get_spritesheet_idx((*joker_object)->joker->id)] =
+
263 UNDEFINED;
+
264 }
+
265
+
266 sprite_object_destroy((SpriteObject*)(*joker_object));
+
267 joker_destroy(&(*joker_object)->joker);
+
268 POOL_FREE(JokerObject, *joker_object);
+
269 *joker_object = NULL;
+
270}
+
271
+
+
272void joker_object_dispose(Item** joker_object_item)
+
273{
+
274 GBAL_RETURN_IF_NULL_VOID(joker_object_item);
+
275 GBAL_RETURN_IF_NULL_VOID(*joker_object_item);
+
276 ITEM_RETURN_IF_UNEXPECTED_TYPE_VOID(*joker_object_item, ITEM_TYPE_JOKER);
+
277
+
278 JokerObject* joker_object = (JokerObject*)(*joker_object_item);
+
279 GBAL_RETURN_IF_NULL_VOID(joker_object->joker);
+
280
+
281 joker_set_rollable(joker_object->joker->id, true);
+
282
+
283 joker_object_destroy(&joker_object);
+
284 *joker_object_item = NULL;
+
285}
-
285
-
286void joker_object_shake(JokerObject* joker_object, mm_word sound_id)
-
287{
-
288 sprite_object_shake((SpriteObject*)joker_object, sound_id);
-
289}
-
290
-
- -
292{
-
293 GBAL_RETURN_IF_NULL_RET(joker_object, UNDEFINED);
-
294 ITEM_RETURN_IF_UNEXPECTED_TYPE_RET(joker_object, ITEM_TYPE_JOKER, UNDEFINED);
-
295
-
296 return ((JokerObject*)joker_object)->joker->value;
-
297}
+
286
+
287void joker_object_shake(JokerObject* joker_object, mm_word sound_id)
+
288{
+
289 sprite_object_shake((SpriteObject*)joker_object, sound_id);
+
290}
+
291
+
+ +
293{
+
294 GBAL_RETURN_IF_NULL_RET(joker_object, UNDEFINED);
+
295 ITEM_RETURN_IF_UNEXPECTED_TYPE_RET(joker_object, ITEM_TYPE_JOKER, UNDEFINED);
+
296
+
297 return ((JokerObject*)joker_object)->joker->value;
+
298}
-
298
-
- -
300{
-
301 GBAL_RETURN_IF_NULL_VOID(joker_object);
-
302 ITEM_RETURN_IF_UNEXPECTED_TYPE_VOID(joker_object, ITEM_TYPE_JOKER);
-
303
-
304 joker_object->ty = int2fx(HELD_JOKERS_POS.y);
-
305 add_joker((JokerObject*)joker_object);
-
306}
+
299
+
+ +
301{
+
302 GBAL_RETURN_IF_NULL_VOID(joker_object);
+
303 ITEM_RETURN_IF_UNEXPECTED_TYPE_VOID(joker_object, ITEM_TYPE_JOKER);
+
304
+
305 joker_object->ty = int2fx(HELD_JOKERS_POS.y);
+
306 add_joker((JokerObject*)joker_object);
+
307}
-
307
-
-
308void joker_set_rollable(int joker_id, bool rollable)
-
309{
-
310 bitset_set_idx(&s_rollable_jokers_bitset, joker_id, rollable);
-
311}
+
308
+
+
309void joker_set_rollable(int joker_id, bool rollable)
+
310{
+
311 bitset_set_idx(&s_rollable_jokers_bitset, joker_id, rollable);
+
312}
-
312
-
317static inline int get_num_rollable_jokers(void)
-
318{
-
319 return bitset_num_set_bits(&s_rollable_jokers_bitset);
-
320}
-
321
-
325static inline bool no_rollable_jokers(void)
-
326{
-
327 return bitset_is_empty(&s_rollable_jokers_bitset);
-
328}
-
329
- -
331static inline bool joker_is_rollable(int joker_id)
-
332{
-
333 return bitset_get_idx(&s_rollable_jokers_bitset, joker_id);
-
334}
-
335
-
- -
337{
-
338 int num_jokers = get_joker_registry_size();
-
339
-
340 bitset_clear(&s_rollable_jokers_bitset);
-
341 for (int i = 0; i < num_jokers; i++)
-
342 {
-
343 bitset_set_idx(&s_rollable_jokers_bitset, i, true);
-
344 }
-
345}
+
313
+
318static inline int get_num_rollable_jokers(void)
+
319{
+
320 return bitset_num_set_bits(&s_rollable_jokers_bitset);
+
321}
+
322
+
326static inline bool no_rollable_jokers(void)
+
327{
+
328 return bitset_is_empty(&s_rollable_jokers_bitset);
+
329}
+
330
+ +
332static inline bool joker_is_rollable(int joker_id)
+
333{
+
334 return bitset_get_idx(&s_rollable_jokers_bitset, joker_id);
+
335}
+
336
+
+ +
338{
+
339 int num_jokers = get_joker_registry_size();
+
340
+
341 bitset_clear(&s_rollable_jokers_bitset);
+
342 for (int i = 0; i < num_jokers; i++)
+
343 {
+
344 bitset_set_idx(&s_rollable_jokers_bitset, i, true);
+
345 }
+
346}
-
346
-
350static int joker_roll_id(void)
-
351{
-
352 // Now determine how many jokers are available based on the rarity
-
353 int jokers_avail_size = get_num_rollable_jokers();
-
354
-
355 if (jokers_avail_size == 0)
-
356 return UNDEFINED;
-
357
-
358 // Roll for what rarity the joker will be
-
359 int joker_rarity = joker_get_random_rarity();
-
360
-
361 int matching_joker_ids[jokers_avail_size];
-
362 int fallback_random_idx = rng_get_u32() % jokers_avail_size;
-
363 int fallback_random_joker_id = UNDEFINED;
-
364 int match_count = 0;
-
365
-
366 BitsetItr itr = bitset_itr_create(&s_rollable_jokers_bitset);
-
367
-
368 int i = 0;
-
369 int joker_id = UNDEFINED;
-
370 while ((joker_id = bitset_itr_next(&itr)) != UNDEFINED)
-
371 {
-
372 if (i++ == fallback_random_idx)
-
373 fallback_random_joker_id = joker_id;
-
374 const JokerInfo* info = get_joker_registry_entry(joker_id);
-
375 if (info->rarity == joker_rarity)
-
376 {
-
377 matching_joker_ids[match_count++] = joker_id;
-
378 }
-
379 }
-
380
-
381 int selected_joker_id = (match_count > 0) ? matching_joker_ids[rng_get_u32() % match_count]
-
382 : fallback_random_joker_id;
-
383
-
384 return selected_joker_id;
-
385}
-
386
-
- -
388{
-
389 if (no_rollable_jokers())
-
390 return NULL;
-
391
-
392 int joker_id = 0;
-
393#ifdef TEST_JOKER_ID0 // Allow defining an ID for a joker to always appear in shop and be tested
-
394 if (joker_is_rollable(TEST_JOKER_ID0))
-
395 {
-
396 joker_id = TEST_JOKER_ID0;
-
397 }
-
398 else
-
399#endif
-
400#ifdef TEST_JOKER_ID1
-
401 if (joker_is_rollable(TEST_JOKER_ID1))
-
402 {
-
403 joker_id = TEST_JOKER_ID1;
-
404 }
-
405 else
-
406#endif
-
407 {
-
408 joker_id = joker_roll_id();
-
409 }
-
410
-
411 // If for some reason only no joker is left, don't make another
-
412 if (joker_id == UNDEFINED)
-
413 return NULL;
-
414
-
415 joker_set_rollable(joker_id, false);
-
416
-
417 return (Item*)joker_object_new(joker_new(joker_id));
-
418}
+
347
+
351static int joker_roll_id(void)
+
352{
+
353 // Now determine how many jokers are available based on the rarity
+
354 int jokers_avail_size = get_num_rollable_jokers();
+
355
+
356 if (jokers_avail_size == 0)
+
357 return UNDEFINED;
+
358
+
359 // Roll for what rarity the joker will be
+
360 int joker_rarity = joker_get_random_rarity();
+
361
+
362 int matching_joker_ids[jokers_avail_size];
+
363 int fallback_random_idx = rng_get_u32() % jokers_avail_size;
+
364 int fallback_random_joker_id = UNDEFINED;
+
365 int match_count = 0;
+
366
+
367 BitsetItr itr = bitset_itr_create(&s_rollable_jokers_bitset);
+
368
+
369 int i = 0;
+
370 int joker_id = UNDEFINED;
+
371 while ((joker_id = bitset_itr_next(&itr)) != UNDEFINED)
+
372 {
+
373 if (i++ == fallback_random_idx)
+
374 fallback_random_joker_id = joker_id;
+
375 const JokerInfo* info = get_joker_registry_entry(joker_id);
+
376 if (info->rarity == joker_rarity)
+
377 {
+
378 matching_joker_ids[match_count++] = joker_id;
+
379 }
+
380 }
+
381
+
382 int selected_joker_id = (match_count > 0) ? matching_joker_ids[rng_get_u32() % match_count]
+
383 : fallback_random_joker_id;
+
384
+
385 return selected_joker_id;
+
386}
+
387
+
+ +
389{
+
390 if (no_rollable_jokers())
+
391 return NULL;
+
392
+
393 int joker_id = 0;
+
394#ifdef TEST_JOKER_ID0 // Allow defining an ID for a joker to always appear in shop and be tested
+
395 if (joker_is_rollable(TEST_JOKER_ID0))
+
396 {
+
397 joker_id = TEST_JOKER_ID0;
+
398 }
+
399 else
+
400#endif
+
401#ifdef TEST_JOKER_ID1
+
402 if (joker_is_rollable(TEST_JOKER_ID1))
+
403 {
+
404 joker_id = TEST_JOKER_ID1;
+
405 }
+
406 else
+
407#endif
+
408 {
+
409 joker_id = joker_roll_id();
+
410 }
+
411
+
412 // If for some reason only no joker is left, don't make another
+
413 if (joker_id == UNDEFINED)
+
414 return NULL;
+
415
+
416 joker_set_rollable(joker_id, false);
+
417
+
418 return (Item*)joker_object_new(joker_new(joker_id));
+
419}
-
419
-
420static void set_and_shift_text(char* str, int* cursor_pos_x, int* cursor_pos_y, int color_pb)
-
421{
-
422 tte_set_pos(*cursor_pos_x, *cursor_pos_y);
-
423 tte_set_special(color_pb * TTE_SPECIAL_PB_MULT_OFFSET);
-
424 tte_write(str);
-
425
-
426 // + 1 For space
-
427 const int joker_score_display_offset_px = (MAX_CARD_SCORE_STR_LEN + 1) * TTE_CHAR_SIZE;
-
428 *cursor_pos_x += joker_score_display_offset_px;
-
429}
-
430
-
431bool joker_object_score(
-
432 JokerObject* joker_object,
-
433 CardObject* card_object,
-
434 enum JokerEvent joker_event
-
435)
-
436{
-
437 if (joker_object == NULL)
-
438 {
-
439 return false;
-
440 }
-
441
-
442 JokerEffect* joker_effect = NULL;
-
443 u32 effect_flags_ret =
-
444 joker_get_score_effect(joker_object->joker, card_object->card, joker_event, &joker_effect);
-
445
-
446 if (effect_flags_ret == JOKER_EFFECT_FLAG_NONE)
-
447 {
-
448 return false;
-
449 }
-
450
-
451 if (effect_flags_ret & JOKER_EFFECT_FLAG_RETRIGGER)
-
452 {
-
453 set_retrigger(joker_effect->retrigger);
-
454 }
-
455
-
456 // joker_effect.message will have been set if the Joker had anything custom to say
-
457
-
458 int cursorPosX = TILE_SIZE; // Offset of one tile to better center the text on the card
-
459 int cursorPosY = 0;
-
460 if (joker_event == JOKER_EVENT_ON_CARD_HELD)
-
461 {
-
462 // display the text on top of the card instead of below the Joker for Held Cards effects
-
463 // scored_card cannot be NULL here because of the joker event
-
464 cursorPosX += fx2int(card_object->x);
-
465 cursorPosY = HELD_CARD_SCORE_TEXT_Y;
-
466 }
-
467 else
-
468 {
-
469 cursorPosX += fx2int(joker_object->x);
-
470 cursorPosY = JOKER_SCORE_TEXT_Y;
-
471 }
-
472
-
473 mm_word sfx_id;
-
474 if (effect_flags_ret & JOKER_EFFECT_FLAG_CHIPS)
-
475 {
-
476 g_game_vars.chips = u32_protected_add(g_game_vars.chips, joker_effect->chips);
-
477 char score_buffer[INT_MAX_DIGITS + 2]; // For '+' and null terminator
-
478 snprintf(score_buffer, sizeof(score_buffer), "+%lu", joker_effect->chips);
-
479 set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_BLUE_PB);
-
480 sfx_id = SFX_CHIPS_GENERIC; // The joker chips effect is "generic"
-
481 }
-
482 if (effect_flags_ret & JOKER_EFFECT_FLAG_MULT)
-
483 {
-
484 g_game_vars.mult = u32_protected_add(g_game_vars.mult, joker_effect->mult);
-
485 char score_buffer[INT_MAX_DIGITS + 2];
-
486 snprintf(score_buffer, sizeof(score_buffer), "+%lu", joker_effect->mult);
-
487 set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_RED_PB);
-
488 sfx_id = SFX_MULT;
-
489 }
-
490 // if xmult is zero, DO NOT multiply by it
-
491 if (effect_flags_ret & JOKER_EFFECT_FLAG_XMULT && joker_effect->xmult > 0)
-
492 {
-
493 g_game_vars.mult = u32_protected_mult(g_game_vars.mult, joker_effect->xmult);
-
494 char score_buffer[INT_MAX_DIGITS + 2];
-
495 snprintf(score_buffer, sizeof(score_buffer), "X%lu", joker_effect->xmult);
-
496 set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_RED_PB);
-
497 sfx_id = SFX_XMULT;
-
498 }
-
499 if (effect_flags_ret & JOKER_EFFECT_FLAG_MONEY)
-
500 {
-
501 g_game_vars.money += joker_effect->money;
-
502 char score_buffer[INT_MAX_DIGITS + 2];
-
503 snprintf(score_buffer, sizeof(score_buffer), "%d$", joker_effect->money);
-
504 set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_YELLOW_PB);
-
505 // TODO: Money sound effect
-
506 }
-
507 // custom message for Jokers (including retriggers where Jokers will say "Again!")
-
508 // joker_effect->message will have been set if the Joker had anything custom to say
-
509 if (effect_flags_ret & JOKER_EFFECT_FLAG_MESSAGE)
-
510 {
-
511 set_and_shift_text(joker_effect->message, &cursorPosX, &cursorPosY, TTE_WHITE_PB);
-
512 }
-
513 // this will start the Joker expire animation
-
514 if (effect_flags_ret & JOKER_EFFECT_FLAG_EXPIRE && joker_effect->expire)
-
515 {
-
516 joker_object_shake(joker_object, UNDEFINED);
-
517 list_push_back(get_expired_jokers_list(), joker_object);
-
518 }
-
519
-
520 // Update displays
-
521 display_chips();
-
522 display_mult();
-
523 display_money();
-
524
-
525 joker_object_shake(joker_object, sfx_id);
-
526
-
527 return true;
-
528}
-
529
-
530Sprite* joker_object_get_sprite(JokerObject* joker_object)
-
531{
-
532 if (joker_object == NULL)
-
533 return NULL;
-
534 return sprite_object_get_sprite((SpriteObject*)joker_object);
-
535}
-
536
-
537int joker_get_random_rarity()
-
538{
-
539 int joker_rarity = 0;
-
540 int rarity_roll = rng_get_u32() % 100;
-
541 if (rarity_roll < COMMON_JOKER_CHANCE)
-
542 {
-
543 joker_rarity = COMMON_JOKER;
-
544 }
-
545 else if (rarity_roll < COMMON_JOKER_CHANCE + UNCOMMON_JOKER_CHANCE)
-
546 {
-
547 joker_rarity = UNCOMMON_JOKER;
-
548 }
-
549 else if (rarity_roll < COMMON_JOKER_CHANCE + UNCOMMON_JOKER_CHANCE + RARE_JOKER_CHANCE)
-
550 {
-
551 joker_rarity = RARE_JOKER;
-
552 }
-
553 else if (rarity_roll < COMMON_JOKER_CHANCE + UNCOMMON_JOKER_CHANCE + RARE_JOKER_CHANCE +
-
554 LEGENDARY_JOKER_CHANCE)
-
555 {
-
556 joker_rarity = LEGENDARY_JOKER;
-
557 }
-
558
-
559 return joker_rarity;
-
560}
-
561
-
562static int s_get_num_spritesheets()
-
563{
-
564 return MAX_NUM_JOKERS_SPRITESHEETS;
-
565}
-
566
-
567static int s_joker_get_spritesheet_idx(u8 joker_id)
-
568{
-
569 return joker_id_to_sprite_map[joker_id];
-
570}
-
571
-
572static int s_joker_get_sprite_idx_in_sheet(u8 joker_id, int spritesheet_idx)
-
573{
-
574 return joker_id - spritesheet_idx_to_starting_joker_id[joker_id_to_sprite_map[joker_id]];
-
575}
-
576
-
577static void s_joker_pb_add_sprite_user(int pb)
-
578{
-
579 joker_pb_num_sprite_users[pb - JOKER_BASE_PB]++;
-
580}
-
581
-
582static void s_joker_pb_remove_sprite_user(int pb)
-
583{
-
584 int num_sprite_users = joker_pb_num_sprite_users[pb - JOKER_BASE_PB];
-
585 joker_pb_num_sprite_users[pb - JOKER_BASE_PB] = max(0, num_sprite_users - 1);
-
586}
-
587
-
588static int s_joker_pb_get_num_sprite_users(int joker_pb)
-
589{
-
590 return joker_pb_num_sprite_users[joker_pb - JOKER_BASE_PB];
-
591}
-
592
-
593static int s_get_unused_joker_pb()
-
594{
-
595 for (int i = 0; i < NUM_ELEM_IN_ARR(joker_pb_num_sprite_users); i++)
-
596 {
-
597 if (joker_pb_num_sprite_users[i] == 0)
-
598 {
-
599 return (i + JOKER_BASE_PB);
-
600 }
-
601 }
-
602
-
603 return UNDEFINED;
-
604}
-
605
-
606static int s_allocate_pb_if_needed(u8 joker_id)
-
607{
-
608 int joker_spritesheet_idx = s_joker_get_spritesheet_idx(joker_id);
-
609 int joker_pb = joker_spritesheet_pb_map[joker_spritesheet_idx];
-
610 if (joker_pb != UNDEFINED)
-
611 {
-
612 // Already allocated
-
613 return joker_pb;
-
614 }
-
615
-
616 // Allocate a new palette
-
617 joker_pb = s_get_unused_joker_pb();
-
618
-
619 if (joker_pb == UNDEFINED)
-
620 {
-
621 // Ran out of palettes, default to base and pray
-
622 joker_pb = JOKER_BASE_PB;
-
623 }
-
624 else
-
625 {
-
626 joker_spritesheet_pb_map[joker_spritesheet_idx] = joker_pb;
-
627 memcpy16(
-
628 &pal_obj_mem[PAL_ROW_LEN * joker_pb],
-
629 joker_gfxPal[joker_spritesheet_idx],
-
630 NUM_ELEM_IN_ARR(joker_gfx0Pal)
-
631 );
-
632 }
-
633
-
634 return joker_pb;
-
635}
+
420
+
421static void set_and_shift_text(char* str, int* cursor_pos_x, int* cursor_pos_y, int color_pb)
+
422{
+
423 tte_set_pos(*cursor_pos_x, *cursor_pos_y);
+
424 tte_set_special(color_pb * TTE_SPECIAL_PB_MULT_OFFSET);
+
425 tte_write(str);
+
426
+
427 // + 1 For space
+
428 const int joker_score_display_offset_px = (MAX_CARD_SCORE_STR_LEN + 1) * TTE_CHAR_SIZE;
+
429 *cursor_pos_x += joker_score_display_offset_px;
+
430}
+
431
+
432bool joker_object_score(
+
433 JokerObject* joker_object,
+
434 CardObject* card_object,
+
435 enum JokerEvent joker_event
+
436)
+
437{
+
438 if (joker_object == NULL)
+
439 {
+
440 return false;
+
441 }
+
442
+
443 JokerEffect* joker_effect = NULL;
+
444 u32 effect_flags_ret =
+
445 joker_get_score_effect(joker_object->joker, card_object->card, joker_event, &joker_effect);
+
446
+
447 if (effect_flags_ret == JOKER_EFFECT_FLAG_NONE)
+
448 {
+
449 return false;
+
450 }
+
451
+
452 if (effect_flags_ret & JOKER_EFFECT_FLAG_RETRIGGER)
+
453 {
+
454 set_retrigger(joker_effect->retrigger);
+
455 }
+
456
+
457 // joker_effect.message will have been set if the Joker had anything custom to say
+
458
+
459 int cursorPosX = TILE_SIZE; // Offset of one tile to better center the text on the card
+
460 int cursorPosY = 0;
+
461 if (joker_event == JOKER_EVENT_ON_CARD_HELD)
+
462 {
+
463 // display the text on top of the card instead of below the Joker for Held Cards effects
+
464 // scored_card cannot be NULL here because of the joker event
+
465 cursorPosX += fx2int(card_object->x);
+
466 cursorPosY = HELD_CARD_SCORE_TEXT_Y;
+
467 }
+
468 else
+
469 {
+
470 cursorPosX += fx2int(joker_object->x);
+
471 cursorPosY = JOKER_SCORE_TEXT_Y;
+
472 }
+
473
+
474 mm_word sfx_id;
+
475 if (effect_flags_ret & JOKER_EFFECT_FLAG_CHIPS)
+
476 {
+
477 g_game_vars.chips = u32_protected_add(g_game_vars.chips, joker_effect->chips);
+
478 char score_buffer[INT_MAX_DIGITS + 2]; // For '+' and null terminator
+
479 snprintf(score_buffer, sizeof(score_buffer), "+%lu", joker_effect->chips);
+
480 set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_BLUE_PB);
+
481 sfx_id = SFX_CHIPS_GENERIC; // The joker chips effect is "generic"
+
482 }
+
483 if (effect_flags_ret & JOKER_EFFECT_FLAG_MULT)
+
484 {
+
485 g_game_vars.mult = u32_protected_add(g_game_vars.mult, joker_effect->mult);
+
486 char score_buffer[INT_MAX_DIGITS + 2];
+
487 snprintf(score_buffer, sizeof(score_buffer), "+%lu", joker_effect->mult);
+
488 set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_RED_PB);
+
489 sfx_id = SFX_MULT;
+
490 }
+
491 // if xmult is zero, DO NOT multiply by it
+
492 if (effect_flags_ret & JOKER_EFFECT_FLAG_XMULT && joker_effect->xmult > 0)
+
493 {
+
494 g_game_vars.mult = u32_protected_mult(g_game_vars.mult, joker_effect->xmult);
+
495 char score_buffer[INT_MAX_DIGITS + 2];
+
496 snprintf(score_buffer, sizeof(score_buffer), "X%lu", joker_effect->xmult);
+
497 set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_RED_PB);
+
498 sfx_id = SFX_XMULT;
+
499 }
+
500 if (effect_flags_ret & JOKER_EFFECT_FLAG_MONEY)
+
501 {
+
502 g_game_vars.money += joker_effect->money;
+
503 char score_buffer[INT_MAX_DIGITS + 2];
+
504 snprintf(score_buffer, sizeof(score_buffer), "%d$", joker_effect->money);
+
505 set_and_shift_text(score_buffer, &cursorPosX, &cursorPosY, TTE_YELLOW_PB);
+
506 // TODO: Money sound effect
+
507 }
+
508 // custom message for Jokers (including retriggers where Jokers will say "Again!")
+
509 // joker_effect->message will have been set if the Joker had anything custom to say
+
510 if (effect_flags_ret & JOKER_EFFECT_FLAG_MESSAGE)
+
511 {
+
512 set_and_shift_text(joker_effect->message, &cursorPosX, &cursorPosY, TTE_WHITE_PB);
+
513 }
+
514 // this will start the Joker expire animation
+
515 if (effect_flags_ret & JOKER_EFFECT_FLAG_EXPIRE && joker_effect->expire)
+
516 {
+
517 joker_object_shake(joker_object, UNDEFINED);
+
518 list_push_back(get_expired_jokers_list(), joker_object);
+
519 }
+
520
+
521 // Update displays
+
522 display_chips();
+
523 display_mult();
+
524 display_money();
+
525
+
526 joker_object_shake(joker_object, sfx_id);
+
527
+
528 return true;
+
529}
+
530
+
531Sprite* joker_object_get_sprite(JokerObject* joker_object)
+
532{
+
533 if (joker_object == NULL)
+
534 return NULL;
+
535 return sprite_object_get_sprite((SpriteObject*)joker_object);
+
536}
+
537
+
538int joker_get_random_rarity()
+
539{
+
540 int joker_rarity = 0;
+
541 int rarity_roll = rng_get_u32() % 100;
+
542 if (rarity_roll < COMMON_JOKER_CHANCE)
+
543 {
+
544 joker_rarity = COMMON_JOKER;
+
545 }
+
546 else if (rarity_roll < COMMON_JOKER_CHANCE + UNCOMMON_JOKER_CHANCE)
+
547 {
+
548 joker_rarity = UNCOMMON_JOKER;
+
549 }
+
550 else if (rarity_roll < COMMON_JOKER_CHANCE + UNCOMMON_JOKER_CHANCE + RARE_JOKER_CHANCE)
+
551 {
+
552 joker_rarity = RARE_JOKER;
+
553 }
+
554 else if (rarity_roll < COMMON_JOKER_CHANCE + UNCOMMON_JOKER_CHANCE + RARE_JOKER_CHANCE +
+
555 LEGENDARY_JOKER_CHANCE)
+
556 {
+
557 joker_rarity = LEGENDARY_JOKER;
+
558 }
+
559
+
560 return joker_rarity;
+
561}
+
562
+
563static int s_get_num_spritesheets()
+
564{
+
565 return MAX_NUM_JOKERS_SPRITESHEETS;
+
566}
+
567
+
568static int s_joker_get_spritesheet_idx(u8 joker_id)
+
569{
+
570 return JOKER_ID_TO_SPRITE_MAP[joker_id];
+
571}
+
572
+
573static int s_joker_get_sprite_idx_in_sheet(u8 joker_id, int spritesheet_idx)
+
574{
+
575 return joker_id - SPRITESHEET_IDX_TO_STARTING_JOKER_ID[JOKER_ID_TO_SPRITE_MAP[joker_id]];
+
576}
+
577
+
578static void s_joker_pb_add_sprite_user(int pb)
+
579{
+
580 s_joker_pb_num_sprite_users[pb - JOKER_BASE_PB]++;
+
581}
+
582
+
583static void s_joker_pb_remove_sprite_user(int pb)
+
584{
+
585 int num_sprite_users = s_joker_pb_num_sprite_users[pb - JOKER_BASE_PB];
+
586 s_joker_pb_num_sprite_users[pb - JOKER_BASE_PB] = max(0, num_sprite_users - 1);
+
587}
+
588
+
589static int s_joker_pb_get_num_sprite_users(int joker_pb)
+
590{
+
591 return s_joker_pb_num_sprite_users[joker_pb - JOKER_BASE_PB];
+
592}
+
593
+
594static int s_get_unused_joker_pb()
+
595{
+
596 for (int i = 0; i < NUM_ELEM_IN_ARR(s_joker_pb_num_sprite_users); i++)
+
597 {
+
598 if (s_joker_pb_num_sprite_users[i] == 0)
+
599 {
+
600 return (i + JOKER_BASE_PB);
+
601 }
+
602 }
+
603
+
604 return UNDEFINED;
+
605}
+
606
+
607static int s_allocate_pb_if_needed(u8 joker_id)
+
608{
+
609 int joker_spritesheet_idx = s_joker_get_spritesheet_idx(joker_id);
+
610 int joker_pb = s_joker_spritesheet_pb_map[joker_spritesheet_idx];
+
611 if (joker_pb != UNDEFINED)
+
612 {
+
613 // Already allocated
+
614 return joker_pb;
+
615 }
+
616
+
617 // Allocate a new palette
+
618 joker_pb = s_get_unused_joker_pb();
+
619
+
620 if (joker_pb == UNDEFINED)
+
621 {
+
622 // Ran out of palettes, default to base and pray
+
623 joker_pb = JOKER_BASE_PB;
+
624 }
+
625 else
+
626 {
+
627 s_joker_spritesheet_pb_map[joker_spritesheet_idx] = joker_pb;
+
628 memcpy16(
+
629 &pal_obj_mem[PAL_ROW_LEN * joker_pb],
+
630 joker_gfxPal[joker_spritesheet_idx],
+
631 NUM_ELEM_IN_ARR(joker_gfx0Pal)
+
632 );
+
633 }
+
634
+
635 return joker_pb;
+
636}
bool bitset_get_idx(Bitset *bitset, int idx)
Get the value of a flag.
Definition bitset.c:72
bool bitset_is_empty(Bitset *bitset)
Check if a bitset is empty (all 0's)
Definition bitset.c:62
void bitset_clear(Bitset *bitset)
Clear the bitset, all to 0.
Definition bitset.c:54
@@ -794,13 +795,13 @@ $(document).ready(function(){initNavTree('joker_8c_source.html',''); initResizab
#define ITEM_RETURN_IF_UNEXPECTED_TYPE_RET(item, expected_type, ret_val)
Checks if item is of type expected_type - logs error message and returns otherwise.
Definition item.h:24
#define ITEM_RETURN_IF_UNEXPECTED_TYPE_VOID(item, expected_type)
Checks if item is of type expected_type - logs error message and returns otherwise.
Definition item.h:40
Functions relative to the handling of Jokers.
-
void joker_object_dispose(Item **joker_object)
Destroy a JokerObject item, free its resources, and make it available to be rolled.
Definition joker.c:271
-
u16 joker_get_rarity_color(u8 rarity, bool main_color)
Get Joker rarity panel color.
Definition joker.c:177
-
Item * joker_object_roll_new(void)
Roll and create a new JokerObject item.
Definition joker.c:387
-
int joker_object_get_buy_price(Item *joker_object)
Returns the buy price of the joker object.
Definition joker.c:291
-
void joker_object_add_to_owned(Item *joker_object)
Add a Joker to the list of owned Jokers and place it in the joker row.
Definition joker.c:299
-
void joker_reset_rollable_jokers(void)
Reset rollable jokers to include all jokers in the registry.
Definition joker.c:336
-
void joker_set_rollable(int joker_id, bool rollable)
Set whether a Joker is available to be rolled for the shop, packs, etc.
Definition joker.c:308
+
void joker_object_dispose(Item **joker_object)
Destroy a JokerObject item, free its resources, and make it available to be rolled.
Definition joker.c:272
+
u16 joker_get_rarity_color(u8 rarity, bool main_color)
Get Joker rarity panel color.
Definition joker.c:178
+
Item * joker_object_roll_new(void)
Roll and create a new JokerObject item.
Definition joker.c:388
+
int joker_object_get_buy_price(Item *joker_object)
Returns the buy price of the joker object.
Definition joker.c:292
+
void joker_object_add_to_owned(Item *joker_object)
Add a Joker to the list of owned Jokers and place it in the joker row.
Definition joker.c:300
+
void joker_reset_rollable_jokers(void)
Reset rollable jokers to include all jokers in the registry.
Definition joker.c:337
+
void joker_set_rollable(int joker_id, bool rollable)
Set whether a Joker is available to be rolled for the shop, packs, etc.
Definition joker.c:309
Header of shared rects and points needed for ui.
void list_push_back(List *list, void *data)
Definition list.c:89
Interface to interact with the mgba logger.
diff --git a/joker_8h.html b/joker_8h.html index 5363db8d..80c48c96 100644 --- a/joker_8h.html +++ b/joker_8h.html @@ -1023,7 +1023,7 @@ Functions
-

Definition at line 149 of file joker.c.

+

Definition at line 150 of file joker.c.

@@ -1042,7 +1042,7 @@ Functions
-

Definition at line 537 of file joker.c.

+

Definition at line 538 of file joker.c.

@@ -1092,7 +1092,7 @@ Functions
Returns
u16 value of the color, not a pointer
-

Definition at line 177 of file joker.c.

+

Definition at line 178 of file joker.c.

@@ -1112,7 +1112,7 @@ Functions
-

Definition at line 169 of file joker.c.

+

Definition at line 170 of file joker.c.

@@ -1154,7 +1154,7 @@ Functions
-

Definition at line 155 of file joker.c.

+

Definition at line 156 of file joker.c.

@@ -1174,7 +1174,7 @@ Functions
-

Definition at line 194 of file joker.c.

+

Definition at line 195 of file joker.c.

@@ -1193,7 +1193,7 @@ Functions
-

Definition at line 116 of file joker.c.

+

Definition at line 117 of file joker.c.

@@ -1213,7 +1213,7 @@ Functions
-

Definition at line 127 of file joker.c.

+

Definition at line 128 of file joker.c.

@@ -1241,7 +1241,7 @@ Functions -

Definition at line 299 of file joker.c.

+

Definition at line 300 of file joker.c.

@@ -1261,7 +1261,7 @@ Functions
-

Definition at line 250 of file joker.c.

+

Definition at line 251 of file joker.c.

@@ -1289,7 +1289,7 @@ Functions -

Definition at line 271 of file joker.c.

+

Definition at line 272 of file joker.c.

@@ -1318,7 +1318,7 @@ Functions
Returns
UNDEFINED in case of error, the buy price of the joker otherwise.
-

Definition at line 291 of file joker.c.

+

Definition at line 292 of file joker.c.

@@ -1338,7 +1338,7 @@ Functions
-

Definition at line 530 of file joker.c.

+

Definition at line 531 of file joker.c.

@@ -1358,7 +1358,7 @@ Functions
-

Definition at line 202 of file joker.c.

+

Definition at line 203 of file joker.c.

@@ -1381,7 +1381,7 @@ Functions

Roll and create a new JokerObject item.

Returns
Newly created Item* (JokerObject) or NULL if none available.
-

Definition at line 387 of file joker.c.

+

Definition at line 388 of file joker.c.

@@ -1417,7 +1417,7 @@ Functions
-

Definition at line 431 of file joker.c.

+

Definition at line 432 of file joker.c.

@@ -1447,7 +1447,7 @@ Functions
-

Definition at line 286 of file joker.c.

+

Definition at line 287 of file joker.c.

@@ -1469,7 +1469,7 @@ Functions

Reset rollable jokers to include all jokers in the registry.

-

Definition at line 336 of file joker.c.

+

Definition at line 337 of file joker.c.

@@ -1508,7 +1508,7 @@ Functions -

Definition at line 308 of file joker.c.

+

Definition at line 309 of file joker.c.

diff --git a/joker_8h_source.html b/joker_8h_source.html index 2a0c2e9e..283d5fec 100644 --- a/joker_8h_source.html +++ b/joker_8h_source.html @@ -354,13 +354,13 @@ $(document).ready(function(){initNavTree('joker_8h_source.html',''); initResizab
258#endif // JOKER_H
graphic_utils.h
Graphic utility functions.
item.h
The core structure for items in the shop and inventory. Provides a common API for the shop and invent...
-
joker_object_dispose
void joker_object_dispose(Item **joker_object)
Destroy a JokerObject item, free its resources, and make it available to be rolled.
Definition joker.c:271
-
joker_get_rarity_color
u16 joker_get_rarity_color(u8 rarity, bool main_color)
Get Joker rarity panel color.
Definition joker.c:177
-
joker_object_roll_new
Item * joker_object_roll_new(void)
Roll and create a new JokerObject item.
Definition joker.c:387
-
joker_object_get_buy_price
int joker_object_get_buy_price(Item *joker_object)
Returns the buy price of the joker object.
Definition joker.c:291
-
joker_object_add_to_owned
void joker_object_add_to_owned(Item *joker_object)
Add a Joker to the list of owned Jokers and place it in the joker row.
Definition joker.c:299
-
joker_reset_rollable_jokers
void joker_reset_rollable_jokers(void)
Reset rollable jokers to include all jokers in the registry.
Definition joker.c:336
-
joker_set_rollable
void joker_set_rollable(int joker_id, bool rollable)
Set whether a Joker is available to be rolled for the shop, packs, etc.
Definition joker.c:308
+
joker_object_dispose
void joker_object_dispose(Item **joker_object)
Destroy a JokerObject item, free its resources, and make it available to be rolled.
Definition joker.c:272
+
joker_get_rarity_color
u16 joker_get_rarity_color(u8 rarity, bool main_color)
Get Joker rarity panel color.
Definition joker.c:178
+
joker_object_roll_new
Item * joker_object_roll_new(void)
Roll and create a new JokerObject item.
Definition joker.c:388
+
joker_object_get_buy_price
int joker_object_get_buy_price(Item *joker_object)
Returns the buy price of the joker object.
Definition joker.c:292
+
joker_object_add_to_owned
void joker_object_add_to_owned(Item *joker_object)
Add a Joker to the list of owned Jokers and place it in the joker row.
Definition joker.c:300
+
joker_reset_rollable_jokers
void joker_reset_rollable_jokers(void)
Reset rollable jokers to include all jokers in the registry.
Definition joker.c:337
+
joker_set_rollable
void joker_set_rollable(int joker_id, bool rollable)
Set whether a Joker is available to be rolled for the shop, packs, etc.
Definition joker.c:309
CardObject
Definition card.h:56
Card
Definition card.h:50
Item
A generic interface for all items that can appear in the shop or be in the inventory....
Definition item.h:75
diff --git a/joker__effects_8c_source.html b/joker__effects_8c_source.html index 222afece..b9d85088 100644 --- a/joker__effects_8c_source.html +++ b/joker__effects_8c_source.html @@ -176,7 +176,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
36 return JOKER_EFFECT_FLAG_NONE; \
37 }
38
-
39static JokerEffect shared_joker_effect = {0};
+
39static JokerEffect s_shared_joker_effect = {0};
40
41// Joker Descriptions
42
@@ -876,7 +876,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
736)
737{
738 SCORE_ON_EVENT_ONLY(JOKER_EVENT_INDEPENDENT, joker_event)
-
739 *joker_effect = &shared_joker_effect;
+
739 *joker_effect = &s_shared_joker_effect;
740
741 (*joker_effect)->mult = 4;
742
@@ -896,7 +896,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
756
757 if (scored_card->suit == sinful_suit)
758 {
-
759 *joker_effect = &shared_joker_effect;
+
759 *joker_effect = &s_shared_joker_effect;
760
761 (*joker_effect)->mult = 3;
762 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -957,7 +957,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
817
818 if (get_contained_hands()->PAIR)
819 {
-
820 *joker_effect = &shared_joker_effect;
+
820 *joker_effect = &s_shared_joker_effect;
821
822 (*joker_effect)->mult = 8;
823 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -979,7 +979,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
839
840 if (get_contained_hands()->THREE_OF_A_KIND)
841 {
-
842 *joker_effect = &shared_joker_effect;
+
842 *joker_effect = &s_shared_joker_effect;
843
844 (*joker_effect)->mult = 12;
845 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -1001,7 +1001,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
861
862 if (get_contained_hands()->TWO_PAIR)
863 {
-
864 *joker_effect = &shared_joker_effect;
+
864 *joker_effect = &s_shared_joker_effect;
865
866 (*joker_effect)->mult = 10;
867 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -1023,7 +1023,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
883
884 if (get_contained_hands()->STRAIGHT)
885 {
-
886 *joker_effect = &shared_joker_effect;
+
886 *joker_effect = &s_shared_joker_effect;
887
888 (*joker_effect)->mult = 12;
889 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -1045,7 +1045,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
905
906 if (get_contained_hands()->FLUSH)
907 {
-
908 *joker_effect = &shared_joker_effect;
+
908 *joker_effect = &s_shared_joker_effect;
909
910 (*joker_effect)->mult = 10;
911 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -1067,7 +1067,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
927
928 if (get_contained_hands()->PAIR)
929 {
-
930 *joker_effect = &shared_joker_effect;
+
930 *joker_effect = &s_shared_joker_effect;
931
932 (*joker_effect)->chips = 50;
933 effect_flags_ret = JOKER_EFFECT_FLAG_CHIPS;
@@ -1089,7 +1089,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
949
950 if (get_contained_hands()->THREE_OF_A_KIND)
951 {
-
952 *joker_effect = &shared_joker_effect;
+
952 *joker_effect = &s_shared_joker_effect;
953
954 (*joker_effect)->chips = 100;
955 effect_flags_ret = JOKER_EFFECT_FLAG_CHIPS;
@@ -1111,7 +1111,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
971
972 if (get_contained_hands()->TWO_PAIR)
973 {
-
974 *joker_effect = &shared_joker_effect;
+
974 *joker_effect = &s_shared_joker_effect;
975
976 (*joker_effect)->chips = 80;
977 effect_flags_ret = JOKER_EFFECT_FLAG_CHIPS;
@@ -1133,7 +1133,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
993
994 if (get_contained_hands()->STRAIGHT)
995 {
-
996 *joker_effect = &shared_joker_effect;
+
996 *joker_effect = &s_shared_joker_effect;
997
998 (*joker_effect)->chips = 100;
999 effect_flags_ret = JOKER_EFFECT_FLAG_CHIPS;
@@ -1155,7 +1155,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1015
1016 if (get_contained_hands()->FLUSH)
1017 {
-
1018 *joker_effect = &shared_joker_effect;
+
1018 *joker_effect = &s_shared_joker_effect;
1019
1020 (*joker_effect)->chips = 80;
1021 effect_flags_ret = JOKER_EFFECT_FLAG_CHIPS;
@@ -1178,7 +1178,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1038 int played_size = get_played_size();
1039 if (played_size <= 3)
1040 {
-
1041 *joker_effect = &shared_joker_effect;
+
1041 *joker_effect = &s_shared_joker_effect;
1042
1043 (*joker_effect)->mult = 20;
1044 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -1196,7 +1196,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1056{
1057 SCORE_ON_EVENT_ONLY(JOKER_EVENT_INDEPENDENT, joker_event)
1058
-
1059 *joker_effect = &shared_joker_effect;
+
1059 *joker_effect = &s_shared_joker_effect;
1060
1061 List* jokers = get_jokers_list();
1062
@@ -1228,7 +1228,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1088{
1089 SCORE_ON_EVENT_ONLY(JOKER_EVENT_INDEPENDENT, joker_event)
1090
-
1091 *joker_effect = &shared_joker_effect;
+
1091 *joker_effect = &s_shared_joker_effect;
1092
1093 (*joker_effect)->mult = rng_get_u32() % (MISPRINT_MAX_MULT + 1);
1094
@@ -1248,7 +1248,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1108
1109 if (scored_card->rank == TEN || scored_card->rank == FOUR)
1110 {
-
1111 *joker_effect = &shared_joker_effect;
+
1111 *joker_effect = &s_shared_joker_effect;
1112
1113 (*joker_effect)->chips = 10;
1114 (*joker_effect)->mult = 4;
@@ -1276,7 +1276,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1136 case THREE:
1137 case FIVE:
1138 case EIGHT:
-
1139 *joker_effect = &shared_joker_effect;
+
1139 *joker_effect = &s_shared_joker_effect;
1140 (*joker_effect)->mult = 8;
1141 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
1142 break;
@@ -1300,7 +1300,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1160
1161 if (get_num_discards_remaining() > 0)
1162 {
-
1163 *joker_effect = &shared_joker_effect;
+
1163 *joker_effect = &s_shared_joker_effect;
1164
1165 (*joker_effect)->chips = 30 * get_num_discards_remaining();
1166 effect_flags_ret = JOKER_EFFECT_FLAG_CHIPS;
@@ -1322,7 +1322,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1182
1183 if (get_num_discards_remaining() == 0)
1184 {
-
1185 *joker_effect = &shared_joker_effect;
+
1185 *joker_effect = &s_shared_joker_effect;
1186
1187 (*joker_effect)->mult = 15;
1188 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -1356,7 +1356,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1216
1217 if (all_cards_are_spades_or_clubs)
1218 {
-
1219 *joker_effect = &shared_joker_effect;
+
1219 *joker_effect = &s_shared_joker_effect;
1220
1221 (*joker_effect)->xmult = 3;
1222 effect_flags_ret = JOKER_EFFECT_FLAG_XMULT;
@@ -1374,7 +1374,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1234{
1235 SCORE_ON_EVENT_ONLY(JOKER_EVENT_INDEPENDENT, joker_event)
1236
-
1237 *joker_effect = &shared_joker_effect;
+
1237 *joker_effect = &s_shared_joker_effect;
1238
1239 (*joker_effect)->chips = (get_deck_top() + 1) * 2;
1240
@@ -1416,7 +1416,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1276 case JOKER_EVENT_ON_CARD_HELD:
1277 if (get_scored_card_index() == *p_lowest_value_index)
1278 {
-
1279 *joker_effect = &shared_joker_effect;
+
1279 *joker_effect = &s_shared_joker_effect;
1280
1281 (*joker_effect)->mult = 2 * card_get_value(scored_card);
1282 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -1443,7 +1443,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1303
1304 if ((rng_get_u32() % 2 == 0) && card_is_face(scored_card))
1305 {
-
1306 *joker_effect = &shared_joker_effect;
+
1306 *joker_effect = &s_shared_joker_effect;
1307
1308 (*joker_effect)->money = 1;
1309 effect_flags_ret = JOKER_EFFECT_FLAG_MONEY;
@@ -1465,7 +1465,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1325
1326 if ((rng_get_u32() % 2 == 0) && card_is_face(scored_card))
1327 {
-
1328 *joker_effect = &shared_joker_effect;
+
1328 *joker_effect = &s_shared_joker_effect;
1329
1330 (*joker_effect)->money = 2;
1331 effect_flags_ret = JOKER_EFFECT_FLAG_MONEY;
@@ -1487,7 +1487,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1347
1348 if (scored_card->rank == ACE)
1349 {
-
1350 *joker_effect = &shared_joker_effect;
+
1350 *joker_effect = &s_shared_joker_effect;
1351
1352 (*joker_effect)->chips = 20;
1353 (*joker_effect)->mult = 4;
@@ -1510,7 +1510,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1370
1371 if (card_is_face(scored_card))
1372 {
-
1373 *joker_effect = &shared_joker_effect;
+
1373 *joker_effect = &s_shared_joker_effect;
1374
1375 (*joker_effect)->chips = 30;
1376 effect_flags_ret = JOKER_EFFECT_FLAG_CHIPS;
@@ -1528,7 +1528,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1388{
1389 SCORE_ON_EVENT_ONLY(JOKER_EVENT_INDEPENDENT, joker_event)
1390
-
1391 *joker_effect = &shared_joker_effect;
+
1391 *joker_effect = &s_shared_joker_effect;
1392
1393 // +1 xmult per occupied joker slot
1394 int num_jokers = list_get_len(get_jokers_list());
@@ -1553,7 +1553,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1413 // This allows us to avoid scoring negative Chips
1414 if (g_game_vars.money > 0)
1415 {
-
1416 *joker_effect = &shared_joker_effect;
+
1416 *joker_effect = &s_shared_joker_effect;
1417
1418 (*joker_effect)->chips = g_game_vars.money * 2;
1419 effect_flags_ret = JOKER_EFFECT_FLAG_CHIPS;
@@ -1575,7 +1575,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1435
1436 if (card_is_face(scored_card))
1437 {
-
1438 *joker_effect = &shared_joker_effect;
+
1438 *joker_effect = &s_shared_joker_effect;
1439
1440 (*joker_effect)->mult = 5;
1441 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -1604,7 +1604,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1464 default:
1465 if (card_get_value(scored_card) % 2 == 0)
1466 {
-
1467 *joker_effect = &shared_joker_effect;
+
1467 *joker_effect = &s_shared_joker_effect;
1468
1469 (*joker_effect)->mult = 4;
1470 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -1628,7 +1628,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1488
1489 if (card_get_value(scored_card) % 2 == 1) // todo test ace
1490 {
-
1491 *joker_effect = &shared_joker_effect;
+
1491 *joker_effect = &s_shared_joker_effect;
1492
1493 (*joker_effect)->chips = 31;
1494 effect_flags_ret = JOKER_EFFECT_FLAG_CHIPS;
@@ -1651,7 +1651,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1511 // 0 remaining hands mean we're scoring the last hand
1512 if (get_num_hands_remaining() == 0)
1513 {
-
1514 *joker_effect = &shared_joker_effect;
+
1514 *joker_effect = &s_shared_joker_effect;
1515
1516 (*joker_effect)->xmult = 3;
1517 effect_flags_ret = JOKER_EFFECT_FLAG_XMULT;
@@ -1680,7 +1680,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1540 // p_remaining_retriggers will always reach 0 on the first card, then retrigger
1541 // will be false and scoring will go onto the next card
1542 case JOKER_EVENT_ON_CARD_SCORED_END:
-
1543 *joker_effect = &shared_joker_effect;
+
1543 *joker_effect = &s_shared_joker_effect;
1544
1545 (*joker_effect)->retrigger = (*p_remaining_retriggers > 0);
1546 if ((*joker_effect)->retrigger)
@@ -1711,7 +1711,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1571
1572 if (get_contained_hands()->PAIR)
1573 {
-
1574 *joker_effect = &shared_joker_effect;
+
1574 *joker_effect = &s_shared_joker_effect;
1575
1576 (*joker_effect)->xmult = 2;
1577 effect_flags_ret = JOKER_EFFECT_FLAG_XMULT;
@@ -1733,7 +1733,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1593
1594 if (get_contained_hands()->THREE_OF_A_KIND)
1595 {
-
1596 *joker_effect = &shared_joker_effect;
+
1596 *joker_effect = &s_shared_joker_effect;
1597
1598 (*joker_effect)->xmult = 3;
1599 effect_flags_ret = JOKER_EFFECT_FLAG_XMULT;
@@ -1755,7 +1755,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1615
1616 if (get_contained_hands()->FOUR_OF_A_KIND)
1617 {
-
1618 *joker_effect = &shared_joker_effect;
+
1618 *joker_effect = &s_shared_joker_effect;
1619
1620 (*joker_effect)->xmult = 4;
1621 effect_flags_ret = JOKER_EFFECT_FLAG_XMULT;
@@ -1777,7 +1777,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1637
1638 if (get_contained_hands()->STRAIGHT)
1639 {
-
1640 *joker_effect = &shared_joker_effect;
+
1640 *joker_effect = &s_shared_joker_effect;
1641
1642 (*joker_effect)->xmult = 3;
1643 effect_flags_ret = JOKER_EFFECT_FLAG_XMULT;
@@ -1799,7 +1799,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1659
1660 if (get_contained_hands()->FLUSH)
1661 {
-
1662 *joker_effect = &shared_joker_effect;
+
1662 *joker_effect = &s_shared_joker_effect;
1663
1664 (*joker_effect)->xmult = 2;
1665 effect_flags_ret = JOKER_EFFECT_FLAG_XMULT;
@@ -1822,7 +1822,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1682 // Same protection as the Bull Joker
1683 if (g_game_vars.money > 0)
1684 {
-
1685 *joker_effect = &shared_joker_effect;
+
1685 *joker_effect = &s_shared_joker_effect;
1686
1687 (*joker_effect)->mult = (g_game_vars.money / 5) * 2;
1688 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -1844,7 +1844,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1704
1705 if (scored_card->rank == QUEEN)
1706 {
-
1707 *joker_effect = &shared_joker_effect;
+
1707 *joker_effect = &s_shared_joker_effect;
1708
1709 (*joker_effect)->mult = 13;
1710 effect_flags_ret = JOKER_EFFECT_FLAG_MULT;
@@ -1882,7 +1882,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1742 // and we will catch potential retriggers
1743 if (*p_first_face_index == get_scored_card_index())
1744 {
-
1745 *joker_effect = &shared_joker_effect;
+
1745 *joker_effect = &s_shared_joker_effect;
1746
1747 (*joker_effect)->xmult = 2;
1748 effect_flags_ret = JOKER_EFFECT_FLAG_XMULT;
@@ -1917,7 +1917,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1777 // Only retrigger current card if it's strictly after the last one we retriggered
1778 if (get_num_hands_remaining() == 0)
1779 {
-
1780 *joker_effect = &shared_joker_effect;
+
1780 *joker_effect = &s_shared_joker_effect;
1781
1782 (*joker_effect)->retrigger = (*p_last_retriggered_index < get_scored_card_index());
1783 if ((*joker_effect)->retrigger)
@@ -2047,7 +2047,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1907 case THREE:
1908 case FOUR:
1909 case FIVE:
-
1910 *joker_effect = &shared_joker_effect;
+
1910 *joker_effect = &s_shared_joker_effect;
1911
1912 (*joker_effect)->retrigger =
1913 (*p_last_retriggered_index < get_scored_card_index());
@@ -2094,7 +2094,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1954 // Works the same way as Dusk
1955 // No need to check for p_hands_left_until_exp because the Joker
1956 // will be destroyed the moment we hit 0
-
1957 *joker_effect = &shared_joker_effect;
+
1957 *joker_effect = &s_shared_joker_effect;
1958
1959 (*joker_effect)->retrigger = ((*p_last_retriggered_idx) < get_scored_card_index());
1960 if ((*joker_effect)->retrigger)
@@ -2106,7 +2106,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1966 break;
1967
1968 case JOKER_EVENT_ON_HAND_SCORED_END:
-
1969 *joker_effect = &shared_joker_effect;
+
1969 *joker_effect = &s_shared_joker_effect;
1970 effect_flags_ret = JOKER_EFFECT_FLAG_MESSAGE;
1971
1972 (*p_hands_left_until_exp)--;
@@ -2114,9 +2114,9 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
1974 {
1975 // Need to do this for now because the message's memory can't really be allocated
1976 // So we can't use snprintf to craft a message depending on the number of hands left
-
1977 static const char* seltzer_messages[] =
+
1977 static const char* SELTZER_MESSAGES[] =
1978 {"1", "2", "3", "4", "5", "6", "7", "8", "9"};
-
1979 (*joker_effect)->message = (char*)seltzer_messages[(*p_hands_left_until_exp) - 1];
+
1979 (*joker_effect)->message = (char*)SELTZER_MESSAGES[(*p_hands_left_until_exp) - 1];
1980 }
1981 else
1982 {
@@ -2151,7 +2151,7 @@ $(document).ready(function(){initNavTree('joker__effects_8c_source.html',''); in
2011 break;
2012
2013 case JOKER_EVENT_ON_CARD_SCORED_END:
-
2014 *joker_effect = &shared_joker_effect;
+
2014 *joker_effect = &s_shared_joker_effect;
2015
2016 // Works the same way as Dusk, but for face cards
2017 (*joker_effect)->retrigger =
diff --git a/main__menu_8c_source.html b/main__menu_8c_source.html index d0626f6d..65b3d905 100644 --- a/main__menu_8c_source.html +++ b/main__menu_8c_source.html @@ -218,10 +218,10 @@ $(document).ready(function(){initNavTree('main__menu_8c_source.html',''); initRe
78// clang-format on
79
80// Main menu sprite - the ace of spades
-
81static CardObject* main_menu_ace = NULL;
+
81static CardObject* s_main_menu_ace = NULL;
82
83// Keep track of last highlighted button
-
84static enum MainButtons last_highlighted_button = PLAY_BTN_IDX;
+
84static enum MainButtons s_last_highlighted_button = PLAY_BTN_IDX;
85
86void game_main_menu_change_background(void)
@@ -246,16 +246,16 @@ $(document).ready(function(){initNavTree('main__menu_8c_source.html',''); initRe
103{
104 affine_background_change_background(AFFINE_BG_MAIN_MENU);
105 change_background(BG_MAIN_MENU, true);
-
106 main_menu_ace = card_object_new(card_new(SPADES, ACE));
-
107 card_object_set_sprite(main_menu_ace, 0);
+
106 s_main_menu_ace = card_object_new(card_new(SPADES, ACE));
+
107 card_object_set_sprite(s_main_menu_ace, 0);
108 // TODO: NULL-check sprite
-
109 main_menu_ace->sprite->obj->attr0 |= ATTR0_AFF_DBL;
-
110 main_menu_ace->tscale = float2fx(0.8f);
-
111 sprite_object_position((SpriteObject*)main_menu_ace, MAIN_MENU_ACE_T_X, MAIN_MENU_ACE_T_Y);
+
109 s_main_menu_ace->sprite->obj->attr0 |= ATTR0_AFF_DBL;
+
110 s_main_menu_ace->tscale = float2fx(0.8f);
+
111 sprite_object_position((SpriteObject*)s_main_menu_ace, MAIN_MENU_ACE_T_X, MAIN_MENU_ACE_T_Y);
112
113 // Select last highlighted button, Play button by default.
114 // e.g. if we return from the options menu, we want the Options button to be highlighted.
-
115 Selection sel_init = {last_highlighted_button, 0};
+
115 Selection sel_init = {s_last_highlighted_button, 0};
116 main_menu_selection_grid.selection = sel_init;
117
118 // Highlight current button
@@ -266,7 +266,7 @@ $(document).ready(function(){initNavTree('main__menu_8c_source.html',''); initRe
123{
-
124 main_menu_ace->trotation = lu_sin((g_game_vars.timer << 8) / 2) / 3;
+
124 s_main_menu_ace->trotation = lu_sin((g_game_vars.timer << 8) / 2) / 3;
125
126 selection_grid_process_input(&main_menu_selection_grid);
127}
@@ -276,12 +276,12 @@ $(document).ready(function(){initNavTree('main__menu_8c_source.html',''); initRe
130{
131 // Save selected button
-
132 last_highlighted_button = main_menu_selection_grid.selection.x;
+
132 s_last_highlighted_button = main_menu_selection_grid.selection.x;
133
134 // Normally I would just cache these and hide/unhide but I didn't feel like dealing with
135 // defining a layer for it
-
136 card_destroy(&main_menu_ace->card);
-
137 card_object_destroy(&main_menu_ace);
+
136 card_destroy(&s_main_menu_ace->card);
+
137 card_object_destroy(&s_main_menu_ace);
138}
139
diff --git a/mgba__logger_8c_source.html b/mgba__logger_8c_source.html index 8d52de35..54e40768 100644 --- a/mgba__logger_8c_source.html +++ b/mgba__logger_8c_source.html @@ -158,18 +158,18 @@ $(document).ready(function(){initNavTree('mgba__logger_8c_source.html',''); init
18static const u32 MGBA_LOG_BUFFER_SIZE = 0x100;
19static const u16 MGBA_LOG_LEVEL_MASK = 0x7;
20
-
21static bool mgba_logger_available = false;
+
21static bool s_mgba_logger_available = false;
22
23bool mgba_logger_init(void)
24{
25 *MGBA_REG_DEBUG_ENABLE = MGBA_ENABLE_MAGIC;
-
26 mgba_logger_available = (*MGBA_REG_DEBUG_ENABLE == MGBA_ENABLE_OK);
-
27 return mgba_logger_available;
+
26 s_mgba_logger_available = (*MGBA_REG_DEBUG_ENABLE == MGBA_ENABLE_OK);
+
27 return s_mgba_logger_available;
28}
29
30static void mgba_vprintf(MgbaLogLevel level, const char* fmt, va_list args)
31{
-
32 if (!mgba_logger_available || fmt == NULL)
+
32 if (!s_mgba_logger_available || fmt == NULL)
33 return;
34
35 vsnprintf(MGBA_REG_DEBUG_STRING, MGBA_LOG_BUFFER_SIZE, fmt, args);
@@ -187,7 +187,7 @@ $(document).ready(function(){initNavTree('mgba__logger_8c_source.html',''); init
47
48void mgba_func_printf(MgbaLogLevel level, const char* func_name, const char* fmt, ...)
49{
-
50 if (!mgba_logger_available || func_name == NULL || fmt == NULL)
+
50 if (!s_mgba_logger_available || func_name == NULL || fmt == NULL)
51 {
52 // The one place where we can't log the error.
53 return;
diff --git a/navtreeindex0.js b/navtreeindex0.js index b9b57456..843f6221 100644 --- a/navtreeindex0.js +++ b/navtreeindex0.js @@ -95,8 +95,8 @@ var NAVTREEINDEX0 = "deck__types_8c.html#a72695ce33b02b8163efcd58a1d3190c2":[3,0,1,7,8], "deck__types_8c.html#a736be51786cebff18770985e85d6a24e":[3,0,1,7,5], "deck__types_8c.html#a994dd3e5b28e324cbff3f7c3d69d28ce":[3,0,1,7,3], -"deck__types_8c.html#aa69c0508a53c09b17c5283a1e5be751a":[3,0,1,7,9], "deck__types_8c.html#ab4e7764cc1e6cf64ebb03078795d2be4":[3,0,1,7,4], +"deck__types_8c.html#aca3bc778faeef112f513ae0a84c5e378":[3,0,1,7,9], "deck__types_8c.html#ae06a285687193be23c00a00b209eb521":[3,0,1,7,6], "deck__types_8c.html#aeb6c51fe050fea32811f33e01f5c8542":[3,0,1,7,0], "deck__types_8c_source.html":[3,0,1,7], diff --git a/random_8c_source.html b/random_8c_source.html index c36e3c01..cda7be00 100644 --- a/random_8c_source.html +++ b/random_8c_source.html @@ -147,7 +147,7 @@ $(document).ready(function(){initNavTree('random_8c_source.html',''); initResiza
7#include <tonc.h>
8
9// Accumulate timer 1 into a bigger variable so we can generate more diverse seeds
-
10static u32 timer_acc = 0;
+
10static u32 s_timer_acc = 0;
11
12// Timers usage docs: https://gbadev.net/tonc/timers.html
@@ -161,7 +161,7 @@ $(document).ready(function(){initNavTree('random_8c_source.html',''); initResiza
19void rng_update(void)
20{
-
21 timer_acc += (u32)REG_TM1D;
+
21 s_timer_acc += (u32)REG_TM1D;
22}
23
@@ -177,7 +177,7 @@ $(document).ready(function(){initNavTree('random_8c_source.html',''); initResiza
32{
-
33 rng_set_seed(timer_acc);
+
33 rng_set_seed(s_timer_acc);
34}
35
@@ -203,7 +203,7 @@ $(document).ready(function(){initNavTree('random_8c_source.html',''); initResiza
Game global game variables struct definition.
Common functions to handle RNG manipulation. Using this interface has three goals:
-
void rng_update(void)
Update the CPU cycles counter and accumulate it into a bigger u32 timer_acc variable.
Definition random.c:19
+
void rng_update(void)
Accumulates CPU cycles for RNG seed generation, call exaclty once per frame.
Definition random.c:19
void rng_shuffle_seed(void)
Uses the CPU cycles counter to randomize the RNG seed as much as possible. This will be called by the...
Definition random.c:31
void rng_set_seed(u32 seed)
Set the rng seed to the chosen value, and reset the step counter to 0. The seed will be capped at MAX...
Definition random.c:24
void rng_restore(RngInfo info)
Restore RNG info struct in the GameVariables. Sets the seed and seeks the position step in the rng se...
Definition random.c:42
diff --git a/random_8h.html b/random_8h.html index f57dbc4c..6c909205 100644 --- a/random_8h.html +++ b/random_8h.html @@ -155,7 +155,7 @@ Functions  Starts counting CPU cycles, this will be used by rng_shuffle_seed to generate a more random seed. To be called once on game start.
  void rng_update (void) - Update the CPU cycles counter and accumulate it into a bigger u32 timer_acc variable.
+ Accumulates CPU cycles for RNG seed generation, call exaclty once per frame.
  void rng_set_seed (u32 seed)  Set the rng seed to the chosen value, and reset the step counter to 0. The seed will be capped at MAX_BASE36 for compatibility with the Seed Input screen used to choose a seed for seeded runs.
@@ -320,7 +320,7 @@ Functions
-

Update the CPU cycles counter and accumulate it into a bigger u32 timer_acc variable.

+

Accumulates CPU cycles for RNG seed generation, call exaclty once per frame.

Definition at line 19 of file random.c.

diff --git a/random_8h_source.html b/random_8h_source.html index 3b4ed950..ff820a6e 100644 --- a/random_8h_source.html +++ b/random_8h_source.html @@ -165,7 +165,7 @@ $(document).ready(function(){initNavTree('random_8h_source.html',''); initResiza
69void rng_restore(RngInfo info);
70
71#endif // RANDOM_H
-
void rng_update(void)
Update the CPU cycles counter and accumulate it into a bigger u32 timer_acc variable.
Definition random.c:19
+
void rng_update(void)
Accumulates CPU cycles for RNG seed generation, call exaclty once per frame.
Definition random.c:19
void rng_shuffle_seed(void)
Uses the CPU cycles counter to randomize the RNG seed as much as possible. This will be called by the...
Definition random.c:31
void rng_set_seed(u32 seed)
Set the rng seed to the chosen value, and reset the step counter to 0. The seed will be capped at MAX...
Definition random.c:24
void rng_restore(RngInfo info)
Restore RNG info struct in the GameVariables. Sets the seed and seeks the position step in the rng se...
Definition random.c:42
diff --git a/round_8c.html b/round_8c.html index f949db68..ac6e2203 100644 --- a/round_8c.html +++ b/round_8c.html @@ -432,50 +432,50 @@ Variables   static const int HAND_SPACING_LUT [MAX_HAND_SIZE]   -static CardObjectplayed [MAX_SELECTION_SIZE] = {NULL} -  -static int played_top = -1 -  -static Carddiscard_pile [MAX_DECK_SIZE] = {NULL} -  -static int discard_top = -1 -  -static int scored_card_index = 0 -  -static bool retrigger = false -  -static ListItr _joker_scored_itr -  -static ListItr _joker_card_scored_end_itr -  -static ListItr _joker_round_end_itr -  -static u32 temp_score = 0 -  -static bool score_flames_active = false -  -static FIXED lerped_score = 0 -  -static FIXED lerped_temp_score = 0 -  -static bool sound_played = false -  -static bool discarded_card = false -  -static int cards_drawn = 0 -  -static int cards_discarded = 0 -  -static bool moving_card = false -  -static bool card_moved_too_fast = false -  -static bool card_selected_instead_of_moved = false -  -static const int card_swap_time_threshold = 6 -  -static int selection_hit_timer = UNDEFINED -  +static CardObjects_played_hand [MAX_SELECTION_SIZE] = {NULL} +  +static int s_played_top = -1 +  +static Cards_discard_pile [MAX_DECK_SIZE] = {NULL} +  +static int s_discard_top = -1 +  +static int s_scored_card_index = 0 +  +static bool s_retrigger = false +  +static ListItr s_joker_scored_itr +  +static ListItr s_joker_card_scored_end_itr +  +static ListItr s_joker_round_end_itr +  +static u32 s_temp_score = 0 +  +static bool s_score_flames_active = false +  +static FIXED s_lerped_score = 0 +  +static FIXED s_lerped_temp_score = 0 +  +static bool s_sound_played = false +  +static bool s_discarded_card = false +  +static int s_cards_drawn = 0 +  +static int s_cards_discarded = 0 +  +static bool s_moving_card = false +  +static bool s_card_moved_too_fast = false +  +static bool s_card_selected_instead_of_moved = false +  +static const int CARD_SWAP_TIME_THRESHOLD = 6 +  +static int s_selection_hit_timer = UNDEFINED + 

Detailed Description

Data structures and implementation of functions relative to the Rounds we play.

@@ -956,7 +956,7 @@ Variables

Draw the next card at the top of the Deck and play a little Sprite animation to position it in our hand.

-

Definition at line 1124 of file round.c.

+

Definition at line 1125 of file round.c.

@@ -1034,7 +1034,7 @@ Variables
-

Definition at line 1260 of file round.c.

+

Definition at line 1261 of file round.c.

@@ -1090,7 +1090,7 @@ Variables
Returns
true if a scoring Joker was encountered, false if not
See also
JokerEvent
-

Definition at line 1485 of file round.c.

+

Definition at line 1486 of file round.c.

@@ -1413,7 +1413,7 @@ Variables
-

Definition at line 1169 of file round.c.

+

Definition at line 1170 of file round.c.

@@ -1650,7 +1650,7 @@ Variables

Determines if the round is over, be it because we lost or won the round.

Returns
true if the round is over, false if we can still play.
-

Definition at line 1048 of file round.c.

+

Definition at line 1049 of file round.c.

@@ -1672,7 +1672,7 @@ Variables

Round state initialization.

-

Definition at line 1970 of file round.c.

+

Definition at line 1975 of file round.c.

@@ -1694,7 +1694,7 @@ Variables

Round state update.

-

Definition at line 2041 of file round.c.

+

Definition at line 2046 of file round.c.

@@ -1752,7 +1752,7 @@ Variables
-

Definition at line 1151 of file round.c.

+

Definition at line 1152 of file round.c.

@@ -1780,7 +1780,7 @@ Variables
-

Definition at line 1447 of file round.c.

+

Definition at line 1448 of file round.c.

@@ -1836,7 +1836,7 @@ Variables
-

Definition at line 1054 of file round.c.

+

Definition at line 1055 of file round.c.

@@ -1924,7 +1924,7 @@ Variables
-

Definition at line 1379 of file round.c.

+

Definition at line 1380 of file round.c.

@@ -2132,7 +2132,7 @@ Variables
Returns
bool
See also
check_and_score_joker_for_event
-

Definition at line 1541 of file round.c.

+

Definition at line 1544 of file round.c.

@@ -2169,7 +2169,7 @@ Variables
Returns
bool
-

Definition at line 1815 of file round.c.

+

Definition at line 1820 of file round.c.

@@ -2205,7 +2205,7 @@ Variables -

Definition at line 1772 of file round.c.

+

Definition at line 1775 of file round.c.

@@ -2237,7 +2237,7 @@ Variables
Returns
true if the Joker scoring loop has returned early
See also
check_and_score_joker_for_event
-

Definition at line 1627 of file round.c.

+

Definition at line 1630 of file round.c.

@@ -2268,7 +2268,7 @@ Variables

Score all played cards in order, then Jokers after each one.

Returns
true if the Cards scoring loop has returned early.
-

Definition at line 1558 of file round.c.

+

Definition at line 1561 of file round.c.

@@ -2300,7 +2300,7 @@ Variables
Returns
true if the Joker scoring loop has returned early
See also
check_and_score_joker_for_event
-

Definition at line 1741 of file round.c.

+

Definition at line 1744 of file round.c.

@@ -2332,7 +2332,7 @@ Variables
Returns
true if the Joker scoring loop has returned early
See also
check_and_score_joker_for_event
-

Definition at line 1677 of file round.c.

+

Definition at line 1680 of file round.c.

@@ -2364,7 +2364,7 @@ Variables
Returns
true if the Joker scoring loop has returned early
See also
check_and_score_joker_for_event
-

Definition at line 1714 of file round.c.

+

Definition at line 1717 of file round.c.

@@ -2392,7 +2392,7 @@ Variables
-

Definition at line 1503 of file round.c.

+

Definition at line 1504 of file round.c.

@@ -2420,7 +2420,7 @@ Variables
-

Definition at line 1871 of file round.c.

+

Definition at line 1876 of file round.c.

@@ -2512,7 +2512,7 @@ Variables
-

Definition at line 1218 of file round.c.

+

Definition at line 1219 of file round.c.

@@ -2596,7 +2596,7 @@ Variables
-

Definition at line 1027 of file round.c.

+

Definition at line 1028 of file round.c.

@@ -2624,7 +2624,7 @@ Variables
-

Definition at line 1007 of file round.c.

+

Definition at line 1008 of file round.c.

@@ -2730,83 +2730,11 @@ Variables

Checks whether the score that would result from the current Chips and Mult exceeds the current Blind's score requirement, and applies the flaming effect if needed.

-

Definition at line 1424 of file round.c.

+

Definition at line 1425 of file round.c.

Variable Documentation

- -

◆ _joker_card_scored_end_itr

- -
-
- - - - - -
- - - - -
ListItr _joker_card_scored_end_itr
-
-static
-
- -

Definition at line 224 of file round.c.

- -
-
- -

◆ _joker_round_end_itr

- -
-
- - - - - -
- - - - -
ListItr _joker_round_end_itr
-
-static
-
- -

Definition at line 225 of file round.c.

- -
-
- -

◆ _joker_scored_itr

- -
-
- - - - - -
- - - - -
ListItr _joker_scored_itr
-
-static
-
- -

Definition at line 223 of file round.c.

- -
-

◆ BIG_BLIND_TITLE_SRC_RECT

@@ -2903,8 +2831,8 @@ Variables - -

◆ card_moved_too_fast

+ +

◆ CARD_SWAP_TIME_THRESHOLD

@@ -2913,55 +2841,7 @@ Variables - - -
bool card_moved_too_fast = false
- - -static - - -
- -

Definition at line 535 of file round.c.

- -
-
- -

◆ card_selected_instead_of_moved

- -
-
- - - - - -
- - - - -
bool card_selected_instead_of_moved = false
-
-static
-
- -

Definition at line 536 of file round.c.

- -
-
- -

◆ card_swap_time_threshold

- -
-
- - - @@ -2973,126 +2853,6 @@ Variables

Definition at line 541 of file round.c.

- - - -

◆ cards_discarded

- -
-
-
- - - +
const int card_swap_time_threshold = 6const int CARD_SWAP_TIME_THRESHOLD = 6
- - - - -
- - - - -
int cards_discarded = 0
-
-static
-
- -

Definition at line 237 of file round.c.

- -
-
- -

◆ cards_drawn

- -
-
- - - - - -
- - - - -
int cards_drawn = 0
-
-static
-
- -

Definition at line 236 of file round.c.

- -
-
- -

◆ discard_pile

- -
-
- - - - - -
- - - - -
Card* discard_pile[MAX_DECK_SIZE] = {NULL}
-
-static
-
- -

Definition at line 215 of file round.c.

- -
-
- -

◆ discard_top

- -
-
- - - - - -
- - - - -
int discard_top = -1
-
-static
-
- -

Definition at line 216 of file round.c.

- -
-
- -

◆ discarded_card

- -
-
- - - - - -
- - - - -
bool discarded_card = false
-
-static
-
- -

Definition at line 234 of file round.c.

-
@@ -3403,78 +3163,6 @@ Variables

Definition at line 94 of file round.c.

- - - -

◆ lerped_score

- -
-
- - - - - -
- - - - -
FIXED lerped_score = 0
-
-static
-
- -

Definition at line 229 of file round.c.

- -
-
- -

◆ lerped_temp_score

- -
-
- - - - - -
- - - - -
FIXED lerped_temp_score = 0
-
-static
-
- -

Definition at line 230 of file round.c.

- -
-
- -

◆ moving_card

- -
-
- - - - - -
- - - - -
bool moving_card = false
-
-static
-
- -

Definition at line 531 of file round.c.

-
@@ -3499,30 +3187,6 @@ Variables

Definition at line 201 of file round.c.

- - - -

◆ played

- -
-
- - - - - -
- - - - -
CardObject* played[MAX_SELECTION_SIZE] = {NULL}
-
-static
-
- -

Definition at line 212 of file round.c.

-
@@ -3549,8 +3213,8 @@ Variables - -

◆ played_top

+ +

◆ s_card_moved_too_fast

@@ -3559,7 +3223,343 @@ Variables - + + +
int played_top = -1bool s_card_moved_too_fast = false
+ + +static + + +
+ +

Definition at line 535 of file round.c.

+ +
+
+ +

◆ s_card_selected_instead_of_moved

+ +
+
+ + + + + +
+ + + + +
bool s_card_selected_instead_of_moved = false
+
+static
+
+ +

Definition at line 536 of file round.c.

+ +
+
+ +

◆ s_cards_discarded

+ +
+
+ + + + + +
+ + + + +
int s_cards_discarded = 0
+
+static
+
+ +

Definition at line 237 of file round.c.

+ +
+
+ +

◆ s_cards_drawn

+ +
+
+ + + + + +
+ + + + +
int s_cards_drawn = 0
+
+static
+
+ +

Definition at line 236 of file round.c.

+ +
+
+ +

◆ s_discard_pile

+ +
+
+ + + + + +
+ + + + +
Card* s_discard_pile[MAX_DECK_SIZE] = {NULL}
+
+static
+
+ +

Definition at line 215 of file round.c.

+ +
+
+ +

◆ s_discard_top

+ +
+
+ + + + + +
+ + + + +
int s_discard_top = -1
+
+static
+
+ +

Definition at line 216 of file round.c.

+ +
+
+ +

◆ s_discarded_card

+ +
+
+ + + + + +
+ + + + +
bool s_discarded_card = false
+
+static
+
+ +

Definition at line 234 of file round.c.

+ +
+
+ +

◆ s_joker_card_scored_end_itr

+ +
+
+ + + + + +
+ + + + +
ListItr s_joker_card_scored_end_itr
+
+static
+
+ +

Definition at line 224 of file round.c.

+ +
+
+ +

◆ s_joker_round_end_itr

+ +
+
+ + + + + +
+ + + + +
ListItr s_joker_round_end_itr
+
+static
+
+ +

Definition at line 225 of file round.c.

+ +
+
+ +

◆ s_joker_scored_itr

+ +
+
+ + + + + +
+ + + + +
ListItr s_joker_scored_itr
+
+static
+
+ +

Definition at line 223 of file round.c.

+ +
+
+ +

◆ s_lerped_score

+ +
+
+ + + + + +
+ + + + +
FIXED s_lerped_score = 0
+
+static
+
+ +

Definition at line 229 of file round.c.

+ +
+
+ +

◆ s_lerped_temp_score

+ +
+
+ + + + + +
+ + + + +
FIXED s_lerped_temp_score = 0
+
+static
+
+ +

Definition at line 230 of file round.c.

+ +
+
+ +

◆ s_moving_card

+ +
+
+ + + + + +
+ + + + +
bool s_moving_card = false
+
+static
+
+ +

Definition at line 531 of file round.c.

+ +
+
+ +

◆ s_played_hand

+ +
+
+ + + + + +
+ + + + +
CardObject* s_played_hand[MAX_SELECTION_SIZE] = {NULL}
+
+static
+
+ +

Definition at line 212 of file round.c.

+ +
+
+ +

◆ s_played_top

+ +
+
+ + + @@ -3573,8 +3573,8 @@ Variables - -

◆ retrigger

+ +

◆ s_retrigger

@@ -3583,7 +3583,7 @@ Variables
@@ -3595,6 +3595,126 @@ Variables

Definition at line 220 of file round.c.

+ + + +

◆ s_score_flames_active

+ +
+
+
+ + +
int s_played_top = -1
- +
bool retrigger = falsebool s_retrigger = false
+ + + + +
+ + + + +
bool s_score_flames_active = false
+
+static
+
+ +

Definition at line 228 of file round.c.

+ +
+
+ +

◆ s_scored_card_index

+ +
+
+ + + + + +
+ + + + +
int s_scored_card_index = 0
+
+static
+
+ +

Definition at line 219 of file round.c.

+ +
+
+ +

◆ s_selection_hit_timer

+ +
+
+ + + + + +
+ + + + +
int s_selection_hit_timer = UNDEFINED
+
+static
+
+ +

Definition at line 542 of file round.c.

+ +
+
+ +

◆ s_sound_played

+ +
+
+ + + + + +
+ + + + +
bool s_sound_played = false
+
+static
+
+ +

Definition at line 233 of file round.c.

+ +
+
+ +

◆ s_temp_score

+ +
+
+ + + + + +
+ + + + +
u32 s_temp_score = 0
+
+static
+
+ +

Definition at line 227 of file round.c.

+
@@ -3691,126 +3811,6 @@ Variables

Definition at line 67 of file round.c.

- - - -

◆ score_flames_active

- -
-
- - - - - -
- - - - -
bool score_flames_active = false
-
-static
-
- -

Definition at line 228 of file round.c.

- -
-
- -

◆ scored_card_index

- -
-
- - - - - -
- - - - -
int scored_card_index = 0
-
-static
-
- -

Definition at line 219 of file round.c.

- -
-
- -

◆ selection_hit_timer

- -
-
- - - - - -
- - - - -
int selection_hit_timer = UNDEFINED
-
-static
-
- -

Definition at line 542 of file round.c.

- -
-
- -

◆ sound_played

- -
-
- - - - - -
- - - - -
bool sound_played = false
-
-static
-
- -

Definition at line 233 of file round.c.

- -
-
- -

◆ temp_score

- -
-
- - - - - -
- - - - -
u32 temp_score = 0
-
-static
-
- -

Definition at line 227 of file round.c.

-
diff --git a/round_8c_source.html b/round_8c_source.html index 386faf53..524dafd3 100644 --- a/round_8c_source.html +++ b/round_8c_source.html @@ -345,32 +345,32 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
209 {28, 28, 28, 28, 27, 21, 18, 15, 13, 12, 10, 9, 9, 8, 8, 7};
210
211// Stacks
-
212static CardObject* played[MAX_SELECTION_SIZE] = {NULL};
-
213static int played_top = -1;
+
212static CardObject* s_played_hand[MAX_SELECTION_SIZE] = {NULL};
+
213static int s_played_top = -1;
214
-
215static Card* discard_pile[MAX_DECK_SIZE] = {NULL};
-
216static int discard_top = -1;
+
215static Card* s_discard_pile[MAX_DECK_SIZE] = {NULL};
+
216static int s_discard_top = -1;
217
218// Keeping track of cards scored
-
219static int scored_card_index = 0;
-
220static bool retrigger = false;
+
219static int s_scored_card_index = 0;
+
220static bool s_retrigger = false;
221
222// Keeping track of what Jokers are scored at each step
-
223static ListItr _joker_scored_itr;
-
224static ListItr _joker_card_scored_end_itr;
-
225static ListItr _joker_round_end_itr;
+
223static ListItr s_joker_scored_itr;
+
224static ListItr s_joker_card_scored_end_itr;
+
225static ListItr s_joker_round_end_itr;
226
-
227static u32 temp_score = 0; // This is the score that shows in the same spot as the hand type.
-
228static bool score_flames_active = false;
-
229static FIXED lerped_score = 0;
-
230static FIXED lerped_temp_score = 0;
+
227static u32 s_temp_score = 0; // This is the score that shows in the same spot as the hand type.
+
228static bool s_score_flames_active = false;
+
229static FIXED s_lerped_score = 0;
+
230static FIXED s_lerped_temp_score = 0;
231
232// discarded cards specific
-
233static bool sound_played = false;
-
234static bool discarded_card = false;
+
233static bool s_sound_played = false;
+
234static bool s_discarded_card = false;
235
-
236static int cards_drawn = 0;
-
237static int cards_discarded = 0;
+
236static int s_cards_drawn = 0;
+
237static int s_cards_discarded = 0;
238
239/*******************************************************************************
240 * UTILS FUNCTIONS
@@ -379,62 +379,62 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
243int get_played_top(void)
244{
-
245 return played_top;
+
245 return s_played_top;
246}
247
248int get_played_size(void)
249{
-
250 return played_top + 1;
+
250 return s_played_top + 1;
251}
252
258static inline void played_push(CardObject* card_object)
259{
-
260 if (played_top >= MAX_SELECTION_SIZE - 1)
+
260 if (s_played_top >= MAX_SELECTION_SIZE - 1)
261 return;
-
262 played[++played_top] = card_object;
+
262 s_played_hand[++s_played_top] = card_object;
263}
264
265int get_discard_top(void)
266{
-
267 return discard_top;
+
267 return s_discard_top;
268}
269
277static inline void discard_push(Card* card)
278{
-
279 if (discard_top >= MAX_DECK_SIZE - 1)
+
279 if (s_discard_top >= MAX_DECK_SIZE - 1)
280 return;
-
281 discard_pile[++discard_top] = card;
+
281 s_discard_pile[++s_discard_top] = card;
282}
283
289static inline Card* discard_pop()
290{
-
291 if (discard_top < 0)
+
291 if (s_discard_top < 0)
292 return NULL;
-
293 return discard_pile[discard_top--];
+
293 return s_discard_pile[s_discard_top--];
294}
295
296int get_scored_card_index(void)
297{
-
298 return scored_card_index;
+
298 return s_scored_card_index;
299}
300
301void set_retrigger(bool new_retrigger)
302{
-
303 retrigger = new_retrigger;
+
303 s_retrigger = new_retrigger;
304}
305
@@ -447,16 +447,16 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
318 for (int i = 0; i < NUM_SUITS; i++)
319 suits_out[i] = 0;
320
-
321 for (int i = 0; i <= played_top; i++)
+
321 for (int i = 0; i <= s_played_top; i++)
322 {
323 /* The difference from get_hand_distribution() (not checking if card is selected)
324 * is in line Balatro behavior,
325 * see https://github.com/GBALATRO/balatro-gba/issues/341#issuecomment-3691363488
326 */
-
327 if (!played[i])
+
327 if (!s_played_hand[i])
328 continue;
-
329 ranks_out[played[i]->card->rank]++;
-
330 suits_out[played[i]->card->suit]++;
+
329 ranks_out[s_played_hand[i]->card->rank]++;
+
330 suits_out[s_played_hand[i]->card->suit]++;
331 }
332}
@@ -650,18 +650,18 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
528 ******************************************************************************/
529
530// true if and only if we are currently moving a card around
-
531static bool moving_card = false;
+
531static bool s_moving_card = false;
532
533// This will prevent us from moving cards around if we selected one
534// by moving too fast after pressing the A button
-
535static bool card_moved_too_fast = false;
-
536static bool card_selected_instead_of_moved = false;
+
535static bool s_card_moved_too_fast = false;
+
536static bool s_card_selected_instead_of_moved = false;
537
538// After pressing A, if we press Left/Right too fast, we should select the card
539// and change focus to the next one, instead of swapping them
540// This should fix inputs sometimes not registering when quickly selecting cards
-
541static const int card_swap_time_threshold = 6;
-
542static int selection_hit_timer = UNDEFINED;
+
541static const int CARD_SWAP_TIME_THRESHOLD = 6;
+
542static int s_selection_hit_timer = UNDEFINED;
543
544static bool game_round_hand_row_on_selection_changed(
545 SelectionGrid* selection_grid,
@@ -674,8 +674,8 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
552 int next_card_idx = UNDEFINED;
553
554 // Do not use FRAMES(x) here as we are counting real frames ignoring game speed
-
555 card_moved_too_fast = (selection_hit_timer != UNDEFINED) &&
-
556 (g_game_vars.timer - selection_hit_timer) < card_swap_time_threshold;
+
555 s_card_moved_too_fast = (s_selection_hit_timer != UNDEFINED) &&
+
556 (g_game_vars.timer - s_selection_hit_timer) < CARD_SWAP_TIME_THRESHOLD;
557
558 if (prev_selection->y == GAME_PLAYING_HAND_SEL_Y)
559 {
@@ -689,8 +689,8 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
567
568 bool on_the_same_row = new_selection->y == prev_selection->y; // == GAME_PLAYING_HAND_SEL_Y
569
-
570 if (on_the_same_row && key_is_down(SELECT_CARD) && !card_moved_too_fast &&
-
571 !card_selected_instead_of_moved)
+
570 if (on_the_same_row && key_is_down(SELECT_CARD) && !s_card_moved_too_fast &&
+
571 !s_card_selected_instead_of_moved)
572 {
573 bool moved_by_one_tile = abs(new_selection->x - prev_selection->x) == 1;
574
@@ -703,7 +703,7 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
581 else
582 {
583 swap_cards_in_hand(prev_card_idx, next_card_idx);
-
584 moving_card = true;
+
584 s_moving_card = true;
585 reorder_card_sprites_layers();
586
587 /* Not calling sprite_object_set_focus() because focus is handled by
@@ -719,10 +719,10 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
597 else
598 {
599 // select current card if we tried moving it too fast
-
600 if (key_released(SELECT_CARD) || (card_moved_too_fast && !moving_card))
+
600 if (key_released(SELECT_CARD) || (s_card_moved_too_fast && !s_moving_card))
601 {
602 hand_select_card(prev_card_idx);
-
603 card_selected_instead_of_moved = true;
+
603 s_card_selected_instead_of_moved = true;
604 }
605 if (next_card_idx != UNDEFINED)
606 {
@@ -744,18 +744,18 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
622{
623 if (key_hit(SELECT_CARD))
624 {
-
625 selection_hit_timer = g_game_vars.timer;
+
625 s_selection_hit_timer = g_game_vars.timer;
626 }
627 else if (key_released(SELECT_CARD))
628 {
-
629 if (!moving_card && !card_selected_instead_of_moved)
+
629 if (!s_moving_card && !s_card_selected_instead_of_moved)
630 {
631 hand_select_card(hand_sel_idx_to_card_idx(selection->x));
632 }
-
633 moving_card = false;
-
634 card_moved_too_fast = false;
-
635 card_selected_instead_of_moved = false;
-
636 selection_hit_timer = UNDEFINED;
+
633 s_moving_card = false;
+
634 s_card_moved_too_fast = false;
+
635 s_card_selected_instead_of_moved = false;
+
636 s_selection_hit_timer = UNDEFINED;
637 }
638 else if (key_hit(DESELECT_CARDS))
639 {
@@ -884,19 +884,19 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
768 *break_loop = false;
769 if (card_object_is_selected(hand[card_idx]) || get_hand_state() == HAND_SHUFFLING)
770 {
-
771 if (!discarded_card)
+
771 if (!s_discarded_card)
772 {
773 *hand_x = int2fx(CARD_DISCARD_PNT.x);
774 *hand_y = int2fx(CARD_DISCARD_PNT.y);
775
-
776 if (!sound_played)
+
776 if (!s_sound_played)
777 {
778 play_sfx(
779 SFX_CARD_DRAW,
-
780 MM_BASE_PITCH_RATE + cards_discarded * PITCH_STEP_DISCARD_SFX,
+
780 MM_BASE_PITCH_RATE + s_cards_discarded * PITCH_STEP_DISCARD_SFX,
781 SFX_DEFAULT_VOLUME
782 );
-
783 sound_played = true;
+
783 s_sound_played = true;
784 }
785
786 if (hand[card_idx]->x >= *hand_x)
@@ -908,8 +908,8 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
792 reorder_card_sprites_layers();
793 set_hand_top(get_hand_top() - 1);
794
-
795 cards_discarded++;
-
796 sound_played = false;
+
795 s_cards_discarded++;
+
796 s_sound_played = false;
797 g_game_vars.timer = TM_ZERO;
798
799 // Protect against an edge case where `card_idx == hand_top` before discarding. In
@@ -922,7 +922,7 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
806 }
807 }
808
-
809 discarded_card = true;
+
809 s_discarded_card = true;
810 }
811 else
812 {
@@ -945,13 +945,13 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
829 -HAND_SPACING_LUT[get_hand_top()];
830 }
831
-
832 if (card_idx == 0 && discarded_card == false && g_game_vars.timer % FRAMES(10) == 0)
+
832 if (card_idx == 0 && s_discarded_card == false && g_game_vars.timer % FRAMES(10) == 0)
833 {
834 // This is never reached in the case of HAND_SHUFFLING. Not sure why but that's how it's
835 // supposed to be.
836 set_hand_state(HAND_DRAW);
-
837 sound_played = false;
-
838 cards_discarded = 0;
+
837 s_sound_played = false;
+
838 s_cards_discarded = 0;
839 hand_set_nb_selected_cards(0);
840 g_game_vars.timer = TM_ZERO;
841 *break_loop = true;
@@ -972,9 +972,9 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
856 get_hand_type() == ROYAL_FLUSH)
857 {
858 bool flush_selection[MAX_HAND_SIZE] = {false};
-
859 find_flush_in_played_cards(played, played_top, min_len, flush_selection);
+
859 find_flush_in_played_cards(s_played_hand, s_played_top, min_len, flush_selection);
860 // Add the results into the final selection
-
861 for (int i = 0; i <= played_top; i++)
+
861 for (int i = 0; i <= s_played_top; i++)
862 {
863 final_selection[i] = flush_selection[i];
864 }
@@ -985,32 +985,32 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
869 get_hand_type() == ROYAL_FLUSH)
870 {
871 bool straight_selection[MAX_HAND_SIZE] = {false};
-
872 find_straight_in_played_cards(played, played_top, min_len, straight_selection);
+
872 find_straight_in_played_cards(s_played_hand, s_played_top, min_len, straight_selection);
873 // Add the results into the final selection
-
874 for (int i = 0; i <= played_top; i++)
+
874 for (int i = 0; i <= s_played_top; i++)
875 {
876 final_selection[i] = final_selection[i] || straight_selection[i];
877 }
878 // If Four Fingers is active, pairs can happen in a valid straight
879 // If Four Fingers is not active, pairs are impossible so this will not affect things
-
880 select_paired_cards_in_hand(played, played_top, final_selection);
+
880 select_paired_cards_in_hand(s_played_hand, s_played_top, final_selection);
881 }
882
883 // Finally, set mark the cards as selected based final_selection
-
884 for (int i = 0; i <= played_top; i++)
+
884 for (int i = 0; i <= s_played_top; i++)
885 {
886 if (final_selection[i])
887 {
-
888 card_object_set_selected(played[i], true);
+
888 card_object_set_selected(s_played_hand[i], true);
889 }
890 }
891}
892
893static inline void select_all_five_cards_in_played_hand(void)
894{
-
895 for (int i = 0; i <= played_top; i++)
+
895 for (int i = 0; i <= s_played_top; i++)
896 {
-
897 card_object_set_selected(played[i], true);
+
897 card_object_set_selected(s_played_hand[i], true);
898 }
899}
900
@@ -1027,8 +1027,8 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
911
912 for (int i = 0; i <= played_size; i++)
913 {
-
914 if (played[i]->card->rank != played[(i + 1) % played_size]->card->rank &&
-
915 played[i]->card->rank != played[(i + 2) % played_size]->card->rank)
+
914 if (s_played_hand[i]->card->rank != s_played_hand[(i + 1) % played_size]->card->rank &&
+
915 s_played_hand[i]->card->rank != s_played_hand[(i + 2) % played_size]->card->rank)
916 {
917 unmatched_index = i;
918 break;
@@ -1039,7 +1039,7 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
923 {
924 if (i != unmatched_index)
925 {
-
926 card_object_set_selected(played[i], true);
+
926 card_object_set_selected(s_played_hand[i], true);
927 }
928 }
929 }
@@ -1047,7 +1047,7 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
931 {
932 for (int i = 0; i <= played_size; i++)
933 {
-
934 card_object_set_selected(played[i], true);
+
934 card_object_set_selected(s_played_hand[i], true);
935 }
936 }
937}
@@ -1055,21 +1055,21 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
939static inline void select_three_of_a_kind_cards_in_played_hand(void)
940{
941 // find three cards with the same rank
-
942 for (int i = 0; i <= played_top - 1; i++)
+
942 for (int i = 0; i <= s_played_top - 1; i++)
943 {
-
944 for (int j = i + 1; j <= played_top; j++)
+
944 for (int j = i + 1; j <= s_played_top; j++)
945 {
-
946 if (played[i]->card->rank == played[j]->card->rank)
+
946 if (s_played_hand[i]->card->rank == s_played_hand[j]->card->rank)
947 {
-
948 card_object_set_selected(played[i], true);
-
949 card_object_set_selected(played[j], true);
+
948 card_object_set_selected(s_played_hand[i], true);
+
949 card_object_set_selected(s_played_hand[j], true);
950
-
951 for (int k = j + 1; k <= played_top; k++)
+
951 for (int k = j + 1; k <= s_played_top; k++)
952 {
-
953 if (played[i]->card->rank == played[k]->card->rank &&
-
954 !card_object_is_selected(played[k]))
+
953 if (s_played_hand[i]->card->rank == s_played_hand[k]->card->rank &&
+
954 !card_object_is_selected(s_played_hand[k]))
955 {
-
956 card_object_set_selected(played[k], true);
+
956 card_object_set_selected(s_played_hand[k], true);
957 break;
958 }
959 }
@@ -1078,7 +1078,7 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
962 }
963 }
964
-
965 if (card_object_is_selected(played[i]))
+
965 if (card_object_is_selected(s_played_hand[i]))
966 break;
967 }
968}
@@ -1088,1060 +1088,1065 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
972 // find two pairs of cards with the same rank
973 int i;
974
-
975 for (i = 0; i <= played_top - 1; i++)
+
975 for (i = 0; i <= s_played_top - 1; i++)
976 {
-
977 for (int j = i + 1; j <= played_top; j++)
+
977 for (int j = i + 1; j <= s_played_top; j++)
978 {
-
979 if (played[i]->card->rank == played[j]->card->rank)
+
979 if (s_played_hand[i]->card->rank == s_played_hand[j]->card->rank)
980 {
-
981 card_object_set_selected(played[i], true);
-
982 card_object_set_selected(played[j], true);
+
981 card_object_set_selected(s_played_hand[i], true);
+
982 card_object_set_selected(s_played_hand[j], true);
983
984 break;
985 }
986 }
987
-
988 if (card_object_is_selected(played[i]))
+
988 if (card_object_is_selected(s_played_hand[i]))
989 break;
990 }
991
-
992 for (; i <= played_top - 1; i++) // Find second pair
+
992 for (; i <= s_played_top - 1; i++) // Find second pair
993 {
-
994 for (int j = i + 1; j <= played_top; j++)
+
994 for (int j = i + 1; j <= s_played_top; j++)
995 {
-
996 if (played[i]->card->rank == played[j]->card->rank &&
-
997 !card_object_is_selected(played[i]) && !card_object_is_selected(played[j]))
-
998 {
-
999 card_object_set_selected(played[i], true);
-
1000 card_object_set_selected(played[j], true);
-
1001 break;
-
1002 }
-
1003 }
-
1004 }
-
1005}
-
1006
-
1007static inline void select_pair_cards_in_played_hand(void)
-
1008{
-
1009 // find two cards with the same rank
-
1010 for (int i = 0; i <= played_top - 1; i++)
-
1011 {
-
1012 for (int j = i + 1; j <= played_top; j++)
-
1013 {
-
1014 if (played[i]->card->rank == played[j]->card->rank)
-
1015 {
-
1016 card_object_set_selected(played[i], true);
-
1017 card_object_set_selected(played[j], true);
-
1018 break;
-
1019 }
-
1020 }
-
1021
-
1022 if (card_object_is_selected(played[i]))
-
1023 break;
-
1024 }
-
1025}
-
1026
-
1027static inline void select_highcard_cards_in_played_hand(void)
-
1028{
-
1029 // find the card with the highest rank in the hand
-
1030 int highest_rank_index = 0;
-
1031
-
1032 for (int i = 0; i <= played_top; i++)
-
1033 {
-
1034 if (played[i]->card->rank > played[highest_rank_index]->card->rank)
-
1035 {
-
1036 highest_rank_index = i;
-
1037 }
-
1038 }
-
1039
-
1040 card_object_set_selected(played[highest_rank_index], true);
-
1041}
-
1042
-
-
1048static inline bool game_round_is_over(void)
-
1049{
-
1050 return g_game_vars.hands == 0 ||
-
1051 g_game_vars.score >= blind_get_requirement(g_game_vars.current_blind, g_game_vars.ante);
-
1052}
+
996 if (s_played_hand[i]->card->rank == s_played_hand[j]->card->rank &&
+
997 !card_object_is_selected(s_played_hand[i]) &&
+
998 !card_object_is_selected(s_played_hand[j]))
+
999 {
+
1000 card_object_set_selected(s_played_hand[i], true);
+
1001 card_object_set_selected(s_played_hand[j], true);
+
1002 break;
+
1003 }
+
1004 }
+
1005 }
+
1006}
+
1007
+
1008static inline void select_pair_cards_in_played_hand(void)
+
1009{
+
1010 // find two cards with the same rank
+
1011 for (int i = 0; i <= s_played_top - 1; i++)
+
1012 {
+
1013 for (int j = i + 1; j <= s_played_top; j++)
+
1014 {
+
1015 if (s_played_hand[i]->card->rank == s_played_hand[j]->card->rank)
+
1016 {
+
1017 card_object_set_selected(s_played_hand[i], true);
+
1018 card_object_set_selected(s_played_hand[j], true);
+
1019 break;
+
1020 }
+
1021 }
+
1022
+
1023 if (card_object_is_selected(s_played_hand[i]))
+
1024 break;
+
1025 }
+
1026}
+
1027
+
1028static inline void select_highcard_cards_in_played_hand(void)
+
1029{
+
1030 // find the card with the highest rank in the hand
+
1031 int highest_rank_index = 0;
+
1032
+
1033 for (int i = 0; i <= s_played_top; i++)
+
1034 {
+
1035 if (s_played_hand[i]->card->rank > s_played_hand[highest_rank_index]->card->rank)
+
1036 {
+
1037 highest_rank_index = i;
+
1038 }
+
1039 }
+
1040
+
1041 card_object_set_selected(s_played_hand[highest_rank_index], true);
+
1042}
+
1043
+
+
1049static inline bool game_round_is_over(void)
+
1050{
+
1051 return g_game_vars.hands == 0 ||
+
1052 g_game_vars.score >= blind_get_requirement(g_game_vars.current_blind, g_game_vars.ante);
+
1053}
-
1053
-
1054static inline void game_round_process_input_and_state(void)
-
1055{
-
1056 if (get_hand_state() == HAND_SELECT)
-
1057 {
-
1058 game_round_process_hand_select_input();
-
1059 }
-
1060 else if (play_state == PLAY_ENDING)
-
1061 {
-
1062 if (g_game_vars.mult > 0)
-
1063 {
-
1064 // protect against score overflow
-
1065 temp_score = u32_protected_mult(g_game_vars.chips, g_game_vars.mult);
-
1066 lerped_temp_score = int2fx(temp_score);
-
1067 lerped_score = int2fx(g_game_vars.score);
-
1068
-
1069 if (temp_score > g_game_vars.best_hand_score)
-
1070 g_game_vars.best_hand_score = temp_score;
-
1071
-
1072 display_temp_score(temp_score);
-
1073
-
1074 g_game_vars.chips = 0;
-
1075 g_game_vars.mult = 0;
-
1076 display_mult();
-
1077 display_chips();
-
1078
-
1079 static const int SCORE_CALC_SFX_PITCH_SHIFT = -102; // -10% OF MM_BASE_PITCH_RATE
-
1080 static const int SCORE_CALC_SFX_VOLUME = 204; // 80% MM_SFX_FULL_VOLUME
-
1081
-
1082 // The chips calculation SFX is the same as button
-
1083 play_sfx(
-
1084 SFX_BUTTON,
-
1085 MM_BASE_PITCH_RATE + SCORE_CALC_SFX_PITCH_SHIFT,
-
1086 SCORE_CALC_SFX_VOLUME
-
1087 );
-
1088 }
-
1089 }
-
1090 else if (play_state == PLAY_ENDED && g_game_vars.timer % FRAMES(TM_SCORE_LERP_INTERVAL) == 0)
-
1091 {
-
1092 /* Using fixed point in case the score is lower than NUM_SCORE_LERP_STEPS and then
-
1093 * then the division rounds it down to 0 and it's never added to the total.
-
1094 * The operation is equivalent to
-
1095 * fxdiv(int2fx(temp_score * g_game_vars.game_speed), int2fx(NUM_SCORE_LERP_STEPS))
-
1096 */
-
1097 lerped_temp_score -= int2fx(temp_score * g_game_vars.game_speed) / NUM_SCORE_LERP_STEPS;
-
1098 lerped_score += int2fx(temp_score * g_game_vars.game_speed) / NUM_SCORE_LERP_STEPS;
-
1099
-
1100 if (lerped_temp_score > 0)
-
1101 {
-
1102 // Set the score display first because it's more important
-
1103 // in case there isn't enough time within the frame to display both
-
1104 display_score(fx2uint(lerped_score));
-
1105 display_temp_score(fx2uint(lerped_temp_score));
-
1106 }
-
1107 else
-
1108 {
-
1109 g_game_vars.score = u32_protected_add(g_game_vars.score, temp_score);
-
1110 temp_score = 0;
-
1111 lerped_temp_score = 0;
-
1112 lerped_score = 0;
-
1113
-
1114 erase_temp_score();
-
1115 display_score(g_game_vars.score);
-
1116 }
-
1117 }
-
1118}
-
1119
-
-
1124static inline void card_draw(void)
-
1125{
-
1126 if (get_deck_top() < 0 || get_hand_top() >= g_game_vars.hand_size - 1 ||
-
1127 get_hand_top() >= MAX_HAND_SIZE - 1)
-
1128 return;
-
1129
-
1130 CardObject* card_object = card_object_new(deck_pop());
-
1131
-
1132 const FIXED deck_x = int2fx(CARD_DRAW_POS.x);
-
1133 const FIXED deck_y = int2fx(CARD_DRAW_POS.y);
-
1134
-
1135 card_object->x = deck_x;
-
1136 card_object->y = deck_y;
-
1137
- -
1139 get_hand_array()[get_hand_top()] = card_object;
-
1140
-
1141 // Sort the hand after drawing a card
-
1142 sort_cards();
-
1143
-
1144 play_sfx(
-
1145 SFX_CARD_DRAW,
-
1146 MM_BASE_PITCH_RATE + cards_drawn * PITCH_STEP_DRAW_SFX,
- -
1148 );
-
1149}
+
1054
+
1055static inline void game_round_process_input_and_state(void)
+
1056{
+
1057 if (get_hand_state() == HAND_SELECT)
+
1058 {
+
1059 game_round_process_hand_select_input();
+
1060 }
+
1061 else if (play_state == PLAY_ENDING)
+
1062 {
+
1063 if (g_game_vars.mult > 0)
+
1064 {
+
1065 // protect against score overflow
+
1066 s_temp_score = u32_protected_mult(g_game_vars.chips, g_game_vars.mult);
+
1067 s_lerped_temp_score = int2fx(s_temp_score);
+
1068 s_lerped_score = int2fx(g_game_vars.score);
+
1069
+
1070 if (s_temp_score > g_game_vars.best_hand_score)
+
1071 g_game_vars.best_hand_score = s_temp_score;
+
1072
+
1073 display_temp_score(s_temp_score);
+
1074
+
1075 g_game_vars.chips = 0;
+
1076 g_game_vars.mult = 0;
+
1077 display_mult();
+
1078 display_chips();
+
1079
+
1080 static const int SCORE_CALC_SFX_PITCH_SHIFT = -102; // -10% OF MM_BASE_PITCH_RATE
+
1081 static const int SCORE_CALC_SFX_VOLUME = 204; // 80% MM_SFX_FULL_VOLUME
+
1082
+
1083 // The chips calculation SFX is the same as button
+
1084 play_sfx(
+
1085 SFX_BUTTON,
+
1086 MM_BASE_PITCH_RATE + SCORE_CALC_SFX_PITCH_SHIFT,
+
1087 SCORE_CALC_SFX_VOLUME
+
1088 );
+
1089 }
+
1090 }
+
1091 else if (play_state == PLAY_ENDED && g_game_vars.timer % FRAMES(TM_SCORE_LERP_INTERVAL) == 0)
+
1092 {
+
1093 /* Using fixed point in case the score is lower than NUM_SCORE_LERP_STEPS and then
+
1094 * then the division rounds it down to 0 and it's never added to the total.
+
1095 * The operation is equivalent to
+
1096 * fxdiv(int2fx(temp_score * g_game_vars.game_speed), int2fx(NUM_SCORE_LERP_STEPS))
+
1097 */
+
1098 s_lerped_temp_score -= int2fx(s_temp_score * g_game_vars.game_speed) / NUM_SCORE_LERP_STEPS;
+
1099 s_lerped_score += int2fx(s_temp_score * g_game_vars.game_speed) / NUM_SCORE_LERP_STEPS;
+
1100
+
1101 if (s_lerped_temp_score > 0)
+
1102 {
+
1103 // Set the score display first because it's more important
+
1104 // in case there isn't enough time within the frame to display both
+
1105 display_score(fx2uint(s_lerped_score));
+
1106 display_temp_score(fx2uint(s_lerped_temp_score));
+
1107 }
+
1108 else
+
1109 {
+
1110 g_game_vars.score = u32_protected_add(g_game_vars.score, s_temp_score);
+
1111 s_temp_score = 0;
+
1112 s_lerped_temp_score = 0;
+
1113 s_lerped_score = 0;
+
1114
+
1115 erase_temp_score();
+
1116 display_score(g_game_vars.score);
+
1117 }
+
1118 }
+
1119}
+
1120
+
+
1125static inline void card_draw(void)
+
1126{
+
1127 if (get_deck_top() < 0 || get_hand_top() >= g_game_vars.hand_size - 1 ||
+
1128 get_hand_top() >= MAX_HAND_SIZE - 1)
+
1129 return;
+
1130
+
1131 CardObject* card_object = card_object_new(deck_pop());
+
1132
+
1133 const FIXED deck_x = int2fx(CARD_DRAW_POS.x);
+
1134 const FIXED deck_y = int2fx(CARD_DRAW_POS.y);
+
1135
+
1136 card_object->x = deck_x;
+
1137 card_object->y = deck_y;
+
1138
+ +
1140 get_hand_array()[get_hand_top()] = card_object;
+
1141
+
1142 // Sort the hand after drawing a card
+
1143 sort_cards();
+
1144
+
1145 play_sfx(
+
1146 SFX_CARD_DRAW,
+
1147 MM_BASE_PITCH_RATE + s_cards_drawn * PITCH_STEP_DRAW_SFX,
+ +
1149 );
+
1150}
-
1150
-
1151static inline void game_round_process_card_draw(void)
-
1152{
-
1153 if (get_hand_state() == HAND_DRAW && cards_drawn < g_game_vars.hand_size)
-
1154 {
-
1155 if (g_game_vars.timer % FRAMES(10) == 0) // Draw a card every 10 frames
-
1156 {
-
1157 cards_drawn++;
-
1158 card_draw();
-
1159 }
-
1160 }
-
1161 else if (get_hand_state() == HAND_DRAW)
-
1162 {
-
1163 set_hand_state(HAND_SELECT); // Change the hand state to select after drawing all the cards
-
1164 cards_drawn = 0;
-
1165 g_game_vars.timer = TM_ZERO;
-
1166 }
-
1167}
-
1168
-
1169static inline void game_round_discarded_cards_loop(void)
-
1170{
-
1171 // Discarded cards loop (mainly for shuffling)
-
1172 if (hand_nb_held_cards() == 0 && get_hand_state() == HAND_SHUFFLING && discard_top >= -1 &&
-
1173 g_game_vars.timer > FRAMES(10))
-
1174 {
-
1175 // Change the background to the round end background. This is how it works in Balatro, so
-
1176 // I'm doing it this way too.
-
1177 change_background(BG_ROUND_END, false);
-
1178
-
1179 // We take each discarded card and put it back into the deck with a short animation
-
1180 static CardObject* discarded_card_object = NULL;
-
1181 if (discard_top >= 0 && discarded_card_object == NULL)
-
1182 {
-
1183 discarded_card_object = card_object_new(discard_pop());
-
1184
-
1185 // Set the sprite for the discarded card object
-
1186 card_object_set_sprite(discarded_card_object, 0);
-
1187 sprite_object_reset_transform((SpriteObject*)discarded_card_object);
-
1188
-
1189 discarded_card_object->tx = int2fx(204);
-
1190 discarded_card_object->ty = int2fx(112);
-
1191 discarded_card_object->x = int2fx(240);
-
1192 discarded_card_object->y = int2fx(80);
-
1193 }
-
1194 else
-
1195 {
-
1196 if (discarded_card_object->y >= discarded_card_object->ty)
-
1197 {
-
1198 deck_push(discarded_card_object->card); // Put the card back into the deck
-
1199 card_object_destroy(&discarded_card_object);
-
1200
-
1201 play_sfx(
-
1202 SFX_CARD_DRAW,
-
1203 MM_BASE_PITCH_RATE + PITCH_STEP_UNDISCARD_SFX,
- -
1205 );
-
1206 }
-
1207 }
-
1208
-
1209 // If there are no more discarded cards, stop shuffling
-
1210 if (discard_top == -1 && discarded_card_object == NULL)
-
1211 {
-
1212 // After HAND_SHUFFLING the round is over
- -
1214 }
-
1215 }
-
1216}
-
1217
-
1218static inline void select_cards_in_played_hand(void)
-
1219{
-
1220 switch (get_hand_type()) // select the cards that apply to the hand type
-
1221 {
-
1222 case NONE:
-
1223 break;
-
1224 case HIGH_CARD:
-
1225 select_highcard_cards_in_played_hand();
-
1226 break;
-
1227 case PAIR:
-
1228 select_pair_cards_in_played_hand();
-
1229 break;
-
1230 case TWO_PAIR:
-
1231 select_two_pair_cards_in_played_hand();
-
1232 break;
-
1233 case THREE_OF_A_KIND:
-
1234 select_three_of_a_kind_cards_in_played_hand();
-
1235 break;
-
1236 case FOUR_OF_A_KIND:
-
1237 select_four_of_a_kind_cards_in_played_hand();
-
1238 break;
-
1239 case STRAIGHT:
-
1240 /* FALL THROUGH */
-
1241 case FLUSH:
-
1242 /* FALL THROUGH */
-
1243 case STRAIGHT_FLUSH:
-
1244 /* FALL THROUGH */
-
1245 case ROYAL_FLUSH:
-
1246 select_flush_and_straight_cards_in_played_hand();
-
1247 break;
-
1248 case FULL_HOUSE:
-
1249 /* FALL THROUGH */
-
1250 case FIVE_OF_A_KIND:
-
1251 /* FALL THROUGH */
-
1252 case FLUSH_HOUSE:
-
1253 /* FALL THROUGH */
-
1254 case FLUSH_FIVE: // Select all played cards in the hand
-
1255 select_all_five_cards_in_played_hand();
-
1256 break;
-
1257 }
-
1258}
-
1259
-
1260static inline void cards_in_hand_update_loop(void)
-
1261{
-
1262 int selected_card_idx = hand_sel_idx_to_card_idx(game_round_selection_grid.selection.x);
-
1263
-
1264 // TODO: Break this function up into smaller ones, Gods be good
-
1265 // Start from the end of the hand and work backwards because that's how Balatro does it
-
1266 CardObject** hand = get_hand_array();
-
1267
-
1268 for (int i = get_hand_top(); i >= 0; i--)
-
1269 {
-
1270 if (hand[i] != NULL)
-
1271 {
-
1272 FIXED hand_x = int2fx(HAND_START_POS.x);
-
1273 FIXED hand_y = int2fx(HAND_START_POS.y);
-
1274
-
1275 switch (get_hand_state())
-
1276 {
-
1277 case HAND_DRAW:
-
1278 hand_x = hand_x + (int2fx(i) - int2fx(get_hand_top()) / 2) *
-
1279 -HAND_SPACING_LUT[get_hand_top()];
-
1280 break;
-
1281 case HAND_SELECT:
-
1282 bool is_focused =
-
1283 (i == selected_card_idx &&
-
1284 game_round_selection_grid.selection.y == GAME_PLAYING_HAND_SEL_Y);
-
1285
-
1286 if (is_focused && !card_object_is_selected(hand[i]))
-
1287 {
-
1288 hand_y -= int2fx(CARD_FOCUSED_UNSEL_Y);
-
1289 }
-
1290 else if (!is_focused && card_object_is_selected(hand[i]))
-
1291 {
-
1292 hand_y -= int2fx(CARD_UNFOCUSED_SEL_Y);
-
1293 }
-
1294 else if (is_focused && card_object_is_selected(hand[i]))
-
1295 {
-
1296 hand_y -= int2fx(CARD_FOCUSED_SEL_Y);
-
1297 }
-
1298 if (i != selected_card_idx && hand[i]->y > hand_y)
-
1299 {
-
1300 hand[i]->y = hand_y;
-
1301 // Set target y to match y. Ensures target is updated even when vy becomes
-
1302 // 0, preventing immediate snap back.
-
1303 hand[i]->ty = hand_y;
-
1304 hand[i]->vy = 0;
-
1305 }
-
1306
-
1307 hand_x = hand_x + (int2fx(i) - int2fx(get_hand_top()) / 2) *
-
1308 -HAND_SPACING_LUT[get_hand_top()]; // TODO: Change this
-
1309 // later to reference a
-
1310 // 2D LUT of positions
-
1311 break;
-
1312 case HAND_SHUFFLING:
-
1313 /* FALL THROUGH */
-
1314 case HAND_DISCARD: // TODO: Add sound
-
1315 bool break_loop;
-
1316 card_in_hand_loop_handle_discard_and_shuffling(
-
1317 i,
-
1318 &hand_x,
-
1319 &hand_y,
-
1320 &break_loop
-
1321 );
-
1322 if (break_loop)
-
1323 break;
-
1324
-
1325 break;
-
1326 case HAND_PLAY:
-
1327 hand_x = hand_x + (int2fx(i) - int2fx(get_hand_top()) / 2) *
-
1328 -HAND_SPACING_LUT[get_hand_top()];
-
1329 hand_y += int2fx(24);
-
1330
-
1331 if (card_object_is_selected(hand[i]) && discarded_card == false &&
-
1332 g_game_vars.timer % FRAMES(10) == 0)
-
1333 {
-
1334 card_object_set_selected(hand[i], false);
-
1335 played_push(hand[i]);
-
1336 sprite_destroy(&hand[i]->sprite);
-
1337 hand[i] = NULL;
- -
1339
-
1340 play_sfx(
-
1341 SFX_CARD_DRAW,
-
1342 MM_BASE_PITCH_RATE + cards_drawn * PITCH_STEP_DISCARD_SFX,
- -
1344 );
-
1345
- - -
1348 cards_drawn++;
-
1349
-
1350 discarded_card = true;
-
1351 }
-
1352
-
1353 if (i == 0 && discarded_card == false && g_game_vars.timer % FRAMES(10) == 0)
-
1354 {
-
1355 set_hand_state(HAND_PLAYING);
-
1356 cards_drawn = 0;
- -
1358 g_game_vars.timer = TM_ZERO;
-
1359 scored_card_index = get_played_size();
-
1360
-
1361 select_cards_in_played_hand();
-
1362 }
-
1363
-
1364 break;
-
1365 // Don't need to do anything here, just wait for the player to select cards
-
1366 case HAND_PLAYING:
-
1367 hand_x = hand_x + (int2fx(i) - int2fx(get_hand_top()) / 2) *
-
1368 -HAND_SPACING_LUT[get_hand_top()];
-
1369 hand_y += int2fx(24);
-
1370 break;
-
1371 }
-
1372
-
1373 hand[i]->tx = hand_x;
-
1374 hand[i]->ty = hand_y;
-
1375 }
-
1376 }
-
1377}
-
1378
-
1379static inline void game_round_ui_text_update(void)
-
1380{
-
1381 static int last_hand_size = 0;
-
1382 static int last_deck_size = 0;
-
1383
-
1384 if (last_hand_size != hand_nb_held_cards() || last_deck_size != deck_get_size())
-
1385 {
-
1386 switch (get_current_background())
-
1387 {
-
1388 case BG_CARD_SELECTING:
-
1389 // Hand size/max size
-
1390 tte_printf(
-
1391 "#{P:%d,%d; cx:0x%X000}%2d/%-2ld",
-
1392 HAND_SIZE_RECT_SELECT.left,
-
1393 HAND_SIZE_RECT_SELECT.top,
-
1394 TTE_WHITE_PB,
- -
1396 g_game_vars.hand_size
-
1397 );
-
1398 break;
-
1399
-
1400 case BG_CARD_PLAYING:
-
1401 // Hand size/max size
-
1402 tte_printf(
-
1403 "#{P:%d,%d; cx:0x%X000}%2d/%-2ld",
-
1404 HAND_SIZE_RECT_PLAYING.left,
-
1405 HAND_SIZE_RECT_PLAYING.top,
-
1406 TTE_WHITE_PB,
- -
1408 g_game_vars.hand_size
-
1409 );
-
1410 break;
-
1411
-
1412 default:
-
1413 break;
-
1414 }
-
1415
-
1416 // Deck size/max size
-
1417 display_deck_size_max();
-
1418
-
1419 last_hand_size = hand_nb_held_cards();
-
1420 last_deck_size = deck_get_size();
-
1421 }
-
1422}
-
1423
-
- -
1425{
-
1426 u32 curr_score = u32_protected_mult(g_game_vars.chips, g_game_vars.mult);
-
1427 u32 required_score = blind_get_requirement(g_game_vars.current_blind, g_game_vars.ante);
-
1428 if (curr_score >= required_score && !score_flames_active)
-
1429 {
-
1430 // start flaming score
-
1431 score_flames_active = true;
-
1432 return;
-
1433 }
-
1434 if (curr_score < required_score && score_flames_active)
-
1435 {
-
1436 // stop flaming score and clear rect
-
1437 score_flames_active = false;
-
1438
-
1439 Rect reset_rect = SCORE_FLAME_RESET;
-
1440 main_bg_se_copy_rect(reset_rect, SCORE_FLAME_CHIPS_POS);
-
1441 reset_rect.left += SCORE_FLAME_FRAME_WIDTH;
-
1442 reset_rect.right += SCORE_FLAME_FRAME_WIDTH;
-
1443 main_bg_se_copy_rect(reset_rect, SCORE_FLAME_MULT_POS);
-
1444 }
-
1445}
+
1151
+
1152static inline void game_round_process_card_draw(void)
+
1153{
+
1154 if (get_hand_state() == HAND_DRAW && s_cards_drawn < g_game_vars.hand_size)
+
1155 {
+
1156 if (g_game_vars.timer % FRAMES(10) == 0) // Draw a card every 10 frames
+
1157 {
+
1158 s_cards_drawn++;
+
1159 card_draw();
+
1160 }
+
1161 }
+
1162 else if (get_hand_state() == HAND_DRAW)
+
1163 {
+
1164 set_hand_state(HAND_SELECT); // Change the hand state to select after drawing all the cards
+
1165 s_cards_drawn = 0;
+
1166 g_game_vars.timer = TM_ZERO;
+
1167 }
+
1168}
+
1169
+
1170static inline void game_round_discarded_cards_loop(void)
+
1171{
+
1172 // Discarded cards loop (mainly for shuffling)
+
1173 if (hand_nb_held_cards() == 0 && get_hand_state() == HAND_SHUFFLING && s_discard_top >= -1 &&
+
1174 g_game_vars.timer > FRAMES(10))
+
1175 {
+
1176 // Change the background to the round end background. This is how it works in Balatro, so
+
1177 // I'm doing it this way too.
+
1178 change_background(BG_ROUND_END, false);
+
1179
+
1180 // We take each discarded card and put it back into the deck with a short animation
+
1181 static CardObject* discarded_card_object = NULL;
+
1182 if (s_discard_top >= 0 && discarded_card_object == NULL)
+
1183 {
+
1184 discarded_card_object = card_object_new(discard_pop());
+
1185
+
1186 // Set the sprite for the discarded card object
+
1187 card_object_set_sprite(discarded_card_object, 0);
+
1188 sprite_object_reset_transform((SpriteObject*)discarded_card_object);
+
1189
+
1190 discarded_card_object->tx = int2fx(204);
+
1191 discarded_card_object->ty = int2fx(112);
+
1192 discarded_card_object->x = int2fx(240);
+
1193 discarded_card_object->y = int2fx(80);
+
1194 }
+
1195 else
+
1196 {
+
1197 if (discarded_card_object->y >= discarded_card_object->ty)
+
1198 {
+
1199 deck_push(discarded_card_object->card); // Put the card back into the deck
+
1200 card_object_destroy(&discarded_card_object);
+
1201
+
1202 play_sfx(
+
1203 SFX_CARD_DRAW,
+
1204 MM_BASE_PITCH_RATE + PITCH_STEP_UNDISCARD_SFX,
+ +
1206 );
+
1207 }
+
1208 }
+
1209
+
1210 // If there are no more discarded cards, stop shuffling
+
1211 if (s_discard_top == -1 && discarded_card_object == NULL)
+
1212 {
+
1213 // After HAND_SHUFFLING the round is over
+ +
1215 }
+
1216 }
+
1217}
+
1218
+
1219static inline void select_cards_in_played_hand(void)
+
1220{
+
1221 switch (get_hand_type()) // select the cards that apply to the hand type
+
1222 {
+
1223 case NONE:
+
1224 break;
+
1225 case HIGH_CARD:
+
1226 select_highcard_cards_in_played_hand();
+
1227 break;
+
1228 case PAIR:
+
1229 select_pair_cards_in_played_hand();
+
1230 break;
+
1231 case TWO_PAIR:
+
1232 select_two_pair_cards_in_played_hand();
+
1233 break;
+
1234 case THREE_OF_A_KIND:
+
1235 select_three_of_a_kind_cards_in_played_hand();
+
1236 break;
+
1237 case FOUR_OF_A_KIND:
+
1238 select_four_of_a_kind_cards_in_played_hand();
+
1239 break;
+
1240 case STRAIGHT:
+
1241 /* FALL THROUGH */
+
1242 case FLUSH:
+
1243 /* FALL THROUGH */
+
1244 case STRAIGHT_FLUSH:
+
1245 /* FALL THROUGH */
+
1246 case ROYAL_FLUSH:
+
1247 select_flush_and_straight_cards_in_played_hand();
+
1248 break;
+
1249 case FULL_HOUSE:
+
1250 /* FALL THROUGH */
+
1251 case FIVE_OF_A_KIND:
+
1252 /* FALL THROUGH */
+
1253 case FLUSH_HOUSE:
+
1254 /* FALL THROUGH */
+
1255 case FLUSH_FIVE: // Select all played cards in the hand
+
1256 select_all_five_cards_in_played_hand();
+
1257 break;
+
1258 }
+
1259}
+
1260
+
1261static inline void cards_in_hand_update_loop(void)
+
1262{
+
1263 int selected_card_idx = hand_sel_idx_to_card_idx(game_round_selection_grid.selection.x);
+
1264
+
1265 // TODO: Break this function up into smaller ones, Gods be good
+
1266 // Start from the end of the hand and work backwards because that's how Balatro does it
+
1267 CardObject** hand = get_hand_array();
+
1268
+
1269 for (int i = get_hand_top(); i >= 0; i--)
+
1270 {
+
1271 if (hand[i] != NULL)
+
1272 {
+
1273 FIXED hand_x = int2fx(HAND_START_POS.x);
+
1274 FIXED hand_y = int2fx(HAND_START_POS.y);
+
1275
+
1276 switch (get_hand_state())
+
1277 {
+
1278 case HAND_DRAW:
+
1279 hand_x = hand_x + (int2fx(i) - int2fx(get_hand_top()) / 2) *
+
1280 -HAND_SPACING_LUT[get_hand_top()];
+
1281 break;
+
1282 case HAND_SELECT:
+
1283 bool is_focused =
+
1284 (i == selected_card_idx &&
+
1285 game_round_selection_grid.selection.y == GAME_PLAYING_HAND_SEL_Y);
+
1286
+
1287 if (is_focused && !card_object_is_selected(hand[i]))
+
1288 {
+
1289 hand_y -= int2fx(CARD_FOCUSED_UNSEL_Y);
+
1290 }
+
1291 else if (!is_focused && card_object_is_selected(hand[i]))
+
1292 {
+
1293 hand_y -= int2fx(CARD_UNFOCUSED_SEL_Y);
+
1294 }
+
1295 else if (is_focused && card_object_is_selected(hand[i]))
+
1296 {
+
1297 hand_y -= int2fx(CARD_FOCUSED_SEL_Y);
+
1298 }
+
1299 if (i != selected_card_idx && hand[i]->y > hand_y)
+
1300 {
+
1301 hand[i]->y = hand_y;
+
1302 // Set target y to match y. Ensures target is updated even when vy becomes
+
1303 // 0, preventing immediate snap back.
+
1304 hand[i]->ty = hand_y;
+
1305 hand[i]->vy = 0;
+
1306 }
+
1307
+
1308 hand_x = hand_x + (int2fx(i) - int2fx(get_hand_top()) / 2) *
+
1309 -HAND_SPACING_LUT[get_hand_top()]; // TODO: Change this
+
1310 // later to reference a
+
1311 // 2D LUT of positions
+
1312 break;
+
1313 case HAND_SHUFFLING:
+
1314 /* FALL THROUGH */
+
1315 case HAND_DISCARD: // TODO: Add sound
+
1316 bool break_loop;
+
1317 card_in_hand_loop_handle_discard_and_shuffling(
+
1318 i,
+
1319 &hand_x,
+
1320 &hand_y,
+
1321 &break_loop
+
1322 );
+
1323 if (break_loop)
+
1324 break;
+
1325
+
1326 break;
+
1327 case HAND_PLAY:
+
1328 hand_x = hand_x + (int2fx(i) - int2fx(get_hand_top()) / 2) *
+
1329 -HAND_SPACING_LUT[get_hand_top()];
+
1330 hand_y += int2fx(24);
+
1331
+
1332 if (card_object_is_selected(hand[i]) && s_discarded_card == false &&
+
1333 g_game_vars.timer % FRAMES(10) == 0)
+
1334 {
+
1335 card_object_set_selected(hand[i], false);
+
1336 played_push(hand[i]);
+
1337 sprite_destroy(&hand[i]->sprite);
+
1338 hand[i] = NULL;
+ +
1340
+
1341 play_sfx(
+
1342 SFX_CARD_DRAW,
+
1343 MM_BASE_PITCH_RATE + s_cards_drawn * PITCH_STEP_DISCARD_SFX,
+ +
1345 );
+
1346
+ + +
1349 s_cards_drawn++;
+
1350
+
1351 s_discarded_card = true;
+
1352 }
+
1353
+
1354 if (i == 0 && s_discarded_card == false && g_game_vars.timer % FRAMES(10) == 0)
+
1355 {
+
1356 set_hand_state(HAND_PLAYING);
+
1357 s_cards_drawn = 0;
+ +
1359 g_game_vars.timer = TM_ZERO;
+
1360 s_scored_card_index = get_played_size();
+
1361
+
1362 select_cards_in_played_hand();
+
1363 }
+
1364
+
1365 break;
+
1366 // Don't need to do anything here, just wait for the player to select cards
+
1367 case HAND_PLAYING:
+
1368 hand_x = hand_x + (int2fx(i) - int2fx(get_hand_top()) / 2) *
+
1369 -HAND_SPACING_LUT[get_hand_top()];
+
1370 hand_y += int2fx(24);
+
1371 break;
+
1372 }
+
1373
+
1374 hand[i]->tx = hand_x;
+
1375 hand[i]->ty = hand_y;
+
1376 }
+
1377 }
+
1378}
+
1379
+
1380static inline void game_round_ui_text_update(void)
+
1381{
+
1382 static int s_last_hand_size = 0;
+
1383 static int s_last_deck_size = 0;
+
1384
+
1385 if (s_last_hand_size != hand_nb_held_cards() || s_last_deck_size != deck_get_size())
+
1386 {
+
1387 switch (get_current_background())
+
1388 {
+
1389 case BG_CARD_SELECTING:
+
1390 // Hand size/max size
+
1391 tte_printf(
+
1392 "#{P:%d,%d; cx:0x%X000}%2d/%-2ld",
+
1393 HAND_SIZE_RECT_SELECT.left,
+
1394 HAND_SIZE_RECT_SELECT.top,
+
1395 TTE_WHITE_PB,
+ +
1397 g_game_vars.hand_size
+
1398 );
+
1399 break;
+
1400
+
1401 case BG_CARD_PLAYING:
+
1402 // Hand size/max size
+
1403 tte_printf(
+
1404 "#{P:%d,%d; cx:0x%X000}%2d/%-2ld",
+
1405 HAND_SIZE_RECT_PLAYING.left,
+
1406 HAND_SIZE_RECT_PLAYING.top,
+
1407 TTE_WHITE_PB,
+ +
1409 g_game_vars.hand_size
+
1410 );
+
1411 break;
+
1412
+
1413 default:
+
1414 break;
+
1415 }
+
1416
+
1417 // Deck size/max size
+
1418 display_deck_size_max();
+
1419
+
1420 s_last_hand_size = hand_nb_held_cards();
+
1421 s_last_deck_size = deck_get_size();
+
1422 }
+
1423}
+
1424
+
+ +
1426{
+
1427 u32 curr_score = u32_protected_mult(g_game_vars.chips, g_game_vars.mult);
+
1428 u32 required_score = blind_get_requirement(g_game_vars.current_blind, g_game_vars.ante);
+
1429 if (curr_score >= required_score && !s_score_flames_active)
+
1430 {
+
1431 // start flaming score
+
1432 s_score_flames_active = true;
+
1433 return;
+
1434 }
+
1435 if (curr_score < required_score && s_score_flames_active)
+
1436 {
+
1437 // stop flaming score and clear rect
+
1438 s_score_flames_active = false;
+
1439
+
1440 Rect reset_rect = SCORE_FLAME_RESET;
+
1441 main_bg_se_copy_rect(reset_rect, SCORE_FLAME_CHIPS_POS);
+
1442 reset_rect.left += SCORE_FLAME_FRAME_WIDTH;
+
1443 reset_rect.right += SCORE_FLAME_FRAME_WIDTH;
+
1444 main_bg_se_copy_rect(reset_rect, SCORE_FLAME_MULT_POS);
+
1445 }
+
1446}
-
1446
-
1447static inline void game_round_process_flaming_score(void)
-
1448{
-
1449 static u8 flame_score_frame = 0;
-
1450
-
1451 if (score_flames_active)
-
1452 {
-
1453 if (g_game_vars.timer % SCORE_FLAMES_ANIM_FREQ == 0)
-
1454 {
-
1455 Rect frame_rect = SCORE_FLAME_FRAMES_START;
-
1456 flame_score_frame = (flame_score_frame + 1) % NUM_SCORE_FLAMES_FRAMES;
-
1457
-
1458 // chips flame (blue)
-
1459 frame_rect.top += flame_score_frame;
-
1460 frame_rect.bottom += flame_score_frame;
-
1461 main_bg_se_copy_rect(frame_rect, SCORE_FLAME_CHIPS_POS);
-
1462
-
1463 // mult flame (red)
-
1464 frame_rect.left += SCORE_FLAME_FRAME_WIDTH;
-
1465 frame_rect.right += SCORE_FLAME_FRAME_WIDTH;
-
1466 main_bg_se_copy_rect(frame_rect, SCORE_FLAME_MULT_POS);
-
1467 }
-
1468 }
-
1469}
-
1470
-
1471/*******************************************************************************
-
1472 * CARD/JOKER SCORING LOGIC
-
1473 ******************************************************************************/
-
1474
-
- -
1486 ListItr* starting_joker_itr,
-
1487 CardObject* card_object,
-
1488 enum JokerEvent joker_event
-
1489)
-
1490{
-
1491 JokerObject* joker;
-
1492
-
1493 while ((joker = list_itr_next(starting_joker_itr)))
-
1494 {
-
1495 if (joker_object_score(joker, card_object, joker_event))
-
1496 {
-
1497 return true;
-
1498 }
-
1499 }
-
1500 return false;
-
1501}
+
1447
+
1448static inline void game_round_process_flaming_score(void)
+
1449{
+
1450 static u8 flame_score_frame = 0;
+
1451
+
1452 if (s_score_flames_active)
+
1453 {
+
1454 if (g_game_vars.timer % SCORE_FLAMES_ANIM_FREQ == 0)
+
1455 {
+
1456 Rect frame_rect = SCORE_FLAME_FRAMES_START;
+
1457 flame_score_frame = (flame_score_frame + 1) % NUM_SCORE_FLAMES_FRAMES;
+
1458
+
1459 // chips flame (blue)
+
1460 frame_rect.top += flame_score_frame;
+
1461 frame_rect.bottom += flame_score_frame;
+
1462 main_bg_se_copy_rect(frame_rect, SCORE_FLAME_CHIPS_POS);
+
1463
+
1464 // mult flame (red)
+
1465 frame_rect.left += SCORE_FLAME_FRAME_WIDTH;
+
1466 frame_rect.right += SCORE_FLAME_FRAME_WIDTH;
+
1467 main_bg_se_copy_rect(frame_rect, SCORE_FLAME_MULT_POS);
+
1468 }
+
1469 }
+
1470}
+
1471
+
1472/*******************************************************************************
+
1473 * CARD/JOKER SCORING LOGIC
+
1474 ******************************************************************************/
+
1475
+
+ +
1487 ListItr* starting_joker_itr,
+
1488 CardObject* card_object,
+
1489 enum JokerEvent joker_event
+
1490)
+
1491{
+
1492 JokerObject* joker;
+
1493
+
1494 while ((joker = list_itr_next(starting_joker_itr)))
+
1495 {
+
1496 if (joker_object_score(joker, card_object, joker_event))
+
1497 {
+
1498 return true;
+
1499 }
+
1500 }
+
1501 return false;
+
1502}
-
1502
-
1503static inline void play_starting_played_cards_update(int played_idx)
-
1504{
-
1505 // Protect against out of bounds read in `played` array
-
1506 bool card_selected = (played_top < scored_card_index)
-
1507 ? false
-
1508 : card_object_is_selected(played[played_top - scored_card_index]);
-
1509
-
1510 if (played_idx == played_top && (g_game_vars.timer % FRAMES(10) == 0 || !card_selected) &&
-
1511 g_game_vars.timer > FRAMES(40))
-
1512 {
-
1513 scored_card_index--;
-
1514
-
1515 if (scored_card_index == 0)
-
1516 {
-
1517 _joker_scored_itr = list_itr_create(get_jokers_list());
-
1518 g_game_vars.timer = TM_ZERO;
-
1519 play_state = PLAY_BEFORE_SCORING;
-
1520 }
-
1521 }
-
1522
-
1523 played[played_idx]->tx =
-
1524 int2fx(HAND_PLAY_POS.x) + (int2fx(played_top - played_idx) - int2fx(played_top) / 2) * -27;
-
1525 played[played_idx]->ty = int2fx(HAND_PLAY_POS.y);
-
1526
-
1527 card_selected = card_object_is_selected(played[played_idx]);
-
1528 if (card_selected && played_top - played_idx >= scored_card_index)
-
1529 {
-
1530 played[played_idx]->ty -= int2fx(10);
-
1531 }
-
1532}
-
1533
-
-
1541static inline bool play_before_scoring_cards_update(void)
-
1542{
-
1543 // Activate Jokers with an effect just before the hand is scored
-
1544 if (check_and_score_joker_for_event(&_joker_scored_itr, NULL, JOKER_EVENT_ON_HAND_PLAYED))
-
1545 {
-
1546 return true;
-
1547 }
-
1548
-
1549 play_state = PLAY_SCORING_CARDS;
-
1550 return false;
-
1551}
+
1503
+
1504static inline void play_starting_played_cards_update(int played_idx)
+
1505{
+
1506 // Protect against out of bounds read in `s_played_hand` array
+
1507 bool card_selected =
+
1508 (s_played_top < s_scored_card_index)
+
1509 ? false
+
1510 : card_object_is_selected(s_played_hand[s_played_top - s_scored_card_index]);
+
1511
+
1512 if (played_idx == s_played_top && (g_game_vars.timer % FRAMES(10) == 0 || !card_selected) &&
+
1513 g_game_vars.timer > FRAMES(40))
+
1514 {
+
1515 s_scored_card_index--;
+
1516
+
1517 if (s_scored_card_index == 0)
+
1518 {
+
1519 s_joker_scored_itr = list_itr_create(get_jokers_list());
+
1520 g_game_vars.timer = TM_ZERO;
+
1521 play_state = PLAY_BEFORE_SCORING;
+
1522 }
+
1523 }
+
1524
+
1525 s_played_hand[played_idx]->tx =
+
1526 int2fx(HAND_PLAY_POS.x) +
+
1527 (int2fx(s_played_top - played_idx) - int2fx(s_played_top) / 2) * -27;
+
1528 s_played_hand[played_idx]->ty = int2fx(HAND_PLAY_POS.y);
+
1529
+
1530 card_selected = card_object_is_selected(s_played_hand[played_idx]);
+
1531 if (card_selected && s_played_top - played_idx >= s_scored_card_index)
+
1532 {
+
1533 s_played_hand[played_idx]->ty -= int2fx(10);
+
1534 }
+
1535}
+
1536
+
+
1544static inline bool play_before_scoring_cards_update(void)
+
1545{
+
1546 // Activate Jokers with an effect just before the hand is scored
+
1547 if (check_and_score_joker_for_event(&s_joker_scored_itr, NULL, JOKER_EVENT_ON_HAND_PLAYED))
+
1548 {
+
1549 return true;
+
1550 }
+
1551
+
1552 play_state = PLAY_SCORING_CARDS;
+
1553 return false;
+
1554}
-
1552
-
-
1558static inline bool play_scoring_cards_update(void)
-
1559{
-
1560 if (g_game_vars.timer % FRAMES(30) == 0 && g_game_vars.timer > FRAMES(40))
-
1561 {
-
1562 // We are about to score played Cards.
-
1563 // Start from the current card index
-
1564 // and seek the next scoring card
-
1565 while (scored_card_index <= played_top &&
-
1566 !card_object_is_selected(played[scored_card_index]))
-
1567 {
-
1568 scored_card_index++;
-
1569 }
-
1570
-
1571 // go to the next state if there are no cards left to score
-
1572 if (scored_card_index > played_top)
-
1573 {
-
1574 // reuse these variables for held cards
-
1575 _joker_scored_itr = list_itr_create(get_jokers_list());
-
1576 scored_card_index = get_hand_top();
-
1577
-
1578 play_state = PLAY_SCORING_HELD_CARDS;
-
1579
-
1580 return false;
-
1581 }
+
1555
+
+
1561static inline bool play_scoring_cards_update(void)
+
1562{
+
1563 if (g_game_vars.timer % FRAMES(30) == 0 && g_game_vars.timer > FRAMES(40))
+
1564 {
+
1565 // We are about to score played Cards.
+
1566 // Start from the current card index
+
1567 // and seek the next scoring card
+
1568 while (s_scored_card_index <= s_played_top &&
+
1569 !card_object_is_selected(s_played_hand[s_scored_card_index]))
+
1570 {
+
1571 s_scored_card_index++;
+
1572 }
+
1573
+
1574 // go to the next state if there are no cards left to score
+
1575 if (s_scored_card_index > s_played_top)
+
1576 {
+
1577 // reuse these variables for held cards
+
1578 s_joker_scored_itr = list_itr_create(get_jokers_list());
+
1579 s_scored_card_index = get_hand_top();
+
1580
+
1581 play_state = PLAY_SCORING_HELD_CARDS;
1582
-
1583 tte_erase_rect_wrapper(PLAYED_CARDS_SCORES_RECT);
-
1584
-
1585 CardObject* scored_card_object = played[scored_card_index];
-
1586
-
1587 if (card_object_is_selected(scored_card_object))
-
1588 {
-
1589 // Offset of 1 tile to keep the text on the card
-
1590 tte_set_pos(fx2int(scored_card_object->x) + TILE_SIZE, SCORED_CARD_TEXT_Y);
-
1591
-
1592 // Set text color to blue from background memory
-
1593 tte_set_special(TTE_BLUE_PB * TTE_SPECIAL_PB_MULT_OFFSET);
+
1583 return false;
+
1584 }
+
1585
+
1586 tte_erase_rect_wrapper(PLAYED_CARDS_SCORES_RECT);
+
1587
+
1588 CardObject* scored_card_object = s_played_hand[s_scored_card_index];
+
1589
+
1590 if (card_object_is_selected(scored_card_object))
+
1591 {
+
1592 // Offset of 1 tile to keep the text on the card
+
1593 tte_set_pos(fx2int(scored_card_object->x) + TILE_SIZE, SCORED_CARD_TEXT_Y);
1594
-
1595 u8 card_value = card_get_value(scored_card_object->card);
-
1596
-
1597 // Write the score to a character buffer variable
-
1598 char score_buffer[INT_MAX_DIGITS + 2]; // for '+' and null terminator
-
1599 snprintf(score_buffer, sizeof(score_buffer), "+%hhu", card_value);
-
1600 tte_write(score_buffer);
-
1601
-
1602 card_object_shake(scored_card_object, SFX_CHIPS_CARD);
-
1603
-
1604 // Relocated card scoring logic here
-
1605 g_game_vars.chips = u32_protected_add(g_game_vars.chips, card_value);
-
1606 display_chips();
-
1607
-
1608 // Allow Joker scoring
-
1609 _joker_scored_itr = list_itr_create(get_jokers_list());
-
1610 _joker_card_scored_end_itr = list_itr_create(get_jokers_list());
-
1611 }
-
1612
-
1613 play_state = PLAY_SCORING_CARD_JOKERS;
-
1614 return true;
-
1615 }
-
1616
-
1617 return false;
-
1618}
-
+
1595 // Set text color to blue from background memory
+
1596 tte_set_special(TTE_BLUE_PB * TTE_SPECIAL_PB_MULT_OFFSET);
+
1597
+
1598 u8 card_value = card_get_value(scored_card_object->card);
+
1599
+
1600 // Write the score to a character buffer variable
+
1601 char score_buffer[INT_MAX_DIGITS + 2]; // for '+' and null terminator
+
1602 snprintf(score_buffer, sizeof(score_buffer), "+%hhu", card_value);
+
1603 tte_write(score_buffer);
+
1604
+
1605 card_object_shake(scored_card_object, SFX_CHIPS_CARD);
+
1606
+
1607 // Relocated card scoring logic here
+
1608 g_game_vars.chips = u32_protected_add(g_game_vars.chips, card_value);
+
1609 display_chips();
+
1610
+
1611 // Allow Joker scoring
+
1612 s_joker_scored_itr = list_itr_create(get_jokers_list());
+
1613 s_joker_card_scored_end_itr = list_itr_create(get_jokers_list());
+
1614 }
+
1615
+
1616 play_state = PLAY_SCORING_CARD_JOKERS;
+
1617 return true;
+
1618 }
1619
-
-
1627static inline bool play_scoring_card_jokers_update(void)
-
1628{
-
1629 if (g_game_vars.timer % FRAMES(30) == 0 && g_game_vars.timer > FRAMES(40))
-
1630 {
-
1631 tte_erase_rect_wrapper(PLAYED_CARDS_SCORES_RECT);
-
1632
-
1633 // since we sought the next scoring card index in the previous state,
-
1634 // scored_card_index is guaranteed to be a scoring card
- -
1636 &_joker_scored_itr,
-
1637 played[scored_card_index],
-
1638 JOKER_EVENT_ON_CARD_SCORED
-
1639 ))
-
1640 {
-
1641 return true;
-
1642 }
-
1643
-
1644 // Trigger all Jokers that have an effect when a card finishes scoring
-
1645 // (e.g. retriggers) after activating all the other scored_card Jokers normally
- -
1647 &_joker_card_scored_end_itr,
-
1648 played[scored_card_index],
-
1649 JOKER_EVENT_ON_CARD_SCORED_END
-
1650 ))
-
1651 {
-
1652 // If we just scored a retrigger, return early and go back to the
-
1653 // previous state score the same card again without incrementing
-
1654 // scored_card_index to score the current card again
-
1655 if (retrigger)
-
1656 {
-
1657 retrigger = false;
-
1658 play_state = PLAY_SCORING_CARDS;
-
1659 }
-
1660 return true;
-
1661 }
-
1662
-
1663 // increment index to start seeking the next scoring card from the next card
-
1664 scored_card_index++;
-
1665 play_state = PLAY_SCORING_CARDS;
-
1666 }
-
1667
-
1668 return false;
-
1669}
+
1620 return false;
+
1621}
+
1622
+
+
1630static inline bool play_scoring_card_jokers_update(void)
+
1631{
+
1632 if (g_game_vars.timer % FRAMES(30) == 0 && g_game_vars.timer > FRAMES(40))
+
1633 {
+
1634 tte_erase_rect_wrapper(PLAYED_CARDS_SCORES_RECT);
+
1635
+
1636 // since we sought the next scoring card index in the previous state,
+
1637 // scored_card_index is guaranteed to be a scoring card
+ +
1639 &s_joker_scored_itr,
+
1640 s_played_hand[s_scored_card_index],
+
1641 JOKER_EVENT_ON_CARD_SCORED
+
1642 ))
+
1643 {
+
1644 return true;
+
1645 }
+
1646
+
1647 // Trigger all Jokers that have an effect when a card finishes scoring
+
1648 // (e.g. retriggers) after activating all the other scored_card Jokers normally
+ +
1650 &s_joker_card_scored_end_itr,
+
1651 s_played_hand[s_scored_card_index],
+
1652 JOKER_EVENT_ON_CARD_SCORED_END
+
1653 ))
+
1654 {
+
1655 // If we just scored a retrigger, return early and go back to the
+
1656 // previous state score the same card again without incrementing
+
1657 // scored_card_index to score the current card again
+
1658 if (s_retrigger)
+
1659 {
+
1660 s_retrigger = false;
+
1661 play_state = PLAY_SCORING_CARDS;
+
1662 }
+
1663 return true;
+
1664 }
+
1665
+
1666 // increment index to start seeking the next scoring card from the next card
+
1667 s_scored_card_index++;
+
1668 play_state = PLAY_SCORING_CARDS;
+
1669 }
1670
-
-
1677static inline bool play_scoring_held_cards_update(int played_idx)
-
1678{
-
1679 if (played_idx == 0 && (g_game_vars.timer % FRAMES(30) == 0) && g_game_vars.timer > FRAMES(40))
-
1680 {
-
1681 tte_erase_rect_wrapper(HELD_CARDS_SCORES_RECT);
-
1682
-
1683 CardObject** hand = get_hand_array();
-
1684
-
1685 // Go through all held cards and see if they activate Jokers
-
1686 for (; scored_card_index >= 0; scored_card_index--)
-
1687 {
- -
1689 &_joker_scored_itr,
-
1690 hand[scored_card_index],
-
1691 JOKER_EVENT_ON_CARD_HELD
-
1692 ))
-
1693 {
-
1694 card_object_shake(hand[scored_card_index], SFX_CARD_SELECT);
-
1695 return true;
-
1696 }
-
1697 _joker_scored_itr = list_itr_create(get_jokers_list());
-
1698 }
-
1699
-
1700 scored_card_index = 0;
-
1701 _joker_round_end_itr = list_itr_create(get_jokers_list());
-
1702 play_state = PLAY_SCORING_INDEPENDENT_JOKERS;
-
1703 }
-
1704
-
1705 return false;
-
1706}
+
1671 return false;
+
1672}
+
1673
+
+
1680static inline bool play_scoring_held_cards_update(int played_idx)
+
1681{
+
1682 if (played_idx == 0 && (g_game_vars.timer % FRAMES(30) == 0) && g_game_vars.timer > FRAMES(40))
+
1683 {
+
1684 tte_erase_rect_wrapper(HELD_CARDS_SCORES_RECT);
+
1685
+
1686 CardObject** hand = get_hand_array();
+
1687
+
1688 // Go through all held cards and see if they activate Jokers
+
1689 for (; s_scored_card_index >= 0; s_scored_card_index--)
+
1690 {
+ +
1692 &s_joker_scored_itr,
+
1693 hand[s_scored_card_index],
+
1694 JOKER_EVENT_ON_CARD_HELD
+
1695 ))
+
1696 {
+
1697 card_object_shake(hand[s_scored_card_index], SFX_CARD_SELECT);
+
1698 return true;
+
1699 }
+
1700 s_joker_scored_itr = list_itr_create(get_jokers_list());
+
1701 }
+
1702
+
1703 s_scored_card_index = 0;
+
1704 s_joker_round_end_itr = list_itr_create(get_jokers_list());
+
1705 play_state = PLAY_SCORING_INDEPENDENT_JOKERS;
+
1706 }
1707
-
-
1714static inline bool play_scoring_independent_jokers_update(int played_idx)
-
1715{
-
1716 if (played_idx == 0 && (g_game_vars.timer % FRAMES(30) == 0) && g_game_vars.timer > FRAMES(40))
-
1717 {
-
1718
-
1719 tte_erase_rect_wrapper(PLAYED_CARDS_SCORES_RECT);
-
1720
-
1721 if (check_and_score_joker_for_event(&_joker_scored_itr, NULL, JOKER_EVENT_INDEPENDENT))
-
1722 {
-
1723 return true;
-
1724 }
-
1725
-
1726 // Reset the scored card index to past the top of the played stack
-
1727 scored_card_index = get_played_size();
+
1708 return false;
+
1709}
+
+
1710
+
+
1717static inline bool play_scoring_independent_jokers_update(int played_idx)
+
1718{
+
1719 if (played_idx == 0 && (g_game_vars.timer % FRAMES(30) == 0) && g_game_vars.timer > FRAMES(40))
+
1720 {
+
1721
+
1722 tte_erase_rect_wrapper(PLAYED_CARDS_SCORES_RECT);
+
1723
+
1724 if (check_and_score_joker_for_event(&s_joker_scored_itr, NULL, JOKER_EVENT_INDEPENDENT))
+
1725 {
+
1726 return true;
+
1727 }
1728
-
1729 play_state = PLAY_SCORING_HAND_SCORED_END;
-
1730 }
+
1729 // Reset the scored card index to past the top of the played stack
+
1730 s_scored_card_index = get_played_size();
1731
-
1732 return false;
-
1733}
-
+
1732 play_state = PLAY_SCORING_HAND_SCORED_END;
+
1733 }
1734
-
-
1741static inline bool play_scoring_hand_scored_end_update(int played_idx)
-
1742{
-
1743 if (played_idx == 0 && (g_game_vars.timer % FRAMES(30) == 0) && g_game_vars.timer > FRAMES(40))
-
1744 {
-
1745
-
1746 tte_erase_rect_wrapper(PLAYED_CARDS_SCORES_RECT);
-
1747
-
1748 bool scored = check_and_score_joker_for_event(
-
1749 &_joker_round_end_itr,
-
1750 NULL,
-
1751 JOKER_EVENT_ON_HAND_SCORED_END
-
1752 );
-
1753
-
1754 if (scored)
-
1755 {
-
1756 return true;
-
1757 }
-
1758
-
1759 g_game_vars.timer = TM_ZERO;
-
1760 play_state = PLAY_ENDING;
-
1761 }
-
1762
-
1763 return false;
-
1764}
+
1735 return false;
+
1736}
+
1737
+
+
1744static inline bool play_scoring_hand_scored_end_update(int played_idx)
+
1745{
+
1746 if (played_idx == 0 && (g_game_vars.timer % FRAMES(30) == 0) && g_game_vars.timer > FRAMES(40))
+
1747 {
+
1748
+
1749 tte_erase_rect_wrapper(PLAYED_CARDS_SCORES_RECT);
+
1750
+
1751 bool scored = check_and_score_joker_for_event(
+
1752 &s_joker_round_end_itr,
+
1753 NULL,
+
1754 JOKER_EVENT_ON_HAND_SCORED_END
+
1755 );
+
1756
+
1757 if (scored)
+
1758 {
+
1759 return true;
+
1760 }
+
1761
+
1762 g_game_vars.timer = TM_ZERO;
+
1763 play_state = PLAY_ENDING;
+
1764 }
1765
-
-
1772static inline void play_ending_played_cards_update(int played_idx)
-
1773{
-
1774 // Same protection against out of bounds access as `play_starting_played_cards_update`
-
1775 bool card_selected = (played_top < scored_card_index)
-
1776 ? false
-
1777 : card_object_is_selected(played[played_top - scored_card_index]);
-
1778
-
1779 if (played_idx == played_top && (g_game_vars.timer % FRAMES(10) == 0 || !card_selected) &&
-
1780 g_game_vars.timer > FRAMES(40))
-
1781 {
-
1782 scored_card_index--;
-
1783
-
1784 /* SFX_CHIPS_ACCUM has been pitch shifted to perserve high frequencies in downsampling.
-
1785 * Now it needs to be pitch shifted back to the original frequency.
-
1786 */
-
1787 int static const CHIPS_ACCUM_SFX_PITCH_RATIO = 2;
-
1788
-
1789 if (scored_card_index == 0)
-
1790 {
-
1791 play_sfx(
-
1792 SFX_CHIPS_ACCUM,
-
1793 CHIPS_ACCUM_SFX_PITCH_RATIO * MM_BASE_PITCH_RATE,
- -
1795 );
-
1796 g_game_vars.timer = TM_ZERO;
-
1797 play_state = PLAY_ENDED;
-
1798 }
-
1799 }
-
1800
-
1801 if (card_object_is_selected(played[played_idx]) && played_top - played_idx >= scored_card_index)
-
1802 {
-
1803 played[played_idx]->ty = int2fx(HAND_PLAY_POS.y);
-
1804 }
-
1805}
+
1766 return false;
+
1767}
-
1806
-
-
1815static bool play_ended_played_cards_update(int played_idx)
-
1816{
-
1817 if (!discarded_card && g_game_vars.timer > FRAMES(40))
-
1818 {
-
1819 // play the sound only once per card, when it is pushed off-screen to the right
-
1820 if (!sound_played)
-
1821 {
-
1822 play_sfx(
-
1823 SFX_CARD_DRAW,
-
1824 MM_BASE_PITCH_RATE + cards_drawn * PITCH_STEP_DISCARD_SFX,
- -
1826 );
-
1827 sound_played = true;
-
1828 }
-
1829
-
1830 // card has exited the screen, now discard it and set it to NULL
-
1831 if (played[played_idx]->x >= int2fx(CARD_DISCARD_PNT.x))
-
1832 {
-
1833 discard_push(played[played_idx]->card); // Push the card to the discard pile
-
1834 card_object_destroy(&played[played_idx]);
-
1835
-
1836 cards_drawn++; // This technically isn't drawing cards, I'm just reusing the variable
-
1837 sound_played = false; // Allow for the sound for the next card to be played
-
1838
-
1839 // we reached hand_top, all cards have been discarded
-
1840 if (played_idx == played_top)
-
1841 {
-
1842 if (game_round_is_over())
-
1843 {
-
1844 set_hand_state(HAND_SHUFFLING);
-
1845 }
-
1846 else
-
1847 {
-
1848 set_hand_state(HAND_DRAW);
-
1849 }
-
1850
-
1851 play_state = PLAY_STARTING;
-
1852 cards_drawn = 0;
- -
1854 played_top = -1; // Reset the played stack
-
1855 scored_card_index = 0;
-
1856 _joker_scored_itr = list_itr_create(get_jokers_list());
-
1857 g_game_vars.timer = TM_ZERO;
-
1858 }
-
1859
-
1860 return true; // return early to avoid accessing played[played_idx] == NULL
-
1861 }
-
1862
-
1863 // put target X position off screen to the right
-
1864 played[played_idx]->tx = int2fx(CARD_DISCARD_PNT.x);
-
1865 discarded_card = true;
-
1866 }
+
1768
+
+
1775static inline void play_ending_played_cards_update(int played_idx)
+
1776{
+
1777 // Same protection against out of bounds access as `play_starting_played_cards_update`
+
1778 bool card_selected =
+
1779 (s_played_top < s_scored_card_index)
+
1780 ? false
+
1781 : card_object_is_selected(s_played_hand[s_played_top - s_scored_card_index]);
+
1782
+
1783 if (played_idx == s_played_top && (g_game_vars.timer % FRAMES(10) == 0 || !card_selected) &&
+
1784 g_game_vars.timer > FRAMES(40))
+
1785 {
+
1786 s_scored_card_index--;
+
1787
+
1788 /* SFX_CHIPS_ACCUM has been pitch shifted to perserve high frequencies in downsampling.
+
1789 * Now it needs to be pitch shifted back to the original frequency.
+
1790 */
+
1791 int static const CHIPS_ACCUM_SFX_PITCH_RATIO = 2;
+
1792
+
1793 if (s_scored_card_index == 0)
+
1794 {
+
1795 play_sfx(
+
1796 SFX_CHIPS_ACCUM,
+
1797 CHIPS_ACCUM_SFX_PITCH_RATIO * MM_BASE_PITCH_RATE,
+ +
1799 );
+
1800 g_game_vars.timer = TM_ZERO;
+
1801 play_state = PLAY_ENDED;
+
1802 }
+
1803 }
+
1804
+
1805 if (card_object_is_selected(s_played_hand[played_idx]) &&
+
1806 s_played_top - played_idx >= s_scored_card_index)
+
1807 {
+
1808 s_played_hand[played_idx]->ty = int2fx(HAND_PLAY_POS.y);
+
1809 }
+
1810}
+
+
1811
+
+
1820static bool play_ended_played_cards_update(int played_idx)
+
1821{
+
1822 if (!s_discarded_card && g_game_vars.timer > FRAMES(40))
+
1823 {
+
1824 // play the sound only once per card, when it is pushed off-screen to the right
+
1825 if (!s_sound_played)
+
1826 {
+
1827 play_sfx(
+
1828 SFX_CARD_DRAW,
+
1829 MM_BASE_PITCH_RATE + s_cards_drawn * PITCH_STEP_DISCARD_SFX,
+ +
1831 );
+
1832 s_sound_played = true;
+
1833 }
+
1834
+
1835 // card has exited the screen, now discard it and set it to NULL
+
1836 if (s_played_hand[played_idx]->x >= int2fx(CARD_DISCARD_PNT.x))
+
1837 {
+
1838 discard_push(s_played_hand[played_idx]->card); // Push the card to the discard pile
+
1839 card_object_destroy(&s_played_hand[played_idx]);
+
1840
+
1841 s_cards_drawn++; // This technically isn't drawing cards, I'm just reusing the variable
+
1842 s_sound_played = false; // Allow for the sound for the next card to be played
+
1843
+
1844 // we reached hand_top, all cards have been discarded
+
1845 if (played_idx == s_played_top)
+
1846 {
+
1847 if (game_round_is_over())
+
1848 {
+
1849 set_hand_state(HAND_SHUFFLING);
+
1850 }
+
1851 else
+
1852 {
+
1853 set_hand_state(HAND_DRAW);
+
1854 }
+
1855
+
1856 play_state = PLAY_STARTING;
+
1857 s_cards_drawn = 0;
+ +
1859 s_played_top = -1; // Reset the played stack
+
1860 s_scored_card_index = 0;
+
1861 s_joker_scored_itr = list_itr_create(get_jokers_list());
+
1862 g_game_vars.timer = TM_ZERO;
+
1863 }
+
1864
+
1865 return true; // return early to avoid accessing played[played_idx] == NULL
+
1866 }
1867
-
1868 return false;
-
1869}
+
1868 // put target X position off screen to the right
+
1869 s_played_hand[played_idx]->tx = int2fx(CARD_DISCARD_PNT.x);
+
1870 s_discarded_card = true;
+
1871 }
+
1872
+
1873 return false;
+
1874}
-
1870
-
1871static inline void played_cards_update_loop(void)
-
1872{
-
1873 // So this one is a bit fucking weird because I have to work kinda backwards for everything
-
1874 // because of the order of the pushed cards from the hand to the play stack (also crazy that the
-
1875 // company that published Balatro is called "Playstack" and this is a play stack, but I digress)
-
1876 for (int played_idx = 0; played_idx <= played_top; played_idx++)
-
1877 {
-
1878 if (played[played_idx] == NULL)
-
1879 {
-
1880 continue;
-
1881 }
-
1882
-
1883 if (card_object_get_sprite(played[played_idx]) == NULL)
+
1875
+
1876static inline void played_cards_update_loop(void)
+
1877{
+
1878 // So this one is a bit fucking weird because I have to work kinda backwards for everything
+
1879 // because of the order of the pushed cards from the hand to the play stack (also crazy that the
+
1880 // company that published Balatro is called "Playstack" and this is a play stack, but I digress)
+
1881 for (int played_idx = 0; played_idx <= s_played_top; played_idx++)
+
1882 {
+
1883 if (s_played_hand[played_idx] == NULL)
1884 {
-
1885 // Set the sprite for the played card object
-
1886 card_object_set_sprite(played[played_idx], played_idx + MAX_HAND_SIZE);
-
1887 }
-
1888
-
1889 switch (play_state)
-
1890 {
-
1891 case PLAY_STARTING:
-
1892
-
1893 play_starting_played_cards_update(played_idx);
-
1894 break;
-
1895
-
1896 case PLAY_BEFORE_SCORING:
+
1885 continue;
+
1886 }
+
1887
+
1888 if (card_object_get_sprite(s_played_hand[played_idx]) == NULL)
+
1889 {
+
1890 // Set the sprite for the played card object
+
1891 card_object_set_sprite(s_played_hand[played_idx], played_idx + MAX_HAND_SIZE);
+
1892 }
+
1893
+
1894 switch (play_state)
+
1895 {
+
1896 case PLAY_STARTING:
1897
- -
1899 {
-
1900 return;
-
1901 }
-
1902 break;
-
1903
-
1904 case PLAY_SCORING_CARDS:
-
1905
- -
1907 {
-
1908 return;
-
1909 }
-
1910 break;
-
1911
-
1912 case PLAY_SCORING_CARD_JOKERS:
-
1913
- -
1915 {
-
1916 return;
-
1917 }
-
1918 break;
-
1919
-
1920 case PLAY_SCORING_HELD_CARDS:
-
1921
-
1922 if (play_scoring_held_cards_update(played_idx))
-
1923 {
-
1924 return;
-
1925 }
-
1926 break;
-
1927
-
1928 case PLAY_SCORING_INDEPENDENT_JOKERS:
-
1929
- -
1931 {
-
1932 return;
-
1933 }
-
1934 break;
-
1935
-
1936 case PLAY_SCORING_HAND_SCORED_END:
-
1937
- -
1939 {
-
1940 return;
-
1941 }
-
1942 break;
-
1943
-
1944 case PLAY_ENDING:
-
1945
- +
1898 play_starting_played_cards_update(played_idx);
+
1899 break;
+
1900
+
1901 case PLAY_BEFORE_SCORING:
+
1902
+ +
1904 {
+
1905 return;
+
1906 }
+
1907 break;
+
1908
+
1909 case PLAY_SCORING_CARDS:
+
1910
+ +
1912 {
+
1913 return;
+
1914 }
+
1915 break;
+
1916
+
1917 case PLAY_SCORING_CARD_JOKERS:
+
1918
+ +
1920 {
+
1921 return;
+
1922 }
+
1923 break;
+
1924
+
1925 case PLAY_SCORING_HELD_CARDS:
+
1926
+
1927 if (play_scoring_held_cards_update(played_idx))
+
1928 {
+
1929 return;
+
1930 }
+
1931 break;
+
1932
+
1933 case PLAY_SCORING_INDEPENDENT_JOKERS:
+
1934
+ +
1936 {
+
1937 return;
+
1938 }
+
1939 break;
+
1940
+
1941 case PLAY_SCORING_HAND_SCORED_END:
+
1942
+ +
1944 {
+
1945 return;
+
1946 }
1947 break;
1948
-
1949 case PLAY_ENDED:
+
1949 case PLAY_ENDING:
1950
-
1951 if (play_ended_played_cards_update(played_idx))
-
1952 {
-
1953 // we continue here instead of returning for performance
-
1954 // to instantly go to the next card to discard at played_idx+1,
-
1955 // instead of starting over from index 0 and going up
-
1956 // to that card again
-
1957 continue;
-
1958 }
-
1959 break;
-
1960 }
-
1961
-
1962 played[played_idx]->tscale = FIX_ONE;
-
1963 }
-
1964}
-
1965
-
1966/*******************************************************************************
-
1967 * FOUND STATE FUNCTIONS
-
1968 ******************************************************************************/
-
1969
-
- -
1971{
-
1972 _joker_scored_itr = list_itr_create(get_jokers_list());
-
1973
-
1974 set_hand_state(HAND_DRAW);
- -
1976 cards_drawn = 0;
-
1977
-
1978 sprite_destroy(&g_game_vars.playing_blind_token);
-
1979 g_game_vars.playing_blind_token = blind_token_new(
-
1980 g_game_vars.current_blind,
-
1981 CUR_BLIND_TOKEN_POS.x,
-
1982 CUR_BLIND_TOKEN_POS.y,
-
1983 PLAYING_BLIND_TOKEN_LAYER
-
1984 ); // Create the blind token sprite at the top left corner
-
1985 // TODO: Hide blind token and display it after sliding blind rect animation
-
1986 // if (g_game_vars.playing_blind_token != NULL)
-
1987 //{
-
1988 // obj_hide(g_game_vars.playing_blind_token->obj); // Hide the blind token sprite for now
-
1989 //}
-
1990 sprite_destroy(&g_game_vars.round_end_blind_token);
-
1991 g_game_vars.round_end_blind_token = blind_token_new(
-
1992 g_game_vars.current_blind,
-
1993 81,
-
1994 86,
-
1995 ROUND_END_BLIND_TOKEN_LAYER
-
1996 ); // Create the blind token sprite for round end
-
1997
-
1998 if (g_game_vars.round_end_blind_token != NULL)
-
1999 {
-
2000 obj_hide(g_game_vars.round_end_blind_token->obj); // Hide the blind token sprite for now
-
2001 }
+ +
1952 break;
+
1953
+
1954 case PLAY_ENDED:
+
1955
+
1956 if (play_ended_played_cards_update(played_idx))
+
1957 {
+
1958 // we continue here instead of returning for performance
+
1959 // to instantly go to the next card to discard at played_idx+1,
+
1960 // instead of starting over from index 0 and going up
+
1961 // to that card again
+
1962 continue;
+
1963 }
+
1964 break;
+
1965 }
+
1966
+
1967 s_played_hand[played_idx]->tscale = FIX_ONE;
+
1968 }
+
1969}
+
1970
+
1971/*******************************************************************************
+
1972 * FOUND STATE FUNCTIONS
+
1973 ******************************************************************************/
+
1974
+
+ +
1976{
+
1977 s_joker_scored_itr = list_itr_create(get_jokers_list());
+
1978
+
1979 set_hand_state(HAND_DRAW);
+ +
1981 s_cards_drawn = 0;
+
1982
+
1983 sprite_destroy(&g_game_vars.playing_blind_token);
+
1984 g_game_vars.playing_blind_token = blind_token_new(
+
1985 g_game_vars.current_blind,
+
1986 CUR_BLIND_TOKEN_POS.x,
+
1987 CUR_BLIND_TOKEN_POS.y,
+
1988 PLAYING_BLIND_TOKEN_LAYER
+
1989 ); // Create the blind token sprite at the top left corner
+
1990 // TODO: Hide blind token and display it after sliding blind rect animation
+
1991 // if (g_game_vars.playing_blind_token != NULL)
+
1992 //{
+
1993 // obj_hide(g_game_vars.playing_blind_token->obj); // Hide the blind token sprite for now
+
1994 //}
+
1995 sprite_destroy(&g_game_vars.round_end_blind_token);
+
1996 g_game_vars.round_end_blind_token = blind_token_new(
+
1997 g_game_vars.current_blind,
+
1998 81,
+
1999 86,
+
2000 ROUND_END_BLIND_TOKEN_LAYER
+
2001 ); // Create the blind token sprite for round end
2002
-
2003 Rect blind_req_text_rect = BLIND_REQ_TEXT_RECT;
-
2004 u32 blind_requirement = blind_get_requirement(g_game_vars.current_blind, g_game_vars.ante);
-
2005
-
2006 char blind_req_str_buff[UINT_MAX_DIGITS + 1];
+
2003 if (g_game_vars.round_end_blind_token != NULL)
+
2004 {
+
2005 obj_hide(g_game_vars.round_end_blind_token->obj); // Hide the blind token sprite for now
+
2006 }
2007
- -
2009 blind_requirement,
-
2010 rect_width(&BLIND_REQ_TEXT_RECT) / TTE_CHAR_SIZE,
-
2011 blind_req_str_buff
-
2012 );
-
2013
-
2014 // Update text rect for right alignment AFTER shortening the number
-
2015 update_text_rect_to_right_align_str(&blind_req_text_rect, blind_req_str_buff, OVERFLOW_RIGHT);
-
2016
-
2017 tte_printf(
-
2018 "#{P:%d,%d; cx:0x%X000}%s",
-
2019 blind_req_text_rect.left,
-
2020 blind_req_text_rect.top,
-
2021 TTE_RED_PB,
-
2022 blind_req_str_buff
-
2023 );
-
2024 tte_printf(
-
2025 "#{P:%d,%d; cx:0x%X000}$%d",
-
2026 BLIND_REWARD_RECT.left,
-
2027 BLIND_REWARD_RECT.top,
-
2028 TTE_YELLOW_PB,
-
2029 blind_get_reward(g_game_vars.current_blind)
-
2030 ); // Blind reward
-
2031
-
2032 deck_shuffle(); // Shuffle the deck at the start of the round
-
2033
-
2034 /* Note that since cards_in_hand_update_loop() handles card highlight there's no need
-
2035 * to call a selection changed callback to highlight the initial card, this wouldn't work
-
2036 * otherwise or for the buttons.
-
2037 */
-
2038 game_round_selection_grid.selection = GAME_PLAYING_INIT_SEL;
-
2039}
+
2008 Rect blind_req_text_rect = BLIND_REQ_TEXT_RECT;
+
2009 u32 blind_requirement = blind_get_requirement(g_game_vars.current_blind, g_game_vars.ante);
+
2010
+
2011 char blind_req_str_buff[UINT_MAX_DIGITS + 1];
+
2012
+ +
2014 blind_requirement,
+
2015 rect_width(&BLIND_REQ_TEXT_RECT) / TTE_CHAR_SIZE,
+
2016 blind_req_str_buff
+
2017 );
+
2018
+
2019 // Update text rect for right alignment AFTER shortening the number
+
2020 update_text_rect_to_right_align_str(&blind_req_text_rect, blind_req_str_buff, OVERFLOW_RIGHT);
+
2021
+
2022 tte_printf(
+
2023 "#{P:%d,%d; cx:0x%X000}%s",
+
2024 blind_req_text_rect.left,
+
2025 blind_req_text_rect.top,
+
2026 TTE_RED_PB,
+
2027 blind_req_str_buff
+
2028 );
+
2029 tte_printf(
+
2030 "#{P:%d,%d; cx:0x%X000}$%d",
+
2031 BLIND_REWARD_RECT.left,
+
2032 BLIND_REWARD_RECT.top,
+
2033 TTE_YELLOW_PB,
+
2034 blind_get_reward(g_game_vars.current_blind)
+
2035 ); // Blind reward
+
2036
+
2037 deck_shuffle(); // Shuffle the deck at the start of the round
+
2038
+
2039 /* Note that since cards_in_hand_update_loop() handles card highlight there's no need
+
2040 * to call a selection changed callback to highlight the initial card, this wouldn't work
+
2041 * otherwise or for the buttons.
+
2042 */
+
2043 game_round_selection_grid.selection = GAME_PLAYING_INIT_SEL;
+
2044}
-
2040
-
- -
2042{
-
2043 // Background logic (thissss might be moved to the card'ssss logic later. I'm a sssssnake)
-
2044 if (get_hand_state() == HAND_DRAW || get_hand_state() == HAND_DISCARD ||
-
2045 get_hand_state() == HAND_SELECT)
-
2046 {
-
2047 change_background(BG_CARD_SELECTING, false);
-
2048 }
-
2049 else if (get_hand_state() != HAND_SHUFFLING)
-
2050 {
-
2051 change_background(BG_CARD_PLAYING, false);
-
2052 }
-
2053
-
2054 game_round_process_input_and_state();
-
2055
-
2056 // Card logic
-
2057
-
2058 game_round_process_card_draw();
-
2059
-
2060 game_round_discarded_cards_loop();
-
2061
-
2062 discarded_card = false;
-
2063
-
2064 cards_in_hand_update_loop();
-
2065 played_cards_update_loop();
+
2045
+
+ +
2047{
+
2048 // Background logic (thissss might be moved to the card'ssss logic later. I'm a sssssnake)
+
2049 if (get_hand_state() == HAND_DRAW || get_hand_state() == HAND_DISCARD ||
+
2050 get_hand_state() == HAND_SELECT)
+
2051 {
+
2052 change_background(BG_CARD_SELECTING, false);
+
2053 }
+
2054 else if (get_hand_state() != HAND_SHUFFLING)
+
2055 {
+
2056 change_background(BG_CARD_PLAYING, false);
+
2057 }
+
2058
+
2059 game_round_process_input_and_state();
+
2060
+
2061 // Card logic
+
2062
+
2063 game_round_process_card_draw();
+
2064
+
2065 game_round_discarded_cards_loop();
2066
-
2067 game_round_ui_text_update();
+
2067 s_discarded_card = false;
2068
-
2069 // animate score flames if we exceed the score requirement
-
2070 game_round_process_flaming_score();
-
2071}
+
2069 cards_in_hand_update_loop();
+
2070 played_cards_update_loop();
+
2071
+
2072 game_round_ui_text_update();
+
2073
+
2074 // animate score flames if we exceed the score requirement
+
2075 game_round_process_flaming_score();
+
2076}
Utilities for using maxmod to play sound effects.
#define MM_BASE_PITCH_RATE
The default pitch rate for the sound effect played.
Definition audio_utils.h:37
@@ -2190,41 +2195,41 @@ $(document).ready(function(){initNavTree('round_8c_source.html',''); initResizab
void * list_itr_next(ListItr *itr)
Definition list.c:281
ListItr list_itr_create(List *list)
Definition list.c:257
u32 rng_get_u32(void)
Get the next "randomly" generated number in the sequence from the current seed.
Definition random.c:36
-
static bool game_round_is_over(void)
Determines if the round is over, be it because we lost or won the round.
Definition round.c:1048
-
static void card_draw(void)
Draw the next card at the top of the Deck and play a little Sprite animation to position it in our ha...
Definition round.c:1124
+
static bool game_round_is_over(void)
Determines if the round is over, be it because we lost or won the round.
Definition round.c:1049
+
static void card_draw(void)
Draw the next card at the top of the Deck and play a little Sprite animation to position it in our ha...
Definition round.c:1125
static void discard_push(Card *card)
Push a new card to discard at the end of the associated array.
Definition round.c:277
static void game_round_handle_round_over(void)
Evaluates if we have won or lost when we can no longer play so that we land on the correct Game Over ...
Definition round.c:723
-
static bool play_scoring_independent_jokers_update(int played_idx)
Score Jokers normally for event JOKER_EVENT_INDEPENDENT.
Definition round.c:1714
+
static bool play_scoring_independent_jokers_update(int played_idx)
Score Jokers normally for event JOKER_EVENT_INDEPENDENT.
Definition round.c:1717
static void game_round_play_hand_on_pressed(void)
"Play" button implementation.
Definition round.c:510
int get_scored_card_index(void)
Get the index of the card that is currently being scored.
Definition round.c:296
static void played_push(CardObject *card_object)
Push a new card to play at the end of the associated array.
Definition round.c:258
int get_discard_top(void)
Get the index of the last discarded card.
Definition round.c:265
-
static bool play_before_scoring_cards_update(void)
Returns true if the Jokers scoring loop has returned early for event JOKER_EVENT_ON_HAND_PLAYED.
Definition round.c:1541
+
static bool play_before_scoring_cards_update(void)
Returns true if the Jokers scoring loop has returned early for event JOKER_EVENT_ON_HAND_PLAYED.
Definition round.c:1544
int get_played_size(void)
Get the number of cards played.
Definition round.c:248
void set_retrigger(bool new_retrigger)
Set whether the current card should get triggered again.
Definition round.c:301
static void game_round_sort_by_suit_on_pressed(void)
"Suit" sorting button implementation.
Definition round.c:486
-
static bool check_and_score_joker_for_event(ListItr *starting_joker_itr, CardObject *card_object, enum JokerEvent joker_event)
Iterate over the Jokers List until we encounter one that scores for the specified event.
Definition round.c:1485
-
void game_round_on_init(void)
Round state initialization.
Definition round.c:1970
-
static void play_ending_played_cards_update(int played_idx)
This is the reverse of PLAY_STARTING. The cards get reset back to their neutral position sequentially...
Definition round.c:1772
+
static bool check_and_score_joker_for_event(ListItr *starting_joker_itr, CardObject *card_object, enum JokerEvent joker_event)
Iterate over the Jokers List until we encounter one that scores for the specified event.
Definition round.c:1486
+
void game_round_on_init(void)
Round state initialization.
Definition round.c:1975
+
static void play_ending_played_cards_update(int played_idx)
This is the reverse of PLAY_STARTING. The cards get reset back to their neutral position sequentially...
Definition round.c:1775
static void game_round_execute_discard(void)
Triggers the discard of the currently selected cards in hand.
Definition round.c:450
static void game_round_execute_play_hand(void)
Triggers the playing of the currently selected cards in hand.
Definition round.c:494
-
void game_round_on_update(void)
Round state update.
Definition round.c:2041
+
void game_round_on_update(void)
Round state update.
Definition round.c:2046
static Card * discard_pop()
Remove and recover the last discarded card.
Definition round.c:289
-
void toggle_flaming_score(void)
Checks whether the score that would result from the current Chips and Mult exceeds the current Blind'...
Definition round.c:1424
+
void toggle_flaming_score(void)
Checks whether the score that would result from the current Chips and Mult exceeds the current Blind'...
Definition round.c:1425
static bool can_play_hand(void)
Determines whether the "Play" button can be pressed or not.
Definition round.c:440
-
static bool play_scoring_card_jokers_update(void)
Activate Jokers for event JOKER_EVENT_ON_CARD_SCORED_END for the previous scored card,...
Definition round.c:1627
+
static bool play_scoring_card_jokers_update(void)
Activate Jokers for event JOKER_EVENT_ON_CARD_SCORED_END for the previous scored card,...
Definition round.c:1630
void game_round_change_background_playing(void)
Change to the round card playing background.
Definition round.c:400
static bool can_discard_hand(void)
Determines whether the "Discard" button can be pressed or not.
Definition round.c:427
static void game_round_discard_on_pressed(void)
"Discard" button implementation.
Definition round.c:464
-
static bool play_scoring_held_cards_update(int played_idx)
Activate Jokers for event JOKER_EVENT_ON_CARD_HELD for the previous scored card, if any.
Definition round.c:1677
+
static bool play_scoring_held_cards_update(int played_idx)
Activate Jokers for event JOKER_EVENT_ON_CARD_HELD for the previous scored card, if any.
Definition round.c:1680
int get_played_top(void)
Get the index of the last played card.
Definition round.c:243
static int hand_sel_idx_to_card_idx(int selection_index)
Converts a selection index from the selection grid into a card index within the hand array.
Definition round.c:706
-
static bool play_scoring_hand_scored_end_update(int played_idx)
Trigger all Jokers for event JOKER_EVENT_ON_HAND_SCORED_END once they are done scoring.
Definition round.c:1741
+
static bool play_scoring_hand_scored_end_update(int played_idx)
Trigger all Jokers for event JOKER_EVENT_ON_HAND_SCORED_END once they are done scoring.
Definition round.c:1744
static GBAL_UNUSED void get_played_distribution(u8 ranks_out[NUM_RANKS], u8 suits_out[NUM_SUITS])
Outputs the distribution of ranks and suits in the played stack.
Definition round.c:314
static void game_round_sort_by_rank_on_pressed(void)
"Rank" sorting button implementation.
Definition round.c:478
void game_round_change_background_selecting(void)
Change to the round card selection background.
Definition round.c:338
-
static bool play_scoring_cards_update(void)
Score all played cards in order, then Jokers after each one.
Definition round.c:1558
-
static bool play_ended_played_cards_update(int played_idx)
Returns true if the card at index played_idx has been discarded. Basically a copy of HAND_DISCARD.
Definition round.c:1815
+
static bool play_scoring_cards_update(void)
Score all played cards in order, then Jokers after each one.
Definition round.c:1561
+
static bool play_ended_played_cards_update(int played_idx)
Returns true if the card at index played_idx has been discarded. Basically a copy of HAND_DISCARD.
Definition round.c:1820
API relative to the Rounds we play.
An implementation for a selection grid that handles directional selection.
void selection_grid_move_selection_vert(SelectionGrid *selection_grid, int direction_tribool)
Moves the selection vertically within the selection grid.
diff --git a/round_8h.html b/round_8h.html index c6d87fcd..8b81f5a3 100644 --- a/round_8h.html +++ b/round_8h.html @@ -242,7 +242,7 @@ Functions

Round state initialization.

-

Definition at line 1970 of file round.c.

+

Definition at line 1975 of file round.c.

@@ -264,7 +264,7 @@ Functions

Round state update.

-

Definition at line 2041 of file round.c.

+

Definition at line 2046 of file round.c.

@@ -406,7 +406,7 @@ Functions

Checks whether the score that would result from the current Chips and Mult exceeds the current Blind's score requirement, and applies the flaming effect if needed.

-

Definition at line 1424 of file round.c.

+

Definition at line 1425 of file round.c.

diff --git a/round_8h_source.html b/round_8h_source.html index 43c9de51..89b67df0 100644 --- a/round_8h_source.html +++ b/round_8h_source.html @@ -169,9 +169,9 @@ $(document).ready(function(){initNavTree('round_8h_source.html',''); initResizab
int get_discard_top(void)
Get the index of the last discarded card.
Definition round.c:265
int get_played_size(void)
Get the number of cards played.
Definition round.c:248
void set_retrigger(bool new_retrigger)
Set whether the current card should get triggered again.
Definition round.c:301
-
void game_round_on_init(void)
Round state initialization.
Definition round.c:1970
-
void game_round_on_update(void)
Round state update.
Definition round.c:2041
-
void toggle_flaming_score(void)
Checks whether the score that would result from the current Chips and Mult exceeds the current Blind'...
Definition round.c:1424
+
void game_round_on_init(void)
Round state initialization.
Definition round.c:1975
+
void game_round_on_update(void)
Round state update.
Definition round.c:2046
+
void toggle_flaming_score(void)
Checks whether the score that would result from the current Chips and Mult exceeds the current Blind'...
Definition round.c:1425
void game_round_change_background_playing(void)
Change to the round card playing background.
Definition round.c:400
int get_played_top(void)
Get the index of the last played card.
Definition round.c:243
void game_round_change_background_selecting(void)
Change to the round card selection background.
Definition round.c:338
diff --git a/run__setup_8c.html b/run__setup_8c.html index 94582aa6..80c30076 100644 --- a/run__setup_8c.html +++ b/run__setup_8c.html @@ -575,12 +575,12 @@ Variables   static Button choose_seed_bottom_buttons [2]   -static const char keyboard_buttons_to_char [KEYBOARD_HEIGHT *KEYBOARD_WIDTH] -  -static char seed_str [BASE36_MAX_DIGITS+1] = {'\0'} -  -static u8 seed_cursor_pos = 0 -  +static const char KEYBOARD_BUTTONS_TO_CHAR [KEYBOARD_HEIGHT *KEYBOARD_WIDTH] +  +static char s_seed_str [BASE36_MAX_DIGITS+1] = {'\0'} +  +static u8 s_seed_cursor_pos = 0 + 

Detailed Description

Setup Run menu state functions implementation.

@@ -3166,8 +3166,8 @@ Variables
- -

◆ keyboard_buttons_to_char

+ +

◆ KEYBOARD_BUTTONS_TO_CHAR

@@ -3176,7 +3176,7 @@ Variables - +
const char keyboard_buttons_to_char[KEYBOARD_HEIGHT *KEYBOARD_WIDTH]const char KEYBOARD_BUTTONS_TO_CHAR[KEYBOARD_HEIGHT *KEYBOARD_WIDTH]
@@ -3924,8 +3924,8 @@ Variables
- -

◆ seed_cursor_pos

+ +

◆ s_seed_cursor_pos

@@ -3934,7 +3934,7 @@ Variables - +
u8 seed_cursor_pos = 0u8 s_seed_cursor_pos = 0
@@ -3948,8 +3948,8 @@ Variables
- -

◆ seed_str

+ +

◆ s_seed_str

@@ -3958,7 +3958,7 @@ Variables - +
char seed_str[BASE36_MAX_DIGITS+1] = {'\0'}char s_seed_str[BASE36_MAX_DIGITS+1] = {'\0'}
diff --git a/run__setup_8c_source.html b/run__setup_8c_source.html index bfe4c03a..e4c931b5 100644 --- a/run__setup_8c_source.html +++ b/run__setup_8c_source.html @@ -663,7 +663,7 @@ $(document).ready(function(){initNavTree('run__setup_8c_source.html',''); initRe
528 }
529};
530
-
531static const char keyboard_buttons_to_char[KEYBOARD_HEIGHT * KEYBOARD_WIDTH] = {
+
531static const char KEYBOARD_BUTTONS_TO_CHAR[KEYBOARD_HEIGHT * KEYBOARD_WIDTH] = {
532 '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
533 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
534 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
@@ -672,8 +672,8 @@ $(document).ready(function(){initNavTree('run__setup_8c_source.html',''); initRe
537// clang-format on
538
539// Size BASE36_MAX_DIGITS + 1 to always have '\0' at the end
-
540static char seed_str[BASE36_MAX_DIGITS + 1] = {'\0'};
-
541static u8 seed_cursor_pos = 0;
+
540static char s_seed_str[BASE36_MAX_DIGITS + 1] = {'\0'};
+
541static u8 s_seed_cursor_pos = 0;
542
543#pragma endregion
544
@@ -720,14 +720,14 @@ $(document).ready(function(){initNavTree('run__setup_8c_source.html',''); initRe
582 if (g_game_vars.rng_info.seed == UNDEFINED)
583 {
584 // Make the string empty instead of showing all zeroes
-
585 memset(seed_str, '\0', BASE36_MAX_DIGITS + 1);
-
586 seed_cursor_pos = 0;
+
585 memset(s_seed_str, '\0', BASE36_MAX_DIGITS + 1);
+
586 s_seed_cursor_pos = 0;
587 }
588 // Or use previous Run's seed if it hasn't been reset
589 else
590 {
-
591 u32_to_base36(g_game_vars.rng_info.seed, seed_str);
-
592 seed_cursor_pos = BASE36_MAX_DIGITS;
+
591 u32_to_base36(g_game_vars.rng_info.seed, s_seed_str);
+
592 s_seed_cursor_pos = BASE36_MAX_DIGITS;
593 use_seed = true;
594 }
595 toggle_seed_enabled(use_seed);
@@ -925,7 +925,7 @@ $(document).ready(function(){initNavTree('run__setup_8c_source.html',''); initRe
808 RUN_SETUP_SEED_FIELD_TEXT_POS.y,
809 TTE_BLACK_PB,
810 BASE36_MAX_DIGITS + 1,
-
811 seed_str
+
811 s_seed_str
812 );
813}
@@ -1024,19 +1024,19 @@ $(document).ready(function(){initNavTree('run__setup_8c_source.html',''); initRe
921 u32 new_seed = rng_get_u32();
922 rng_set_seed(new_seed);
-
923 u32_to_base36(new_seed, seed_str);
+
923 u32_to_base36(new_seed, s_seed_str);
-
925 seed_cursor_pos = BASE36_MAX_DIGITS;
+
925 s_seed_cursor_pos = BASE36_MAX_DIGITS;
926}
927
931static inline void delete_seed_char(void)
932{
-
933 if (seed_cursor_pos == 0)
+
933 if (s_seed_cursor_pos == 0)
934 return;
935
-
936 seed_str[--seed_cursor_pos] = '\0';
+
936 s_seed_str[--s_seed_cursor_pos] = '\0';
938}
@@ -1044,10 +1044,10 @@ $(document).ready(function(){initNavTree('run__setup_8c_source.html',''); initRe
945static inline void type_seed_char(enum RunSetupKeyboardButtons key)
946{
-
947 if (seed_cursor_pos >= BASE36_MAX_DIGITS)
+
947 if (s_seed_cursor_pos >= BASE36_MAX_DIGITS)
948 return;
949
-
950 seed_str[seed_cursor_pos++] = keyboard_buttons_to_char[key];
+
950 s_seed_str[s_seed_cursor_pos++] = KEYBOARD_BUTTONS_TO_CHAR[key];
952}
@@ -1070,8 +1070,8 @@ $(document).ready(function(){initNavTree('run__setup_8c_source.html',''); initRe
976 // The cursor position is unsigned so always positive, but we still need to
977 // ensure it doersn't go out of bounds by more than 1 so that we can always
978 // substract 1 from it when erasing a character from the seed string.
-
979 if (seed_cursor_pos > BASE36_MAX_DIGITS)
-
980 seed_cursor_pos = BASE36_MAX_DIGITS;
+
979 if (s_seed_cursor_pos > BASE36_MAX_DIGITS)
+
980 s_seed_cursor_pos = BASE36_MAX_DIGITS;
981
982 if (key_hit(DESELECT_CARDS))
@@ -1260,7 +1260,7 @@ $(document).ready(function(){initNavTree('run__setup_8c_source.html',''); initRe
1193{
1194 // Apply provided Seed if enabled
1195 if (use_seed)
-
1196 rng_set_seed(base36_to_u32(seed_str));
+
1196 rng_set_seed(base36_to_u32(s_seed_str));
1197 else
1199
diff --git a/search/all_7.js b/search/all_7.js index 4d123703..5f81b139 100644 --- a/search/all_7.js +++ b/search/all_7.js @@ -1,7 +1,7 @@ var searchData= [ ['data_0',['data',['../structListNode.html#a735984d41155bc1032e09bece8f8d66d',1,'ListNode']]], - ['deck_5fnames_1',['deck_names',['../deck__types_8c.html#aa69c0508a53c09b17c5283a1e5be751a',1,'deck_types.c']]], + ['deck_5fnames_1',['DECK_NAMES',['../deck__types_8c.html#aca3bc778faeef112f513ae0a84c5e378',1,'deck_types.c']]], ['deck_5fon_5fpressed_2',['deck_on_pressed',['../run__setup_8c.html#adfb29cc263e0dfc5f4140631a2ba3dbc',1,'run_setup.c']]], ['deck_5ftypes_2ec_3',['deck_types.c',['../deck__types_8c.html',1,'']]], ['deck_5ftypes_2eh_4',['deck_types.h',['../deck__types_8h.html',1,'']]], diff --git a/search/variables_3.js b/search/variables_3.js index aefac1d5..139a8cf4 100644 --- a/search/variables_3.js +++ b/search/variables_3.js @@ -1,6 +1,6 @@ var searchData= [ ['data_0',['data',['../structListNode.html#a735984d41155bc1032e09bece8f8d66d',1,'ListNode']]], - ['deck_5fnames_1',['deck_names',['../deck__types_8c.html#aa69c0508a53c09b17c5283a1e5be751a',1,'deck_types.c']]], + ['deck_5fnames_1',['DECK_NAMES',['../deck__types_8c.html#aca3bc778faeef112f513ae0a84c5e378',1,'deck_types.c']]], ['direction_2',['direction',['../structListItr.html#aa41b077984fb967ea256625056b09145',1,'ListItr']]] ]; diff --git a/shop_8c.html b/shop_8c.html index 1ea952be..ea9f5fbc 100644 --- a/shop_8c.html +++ b/shop_8c.html @@ -352,18 +352,18 @@ Variables   static Button reroll_button   -static int timer -  -static int reroll_cost = REROLL_BASE_COST -  -static JokerObjectdescription_card = NULL -  -static FIXED description_card_original_x_pos = UNDEFINED -  -static FIXED description_card_original_y_pos = UNDEFINED -  -static Listdescription_card_original_list = NULL -  +static int s_timer +  +static int s_reroll_cost = REROLL_BASE_COST +  +static JokerObjects_description_card = NULL +  +static FIXED s_description_card_original_x_pos = UNDEFINED +  +static FIXED s_description_card_original_y_pos = UNDEFINED +  +static Lists_description_card_original_list = NULL + 

Detailed Description

Shop state functions implementation.

@@ -931,7 +931,7 @@ Variables
-

Definition at line 702 of file shop.c.

+

Definition at line 703 of file shop.c.

@@ -991,7 +991,7 @@ Variables

Cycling shop lights animation substate update.

-

Definition at line 856 of file shop.c.

+

Definition at line 857 of file shop.c.

@@ -1013,7 +1013,7 @@ Variables

Shop cleanup.

-

Definition at line 892 of file shop.c.

+

Definition at line 893 of file shop.c.

@@ -1057,7 +1057,7 @@ Variables

Shop state update.

-

Definition at line 882 of file shop.c.

+

Definition at line 883 of file shop.c.

@@ -1087,7 +1087,7 @@ Variables

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

-

Definition at line 814 of file shop.c.

+

Definition at line 815 of file shop.c.

@@ -1681,102 +1681,6 @@ Variables

Definition at line 82 of file shop.c.

- - - -

◆ description_card

- -
-
- - - - - -
- - - - -
JokerObject* description_card = NULL
-
-static
-
- -

Definition at line 175 of file shop.c.

- -
-
- -

◆ description_card_original_list

- -
-
- - - - - -
- - - - -
List* description_card_original_list = NULL
-
-static
-
- -

Definition at line 178 of file shop.c.

- -
-
- -

◆ description_card_original_x_pos

- -
-
- - - - - -
- - - - -
FIXED description_card_original_x_pos = UNDEFINED
-
-static
-
- -

Definition at line 176 of file shop.c.

- -
-
- -

◆ description_card_original_y_pos

- -
-
- - - - - -
- - - - -
FIXED description_card_original_y_pos = UNDEFINED
-
-static
-
- -

Definition at line 177 of file shop.c.

-
@@ -1931,8 +1835,8 @@ Variables - -

◆ reroll_cost

+ +

◆ s_description_card

@@ -1941,7 +1845,103 @@ Variables - + + +
int reroll_cost = REROLL_BASE_COSTJokerObject* s_description_card = NULL
+ + +static + + +
+ +

Definition at line 175 of file shop.c.

+ +
+
+ +

◆ s_description_card_original_list

+ +
+
+ + + + + +
+ + + + +
List* s_description_card_original_list = NULL
+
+static
+
+ +

Definition at line 178 of file shop.c.

+ +
+
+ +

◆ s_description_card_original_x_pos

+ +
+
+ + + + + +
+ + + + +
FIXED s_description_card_original_x_pos = UNDEFINED
+
+static
+
+ +

Definition at line 176 of file shop.c.

+ +
+
+ +

◆ s_description_card_original_y_pos

+ +
+
+ + + + + +
+ + + + +
FIXED s_description_card_original_y_pos = UNDEFINED
+
+static
+
+ +

Definition at line 177 of file shop.c.

+ +
+
+ +

◆ s_reroll_cost

+ +
+
+ + + @@ -1977,6 +1977,30 @@ Variables

Definition at line 91 of file shop.c.

+ + + +

◆ s_timer

+ +
+
+
+ + +
int s_reroll_cost = REROLL_BASE_COST
+ + + + +
+ + + + +
int s_timer
+
+static
+
+ +

Definition at line 168 of file shop.c.

+
@@ -2267,34 +2291,10 @@ Variables
}
game_shop_process_user_input
static void game_shop_process_user_input(void)
Handle user inputs logic in the Shop though a SelectionGrid.
Definition shop.c:553
game_shop_intro
static void game_shop_intro(void)
Intro sequence (menu and shop icon coming into frame)
Definition shop.c:283
-
game_shop_outro
static void game_shop_outro(void)
Outro sequence substate update. This makes the menu and shop icon go out of frame.
Definition shop.c:814
+
game_shop_outro
static void game_shop_outro(void)
Outro sequence substate update. This makes the menu and shop icon go out of frame.
Definition shop.c:815

Definition at line 109 of file shop.c.

- - - -

◆ timer

- -
-
- - - - - -
- - - - -
int timer
-
-static
-
- -

Definition at line 168 of file shop.c.

-
diff --git a/shop_8c_source.html b/shop_8c_source.html index 1b21c356..492131b5 100644 --- a/shop_8c_source.html +++ b/shop_8c_source.html @@ -300,22 +300,22 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
165
166// Shop internal variables
167
-
168static int timer;
+
168static int s_timer;
169
-
170static int reroll_cost = REROLL_BASE_COST;
+
170static int s_reroll_cost = REROLL_BASE_COST;
171
172// Variables relative to the Card we are showing the description of
173
174// TODO: Change this to item once it has description printing API.
-
175static JokerObject* description_card = NULL;
-
176static FIXED description_card_original_x_pos = UNDEFINED;
-
177static FIXED description_card_original_y_pos = UNDEFINED;
-
178static List* description_card_original_list = NULL;
+
175static JokerObject* s_description_card = NULL;
+
176static FIXED s_description_card_original_x_pos = UNDEFINED;
+
177static FIXED s_description_card_original_y_pos = UNDEFINED;
+
178static List* s_description_card_original_list = NULL;
179
180JokerObject* game_shop_get_description_card(void)
181{
-
182 return description_card;
+
182 return s_description_card;
183}
184
@@ -359,7 +359,7 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
217{
218 game_shop_change_background();
219
-
220 timer = TM_ZERO;
+
220 s_timer = TM_ZERO;
221
222 state_machine_register(&shop_sm);
223 state_machine_change_state(&shop_sm, GAME_SHOP_INTRO);
@@ -421,14 +421,14 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
284{
285 main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT, SCREEN_UP);
286
-
287 if (timer == TM_CREATE_SHOP_ITEMS_WAIT)
+
287 if (s_timer == TM_CREATE_SHOP_ITEMS_WAIT)
288 {
289 game_shop_create_top_row_items();
290 }
291
-
292 if (timer >= TM_SHIFT_SHOP_ICON_WAIT) // Shift the shop icon
+
292 if (s_timer >= TM_SHIFT_SHOP_ICON_WAIT) // Shift the shop icon
293 {
-
294 int timer_offset = timer - 6;
+
294 int timer_offset = s_timer - 6;
295
296 // TODO: Extract to generic function?
297 for (int y = 0; y < timer_offset; y++)
@@ -444,10 +444,10 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
307 }
308 }
309
-
310 if (timer == TM_END_GAME_SHOP_INTRO)
+
310 if (s_timer == TM_END_GAME_SHOP_INTRO)
311 {
312 state_machine_change_state(&shop_sm, GAME_SHOP_ACTIVE);
-
313 timer = TM_ZERO; // Reset the timer
+
313 s_timer = TM_ZERO; // Reset the timer
314
315 // print initial reroll cost only when the panel is in place
316 tte_printf(
@@ -455,7 +455,7 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
318 SHOP_REROLL_RECT.left,
319 SHOP_REROLL_RECT.top,
320 TTE_WHITE_PB,
-
321 reroll_cost
+
321 s_reroll_cost
322 );
323 }
324}
@@ -596,7 +596,7 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
471static inline void game_shop_reroll(void)
472{
-
473 g_game_vars.money -= reroll_cost;
+
473 g_game_vars.money -= s_reroll_cost;
474 display_money(); // Update the money display
475
476 List* shop_items_list = &s_shop_items_list;
@@ -629,13 +629,13 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
503 }
504 }
505
-
506 reroll_cost++;
+
506 s_reroll_cost++;
507 tte_printf(
508 "#{P:%d,%d; cx:0x%X000}$%d",
509 SHOP_REROLL_RECT.left,
510 SHOP_REROLL_RECT.top,
511 TTE_WHITE_PB,
-
512 reroll_cost
+
512 s_reroll_cost
513 );
514}
@@ -656,8 +656,8 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
530{
531 // Go to next blind selection game state
532 state_machine_change_state(&shop_sm, GAME_SHOP_EXIT);
-
533 timer = TM_ZERO;
-
534 reroll_cost = REROLL_BASE_COST;
+
533 s_timer = TM_ZERO;
+
534 s_reroll_cost = REROLL_BASE_COST;
535
536 pal_bg_mem[NEXT_ROUND_BTN_SELECTED_BORDER_PAL_IDX] = pal_bg_mem[SHOP_PANEL_SHADOW_PAL_IDX];
537}
@@ -670,7 +670,7 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
544
545static bool reroll_can_be_pressed(void)
546{
-
547 return g_game_vars.money >= reroll_cost;
+
547 return g_game_vars.money >= s_reroll_cost;
548}
549
@@ -686,7 +686,7 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
562 // Owned Joker
563 case 0:
564 {
-
565 description_card_original_list = get_jokers_list();
+
565 s_description_card_original_list = get_jokers_list();
566 tmp_card = list_get_at_idx(get_jokers_list(), shop_selection_grid.selection.x);
567 break;
568 }
@@ -694,7 +694,7 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
570 // Jokers for sale
571 case 1:
572 {
-
573 description_card_original_list = &s_shop_items_list;
+
573 s_description_card_original_list = &s_shop_items_list;
574 tmp_card = (shop_selection_grid.selection.x > 0)
575 ? list_get_at_idx(&s_shop_items_list, shop_selection_grid.selection.x - 1)
576 : NULL;
@@ -705,7 +705,7 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
581
582 default:
583 {
-
584 description_card_original_list = NULL;
+
584 s_description_card_original_list = NULL;
585 tmp_card = NULL;
586 break;
587 }
@@ -716,11 +716,11 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
592 // errors when pressing and releasing B in quick succession.
593 if (tmp_card != NULL && tmp_card->vx == 0 && tmp_card->vy == 0 && key_held(DESELECT_CARDS))
594 {
-
595 description_card = tmp_card;
-
596 description_card_original_x_pos = description_card->x;
-
597 description_card_original_y_pos = description_card->y;
+
595 s_description_card = tmp_card;
+
596 s_description_card_original_x_pos = s_description_card->x;
+
597 s_description_card_original_y_pos = s_description_card->y;
598
-
599 timer = TM_ZERO;
+
599 s_timer = TM_ZERO;
600 state_machine_change_state(&shop_sm, GAME_SHOP_SHOW_CARD_DESC);
601 }
602}
@@ -729,7 +729,7 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
604static void game_shop_show_card_desc(void)
605{
606 // Anim start
-
607 if (timer == 1)
+
607 if (s_timer == 1)
608 {
609 // Erase shop text and disable transparency window
610
@@ -744,7 +744,7 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
619 ListItr itr = list_itr_create(get_jokers_list());
620 while ((joker_object = list_itr_next(&itr)))
621 {
-
622 if (joker_object != description_card)
+
622 if (joker_object != s_description_card)
623 joker_object->ty -= int2fx(OWNED_CARDS_HIDE_Y_OFFSET);
624 }
625
@@ -752,21 +752,21 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
627 itr = list_itr_create(&s_shop_items_list);
628 while ((joker_object = list_itr_next(&itr)))
629 {
-
630 if (joker_object != description_card)
+
630 if (joker_object != s_description_card)
631 joker_object->ty = int2fx(SHOP_JOKER_SPRITES_INIT_POS.y + TILE_SIZE);
632 }
633
634 // Set description_card new target position
635
-
636 description_card->tx = int2fx(CARD_DESCRIPTION_SPRITE_POS.x);
-
637 description_card->ty = int2fx(CARD_DESCRIPTION_SPRITE_POS.y);
+
636 s_description_card->tx = int2fx(CARD_DESCRIPTION_SPRITE_POS.x);
+
637 s_description_card->ty = int2fx(CARD_DESCRIPTION_SPRITE_POS.y);
638 }
639
640 // First 12 anim frames
-
641 if (timer <= TM_SHOW_CARD_DESC_WAIT)
+
641 if (s_timer <= TM_SHOW_CARD_DESC_WAIT)
642 {
643 // Hide Deck (last 5 frames only)
-
644 if (TM_SHOW_CARD_DESC_WAIT - timer < 5)
+
644 if (TM_SHOW_CARD_DESC_WAIT - s_timer < 5)
645 main_bg_se_move_rect_1_tile_vert(DECK_ANIM_RECT, SCREEN_DOWN);
646 // Hide shop panel
647 main_bg_se_move_rect_1_tile_vert(POP_MENU_ANIM_RECT, SCREEN_DOWN);
@@ -775,13 +775,13 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
650 }
651
652 // Anim end
-
653 else if (timer == TM_SHOW_CARD_DESC_WAIT + 1)
+
653 else if (s_timer == TM_SHOW_CARD_DESC_WAIT + 1)
654 {
655 // Compute needed space for the description
-
656 const JokerInfo* info = get_joker_registry_entry(description_card->joker->id);
+
656 const JokerInfo* info = get_joker_registry_entry(s_description_card->joker->id);
657 int desc_bottom_offset =
658 CARD_DESC_MAX_TEXT_HEIGHT -
-
659 info->joker_print_desc(description_card->joker, CARD_DESC_TEXT_RECT);
+
659 info->joker_print_desc(s_description_card->joker, CARD_DESC_TEXT_RECT);
660
661 // Print Rarity and change color or the panel
662 // Do it before drawing the panel so the color is already set
@@ -817,222 +817,223 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
692
693 // Actively wait for the B button to be released, but only if the described card has stopped
694 // moving
-
695 else if (description_card->vx == 0 && description_card->vy == 0 && !key_held(DESELECT_CARDS))
-
696 {
-
697 timer = TM_ZERO;
-
698 state_machine_change_state(&shop_sm, GAME_SHOP_HIDE_CARD_DESC);
-
699 }
-
700}
-
701
-
702static void game_shop_hide_card_desc(void)
-
703{
-
704 // just so we don't print the price of an owned Joker too many times
-
705 static bool owned_joker_price_printed = false;
-
706
-
707 // Anim start
-
708 if (timer == 1)
-
709 {
-
710 // Erase shop text and Joker Description frame
-
711 tte_erase_rect_wrapper(PLAYING_SCREEN_RECT);
-
712 main_bg_se_copy_expand_3x3_rect(CARD_DESC_9_PTCH_TO_RECT, SHOP_CLEAR_3X3_SRC_POS);
-
713
-
714 // Enable transparency window
-
715 toggle_windows(false, true);
-
716
-
717 // Redraw Jokers/Consumables frames
-
718 main_bg_se_copy_expand_3x3_rect(OWNED_JOKERS_PANEL_RECT, OWNED_CARDS_PANEL_3X3_SRC_POS);
-
719 main_bg_se_copy_expand_3x3_rect(
-
720 OWNED_CONSUMABLES_PANEL_RECT,
-
721 OWNED_CARDS_PANEL_3X3_SRC_POS
-
722 );
-
723
-
724 // Move Jokers back to their positions
-
725 JokerObject* joker_object = NULL;
-
726
-
727 // Owned Jokers
-
728 ListItr itr = list_itr_create(get_jokers_list());
-
729 while ((joker_object = list_itr_next(&itr)))
-
730 {
-
731 if (joker_object != description_card)
-
732 joker_object->ty = int2fx(HELD_JOKERS_POS.y);
-
733 }
-
734
-
735 // Shop Jokers
-
736 itr = list_itr_create(&s_shop_items_list);
-
737 while ((joker_object = list_itr_next(&itr)))
-
738 {
-
739 if (joker_object != description_card)
-
740 joker_object->ty = int2fx(ITEM_SHOP_Y);
-
741 }
-
742
-
743 description_card->tx = description_card_original_x_pos;
-
744 description_card->ty = description_card_original_y_pos;
-
745 }
-
746
-
747 // First 12 anim frames
-
748 if (timer <= TM_SHOW_CARD_DESC_WAIT)
-
749 {
-
750 // Show Deck (last 5 frames only)
-
751 if (TM_SHOW_CARD_DESC_WAIT - timer < 5)
-
752 main_bg_se_move_rect_1_tile_vert(DECK_ANIM_RECT, SCREEN_UP);
-
753 // Show shop panel
-
754 main_bg_se_move_rect_1_tile_vert(POP_MENU_ANIM_RECT, SCREEN_UP);
-
755 }
-
756
-
757 // Last anim frame (no need to wait for the Joker to have stopped for this):
-
758 else if (timer == TM_SHOW_CARD_DESC_WAIT + 1)
-
759 {
-
760 // Need to account for the description_card being selected if it came from the shop.
-
761 if (description_card_original_list == &s_shop_items_list)
-
762 description_card->ty += int2fx(TILE_SIZE);
-
763
-
764 // Print price under shop Jokers
-
765 Item* item = NULL;
-
766 ListItr itr = list_itr_create(&s_shop_items_list);
-
767 while ((item = list_itr_next(&itr)))
-
768 {
-
769 item_print_buy_price_under(item);
-
770 }
-
771
-
772 if (description_card_original_list == &s_shop_items_list)
-
773 description_card->ty -= int2fx(TILE_SIZE);
-
774
-
775 // Print Reroll prince
-
776 tte_printf(
-
777 "#{P:%d,%d; cx:0x%X000}$%d",
-
778 SHOP_REROLL_RECT.left,
-
779 SHOP_REROLL_RECT.top,
-
780 TTE_WHITE_PB,
-
781 reroll_cost
-
782 );
-
783
-
784 // Print Deck size that was erased
-
785 display_deck_size_max();
-
786 }
-
787
-
788 // Cleanup and change state
-
789 else if (description_card->vx == 0 && description_card->vy == 0)
-
790 {
-
791 owned_joker_price_printed = false;
-
792 description_card = NULL;
-
793 timer = TM_ZERO;
-
794 state_machine_change_state(&shop_sm, GAME_SHOP_ACTIVE);
-
795 }
-
796
-
797 // At any point after the other prices have been printed, and while the card is still moving,
-
798 // if we are NOT pressing A, print the price under it.
-
799 else if (!owned_joker_price_printed && !key_held(SELECT_CARD) &&
-
800 description_card_original_list == get_jokers_list())
-
801 {
-
802 owned_joker_price_printed = true;
-
803 sprite_object_print_price_under(
-
804 (SpriteObject*)description_card,
-
805 joker_get_sell_value(description_card->joker)
-
806 );
-
807 }
-
808}
-
809
-
-
814static void game_shop_outro(void)
-
815{
-
816 // Shift the shop panel
-
817 main_bg_se_move_rect_1_tile_vert(POP_MENU_ANIM_RECT, SCREEN_DOWN);
-
818
-
819 main_bg_se_copy_rect_1_tile_vert(TOP_LEFT_PANEL_ANIM_RECT, SCREEN_UP);
-
820
-
821 if (timer == 1)
-
822 {
-
823 tte_erase_rect_wrapper(SHOP_PRICES_TEXT_RECT); // Erase the shop prices text
-
824
-
825 ListItr itr = list_itr_create(&s_shop_items_list);
-
826 SpriteObject* shop_item;
-
827 while ((shop_item = list_itr_next(&itr)))
-
828 {
-
829 if (shop_item != NULL)
-
830 {
-
831 shop_item->ty = int2fx(160);
-
832 }
-
833 }
-
834
- -
836 }
-
837 else if (timer == 2)
-
838 {
-
839 // TODO: make heads or tails of what's going on here and replace
-
840 // magic numbers.
-
841 int y = 5;
-
842 memset16(&se_mat[MAIN_BG_SBB][y - 1][0], 0x0001, 1);
-
843 memset16(&se_mat[MAIN_BG_SBB][y - 1][1], 0x0002, 7);
-
844 memset16(&se_mat[MAIN_BG_SBB][y - 1][8], SE_HFLIP | 0x0001, 1);
-
845 }
-
846
-
847 if (timer >= MENU_POP_OUT_ANIM_FRAMES)
-
848 {
-
849 game_change_state(GAME_STATE_BLIND_SELECT);
-
850 }
-
851}
+
695 else if (s_description_card->vx == 0 && s_description_card->vy == 0 &&
+
696 !key_held(DESELECT_CARDS))
+
697 {
+
698 s_timer = TM_ZERO;
+
699 state_machine_change_state(&shop_sm, GAME_SHOP_HIDE_CARD_DESC);
+
700 }
+
701}
+
702
+
703static void game_shop_hide_card_desc(void)
+
704{
+
705 // just so we don't print the price of an owned Joker too many times
+
706 static bool owned_joker_price_printed = false;
+
707
+
708 // Anim start
+
709 if (s_timer == 1)
+
710 {
+
711 // Erase shop text and Joker Description frame
+
712 tte_erase_rect_wrapper(PLAYING_SCREEN_RECT);
+
713 main_bg_se_copy_expand_3x3_rect(CARD_DESC_9_PTCH_TO_RECT, SHOP_CLEAR_3X3_SRC_POS);
+
714
+
715 // Enable transparency window
+
716 toggle_windows(false, true);
+
717
+
718 // Redraw Jokers/Consumables frames
+
719 main_bg_se_copy_expand_3x3_rect(OWNED_JOKERS_PANEL_RECT, OWNED_CARDS_PANEL_3X3_SRC_POS);
+ +
721 OWNED_CONSUMABLES_PANEL_RECT,
+
722 OWNED_CARDS_PANEL_3X3_SRC_POS
+
723 );
+
724
+
725 // Move Jokers back to their positions
+
726 JokerObject* joker_object = NULL;
+
727
+
728 // Owned Jokers
+
729 ListItr itr = list_itr_create(get_jokers_list());
+
730 while ((joker_object = list_itr_next(&itr)))
+
731 {
+
732 if (joker_object != s_description_card)
+
733 joker_object->ty = int2fx(HELD_JOKERS_POS.y);
+
734 }
+
735
+
736 // Shop Jokers
+
737 itr = list_itr_create(&s_shop_items_list);
+
738 while ((joker_object = list_itr_next(&itr)))
+
739 {
+
740 if (joker_object != s_description_card)
+
741 joker_object->ty = int2fx(ITEM_SHOP_Y);
+
742 }
+
743
+
744 s_description_card->tx = s_description_card_original_x_pos;
+
745 s_description_card->ty = s_description_card_original_y_pos;
+
746 }
+
747
+
748 // First 12 anim frames
+
749 if (s_timer <= TM_SHOW_CARD_DESC_WAIT)
+
750 {
+
751 // Show Deck (last 5 frames only)
+
752 if (TM_SHOW_CARD_DESC_WAIT - s_timer < 5)
+
753 main_bg_se_move_rect_1_tile_vert(DECK_ANIM_RECT, SCREEN_UP);
+
754 // Show shop panel
+
755 main_bg_se_move_rect_1_tile_vert(POP_MENU_ANIM_RECT, SCREEN_UP);
+
756 }
+
757
+
758 // Last anim frame (no need to wait for the Joker to have stopped for this):
+
759 else if (s_timer == TM_SHOW_CARD_DESC_WAIT + 1)
+
760 {
+
761 // Need to account for the description_card being selected if it came from the shop.
+
762 if (s_description_card_original_list == &s_shop_items_list)
+
763 s_description_card->ty += int2fx(TILE_SIZE);
+
764
+
765 // Print price under shop Jokers
+
766 Item* item = NULL;
+
767 ListItr itr = list_itr_create(&s_shop_items_list);
+
768 while ((item = list_itr_next(&itr)))
+
769 {
+ +
771 }
+
772
+
773 if (s_description_card_original_list == &s_shop_items_list)
+
774 s_description_card->ty -= int2fx(TILE_SIZE);
+
775
+
776 // Print Reroll prince
+
777 tte_printf(
+
778 "#{P:%d,%d; cx:0x%X000}$%d",
+
779 SHOP_REROLL_RECT.left,
+
780 SHOP_REROLL_RECT.top,
+
781 TTE_WHITE_PB,
+
782 s_reroll_cost
+
783 );
+
784
+
785 // Print Deck size that was erased
+
786 display_deck_size_max();
+
787 }
+
788
+
789 // Cleanup and change state
+
790 else if (s_description_card->vx == 0 && s_description_card->vy == 0)
+
791 {
+
792 owned_joker_price_printed = false;
+
793 s_description_card = NULL;
+
794 s_timer = TM_ZERO;
+
795 state_machine_change_state(&shop_sm, GAME_SHOP_ACTIVE);
+
796 }
+
797
+
798 // At any point after the other prices have been printed, and while the card is still moving,
+
799 // if we are NOT pressing A, print the price under it.
+
800 else if (!owned_joker_price_printed && !key_held(SELECT_CARD) &&
+
801 s_description_card_original_list == get_jokers_list())
+
802 {
+
803 owned_joker_price_printed = true;
+ +
805 (SpriteObject*)s_description_card,
+
806 joker_get_sell_value(s_description_card->joker)
+
807 );
+
808 }
+
809}
+
810
+
+
815static void game_shop_outro(void)
+
816{
+
817 // Shift the shop panel
+
818 main_bg_se_move_rect_1_tile_vert(POP_MENU_ANIM_RECT, SCREEN_DOWN);
+
819
+
820 main_bg_se_copy_rect_1_tile_vert(TOP_LEFT_PANEL_ANIM_RECT, SCREEN_UP);
+
821
+
822 if (s_timer == 1)
+
823 {
+
824 tte_erase_rect_wrapper(SHOP_PRICES_TEXT_RECT); // Erase the shop prices text
+
825
+
826 ListItr itr = list_itr_create(&s_shop_items_list);
+
827 SpriteObject* shop_item;
+
828 while ((shop_item = list_itr_next(&itr)))
+
829 {
+
830 if (shop_item != NULL)
+
831 {
+
832 shop_item->ty = int2fx(160);
+
833 }
+
834 }
+
835
+ +
837 }
+
838 else if (s_timer == 2)
+
839 {
+
840 // TODO: make heads or tails of what's going on here and replace
+
841 // magic numbers.
+
842 int y = 5;
+
843 memset16(&se_mat[MAIN_BG_SBB][y - 1][0], 0x0001, 1);
+
844 memset16(&se_mat[MAIN_BG_SBB][y - 1][1], 0x0002, 7);
+
845 memset16(&se_mat[MAIN_BG_SBB][y - 1][8], SE_HFLIP | 0x0001, 1);
+
846 }
+
847
+
848 if (s_timer >= MENU_POP_OUT_ANIM_FRAMES)
+
849 {
+
850 game_change_state(GAME_STATE_BLIND_SELECT);
+
851 }
+
852}
-
852
-
-
856static inline void game_shop_lights_anim_frame(void)
-
857{
-
858 // Shift palette around the border of the shop icon
-
859 COLOR shifted_palette[4];
-
860 shifted_palette[0] = pal_bg_mem[SHOP_LIGHTS_2_PAL_IDX];
-
861 shifted_palette[1] = pal_bg_mem[SHOP_LIGHTS_3_PAL_IDX];
-
862 shifted_palette[2] = pal_bg_mem[SHOP_LIGHTS_4_PAL_IDX];
-
863 shifted_palette[3] = pal_bg_mem[SHOP_LIGHTS_1_PAL_IDX];
-
864
-
865 // Circularly shift the palette
-
866 int last = shifted_palette[3];
-
867
-
868 for (int i = 3; i > 0; --i)
-
869 {
-
870 shifted_palette[i] = shifted_palette[i - 1];
-
871 }
-
872
-
873 shifted_palette[0] = last;
-
874
-
875 // Copy the shifted palette to the next 4 slots
-
876 pal_bg_mem[SHOP_LIGHTS_2_PAL_IDX] = shifted_palette[0];
-
877 pal_bg_mem[SHOP_LIGHTS_3_PAL_IDX] = shifted_palette[1];
-
878 pal_bg_mem[SHOP_LIGHTS_4_PAL_IDX] = shifted_palette[2];
-
879 pal_bg_mem[SHOP_LIGHTS_1_PAL_IDX] = shifted_palette[3];
-
880}
+
853
+
+
857static inline void game_shop_lights_anim_frame(void)
+
858{
+
859 // Shift palette around the border of the shop icon
+
860 COLOR shifted_palette[4];
+
861 shifted_palette[0] = pal_bg_mem[SHOP_LIGHTS_2_PAL_IDX];
+
862 shifted_palette[1] = pal_bg_mem[SHOP_LIGHTS_3_PAL_IDX];
+
863 shifted_palette[2] = pal_bg_mem[SHOP_LIGHTS_4_PAL_IDX];
+
864 shifted_palette[3] = pal_bg_mem[SHOP_LIGHTS_1_PAL_IDX];
+
865
+
866 // Circularly shift the palette
+
867 int last = shifted_palette[3];
+
868
+
869 for (int i = 3; i > 0; --i)
+
870 {
+
871 shifted_palette[i] = shifted_palette[i - 1];
+
872 }
+
873
+
874 shifted_palette[0] = last;
+
875
+
876 // Copy the shifted palette to the next 4 slots
+
877 pal_bg_mem[SHOP_LIGHTS_2_PAL_IDX] = shifted_palette[0];
+
878 pal_bg_mem[SHOP_LIGHTS_3_PAL_IDX] = shifted_palette[1];
+
879 pal_bg_mem[SHOP_LIGHTS_4_PAL_IDX] = shifted_palette[2];
+
880 pal_bg_mem[SHOP_LIGHTS_1_PAL_IDX] = shifted_palette[3];
+
881}
-
881
-
- -
883{
-
884 timer++;
-
885
-
886 if (timer % 20 == 0)
-
887 {
- -
889 }
-
890}
+
882
+
+ +
884{
+
885 s_timer++;
+
886
+
887 if (s_timer % 20 == 0)
+
888 {
+ +
890 }
+
891}
-
891
-
- -
893{
-
894 List* shop_items_list = &s_shop_items_list;
-
895 ListItr itr = list_itr_create(shop_items_list);
-
896 Item* item;
-
897
-
898 while ((item = list_itr_next(&itr)))
-
899 {
-
900 item_dispose(&item);
-
901 }
-
902
-
903 list_clear(shop_items_list);
-
904
-
905 increment_blind(BLIND_STATE_DEFEATED); // TODO: Move to game_round_end()?
-
906
-
907 state_machine_remove(&shop_sm);
-
908
-
909 save_game();
-
910}
+
892
+
+ +
894{
+
895 List* shop_items_list = &s_shop_items_list;
+
896 ListItr itr = list_itr_create(shop_items_list);
+
897 Item* item;
+
898
+
899 while ((item = list_itr_next(&itr)))
+
900 {
+
901 item_dispose(&item);
+
902 }
+
903
+
904 list_clear(shop_items_list);
+
905
+
906 increment_blind(BLIND_STATE_DEFEATED); // TODO: Move to game_round_end()?
+
907
+
908 state_machine_remove(&shop_sm);
+
909
+
910 save_game();
+
911}
Utilities for using maxmod to play sound effects.
A bitset for operating on flags.
@@ -1058,8 +1059,8 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
void item_acquire(Item *item)
Acquires the item, adding to inventory if applicable. Called when it is purchased from the shop,...
Definition item.c:35
int item_get_buy_price(Item *item)
Returns the buy price of the item.
Definition item.c:24
Functions relative to the handling of Jokers.
-
u16 joker_get_rarity_color(u8 rarity, bool main_color)
Get Joker rarity panel color.
Definition joker.c:177
-
void joker_reset_rollable_jokers(void)
Reset rollable jokers to include all jokers in the registry.
Definition joker.c:336
+
u16 joker_get_rarity_color(u8 rarity, bool main_color)
Get Joker rarity panel color.
Definition joker.c:178
+
void joker_reset_rollable_jokers(void)
Reset rollable jokers to include all jokers in the registry.
Definition joker.c:337
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.
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:100
@@ -1084,12 +1085,12 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
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:441
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:355
JokerObject * game_shop_get_description_card(void)
Get a pointer to the Card we are currently showing the description of.
Definition shop.c:180
-
void game_shop_on_exit(void)
Shop cleanup.
Definition shop.c:892
+
void game_shop_on_exit(void)
Shop cleanup.
Definition shop.c:893
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:381
static void game_shop_reroll(void)
Reroll items up for sale in the Shop. Reroll cost will go up by a rate that increases by 1 each rerol...
Definition shop.c:471
static void game_shop_process_user_input(void)
Handle user inputs logic in the Shop though a SelectionGrid.
Definition shop.c:553
static void game_shop_intro(void)
Intro sequence (menu and shop icon coming into frame)
Definition shop.c:283
-
static void game_shop_lights_anim_frame(void)
Cycling shop lights animation substate update.
Definition shop.c:856
+
static void game_shop_lights_anim_frame(void)
Cycling shop lights animation substate update.
Definition shop.c:857
void game_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 shop.c:185
void game_shop_on_init(void)
Shop state initialization.
Definition shop.c:216
static int shop_reroll_row_get_size(void)
Get size of the row with the "Reroll" button.
Definition shop.c:433
@@ -1097,8 +1098,8 @@ $(document).ready(function(){initNavTree('shop_8c_source.html',''); initResizabl
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:330
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:519
static void game_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 ...
Definition shop.c:245
-
static void game_shop_outro(void)
Outro sequence substate update. This makes the menu and shop icon go out of frame.
Definition shop.c:814
-
void game_shop_on_update(void)
Shop state update.
Definition shop.c:882
+
static void game_shop_outro(void)
Outro sequence substate update. This makes the menu and shop icon go out of frame.
Definition shop.c:815
+
void game_shop_on_update(void)
Shop state update.
Definition shop.c:883
void game_shop_change_background(void)
Change to the shop background.
Definition shop.c:192
static Item * game_shop_create_top_row_item(void)
Create a shop top row item - jokers, consumables, and possibly playing cards Currently only jokers ar...
Definition shop.c:235
Shop state functions.
diff --git a/shop_8h.html b/shop_8h.html index 64b2c32c..3223cd7e 100644 --- a/shop_8h.html +++ b/shop_8h.html @@ -232,7 +232,7 @@ Functions

Shop cleanup.

-

Definition at line 892 of file shop.c.

+

Definition at line 893 of file shop.c.

@@ -276,7 +276,7 @@ Functions

Shop state update.

-

Definition at line 882 of file shop.c.

+

Definition at line 883 of file shop.c.

diff --git a/shop_8h_source.html b/shop_8h_source.html index 70becf28..c8958b4f 100644 --- a/shop_8h_source.html +++ b/shop_8h_source.html @@ -161,10 +161,10 @@ $(document).ready(function(){initNavTree('shop_8h_source.html',''); initResizabl
46#endif // GAME_SHOP_H
Functions relative to the handling of Jokers.
JokerObject * game_shop_get_description_card(void)
Get a pointer to the Card we are currently showing the description of.
Definition shop.c:180
-
void game_shop_on_exit(void)
Shop cleanup.
Definition shop.c:892
+
void game_shop_on_exit(void)
Shop cleanup.
Definition shop.c:893
void game_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 shop.c:185
void game_shop_on_init(void)
Shop state initialization.
Definition shop.c:216
-
void game_shop_on_update(void)
Shop state update.
Definition shop.c:882
+
void game_shop_on_update(void)
Shop state update.
Definition shop.c:883
void game_shop_change_background(void)
Change to the shop background.
Definition shop.c:192
Definition joker.h:114
diff --git a/splash__screen_8c_source.html b/splash__screen_8c_source.html index d6e7039e..42bdf11a 100644 --- a/splash__screen_8c_source.html +++ b/splash__screen_8c_source.html @@ -149,12 +149,12 @@ $(document).ready(function(){initNavTree('splash__screen_8c_source.html',''); in
9#include <tonc.h>
10
11static const Rect COUNTDOWN_TIMER_RECT = {208, 144, 240, 152};
-
12static uint timer = 0;
+
12static uint s_timer = 0;
13
14void splash_screen_on_init(void)
15{
-
16 timer = 0;
+
16 s_timer = 0;
17
18 tte_printf("#{P:72,8; cx:0x%X000}DISCLAIMER", TTE_WHITE_PB);
19 tte_printf(
@@ -172,9 +172,9 @@ $(document).ready(function(){initNavTree('splash__screen_8c_source.html',''); in
31{
-
32 timer++;
+
32 s_timer++;
33
-
34 if (timer < SPLASH_DURATION_FRAMES)
+
34 if (s_timer < SPLASH_DURATION_FRAMES)
35 {
36 tte_erase_rect_wrapper(COUNTDOWN_TIMER_RECT);
37 tte_printf(
@@ -182,7 +182,7 @@ $(document).ready(function(){initNavTree('splash__screen_8c_source.html',''); in
39 COUNTDOWN_TIMER_RECT.left,
40 COUNTDOWN_TIMER_RECT.top,
41 TTE_WHITE_PB,
-
42 1 + (SPLASH_DURATION_FRAMES - timer) / SPLASH_FPS
+
42 1 + (SPLASH_DURATION_FRAMES - s_timer) / SPLASH_FPS
43 );
44
45 if (!key_hit(KEY_ANY))
diff --git a/state__machine_8c_source.html b/state__machine_8c_source.html index e75a8836..5d57d84d 100644 --- a/state__machine_8c_source.html +++ b/state__machine_8c_source.html @@ -144,7 +144,7 @@ $(document).ready(function(){initNavTree('state__machine_8c_source.html',''); in
4#include "list.h"
5#include "util.h"
6
-
7static List update_cbs = LIST_DEFAULT;
+
7static List s_update_cbs = LIST_DEFAULT;
8
9// Used as a No Operation for game states that have no init and/or exit function.
10// ricfehr3 did the work of determining whether a noop or a NULL check was more
@@ -164,7 +164,7 @@ $(document).ready(function(){initNavTree('state__machine_8c_source.html',''); in
23 state_machine->active_update = noop;
24 state_machine->state = UNDEFINED;
25
-
26 list_push_back(&update_cbs, &state_machine->active_update);
+
26 list_push_back(&s_update_cbs, &state_machine->active_update);
27}
28
@@ -175,14 +175,14 @@ $(document).ready(function(){initNavTree('state__machine_8c_source.html',''); in
32 return;
33
34 state_machine->registered = false;
-
35 list_remove_data(&update_cbs, &state_machine->active_update);
+
35 list_remove_data(&s_update_cbs, &state_machine->active_update);
36}
37
38void state_machine_update(void)
39{
-
40 ListItr itr = list_itr_create(&update_cbs);
+
40 ListItr itr = list_itr_create(&s_update_cbs);
41 StateCallback* cb;
42 while ((cb = list_itr_next(&itr)))
43 {