Merge pull request #172 from cellos51/start_music_after_splashscreen

Changed music to start after Splash Screen
This commit is contained in:
MeirGavish
2025-10-22 06:41:29 +03:00
committed by GitHub
6 changed files with 23 additions and 8 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
// (stateEnum, on_init, on_update, on_exit)
DEF_STATE_INFO(GAME_STATE_SPLASH_SCREEN, splash_screen_on_init, splash_screen_on_update, _noop)
DEF_STATE_INFO(GAME_STATE_SPLASH_SCREEN, splash_screen_on_init, splash_screen_on_update, splash_screen_on_exit)
DEF_STATE_INFO(GAME_STATE_MAIN_MENU, game_main_menu_on_init, game_main_menu_on_update, _noop)
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)
+2 -1
View File
@@ -32,7 +32,8 @@ enum GameState
#define DEF_STATE_INFO(stateEnum, on_init, on_update, on_exit) stateEnum,
#include "def_state_info_table.h"
#undef DEF_STATE_INFO
GAME_STATE_MAX
GAME_STATE_MAX,
GAME_STATE_UNDEFINED
};
enum HandState
+1
View File
@@ -9,5 +9,6 @@
void splash_screen_on_init();
void splash_screen_on_update();
void splash_screen_on_exit();
#endif // SPLASH_SCREEN_H
+12 -5
View File
@@ -164,7 +164,7 @@ static const SubStateActionFn round_end_state_actions[] =
game_round_end_dismiss_round_end_panel
};
static enum GameState game_state = GAME_STATE_SPLASH_SCREEN; // The current game state, this is used to determine what the game is doing at any given time
static enum GameState game_state = GAME_STATE_UNDEFINED; // The current game state, this is used to determine what the game is doing at any given time
static enum HandState hand_state = HAND_DRAW;
static enum PlayState play_state = PLAY_PLAYING;
@@ -1269,11 +1269,18 @@ void game_change_state(enum GameState new_game_state)
{
timer = TM_ZERO; // Reset the timer
state_info[game_state].substate = 0;
state_info[game_state].on_exit();
state_info[new_game_state].on_init();
if (game_state >= 0 && game_state < GAME_STATE_MAX)
{
state_info[game_state].substate = 0;
state_info[game_state].on_exit();
}
game_state = new_game_state;
if (new_game_state >= 0 && new_game_state < GAME_STATE_MAX)
{
state_info[new_game_state].on_init();
game_state = new_game_state;
}
}
void jokers_available_to_shop_init()
-1
View File
@@ -70,7 +70,6 @@ void init()
// Initialize subsystems
mmInitDefault((mm_addr)soundbank_bin, 12);
mmStart(MOD_MAIN_THEME, MM_PLAY_LOOP);
affine_background_init();
sprite_init();
card_init();
+7
View File
@@ -4,6 +4,8 @@
#include "graphic_utils.h"
#include "game.h"
#include "maxmod.h"
#include "soundbank.h"
static const Rect COUNTDOWN_TIMER_RECT = {208, 144, 240, 152};
static uint timer = 0;
@@ -35,3 +37,8 @@ void splash_screen_on_update()
game_change_state(GAME_STATE_MAIN_MENU);
tte_erase_screen();
}
void splash_screen_on_exit()
{
mmStart(MOD_MAIN_THEME, MM_PLAY_LOOP);
}