]> icculus.org git repositories - taylor/freespace2.git/blob - include/eventmusic.h
Initial revision
[taylor/freespace2.git] / include / eventmusic.h
1 /*
2  * $Logfile: /Freespace2/code/Gamesnd/EventMusic.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Header file for high-level control of event driven music 
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 5     8/11/99 5:33p Jefff
15  * added 3rd debrief music track
16  * 
17  * 4     6/20/99 12:06a Alanl
18  * new event music changes
19  * 
20  * 3     11/20/98 4:08p Dave
21  * Fixed flak effect in multiplayer.
22  * 
23  * 2     10/07/98 10:52a Dave
24  * Initial checkin.
25  * 
26  * 1     10/07/98 10:48a Dave
27  * 
28  * 27    9/18/98 1:22p Dave
29  * Added new event music stuff defines.
30  * 
31  * 26    5/18/98 5:22p Lawrance
32  * Support new briefing music
33  * 
34  * 25    5/03/98 1:54a Lawrance
35  * Fix event music problems related to respawning
36  * 
37  * 24    12/30/97 11:46a Lawrance
38  * Support a success debriefing music.
39  * 
40  * 23    12/28/97 5:52p Lawrance
41  * Add support for debriefing success/fail music.
42  * 
43  * 22    12/26/97 10:01p Lawrance
44  * Add goal failure music... remove unused arrival music patterns
45  * 
46  * 21    9/19/97 5:13p Lawrance
47  * add support for specifying music in the mission file
48  * 
49  * 20    9/09/97 5:24p Lawrance
50  * added ability to switch soundtracks, gave soundtracks real names
51  * 
52  * 19    9/06/97 2:13p Mike
53  * Replace support for TEAM_NEUTRAL
54  * 
55  * 18    5/14/97 9:54a Lawrance
56  * supporting mission-specific briefing music
57  * 
58  * 17    4/21/97 5:36p Lawrance
59  * add in hooks to play death music when pilot dies
60  * 
61  * 16    4/17/97 3:28p Lawrance
62  * documented functions
63  * 
64  * 15    4/14/97 1:52p Lawrance
65  * making transitions happen on measure boundries
66  * 
67  * 14    4/07/97 1:39p Lawrance
68  * added event_music_first_pattern();
69  * 
70  * 13    4/03/97 4:26p Lawrance
71  * getting digital event music working
72  * 
73  * 12    3/07/97 8:53a Lawrance
74  * Read event at time 0 when music first starts
75  * 
76  * 11    2/25/97 11:10a Lawrance
77  * using text of the mission name to match up which midi file gets played
78  * for which mission
79  * 
80  * 10    2/18/97 9:43a Lawrance
81  * make BTTL_2 play after 2 enemy arrivals in battle mode.  Then switch
82  * back to default BTTL_1 until 2 more.
83  * 
84  * 9     2/14/97 11:50a Lawrance
85  * added BTTL_2 track 
86  * 
87  * 8     2/11/97 4:22p Lawrance
88  * adding song switching request to the event music level
89  * 
90  * 7     2/11/97 9:15a Lawrance
91  * taking out BTTL_2 and BTTL_3
92  * 
93  * 6     2/10/97 9:26a Lawrance
94  * 
95  * 5     2/05/97 3:12p Lawrance
96  * supporting changes in MIDI system that remove any high-level
97  * dependencies
98  * 
99  * 4     2/04/97 11:58p Lawrance
100  * volume change code, and fixing some bugs
101  * 
102  * 3     2/04/97 12:02p Lawrance
103  * fixed temp bug, integrating music.tbl
104  * 
105  * 2     2/03/97 6:49p Lawrance
106  * Event Music interface working
107  *
108  * $NoKeywords: $
109  */
110
111
112 #ifndef __EVENT_MUSIC_H__
113 #define __EVENT_MUSIC_H__
114
115 #include "parselo.h"
116
117 // Identifies songs in the Soundtrack_filenames[] structure.  The order matches up with
118 // what is in music.tbl.  Do not modify without synching music.tbl.
119 #define SONG_NRML_1                             0               // Normal Song 1
120 #define SONG_AARV_1                             1               // Allied Arrival 1
121 #define SONG_EARV_1                             2               // Enemy Arrival 1
122 #define SONG_BTTL_1                             3               // Battle Song 1
123 #define SONG_BTTL_2                             4               // Battle Song 2
124 #define SONG_BTTL_3                             5               // Battle Song 3
125 #define SONG_AARV_2                             6               // Allied Arrival 2
126 #define SONG_EARV_2                             7               // Enemy Arrival 2
127 #define SONG_VICT_1                             8               // Victory Song 1
128 #define SONG_VICT_2                             9               // Victory Song 2
129 #define SONG_FAIL_1                             10              // Goal Failed
130 #define SONG_DEAD_1                             11              // Death Song 1
131
132 #define MAX_PATTERNS    12
133
134 // if player targets a hostile ship at less than this range, switch to battle track 
135 #define BATTLE_START_MIN_TARGET_DIST    500     
136
137 extern int Event_Music_battle_started;  // flag that will tell us if we've started a battle in the current mission
138 extern int Event_music_enabled;
139 extern float Master_event_music_volume;                 // range is 0->1
140
141
142 /////////////////////////////////////////////////////////////////////////////
143 // Used to track what briefing and debriefing music is played for the mission
144 /////////////////////////////////////////////////////////////////////////////
145 #define NUM_SCORES                                              4
146 #define SCORE_BRIEFING                                  0
147 #define SCORE_DEBRIEF_SUCCESS                   1
148 #define SCORE_DEBRIEF_AVERAGE                   2
149 #define SCORE_DEBRIEF_FAIL                              3
150 extern int Mission_music[NUM_SCORES];           // indicies into Spooled_music[]
151 /////////////////////////////////////////////////////////////////////////////
152
153 extern int Current_soundtrack_num;              // index into Soundtracks[]
154
155 // menu music storage
156 typedef struct menu_music {
157         char name[NAME_LENGTH];                         // name music is known by
158         char filename[MAX_FILENAME_LEN];        // name music is stored on disk as
159 } menu_music;
160
161 #define MAX_SPOOLED_MUSIC       20
162
163 extern menu_music Spooled_music[MAX_SPOOLED_MUSIC];
164 extern int Num_music_files;
165
166 // event music soundtrack storage
167 typedef struct tagSOUNDTRACK_INFO {
168         int     num_patterns;
169         char    name[NAME_LENGTH];
170         char    pattern_fnames[MAX_PATTERNS][MAX_FILENAME_LEN];
171 } SOUNDTRACK_INFO;
172
173 #define MAX_SOUNDTRACKS 10
174
175 extern SOUNDTRACK_INFO Soundtracks[MAX_SOUNDTRACKS];
176 extern int Num_soundtracks;
177
178 void    event_music_init();
179 void    event_music_close();
180 void    event_music_level_init(int force_soundtrack = -1);
181 void    event_music_level_close();
182 void    event_music_do_frame();
183 void    event_music_disable();
184 void    event_music_enable();
185 void    event_music_pause();
186 void    event_music_unpause();
187 void    event_music_set_volume_all(float volume);
188 void    event_music_parse_musictbl();
189 void    event_music_change_pattern(int new_pattern);
190 int     event_music_return_current_pattern();
191 void    event_music_first_pattern();
192 int     event_music_battle_start();
193 int     event_music_enemy_arrival();
194 int     event_music_friendly_arrival();
195 void    event_music_arrival(int team);
196 int     event_music_primary_goals_met();
197 int     event_music_primary_goal_failed();
198 int     event_music_player_death();
199 void    event_music_start_default();
200 void    event_music_get_info(char *outbuf);
201 void    event_music_get_soundtrack_name(char *outbuf);
202 int     event_music_next_soundtrack(int delta);
203 void    event_music_set_soundtrack(char *name);
204 void    event_music_set_score(int score_index, char *name);
205 int     event_music_get_spooled_music_index(char *name);
206 void    event_music_reset_choices();
207 int     event_music_player_respawn();
208 int     event_music_player_respawn_as_observer();
209 void event_music_hostile_ship_destroyed();
210
211 #endif /* __EVENT_MUSIC_H__  */
212