mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-06-02 02:53:32 +02:00
98ef7a8675
musicclass::init() re-initializes every attribute of musicclass unnecessarily, when initialization should be put in a constructor instead. This is bad, because music.init() gets called whenever we enter and exit a custom level that has assets. Otherwise, this would result in a bug where music.usingmmmmmm would be reset, causing you to revert to PPPPPP on the title screen whenever you enter a level with MMMMMM selected and exit it. This also causes a confusing desync between game.usingmmmmmm and music.usingmmmmmm since the values of the two variables are now different (these duplicate variables should probably be removed, too, and a lot of other duplicate variables like these exist, too, which are a real headache). Which means despite MMMMMM playing on the title screen, exiting the game and re-launching it will play PPPPPP instead. What's even more is that going to game options and switching to PPPPPP will play PPPPPP, but afterwards launching and re-entering will play MMMMMM. Again, having duplicate variables is very bad, and should probably be fixed, but that's a separate patch.
66 lines
1.1 KiB
C++
66 lines
1.1 KiB
C++
#ifndef MUSIC_H
|
|
#define MUSIC_H
|
|
|
|
#include <vector>
|
|
|
|
#include "BinaryBlob.h"
|
|
#include "SoundSystem.h"
|
|
|
|
#define musicroom(rx, ry) ((rx) + ((ry) * 20))
|
|
|
|
class musicclass
|
|
{
|
|
public:
|
|
musicclass();
|
|
void init();
|
|
|
|
void play(int t, const double position_sec = 0.0, const int fadein_ms = 3000);
|
|
void resume(const int fadein_ms = 0);
|
|
void haltdasmusik();
|
|
void silencedasmusik();
|
|
void fadeMusicVolumeIn(int ms);
|
|
void fadeout(const bool quick_fade_ = true);
|
|
void fadein();
|
|
void processmusicfadein();
|
|
void processmusic();
|
|
void niceplay(int t);
|
|
|
|
void changemusicarea(int x, int y);
|
|
|
|
int currentsong;
|
|
int resumesong;
|
|
|
|
void playef(int t);
|
|
|
|
std::vector<SoundTrack> soundTracks;
|
|
std::vector<MusicTrack> musicTracks;
|
|
SoundSystem soundSystem;
|
|
bool safeToProcessMusic;
|
|
|
|
int nicechange; // -1 if no song queued
|
|
bool nicefade;
|
|
|
|
bool m_doFadeInVol;
|
|
int FadeVolAmountPerFrame;
|
|
int musicVolume;
|
|
|
|
bool quick_fade;
|
|
|
|
// MMMMMM mod settings
|
|
bool mmmmmm;
|
|
bool usingmmmmmm;
|
|
|
|
binaryBlob musicReadBlob;
|
|
int num_pppppp_tracks;
|
|
int num_mmmmmm_tracks;
|
|
|
|
Uint64 songStart;
|
|
Uint64 songEnd;
|
|
};
|
|
|
|
#ifndef MUSIC_DEFINITION
|
|
extern musicclass music;
|
|
#endif
|
|
|
|
#endif /* MUSIC_H */
|