make music civ specific

This was SVN commit r9429.
This commit is contained in:
WhiteTreePaladin 2011-05-04 19:31:01 +00:00
parent da40ea8e2c
commit dd264f46cf
8 changed files with 76 additions and 17 deletions

View File

@ -3,6 +3,13 @@
"Name": "Carthaginians",
"Emblem": "session/portraits/emblems/emblem_carthaginians.png",
"History": "Carthage was founded in either 814 B.C. or 813 B.C. by a Tyrian Princess named Elissa or Dido. The culture spanned over seven hundred years. In 146 B.C., Carthage (the center of civilsation) was brought to its knees by the Romans. They are probably best known for the usage of elephants in battle. Not only did they ferry them across the Mediterranean, but they were also taken through the alps for a sly attack from the north of Rome. The Carthaginians were most active in the 4th and 3rd centuries B.C. Some famous Carthaginians were: Hamilcar Barca (who fought in the First Punic War), his son Hannibal Barca, and Maharbal (Hannibals cavalry commander). Some famous battles were: Acragas in 406 B.C., Zama in 202 B.C., and the Siege of Carthage 148-146 B.C.",
"Music":[
{"File":"germanic_peace_1.ogg", "Type":"peace"},
{"File":"germanic_peace_2.ogg", "Type":"peace"},
{"File":"germanic_peace_3.ogg", "Type":"peace"},
{"File":"carthaginian_battle_1.ogg", "Type":"battle"},
{"File":"carthaginian_battle_2.ogg", "Type":"battle"}
],
"Factions":
[
{

View File

@ -3,6 +3,9 @@
"Name": "Celts",
"Emblem": "session/portraits/emblems/emblem_celts.png",
"History": "At its peak (around 200 B.C.), the massive Celtic Empire spanned from Spain to Romania and Northern Italy to Scotland; although it wasnt a true empire because the Celtic people were not united by any form of government, but only in language and various social aspects. Their lack of any cohesion was probably the largest contributing factor to their ultimate submission to Rome by 100 A.D. The other contributing factors were their lack of armour and their inability to counter the mighty legions and siege weapons of Rome.",
"Music":[
{"File":"celts_peace_1.ogg", "Type":"peace"}
],
"Factions":
[
{
@ -138,4 +141,4 @@
"Template": "units/celt_cavalry_swordsman_e"
}
]
}
}

View File

@ -3,6 +3,10 @@
"Name":"Hellenes",
"Emblem":"session/portraits/emblems/emblem_hellenes.png",
"History":"The Hellenes were a people famous today for their architecture, fighting ability, and culture. The Hellenic peoples of the Dorian, Ionian, and Aeolian tribes swept into modern day Greece from 3000 BC to around 1100 BC in successive waves that eventually supplanted the previously established cultures of Mycenae and Minoan Crete. They were most active during the period of colonization that took place in the 7th and 6th centuries BC, the Greco-Persian Wars (499-449 BC), the Peloponnesian War (431-404 BC), and the conquests of Alexander the Great (4th Century BC). Their civilization would endure until their final absorption by Rome in 146 BC.",
"Music":[
{"File":"hellenes_peace_1.ogg", "Type":"peace"},
{"File":"hellenic_battle_2.ogg", "Type":"battle"}
],
"Factions":
[
{
@ -156,4 +160,4 @@
"Template":"units/hele_cavalry_swordsman_e"
}
]
}
}

View File

@ -3,6 +3,9 @@
"Name": "Iberians",
"Emblem": "session/portraits/emblems/emblem_iberians.png",
"History": "No one really knows when the Iberians appeared as a people, though first contact with them came in 1100 B.C. with the establishment of a trading post by the Phoenicians. They were a relatively peaceful culture, and when they fought it fighting in other's battles as mercenaries. When they fought their won battle, they proved tenacious when Rome sought to take their land and freedom away from them. Yet, the Iberians were put in submission once and for all by the Romans in 18 B.C.",
"Music":[
{"File":"iberians_peace_1.ogg", "Type":"peace"}
],
"Factions":
[
{
@ -83,4 +86,4 @@
"StartEntities":
[
]
}
}

View File

@ -3,6 +3,10 @@
"Name": "Persians",
"Emblem": "session/portraits/emblems/emblem_persians.png",
"History": "The Persians originally came from beyond the Zargos Mountains and moved into what is now Iran sometime in the first millennium B.C. They began their rise to power when Cyrus the Great led a revolt against the Median Empire, he would go on to conquer everything he possibly could. By the time of his death in 529 B.C. Cyrus had created the greatest empire thus far seen in the ancient world. In 0 AD we will cover the Achaemenid dynasty of Persia, this dynasty was ended by the conquests of Alexander the Great starting with the Greek victory the Battle of Granicus in 334 B.C.",
"Music":[
{"File":"persian_peace_1.ogg", "Type":"peace"},
{"File":"persian_battle_1.ogg", "Type":"battle"}
],
"Factions":
[
{

View File

@ -3,6 +3,11 @@
"Name": "Romans",
"Emblem": "session/portraits/emblems/emblem_romans.png",
"History": "The Romans controlled the largest empire of the ancient world. Rising from a group of villages to controlling an empire stretching from southern Scotland to the Sahara Desert, Rome remained one of the strongest nations on earth for almost 800 years. Initially Rome controlled Italy, but after three wars with Carthage began to expand in all directions. At its peak, Rome's empire contained over 60 million inhabitants, one quarter of the Earth's population at that time. But this massive empire soon became too large to control and barbarians began swarming into the Empire. The 300 years before the fall of Rome in 476 A.D. were mostly spent trying to keep the ever-increasing flood of migrant barbarians back behind the Rhine and Danube rivers.",
"Music":[
{"File":"roman_peace_1.ogg", "Type":"peace"},
{"File":"roman_battle_1.ogg", "Type":"battle"},
{"File":"roman_defeat_1.ogg", "Type":"defeat"}
],
"Factions":
[
{

View File

@ -3,14 +3,46 @@ var g_CurrentAmbient = null;
var g_MusicGain = 0.3;
const MUSIC_PATH = "audio/music/";
var g_PeaceTracks = [];
var g_BattleTracks = [];
/*
* At some point, this ought to be extended to do dynamic music selection and
* crossfading - it at least needs to pick the music track based on the player's
* civ and peace/battle
*/
function startMusic()
function storeTracks(civMusic)
{
for each (var music in civMusic)
{
if ("peace" == music["Type"])
{
g_PeaceTracks.push(music["File"]);
}
else if ("battle" == music["Type"])
{
g_BattleTracks.push(music["File"]);
}
}
}
function getRandomPeaceTrack()
{
return MUSIC_PATH + g_PeaceTracks[getRandom(0, g_PeaceTracks.length-1)];
}
function getRandomBattleTrack()
{
return MUSIC_PATH + g_BattleTracks[getRandom(0, g_BattleTracks.length-1)];
}
function startMusic(civMusic)
{
storeTracks(civMusic);
g_CurrentAmbient = new Sound("audio/ambient/dayscape/day_temperate_gen_03.ogg");
if (g_CurrentAmbient)
{
@ -18,7 +50,9 @@ function startMusic()
g_CurrentAmbient.setGain(0.8);
}
g_CurrentMusic = new Sound("audio/music/germanic_peace_1.ogg");
//g_CurrentMusic = new Sound("audio/music/germanic_peace_1.ogg");
g_CurrentMusic = new Sound(getRandomPeaceTrack());
if (g_CurrentMusic)
{
g_CurrentMusic.loop();
@ -31,7 +65,7 @@ function switchMusic(track, fadeInPeriod)
if (g_CurrentMusic)
g_CurrentMusic.fade(-1, 0.0, 5.0);
g_CurrentMusic = new Sound("audio/music/" + track + ".ogg");
g_CurrentMusic = new Sound(MUSIC_PATH + track + ".ogg");
if (g_CurrentMusic)
{

View File

@ -52,16 +52,6 @@ function GetTemplateData(templateName)
// Init
function init(initData, hotloadData)
{
if (hotloadData)
{
g_Selection.selected = hotloadData.selection;
}
else
{
// Starting for the first time:
startMusic();
}
if (initData)
{
g_IsNetworked = initData.isNetworked; // Set network mode
@ -81,7 +71,16 @@ function init(initData, hotloadData)
g_CivData["gaia"] = { "Code": "gaia", "Name": "Gaia" };
getGUIObjectByName("civIcon").sprite = "stretched:"+g_CivData[g_Players[Engine.GetPlayerID()].civ].Emblem;
if (hotloadData)
{
g_Selection.selected = hotloadData.selection;
}
else
{
startMusic(g_CivData[g_Players[Engine.GetPlayerID()].civ].Music); // Starting for the first time:
}
onSimulationUpdate();
// Report the performance after 5 seconds (when we're still near