FS2_Open
Open source remastering of the Freespace 2 engine
eventmusic.h
Go to the documentation of this file.
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 the
6  * source.
7  *
8 */
9 
10 
11 
12 
13 #ifndef __EVENT_MUSIC_H__
14 #define __EVENT_MUSIC_H__
15 
16 #include "globalincs/globals.h"
17 #include "globalincs/pstypes.h"
18 
19 // Identifies songs in the Soundtrack_filenames[] structure. The order matches up with
20 // what is in Pattern_info and music.tbl. Do not modify without properly inputting to
21 //Pattern_info and New_pattern_order
22 #define SONG_NRML_1 0 // Normal Song 1
23 #define SONG_NRML_2 1 // Normal Song 2 - for FS1
24 #define SONG_NRML_3 2 // Normal Song 3 - for FS1
25 #define SONG_AARV_1 3 // Allied Arrival 1
26 #define SONG_AARV_2 4 // Allied Arrival 2
27 #define SONG_EARV_1 5 // Enemy Arrival 1
28 #define SONG_EARV_2 6 // Enemy Arrival 2
29 #define SONG_BTTL_1 7 // Battle Song 1
30 #define SONG_BTTL_2 8 // Battle Song 2
31 #define SONG_BTTL_3 9 // Battle Song 3
32 #define SONG_FAIL_1 10 // Goal Failed
33 #define SONG_VICT_1 11 // Victory Song 1
34 #define SONG_VICT_2 12 // Victory Song 2
35 #define SONG_DEAD_1 13 // Death Song 1
36 
37 #define MAX_PATTERNS 14
38 
39 // if player targets a hostile ship at less than this range, switch to battle track
40 #define BATTLE_START_MIN_TARGET_DIST 500
41 
42 extern int Event_Music_battle_started; // flag that will tell us if we've started a battle in the current mission
43 extern int Event_music_enabled;
44 extern float Master_event_music_volume; // range is 0->1
45 
46 
48 // Used to track what briefing and debriefing music is played for the mission
50 #define NUM_SCORES 5
51 #define SCORE_BRIEFING 0
52 #define SCORE_DEBRIEF_SUCCESS 1
53 #define SCORE_DEBRIEF_AVERAGE 2
54 #define SCORE_DEBRIEF_FAIL 3
55 #define SCORE_FICTION_VIEWER 4
56 extern int Mission_music[NUM_SCORES]; // indicies into Spooled_music[]
58 
59 extern int Current_soundtrack_num; // index into Soundtracks[]
60 
61 
62 // menu music storage
63 typedef struct menu_music {
64  int flags;
65  char name[NAME_LENGTH]; // name music is known by
66  char filename[MAX_FILENAME_LEN]; // name music is stored on disk as
67 } menu_music;
68 
69 #define MAX_SPOOLED_MUSIC 50 // max number of briefing/mainhall/credits tracks
70 
71 // Goober5000 - spooled music flags
72 #define SMF_VALID (1 << 0)
73 
75 extern int Num_music_files;
76 
77 
78 // event music soundtrack storage
79 typedef struct tagSOUNDTRACK_INFO {
80  int flags;
85 
86 #define MAX_SOUNDTRACKS 30 // max number of battle tracks
87 
88 // Goober5000 - event music flags
89 #define EMF_VALID (1 << 0)
90 #define EMF_ALLIED_ARRIVAL_OVERLAY (1 << 1)
91 #define EMF_CYCLE_FS1 (1 << 2)
92 
94 extern int Num_soundtracks;
95 
96 
97 void event_music_init();
98 void event_music_close();
99 void event_music_level_init(int force_soundtrack = -1);
101 void event_music_do_frame();
102 void event_music_disable();
103 void event_music_enable();
104 void event_music_pause();
105 void event_music_unpause();
106 void event_music_set_volume_all(float volume);
107 void event_music_parse_musictbl(const char *filename);
108 void event_music_change_pattern(int new_pattern);
114 void event_music_arrival(int team);
119 void event_music_get_info(char *outbuf);
120 void event_music_get_soundtrack_name(char *outbuf);
123 void event_music_set_soundtrack(char *name);
124 void event_music_set_score(int score_index, char *name);
132 
133 #endif /* __EVENT_MUSIC_H__ */
struct menu_music menu_music
#define MAX_FILENAME_LEN
Definition: pstypes.h:324
#define NUM_SCORES
Definition: eventmusic.h:50
void event_music_disable()
void event_music_get_soundtrack_name(char *outbuf)
int event_music_player_respawn_as_observer()
void event_music_start_default()
int event_music_friendly_arrival()
Definition: eventmusic.cpp:870
void event_music_level_init(int force_soundtrack=-1)
Definition: eventmusic.cpp:543
int event_music_return_current_pattern()
void event_music_set_score(int score_index, char *name)
int event_music_player_death()
struct tagSOUNDTRACK_INFO SOUNDTRACK_INFO
CButton * team
void event_music_parse_musictbl(const char *filename)
void event_music_first_pattern()
Definition: eventmusic.cpp:648
void event_music_reset_choices()
int Event_Music_battle_started
Definition: eventmusic.cpp:39
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
#define MAX_SOUNDTRACKS
Definition: eventmusic.h:86
void event_music_level_close()
Definition: eventmusic.cpp:691
void event_music_init()
Definition: eventmusic.cpp:261
int event_music_primary_goals_met()
#define MAX_SPOOLED_MUSIC
Definition: eventmusic.h:69
void event_music_arrival(int team)
Definition: eventmusic.cpp:955
char * filename
void event_music_get_info(char *outbuf)
void event_music_set_soundtrack(char *name)
void event_music_pause()
int Current_soundtrack_num
Definition: eventmusic.cpp:59
int event_music_enemy_arrival()
Definition: eventmusic.cpp:775
int event_music_get_spooled_music_index(const char *name)
float Master_event_music_volume
Definition: eventmusic.cpp:40
#define delta
Definition: fvi.cpp:418
menu_music Spooled_music[MAX_SPOOLED_MUSIC]
Definition: eventmusic.cpp:249
int event_music_get_soundtrack_index(char *name)
void event_music_do_frame()
Definition: eventmusic.cpp:419
int event_music_primary_goal_failed()
Definition: eventmusic.cpp:973
void event_music_close()
Definition: eventmusic.cpp:320
void event_music_unpause()
int event_music_player_respawn()
GLuint const GLchar * name
Definition: Glext.h:5608
int Event_music_enabled
Definition: eventmusic.cpp:237
#define MAX_PATTERNS
Definition: eventmusic.h:37
#define NAME_LENGTH
Definition: globals.h:15
void event_music_hostile_ship_destroyed()
char pattern_fnames[MAX_PATTERNS][MAX_FILENAME_LEN]
Definition: eventmusic.h:83
void event_sexp_change_soundtrack(char *name)
void event_music_change_pattern(int new_pattern)
void event_music_set_volume_all(float volume)
int Num_music_files
Definition: eventmusic.cpp:250
int Num_soundtracks
Definition: eventmusic.cpp:58
int event_music_battle_start()
Definition: eventmusic.cpp:732
int event_music_next_soundtrack(int delta)
void event_music_enable()
int Mission_music[NUM_SCORES]
Definition: eventmusic.cpp:253
SOUNDTRACK_INFO Soundtracks[MAX_SOUNDTRACKS]
Definition: eventmusic.cpp:57
char filename[MAX_FILENAME_LEN]
Definition: eventmusic.h:66