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