Feature/game over audio (#494)
* initial additions * Move current_blind to game vars * tmp * tmp * tmp * tmp * tmp * tmp * tmp * Compile but is broken * temp fix for token location * tmp * Working, lets clean up * remove todo * Remove odd reroll blind variable * fix skipping blind screen * fix reroll * remove magic for blind token locations * clang format * Cleanup button highlight in blind menu * some cleanup * Add layout file for global UI rects * remove dead code * Clang format * clang format it up * Move reset top left funct to gfx utils * make note of soon-to-be removed vars * Cleanup gamevars declaration * Cleanup layout file * Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Add include for stdbool.h in common_ui.h * Cleanup rect declaration * Start moving state machine stuff to new file * quick tmp * oops, add new files * working call list * fixed pointer stuff * working as per norm * working replacement * move defines to static const * fix compile issue * Add some missing "void"s * Working new substates * add statemachine to blind select * Fix game restart statemachine leak * clang-format * Clang format * Rework shop exit logic * Use new state machine in shop * Remove substates entirely * Remove debug stuff * Clang format * document state machine better * update list tests * clang-format * Update for PR * Claaaaang format * another clang-format * Remove extra state in round_end * cleanup docs for removals in lists * clang-format... again * update doxygen format * Clang format * tmp * Update for Pr * clang-format * Cleanup for only supporting losing * bug fix, thanks logs! * Fix dangling pointer bug The control of removing statemachines may call issues if starting the function is done from another state machine call. To remedy this, add a flag to determine if a state machine is registered and return early instead of blindly removing it to re-add. * Fix bug with audio iterations possibly going in reverse * Remove extra includes * Clang-format * Add sound effects for game win/lose * adjust audio steps * tmp * Nice sounding and cleaned up * Fix and cleanup * clang-format * clang-format * clang format again --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
co-authored by
Copilot Autofix powered by AI
parent
d2e453c256
commit
63b6584706
@@ -56,10 +56,7 @@ static StateInfo state_info[] = {
|
||||
STATE_INFO_UPDATE_FN_ONLY(game_blind_select_exit),
|
||||
};
|
||||
|
||||
static StateMachine blind_select_sm = {
|
||||
.state_infos = &state_info[0],
|
||||
.num_infos = BLIND_SELECT_MAX,
|
||||
};
|
||||
static StateMachine blind_select_sm = STATE_MACHINE_DEFINE(state_info, BLIND_SELECT_MAX);
|
||||
|
||||
// clang-format off
|
||||
// Points x y
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "audio_utils.h"
|
||||
#include "button.h"
|
||||
#include "game.h"
|
||||
#include "game/main_menu.h"
|
||||
#include "graphic_utils.h"
|
||||
#include "layout.h"
|
||||
#include "random.h"
|
||||
@@ -63,11 +62,16 @@ static void game_over_init(enum EndCondition init_condition)
|
||||
|
||||
void game_win_on_init(void)
|
||||
{
|
||||
play_sfx(SFX_GAME_WIN, MM_BASE_PITCH_RATE, SFX_DEFAULT_VOLUME);
|
||||
|
||||
game_over_init(END_CONDITION_WIN);
|
||||
}
|
||||
|
||||
void game_lose_on_init(void)
|
||||
{
|
||||
play_sfx(SFX_GAME_LOSE, MM_BASE_PITCH_RATE, SFX_DEFAULT_VOLUME);
|
||||
play_lose_music();
|
||||
|
||||
game_over_init(END_CONDITION_LOSS);
|
||||
}
|
||||
|
||||
@@ -127,6 +131,7 @@ void game_over_on_update(void)
|
||||
|
||||
void game_over_on_exit(void)
|
||||
{
|
||||
play_regular_music();
|
||||
condition = END_CONDITION_NONE;
|
||||
game_reset();
|
||||
rng_shuffle_seed();
|
||||
|
||||
@@ -612,7 +612,7 @@ static bool music_volume_row_on_selection_changed(
|
||||
}
|
||||
|
||||
update_volume_slider_graphics(MUSIC_VOLUME_ROW_IDX);
|
||||
mmSetModuleVolume(MM_MODULE_FULL_VOLUME * g_game_vars.music_volume / VOLUME_OPTION_MAX);
|
||||
set_volume(volume_module_step_to_val(g_game_vars.music_volume));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -79,10 +79,7 @@ static StateInfo state_info[] = {
|
||||
STATE_INFO_UPDATE_FN_ONLY(game_round_end_dismiss_round_end_panel),
|
||||
};
|
||||
|
||||
static StateMachine round_end_sm = {
|
||||
.state_infos = &state_info[0],
|
||||
.num_infos = ROUND_END_STATES_MAX,
|
||||
};
|
||||
static StateMachine round_end_sm = STATE_MACHINE_DEFINE(state_info, ROUND_END_STATES_MAX);
|
||||
|
||||
static int calculate_interest_reward(void)
|
||||
{
|
||||
|
||||
+1
-4
@@ -81,10 +81,7 @@ static StateInfo shop_state_actions[] = {
|
||||
STATE_INFO_UPDATE_FN_ONLY(game_shop_outro),
|
||||
};
|
||||
|
||||
static StateMachine shop_sm = {
|
||||
.state_infos = &shop_state_actions[0],
|
||||
.num_infos = GAME_SHOP_MAX,
|
||||
};
|
||||
static StateMachine shop_sm = STATE_MACHINE_DEFINE(shop_state_actions, GAME_SHOP_MAX);
|
||||
|
||||
// Shop SelectionGrid
|
||||
|
||||
|
||||
Reference in New Issue
Block a user