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

◆ DrawTileCracks()

void Terraria.Main.DrawTileCracks ( int crackType,
HitTile hitter )
inline

Definition at line 58210 of file Main.cs.

58211 {
58213 if (drawToScreen)
58214 {
58216 }
58217 bool flag = ShouldShowInvisibleWalls();
58218 for (int i = 0; i < hitter.data.Length; i++)
58219 {
58220 if (hitter.data[i].type != crackType)
58221 {
58222 continue;
58223 }
58224 int damage = hitter.data[i].damage;
58225 if (damage < 20)
58226 {
58227 continue;
58228 }
58229 int x = hitter.data[i].X;
58230 int y = hitter.data[i].Y;
58231 if (!WorldGen.InWorld(x, y))
58232 {
58233 continue;
58234 }
58235 bool flag2 = tile[x, y] != null;
58236 if (flag2 && crackType == 1)
58237 {
58238 flag2 = flag2 && tile[x, y].active() && (flag || !tile[x, y].invisibleBlock());
58239 }
58240 if (flag2 && crackType == 2)
58241 {
58242 flag2 = flag2 && tile[x, y].wall != 0 && (flag || !tile[x, y].invisibleWall());
58243 }
58244 if (!flag2)
58245 {
58246 continue;
58247 }
58248 bool flag3 = false;
58249 bool flag4 = false;
58250 if (tile[x, y].type == 10)
58251 {
58252 flag3 = false;
58253 }
58254 else if (tileSolid[tile[x, y].type] && !tileSolidTop[tile[x, y].type])
58255 {
58256 flag3 = true;
58257 }
58258 else if (WorldGen.IsTreeType(tile[x, y].type))
58259 {
58260 flag4 = true;
58261 int num = tile[x, y].frameX / 22;
58262 int num2 = tile[x, y].frameY / 22;
58263 if (num2 < 9)
58264 {
58265 flag3 = ((num != 1 && num != 2) || num2 < 6 || num2 > 8) && (num != 3 || num2 > 2) && (num != 4 || num2 < 3 || num2 > 5) && ((num != 5 || num2 < 6 || num2 > 8) ? true : false);
58266 }
58267 }
58268 else if (tile[x, y].type == 72)
58269 {
58270 flag4 = true;
58271 if (tile[x, y].frameX <= 34)
58272 {
58273 flag3 = true;
58274 }
58275 }
58276 if (flag3 && tile[x, y].slope() == 0 && !tile[x, y].halfBrick())
58277 {
58278 int num3 = 0;
58279 if (damage >= 80)
58280 {
58281 num3 = 3;
58282 }
58283 else if (damage >= 60)
58284 {
58285 num3 = 2;
58286 }
58287 else if (damage >= 40)
58288 {
58289 num3 = 1;
58290 }
58291 else if (damage >= 20)
58292 {
58293 num3 = 0;
58294 }
58295 Microsoft.Xna.Framework.Rectangle value = new Microsoft.Xna.Framework.Rectangle(hitter.data[i].crackStyle * 18, num3 * 18, 16, 16);
58296 if (flag4)
58297 {
58298 value.X = (4 + hitter.data[i].crackStyle / 2) * 18;
58299 }
58300 spriteBatch.Draw(TextureAssets.TileCrack.Value, new Vector2(x * 16 - (int)screenPosition.X, y * 16 - (int)screenPosition.Y) + vector, value, Lighting.GetColor(x, y), 0f, default(Vector2), 1f, SpriteEffects.None, 0f);
58301 }
58302 }
58303 }
static Asset< Texture2D > TileCrack
static bool[] tileSolidTop
Definition Main.cs:1469
static bool ShouldShowInvisibleWalls()
Definition Main.cs:54895
static SpriteBatch spriteBatch
Definition Main.cs:974
static bool drawToScreen
Definition Main.cs:600
static Vector2 screenPosition
Definition Main.cs:1715
static int offScreenRange
Definition Main.cs:836
static bool[] tileSolid
Definition Main.cs:1471
static Tile[,] tile
Definition Main.cs:1675

References Terraria.Main.drawToScreen, Terraria.Lighting.GetColor(), System.Text.RegularExpressions.i, Terraria.WorldGen.InWorld(), Terraria.WorldGen.IsTreeType(), Terraria.Main.offScreenRange, Terraria.Main.screenPosition, Terraria.Main.ShouldShowInvisibleWalls(), Terraria.Main.spriteBatch, Terraria.Main.tile, Terraria.GameContent.TextureAssets.TileCrack, Terraria.Main.tileSolid, Terraria.Main.tileSolidTop, System.type, System.value, Microsoft.Xna.Framework.Graphics.Vector2, and Microsoft.Xna.Framework.Vector2.Zero.