From 68cfcabf80a977b0cbf0545f6e4d3b3fb69ca1c7 Mon Sep 17 00:00:00 2001 From: Taylor Richards Date: Wed, 13 Aug 2014 21:56:56 -0400 Subject: [PATCH] handle stopping of background sounds properly; cleanup --- src/movie/movie.cpp | 76 +++++++++++++++++++++++---------------------- 1 file changed, 39 insertions(+), 37 deletions(-) diff --git a/src/movie/movie.cpp b/src/movie/movie.cpp index 63225dd..5da9a6f 100644 --- a/src/movie/movie.cpp +++ b/src/movie/movie.cpp @@ -33,6 +33,8 @@ #include "cmdline.h" #include "gamesequence.h" #include "mainhallmenu.h" +#include "audiostr.h" + int movie_play(const char *filename) { @@ -41,45 +43,45 @@ int movie_play(const char *filename) cutscene_mark_viewable(filename); } - if (Cmdline_play_movies) { - MVESTREAM *movie; - - movie = mve_open(filename); - - if (movie) { - // kill all background sounds - game_stop_looped_sounds(); - main_hall_stop_music(); - main_hall_stop_ambient(); - - // clear the screen and hide the mouse cursor - Mouse_hidden++; - gr_set_clear_color(0, 0, 0); - gr_reset_clip(); - gr_clear(); - gr_flip(); - gr_clear(); - gr_zbuffer_clear(1); // G400, blah - - // ready to play... - mve_init(movie); - mve_play(movie); - - // ...done playing, close the mve and show the cursor again - mve_shutdown(); - mve_close(movie); - - Mouse_hidden--; - main_hall_start_ambient(); - } else { - printf("Can't open movie file: '%s'\n", filename); - return 0; - } - - } else { - mprintf(("Movies are disabled, skipping...\n")); + if ( !Cmdline_play_movies ) { + mprintf(("Movies are disabled, skipping playback of '%s'...\n", filename)); + return 1; + } + + MVESTREAM *movie = NULL; + + movie = mve_open(filename); + + if (movie == NULL) { + mprintf(("Can't open movie file: '%s'\n", filename)); + return 0; } + // kill all background sounds + snd_stop_all(); + audiostream_pause_all(); + + // clear the screen and hide the mouse cursor + Mouse_hidden++; + gr_set_clear_color(0, 0, 0); + gr_reset_clip(); + gr_clear(); + gr_flip(); + gr_clear(); + gr_zbuffer_clear(1); // G400, blah + + // ready to play... + mve_init(movie); + mve_play(movie); + + // ...done playing, close the mve and show the cursor again + mve_shutdown(); + mve_close(movie); + + Mouse_hidden--; + + audiostream_unpause_all(); + return 1; } -- 2.39.2