#import "data/scripts/music.c"
void main(){
musicReturn();
}
void musicReturn()
{//Start all tasks
if(openborvariant("in_titlescreen")){
//FLAG USED TO INDICATE IF THE LEVEL MUSIC IS STOPPED TO THE "MUSICSTAGE.C" FUNCTIONS
if(getglobalvar("musicStopped") != 1){setglobalvar("musicStopped", 1);}
if(getglobalvar("musicStyle") == NULL()){setglobalvar("musicStyle", 0);}
}
//DETECT MANY DIFFERENT EVENTS AND PLAY THE PROPER MUSIC
musicEvents();
if(openborvariant("in_level")){
//RESTART MUSICS EVERYTIME THE SOUND MENU IS ACCESSED
//USED BECAUSE SCRIPTED MUSICS DON'T RESTARTS AUTOMATICALLY IF THE PLAYER DISABLE/ENABLE IT IN THE SOUND MENU
if(openborvariant("pause") && openborvariant("in_sound_options")){
if(getglobalvar("soundMenu") == NULL()){setglobalvar("soundMenu", 1);}
}
else
if(!openborvariant("pause")){
if(getglobalvar("soundMenu") != NULL()){musicReplay();setglobalvar("soundMenu", NULL());}
}
}
if(openborvariant("current_scene") == "data/scenes/howto.txt"){
musicMenu();
}
}
void musicMenu()
{//Draw a Menu in/out game
//DRAW MENU
if(openborvariant("current_scene") == "data/scenes/howto.txt"){
void str;
float hRes = openborvariant("hresolution");
int mStyle = getglobalvar("musicStyle");
int align;
int xDif = 10; //DIFFERENCE BETWEEN THE FIRST AND SECOND COLUMNS
int xPos1 = (hRes/2)-xDif; //BASE X POSITION, FIRST COLUMN (HIGHLIGHTED OPTIONS NAME)
int xPos2 = (hRes/2)+xDif; //BASE X POSITION, SECOND COLUMN (HIGHLIGHTED OPTIONS CHANGE)
int yPos = 60; //BASE Y POSITION FOR ALL MENU CONTENT, USE THIS TO MOVE ALL OPTIONS TOGETHER
int font = 0; //ALL FONTS BELOW CHANGES FROM 0 TO 1 IF THE OPTION IS HIGHLIGHTED
int layer = 1000000003;
//OPTION TITLE
str = "Music_Style:";align = xPos1-strwidth(str, font);
drawstring(align, yPos, font, str, layer);
//OPTION NAME
if(mStyle == 0){str = "Green";}
if(mStyle == 1){str = "Red";}
if(mStyle == 2){str = "Blue";}
drawstring(xPos2, yPos, font, str, layer);
}
}
void musicEvents()
{
if(openborvariant("in_titlescreen")){
//CHECK THE CURRENT MUSIC TO PLAY IT ONCE
if(getglobalvar("musicPlaying") != "title.bor"){
musicTitle();
}
}
if(openborvariant("in_selectscreen")){
//CHECK THE CURRENT MUSIC TO PLAY IT ONCE
if(getglobalvar("musicPlaying") != "select.bor"){
musicSelect();
}
}
if(openborvariant("in_showcomplete")){
//CHECK THE CURRENT MUSIC TO PLAY IT ONCE
if(getglobalvar("musicPlaying") != "finish.bor"){
musicFinish();
}
}
if(openborvariant("in_gameoverscreen") || openborvariant("current_scene") == "data/scenes/gameover.txt"){
//CHECK THE CURRENT MUSIC TO PLAY IT ONCE
if(getglobalvar("musicPlaying") != "gameova.bor"){
musicGameova();
}
}
}