Ticket #1198: skirmish.diff
File skirmish.diff, 33.0 KB (added by , 11 years ago) |
---|
-
binaries/data/mods/public/gui/gamesetup/gamesetup.js
107 107 108 108 // Init map types 109 109 var mapTypes = getGUIObjectByName("mapTypeSelection"); 110 mapTypes.list = ["Scenario"," Random"];111 mapTypes.list_data = ["scenario"," random"];110 mapTypes.list = ["Scenario","Skirmish","Random"]; 111 mapTypes.list_data = ["scenario","skirmish","random"]; 112 112 113 113 // Setup map filters - will appear in order they are added 114 114 addFilter("Default", function(settings) { return settings && !keywordTestOR(settings.Keywords, ["naval", "demo", "hidden"]); }); … … 471 471 switch (g_GameAttributes.mapType) 472 472 { 473 473 case "scenario": 474 case "skirmish": 474 475 mapFiles = getXMLFileList(g_GameAttributes.mapPath); 475 476 break; 476 477 … … 532 533 switch (g_GameAttributes.mapType) 533 534 { 534 535 case "scenario": 536 case "skirmish": 535 537 g_MapData[name] = Engine.LoadMapSettings(g_GameAttributes.mapPath+name); 536 538 break; 537 539 … … 656 658 g_GameAttributes.mapPath = "maps/scenarios/"; 657 659 break; 658 660 661 case "skirmish": 662 g_GameAttributes.mapPath = "maps/skirmish/"; 663 g_GameAttributes.settings = { 664 PlayerData: g_DefaultPlayerData.slice(0, 4), 665 Seed: Math.floor(Math.random() * 65536), 666 CheatsEnabled: g_GameAttributes.settings.CheatsEnabled 667 }; 668 break; 669 659 670 case "random": 660 671 g_GameAttributes.mapPath = "maps/random/"; 661 672 g_GameAttributes.settings = { … … 959 970 960 971 break; 961 972 973 case "skirmish": 974 mapSizeText.caption = "Default"; 975 numPlayersText.caption = numPlayers; 976 numPlayersSelection.hidden = true; 977 mapSize.hidden = true; 978 if (g_IsController) 979 { //Host 980 revealMap.hidden = false; 981 victoryCondition.hidden = false; 982 lockTeams.hidden = false; 983 populationCap.hidden = false; 984 startingResources.hidden = false; 985 986 numPlayersText.hidden = false; 987 mapSizeText.hidden = false; 988 revealMapText.hidden = true; 989 victoryConditionText.hidden = true; 990 lockTeamsText.hidden = true; 991 populationCapText.hidden = true; 992 startingResourcesText.hidden = true; 993 994 // Update map preview 995 getGUIObjectByName("mapPreview").sprite = "cropped:(0.78125,0.5859375)session/icons/mappreview/" + getMapPreview(mapName); 996 997 revealMapText.caption = "Reveal map:"; 998 revealMap.checked = (mapSettings.RevealMap ? true : false); 999 1000 victoryConditionText.caption = "Victory condition:"; 1001 victoryCondition.selected = victoryIdx; 1002 lockTeamsText.caption = "Teams locked:"; 1003 lockTeams.checked = (mapSettings.LockTeams ? true : false); 1004 } 1005 else 1006 { 1007 // Client 1008 numPlayersText.hidden = false; 1009 mapSizeText.hidden = false; 1010 revealMapText.hidden = false; 1011 victoryConditionText.hidden = false; 1012 lockTeamsText.hidden = false; 1013 populationCap.hidden = true; 1014 populationCapText.hidden = false; 1015 startingResources.hidden = true; 1016 startingResourcesText.hidden = false; 1017 // Update map preview 1018 getGUIObjectByName("mapPreview").sprite = "cropped:(0.78125,0.5859375)session/icons/mappreview/" + getMapPreview(mapName); 1019 1020 revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No"); 1021 victoryConditionText.caption = VICTORY_TEXT[victoryIdx]; 1022 lockTeamsText.caption = (mapSettings.LockTeams ? "Yes" : "No"); 1023 } 1024 1025 break; 1026 1027 962 1028 case "scenario": 963 1029 // For scenario just reflect settings for the current map 964 1030 numPlayersSelection.hidden = true; … … 1046 1112 pCivText.caption = g_CivData[civ].Name; 1047 1113 pTeamText.caption = (team !== undefined && team >= 0) ? team+1 : "-"; 1048 1114 } 1049 else if (g_GameAttributes.mapType == "random")1115 else if (g_GameAttributes.mapType != "scenario") 1050 1116 { 1051 1117 pCivText.hidden = true; 1052 1118 pCiv.hidden = false; -
binaries/data/mods/public/gui/loading/loading.js
46 46 var mapName = data.attribs.settings.Name; 47 47 switch (data.attribs.mapType) 48 48 { 49 case "skirmish": 49 50 case "scenario": 50 51 loadingMapName.caption = "Loading \"" + mapName + "\""; 51 52 break; -
binaries/data/mods/public/maps/scenarios/Acropolis
23078 23078 </Entity> 23079 23079 </Entities> 23080 23080 <Paths/> 23081 </Scenario> 23082 No newline at end of file 23081 </Scenario> -
binaries/data/mods/public/simulation/components/SkirmishReplacer.js
1 const civList = ["general", "athen", "brit", "cart", "celt", "gaul", "hele", "iber", "mace", "maur", "pers", "rome", "spart"]; 2 3 function SkirmishReplacer() {} 4 5 6 SkirmishReplacer.prototype.Schema = ""; 7 for each (var civ in civList) 8 SkirmishReplacer.prototype.Schema += 9 "<optional>" + 10 "<element name='"+civ+"' a:help='Replacement template for this civ. If this element is not present, the \"general\" element (with {civ} replaced by the civ code) is taken. If this element is empty, or not defined, and also no general element, this entity is just deleted.'>" + 11 "<text/>" + 12 "</element>" + 13 "</optional>"; 14 15 16 17 SkirmishReplacer.prototype.Init = function() 18 { 19 }; 20 21 SkirmishReplacer.prototype.OnOwnershipChanged = function(msg) 22 { 23 if (msg.to == 0) 24 warn("Skirmish map elements can only be owned by regular players. Please delete entity "+this.entity+" or change the ownership to a non-gaia player."); 25 }; 26 27 /** 28 * Replace this entity with a civ-specific entity on the first turn 29 */ 30 SkirmishReplacer.prototype.OnUpdate = function(msg) 31 { 32 var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player); 33 var civ = cmpPlayer.GetCiv(); 34 35 var templateName = ""; 36 if (civ in this.template) 37 templateName = this.template[civ]; 38 else if ("general" in this.template) 39 templateName = this.template.general; 40 41 if (!templateName || civ == "gaia") 42 { 43 Engine.DestroyEntity(this.entity); 44 return; 45 } 46 47 templateName = templateName.replace(/\{civ\}/g, civ); 48 49 var cmpCurPosition = Engine.QueryInterface(this.entity, IID_Position); 50 var replacement = Engine.AddEntity(templateName); 51 var cmpReplacementPosition = Engine.QueryInterface(replacement, IID_Position) 52 var pos = cmpCurPosition.GetPosition2D(); 53 cmpReplacementPosition.JumpTo(pos.x, pos.y); 54 var rot = cmpCurPosition.GetRotation(); 55 cmpReplacementPosition.SetYRotation(rot.y); 56 var cmpCurOwnership = Engine.QueryInterface(this.entity, IID_Ownership); 57 var cmpReplacementOwnership = Engine.QueryInterface(replacement, IID_Ownership); 58 cmpReplacementOwnership.SetOwner(cmpCurOwnership.GetOwner()); 59 60 Engine.DestroyEntity(this.entity); 61 }; 62 63 Engine.RegisterComponentType(IID_SkirmishReplacer, "SkirmishReplacer", SkirmishReplacer); -
binaries/data/mods/public/simulation/components/interfaces/SkirmishReplacer.js
1 Engine.RegisterInterface("SkirmishReplacer"); -
binaries/data/mods/public/simulation/templates/skirmish/structures/default_civil_centre.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_structure_civic_civil_centre"> 3 <Identity> 4 <Civ>skirm</Civ> 5 </Identity> 6 <SkirmishReplacer> 7 <general>structures/{civ}_civil_centre</general> 8 </SkirmishReplacer> 9 <VisualActor> 10 <Actor>structures/athenians/civic_centre_new.xml</Actor> 11 </VisualActor> 12 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/structures/default_wall_gate.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/structures/default_civil_centre.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_structure_defense_wall_gate"> 3 <Footprint> 4 <Square width="39.0" depth="8.0"/> 5 <Height>9.0</Height> 6 </Footprint> 7 <Identity> 8 <Civ>skirm</Civ> 9 </Identity> 10 <Obstruction> 11 <Obstructions> 12 <Right width="12" depth="6.5" x="12.5" z="0"/> 13 <Left width="12" depth="6.5" x="-12.5" z="0"/> 14 <Door width="13" depth="6.5" x="0" z="0"/> 15 </Obstructions> 16 </Obstruction> 17 <SkirmishReplacer> 18 <general>structures/{civ}_wall_gate</general> 19 <spart/> 20 </SkirmishReplacer> 21 <VisualActor> 22 <Actor>structures/hellenes/wall_gate.xml</Actor> 23 </VisualActor> 24 <WallPiece> 25 <Length>38.0</Length> 26 </WallPiece> 27 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/structures/default_wall_long.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/structures/default_wall_gate.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_structure_defense_wall_long"> 3 <Footprint> 4 <Square width="37" depth="9"/> 5 <Height>9.0</Height> 6 </Footprint> 7 <Identity> 8 <Civ>skirm</Civ> 9 </Identity> 10 <Obstruction> 11 <Static width="36.0" depth="8"/> 12 </Obstruction> 13 <SkirmishReplacer> 14 <general>structures/{civ}_wall_long</general> 15 <spart/> 16 </SkirmishReplacer> 17 <VisualActor> 18 <Actor>structures/hellenes/wall_long.xml</Actor> 19 </VisualActor> 20 <WallPiece> 21 <Length>36.0</Length> 22 </WallPiece> 23 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/structures/default_wall_medium.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/structures/default_wall_long.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_structure_defense_wall_medium"> 3 <Footprint> 4 <Square width="25" depth="9"/> 5 <Height>9.0</Height> 6 </Footprint> 7 <Identity> 8 <Civ>skirm</Civ> 9 </Identity> 10 <Obstruction> 11 <Static width="24.0" depth="8"/> 12 </Obstruction> 13 <SkirmishReplacer> 14 <general>structures/{civ}_wall_medium</general> 15 <spart/> 16 </SkirmishReplacer> 17 <VisualActor> 18 <Actor>structures/hellenes/wall_medium.xml</Actor> 19 </VisualActor> 20 <WallPiece> 21 <Length>24.0</Length> 22 </WallPiece> 23 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/structures/default_wall_short.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/structures/default_wall_medium.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_structure_defense_wall_short"> 3 <Footprint> 4 <Square width="13" depth="9"/> 5 <Height>9.0</Height> 6 </Footprint> 7 <Identity> 8 <Civ>skirm</Civ> 9 </Identity> 10 <Obstruction> 11 <Static width="12.0" depth="8"/> 12 </Obstruction> 13 <SkirmishReplacer> 14 <general>structures/{civ}_wall_short</general> 15 <spart/> 16 </SkirmishReplacer> 17 <VisualActor> 18 <Actor>structures/hellenes/wall_short.xml</Actor> 19 </VisualActor> 20 <WallPiece> 21 <Length>12.0</Length> 22 </WallPiece> 23 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/structures/default_wall_tower.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/structures/default_wall_short.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_structure_defense_wall_tower"> 3 <Footprint replace=""> 4 <Circle radius="6.2"/> 5 <Height>15.0</Height> 6 </Footprint> 7 <Identity> 8 <Civ>skirm</Civ> 9 </Identity> 10 <Obstruction> 11 <Static width="10" depth="10"/> 12 </Obstruction> 13 <SkirmishReplacer> 14 <general>structures/{civ}_wall_tower</general> 15 <spart/> 16 </SkirmishReplacer> 17 <VisualActor> 18 <Actor>structures/hellenes/wall_tower.xml</Actor> 19 </VisualActor> 20 <WallPiece> 21 <Length>10</Length> 22 </WallPiece> 23 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/structures/iber_wall_gate.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/structures/default_wall_tower.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_structure_defense_wall_gate"> 3 <Footprint> 4 <Square width="37.0" depth="9.5"/> 5 <Height>9.0</Height> 6 </Footprint> 7 <Identity> 8 <Civ>skirm</Civ> 9 </Identity> 10 <Obstruction> 11 <Obstructions> 12 <Right width="10" depth="8.5" x="13" z="0"/> 13 <Left width="10" depth="8.5" x="-13" z="0"/> 14 <Door width="16.0" depth="8.5" x="0" z="0"/> 15 </Obstructions> 16 </Obstruction> 17 <SkirmishReplacer> 18 <iber>structures/iber_wall_gate</iber> 19 </SkirmishReplacer> 20 <VisualActor> 21 <Actor>structures/iberians/wall_gate.xml</Actor> 22 </VisualActor> 23 <WallPiece> 24 <Length>36.0</Length> 25 </WallPiece> 26 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/structures/iber_wall_long.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/structures/iber_wall_gate.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_structure_defense_wall_long"> 3 <Footprint> 4 <Square width="37" depth="9"/> 5 <Height>9.0</Height> 6 </Footprint> 7 <Identity> 8 <Civ>skirm</Civ> 9 </Identity> 10 <Obstruction> 11 <Static width="36.0" depth="8"/> 12 </Obstruction> 13 <SkirmishReplacer> 14 <iber>structures/iber_wall_long</iber> 15 </SkirmishReplacer> 16 <VisualActor> 17 <Actor>structures/iberians/wall_long.xml</Actor> 18 </VisualActor> 19 <WallPiece> 20 <Length>36.0</Length> 21 </WallPiece> 22 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/structures/iber_wall_medium.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/structures/iber_wall_long.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_structure_defense_wall_medium"> 3 <Footprint> 4 <Square width="25" depth="9"/> 5 <Height>9.0</Height> 6 </Footprint> 7 <Identity> 8 <Civ>skirm</Civ> 9 </Identity> 10 <Obstruction> 11 <Static width="24.0" depth="8"/> 12 </Obstruction> 13 <SkirmishReplacer> 14 <iber>structures/iber_wall_medium</iber> 15 </SkirmishReplacer> 16 <VisualActor> 17 <Actor>structures/iberians/wall_medium.xml</Actor> 18 </VisualActor> 19 <WallPiece> 20 <Length>24.0</Length> 21 </WallPiece> 22 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/structures/iber_wall_short.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/structures/iber_wall_medium.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_structure_defense_wall_short"> 3 <Footprint> 4 <Square width="13" depth="9"/> 5 <Height>9.0</Height> 6 </Footprint> 7 <Identity> 8 <Civ>skirm</Civ> 9 </Identity> 10 <Obstruction> 11 <Static width="12.0" depth="8"/> 12 </Obstruction> 13 <SkirmishReplacer> 14 <iber>structures/iber_wall_short</iber> 15 </SkirmishReplacer> 16 <VisualActor> 17 <Actor>structures/iberians/wall_short.xml</Actor> 18 </VisualActor> 19 <WallPiece> 20 <Length>12.0</Length> 21 </WallPiece> 22 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/structures/iber_wall_tower.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/structures/iber_wall_short.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_structure_defense_wall_tower"> 3 <Footprint replace=""> 4 <Circle radius="6.2"/> 5 <Height>15.0</Height> 6 </Footprint> 7 <Identity> 8 <Civ>skirm</Civ> 9 </Identity> 10 <Obstruction> 11 <Static width="10" depth="10"/> 12 </Obstruction> 13 <SkirmishReplacer> 14 <iber>structures/iber_wall_tower</iber> 15 </SkirmishReplacer> 16 <VisualActor> 17 <Actor>structures/iberians/wall_tower.xml</Actor> 18 </VisualActor> 19 <WallPiece> 20 <Length>10</Length> 21 </WallPiece> 22 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/units/default_cavalry.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/structures/iber_wall_tower.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_unit_cavalry"> 3 <Identity> 4 <Civ>skirm</Civ> 5 </Identity> 6 <Promotion disable=""/> 7 <SkirmishReplacer> 8 <general>units/{civ}_cavalry_javelinist_b</general> 9 <celt>units/celt_cavalry_swordsman_b</celt> 10 <gaul>units/gaul_cavalry_swordsman_b</gaul> 11 <hele>units/hele_cavalry_swordsman_b</hele> 12 <iber>units/iber_cavalry_spearman_b</iber> 13 <maur>units/maur_support_elephant</maur> 14 <rome>units/rome_cavalry_spearman_b</rome> 15 </SkirmishReplacer> 16 <VisualActor> 17 <Actor>units/athenians/cavalry_javelinist_b.xml</Actor> 18 </VisualActor> 19 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/units/default_infantry_melee_b.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/units/default_cavalry.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_unit_infantry_melee"> 3 <Identity> 4 <Civ>skirm</Civ> 5 </Identity> 6 <Promotion disable=""/> 7 <SkirmishReplacer> 8 <general>units/{civ}_infantry_spearman_b</general> 9 <rome>units/rome_infantry_swordsman_b</rome> 10 </SkirmishReplacer> 11 <VisualActor> 12 <Actor>units/athenians/infantry_spearman_b.xml</Actor> 13 </VisualActor> 14 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/units/default_infantry_ranged_b.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/units/default_infantry_melee_b.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_unit_infantry_ranged"> 3 <Identity> 4 <Civ>skirm</Civ> 5 </Identity> 6 <Promotion disable=""/> 7 <SkirmishReplacer> 8 <general>units/{civ}_infantry_javelinist_b</general> 9 <athen>units/athen_infantry_slinger_b</athen> 10 <brit>units/brit_infantry_slinger_b</brit> 11 <cart>units/cart_infantry_archer_b</cart> 12 <maur>units/maur_infantry_archer_b</maur> 13 <pers>units/pers_infantry_archer_b</pers> 14 </SkirmishReplacer> 15 <VisualActor> 16 <Actor>units/athenians/infantry_slinger_b.xml</Actor> 17 </VisualActor> 18 </Entity> -
binaries/data/mods/public/simulation/templates/skirmish/units/default_support_female_citizen.xml
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/units/default_infantry_ranged_b.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
1 <?xml version="1.0" encoding="utf-8"?> 2 <Entity parent="template_unit_support_female_citizen"> 3 <Identity> 4 <Civ>skirm</Civ> 5 </Identity> 6 <SkirmishReplacer> 7 <general>units/{civ}_support_female_citizen</general> 8 </SkirmishReplacer> 9 <VisualActor> 10 <Actor>units/athenians/female_citizen.xml</Actor> 11 </VisualActor> 12 </Entity> -
source/graphics/MapReader.cpp
Property changes on: binaries/data/mods/public/simulation/templates/skirmish/units/default_support_female_citizen.xml ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property
64 64 } 65 65 66 66 // LoadMap: try to load the map from given file; reinitialise the scene to new data if successful 67 void CMapReader::LoadMap(const VfsPath& pathname, CTerrain *pTerrain_,67 void CMapReader::LoadMap(const VfsPath& pathname, const CScriptValRooted& settings, CTerrain *pTerrain_, 68 68 WaterManager* pWaterMan_, SkyManager* pSkyMan_, 69 69 CLightEnv *pLightEnv_, CGameView *pGameView_, CCinemaManager* pCinema_, CTriggerManager* pTrigMan_, CPostprocManager* pPostproc_, 70 70 CSimulation2 *pSimulation2_, const CSimContext* pSimContext_, int playerID_, bool skipEntities) … … 83 83 m_PlayerID = playerID_; 84 84 m_SkipEntities = skipEntities; 85 85 m_StartingCameraTarget = INVALID_ENTITY; 86 m_ScriptSettings = settings; 86 87 87 88 filename_xml = pathname.ChangeExtension(L".xml"); 88 89 … … 116 117 if (pPostproc) 117 118 pPostproc->SetPostEffect(L"default"); 118 119 119 // load map settings script 120 RegMemFun(this, &CMapReader::LoadScriptSettings, L"CMapReader::LoadScriptSettings", 50); 120 // load map or script settings script 121 if (settings.undefined()) 122 RegMemFun(this, &CMapReader::LoadScriptSettings, L"CMapReader::LoadScriptSettings", 50); 123 else 124 RegMemFun(this, &CMapReader::LoadRMSettings, L"CMapReader::LoadRMSettings", 50); 121 125 122 126 // load player settings script (must be done before reading map) 123 127 RegMemFun(this, &CMapReader::LoadPlayerSettings, L"CMapReader::LoadPlayerSettings", 50); … … 138 142 RegMemFun(this, &CMapReader::DelayLoadFinished, L"CMapReader::DelayLoadFinished", 5); 139 143 } 140 144 141 142 145 // LoadRandomMap: try to load the map data; reinitialise the scene to new data if successful 143 146 void CMapReader::LoadRandomMap(const CStrW& scriptFile, const CScriptValRooted& settings, CTerrain *pTerrain_, 144 147 WaterManager* pWaterMan_, SkyManager* pSkyMan_, -
source/graphics/MapReader.h
53 53 ~CMapReader(); 54 54 55 55 // LoadMap: try to load the map from given file; reinitialise the scene to new data if successful 56 void LoadMap(const VfsPath& pathname, CTerrain*, WaterManager*, SkyManager*, CLightEnv*, CGameView*,56 void LoadMap(const VfsPath& pathname, const CScriptValRooted& settings, CTerrain*, WaterManager*, SkyManager*, CLightEnv*, CGameView*, 57 57 CCinemaManager*, CTriggerManager*, CPostprocManager* pPostproc, CSimulation2*, const CSimContext*, 58 58 int playerID, bool skipEntities); 59 59 -
source/ps/Game.cpp
146 146 { 147 147 // Load scenario attributes 148 148 std::wstring mapFile; 149 // let settings undefined to take map file settings instead 150 CScriptValRooted settings; 149 151 m_Simulation2->GetScriptInterface().GetProperty(attribs.get(), "map", mapFile); 150 152 151 m_World->RegisterInit( mapFile, m_PlayerID);153 m_World->RegisterInit(L"scenarios/"+mapFile, settings, m_PlayerID); 152 154 } 153 155 else if (mapType == "random") 154 156 { … … 160 162 m_Simulation2->GetScriptInterface().GetProperty(attribs.get(), "settings", settings); 161 163 162 164 m_World->RegisterInitRMS(scriptFile, settings, m_PlayerID); 165 } 166 else if (mapType == "skirmish") 167 { 168 // Load skirmish attributes 169 std::wstring mapFile; 170 CScriptValRooted settings; 171 172 m_Simulation2->GetScriptInterface().GetProperty(attribs.get(), "map", mapFile); 173 m_Simulation2->GetScriptInterface().GetProperty(attribs.get(), "settings", settings); 174 175 m_World->RegisterInit(L"skirmish/"+mapFile, settings, m_PlayerID); 163 176 } 164 177 165 178 if (m_IsSavedGame) -
source/ps/World.cpp
65 65 /** 66 66 * Initializes the game world with the attributes provided. 67 67 **/ 68 void CWorld::RegisterInit(const CStrW& mapFile, int playerID)68 void CWorld::RegisterInit(const CStrW& mapFile, const CScriptValRooted& settings, int playerID) 69 69 { 70 70 // Load the map, if one was specified 71 71 if (mapFile.length()) 72 72 { 73 VfsPath mapfilename(VfsPath("maps/ scenarios") / (mapFile + L".pmp"));73 VfsPath mapfilename(VfsPath("maps/") / (mapFile + L".pmp")); 74 74 CMapReader* reader = 0; 75 75 76 76 try … … 77 77 { 78 78 reader = new CMapReader; 79 79 CTriggerManager* pTriggerManager = NULL; 80 reader->LoadMap(mapfilename, m_Terrain,80 reader->LoadMap(mapfilename, settings, m_Terrain, 81 81 CRenderer::IsInitialised() ? g_Renderer.GetWaterManager() : NULL, 82 82 CRenderer::IsInitialised() ? g_Renderer.GetSkyManager() : NULL, 83 83 &g_LightEnv, m_pGame->GetView(), -
source/ps/World.h
73 73 /* 74 74 Initialize the World - load the map and all objects 75 75 */ 76 void RegisterInit(const CStrW& mapFile, int playerID);76 void RegisterInit(const CStrW& mapFile, const CScriptValRooted& settings, int playerID); 77 77 78 78 /* 79 79 Initialize the World - generate and load the random map -
source/simulation2/Simulation2.cpp
388 388 { 389 389 // Load scenario attributes 390 390 std::wstring mapFile; 391 CScriptValRooted settings; 391 392 m_ComponentManager.GetScriptInterface().GetProperty(m_InitAttributes.get(), "map", mapFile); 392 393 393 394 VfsPath mapfilename(VfsPath("maps/scenarios") / (mapFile + L".pmp")); 394 mapReader->LoadMap(mapfilename, &secondaryTerrain, NULL, NULL, NULL, NULL, NULL, NULL,395 mapReader->LoadMap(mapfilename, settings, &secondaryTerrain, NULL, NULL, NULL, NULL, NULL, NULL, 395 396 NULL, NULL, &secondaryContext, INVALID_PLAYER, true); // throws exception on failure 396 397 } 397 398 else -
source/simulation2/components/tests/test_Pathfinder.h
66 66 sim2.ResetState(); 67 67 68 68 CMapReader* mapReader = new CMapReader(); // it'll call "delete this" itself 69 CScriptValRooted settings; 69 70 70 71 LDR_BeginRegistering(); 71 mapReader->LoadMap(L"maps/scenarios/Median Oasis 01.pmp", &terrain, NULL, NULL, NULL, NULL, NULL, NULL, NULL,72 mapReader->LoadMap(L"maps/scenarios/Median Oasis 01.pmp", settings, &terrain, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 72 73 &sim2, &sim2.GetSimContext(), -1, false); 73 74 LDR_EndRegistering(); 74 75 TS_ASSERT_OK(LDR_NonprogressiveLoad()); -
source/simulation2/tests/test_Serializer.h
642 642 sim2.ResetState(); 643 643 644 644 CMapReader* mapReader = new CMapReader(); // it'll call "delete this" itself 645 CScriptValRooted settings; 645 646 646 647 LDR_BeginRegistering(); 647 mapReader->LoadMap(L"maps/scenarios/Latium.pmp", &terrain, NULL, NULL, NULL, NULL, NULL, NULL, NULL,648 mapReader->LoadMap(L"maps/scenarios/Latium.pmp", settings, &terrain, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 648 649 &sim2, &sim2.GetSimContext(), -1, false); 649 650 LDR_EndRegistering(); 650 651 TS_ASSERT_OK(LDR_NonprogressiveLoad());