mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Add an 'explore map' option to the game setup.
This was SVN commit r14931.
This commit is contained in:
@@ -235,6 +235,15 @@ function initMain()
|
|||||||
updateGameAttributes();
|
updateGameAttributes();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Engine.GetGUIObjectByName("exploreMap").onPress = function()
|
||||||
|
{ // Update attributes so other players can see change
|
||||||
|
g_GameAttributes.settings.ExploreMap = this.checked;
|
||||||
|
|
||||||
|
if (!g_IsInGuiUpdate)
|
||||||
|
updateGameAttributes();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
Engine.GetGUIObjectByName("lockTeams").onPress = function()
|
Engine.GetGUIObjectByName("lockTeams").onPress = function()
|
||||||
{ // Update attributes so other players can see change
|
{ // Update attributes so other players can see change
|
||||||
g_GameAttributes.settings.LockTeams = this.checked;
|
g_GameAttributes.settings.LockTeams = this.checked;
|
||||||
@@ -933,6 +942,7 @@ function onGameAttributesChange()
|
|||||||
// Controls common to all map types
|
// Controls common to all map types
|
||||||
var numPlayersSelection = Engine.GetGUIObjectByName("numPlayersSelection");
|
var numPlayersSelection = Engine.GetGUIObjectByName("numPlayersSelection");
|
||||||
var revealMap = Engine.GetGUIObjectByName("revealMap");
|
var revealMap = Engine.GetGUIObjectByName("revealMap");
|
||||||
|
var exploreMap = Engine.GetGUIObjectByName("exploreMap");
|
||||||
var victoryCondition = Engine.GetGUIObjectByName("victoryCondition");
|
var victoryCondition = Engine.GetGUIObjectByName("victoryCondition");
|
||||||
var lockTeams = Engine.GetGUIObjectByName("lockTeams");
|
var lockTeams = Engine.GetGUIObjectByName("lockTeams");
|
||||||
var mapSize = Engine.GetGUIObjectByName("mapSize");
|
var mapSize = Engine.GetGUIObjectByName("mapSize");
|
||||||
@@ -944,6 +954,7 @@ function onGameAttributesChange()
|
|||||||
var mapSizeDesc = Engine.GetGUIObjectByName("mapSizeDesc");
|
var mapSizeDesc = Engine.GetGUIObjectByName("mapSizeDesc");
|
||||||
var mapSizeText = Engine.GetGUIObjectByName("mapSizeText");
|
var mapSizeText = Engine.GetGUIObjectByName("mapSizeText");
|
||||||
var revealMapText = Engine.GetGUIObjectByName("revealMapText");
|
var revealMapText = Engine.GetGUIObjectByName("revealMapText");
|
||||||
|
var exploreMapText = Engine.GetGUIObjectByName("exploreMapText");
|
||||||
var victoryConditionText = Engine.GetGUIObjectByName("victoryConditionText");
|
var victoryConditionText = Engine.GetGUIObjectByName("victoryConditionText");
|
||||||
var lockTeamsText = Engine.GetGUIObjectByName("lockTeamsText");
|
var lockTeamsText = Engine.GetGUIObjectByName("lockTeamsText");
|
||||||
var enableCheatsText = Engine.GetGUIObjectByName("enableCheatsText");
|
var enableCheatsText = Engine.GetGUIObjectByName("enableCheatsText");
|
||||||
@@ -977,6 +988,7 @@ function onGameAttributesChange()
|
|||||||
numPlayersSelection.hidden = false;
|
numPlayersSelection.hidden = false;
|
||||||
mapSize.hidden = false;
|
mapSize.hidden = false;
|
||||||
revealMap.hidden = false;
|
revealMap.hidden = false;
|
||||||
|
exploreMap.hidden = false;
|
||||||
victoryCondition.hidden = false;
|
victoryCondition.hidden = false;
|
||||||
lockTeams.hidden = false;
|
lockTeams.hidden = false;
|
||||||
populationCap.hidden = false;
|
populationCap.hidden = false;
|
||||||
@@ -985,6 +997,7 @@ function onGameAttributesChange()
|
|||||||
numPlayersText.hidden = true;
|
numPlayersText.hidden = true;
|
||||||
mapSizeText.hidden = true;
|
mapSizeText.hidden = true;
|
||||||
revealMapText.hidden = true;
|
revealMapText.hidden = true;
|
||||||
|
exploreMapText.hidden = true;
|
||||||
victoryConditionText.hidden = true;
|
victoryConditionText.hidden = true;
|
||||||
lockTeamsText.hidden = true;
|
lockTeamsText.hidden = true;
|
||||||
populationCapText.hidden = true;
|
populationCapText.hidden = true;
|
||||||
@@ -993,7 +1006,9 @@ function onGameAttributesChange()
|
|||||||
mapSizeText.caption = "Map size:";
|
mapSizeText.caption = "Map size:";
|
||||||
mapSize.selected = sizeIdx;
|
mapSize.selected = sizeIdx;
|
||||||
revealMapText.caption = "Reveal map:";
|
revealMapText.caption = "Reveal map:";
|
||||||
|
exploreMapText.caption = "Explore map:";
|
||||||
revealMap.checked = (mapSettings.RevealMap ? true : false);
|
revealMap.checked = (mapSettings.RevealMap ? true : false);
|
||||||
|
exploreMap.checked = (mapSettings.ExploreMap ? true : false);
|
||||||
|
|
||||||
victoryConditionText.caption = "Victory condition:";
|
victoryConditionText.caption = "Victory condition:";
|
||||||
victoryCondition.selected = victoryIdx;
|
victoryCondition.selected = victoryIdx;
|
||||||
@@ -1006,6 +1021,7 @@ function onGameAttributesChange()
|
|||||||
numPlayersText.hidden = false;
|
numPlayersText.hidden = false;
|
||||||
mapSizeText.hidden = false;
|
mapSizeText.hidden = false;
|
||||||
revealMapText.hidden = false;
|
revealMapText.hidden = false;
|
||||||
|
exploreMapText.hidden = false;
|
||||||
victoryConditionText.hidden = false;
|
victoryConditionText.hidden = false;
|
||||||
lockTeamsText.hidden = false;
|
lockTeamsText.hidden = false;
|
||||||
populationCap.hidden = true;
|
populationCap.hidden = true;
|
||||||
@@ -1016,6 +1032,7 @@ function onGameAttributesChange()
|
|||||||
numPlayersText.caption = numPlayers;
|
numPlayersText.caption = numPlayers;
|
||||||
mapSizeText.caption = g_MapSizes.names[sizeIdx];
|
mapSizeText.caption = g_MapSizes.names[sizeIdx];
|
||||||
revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No");
|
revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No");
|
||||||
|
exploreMapText.caption = (mapSettings.ExloreMap ? "Yes" : "No");
|
||||||
victoryConditionText.caption = VICTORY_TEXT[victoryIdx];
|
victoryConditionText.caption = VICTORY_TEXT[victoryIdx];
|
||||||
lockTeamsText.caption = (mapSettings.LockTeams ? "Yes" : "No");
|
lockTeamsText.caption = (mapSettings.LockTeams ? "Yes" : "No");
|
||||||
}
|
}
|
||||||
@@ -1033,6 +1050,7 @@ function onGameAttributesChange()
|
|||||||
{
|
{
|
||||||
//Host
|
//Host
|
||||||
revealMap.hidden = false;
|
revealMap.hidden = false;
|
||||||
|
exploreMap.hidden = false;
|
||||||
victoryCondition.hidden = false;
|
victoryCondition.hidden = false;
|
||||||
lockTeams.hidden = false;
|
lockTeams.hidden = false;
|
||||||
populationCap.hidden = false;
|
populationCap.hidden = false;
|
||||||
@@ -1040,13 +1058,16 @@ function onGameAttributesChange()
|
|||||||
|
|
||||||
numPlayersText.hidden = false;
|
numPlayersText.hidden = false;
|
||||||
revealMapText.hidden = true;
|
revealMapText.hidden = true;
|
||||||
|
exploreMapText.hidden = true;
|
||||||
victoryConditionText.hidden = true;
|
victoryConditionText.hidden = true;
|
||||||
lockTeamsText.hidden = true;
|
lockTeamsText.hidden = true;
|
||||||
populationCapText.hidden = true;
|
populationCapText.hidden = true;
|
||||||
startingResourcesText.hidden = true;
|
startingResourcesText.hidden = true;
|
||||||
|
|
||||||
revealMapText.caption = "Reveal map:";
|
revealMapText.caption = "Reveal map:";
|
||||||
|
exploreMapText.caption = "Explore map:";
|
||||||
revealMap.checked = (mapSettings.RevealMap ? true : false);
|
revealMap.checked = (mapSettings.RevealMap ? true : false);
|
||||||
|
exploreMap.checked = (mapSettings.ExploreMap ? true : false);
|
||||||
|
|
||||||
victoryConditionText.caption = "Victory condition:";
|
victoryConditionText.caption = "Victory condition:";
|
||||||
victoryCondition.selected = victoryIdx;
|
victoryCondition.selected = victoryIdx;
|
||||||
@@ -1058,6 +1079,7 @@ function onGameAttributesChange()
|
|||||||
// Client
|
// Client
|
||||||
numPlayersText.hidden = false;
|
numPlayersText.hidden = false;
|
||||||
revealMapText.hidden = false;
|
revealMapText.hidden = false;
|
||||||
|
exploreMapText.hidden = false;
|
||||||
victoryConditionText.hidden = false;
|
victoryConditionText.hidden = false;
|
||||||
lockTeamsText.hidden = false;
|
lockTeamsText.hidden = false;
|
||||||
populationCap.hidden = true;
|
populationCap.hidden = true;
|
||||||
@@ -1066,6 +1088,7 @@ function onGameAttributesChange()
|
|||||||
startingResourcesText.hidden = false;
|
startingResourcesText.hidden = false;
|
||||||
|
|
||||||
revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No");
|
revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No");
|
||||||
|
exploreMapText.caption = (mapSettings.ExploreMap ? "Yes" : "No");
|
||||||
victoryConditionText.caption = VICTORY_TEXT[victoryIdx];
|
victoryConditionText.caption = VICTORY_TEXT[victoryIdx];
|
||||||
lockTeamsText.caption = (mapSettings.LockTeams ? "Yes" : "No");
|
lockTeamsText.caption = (mapSettings.LockTeams ? "Yes" : "No");
|
||||||
}
|
}
|
||||||
@@ -1078,12 +1101,14 @@ function onGameAttributesChange()
|
|||||||
numPlayersSelection.hidden = true;
|
numPlayersSelection.hidden = true;
|
||||||
mapSize.hidden = true;
|
mapSize.hidden = true;
|
||||||
revealMap.hidden = true;
|
revealMap.hidden = true;
|
||||||
|
exploreMap.hidden = true;
|
||||||
victoryCondition.hidden = true;
|
victoryCondition.hidden = true;
|
||||||
lockTeams.hidden = true;
|
lockTeams.hidden = true;
|
||||||
numPlayersText.hidden = false;
|
numPlayersText.hidden = false;
|
||||||
mapSizeText.hidden = true;
|
mapSizeText.hidden = true;
|
||||||
mapSizeDesc.hidden = true;
|
mapSizeDesc.hidden = true;
|
||||||
revealMapText.hidden = false;
|
revealMapText.hidden = false;
|
||||||
|
exploreMapText.hidden = false;
|
||||||
victoryConditionText.hidden = false;
|
victoryConditionText.hidden = false;
|
||||||
lockTeamsText.hidden = false;
|
lockTeamsText.hidden = false;
|
||||||
populationCap.hidden = true;
|
populationCap.hidden = true;
|
||||||
@@ -1094,6 +1119,7 @@ function onGameAttributesChange()
|
|||||||
numPlayersText.caption = numPlayers;
|
numPlayersText.caption = numPlayers;
|
||||||
mapSizeText.caption = "Default";
|
mapSizeText.caption = "Default";
|
||||||
revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No");
|
revealMapText.caption = (mapSettings.RevealMap ? "Yes" : "No");
|
||||||
|
exploreMapText.caption = (mapSettings.ExploreMap ? "Yes" : "No");
|
||||||
victoryConditionText.caption = VICTORY_TEXT[victoryIdx];
|
victoryConditionText.caption = VICTORY_TEXT[victoryIdx];
|
||||||
lockTeamsText.caption = (mapSettings.LockTeams ? "Yes" : "No");
|
lockTeamsText.caption = (mapSettings.LockTeams ? "Yes" : "No");
|
||||||
Engine.GetGUIObjectByName("populationCap").selected = POPULATION_CAP_DEFAULTIDX;
|
Engine.GetGUIObjectByName("populationCap").selected = POPULATION_CAP_DEFAULTIDX;
|
||||||
|
|||||||
@@ -276,21 +276,29 @@
|
|||||||
<object size="0 0 100% 100%" type="text" style="ModernRightLabelText">Reveal Map:</object>
|
<object size="0 0 100% 100%" type="text" style="ModernRightLabelText">Reveal Map:</object>
|
||||||
</object>
|
</object>
|
||||||
<object size="0 30 40% 58">
|
<object size="0 30 40% 58">
|
||||||
|
<object size="0 0 100% 100%" type="text" style="ModernRightLabelText">Explore Map:</object>
|
||||||
|
</object>
|
||||||
|
<object size="0 60 40% 88">
|
||||||
<object size="0 0 100% 100%" type="text" style="ModernRightLabelText">Teams Locked:</object>
|
<object size="0 0 100% 100%" type="text" style="ModernRightLabelText">Teams Locked:</object>
|
||||||
</object>
|
</object>
|
||||||
<object size="0 60 40% 88" name="enableCheatsDesc" hidden="true">
|
<object size="0 90 40% 118" name="enableCheatsDesc" hidden="true">
|
||||||
<object size="0 0 100% 100%" type="text" style="ModernRightLabelText">Cheats:</object>
|
<object size="0 0 100% 100%" type="text" style="ModernRightLabelText">Cheats:</object>
|
||||||
</object>
|
</object>
|
||||||
|
|
||||||
<object size="40% 0 100% 28">
|
<object size="40% 0 100% 28">
|
||||||
<object name="revealMapText" size="0 0 100% 100%" type="text" style="ModernLeftLabelText"/>
|
<object name="revealMapText" size="0 0 100% 100%" type="text" style="ModernLeftLabelText"/>
|
||||||
<object name="revealMap" size="10 50%-8 26 50%+8" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip" tooltip="Toggle reveal map."/>
|
<object name="revealMap" size="10 50%-8 26 50%+8" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip" tooltip="Toggle reveal map(see everything)."/>
|
||||||
</object>
|
</object>
|
||||||
<object size="40% 30 100% 58">
|
<object size="40% 30 100% 58">
|
||||||
|
<object name="exploreMapText" size="0 0 100% 100%" type="text" style="ModernLeftLabelText"/>
|
||||||
|
<object name="exploreMap" size="10 50%-8 26 50%+8" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip" tooltip="Toggle explore map (see everything apart from enemy units)."/>
|
||||||
|
</object>
|
||||||
|
|
||||||
|
<object size="40% 60 100% 88">
|
||||||
<object name="lockTeamsText" size="0 0 100% 100%" type="text" style="ModernLeftLabelText"/>
|
<object name="lockTeamsText" size="0 0 100% 100%" type="text" style="ModernLeftLabelText"/>
|
||||||
<object name="lockTeams" size="10 50%-8 26 50%+8" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip" tooltip="Toggle locked teams."/>
|
<object name="lockTeams" size="10 50%-8 26 50%+8" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip" tooltip="Toggle locked teams."/>
|
||||||
</object>
|
</object>
|
||||||
<object size="40% 60 100% 88">
|
<object size="40% 90 100% 1188">
|
||||||
<object name="enableCheatsText" size="0 0 100% 100%" type="text" style="ModernLeftLabelText" hidden="true"/>
|
<object name="enableCheatsText" size="0 0 100% 100%" type="text" style="ModernLeftLabelText" hidden="true"/>
|
||||||
<object name="enableCheats" size="10 50%-8 26 50%+8" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip" tooltip="Toggle the usability of cheats."/>
|
<object name="enableCheats" size="10 50%-8 26 50%+8" type="checkbox" style="ModernTickBox" hidden="true" tooltip_style="onscreenToolTip" tooltip="Toggle the usability of cheats."/>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
@@ -36,6 +36,16 @@ function LoadMapSettings(settings)
|
|||||||
cmpObstructionManager.SetPassabilityCircular(true);
|
cmpObstructionManager.SetPassabilityCircular(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (settings.ExploreMap)
|
||||||
|
{
|
||||||
|
// this needs to happen after changing the map to a circular one
|
||||||
|
// as by making the map circular, the explored tiles get reset
|
||||||
|
var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|
||||||
|
if (cmpRangeManager)
|
||||||
|
for (var i = 0; i < settings.PlayerData.length; i++)
|
||||||
|
cmpRangeManager.ExploreAllTiles(i+1);
|
||||||
|
}
|
||||||
|
|
||||||
var cmpEndGameManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_EndGameManager);
|
var cmpEndGameManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_EndGameManager);
|
||||||
if (settings.GameType)
|
if (settings.GameType)
|
||||||
cmpEndGameManager.SetGameType(settings.GameType);
|
cmpEndGameManager.SetGameType(settings.GameType);
|
||||||
|
|||||||
@@ -1430,6 +1430,21 @@ public:
|
|||||||
return m_SharedLosMasks[player];
|
return m_SharedLosMasks[player];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ExploreAllTiles(player_id_t p)
|
||||||
|
{
|
||||||
|
for (u16 j = 0; j < m_TerrainVerticesPerSide; ++j)
|
||||||
|
{
|
||||||
|
for (u16 i = 0; i < m_TerrainVerticesPerSide; ++i)
|
||||||
|
{
|
||||||
|
if (LosIsOffWorld(i,j))
|
||||||
|
continue;
|
||||||
|
u32 &explored = m_ExploredVertices.at(p);
|
||||||
|
explored += !(m_LosState[i + j*m_TerrainVerticesPerSide] & (LOS_EXPLORED << (2*(p-1))));
|
||||||
|
m_LosState[i + j*m_TerrainVerticesPerSide] |= (LOS_EXPLORED << (2*(p-1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void UpdateTerritoriesLos()
|
void UpdateTerritoriesLos()
|
||||||
{
|
{
|
||||||
CmpPtr<ICmpTerritoryManager> cmpTerritoryManager(GetSystemEntity());
|
CmpPtr<ICmpTerritoryManager> cmpTerritoryManager(GetSystemEntity());
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ DEFINE_INTERFACE_METHOD_3("SetEntityFlag", void, ICmpRangeManager, SetEntityFlag
|
|||||||
DEFINE_INTERFACE_METHOD_1("GetEntityFlagMask", u8, ICmpRangeManager, GetEntityFlagMask, std::string)
|
DEFINE_INTERFACE_METHOD_1("GetEntityFlagMask", u8, ICmpRangeManager, GetEntityFlagMask, std::string)
|
||||||
DEFINE_INTERFACE_METHOD_1("GetEntitiesByPlayer", std::vector<entity_id_t>, ICmpRangeManager, GetEntitiesByPlayer, player_id_t)
|
DEFINE_INTERFACE_METHOD_1("GetEntitiesByPlayer", std::vector<entity_id_t>, ICmpRangeManager, GetEntitiesByPlayer, player_id_t)
|
||||||
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpRangeManager, SetDebugOverlay, bool)
|
DEFINE_INTERFACE_METHOD_1("SetDebugOverlay", void, ICmpRangeManager, SetDebugOverlay, bool)
|
||||||
|
DEFINE_INTERFACE_METHOD_1("ExploreAllTiles", void, ICmpRangeManager, ExploreAllTiles, player_id_t)
|
||||||
DEFINE_INTERFACE_METHOD_2("SetLosRevealAll", void, ICmpRangeManager, SetLosRevealAll, player_id_t, bool)
|
DEFINE_INTERFACE_METHOD_2("SetLosRevealAll", void, ICmpRangeManager, SetLosRevealAll, player_id_t, bool)
|
||||||
DEFINE_INTERFACE_METHOD_1("GetLosRevealAll", bool, ICmpRangeManager, GetLosRevealAll, player_id_t)
|
DEFINE_INTERFACE_METHOD_1("GetLosRevealAll", bool, ICmpRangeManager, GetLosRevealAll, player_id_t)
|
||||||
DEFINE_INTERFACE_METHOD_5("GetElevationAdaptedRange", entity_pos_t, ICmpRangeManager, GetElevationAdaptedRange, CFixedVector3D, CFixedVector3D, entity_pos_t, entity_pos_t, entity_pos_t)
|
DEFINE_INTERFACE_METHOD_5("GetElevationAdaptedRange", entity_pos_t, ICmpRangeManager, GetElevationAdaptedRange, CFixedVector3D, CFixedVector3D, entity_pos_t, entity_pos_t, entity_pos_t)
|
||||||
|
|||||||
@@ -332,6 +332,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
std::string GetLosVisibility_wrapper(entity_id_t ent, player_id_t player, bool forceRetainInFog);
|
std::string GetLosVisibility_wrapper(entity_id_t ent, player_id_t player, bool forceRetainInFog);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Explore all tiles (but leave them in the FoW) for player p
|
||||||
|
*/
|
||||||
|
virtual void ExploreAllTiles(player_id_t p) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set whether the whole map should be made visible to the given player.
|
* Set whether the whole map should be made visible to the given player.
|
||||||
* If player is -1, the map will be made visible to all players.
|
* If player is -1, the map will be made visible to all players.
|
||||||
|
|||||||
Reference in New Issue
Block a user