diff --git a/CentrED/Map/LightObject.cs b/CentrED/Map/LightObject.cs index f6a6ba7..c13b5e3 100644 --- a/CentrED/Map/LightObject.cs +++ b/CentrED/Map/LightObject.cs @@ -57,7 +57,7 @@ public void Update() var tiledata = TileDataLoader.Instance.StaticData[staticTile.Id]; lightId = tiledata.Layer; } - if (LightsManager.Instance.ShowInvisibleLights && (so.RealBounds.Width <= 0 || so.RealBounds.Height <= 0)) + if (LightsManager.Instance.ShowInvisibleLights && (so.RealBounds.Width < 0 || so.RealBounds.Height < 0)) { so.UpdateId(LightsManager.Instance.VisibleLightId); } @@ -108,9 +108,11 @@ public void Update() { Vertices[i].Hue = hue; } - - var posX = staticTile.X * TileObject.TILE_SIZE - so.TextureBounds.Height / 4f; - var posY = staticTile.Y * TileObject.TILE_SIZE - so.TextureBounds.Height / 4f; + + //Don't use so.TextureBounds as it can have different graphic ie. invisible light source + var tileSpriteInfo = Application.CEDGame.MapManager.Arts.GetArt(so.StaticTile.Id); + var posX = staticTile.X * TileObject.TILE_SIZE - tileSpriteInfo.UV.Height / 4f; + var posY = staticTile.Y * TileObject.TILE_SIZE - tileSpriteInfo.UV.Height / 4f; var posZ = staticTile.Z * TileObject.TILE_Z_SCALE; //Handle FlatView var sqrt2 = (float)Math.Sqrt(2); diff --git a/CentrED/Map/MapManager.cs b/CentrED/Map/MapManager.cs index 076709d..8cbd598 100644 --- a/CentrED/Map/MapManager.cs +++ b/CentrED/Map/MapManager.cs @@ -752,6 +752,7 @@ public void Reset() StaticTiles = new List[Client.Width * 8, Client.Height * 8]; GhostLandTiles.Clear(); GhostStaticTiles.Clear(); + LightTiles.Clear(); AllTiles.Clear(); ViewRange = Rectangle.Empty; Client.ResizeCache(0);