Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ExportToMiniMap()

void Terraria.Graphics.Light.LightingEngine.ExportToMiniMap ( )
inlineprivate

Definition at line 240 of file LightingEngine.cs.

241 {
242 //IL_0102: Unknown result type (might be due to invalid IL or missing references)
243 //IL_010d: Expected O, but got Unknown
244 if (!Main.mapEnabled || _activeProcessedArea.Width <= 0 || _activeProcessedArea.Height <= 0)
245 {
246 return;
247 }
249 Rectangle value = new Rectangle(0, 0, Main.maxTilesX, Main.maxTilesY);
250 value.Inflate(-40, -40);
252 Main.mapMinX = area.Left;
253 Main.mapMinY = area.Top;
254 Main.mapMaxX = area.Right;
255 Main.mapMaxY = area.Bottom;
256 FastParallel.For(area.Left, area.Right, (ParallelForAction)delegate(int start, int end, object context)
257 {
258 for (int i = start; i < end; i++)
259 {
260 for (int j = area.Top; j < area.Bottom; j++)
261 {
263 float num = Math.Max(Math.Max(vector.X, vector.Y), vector.Z);
264 byte light = (byte)Math.Min(255, (int)(num * 255f));
265 Main.Map.UpdateLighting(i, j, light);
266 }
267 }
268 }, (object)null);
269 Main.updateMap = true;
270 }
static void For(int fromInclusive, int toExclusive, ParallelForAction callback, object context=null)
static byte Min(byte val1, byte val2)
Definition Math.cs:912
static byte Max(byte val1, byte val2)
Definition Math.cs:738
delegate void ParallelForAction(int fromInclusive, int toExclusive, object context)
static Rectangle Intersect(Rectangle value1, Rectangle value2)
Definition Rectangle.cs:143

References Terraria.Graphics.Light.LightingEngine._activeLightMap, Terraria.Graphics.Light.LightingEngine._activeProcessedArea, ReLogic.Threading.FastParallel.For(), Microsoft.Xna.Framework.Rectangle.Height, Microsoft.Xna.Framework.Rectangle.Intersect(), Terraria.Main.Map, Terraria.Main.mapEnabled, System.Math.Max(), Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, System.Math.Min(), ReLogic.Threading.ParallelForAction(), System.start, System.value, Microsoft.Xna.Framework.Rectangle.Width, Microsoft.Xna.Framework.Rectangle.X, and Microsoft.Xna.Framework.Rectangle.Y.

Referenced by Terraria.Graphics.Light.LightingEngine.ProcessArea().