Fixed primitives, improved sound tracks management, now it's possbile to add a custom tracks for Shop section (Track2.mp3), Option window (Track3.mp3) and Awards section (Track4.mp3) and it's also possible to add two subfolders "MainMenu" and "Battlefield" within "suound" folder where it's possbile to add twenty custom songs ("TrackMenuXX.mp3" and "TrackDuelXX.mp3") that will be played randomly in main menu windows and when match starts.
This commit is contained in:
@@ -550,6 +550,9 @@ void GameApp::playMusic(string filename, bool loop)
|
||||
if (filename.compare(currentMusicFile) == 0 && music)
|
||||
return;
|
||||
|
||||
if(!WResourceManager::Instance()->ssLoadMusic(filename.c_str()))
|
||||
return; // Added to avoid opening not existing file.
|
||||
|
||||
if (music)
|
||||
{
|
||||
JSoundSystem::GetInstance()->StopMusic(music);
|
||||
|
||||
@@ -147,6 +147,8 @@ void GameStateAwards::Start()
|
||||
detailview = NULL;
|
||||
setSrc = NULL;
|
||||
showMenu = false;
|
||||
|
||||
GameApp::playMusic("Track4.mp3"); // Added music for trophies.
|
||||
}
|
||||
|
||||
void GameStateAwards::Create()
|
||||
|
||||
@@ -770,16 +770,27 @@ void GameStateDuel::Update(float dt)
|
||||
sprintf(temp, "ai_baka_music%i.mp3", OpponentsDeckid);
|
||||
musictrack.assign(temp);
|
||||
}
|
||||
else if (mParent->gameType == GAME_TYPE_CLASSIC || mParent->gameType == GAME_TYPE_COMMANDER)
|
||||
musictrack = "ai_baka_music.mp3";
|
||||
else if (mParent->gameType == GAME_TYPE_MOMIR)
|
||||
musictrack = "ai_baka_music_momir.mp3";
|
||||
else if (mParent->gameType == GAME_TYPE_RANDOM1 || mParent->gameType == GAME_TYPE_RANDOM2) musictrack
|
||||
= "ai_baka_music_random.mp3";
|
||||
else if (mParent->gameType == GAME_TYPE_RANDOM3 || mParent->gameType == GAME_TYPE_RANDOM5) musictrack
|
||||
= "ai_baka_music_random.mp3";
|
||||
else if (mParent->gameType == GAME_TYPE_HORDE || mParent->gameType == GAME_TYPE_SET_LIMITED) musictrack
|
||||
= "ai_baka_music_momir.mp3";
|
||||
// Now it's possibile to use up to 20 sound tracks for duels.
|
||||
if (!MusicExist(musictrack)){
|
||||
char temp[4096];
|
||||
sprintf(temp, "Battlefield/TrackDuel%i.mp3", std::rand() % 20);
|
||||
musictrack.assign(temp);
|
||||
}
|
||||
// Try if there is a sound track for specific game type.
|
||||
if (!MusicExist(musictrack)){
|
||||
if (mParent->gameType == GAME_TYPE_CLASSIC)
|
||||
musictrack = "ai_baka_music.mp3";
|
||||
else if (mParent->gameType == GAME_TYPE_COMMANDER)
|
||||
musictrack = "ai_baka_music_commander.mp3";
|
||||
else if (mParent->gameType == GAME_TYPE_MOMIR)
|
||||
musictrack = "ai_baka_music_momir.mp3";
|
||||
else if (mParent->gameType == GAME_TYPE_RANDOM1 || mParent->gameType == GAME_TYPE_RANDOM2 || mParent->gameType == GAME_TYPE_RANDOM3 || mParent->gameType == GAME_TYPE_RANDOM5)
|
||||
musictrack = "ai_baka_music_random.mp3";
|
||||
else if (mParent->gameType == GAME_TYPE_HORDE)
|
||||
musictrack = "ai_baka_music_horde.mp3";
|
||||
else if (mParent->gameType == GAME_TYPE_SET_LIMITED)
|
||||
musictrack = "ai_baka_music_limited.mp3";
|
||||
}
|
||||
if (!MusicExist(musictrack))
|
||||
musictrack = "ai_baka_music.mp3";
|
||||
|
||||
|
||||
@@ -141,8 +141,15 @@ void GameStateMenu::Start()
|
||||
subMenuController = NULL;
|
||||
SAFE_DELETE(mGuiController);
|
||||
|
||||
GameApp::playMusic("Track0.mp3");
|
||||
|
||||
char temp[4096];
|
||||
string musicFilename = "";
|
||||
sprintf(temp, "MainMenu/TrackMenu%i.mp3", std::rand() % 20); // Now it's possibile to use up to 20 sound tracks for main menu.
|
||||
musicFilename.assign(temp);
|
||||
musicFilename = WResourceManager::Instance()->musicFile(musicFilename);
|
||||
if (musicFilename.length() < 1 || !FileExists(musicFilename))
|
||||
musicFilename = "Track0.mp3";
|
||||
GameApp::playMusic(musicFilename);
|
||||
|
||||
hasChosenGameType = false;
|
||||
mParent->gameType = GAME_TYPE_CLASSIC;
|
||||
|
||||
|
||||
@@ -142,6 +142,8 @@ void GameStateOptions::Start()
|
||||
optionsMenu->Add(kCancelMenuID, "Cancel");
|
||||
|
||||
optionsTabs->Entering(JGE_BTN_NONE);
|
||||
|
||||
GameApp::playMusic("Track3.mp3"); // Added music for options.
|
||||
}
|
||||
|
||||
void GameStateOptions::End()
|
||||
|
||||
@@ -147,6 +147,8 @@ void GameStateShop::Start()
|
||||
pspIcons[i]->SetHotSpot(16, 16);
|
||||
}
|
||||
|
||||
GameApp::playMusic("Track2.mp3"); // Added music for shop.
|
||||
|
||||
JRenderer::GetInstance()->EnableVSync(true);
|
||||
|
||||
taskList = NULL;
|
||||
|
||||
Reference in New Issue
Block a user