Skip to content

Commit

Permalink
Lights fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kaczy93 committed Aug 13, 2024
1 parent 3733e6a commit ec72dab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
10 changes: 6 additions & 4 deletions CentrED/Map/LightObject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions CentrED/Map/MapManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ public void Reset()
StaticTiles = new List<StaticObject>[Client.Width * 8, Client.Height * 8];
GhostLandTiles.Clear();
GhostStaticTiles.Clear();
LightTiles.Clear();
AllTiles.Clear();
ViewRange = Rectangle.Empty;
Client.ResizeCache(0);
Expand Down

0 comments on commit ec72dab

Please sign in to comment.