diff --git a/binaries/data/mods/public/gui/common/functions_page_pregame.js b/binaries/data/mods/public/gui/common/functions_page_pregame.js index 6cc26d0712..fc837d895a 100644 --- a/binaries/data/mods/public/gui/common/functions_page_pregame.js +++ b/binaries/data/mods/public/gui/common/functions_page_pregame.js @@ -13,12 +13,12 @@ function startMainMenu() guiUnHide ("pg"); // Play main 0 A.D. theme when the main menu starts. - curr_music = newRandomSound("music", "menu"); - if (curr_music) - curr_music.loop(); + global.curr_music = newRandomSound("music", "menu"); + if (global.curr_music) + global.curr_music.loop(); // Set starting volume (I'm using a value of zero here for no sound; feel free to comment out these two lines to use defaults). -// curr_music.setGain (0.0); +// global.curr_music.setGain (0.0); // g_ConfigDB.system["sound.mastergain"] = 0.0; } diff --git a/binaries/data/mods/public/gui/common/functions_utility_list.js b/binaries/data/mods/public/gui/common/functions_utility_list.js index 5eed662685..73476e6ea8 100644 --- a/binaries/data/mods/public/gui/common/functions_utility_list.js +++ b/binaries/data/mods/public/gui/common/functions_utility_list.js @@ -145,7 +145,7 @@ function setCurrItemValue (objectName, string) return -1; // Return -1 if nothing selected. var list = getGUIObjectByName(objectName).list; // Seek through list. - for (ctr = 0; ctr < list.length; ctr++) + for (var ctr = 0; ctr < list.length; ctr++) { // If we have found the string in the list, if (list[ctr] == string) @@ -161,4 +161,4 @@ function setCurrItemValue (objectName, string) return -2; } -// ==================================================================== \ No newline at end of file +// ==================================================================== diff --git a/binaries/data/mods/public/gui/common/functions_utility_music.js b/binaries/data/mods/public/gui/common/functions_utility_music.js index fe4128303d..49eb8c8ea7 100644 --- a/binaries/data/mods/public/gui/common/functions_utility_music.js +++ b/binaries/data/mods/public/gui/common/functions_utility_music.js @@ -47,7 +47,7 @@ function newRandomSound(soundType, soundSubType, soundPrePath) if (soundArray.length == 0) { console.write ("Failed to find sounds matching '*"+soundSubType+"*'"); - return; + return undefined; } // Get a random number within the sound's range. var randomSound = getRandom (0, soundArray.length-1); @@ -103,4 +103,4 @@ function crossFade (outHandle, inHandle, fadeDuration) return true; } -// ==================================================================== \ No newline at end of file +// ==================================================================== diff --git a/binaries/data/mods/public/gui/loading/loading.js b/binaries/data/mods/public/gui/loading/loading.js index 1a4464acad..adf88b4e67 100644 --- a/binaries/data/mods/public/gui/loading/loading.js +++ b/binaries/data/mods/public/gui/loading/loading.js @@ -38,8 +38,8 @@ function init(data) function reallyStartGame() { // Stop the music - if (typeof curr_music != "undefined" && curr_music) - curr_music.fade(-1, 0.0, 5.0); // fade to 0 over 5 seconds + if (global.curr_music) + global.curr_music.fade(-1, 0.0, 5.0); // fade to 0 over 5 seconds // This is a reserved function name that is executed by the engine when it is ready // to start the game (i.e. loading progress has reached 100%). @@ -50,4 +50,3 @@ function reallyStartGame() // Restore default cursor. setCursor ("arrow-default"); } - diff --git a/binaries/data/mods/public/gui/pregame/mainmenu.xml b/binaries/data/mods/public/gui/pregame/mainmenu.xml index 1be62eb17e..bb7275eb92 100644 --- a/binaries/data/mods/public/gui/pregame/mainmenu.xml +++ b/binaries/data/mods/public/gui/pregame/mainmenu.xml @@ -3,7 +3,7 @@