Changed music to start after Splash Screen

This commit is contained in:
MeirGavish
2025-10-17 13:43:21 +03:00
parent f725c5e1b8
commit 53d2e53d78
6 changed files with 21 additions and 6 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)
+1
View File
@@ -29,6 +29,7 @@
// Enum value names in ../include/def_state_info_table.h
enum GameState
{
GAME_STATE_UNDEFINED = -1,
#define DEF_STATE_INFO(stateEnum, on_init, on_update, on_exit) stateEnum,
#include "def_state_info_table.h"
#undef DEF_STATE_INFO
+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
+11 -4
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;
@@ -1270,10 +1270,17 @@ 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 != GAME_STATE_UNDEFINED)
{
state_info[game_state].on_exit();
}
game_state = new_game_state;
if (new_game_state != GAME_STATE_UNDEFINED)
{
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);
}