diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup.js b/binaries/data/mods/public/gui/gamesetup/gamesetup.js
index 8ec60ee3fd..012687b75a 100644
--- a/binaries/data/mods/public/gui/gamesetup/gamesetup.js
+++ b/binaries/data/mods/public/gui/gamesetup/gamesetup.js
@@ -7,7 +7,12 @@ const DEFAULT_OFFLINE_MAP = "Acropolis 1";
const VICTORY_TEXT = ["Conquest", "None"];
const VICTORY_DATA = ["conquest", "endless"];
const VICTORY_DEFAULTIDX = 0;
-
+const POPULATION_CAP = ["50", "100", "150", "200", "250", "300", "Unlimited"];
+const POPULATION_CAP_DATA = [50, 100, 150, 200, 250, 300, 10000];
+const POPULATION_CAP_DEFAULTIDX = 5;
+const STARTING_RESOURCES = ["Very Low", "Low", "Medium", "High", "Very High", "Deathmatch"];
+const STARTING_RESOURCES_DATA = [100, 300, 500, 1000, 3000, 50000];
+const STARTING_RESOURCES_DEFAULTIDX = 1;
// Max number of players for any map
const MAX_PLAYERS = 8;
@@ -53,7 +58,6 @@ Naval maps are recommended to be played with human opponents only.";
// tick handler
var g_LoadingState = 0; // 0 = not started, 1 = loading, 2 = loaded
-
////////////////////////////////////////////////////////////////////////////////////////////////
function init(attribs)
@@ -134,6 +138,40 @@ function initMain()
numPlayersSelection.list_data = players;
numPlayersSelection.selected = MAX_PLAYERS - 1;
+ var populationCaps = getGUIObjectByName("populationCap");
+ populationCaps.list = POPULATION_CAP;
+ populationCaps.list_data = POPULATION_CAP_DATA;
+ populationCaps.selected = POPULATION_CAP_DEFAULTIDX;
+ populationCaps.onSelectionChange = function()
+ {
+ if (this.selected != -1)
+ {
+ g_GameAttributes.settings.PopulationCap = POPULATION_CAP_DATA[this.selected];
+ }
+
+ if (!g_IsInGuiUpdate)
+ {
+ updateGameAttributes();
+ }
+ }
+
+ var startingResourcesL = getGUIObjectByName("startingResources");
+ startingResourcesL.list = STARTING_RESOURCES;
+ startingResourcesL.list_data = STARTING_RESOURCES_DATA;
+ startingResourcesL.selected = STARTING_RESOURCES_DEFAULTIDX;
+ startingResourcesL.onSelectionChange = function()
+ {
+ if (this.selected != -1)
+ {
+ g_GameAttributes.settings.StartingResources = STARTING_RESOURCES_DATA[this.selected];
+ }
+
+ if (!g_IsInGuiUpdate)
+ {
+ updateGameAttributes();
+ }
+ }
+
var victoryConditions = getGUIObjectByName("victoryCondition");
victoryConditions.list = VICTORY_TEXT;
victoryConditions.list_data = VICTORY_DATA;
@@ -207,7 +245,9 @@ function initMain()
getGUIObjectByName("mapFilterText").hidden = false;
getGUIObjectByName("mapSelectionText").hidden = false;
getGUIObjectByName("mapSelection").hidden = true;
-
+ getGUIObjectByName("victoryConditionText").hidden = false;
+ getGUIObjectByName("victoryCondition").hidden = true;
+
// Disable player and game options controls
// TODO: Shouldn't players be able to choose their own assignment?
for (var i = 0; i < MAX_PLAYERS; ++i)
@@ -774,6 +814,7 @@ function launchGame()
selectMap(getGUIObjectByName("mapSelection").list_data[Math.floor(Math.random() *
(getGUIObjectByName("mapSelection").list.length - 1)) + 1]);
+ g_GameAttributes.settings.mapType = g_GameAttributes.mapType;
var numPlayers = g_GameAttributes.settings.PlayerData.length;
// Assign random civilizations to players with that choice
// (this is synchronized because we're the host)
@@ -877,6 +918,10 @@ function onGameAttributesChange()
var mapSelectionBox = getGUIObjectByName("mapSelection");
mapSelectionBox.selected = mapSelectionBox.list_data.indexOf(mapName);
getGUIObjectByName("mapSelectionText").caption = getMapDisplayName(mapName);
+ var populationCapBox = getGUIObjectByName("populationCap");
+ populationCapBox.selected = populationCapBox.list_data.indexOf(mapSettings.PopulationCap);
+ var startingResourcesBox = getGUIObjectByName("startingResources");
+ startingResourcesBox.selected = startingResourcesBox.list_data.indexOf(mapSettings.StartingResources);
initMapNameList();
}
@@ -887,6 +932,8 @@ function onGameAttributesChange()
var lockTeams = getGUIObjectByName("lockTeams");
var mapSize = getGUIObjectByName("mapSize");
var enableCheats = getGUIObjectByName("enableCheats");
+ var populationCap = getGUIObjectByName("populationCap");
+ var startingResources = getGUIObjectByName("startingResources");
var numPlayersText= getGUIObjectByName("numPlayersText");
var mapSizeText = getGUIObjectByName("mapSizeText");
@@ -894,11 +941,17 @@ function onGameAttributesChange()
var victoryConditionText = getGUIObjectByName("victoryConditionText");
var lockTeamsText = getGUIObjectByName("lockTeamsText");
var enableCheatsText = getGUIObjectByName("enableCheatsText");
+ var populationCapText = getGUIObjectByName("populationCapText");
+ var startingResourcesText = getGUIObjectByName("startingResourcesText");
var sizeIdx = (g_MapSizes.tiles.indexOf(mapSettings.Size) != -1 ? g_MapSizes.tiles.indexOf(mapSettings.Size) : g_MapSizes.default);
var victoryIdx = (VICTORY_DATA.indexOf(mapSettings.GameType) != -1 ? VICTORY_DATA.indexOf(mapSettings.GameType) : VICTORY_DEFAULTIDX);
enableCheats.checked = (g_GameAttributes.settings.CheatsEnabled === undefined || !g_GameAttributes.settings.CheatsEnabled ? false : true)
enableCheatsText.caption = (enableCheats.checked ? "Yes" : "No");
+ populationCap.selected = (POPULATION_CAP_DATA.indexOf(mapSettings.PopulationCap) != -1 ? POPULATION_CAP_DATA.indexOf(mapSettings.PopulationCap) : POPULATION_CAP_DEFAULTIDX);
+ populationCapText.caption = POPULATION_CAP[populationCap.selected];
+ startingResources.selected = (STARTING_RESOURCES_DATA.indexOf(mapSettings.StartingResources) != -1 ? STARTING_RESOURCES_DATA.indexOf(mapSettings.StartingResources) : STARTING_RESOURCES_DEFAULTIDX);
+ startingResourcesText.caption = STARTING_RESOURCES[startingResources.selected];
// Handle map type specific logic
switch (g_GameAttributes.mapType)
{
@@ -911,13 +964,17 @@ function onGameAttributesChange()
revealMap.hidden = false;
victoryCondition.hidden = false;
lockTeams.hidden = false;
+ populationCap.hidden = false;
+ startingResources.hidden = false;
numPlayersText.hidden = true;
mapSizeText.hidden = true;
revealMapText.hidden = true;
victoryConditionText.hidden = true;
lockTeamsText.hidden = true;
-
+ populationCapText.hidden = true;
+ startingResourcesText.hidden = true;
+
// Update map preview
getGUIObjectByName("mapPreview").sprite = "cropped:(0.78125,0.5859375)session/icons/mappreview/" + getMapPreview(mapName);
@@ -939,10 +996,13 @@ function onGameAttributesChange()
revealMapText.hidden = false;
victoryConditionText.hidden = false;
lockTeamsText.hidden = false;
-
+ populationCap.hidden = true;
+ populationCapText.hidden = false;
+ startingResources.hidden = true;
+ startingResourcesText.hidden = false;
// Update map preview
getGUIObjectByName("mapPreview").sprite = "cropped:(0.78125,0.5859375)session/icons/mappreview/" + getMapPreview(mapName);
-
+
numPlayersText.caption = numPlayers;
mapSizeText.caption = g_MapSizes.names[sizeIdx];
revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No");
@@ -964,7 +1024,11 @@ function onGameAttributesChange()
revealMapText.hidden = false;
victoryConditionText.hidden = false;
lockTeamsText.hidden = false;
-
+ populationCap.hidden = true;
+ populationCapText.hidden = false;
+ startingResources.hidden = true;
+ startingResourcesText.hidden = false;
+
// Update map preview
getGUIObjectByName("mapPreview").sprite = "cropped:(0.78125,0.5859375)session/icons/mappreview/" + getMapPreview(mapName);
numPlayersText.caption = numPlayers;
@@ -972,7 +1036,7 @@ function onGameAttributesChange()
revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No");
victoryConditionText.caption = VICTORY_TEXT[victoryIdx];
lockTeamsText.caption = (mapSettings.LockTeams === undefined || mapSettings.LockTeams ? "Yes" : "No");
-
+ getGUIObjectByName("populationCap").selected = POPULATION_CAP_DEFAULTIDX;
break;
default:
@@ -1326,6 +1390,11 @@ function addChatMessage(msg)
getGUIObjectByName("chatText").caption = g_ChatMessages.join("\n");
}
+function toggleMoreOptions()
+{
+ getGUIObjectByName("moreOptions").hidden = !getGUIObjectByName("moreOptions").hidden;
+}
+
////////////////////////////////////////////////////////////////////////////////////////////////
// Basic map filters API
diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup.xml b/binaries/data/mods/public/gui/gamesetup/gamesetup.xml
index 55c2952109..b82f4e1bc4 100644
--- a/binaries/data/mods/public/gui/gamesetup/gamesetup.xml
+++ b/binaries/data/mods/public/gui/gamesetup/gamesetup.xml
@@ -32,8 +32,29 @@
+
+
+
@@ -77,13 +98,14 @@
-
+
Select Map:
Match Type:
Map Filter:
+ Map Size:
-
+
@@ -92,7 +114,7 @@
selectMapType(this.list_data[this.selected]);
@@ -101,13 +123,13 @@
selectMapFilter(this.list[this.selected]);
-
+
-
-
- Cheats:
-
-
+
-
-
-
-
+
+
+
+
+
@@ -138,89 +157,106 @@
-
-
-
-
-
-
-
-
- Number of players:
-
-
-
- Map size:
-
-
-
- Victory condition:
-
-
-
-
-
-
-
-
-
-
-
- selectNumPlayers(this.list_data[this.selected]);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Reveal map:
-
-
- Teams locked:
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+ More Options
+ toggleMoreOptions();
+
+
+
+
+
+
+
+
+ More Options
+
+
+
+
+ Victory condition:
+
+
+
+
+
+
+
+ Population Cap:
+
+
+
+
+
+
+
+ Starting Resources:
+
+
+
+
+
+
+
+ Reveal map:
+
+
+ Teams locked:
+
+
+ Cheats:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OK
+ toggleMoreOptions();
+
+
+
+
+
-
+
diff --git a/binaries/data/mods/public/simulation/helpers/InitGame.js b/binaries/data/mods/public/simulation/helpers/InitGame.js
index 24dead1623..e30df68834 100644
--- a/binaries/data/mods/public/simulation/helpers/InitGame.js
+++ b/binaries/data/mods/public/simulation/helpers/InitGame.js
@@ -22,6 +22,11 @@ function InitGame(settings)
cmpPlayer.SetAI(true);
cmpPlayer.SetCheatEnabled(true);
}
+ cmpPlayer.maxPop = settings.PopulationCap;
+
+ if (settings.mapType !== "scenario")
+ for (var resouces in cmpPlayer.resourceCount)
+ cmpPlayer.resourceCount[resouces] = settings.StartingResources;
}
}