-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMidiPlayer.cpp
55 lines (48 loc) · 1.27 KB
/
MidiPlayer.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "MidiPlayer.h"
//Handling of the Midi tracks
SoundtrackList slMidi("Midi", "SoundtrackList.json");
SoundtrackList slMidiPos("Pos", "SoundtrackList.json");
bool MidiPlayer::GetSoundtrack()
{
if (EventPlaying)
return true;
if (xsection)
soundtrackData = slMidiPos.GetData(gameData->World.c_str(), (gameData->Level + std::to_string(xsection)).c_str());
else
soundtrackData = slMidi.GetData(gameData->World.c_str(), gameData->Level.c_str());
return soundtrackData->FileName != "";
}
void MidiPlayer::updateBossEventChange(){
//Handle the victory jingle when defeating a boss!
if (gameData->BossEvent) {
soundtrackData = slMidi.GetData("RAY1.WLD", "Victory");
EventPlaying = true;
Play();
}
else {
EventPlaying = false;
}
}
void MidiPlayer::updateXAxis()
{
//Mr Stones Chase Level
if (gameData->World == "RAY3.WLD" && gameData->Level == "RAY2.LEV") {
//Phase where Mr Stones tries to crush Rayman
if (((1930 < gameData->XAxis && gameData->XAxis < 4525) || (5670 < gameData->XAxis && gameData->XAxis < 6670))) {
if (xsection != 1) {
xsection = 1;
updateInLevelChange();
}
}
else if (xsection != 0) {
xsection = 0; //Reset the section if not being chased anymore!
Stop();
}
}
else {
xsection = 0;
}
}
void MidiPlayer::updateYAxis()
{
}