Skip to content

Commit

Permalink
Play intro track when returning to main menu
Browse files Browse the repository at this point in the history
  • Loading branch information
bvschaik committed Jan 6, 2020
1 parent 6de5960 commit 6603961
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/game/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void game_exit_editor(void)
}

editor_set_active(0);
window_main_menu_show();
window_main_menu_show(1);
}

static int get_elapsed_ticks(void)
Expand Down
2 changes: 1 addition & 1 deletion src/widget/top_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ static void menu_file_new_game(int param)
building_construction_clear_type();
game_undo_disable();
game_state_reset_overlay();
window_main_menu_show();
window_main_menu_show(1);
}

static void menu_file_replay_map(int param)
Expand Down
2 changes: 1 addition & 1 deletion src/window/logo.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void draw_background(void)
static void handle_mouse(const mouse *m)
{
if (m->left.went_up || m->right.went_up) {
window_main_menu_show();
window_main_menu_show(0);
}
}

Expand Down
6 changes: 5 additions & 1 deletion src/window/main_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "graphics/lang_text.h"
#include "graphics/panel.h"
#include "graphics/window.h"
#include "sound/music.h"
#include "window/cck_selection.h"
#include "window/file_dialog.h"
#include "window/new_career.h"
Expand Down Expand Up @@ -88,8 +89,11 @@ static void button_click(int type, int param2)
}
}

void window_main_menu_show(void)
void window_main_menu_show(int restart_music)
{
if (restart_music) {
sound_music_play_intro();
}
window_type window = {
WINDOW_MAIN_MENU,
draw_background,
Expand Down
2 changes: 1 addition & 1 deletion src/window/main_menu.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef WINDOW_MAIN_MENU_H
#define WINDOW_MAIN_MENU_H

void window_main_menu_show(void);
void window_main_menu_show(int restart_music);

#endif // WINDOW_MAIN_MENU_H
4 changes: 2 additions & 2 deletions src/window/mission_end.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static void advance_to_next_mission(void)
game_state_reset_overlay();

if (scenario_campaign_rank() >= 11 || scenario_is_custom()) {
window_main_menu_show();
window_main_menu_show(1);
if (!scenario_is_custom()) {
setting_clear_personal_savings();
scenario_settings_init();
Expand Down Expand Up @@ -136,7 +136,7 @@ static void button_fired(int param1, int param2)
city_victory_stop_governing();
game_undo_disable();
if (scenario_is_custom()) {
window_main_menu_show();
window_main_menu_show(1);
} else {
window_mission_selection_show();
}
Expand Down
3 changes: 1 addition & 2 deletions src/window/new_career.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include "input/keyboard.h"
#include "scenario/property.h"
#include "scenario/scenario.h"
#include "window/main_menu.h"
#include "window/mission_selection.h"

static void start_mission(int param1, int param2);
Expand Down Expand Up @@ -60,7 +59,7 @@ static void handle_mouse(const mouse *m)
{
if (m->right.went_up) {
keyboard_stop_capture();
window_main_menu_show();
window_go_back();
}

if (image_buttons_handle_mouse(mouse_in_dialog(m), 464, 249, &image_button_start_mission, 1, 0)) {
Expand Down
2 changes: 1 addition & 1 deletion test/stub/ui.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void window_invalidate(void)
void window_logo_show(int show_patch_message)
{}

void window_main_menu_show(void)
void window_main_menu_show(int restart_music)
{}

void window_mission_end_show_fired(void)
Expand Down

0 comments on commit 6603961

Please sign in to comment.