| 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_Hcxx . . $ `Descent3/d3music.h:75:9`! |
| 76 | |
| 77 | #include <cstdint> |
| 78 | |
| 79 | // register constants for the sequencer |
| 80 | #define MUSICREG_TRIGGER_VALUEcxx . . $ `Descent3/d3music.h:80:9`! 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_TIMERcxx . . $ `Descent3/d3music.h:84:9`! 5 // amount of time in 'non-combat' mode. |
| 85 | |
| 86 | // types of triggers |
| 87 | #define MUSICTRIGGER_NONEcxx . . $ `Descent3/d3music.h:87:9`! 0 |
| 88 | #define MUSICTRIGGER_NEWREGIONcxx . . $ `Descent3/d3music.h:88:9`! 1 // player entered new region |
| 89 | |
| 90 | extern const char *const Music_type_namescxx . . $ Music_type_names.[]; // contains type names. |
| 91 | |
| 92 | // structure passed to music frame |
| 93 | struct tMusicSeqInfocxx . . $ tMusicSeqInfo# { |
| 94 | // INPUT |
| 95 | bool started_levelcxx . . $ tMusicSeqInfo#started_level.; // player started level |
| 96 | bool player_deadcxx . . $ tMusicSeqInfo#player_dead.; // did player die? |
| 97 | bool player_damagedcxx . . $ tMusicSeqInfo#player_damaged.; // was player hit by enemy fire? |
| 98 | bool player_invulnerablecxx . . $ tMusicSeqInfo#player_invulnerable.; // is player invulnerable? |
| 99 | bool player_terraincxx . . $ tMusicSeqInfo#player_terrain.; // is player in terrain (if not, in mine) |
| 100 | uint8_tcxx . . $ uint8_t# player_shield_levelcxx . . $ tMusicSeqInfo#player_shield_level.; // what shield level the player is at? (0-10) |
| 101 | uint8_tcxx . . $ uint8_t# n_hostilescxx . . $ tMusicSeqInfo#n_hostiles.; // number of hostiles |
| 102 | uint8_tcxx . . $ uint8_t# n_hostiles_player_killedcxx . . $ tMusicSeqInfo#n_hostiles_player_killed.; // number hostiles killed by player this frame. |
| 103 | uint8_tcxx . . $ uint8_t# padcxx . . $ tMusicSeqInfo#pad.; |
| 104 | |
| 105 | float frametimecxx . . $ tMusicSeqInfo#frametime.; // frame time. |
| 106 | |
| 107 | // OUTPUT |
| 108 | int16_tcxx . . $ int16_t# cur_songcxx . . $ tMusicSeqInfo#cur_song.; // current song. |
| 109 | float peace_timercxx . . $ tMusicSeqInfo#peace_timer.; // current peace timer |
| 110 | |
| 111 | const char *cur_loop_namecxx . . $ tMusicSeqInfo#cur_loop_name.; // current loop playing (NULL if none.) |
| 112 | int cur_loop_countcxx . . $ tMusicSeqInfo#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 tMusicSeqInfocxx . . $ tMusicSeqInfo# Game_music_infocxx . . $ Game_music_info.; |
| 118 | |
| 119 | #ifdef _DEBUGcxx . . $ `<built-in>:482:9`! |
| 120 | // if true, turns on debugging for music. |
| 121 | extern bool Music_debug_verbosecxx . . $ Music_debug_verbose.; |
| 122 | #endif |
| 123 | |
| 124 | // Music extensions |
| 125 | void InitD3Musiccxx . . $ InitD3Music(b45ddcbc8423892c).(bool allow_music); |
| 126 | |
| 127 | // closes music system |
| 128 | void CloseD3Musiccxx . . $ CloseD3Music(49f6e7a06ebc5aa8).(); |
| 129 | |
| 130 | // starts up the music sequencer |
| 131 | void D3MusicStartcxx . . $ D3MusicStart(85c52e162fed56f9).(const char *theme_file); |
| 132 | |
| 133 | // stops the music sequencer |
| 134 | void D3MusicStopcxx . . $ D3MusicStop(49f6e7a06ebc5aa8).(); |
| 135 | |
| 136 | // execute music sequencer. |
| 137 | void D3MusicDoFramecxx . . $ D3MusicDoFrame(54ecf43cdccad508).(tMusicSeqInfocxx . . $ tMusicSeqInfo# *music_info); |
| 138 | |
| 139 | // toggle music system. |
| 140 | void D3MusicTogglecxx . . $ D3MusicToggle(49f6e7a06ebc5aa8).(); |
| 141 | |
| 142 | // toggle music system. |
| 143 | void D3MusicTogglecxx . . $ D3MusicToggle(b45ddcbc8423892c).(bool state); |
| 144 | |
| 145 | // pauses and or resumes music |
| 146 | void D3MusicPausecxx . . $ D3MusicPause(49f6e7a06ebc5aa8).(); |
| 147 | void D3MusicResumecxx . . $ D3MusicResume(49f6e7a06ebc5aa8).(); |
| 148 | |
| 149 | // returns true if music system is on. |
| 150 | bool IsD3MusicOncxx . . $ IsD3MusicOn(c9857a73d68e59ba).(); |
| 151 | |
| 152 | // set music region |
| 153 | void D3MusicSetRegioncxx . . $ D3MusicSetRegion(472b8ebd11b2ca81).(int16_tcxx . . $ 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_tcxx . . $ int16_t# D3MusicGetRegioncxx . . $ D3MusicGetRegion(4c3706f7850cf040).(); |
| 158 | |
| 159 | // retreives current pending region |
| 160 | int16_tcxx . . $ int16_t# D3MusicGetPendingRegioncxx . . $ D3MusicGetPendingRegion(4c3706f7850cf040).(); |
| 161 | |
| 162 | // starts special in-game cinematic music |
| 163 | void D3MusicStartCinematiccxx . . $ D3MusicStartCinematic(49f6e7a06ebc5aa8).(); |
| 164 | |
| 165 | // stops special in-game cinematic music |
| 166 | void D3MusicStopCinematiccxx . . $ D3MusicStopCinematic(49f6e7a06ebc5aa8).(); |
| 167 | |
| 168 | // volume stuff |
| 169 | float D3MusicGetVolumecxx . . $ D3MusicGetVolume(9b8c9e39889c762c).(); |
| 170 | void D3MusicSetVolumecxx . . $ D3MusicSetVolume(9364e6e7bff7660).(float vol); |
| 171 | |
| 172 | #endif |