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

◆ DrawBlack()

void Terraria.Main.DrawBlack ( bool force = false)
inlineprotected

Definition at line 73870 of file Main.cs.

73871 {
73872 //IL_0033: Unknown result type (might be due to invalid IL or missing references)
73873 //IL_002c: Unknown result type (might be due to invalid IL or missing references)
73874 //IL_0038: Unknown result type (might be due to invalid IL or missing references)
73875 //IL_00bf: Unknown result type (might be due to invalid IL or missing references)
73876 //IL_00c4: Unknown result type (might be due to invalid IL or missing references)
73877 //IL_00d1: Unknown result type (might be due to invalid IL or missing references)
73878 //IL_00e2: Unknown result type (might be due to invalid IL or missing references)
73879 //IL_00f9: Unknown result type (might be due to invalid IL or missing references)
73880 //IL_010d: Unknown result type (might be due to invalid IL or missing references)
73881 //IL_0128: Unknown result type (might be due to invalid IL or missing references)
73882 //IL_0138: Unknown result type (might be due to invalid IL or missing references)
73883 //IL_014c: Unknown result type (might be due to invalid IL or missing references)
73884 //IL_0160: Unknown result type (might be due to invalid IL or missing references)
73885 //IL_017b: Unknown result type (might be due to invalid IL or missing references)
73886 //IL_018b: Unknown result type (might be due to invalid IL or missing references)
73887 //IL_019a: Unknown result type (might be due to invalid IL or missing references)
73888 //IL_01b1: Unknown result type (might be due to invalid IL or missing references)
73889 //IL_01c0: Unknown result type (might be due to invalid IL or missing references)
73890 //IL_01d7: Unknown result type (might be due to invalid IL or missing references)
73891 //IL_03d1: Unknown result type (might be due to invalid IL or missing references)
73892 //IL_03d6: Unknown result type (might be due to invalid IL or missing references)
73893 //IL_03db: Unknown result type (might be due to invalid IL or missing references)
73894 //IL_03e0: Unknown result type (might be due to invalid IL or missing references)
73895 //IL_03e1: Unknown result type (might be due to invalid IL or missing references)
73896 //IL_03f1: Unknown result type (might be due to invalid IL or missing references)
73897 //IL_03fb: Unknown result type (might be due to invalid IL or missing references)
73898 if (shimmerAlpha == 1f)
73899 {
73900 return;
73901 }
73902 Stopwatch stopwatch = new Stopwatch();
73903 stopwatch.Start();
73904 Vector2 vector = (Vector2)(drawToScreen ? Vector2.Zero : new Vector2((float)offScreenRange, (float)offScreenRange));
73905 int num = (((Color)(ref tileColor)).R + ((Color)(ref tileColor)).G + ((Color)(ref tileColor)).B) / 3;
73906 float num2 = (float)((double)num * 0.4) / 255f;
73907 if (Lighting.Mode == LightMode.Retro)
73908 {
73909 num2 = (float)(((Color)(ref tileColor)).R - 55) / 255f;
73910 if (num2 < 0f)
73911 {
73912 num2 = 0f;
73913 }
73914 }
73915 else if (Lighting.Mode == LightMode.Trippy)
73916 {
73917 num2 = (float)(num - 55) / 255f;
73918 if (num2 < 0f)
73919 {
73920 num2 = 0f;
73921 }
73922 }
73924 Point point = default(Point);
73926 int num3 = (int)((screenPosition.X - vector.X) / 16f - 1f) + point.X;
73927 int num4 = (int)((screenPosition.X + (float)screenWidth + vector.X) / 16f) + 2 - point.X;
73928 int num5 = (int)((screenPosition.Y - vector.Y) / 16f - 1f) + point.Y;
73929 int num6 = (int)((screenPosition.Y + (float)screenHeight + vector.Y) / 16f) + 5 - point.Y;
73930 if (num3 < 0)
73931 {
73932 num3 = point.X;
73933 }
73934 if (num4 > maxTilesX)
73935 {
73936 num4 = maxTilesX - point.X;
73937 }
73938 if (num5 < 0)
73939 {
73940 num5 = point.Y;
73941 }
73942 if (num6 > maxTilesY)
73943 {
73944 num6 = maxTilesY - point.Y;
73945 }
73946 if (!force)
73947 {
73948 if (num5 < maxTilesY / 2)
73949 {
73950 num6 = Math.Min(num6, (int)worldSurface + 1);
73951 num5 = Math.Min(num5, (int)worldSurface + 1);
73952 }
73953 else
73954 {
73955 num6 = Math.Max(num6, UnderworldLayer);
73956 num5 = Math.Max(num5, UnderworldLayer);
73957 }
73958 }
73960 for (int i = num5; i < num6; i++)
73961 {
73962 bool flag2 = i >= UnderworldLayer;
73963 if (flag2)
73964 {
73965 num2 = 0.2f;
73966 }
73967 for (int j = num3; j < num4; j++)
73968 {
73969 int num7 = j;
73970 for (; j < num4; j++)
73971 {
73972 if (!WorldGen.InWorld(j, i))
73973 {
73974 return;
73975 }
73976 if (Main.tile[j, i] == null)
73977 {
73978 Main.tile[j, i] = default(Tile);
73979 }
73980 Tile tile = Main.tile[j, i];
73981 float num8 = Lighting.Brightness(j, i);
73982 num8 = (float)Math.Floor(num8 * 255f) / 255f;
73983 byte b = tile.liquid;
73984 bool num9 = num8 <= num2 && ((!flag2 && b < 250) || WorldGen.SolidTile(tile) || (b >= 200 && num8 == 0f));
73985 bool flag3 = tile.active() && tileBlockLight[tile.type] && (!tile.invisibleBlock() || flag);
73986 bool flag4 = !WallID.Sets.Transparent[tile.wall] && (!tile.invisibleWall() || flag);
73987 if (!num9 || (!flag4 && !flag3) || (!drawToScreen && LiquidRenderer.Instance.HasFullWater(j, i) && tile.wall == 0 && !tile.halfBrick() && !((double)i <= worldSurface)))
73988 {
73989 break;
73990 }
73991 }
73992 if (j - num7 > 0)
73993 {
73994 spriteBatch.Draw(TextureAssets.BlackTile.Value, new Vector2((float)(num7 << 4), (float)(i << 4)) - screenPosition + vector, (Rectangle?)new Rectangle(0, 0, j - num7 << 4, 16), Color.Black);
73995 }
73996 }
73997 }
73998 TimeLogger.DrawTime(5, stopwatch.Elapsed.TotalMilliseconds);
73999 }
static Asset< Texture2D > BlackTile
static bool[] Transparent
Definition WallID.cs:43
static bool[] tileBlockLight
Definition Main.cs:1588
static int maxTilesY
The height of the currently-loaded world in tiles.
Definition Main.cs:1191
static bool ShouldShowInvisibleWalls()
Definition Main.cs:74001
static SpriteBatch spriteBatch
Definition Main.cs:1043
static double worldSurface
The y-coordinate of the top of the dirt layer, in tile coordinates. Corresponds to 0' on the Depth Me...
Definition Main.cs:1351
static bool drawToScreen
Definition Main.cs:628
static int screenHeight
Definition Main.cs:1870
static Vector2 screenPosition
The position of the top left corner of the screen in world coordinates. Modify in M:Terraria....
Definition Main.cs:1864
static int maxTilesX
The width of the currently-loaded world in tiles.
Definition Main.cs:1186
static int offScreenRange
Definition Main.cs:905
static Color tileColor
Definition Main.cs:1345
static int screenWidth
Definition Main.cs:1868
static Point GetScreenOverdrawOffset()
Definition Main.cs:68872
static int UnderworldLayer
The y-coordinate of the top of the underworld, in tile coordinates.
Definition Main.cs:2993
static Tilemap tile
Definition Main.cs:1820
static float shimmerAlpha
Definition Main.cs:1077

References Terraria.GameContent.TextureAssets.BlackTile, Terraria.Lighting.Brightness(), Terraria.Graphics.Light.Color, Terraria.TimeLogger.DrawTime(), Terraria.Main.drawToScreen, Terraria.Main.GetScreenOverdrawOffset(), Terraria.GameContent.Liquid.LiquidRenderer.Instance, Terraria.WorldGen.InWorld(), Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.Lighting.Mode, Terraria.Main.offScreenRange, Terraria.Main.screenHeight, Terraria.Main.screenPosition, Terraria.Main.screenWidth, Terraria.Main.shimmerAlpha, Terraria.Main.ShouldShowInvisibleWalls(), Terraria.WorldGen.SolidTile(), Terraria.Main.spriteBatch, Terraria.Main.tile, Terraria.Main.tileBlockLight, Terraria.Main.tileColor, Terraria.ID.WallID.Sets.Transparent, Terraria.Main.UnderworldLayer, and Terraria.Main.worldSurface.

Referenced by Terraria.Main.DoDraw_WallsAndBlacks(), Terraria.Main.DrawCapture(), and Terraria.Main.RenderBlack().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: