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