diff --git a/README.md b/README.md index 2116414..3d95e33 100644 --- a/README.md +++ b/README.md @@ -38,16 +38,20 @@ https://github.com/user-attachments/assets/54a9e2e9-1a02-48d5-bb9d-5ab257a7e03b ### Controls: +(D-Pad: Navigation) + (A: Pick Card/Make Selections) +#### When on the hand row during round +(L: Play Hand) + +(R: Discard Hand) + (B: Deselect All Cards) +#### When on the joker row in the shop or during round (L: Sell Joker) -(R: Toggle Sort Suit/Rank) - -(D-Pad: Navigation) - (Hold A: Swap Owned Jokers or Playing Cards in the Shop or Round) # Contributing diff --git a/include/game.h b/include/game.h index 859152a..f9ff549 100644 --- a/include/game.h +++ b/include/game.h @@ -22,6 +22,12 @@ #define PAUSE_GAME KEY_START // Not implemented #define SELL_KEY KEY_L +// Matching the position of the on-screen buttons +#define PLAY_HAND_KEY KEY_L +// Same value as SELL_KEY - activated on the joker row, while this is activated on the hand row + +#define DISCARD_HAND_KEY KEY_R + struct List; typedef struct List List; diff --git a/source/game.c b/source/game.c index 4a81072..2f22073 100644 --- a/source/game.c +++ b/source/game.c @@ -256,7 +256,9 @@ static int calculate_interest_reward(void); static void game_over_anim_frame(void); static void game_playing_discard_on_pressed(void); +static void game_playing_execute_discard(void); static void game_playing_play_hand_on_pressed(void); +static void game_playing_execute_play_hand(void); static void game_playing_sort_by_rank_on_pressed(void); static void game_playing_sort_by_suit_on_pressed(void); @@ -2022,21 +2024,22 @@ static void game_playing_discard_on_pressed(void) if (!can_discard_hand()) return; - hand_state = HAND_DISCARD; - display_hands(--discards); - set_hand(); - tte_printf( - "#{P:%d,%d; cx:0x%X000}%d", - DISCARDS_TEXT_RECT.left, - DISCARDS_TEXT_RECT.top, - TTE_RED_PB, - discards - ); + game_playing_execute_discard(); // Move back to hand selection selection_grid_move_selection_vert(&game_playing_selection_grid, -1); } +static void game_playing_execute_discard(void) +{ + if (!can_discard_hand()) + return; + + hand_state = HAND_DISCARD; + display_discards(--discards); + set_hand(); +} + static void game_playing_sort_by_rank_on_pressed(void) { hand_change_sort(false); @@ -2086,13 +2089,21 @@ static void game_playing_play_hand_on_pressed(void) if (!can_play_hand()) return; - hand_state = HAND_PLAY; - display_hands(--hands); + game_playing_execute_play_hand(); // Move back to hand selection selection_grid_move_selection_vert(&game_playing_selection_grid, -1); } +static void game_playing_execute_play_hand(void) +{ + if (!can_play_hand()) + return; + + hand_state = HAND_PLAY; + display_hands(--hands); +} + static int game_playing_hand_row_get_size(void) { return hand_get_size(); @@ -2216,9 +2227,13 @@ static void game_playing_hand_row_on_key_transit( hand_deselect_all_cards(); set_hand(); } - else if (key_hit(SORT_HAND)) + else if (key_hit(PLAY_HAND_KEY)) { - hand_toggle_sort(); + game_playing_execute_play_hand(); + } + else if (key_hit(DISCARD_HAND_KEY)) + { + game_playing_execute_discard(); } }