2020-01-01 21:29:24 +01:00
|
|
|
#ifndef MUSIC_H
|
|
|
|
#define MUSIC_H
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
|
2020-07-19 21:43:29 +02:00
|
|
|
#include "BinaryBlob.h"
|
|
|
|
#include "SoundSystem.h"
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
#define musicroom(rx, ry) ((rx) + ((ry) * 20))
|
|
|
|
|
2021-04-12 02:41:46 +02:00
|
|
|
/* The amount of "space" for the scale of the user-set volume. */
|
|
|
|
#define USER_VOLUME_MAX 256
|
|
|
|
|
2021-04-12 02:43:17 +02:00
|
|
|
/* It is advised that USER_VOLUME_MAX be divisible by this. */
|
|
|
|
#define USER_VOLUME_STEP 32
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
class musicclass
|
|
|
|
{
|
|
|
|
public:
|
2021-09-07 03:56:39 +02:00
|
|
|
musicclass(void);
|
|
|
|
void init(void);
|
|
|
|
void destroy(void);
|
|
|
|
|
|
|
|
void play(int t);
|
|
|
|
void resume();
|
|
|
|
void resumefade(const int fadein_ms);
|
|
|
|
void pause(void);
|
|
|
|
void haltdasmusik(void);
|
|
|
|
void silencedasmusik(void);
|
|
|
|
void fadeMusicVolumeIn(int ms);
|
|
|
|
void fadeMusicVolumeOut(const int fadeout_ms);
|
|
|
|
void fadeout(const bool quick_fade_ = true);
|
|
|
|
void fadein(void);
|
|
|
|
void processmusicfadein(void);
|
|
|
|
void processmusicfadeout(void);
|
|
|
|
void processmusic(void);
|
|
|
|
void niceplay(int t);
|
|
|
|
|
|
|
|
void changemusicarea(int x, int y);
|
|
|
|
|
|
|
|
int currentsong;
|
|
|
|
|
|
|
|
void playef(int t);
|
|
|
|
void pauseef(void);
|
|
|
|
void resumeef(void);
|
|
|
|
|
2021-09-11 04:35:29 +02:00
|
|
|
bool halted(void);
|
|
|
|
|
2021-09-07 03:56:39 +02:00
|
|
|
std::vector<SoundTrack> soundTracks;
|
|
|
|
std::vector<MusicTrack> musicTracks;
|
|
|
|
SoundSystem soundSystem;
|
|
|
|
bool safeToProcessMusic;
|
|
|
|
|
|
|
|
int nicechange; // -1 if no song queued
|
|
|
|
bool nicefade;
|
|
|
|
|
|
|
|
bool m_doFadeInVol;
|
|
|
|
bool m_doFadeOutVol;
|
|
|
|
int musicVolume;
|
|
|
|
|
|
|
|
/* 0..USER_VOLUME_MAX */
|
|
|
|
int user_music_volume;
|
|
|
|
int user_sound_volume;
|
|
|
|
|
|
|
|
bool quick_fade;
|
|
|
|
|
|
|
|
// MMMMMM mod settings
|
|
|
|
bool mmmmmm;
|
|
|
|
bool usingmmmmmm;
|
|
|
|
|
|
|
|
binaryBlob pppppp_blob;
|
|
|
|
binaryBlob mmmmmm_blob;
|
|
|
|
int num_pppppp_tracks;
|
|
|
|
int num_mmmmmm_tracks;
|
2020-01-01 21:29:24 +01:00
|
|
|
};
|
|
|
|
|
2020-09-28 04:15:06 +02:00
|
|
|
#ifndef MUSIC_DEFINITION
|
Allow using help/graphics/music/game/key/map/obj everywhere
This commit makes `help`, `graphics`, `music`, `game`, `key`, `map`, and
`obj` essentially static global objects that can be used everywhere.
This is useful in case we ever need to add a new function in the future,
so we don't have to bother with passing a new argument in which means we
have to pass a new argument in to the function that calls that function
which means having to pass a new argument into the function that calls
THAT function, etc. which is a real headache when working on fan mods of
the source code.
Note that this changes NONE of the existing function signatures, it
merely just makes those variables accessible everywhere in the same way
`script` and `ed` are.
Also note that some classes had to be initialized after the filesystem
was initialized, but C++ would keep initializing them before the
filesystem got initialized, because I *had* to put them at the top of
`main.cpp`, or else they wouldn't be global variables.
The only way to work around this was to use entityclass's initialization
style (which I'm pretty sure entityclass of all things doesn't need to
be initialized this way), where you actually initialize the class in an
`init()` function, and so then you do `graphics.init()` after the
filesystem initialization, AFTER doing `Graphics graphics` up at the
top.
I've had to do this for `graphics` (but only because its child
GraphicsResources `grphx` needs to be initialized this way), `music`,
and `game`. I don't think this will affect anything. Other than that,
`help`, `key`, and `map` are still using the C++-intended method of
having ClassName::ClassName() functions.
2020-01-29 08:35:03 +01:00
|
|
|
extern musicclass music;
|
2020-09-28 04:15:06 +02:00
|
|
|
#endif
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
#endif /* MUSIC_H */
|