Allow GPS to be revoked
This commit is contained in:
@@ -13,10 +13,21 @@ namespace OpenRa.Game
|
||||
Sprite[] shadowBits = SpriteSheetBuilder.LoadAllSprites("shadow");
|
||||
Sprite[,] sprites = new Sprite[128, 128];
|
||||
bool dirty;
|
||||
bool hasGPS = false;
|
||||
|
||||
public bool IsExplored(int2 xy)
|
||||
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)
|
||||
@@ -27,22 +38,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 =
|
||||
{
|
||||
0xf,0xf,0xf,0xf,
|
||||
@@ -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]];
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user