diff --git a/OpenRa.Game/Shroud.cs b/OpenRa.Game/Shroud.cs index b2f60a891b..697e774406 100644 --- a/OpenRa.Game/Shroud.cs +++ b/OpenRa.Game/Shroud.cs @@ -13,10 +13,21 @@ namespace OpenRa.Game Sprite[] shadowBits = SpriteSheetBuilder.LoadAllSprites("shadow"); Sprite[,] sprites = new Sprite[128, 128]; bool dirty; - - public bool IsExplored(int2 xy) + bool hasGPS = false; + + public bool HasGPS { - return explored[ xy.X, xy.Y ]; + get { return hasGPS; } + set { hasGPS = value; dirty = true;} + } + + public bool IsExplored(int2 xy) { return IsExplored(xy.X, xy.Y); } + public bool IsExplored(int x, int y) + { + if (hasGPS) + return true; + + return explored[ x, y ]; } public void Explore(Actor a) @@ -26,22 +37,6 @@ namespace OpenRa.Game dirty = true; } - - public void RevealAll() - { - for (int x = 0; x < 128; x++) - for (int y = 0; y < 128; y++) - explored[x, y] = true; - dirty = true; - } - - public void HideAll() - { - for (int x = 0; x < 128; x++) - for (int y = 0; y < 128; y++) - explored[x, y] = false; - dirty = true; - } static readonly byte[] ShroudTiles = { @@ -67,11 +62,11 @@ namespace OpenRa.Game { // bits are for exploredness: left, right, up, down, self var v = 0; - if (explored[i - 1, j]) v |= 1; - if (explored[i + 1, j]) v |= 2; - if (explored[i, j - 1]) v |= 4; - if (explored[i, j + 1]) v |= 8; - if (explored[i, j]) v |= 16; + if (IsExplored(i - 1, j)) v |= 1; + if (IsExplored(i + 1, j)) v |= 2; + if (IsExplored(i, j - 1)) v |= 4; + if (IsExplored(i, j + 1)) v |= 8; + if (IsExplored(i, j)) v |= 16; var x = ShroudTiles[v]; if (x != 0) @@ -79,10 +74,10 @@ namespace OpenRa.Game // bits are for exploredness: TL, TR, BR, BL var u = 0; - if (explored[i - 1, j - 1]) u |= 1; - if (explored[i + 1, j - 1]) u |= 2; - if (explored[i + 1, j + 1]) u |= 4; - if (explored[i - 1, j + 1]) u |= 8; + if (IsExplored(i - 1, j - 1)) u |= 1; + if (IsExplored(i + 1, j - 1)) u |= 2; + if (IsExplored(i + 1, j + 1)) u |= 4; + if (IsExplored(i - 1, j + 1)) u |= 8; return shadowBits[ExtraShroudTiles[u]]; } diff --git a/OpenRa.Game/Traits/GpsSatellite.cs b/OpenRa.Game/Traits/GpsSatellite.cs index e71f8a3455..f735f941be 100644 --- a/OpenRa.Game/Traits/GpsSatellite.cs +++ b/OpenRa.Game/Traits/GpsSatellite.cs @@ -17,7 +17,7 @@ namespace OpenRa.Game.Traits if (fired && --revealTicks == 0) { - self.Owner.Shroud.RevealAll(); + self.Owner.Shroud.HasGPS = true; } } public void Activate(Actor self)