forked from mirrors/0ad
LosRevealAll -> LosRevealWholeMap
This name is more descriptive. And the plan is to split off the extra player value of the vector into an own flag in the future, and LosRevealAllForAll would have been a poor name for that.
This commit is contained in:
@@ -1 +1 @@
|
||||
Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).SetLosRevealAll(-1, true);
|
||||
Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).SetLosRevealWholeMap(-1, true);
|
||||
|
||||
@@ -1968,7 +1968,7 @@ GuiInterface.prototype.GetBatchTime = function(player, data)
|
||||
|
||||
GuiInterface.prototype.IsMapRevealed = function(player)
|
||||
{
|
||||
return Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetLosRevealAll(player);
|
||||
return Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).GetLosRevealWholeMap(player);
|
||||
};
|
||||
|
||||
GuiInterface.prototype.SetPathfinderDebugOverlay = function(player, enabled)
|
||||
|
||||
@@ -488,7 +488,7 @@ Player.prototype.SetState = function(newState, message)
|
||||
const won = this.HasWon();
|
||||
const cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|
||||
if (won)
|
||||
cmpRangeManager.SetLosRevealAll(this.playerID, true);
|
||||
cmpRangeManager.SetLosRevealWholeMap(this.playerID, true);
|
||||
else
|
||||
{
|
||||
// Reassign all player's entities to Gaia.
|
||||
|
||||
@@ -22,7 +22,7 @@ function Cheat(input)
|
||||
cmpPlayer.AddResource(input.text, input.parameter);
|
||||
return;
|
||||
case "revealmap":
|
||||
Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).SetLosRevealAll(-1, true);
|
||||
Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).SetLosRevealWholeMap(-1, true);
|
||||
return;
|
||||
case "maxpopulation":
|
||||
cmpPlayer.SetPopulationBonuses(cmpPopulationManager.GetPopulationCap() + 500);
|
||||
|
||||
@@ -101,7 +101,7 @@ var g_Commands = {
|
||||
// Reveal the map for all players, not just the current player,
|
||||
// primarily to make it obvious to everyone that the player is cheating
|
||||
var cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|
||||
cmpRangeManager.SetLosRevealAll(-1, cmd.enable);
|
||||
cmpRangeManager.SetLosRevealWholeMap(-1, cmd.enable);
|
||||
},
|
||||
|
||||
"walk": function(player, cmd, data)
|
||||
|
||||
@@ -19,7 +19,7 @@ function LoadMapSettings(settings)
|
||||
{
|
||||
const cmpRangeManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager);
|
||||
if (cmpRangeManager)
|
||||
cmpRangeManager.SetLosRevealAll(-1, true);
|
||||
cmpRangeManager.SetLosRevealWholeMap(-1, true);
|
||||
}
|
||||
|
||||
if (settings.DisableTreasures)
|
||||
|
||||
@@ -928,7 +928,7 @@ public:
|
||||
// (TODO: maybe cleverer AIs should be able to optionally retain FoW/SoD)
|
||||
CmpPtr<ICmpRangeManager> cmpRangeManager(GetSystemEntity());
|
||||
if (cmpRangeManager)
|
||||
cmpRangeManager->SetLosRevealAll(player, true);
|
||||
cmpRangeManager->SetLosRevealWholeMap(player, true);
|
||||
}
|
||||
|
||||
void SetRNGSeed(u32 seed) override
|
||||
|
||||
@@ -252,9 +252,9 @@ public:
|
||||
if (cmpRangeManager)
|
||||
{
|
||||
if (enabled)
|
||||
m_MapRevealed = cmpRangeManager->GetLosRevealAll(-1);
|
||||
m_MapRevealed = cmpRangeManager->GetLosRevealWholeMap(-1);
|
||||
// TODO: improve m_MapRevealed state and without fade in
|
||||
cmpRangeManager->SetLosRevealAll(-1, enabled);
|
||||
cmpRangeManager->SetLosRevealWholeMap(-1, enabled);
|
||||
}
|
||||
if (cmpTerritoryManager)
|
||||
cmpTerritoryManager->SetVisibility(!enabled);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -123,7 +123,7 @@ public:
|
||||
void RemoveProjectile(uint32_t) override;
|
||||
|
||||
void RenderModel(CModelAbstract& model, const CVector3D& position, SceneCollector& collector, const CFrustum& frustum, bool culling,
|
||||
const CLosQuerier& los, bool losRevealAll) const;
|
||||
const CLosQuerier& los, bool losRevealWholeMap) const;
|
||||
|
||||
private:
|
||||
struct Projectile
|
||||
@@ -365,12 +365,12 @@ void CCmpProjectileManager::RemoveProjectile(uint32_t id)
|
||||
}
|
||||
|
||||
void CCmpProjectileManager::RenderModel(CModelAbstract& model, const CVector3D& position, SceneCollector& collector,
|
||||
const CFrustum& frustum, bool culling, const CLosQuerier& los, bool losRevealAll) const
|
||||
const CFrustum& frustum, bool culling, const CLosQuerier& los, bool losRevealWholeMap) const
|
||||
{
|
||||
// Don't display objects outside the visible area
|
||||
ssize_t posi = (ssize_t)(0.5f + position.X / LOS_TILE_SIZE);
|
||||
ssize_t posj = (ssize_t)(0.5f + position.Z / LOS_TILE_SIZE);
|
||||
if (!losRevealAll && !los.IsVisible(posi, posj))
|
||||
if (!losRevealWholeMap && !los.IsVisible(posi, posj))
|
||||
return;
|
||||
|
||||
model.ValidatePosition();
|
||||
@@ -388,16 +388,16 @@ void CCmpProjectileManager::RenderSubmit(SceneCollector& collector, const CFrust
|
||||
CmpPtr<ICmpRangeManager> cmpRangeManager(GetSystemEntity());
|
||||
int player = GetSimContext().GetCurrentDisplayedPlayer();
|
||||
CLosQuerier los(cmpRangeManager->GetLosQuerier(player));
|
||||
bool losRevealAll = cmpRangeManager->GetLosRevealAll(player);
|
||||
bool losRevealWholeMap = cmpRangeManager->GetLosRevealWholeMap(player);
|
||||
|
||||
for (const Projectile& projectile : m_Projectiles)
|
||||
{
|
||||
RenderModel(projectile.unit->GetModel(), projectile.pos, collector, frustum, culling, los, losRevealAll);
|
||||
RenderModel(projectile.unit->GetModel(), projectile.pos, collector, frustum, culling, los, losRevealWholeMap);
|
||||
}
|
||||
|
||||
for (const ProjectileImpactAnimation& projectileImpactAnimation : m_ProjectileImpactAnimations)
|
||||
{
|
||||
RenderModel(projectileImpactAnimation.unit->GetModel(), projectileImpactAnimation.pos,
|
||||
collector, frustum, culling, los, losRevealAll);
|
||||
collector, frustum, culling, los, losRevealWholeMap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -431,7 +431,7 @@ public:
|
||||
|
||||
using LosRegion = std::pair<u16, u16>;
|
||||
|
||||
std::array<bool, MAX_LOS_PLAYER_ID+2> m_LosRevealAll;
|
||||
std::array<bool, MAX_LOS_PLAYER_ID+2> m_LosRevealWholeMap;
|
||||
bool m_LosCircular;
|
||||
i32 m_LosVerticesPerSide;
|
||||
|
||||
@@ -493,7 +493,7 @@ public:
|
||||
|
||||
// The whole map should be visible to Gaia by default, else e.g. animals
|
||||
// will get confused when trying to run from enemies
|
||||
m_LosRevealAll[0] = true;
|
||||
m_LosRevealWholeMap[0] = true;
|
||||
|
||||
m_GlobalVisibilityUpdate = true;
|
||||
|
||||
@@ -517,7 +517,7 @@ public:
|
||||
Serializer(serialize, "queries", m_Queries, GetSimContext());
|
||||
Serializer(serialize, "entity data", m_EntityData);
|
||||
|
||||
Serializer(serialize, "los reveal all", m_LosRevealAll);
|
||||
Serializer(serialize, "los reveal all", m_LosRevealWholeMap);
|
||||
serialize.Bool("los circular", m_LosCircular);
|
||||
serialize.NumberI32_Unbounded("los verts per side", m_LosVerticesPerSide);
|
||||
|
||||
@@ -1722,7 +1722,7 @@ public:
|
||||
|
||||
CLosQuerier GetLosQuerier(player_id_t player) const override
|
||||
{
|
||||
if (GetLosRevealAll(player))
|
||||
if (GetLosRevealWholeMap(player))
|
||||
return CLosQuerier(0xFFFFFFFFu, m_LosStateRevealed, m_LosVerticesPerSide);
|
||||
else
|
||||
return CLosQuerier(GetSharedLosMask(player), m_LosState, m_LosVerticesPerSide);
|
||||
@@ -1754,7 +1754,7 @@ public:
|
||||
int j = (pos.Y / LOS_TILE_SIZE).ToInt_RoundToNearest();
|
||||
|
||||
// Reveal flag makes all positioned entities visible and all mirages useless
|
||||
if (GetLosRevealAll(player))
|
||||
if (GetLosRevealWholeMap(player))
|
||||
{
|
||||
if (LosIsOffWorld(i, j) || cmpMirage)
|
||||
return LosVisibility::HIDDEN;
|
||||
@@ -1881,7 +1881,7 @@ public:
|
||||
int j = (z / LOS_TILE_SIZE).ToInt_RoundToNearest();
|
||||
|
||||
// Reveal flag makes all positioned entities visible and all mirages useless
|
||||
if (GetLosRevealAll(player))
|
||||
if (GetLosRevealWholeMap(player))
|
||||
{
|
||||
if (LosIsOffWorld(i, j))
|
||||
return LosVisibility::HIDDEN;
|
||||
@@ -2001,28 +2001,28 @@ public:
|
||||
UpdateVisibility(ent, player);
|
||||
}
|
||||
|
||||
void SetLosRevealAll(player_id_t player, bool enabled) override
|
||||
void SetLosRevealWholeMap(player_id_t player, bool enabled) override
|
||||
{
|
||||
if (player == -1)
|
||||
m_LosRevealAll[MAX_LOS_PLAYER_ID+1] = enabled;
|
||||
m_LosRevealWholeMap[MAX_LOS_PLAYER_ID+1] = enabled;
|
||||
else
|
||||
{
|
||||
ENSURE(player >= 0 && player <= MAX_LOS_PLAYER_ID);
|
||||
m_LosRevealAll[player] = enabled;
|
||||
m_LosRevealWholeMap[player] = enabled;
|
||||
}
|
||||
|
||||
// On next update, update the visibility of every entity in the world
|
||||
m_GlobalVisibilityUpdate = true;
|
||||
}
|
||||
|
||||
bool GetLosRevealAll(player_id_t player) const override
|
||||
bool GetLosRevealWholeMap(player_id_t player) const override
|
||||
{
|
||||
// Special player value can force reveal-all for every player
|
||||
if (m_LosRevealAll[MAX_LOS_PLAYER_ID+1] || player == -1)
|
||||
if (m_LosRevealWholeMap[MAX_LOS_PLAYER_ID+1] || player == -1)
|
||||
return true;
|
||||
ENSURE(player >= 0 && player <= MAX_LOS_PLAYER_ID+1);
|
||||
// Otherwise check the player-specific flag
|
||||
if (m_LosRevealAll[player])
|
||||
if (m_LosRevealWholeMap[player])
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -62,8 +62,8 @@ DEFINE_INTERFACE_METHOD("GetGaiaAndNonGaiaEntities", ICmpRangeManager, GetGaiaAn
|
||||
DEFINE_INTERFACE_METHOD("SetDebugOverlay", ICmpRangeManager, SetDebugOverlay)
|
||||
DEFINE_INTERFACE_METHOD("ExploreMap", ICmpRangeManager, ExploreMap)
|
||||
DEFINE_INTERFACE_METHOD("ExploreTerritories", ICmpRangeManager, ExploreTerritories)
|
||||
DEFINE_INTERFACE_METHOD("SetLosRevealAll", ICmpRangeManager, SetLosRevealAll)
|
||||
DEFINE_INTERFACE_METHOD("GetLosRevealAll", ICmpRangeManager, GetLosRevealAll)
|
||||
DEFINE_INTERFACE_METHOD("SetLosRevealWholeMap", ICmpRangeManager, SetLosRevealWholeMap)
|
||||
DEFINE_INTERFACE_METHOD("GetLosRevealWholeMap", ICmpRangeManager, GetLosRevealWholeMap)
|
||||
DEFINE_INTERFACE_METHOD("GetEffectiveParabolicRange", ICmpRangeManager, GetEffectiveParabolicRange)
|
||||
DEFINE_INTERFACE_METHOD("GetElevationAdaptedRange", ICmpRangeManager, GetElevationAdaptedRange)
|
||||
DEFINE_INTERFACE_METHOD("ActivateScriptedVisibility", ICmpRangeManager, ActivateScriptedVisibility)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -292,14 +292,14 @@ public:
|
||||
/**
|
||||
* Returns the visibility status of the given entity, with respect to the given player.
|
||||
* Returns LosVisibility::HIDDEN if the entity doesn't exist or is not in the world.
|
||||
* This respects the GetLosRevealAll flag.
|
||||
* This respects the GetLosRevealWholeMap flag.
|
||||
*/
|
||||
virtual LosVisibility GetLosVisibility(CEntityHandle ent, player_id_t player) const = 0;
|
||||
virtual LosVisibility GetLosVisibility(entity_id_t ent, player_id_t player) const = 0;
|
||||
|
||||
/**
|
||||
* Returns the visibility status of the given position, with respect to the given player.
|
||||
* This respects the GetLosRevealAll flag.
|
||||
* This respects the GetLosRevealWholeMap flag.
|
||||
*/
|
||||
virtual LosVisibility GetLosVisibilityPosition(entity_pos_t x, entity_pos_t z, player_id_t player) const = 0;
|
||||
|
||||
@@ -345,12 +345,12 @@ public:
|
||||
* 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.
|
||||
*/
|
||||
virtual void SetLosRevealAll(player_id_t player, bool enabled) = 0;
|
||||
virtual void SetLosRevealWholeMap(player_id_t player, bool enabled) = 0;
|
||||
|
||||
/**
|
||||
* Returns whether the whole map has been made visible to the given player.
|
||||
*/
|
||||
virtual bool GetLosRevealAll(player_id_t player) const = 0;
|
||||
virtual bool GetLosRevealWholeMap(player_id_t player) const = 0;
|
||||
|
||||
/**
|
||||
* Set the LOS to be restricted to a circular map.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2025 Wildfire Games.
|
||||
/* Copyright (C) 2026 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -43,7 +43,7 @@ enum class LosState : u8
|
||||
* Object providing efficient abstracted access to the LOS state.
|
||||
* This depends on some implementation details of CCmpRangeManager.
|
||||
*
|
||||
* This *ignores* the GetLosRevealAll flag - callers should check that explicitly.
|
||||
* This *ignores* the GetLosRevealWholeMap flag - callers should check that explicitly.
|
||||
*/
|
||||
class CLosQuerier
|
||||
{
|
||||
|
||||
@@ -334,7 +334,7 @@ ActorViewer::ActorViewer()
|
||||
// Remove FOW since we're in Atlas
|
||||
CmpPtr<ICmpRangeManager> cmpRangeManager(m.Simulation2, SYSTEM_ENTITY);
|
||||
if (cmpRangeManager)
|
||||
cmpRangeManager->SetLosRevealAll(-1, true);
|
||||
cmpRangeManager->SetLosRevealWholeMap(-1, true);
|
||||
|
||||
m.Simulation2.InitGame();
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace
|
||||
// as visual actors cache their visibility state on first render.
|
||||
CmpPtr<ICmpRangeManager> cmpRangeManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY);
|
||||
if (cmpRangeManager)
|
||||
cmpRangeManager->SetLosRevealAll(-1, true);
|
||||
cmpRangeManager->SetLosRevealWholeMap(-1, true);
|
||||
|
||||
PSRETURN ret = g_Game->ReallyStartGame();
|
||||
ENSURE(ret == PSRETURN_OK);
|
||||
|
||||
Reference in New Issue
Block a user