Fix GPS/Disabled shroud
This commit is contained in:
@@ -151,7 +151,7 @@ namespace OpenRA
|
|||||||
public static void LoadMap(string mapName)
|
public static void LoadMap(string mapName)
|
||||||
{
|
{
|
||||||
Timer.Time( "----LoadMap" );
|
Timer.Time( "----LoadMap" );
|
||||||
|
SheetBuilder.Initialize(renderer);
|
||||||
var manifest = new Manifest(LobbyInfo.GlobalSettings.Mods);
|
var manifest = new Manifest(LobbyInfo.GlobalSettings.Mods);
|
||||||
Timer.Time( "manifest: {0}" );
|
Timer.Time( "manifest: {0}" );
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
|
* along with OpenRA. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
using System;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.FileFormats.Graphics;
|
using OpenRA.FileFormats.Graphics;
|
||||||
@@ -47,6 +47,8 @@ namespace OpenRA.Graphics
|
|||||||
Vertex[] vertices = new Vertex[4 * map.Height * map.Width];
|
Vertex[] vertices = new Vertex[4 * map.Height * map.Width];
|
||||||
ushort[] indices = new ushort[6 * map.Height * map.Width];
|
ushort[] indices = new ushort[6 * map.Height * map.Width];
|
||||||
|
|
||||||
|
terrainSheet = tileMapping[map.MapTiles[map.TopLeft.X, map.TopLeft.Y]].sheet;
|
||||||
|
|
||||||
int nv = 0;
|
int nv = 0;
|
||||||
int ni = 0;
|
int ni = 0;
|
||||||
for( int j = map.TopLeft.Y ; j < map.BottomRight.Y; j++ )
|
for( int j = map.TopLeft.Y ; j < map.BottomRight.Y; j++ )
|
||||||
@@ -58,9 +60,10 @@ namespace OpenRA.Graphics
|
|||||||
Util.FastCreateQuad(vertices, indices, Game.CellSize * new float2(i, j), tile, 0, nv, ni, tile.size);
|
Util.FastCreateQuad(vertices, indices, Game.CellSize * new float2(i, j), tile, 0, nv, ni, tile.size);
|
||||||
nv += 4;
|
nv += 4;
|
||||||
ni += 6;
|
ni += 6;
|
||||||
}
|
|
||||||
|
|
||||||
terrainSheet = tileMapping[map.MapTiles[map.TopLeft.X, map.TopLeft.Y]].sheet;
|
if (tileMapping[map.MapTiles[i, j]].sheet != terrainSheet)
|
||||||
|
throw new InvalidOperationException("Terrain sprites span multiple sheets");
|
||||||
|
}
|
||||||
|
|
||||||
vertexBuffer = renderer.Device.CreateVertexBuffer( vertices.Length );
|
vertexBuffer = renderer.Device.CreateVertexBuffer( vertices.Length );
|
||||||
vertexBuffer.SetData( vertices );
|
vertexBuffer.SetData( vertices );
|
||||||
@@ -85,7 +88,7 @@ namespace OpenRA.Graphics
|
|||||||
if (firstRow < 0) firstRow = 0;
|
if (firstRow < 0) firstRow = 0;
|
||||||
if (lastRow > map.Height) lastRow = map.Height;
|
if (lastRow > map.Height) lastRow = map.Height;
|
||||||
|
|
||||||
if (!Game.world.LocalPlayer.Shroud.HasGPS && Game.world.LocalPlayer.Shroud.bounds.HasValue)
|
if (!Game.world.LocalPlayer.Shroud.Disabled && Game.world.LocalPlayer.Shroud.bounds.HasValue)
|
||||||
{
|
{
|
||||||
var r = Game.world.LocalPlayer.Shroud.bounds.Value;
|
var r = Game.world.LocalPlayer.Shroud.bounds.Value;
|
||||||
if (firstRow < r.Top - map.YOffset)
|
if (firstRow < r.Top - map.YOffset)
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ namespace OpenRA.Graphics
|
|||||||
|
|
||||||
Rectangle GetBoundsRect()
|
Rectangle GetBoundsRect()
|
||||||
{
|
{
|
||||||
if (!world.LocalPlayer.Shroud.HasGPS && world.LocalPlayer.Shroud.bounds.HasValue)
|
if (!world.LocalPlayer.Shroud.Disabled && world.LocalPlayer.Shroud.bounds.HasValue)
|
||||||
{
|
{
|
||||||
var r = world.LocalPlayer.Shroud.bounds.Value;
|
var r = world.LocalPlayer.Shroud.bounds.Value;
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ namespace OpenRA
|
|||||||
Sprite[,] sprites, fogSprites;
|
Sprite[,] sprites, fogSprites;
|
||||||
|
|
||||||
bool dirty = true;
|
bool dirty = true;
|
||||||
bool hasGPS = false;
|
bool disabled = false;
|
||||||
Player owner;
|
Player owner;
|
||||||
Map map;
|
Map map;
|
||||||
|
|
||||||
@@ -50,14 +50,19 @@ namespace OpenRA
|
|||||||
shroud.Dirty += () => dirty = true;
|
shroud.Dirty += () => dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasGPS
|
public bool Disabled
|
||||||
{
|
{
|
||||||
get { return hasGPS; }
|
get { return disabled; }
|
||||||
set { hasGPS = value; dirty = true;}
|
set { disabled = value; dirty = true;}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsExplored(int2 xy) { return IsExplored(xy.X, xy.Y); }
|
public bool IsExplored(int2 xy) { return IsExplored(xy.X, xy.Y); }
|
||||||
bool IsExplored(int x, int y) { return shroud.exploredCells[x,y]; }
|
bool IsExplored(int x, int y)
|
||||||
|
{
|
||||||
|
if (disabled)
|
||||||
|
return true;
|
||||||
|
return shroud.exploredCells[x,y];
|
||||||
|
}
|
||||||
|
|
||||||
public bool DisplayOnRadar(int x, int y) { return IsExplored(x, y); }
|
public bool DisplayOnRadar(int x, int y) { return IsExplored(x, y); }
|
||||||
|
|
||||||
@@ -132,6 +137,9 @@ namespace OpenRA
|
|||||||
|
|
||||||
internal void Draw(SpriteRenderer r)
|
internal void Draw(SpriteRenderer r)
|
||||||
{
|
{
|
||||||
|
if (disabled)
|
||||||
|
return;
|
||||||
|
|
||||||
if (dirty)
|
if (dirty)
|
||||||
{
|
{
|
||||||
dirty = false;
|
dirty = false;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#region Copyright & License Information
|
#region Copyright & License Information
|
||||||
/*
|
/*
|
||||||
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
* Copyright 2007,2009,2010 Chris Forbes, Robert Pepperell, Matthew Bowra-Dean, Paul Chote, Alli Witheford.
|
||||||
* This file is part of OpenRA.
|
* This file is part of OpenRA.
|
||||||
@@ -50,7 +50,7 @@ namespace OpenRA.Mods.RA
|
|||||||
|
|
||||||
w.Add(new SatelliteLaunch(launchSite));
|
w.Add(new SatelliteLaunch(launchSite));
|
||||||
w.Add(new DelayedAction((Info as GpsPowerInfo).RevealDelay * 25,
|
w.Add(new DelayedAction((Info as GpsPowerInfo).RevealDelay * 25,
|
||||||
() => Owner.Shroud.HasGPS = true));
|
() => Owner.Shroud.Disabled = true));
|
||||||
});
|
});
|
||||||
|
|
||||||
FinishActivate();
|
FinishActivate();
|
||||||
|
|||||||
Reference in New Issue
Block a user