From 21a61721a7029eb04d2b1daec90fa8bb92d3dd63 Mon Sep 17 00:00:00 2001 From: Vantha Date: Mon, 12 Jan 2026 14:51:15 +0100 Subject: [PATCH] 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. --- .../public/maps/random/wall_demo_triggers.js | 2 +- .../simulation/components/GuiInterface.js | 2 +- .../public/simulation/components/Player.js | 2 +- .../mods/public/simulation/helpers/Cheat.js | 2 +- .../public/simulation/helpers/Commands.js | 2 +- .../mods/public/simulation/helpers/Setup.js | 2 +- .../simulation2/components/CCmpAIManager.cpp | 2 +- .../components/CCmpCinemaManager.cpp | 4 +-- .../components/CCmpProjectileManager.cpp | 14 +++++----- .../components/CCmpRangeManager.cpp | 26 +++++++++---------- .../components/ICmpRangeManager.cpp | 6 ++--- .../simulation2/components/ICmpRangeManager.h | 10 +++---- source/simulation2/helpers/Los.h | 4 +-- .../tools/atlas/GameInterface/ActorViewer.cpp | 2 +- .../GameInterface/Handlers/MapHandlers.cpp | 2 +- 15 files changed, 41 insertions(+), 41 deletions(-) diff --git a/binaries/data/mods/public/maps/random/wall_demo_triggers.js b/binaries/data/mods/public/maps/random/wall_demo_triggers.js index cbe6124c57..52329a8356 100644 --- a/binaries/data/mods/public/maps/random/wall_demo_triggers.js +++ b/binaries/data/mods/public/maps/random/wall_demo_triggers.js @@ -1 +1 @@ -Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).SetLosRevealAll(-1, true); +Engine.QueryInterface(SYSTEM_ENTITY, IID_RangeManager).SetLosRevealWholeMap(-1, true); diff --git a/binaries/data/mods/public/simulation/components/GuiInterface.js b/binaries/data/mods/public/simulation/components/GuiInterface.js index c3b375f445..1f892f7ea7 100644 --- a/binaries/data/mods/public/simulation/components/GuiInterface.js +++ b/binaries/data/mods/public/simulation/components/GuiInterface.js @@ -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) diff --git a/binaries/data/mods/public/simulation/components/Player.js b/binaries/data/mods/public/simulation/components/Player.js index 891dc68f09..200ab1191d 100644 --- a/binaries/data/mods/public/simulation/components/Player.js +++ b/binaries/data/mods/public/simulation/components/Player.js @@ -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. diff --git a/binaries/data/mods/public/simulation/helpers/Cheat.js b/binaries/data/mods/public/simulation/helpers/Cheat.js index 31a18686e3..757eed6abb 100644 --- a/binaries/data/mods/public/simulation/helpers/Cheat.js +++ b/binaries/data/mods/public/simulation/helpers/Cheat.js @@ -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); diff --git a/binaries/data/mods/public/simulation/helpers/Commands.js b/binaries/data/mods/public/simulation/helpers/Commands.js index 3412d26fd7..5f69bfd1a9 100644 --- a/binaries/data/mods/public/simulation/helpers/Commands.js +++ b/binaries/data/mods/public/simulation/helpers/Commands.js @@ -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) diff --git a/binaries/data/mods/public/simulation/helpers/Setup.js b/binaries/data/mods/public/simulation/helpers/Setup.js index 2c616fbbc1..d2c7a7970a 100644 --- a/binaries/data/mods/public/simulation/helpers/Setup.js +++ b/binaries/data/mods/public/simulation/helpers/Setup.js @@ -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) diff --git a/source/simulation2/components/CCmpAIManager.cpp b/source/simulation2/components/CCmpAIManager.cpp index 1cc2b51642..dcfdef0354 100644 --- a/source/simulation2/components/CCmpAIManager.cpp +++ b/source/simulation2/components/CCmpAIManager.cpp @@ -928,7 +928,7 @@ public: // (TODO: maybe cleverer AIs should be able to optionally retain FoW/SoD) CmpPtr cmpRangeManager(GetSystemEntity()); if (cmpRangeManager) - cmpRangeManager->SetLosRevealAll(player, true); + cmpRangeManager->SetLosRevealWholeMap(player, true); } void SetRNGSeed(u32 seed) override diff --git a/source/simulation2/components/CCmpCinemaManager.cpp b/source/simulation2/components/CCmpCinemaManager.cpp index 9f7ddcfe9d..9374dcefbb 100644 --- a/source/simulation2/components/CCmpCinemaManager.cpp +++ b/source/simulation2/components/CCmpCinemaManager.cpp @@ -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); diff --git a/source/simulation2/components/CCmpProjectileManager.cpp b/source/simulation2/components/CCmpProjectileManager.cpp index bcf9019672..4fe563f56c 100644 --- a/source/simulation2/components/CCmpProjectileManager.cpp +++ b/source/simulation2/components/CCmpProjectileManager.cpp @@ -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 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); } } diff --git a/source/simulation2/components/CCmpRangeManager.cpp b/source/simulation2/components/CCmpRangeManager.cpp index a9fb786e39..976898bb19 100644 --- a/source/simulation2/components/CCmpRangeManager.cpp +++ b/source/simulation2/components/CCmpRangeManager.cpp @@ -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; - std::array m_LosRevealAll; + std::array 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; diff --git a/source/simulation2/components/ICmpRangeManager.cpp b/source/simulation2/components/ICmpRangeManager.cpp index b94d84919b..4f01d0fae2 100644 --- a/source/simulation2/components/ICmpRangeManager.cpp +++ b/source/simulation2/components/ICmpRangeManager.cpp @@ -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) diff --git a/source/simulation2/components/ICmpRangeManager.h b/source/simulation2/components/ICmpRangeManager.h index e81796e883..f9f87640ab 100644 --- a/source/simulation2/components/ICmpRangeManager.h +++ b/source/simulation2/components/ICmpRangeManager.h @@ -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. diff --git a/source/simulation2/helpers/Los.h b/source/simulation2/helpers/Los.h index e4e25c7a19..ca6e73dcf7 100644 --- a/source/simulation2/helpers/Los.h +++ b/source/simulation2/helpers/Los.h @@ -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 { diff --git a/source/tools/atlas/GameInterface/ActorViewer.cpp b/source/tools/atlas/GameInterface/ActorViewer.cpp index 30005e4a22..21d4ef9ad8 100644 --- a/source/tools/atlas/GameInterface/ActorViewer.cpp +++ b/source/tools/atlas/GameInterface/ActorViewer.cpp @@ -334,7 +334,7 @@ ActorViewer::ActorViewer() // Remove FOW since we're in Atlas CmpPtr cmpRangeManager(m.Simulation2, SYSTEM_ENTITY); if (cmpRangeManager) - cmpRangeManager->SetLosRevealAll(-1, true); + cmpRangeManager->SetLosRevealWholeMap(-1, true); m.Simulation2.InitGame(); } diff --git a/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp b/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp index 079c2cbbff..4f8df2f804 100644 --- a/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp +++ b/source/tools/atlas/GameInterface/Handlers/MapHandlers.cpp @@ -115,7 +115,7 @@ namespace // as visual actors cache their visibility state on first render. CmpPtr 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);