diff --git a/audio/chips_accum.wav b/audio/chips_accum.wav new file mode 100644 index 0000000..607fd5b Binary files /dev/null and b/audio/chips_accum.wav differ diff --git a/audio/pop.wav b/audio/pop.wav new file mode 100644 index 0000000..0e5f2b5 Binary files /dev/null and b/audio/pop.wav differ diff --git a/include/def_state_info_table.h b/include/def_state_info_table.h index 616eb96..781b325 100644 --- a/include/def_state_info_table.h +++ b/include/def_state_info_table.h @@ -5,7 +5,7 @@ DEF_STATE_INFO(GAME_STATE_MAIN_MENU, game_main_menu_on_init, game_main_menu_on_u DEF_STATE_INFO(GAME_STATE_PLAYING, game_round_on_init, game_playing_on_update, noop) DEF_STATE_INFO(GAME_STATE_ROUND_END, noop, game_round_end_on_update, game_round_end_on_exit) DEF_STATE_INFO(GAME_STATE_SHOP, noop, game_shop_on_update, game_shop_on_exit) -DEF_STATE_INFO(GAME_STATE_BLIND_SELECT, noop, game_blind_select_on_update, game_blind_select_on_exit) +DEF_STATE_INFO(GAME_STATE_BLIND_SELECT, game_blind_select_on_init, game_blind_select_on_update, game_blind_select_on_exit) DEF_STATE_INFO(GAME_STATE_LOSE, game_lose_on_init, game_lose_on_update, game_over_on_exit) DEF_STATE_INFO(GAME_STATE_WIN, game_win_on_init, game_win_on_update, game_over_on_exit) // clang-format on diff --git a/source/game.c b/source/game.c index ee12f9b..48f6d0a 100644 --- a/source/game.c +++ b/source/game.c @@ -195,6 +195,7 @@ static void game_round_end_on_update(void); static void game_round_end_on_exit(void); static void game_shop_on_update(void); static void game_shop_on_exit(void); +static void game_blind_select_on_init(void); static void game_blind_select_on_update(void); static void game_blind_select_on_exit(void); static void game_lose_on_init(void); @@ -2675,8 +2676,18 @@ static inline void play_ending_played_cards_update(int played_idx) { scored_card_index--; + /* SFX_CHIPS_ACCUM has been pitch shifted to perserve high frequencies in downsampling. + * Now it needs to be pitch shifted back to the original frequency. + */ + int static const CHIPS_ACCUM_SFX_PITCH_RATIO = 2; + if (scored_card_index == 0) { + play_sfx( + SFX_CHIPS_ACCUM, + CHIPS_ACCUM_SFX_PITCH_RATIO * MM_BASE_PITCH_RATE, + SFX_DEFAULT_VOLUME + ); timer = TM_ZERO; play_state = PLAY_ENDED; } @@ -2815,6 +2826,16 @@ static inline void game_playing_process_input_and_state(void) mult = 0; display_mult(); display_chips(); + + static const int SCORE_CALC_SFX_PITCH_SHIFT = -102; // -10% OF MM_BASE_PITCH_RATE + static const int SCORE_CALC_SFX_VOLUME = 204; // 80% MM_FULL_VOLUME + + // The chips calculation SFX is the same as button + play_sfx( + SFX_BUTTON, + MM_BASE_PITCH_RATE + SCORE_CALC_SFX_PITCH_SHIFT, + SCORE_CALC_SFX_VOLUME + ); } } else if (play_state == PLAY_ENDED) @@ -4171,6 +4192,13 @@ static void game_shop_on_exit() increment_blind(BLIND_STATE_DEFEATED); // TODO: Move to game_round_end()? } +static void game_blind_select_on_init() +{ + change_background(BG_BLIND_SELECT); + + play_sfx(SFX_POP, MM_BASE_PITCH_RATE, SFX_DEFAULT_VOLUME); +} + static void game_blind_select_on_update() { if (state_info[game_state].substate == BLIND_SELECT_MAX) @@ -4185,7 +4213,6 @@ static void game_blind_select_on_update() static void game_blind_select_start_anim_seq() { - change_background(BG_BLIND_SELECT); main_bg_se_copy_rect_1_tile_vert(POP_MENU_ANIM_RECT, SCREEN_UP); for (int i = 0; i < BLIND_TYPE_MAX; i++)