Descent3/lib/d3music.h

154 lines
4.0 KiB
C
Raw Normal View History

2024-04-16 03:43:29 +00:00
/*
* $Source: $
* $Revision: 14 $
* $Author: Samir $
* $Date: 3/27/99 4:45p $
*
* D3 Music System
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* $Log: /DescentIII/Main/Lib/d3music.h $
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 14 3/27/99 4:45p Samir
* reinstate pause music when pausing game.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 13 3/23/99 9:07p Samir
* turn on and off music when pausing and resuming game, if appropriate.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 12 3/18/99 10:13a Samir
* msuic update.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 11 2/27/99 8:23p Samir
* fixes to music system to act nicely to sudden and frequent region
* changes.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 10 2/27/99 6:51p Samir
* added code for music tester to display current stream and loop/region.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 9 2/27/99 4:37p Samir
* return name of loop currently playing.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 8 2/19/99 10:31p Samir
* added music volume.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 7 2/18/99 6:47p Jeff
* added call to start/stop special cinematics music
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 6 1/28/99 2:22p Samir
* simplified music system for D3.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 5 1/07/99 12:28p Samir
* Call to InitD3Music added parameter.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 4 12/07/98 11:44a Samir
* added new themes.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 3 12/03/98 12:49p Samir
* added positive and negative mood timers.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 2 11/20/98 5:23p Samir
* pass mood register to sequencer.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
* 1 11/13/98 2:30p Samir
* initial rev.
2024-04-16 18:56:40 +00:00
*
2024-04-16 03:43:29 +00:00
*/
#ifndef D3MUSIC_H
#define D3MUSIC_H
#include "pstypes.h"
// register constants for the sequencer
2024-04-16 18:56:40 +00:00
#define MUSICREG_TRIGGER_VALUE 1 // trigger value set by calling app to sequencer
2024-04-16 03:43:29 +00:00
//@@#define MUSICREG_MOOD_VALUE 2 // current mood of player stored here.
//@@#define MUSICREG_NEGMOOD_TIMER 3 // time in negative mood
//@@#define MUSICREG_POSMOOD_TIMER 4 // time in positive mood
2024-04-16 18:56:40 +00:00
#define MUSICREG_PEACE_TIMER 5 // amount of time in 'non-combat' mode.
2024-04-16 03:43:29 +00:00
// types of triggers
2024-04-16 18:56:40 +00:00
#define MUSICTRIGGER_NONE 0
#define MUSICTRIGGER_NEWREGION 1 // player entered new region
2024-04-16 03:43:29 +00:00
2024-04-16 18:56:40 +00:00
extern const char *Music_type_names[]; // contains type names.
2024-04-16 03:43:29 +00:00
// structure passed to music frame
2024-04-16 18:56:40 +00:00
typedef struct tMusicSeqInfo {
// INPUT
bool started_level; // player started level
bool player_dead; // did player die?
bool player_damaged; // was player hit by enemy fire?
bool player_invulnerable; // is player invulnerable?
bool player_terrain; // is player in terrain (if not, in mine)
ubyte player_shield_level; // what shield level the player is at? (0-10)
ubyte n_hostiles; // number of hostiles
ubyte n_hostiles_player_killed; // number hostiles killed by player this frame.
ubyte pad;
float frametime; // frame time.
// OUTPUT
short cur_song; // current song.
float peace_timer; // current peace timer
const char *cur_loop_name; // current loop playing (NULL if none.)
int cur_loop_count;
} tMusicSeqInfo;
// this is located in gameloop.cpp. kept here so files that need this data structure don't have to include
2024-04-16 03:43:29 +00:00
// gameloop (and to stop gameloop.h from including d3music.h)
extern tMusicSeqInfo Game_music_info;
#ifdef _DEBUG
// if true, turns on debugging for music.
extern bool Music_debug_verbose;
#endif
// Music extensions
void InitD3Music(bool allow_music);
// closes music system
void CloseD3Music();
// starts up the music sequencer
void D3MusicStart(const char *theme_file);
// stops the music sequencer
void D3MusicStop();
// execute music sequencer.
void D3MusicDoFrame(tMusicSeqInfo *music_info);
// toggle music system.
void D3MusicToggle();
// toggle music system.
void D3MusicToggle(bool state);
// pauses and or resumes music
void D3MusicPause();
void D3MusicResume();
// returns true if music system is on.
bool IsD3MusicOn();
// set music region
2024-04-16 18:56:40 +00:00
void D3MusicSetRegion(short region, bool immediate = false);
2024-04-16 03:43:29 +00:00
// retreives current region (can be different than regin passed to D3MusicSetRegion),
// returns current played region, not waiting region.
short D3MusicGetRegion();
// retreives current pending region
short D3MusicGetPendingRegion();
// starts special in-game cinematic music
void D3MusicStartCinematic();
// stops special in-game cinematic music
void D3MusicStopCinematic();
// volume stuff
float D3MusicGetVolume();
void D3MusicSetVolume(float vol);
#endif