41 {
42 float gfxQuality = Main.gfxQuality;
43 int offScreenRange = Main.offScreenRange;
44 bool drawToScreen = Main.drawToScreen;
45 Vector2 screenPosition = Main.screenPosition;
46 int screenWidth = Main.screenWidth;
47 int screenHeight = Main.screenHeight;
48 int maxTilesX = Main.maxTilesX;
49 int maxTilesY = Main.maxTilesY;
50 int[] wallBlend = Main.wallBlend;
56 int num = (int)(120f * (1f - gfxQuality) + 40f * gfxQuality);
57 int num2 = (int)((float)num * 0.4f);
58 int num3 = (int)((float)num * 0.35f);
59 int num4 = (int)((float)num * 0.3f);
61 if (drawToScreen)
62 {
64 }
65 int num5 = (int)((screenPosition.
X - vector.
X) / 16f - 1f);
66 int num6 = (int)((screenPosition.
X + (
float)screenWidth + vector.
X) / 16f) + 2;
67 int num7 = (int)((screenPosition.
Y - vector.
Y) / 16f - 1f);
68 int num8 = (int)((screenPosition.
Y + (
float)screenHeight + vector.
Y) / 16f) + 5;
69 int num9 = offScreenRange / 16;
70 int num10 = offScreenRange / 16;
71 if (num5 - num9 < 4)
72 {
73 num5 = num9 + 4;
74 }
75 if (num6 + num9 > maxTilesX - 4)
76 {
77 num6 = maxTilesX - num9 - 4;
78 }
79 if (num7 - num10 < 4)
80 {
81 num7 = num10 + 4;
82 }
83 if (num8 + num10 > maxTilesY - 4)
84 {
85 num8 = maxTilesY - num10 - 4;
86 }
89 int underworldLayer = Main.UnderworldLayer;
90 Point screenOverdrawOffset = Main.GetScreenOverdrawOffset();
91 for (
int i = num7 - num10 + screenOverdrawOffset.
Y;
i < num8 + num10 - screenOverdrawOffset.
Y;
i++)
92 {
93 for (
int j = num5 - num9 + screenOverdrawOffset.
X; j < num6 + num9 - screenOverdrawOffset.
X; j++)
94 {
96 if (tile == null)
97 {
100 }
101 ushort wall = tile.
wall;
103 {
104 continue;
105 }
106 Color color = Lighting.GetColor(j, i);
107 if (tile.fullbrightWall())
108 {
110 }
111 if (wall == 318)
112 {
114 }
115 if (color.
R == 0 && color.
G == 0 && color.
B == 0 && i < underworldLayer)
116 {
117 continue;
118 }
119 Main.instance.LoadWall(wall);
120 value.X = tile.wallFrameX();
121 value.Y = tile.wallFrameY() + Main.wallFrame[wall] * 180;
122 ushort wall2 = tile.wall;
123 if ((uint)(wall2 - 242) <= 1u)
124 {
125 int num11 = 20;
126 int num12 = (Main.wallFrameCounter[wall] + j * 11 +
i * 27) % (num11 * 8);
127 value.Y = tile.wallFrameY() + 180 * (num12 / num11);
128 }
129 if (Lighting.NotRetro && !Main.wallLight[wall] && tile.wall != 241 && (tile.wall < 88 || tile.wall > 93) && !
WorldGen.SolidTile(tile))
130 {
132 if (tile.wall == 346)
133 {
134 vertices.TopRightColor = (vertices.TopLeftColor = (vertices.BottomRightColor = (vertices.BottomLeftColor =
new Color((
byte)Main.DiscoR, (
byte)Main.DiscoG, (
byte)Main.DiscoB))));
135 }
136 else if (tile.wall == 44)
137 {
138 vertices.TopRightColor = (vertices.TopLeftColor = (vertices.BottomRightColor = (vertices.BottomLeftColor =
new Color((
byte)Main.DiscoR, (
byte)Main.DiscoG, (
byte)Main.DiscoB))));
139 }
140 else
141 {
142 Lighting.GetCornerColors(j, i, out vertices);
143 wall2 = tile.wall;
144 if ((uint)(wall2 - 341) <= 4u)
145 {
147 }
148 if (tile.fullbrightWall())
149 {
151 }
152 }
153 tileBatch.
Draw(tileDrawTexture,
new Vector2(j * 16 - (
int)screenPosition.
X - 8, i * 16 - (
int)screenPosition.
Y - 8) + vector, value, vertices,
Vector2.
Zero, 1f,
SpriteEffects.None);
154 }
155 else
156 {
157 Color color2 = color;
158 if (wall == 44 || wall == 346)
159 {
160 color2 =
new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB);
161 }
162 if ((uint)(wall - 341) <= 4u)
163 {
165 }
167 spriteBatch.
Draw(tileDrawTexture2,
new Vector2(j * 16 - (
int)screenPosition.
X - 8, i * 16 - (
int)screenPosition.
Y - 8) + vector, value, color2, 0f,
Vector2.
Zero, 1f,
SpriteEffects.None, 0f);
168 }
169 if (color.
R > num2 || color.
G > num3 || color.
B > num4)
170 {
175 if (num13)
176 {
177 spriteBatch.
Draw(TextureAssets.WallOutline.Value,
new Vector2(j * 16 - (
int)screenPosition.
X, i * 16 - (
int)screenPosition.
Y) + vector,
new Rectangle(0, 0, 2, 16), color, 0f,
Vector2.
Zero, 1f,
SpriteEffects.None, 0f);
178 }
179 if (flag)
180 {
181 spriteBatch.
Draw(TextureAssets.WallOutline.Value,
new Vector2(j * 16 - (
int)screenPosition.
X + 14, i * 16 - (
int)screenPosition.
Y) + vector,
new Rectangle(14, 0, 2, 16), color, 0f,
Vector2.
Zero, 1f,
SpriteEffects.None, 0f);
182 }
183 if (flag2)
184 {
185 spriteBatch.
Draw(TextureAssets.WallOutline.Value,
new Vector2(j * 16 - (
int)screenPosition.
X, i * 16 - (
int)screenPosition.
Y) + vector,
new Rectangle(0, 0, 16, 2), color, 0f,
Vector2.
Zero, 1f,
SpriteEffects.None, 0f);
186 }
187 if (flag3)
188 {
189 spriteBatch.
Draw(TextureAssets.WallOutline.Value,
new Vector2(j * 16 - (
int)screenPosition.
X, i * 16 - (
int)screenPosition.
Y + 14) + vector,
new Rectangle(0, 14, 16, 2), color, 0f,
Vector2.
Zero, 1f,
SpriteEffects.None, 0f);
190 }
191 }
192 }
193 }
194 Main.instance.DrawTileCracks(2, Main.LocalPlayer.hitReplace);
195 Main.instance.DrawTileCracks(2, Main.LocalPlayer.hitTile);
197 }
void Draw(Texture2D texture, Vector2 position, Color color)
bool FullTile(int x, int y)
Texture2D GetTileDrawTexture(Tile tile, int tileX, int tileY)
bool _shouldShowInvisibleWalls
void LerpVertexColorsWithColor(ref VertexColors colors, Color lerpColor, float percent)
static VertexColors _glowPaintColors
void Draw(Texture2D texture, Vector2 position, VertexColors colors)
static Color Lerp(Color value1, Color value2, float amount)