Debian Codegraph @

Descent3/d3music.h

raw symbols SCIP
1 /*
2 * Descent 3
3 * Copyright (C) 2024 Parallax Software
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 --- HISTORICAL COMMENTS FOLLOW ---
19
20 * $Source: $
21 * $Revision: 14 $
22 * $Author: Samir $
23 * $Date: 3/27/99 4:45p $
24 *
25 * D3 Music System
26 *
27 * $Log: /DescentIII/Main/Lib/d3music.h $
28 *
29 * 14 3/27/99 4:45p Samir
30 * reinstate pause music when pausing game.
31 *
32 * 13 3/23/99 9:07p Samir
33 * turn on and off music when pausing and resuming game, if appropriate.
34 *
35 * 12 3/18/99 10:13a Samir
36 * msuic update.
37 *
38 * 11 2/27/99 8:23p Samir
39 * fixes to music system to act nicely to sudden and frequent region
40 * changes.
41 *
42 * 10 2/27/99 6:51p Samir
43 * added code for music tester to display current stream and loop/region.
44 *
45 * 9 2/27/99 4:37p Samir
46 * return name of loop currently playing.
47 *
48 * 8 2/19/99 10:31p Samir
49 * added music volume.
50 *
51 * 7 2/18/99 6:47p Jeff
52 * added call to start/stop special cinematics music
53 *
54 * 6 1/28/99 2:22p Samir
55 * simplified music system for D3.
56 *
57 * 5 1/07/99 12:28p Samir
58 * Call to InitD3Music added parameter.
59 *
60 * 4 12/07/98 11:44a Samir
61 * added new themes.
62 *
63 * 3 12/03/98 12:49p Samir
64 * added positive and negative mood timers.
65 *
66 * 2 11/20/98 5:23p Samir
67 * pass mood register to sequencer.
68 *
69 * 1 11/13/98 2:30p Samir
70 * initial rev.
71 *
72 */
73
74 #ifndef D3MUSIC_H
75 #define D3MUSIC_H
76
77 #include <cstdint>
78
79 // register constants for the sequencer
80 #define MUSICREG_TRIGGER_VALUE 1 // trigger value set by calling app to sequencer
81 //@@#define MUSICREG_MOOD_VALUE 2 // current mood of player stored here.
82 //@@#define MUSICREG_NEGMOOD_TIMER 3 // time in negative mood
83 //@@#define MUSICREG_POSMOOD_TIMER 4 // time in positive mood
84 #define MUSICREG_PEACE_TIMER 5 // amount of time in 'non-combat' mode.
85
86 // types of triggers
87 #define MUSICTRIGGER_NONE 0
88 #define MUSICTRIGGER_NEWREGION 1 // player entered new region
89
90 extern const char *const Music_type_names[]; // contains type names.
91
92 // structure passed to music frame
93 struct tMusicSeqInfo {
94 // INPUT
95 bool started_level; // player started level
96 bool player_dead; // did player die?
97 bool player_damaged; // was player hit by enemy fire?
98 bool player_invulnerable; // is player invulnerable?
99 bool player_terrain; // is player in terrain (if not, in mine)
100 uint8_t player_shield_level; // what shield level the player is at? (0-10)
101 uint8_t n_hostiles; // number of hostiles
102 uint8_t n_hostiles_player_killed; // number hostiles killed by player this frame.
103 uint8_t pad;
104
105 float frametime; // frame time.
106
107 // OUTPUT
108 int16_t cur_song; // current song.
109 float peace_timer; // current peace timer
110
111 const char *cur_loop_name; // current loop playing (NULL if none.)
112 int cur_loop_count;
113 };
114
115 // this is located in gameloop.cpp. kept here so files that need this data structure don't have to include
116 // gameloop (and to stop gameloop.h from including d3music.h)
117 extern tMusicSeqInfo Game_music_info;
118
119 #ifdef _DEBUG
120 // if true, turns on debugging for music.
121 extern bool Music_debug_verbose;
122 #endif
123
124 // Music extensions
125 void InitD3Music(bool allow_music);
126
127 // closes music system
128 void CloseD3Music();
129
130 // starts up the music sequencer
131 void D3MusicStart(const char *theme_file);
132
133 // stops the music sequencer
134 void D3MusicStop();
135
136 // execute music sequencer.
137 void D3MusicDoFrame(tMusicSeqInfo *music_info);
138
139 // toggle music system.
140 void D3MusicToggle();
141
142 // toggle music system.
143 void D3MusicToggle(bool state);
144
145 // pauses and or resumes music
146 void D3MusicPause();
147 void D3MusicResume();
148
149 // returns true if music system is on.
150 bool IsD3MusicOn();
151
152 // set music region
153 void D3MusicSetRegion(int16_t region, bool immediate = false);
154
155 // retreives current region (can be different than regin passed to D3MusicSetRegion),
156 // returns current played region, not waiting region.
157 int16_t D3MusicGetRegion();
158
159 // retreives current pending region
160 int16_t D3MusicGetPendingRegion();
161
162 // starts special in-game cinematic music
163 void D3MusicStartCinematic();
164
165 // stops special in-game cinematic music
166 void D3MusicStopCinematic();
167
168 // volume stuff
169 float D3MusicGetVolume();
170 void D3MusicSetVolume(float vol);
171
172 #endif