-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBGMPlayer.cpp
85 lines (78 loc) · 2.15 KB
/
BGMPlayer.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "BGMPlayer.h"
//Background Music handler
SoundtrackList sl("BGM", "SoundtrackList.json");
SoundtrackList slPos("Pos", "SoundtrackList.json");
bool BGMPlayer::GetSoundtrack()
{
if (EventPlaying)
return false;
if (xsection + ysection)
soundtrackData = slPos.GetData(gameData->World.c_str(), (gameData->Level + std::to_string(xsection + ysection)).c_str());
else
soundtrackData = sl.GetData(gameData->World.c_str(), gameData->Level.c_str());
return soundtrackData->FileName != "";
}
void BGMPlayer::updateXAxis()
{
//Flight with Mosquito Level
if (gameData->World == "RAY1.WLD" && gameData->Level == "RAY7.LEV") {
//Phase when Bzzit behaves like a friend
if ((gameData->XAxis < 4850 || gameData->XAxis > 9250) && xsection != 1) {
xsection = 1;
updateInLevelChange(); //Final checks before letting the track play
}
//Phase when Bzzit tries to kill Rayman again
else if (gameData->XAxis > 4850 && gameData->XAxis < 9250 && xsection != 2) {
xsection = 2;
updateInLevelChange();
}
}
else {
xsection = 0;
}
}
void BGMPlayer::updateYAxis()
{
if (gameData->World == "RAY1.WLD") {
//Bzzit attacks level
if (gameData->Level == "RAY6.LEV") {
//Phase were Rayman tries to commit suicide by jumping into the abyss
if (gameData->YAxis < 830 && ysection != 1) {
ysection = 1;
updateInLevelChange();
}
//Phase were Bzzit tries to help Rayman in getting killed
else if (gameData->YAxis > 830 && ysection != 2) {
ysection = 2;
updateInLevelChange();
}
}
//Tarayzan level
else if (gameData->Level == "RAY9.LEV") {
//Phase were Rayman helps Tarayzan getting dressed
if (gameData->YAxis > 2650 && ysection != 1) {
ysection = 1;
updateInLevelChange();
}
//Phase were Tarayzan showing his gratitude by letting Rayman getting drown
else if (gameData->YAxis < 2650 && ysection != 2) {
ysection = 2;
updateInLevelChange();
}
}
else {
ysection = 0;
}
}
else {
ysection = 0;
}
}
void BGMPlayer::updateBossEventChange() {
//Just stop the track if boss battle is won, to let Midi handle the funny jingle
if (gameData->BossEvent)
Fade();
}
void BGMPlayer::updateWorldLoading()
{
}