Updated all static variables to have the s_ prefix and constants to upper case (#591)

* Updated all static variables to have the s_ prefix and constants to upper case

* Renamed missed sneaky functions in round.c (+ clang-format...)

* Renamed a few more missed constants

* Updated rng_update() documentation

* Apply suggestions from Copilot's code review

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Added missed suggestion

* Updated rng_update() comment

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
MeirGavish
2026-07-16 20:21:18 +03:00
committed by GitHub
co-authored by Copilot Autofix powered by AI
parent 6e7d8a8399
commit 7a5a4a1276
21 changed files with 615 additions and 608 deletions
+15 -15
View File
@@ -25,7 +25,7 @@ static const u32 BLIND_SELECT_BTN_SELECTED_BORDER_PID = 18;
static const u32 TM_DISP_BLIND_PANEL_FINISH = 7;
static const u32 TM_DISP_BLIND_PANEL_START = 1;
static int timer;
static int s_timer;
static void game_blind_select_start_anim_seq(void);
static void game_blind_select_handle_input(void);
@@ -97,11 +97,11 @@ static void game_blind_select_start_anim_seq()
);
}
if (timer == TM_END_ANIM_SEQ)
if (s_timer == TM_END_ANIM_SEQ)
{
game_blind_select_print_blinds_reqs_and_rewards();
state_machine_change_state(&blind_select_sm, BLIND_SELECT);
timer = TM_ZERO; // Reset the timer
s_timer = TM_ZERO; // Reset the timer
}
}
@@ -172,7 +172,7 @@ static inline void highlight_skip_button(void)
static void game_blind_select_handle_input()
{
if (timer == TM_BLIND_SELECT_START && g_game_vars.current_blind == BLIND_TYPE_BOSS)
if (s_timer == TM_BLIND_SELECT_START && g_game_vars.current_blind == BLIND_TYPE_BOSS)
{
selection_y = BLIND_ROW;
}
@@ -197,7 +197,7 @@ static void game_blind_select_handle_input()
case BLIND_ROW:
play_sfx(SFX_BUTTON, MM_BASE_PITCH_RATE, BUTTON_SFX_VOLUME);
state_machine_change_state(&blind_select_sm, BLIND_SELECTED_ANIM_SEQ);
timer = TM_ZERO;
s_timer = TM_ZERO;
++g_game_vars.round;
display_round();
break;
@@ -230,7 +230,7 @@ static void game_blind_select_handle_input()
game_blind_select_print_blinds_reqs_and_rewards();
highlight_select_button();
timer = TM_ZERO;
s_timer = TM_ZERO;
}
break;
default:
@@ -241,7 +241,7 @@ static void game_blind_select_handle_input()
static void game_blind_select_selected_anim_seq()
{
if (timer < 15)
if (s_timer < 15)
{
Rect blinds_rect = POP_MENU_ANIM_RECT;
blinds_rect.top -= 1; // Because of the raised blind
@@ -256,28 +256,28 @@ static void game_blind_select_selected_anim_seq()
);
}
}
else if (timer >= MENU_POP_OUT_ANIM_FRAMES)
else if (s_timer >= MENU_POP_OUT_ANIM_FRAMES)
{
for (int i = 0; i < NUM_BLINDS_PER_ANTE; i++)
{
obj_hide(blind_select_tokens[i]->obj);
}
timer = TM_ZERO;
s_timer = TM_ZERO;
state_machine_change_state(&blind_select_sm, DISPLAY_BLIND_PANEL);
}
}
static void game_blind_select_display_blind_panel()
{
if (timer >= TM_DISP_BLIND_PANEL_FINISH)
if (s_timer >= TM_DISP_BLIND_PANEL_FINISH)
{
state_machine_change_state(&blind_select_sm, BLIND_SELECT_EXIT);
return;
}
// Switches to the selecting background and clears the blind panel area
if (timer == TM_DISP_BLIND_PANEL_START)
if (s_timer == TM_DISP_BLIND_PANEL_START)
{
change_background(BG_CARD_SELECTING, false);
@@ -295,9 +295,9 @@ static void game_blind_select_display_blind_panel()
}
// Shift the blind panel down onto screen
for (int y = 0; y < timer; y++)
for (int y = 0; y < s_timer; y++)
{
int y_from = 26 + y - timer;
int y_from = 26 + y - s_timer;
int y_to = 0 + y;
Rect from = {0, y_from, 8, y_from};
@@ -451,7 +451,7 @@ static void blind_tokens_init()
void game_blind_select_on_init(void)
{
timer = TM_ZERO;
s_timer = TM_ZERO;
state_machine_register(&blind_select_sm);
state_machine_change_state(&blind_select_sm, START_ANIM_SEQ);
@@ -472,7 +472,7 @@ void game_blind_select_on_init(void)
void game_blind_select_on_update(void)
{
timer++;
s_timer++;
}
void game_blind_select_on_exit(void)
+5 -5
View File
@@ -12,7 +12,7 @@
typedef void (*BackgroundRenderCallback)(void);
static enum BackgroundId background = BG_NONE;
static enum BackgroundId s_background = BG_NONE;
// Map to fill in for refactor
static const BackgroundRenderCallback bgCallbacks[] = {
@@ -29,20 +29,20 @@ static const BackgroundRenderCallback bgCallbacks[] = {
enum BackgroundId get_current_background(void)
{
return background;
return s_background;
}
void change_background(enum BackgroundId id, bool force_redraw)
{
if (force_redraw)
{
background = BG_NONE;
s_background = BG_NONE;
}
if (id != background && bgCallbacks[id] != NULL)
if (id != s_background && bgCallbacks[id] != NULL)
{
bgCallbacks[id]();
}
background = id;
s_background = id;
}
void reset_top_left_panel_bottom_row(void)
+18 -18
View File
@@ -126,17 +126,17 @@ static Button game_over_buttons[GAME_OVER_ROW_MAX][2] = {
// Internal Variables
static enum EndCondition condition = END_CONDITION_NONE;
static u32 timer = TM_ZERO;
static bool reuse_seed = false;
static bool continue_run = false;
static enum EndCondition s_end_condition = END_CONDITION_NONE;
static u32 s_timer = TM_ZERO;
static bool s_reuse_seed = false;
static bool s_continue_run = false;
static void game_over_common_init(enum EndCondition init_condition)
{
condition = init_condition;
timer = TM_ZERO;
reuse_seed = false;
continue_run = false;
s_end_condition = init_condition;
s_timer = TM_ZERO;
s_reuse_seed = false;
s_continue_run = false;
// Hide all Joker sprites
JokerObject* joker_object = NULL;
@@ -208,14 +208,14 @@ void game_lose_on_init(void)
void game_over_on_update(void)
{
timer++;
s_timer++;
// Need to clear text here or the number of cards remaining in deck stays for some reason
if (timer == 1)
if (s_timer == 1)
tte_erase_screen();
// Move whole panel and Blind Token sprite up by a tile each frame
if (timer < GAME_OVER_ANIM_FRAMES)
if (s_timer < GAME_OVER_ANIM_FRAMES)
{
main_bg_se_move_rect_1_tile_vert(GAME_OVER_ANIM_RECT, SCREEN_UP);
@@ -227,7 +227,7 @@ void game_over_on_update(void)
}
// Print values and buttons text
else if (timer == GAME_OVER_ANIM_FRAMES)
else if (s_timer == GAME_OVER_ANIM_FRAMES)
{
char best_hand_str[UINT_MAX_DIGITS + 1];
truncate_uint_to_suffixed_str(
@@ -291,7 +291,7 @@ void game_over_on_update(void)
);
}
if (timer >= GAME_OVER_ANIM_FRAMES)
if (s_timer >= GAME_OVER_ANIM_FRAMES)
selection_grid_process_input(&game_over_selection_grid);
}
@@ -300,14 +300,14 @@ void game_over_on_exit(void)
toggle_windows(false, false);
play_regular_music();
condition = END_CONDITION_NONE;
s_end_condition = END_CONDITION_NONE;
u32 previous_seed = g_game_vars.rng_info.seed;
if (!continue_run)
if (!s_continue_run)
game_reset();
if (reuse_seed)
if (s_reuse_seed)
rng_set_seed(previous_seed);
else
g_game_vars.rng_info.seed = UNDEFINED;
@@ -346,9 +346,9 @@ static bool game_over_on_selection_changed(
static void reuse_seed_on_pressed(void)
{
reuse_seed = !reuse_seed;
s_reuse_seed = !s_reuse_seed;
main_bg_se_copy_rect(
reuse_seed ? REUSE_SEED_BTN_ON_SRC_RECT : REUSE_SEED_BTN_OFF_SRC_RECT,
s_reuse_seed ? REUSE_SEED_BTN_ON_SRC_RECT : REUSE_SEED_BTN_OFF_SRC_RECT,
REUSE_SEED_BTN_DEST_POS
);
}
+12 -12
View File
@@ -78,10 +78,10 @@ static SelectionGrid main_menu_selection_grid = {
// clang-format on
// Main menu sprite - the ace of spades
static CardObject* main_menu_ace = NULL;
static CardObject* s_main_menu_ace = NULL;
// Keep track of last highlighted button
static enum MainButtons last_highlighted_button = PLAY_BTN_IDX;
static enum MainButtons s_last_highlighted_button = PLAY_BTN_IDX;
void game_main_menu_change_background(void)
{
@@ -103,16 +103,16 @@ void game_main_menu_on_init(void)
{
affine_background_change_background(AFFINE_BG_MAIN_MENU);
change_background(BG_MAIN_MENU, true);
main_menu_ace = card_object_new(card_new(SPADES, ACE));
card_object_set_sprite(main_menu_ace, 0);
s_main_menu_ace = card_object_new(card_new(SPADES, ACE));
card_object_set_sprite(s_main_menu_ace, 0);
// TODO: NULL-check sprite
main_menu_ace->sprite->obj->attr0 |= ATTR0_AFF_DBL;
main_menu_ace->tscale = float2fx(0.8f);
sprite_object_position((SpriteObject*)main_menu_ace, MAIN_MENU_ACE_T_X, MAIN_MENU_ACE_T_Y);
s_main_menu_ace->sprite->obj->attr0 |= ATTR0_AFF_DBL;
s_main_menu_ace->tscale = float2fx(0.8f);
sprite_object_position((SpriteObject*)s_main_menu_ace, MAIN_MENU_ACE_T_X, MAIN_MENU_ACE_T_Y);
// Select last highlighted button, Play button by default.
// e.g. if we return from the options menu, we want the Options button to be highlighted.
Selection sel_init = {last_highlighted_button, 0};
Selection sel_init = {s_last_highlighted_button, 0};
main_menu_selection_grid.selection = sel_init;
// Highlight current button
@@ -121,7 +121,7 @@ void game_main_menu_on_init(void)
void game_main_menu_on_update(void)
{
main_menu_ace->trotation = lu_sin((g_game_vars.timer << 8) / 2) / 3;
s_main_menu_ace->trotation = lu_sin((g_game_vars.timer << 8) / 2) / 3;
selection_grid_process_input(&main_menu_selection_grid);
}
@@ -129,12 +129,12 @@ void game_main_menu_on_update(void)
void game_main_menu_on_exit(void)
{
// Save selected button
last_highlighted_button = main_menu_selection_grid.selection.x;
s_last_highlighted_button = main_menu_selection_grid.selection.x;
// Normally I would just cache these and hide/unhide but I didn't feel like dealing with
// defining a layer for it
card_destroy(&main_menu_ace->card);
card_object_destroy(&main_menu_ace);
card_destroy(&s_main_menu_ace->card);
card_object_destroy(&s_main_menu_ace);
}
// Implement SelectionGrid handler functions
+221 -216
View File
File diff suppressed because it is too large Load Diff
+17 -17
View File
@@ -528,7 +528,7 @@ static Button choose_seed_bottom_buttons[2] = {
}
};
static const char keyboard_buttons_to_char[KEYBOARD_HEIGHT * KEYBOARD_WIDTH] = {
static const char KEYBOARD_BUTTONS_TO_CHAR[KEYBOARD_HEIGHT * KEYBOARD_WIDTH] = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
@@ -537,8 +537,8 @@ static const char keyboard_buttons_to_char[KEYBOARD_HEIGHT * KEYBOARD_WIDTH] = {
// clang-format on
// Size BASE36_MAX_DIGITS + 1 to always have '\0' at the end
static char seed_str[BASE36_MAX_DIGITS + 1] = {'\0'};
static u8 seed_cursor_pos = 0;
static char s_seed_str[BASE36_MAX_DIGITS + 1] = {'\0'};
static u8 s_seed_cursor_pos = 0;
#pragma endregion
@@ -582,14 +582,14 @@ void game_run_setup_on_init(void)
if (g_game_vars.rng_info.seed == UNDEFINED)
{
// Make the string empty instead of showing all zeroes
memset(seed_str, '\0', BASE36_MAX_DIGITS + 1);
seed_cursor_pos = 0;
memset(s_seed_str, '\0', BASE36_MAX_DIGITS + 1);
s_seed_cursor_pos = 0;
}
// Or use previous Run's seed if it hasn't been reset
else
{
u32_to_base36(g_game_vars.rng_info.seed, seed_str);
seed_cursor_pos = BASE36_MAX_DIGITS;
u32_to_base36(g_game_vars.rng_info.seed, s_seed_str);
s_seed_cursor_pos = BASE36_MAX_DIGITS;
use_seed = true;
}
toggle_seed_enabled(use_seed);
@@ -808,7 +808,7 @@ static inline void update_seed_text(void)
RUN_SETUP_SEED_FIELD_TEXT_POS.y,
TTE_BLACK_PB,
BASE36_MAX_DIGITS + 1,
seed_str
s_seed_str
);
}
@@ -920,9 +920,9 @@ static inline void reroll_seed_str(void)
rng_shuffle_seed();
u32 new_seed = rng_get_u32();
rng_set_seed(new_seed);
u32_to_base36(new_seed, seed_str);
u32_to_base36(new_seed, s_seed_str);
update_seed_text();
seed_cursor_pos = BASE36_MAX_DIGITS;
s_seed_cursor_pos = BASE36_MAX_DIGITS;
}
/**
@@ -930,10 +930,10 @@ static inline void reroll_seed_str(void)
*/
static inline void delete_seed_char(void)
{
if (seed_cursor_pos == 0)
if (s_seed_cursor_pos == 0)
return;
seed_str[--seed_cursor_pos] = '\0';
s_seed_str[--s_seed_cursor_pos] = '\0';
update_seed_text();
}
@@ -944,10 +944,10 @@ static inline void delete_seed_char(void)
*/
static inline void type_seed_char(enum RunSetupKeyboardButtons key)
{
if (seed_cursor_pos >= BASE36_MAX_DIGITS)
if (s_seed_cursor_pos >= BASE36_MAX_DIGITS)
return;
seed_str[seed_cursor_pos++] = keyboard_buttons_to_char[key];
s_seed_str[s_seed_cursor_pos++] = KEYBOARD_BUTTONS_TO_CHAR[key];
update_seed_text();
}
@@ -976,8 +976,8 @@ static void keyboard_button_on_pressed(void)
// The cursor position is unsigned so always positive, but we still need to
// ensure it doersn't go out of bounds by more than 1 so that we can always
// substract 1 from it when erasing a character from the seed string.
if (seed_cursor_pos > BASE36_MAX_DIGITS)
seed_cursor_pos = BASE36_MAX_DIGITS;
if (s_seed_cursor_pos > BASE36_MAX_DIGITS)
s_seed_cursor_pos = BASE36_MAX_DIGITS;
if (key_hit(DESELECT_CARDS))
delete_seed_char();
@@ -1193,7 +1193,7 @@ static void play_on_pressed(void)
{
// Apply provided Seed if enabled
if (use_seed)
rng_set_seed(base36_to_u32(seed_str));
rng_set_seed(base36_to_u32(s_seed_str));
else
rng_shuffle_seed();
+64 -63
View File
@@ -165,21 +165,21 @@ static Button reroll_button = {
// Shop internal variables
static int timer;
static int s_timer;
static int reroll_cost = REROLL_BASE_COST;
static int s_reroll_cost = REROLL_BASE_COST;
// Variables relative to the Card we are showing the description of
// TODO: Change this to item once it has description printing API.
static JokerObject* description_card = NULL;
static FIXED description_card_original_x_pos = UNDEFINED;
static FIXED description_card_original_y_pos = UNDEFINED;
static List* description_card_original_list = NULL;
static JokerObject* s_description_card = NULL;
static FIXED s_description_card_original_x_pos = UNDEFINED;
static FIXED s_description_card_original_y_pos = UNDEFINED;
static List* s_description_card_original_list = NULL;
JokerObject* game_shop_get_description_card(void)
{
return description_card;
return s_description_card;
}
void game_shop_reset(void)
@@ -217,7 +217,7 @@ void game_shop_on_init(void)
{
game_shop_change_background();
timer = TM_ZERO;
s_timer = TM_ZERO;
state_machine_register(&shop_sm);
state_machine_change_state(&shop_sm, GAME_SHOP_INTRO);
@@ -284,14 +284,14 @@ static void game_shop_intro()
{
main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT, SCREEN_UP);
if (timer == TM_CREATE_SHOP_ITEMS_WAIT)
if (s_timer == TM_CREATE_SHOP_ITEMS_WAIT)
{
game_shop_create_top_row_items();
}
if (timer >= TM_SHIFT_SHOP_ICON_WAIT) // Shift the shop icon
if (s_timer >= TM_SHIFT_SHOP_ICON_WAIT) // Shift the shop icon
{
int timer_offset = timer - 6;
int timer_offset = s_timer - 6;
// TODO: Extract to generic function?
for (int y = 0; y < timer_offset; y++)
@@ -307,10 +307,10 @@ static void game_shop_intro()
}
}
if (timer == TM_END_GAME_SHOP_INTRO)
if (s_timer == TM_END_GAME_SHOP_INTRO)
{
state_machine_change_state(&shop_sm, GAME_SHOP_ACTIVE);
timer = TM_ZERO; // Reset the timer
s_timer = TM_ZERO; // Reset the timer
// print initial reroll cost only when the panel is in place
tte_printf(
@@ -318,7 +318,7 @@ static void game_shop_intro()
SHOP_REROLL_RECT.left,
SHOP_REROLL_RECT.top,
TTE_WHITE_PB,
reroll_cost
s_reroll_cost
);
}
}
@@ -470,7 +470,7 @@ static bool shop_reroll_row_on_selection_changed(
*/
static inline void game_shop_reroll(void)
{
g_game_vars.money -= reroll_cost;
g_game_vars.money -= s_reroll_cost;
display_money(); // Update the money display
List* shop_items_list = &s_shop_items_list;
@@ -503,13 +503,13 @@ static inline void game_shop_reroll(void)
}
}
reroll_cost++;
s_reroll_cost++;
tte_printf(
"#{P:%d,%d; cx:0x%X000}$%d",
SHOP_REROLL_RECT.left,
SHOP_REROLL_RECT.top,
TTE_WHITE_PB,
reroll_cost
s_reroll_cost
);
}
@@ -530,8 +530,8 @@ static void next_round_on_pressed(void)
{
// Go to next blind selection game state
state_machine_change_state(&shop_sm, GAME_SHOP_EXIT);
timer = TM_ZERO;
reroll_cost = REROLL_BASE_COST;
s_timer = TM_ZERO;
s_reroll_cost = REROLL_BASE_COST;
pal_bg_mem[NEXT_ROUND_BTN_SELECTED_BORDER_PAL_IDX] = pal_bg_mem[SHOP_PANEL_SHADOW_PAL_IDX];
}
@@ -544,7 +544,7 @@ static void reroll_on_pressed(void)
static bool reroll_can_be_pressed(void)
{
return g_game_vars.money >= reroll_cost;
return g_game_vars.money >= s_reroll_cost;
}
/**
@@ -562,7 +562,7 @@ static void game_shop_process_user_input(void)
// Owned Joker
case 0:
{
description_card_original_list = get_jokers_list();
s_description_card_original_list = get_jokers_list();
tmp_card = list_get_at_idx(get_jokers_list(), shop_selection_grid.selection.x);
break;
}
@@ -570,7 +570,7 @@ static void game_shop_process_user_input(void)
// Jokers for sale
case 1:
{
description_card_original_list = &s_shop_items_list;
s_description_card_original_list = &s_shop_items_list;
tmp_card = (shop_selection_grid.selection.x > 0)
? list_get_at_idx(&s_shop_items_list, shop_selection_grid.selection.x - 1)
: NULL;
@@ -581,7 +581,7 @@ static void game_shop_process_user_input(void)
default:
{
description_card_original_list = NULL;
s_description_card_original_list = NULL;
tmp_card = NULL;
break;
}
@@ -592,11 +592,11 @@ static void game_shop_process_user_input(void)
// errors when pressing and releasing B in quick succession.
if (tmp_card != NULL && tmp_card->vx == 0 && tmp_card->vy == 0 && key_held(DESELECT_CARDS))
{
description_card = tmp_card;
description_card_original_x_pos = description_card->x;
description_card_original_y_pos = description_card->y;
s_description_card = tmp_card;
s_description_card_original_x_pos = s_description_card->x;
s_description_card_original_y_pos = s_description_card->y;
timer = TM_ZERO;
s_timer = TM_ZERO;
state_machine_change_state(&shop_sm, GAME_SHOP_SHOW_CARD_DESC);
}
}
@@ -604,7 +604,7 @@ static void game_shop_process_user_input(void)
static void game_shop_show_card_desc(void)
{
// Anim start
if (timer == 1)
if (s_timer == 1)
{
// Erase shop text and disable transparency window
@@ -619,7 +619,7 @@ static void game_shop_show_card_desc(void)
ListItr itr = list_itr_create(get_jokers_list());
while ((joker_object = list_itr_next(&itr)))
{
if (joker_object != description_card)
if (joker_object != s_description_card)
joker_object->ty -= int2fx(OWNED_CARDS_HIDE_Y_OFFSET);
}
@@ -627,21 +627,21 @@ static void game_shop_show_card_desc(void)
itr = list_itr_create(&s_shop_items_list);
while ((joker_object = list_itr_next(&itr)))
{
if (joker_object != description_card)
if (joker_object != s_description_card)
joker_object->ty = int2fx(SHOP_JOKER_SPRITES_INIT_POS.y + TILE_SIZE);
}
// Set description_card new target position
description_card->tx = int2fx(CARD_DESCRIPTION_SPRITE_POS.x);
description_card->ty = int2fx(CARD_DESCRIPTION_SPRITE_POS.y);
s_description_card->tx = int2fx(CARD_DESCRIPTION_SPRITE_POS.x);
s_description_card->ty = int2fx(CARD_DESCRIPTION_SPRITE_POS.y);
}
// First 12 anim frames
if (timer <= TM_SHOW_CARD_DESC_WAIT)
if (s_timer <= TM_SHOW_CARD_DESC_WAIT)
{
// Hide Deck (last 5 frames only)
if (TM_SHOW_CARD_DESC_WAIT - timer < 5)
if (TM_SHOW_CARD_DESC_WAIT - s_timer < 5)
main_bg_se_move_rect_1_tile_vert(DECK_ANIM_RECT, SCREEN_DOWN);
// Hide shop panel
main_bg_se_move_rect_1_tile_vert(POP_MENU_ANIM_RECT, SCREEN_DOWN);
@@ -650,13 +650,13 @@ static void game_shop_show_card_desc(void)
}
// Anim end
else if (timer == TM_SHOW_CARD_DESC_WAIT + 1)
else if (s_timer == TM_SHOW_CARD_DESC_WAIT + 1)
{
// Compute needed space for the description
const JokerInfo* info = get_joker_registry_entry(description_card->joker->id);
const JokerInfo* info = get_joker_registry_entry(s_description_card->joker->id);
int desc_bottom_offset =
CARD_DESC_MAX_TEXT_HEIGHT -
info->joker_print_desc(description_card->joker, CARD_DESC_TEXT_RECT);
info->joker_print_desc(s_description_card->joker, CARD_DESC_TEXT_RECT);
// Print Rarity and change color or the panel
// Do it before drawing the panel so the color is already set
@@ -692,9 +692,10 @@ static void game_shop_show_card_desc(void)
// Actively wait for the B button to be released, but only if the described card has stopped
// moving
else if (description_card->vx == 0 && description_card->vy == 0 && !key_held(DESELECT_CARDS))
else if (s_description_card->vx == 0 && s_description_card->vy == 0 &&
!key_held(DESELECT_CARDS))
{
timer = TM_ZERO;
s_timer = TM_ZERO;
state_machine_change_state(&shop_sm, GAME_SHOP_HIDE_CARD_DESC);
}
}
@@ -705,7 +706,7 @@ static void game_shop_hide_card_desc(void)
static bool owned_joker_price_printed = false;
// Anim start
if (timer == 1)
if (s_timer == 1)
{
// Erase shop text and Joker Description frame
tte_erase_rect_wrapper(PLAYING_SCREEN_RECT);
@@ -728,7 +729,7 @@ static void game_shop_hide_card_desc(void)
ListItr itr = list_itr_create(get_jokers_list());
while ((joker_object = list_itr_next(&itr)))
{
if (joker_object != description_card)
if (joker_object != s_description_card)
joker_object->ty = int2fx(HELD_JOKERS_POS.y);
}
@@ -736,30 +737,30 @@ static void game_shop_hide_card_desc(void)
itr = list_itr_create(&s_shop_items_list);
while ((joker_object = list_itr_next(&itr)))
{
if (joker_object != description_card)
if (joker_object != s_description_card)
joker_object->ty = int2fx(ITEM_SHOP_Y);
}
description_card->tx = description_card_original_x_pos;
description_card->ty = description_card_original_y_pos;
s_description_card->tx = s_description_card_original_x_pos;
s_description_card->ty = s_description_card_original_y_pos;
}
// First 12 anim frames
if (timer <= TM_SHOW_CARD_DESC_WAIT)
if (s_timer <= TM_SHOW_CARD_DESC_WAIT)
{
// Show Deck (last 5 frames only)
if (TM_SHOW_CARD_DESC_WAIT - timer < 5)
if (TM_SHOW_CARD_DESC_WAIT - s_timer < 5)
main_bg_se_move_rect_1_tile_vert(DECK_ANIM_RECT, SCREEN_UP);
// Show shop panel
main_bg_se_move_rect_1_tile_vert(POP_MENU_ANIM_RECT, SCREEN_UP);
}
// Last anim frame (no need to wait for the Joker to have stopped for this):
else if (timer == TM_SHOW_CARD_DESC_WAIT + 1)
else if (s_timer == TM_SHOW_CARD_DESC_WAIT + 1)
{
// Need to account for the description_card being selected if it came from the shop.
if (description_card_original_list == &s_shop_items_list)
description_card->ty += int2fx(TILE_SIZE);
if (s_description_card_original_list == &s_shop_items_list)
s_description_card->ty += int2fx(TILE_SIZE);
// Print price under shop Jokers
Item* item = NULL;
@@ -769,8 +770,8 @@ static void game_shop_hide_card_desc(void)
item_print_buy_price_under(item);
}
if (description_card_original_list == &s_shop_items_list)
description_card->ty -= int2fx(TILE_SIZE);
if (s_description_card_original_list == &s_shop_items_list)
s_description_card->ty -= int2fx(TILE_SIZE);
// Print Reroll prince
tte_printf(
@@ -778,7 +779,7 @@ static void game_shop_hide_card_desc(void)
SHOP_REROLL_RECT.left,
SHOP_REROLL_RECT.top,
TTE_WHITE_PB,
reroll_cost
s_reroll_cost
);
// Print Deck size that was erased
@@ -786,23 +787,23 @@ static void game_shop_hide_card_desc(void)
}
// Cleanup and change state
else if (description_card->vx == 0 && description_card->vy == 0)
else if (s_description_card->vx == 0 && s_description_card->vy == 0)
{
owned_joker_price_printed = false;
description_card = NULL;
timer = TM_ZERO;
s_description_card = NULL;
s_timer = TM_ZERO;
state_machine_change_state(&shop_sm, GAME_SHOP_ACTIVE);
}
// At any point after the other prices have been printed, and while the card is still moving,
// if we are NOT pressing A, print the price under it.
else if (!owned_joker_price_printed && !key_held(SELECT_CARD) &&
description_card_original_list == get_jokers_list())
s_description_card_original_list == get_jokers_list())
{
owned_joker_price_printed = true;
sprite_object_print_price_under(
(SpriteObject*)description_card,
joker_get_sell_value(description_card->joker)
(SpriteObject*)s_description_card,
joker_get_sell_value(s_description_card->joker)
);
}
}
@@ -818,7 +819,7 @@ static void game_shop_outro(void)
main_bg_se_copy_rect_1_tile_vert(TOP_LEFT_PANEL_ANIM_RECT, SCREEN_UP);
if (timer == 1)
if (s_timer == 1)
{
tte_erase_rect_wrapper(SHOP_PRICES_TEXT_RECT); // Erase the shop prices text
@@ -834,7 +835,7 @@ static void game_shop_outro(void)
reset_top_left_panel_bottom_row();
}
else if (timer == 2)
else if (s_timer == 2)
{
// TODO: make heads or tails of what's going on here and replace
// magic numbers.
@@ -844,7 +845,7 @@ static void game_shop_outro(void)
memset16(&se_mat[MAIN_BG_SBB][y - 1][8], SE_HFLIP | 0x0001, 1);
}
if (timer >= MENU_POP_OUT_ANIM_FRAMES)
if (s_timer >= MENU_POP_OUT_ANIM_FRAMES)
{
game_change_state(GAME_STATE_BLIND_SELECT);
}
@@ -881,9 +882,9 @@ static inline void game_shop_lights_anim_frame(void)
void game_shop_on_update(void)
{
timer++;
s_timer++;
if (timer % 20 == 0)
if (s_timer % 20 == 0)
{
game_shop_lights_anim_frame();
}