]> icculus.org git repositories - taylor/freespace2.git/blob - src/movie/movie.cpp
get rid of some platform specific stuff
[taylor/freespace2.git] / src / movie / movie.cpp
1 /*
2  * $Logfile: /Freespace2/src/movie/movie.cpp $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Frontend for MVE playing
8  *
9  * $Log$
10  * Revision 1.5  2005/10/01 21:48:01  taylor
11  * various cleanups
12  * fix decoder to swap opcode 0xb since it screws up on PPC
13  * the previous opcode 0xc change was wrong since we had already determined that it messes up FS1 movies
14  *
15  * Revision 1.4  2005/03/29 07:50:34  taylor
16  * Update to newest movie code with much better video support and audio support from
17  *   Pierre Willenbrock.  Movies are enabled always now (no longer a build option)
18  *   and but can be skipped with the "--nomovies" or "-n" cmdline options.
19  *
20  *
21  *
22  * $NoKeywords: $
23  *
24  */
25
26 #include "pstypes.h"
27 #include "mvelib.h"
28 #include "movie.h"
29 #include "cutscenes.h"
30 #include "freespace.h"
31 #include "mouse.h"
32 #include "sound.h"
33 #include "cmdline.h"
34 #include "gamesequence.h"
35 #include "mainhallmenu.h"
36
37 int movie_play(const char *filename)
38 {
39         // mark the movie as viewable in the techroom if in a campaign
40         if (Game_mode & GM_CAMPAIGN_MODE) {
41                 cutscene_mark_viewable(filename);
42         }
43
44         if (Cmdline_play_movies) {
45                 MVESTREAM *movie;
46
47                 movie = mve_open(filename);
48
49                 if (movie) {
50                         // kill all background sounds
51                         game_stop_looped_sounds();
52                         main_hall_stop_music();
53                         main_hall_stop_ambient();
54
55                         // clear the screen and hide the mouse cursor
56                         Mouse_hidden++;
57                         gr_reset_clip();
58                         gr_clear();
59                         gr_flip();
60                         gr_zbuffer_clear(1);    // G400, blah
61                         
62                         // ready to play...
63                         mve_init(movie);
64                         mve_play(movie);
65
66                         // ...done playing, close the mve and show the cursor again
67                         mve_shutdown();
68                         mve_close(movie);
69
70                         Mouse_hidden--;
71                         main_hall_start_ambient();
72                 } else {
73                         printf("Can't open movie file: '%s'\n", filename);
74                         return 0;
75                 }
76         
77         } else {
78                 mprintf(("Movies are disabled, skipping...\n"));
79         }
80
81         return 1;
82 }
83
84 int movie_play_two(const char *filename1, const char *filename2)
85 {
86         // make sure the first movie played correctly, then play the second one
87         if ( movie_play(filename1) ) {
88                 movie_play(filename2);
89         } else {
90                 printf("Not playing second movie: %s\n", filename2);
91                 return 0;
92         }
93
94         return 1;
95 }