public static List<Point> FindCollisionTile(int Direction, Vector2 position, float testMagnitude, int Width, int Height, bool fallThrough = false, bool fall2 = false, int gravDir = 1, bool checkCardinals = true, bool checkSlopes = false) { int num; Vector2 vector2; Vector4 vector4; int width; int height; List<Point> points = new List<Point>(); switch (Direction) { case 0: case 1: { vector2 = (Direction == 0 ? Vector2.UnitX * testMagnitude : -Vector2.UnitX * testMagnitude); vector4 = new Vector4(position, vector2.X, vector2.Y); float x = position.X; if (Direction == 0) { width = Width; } else { width = 0; } num = (int)(x + (float)width) / 16; float single = Math.Min(16f - position.Y % 16f, (float)Height); float single1 = single; if (checkCardinals && Collision.TileCollision(position - vector2, vector2, Width, (int)single, fallThrough, fall2, gravDir) != vector2) { points.Add(new Point(num, (int)position.Y / 16)); } else if (checkSlopes && Collision.SlopeCollision(position, vector2, Width, (int)single, (float)gravDir, fallThrough).XZW() != vector4.XZW()) { points.Add(new Point(num, (int)position.Y / 16)); } while (single1 + 16f <= (float)(Height - 16)) { if (checkCardinals && Collision.TileCollision((position - vector2) + (Vector2.UnitY * single1), vector2, Width, 16, fallThrough, fall2, gravDir) != vector2) { points.Add(new Point(num, (int)(position.Y + single1) / 16)); } else if (checkSlopes && Collision.SlopeCollision(position + (Vector2.UnitY * single1), vector2, Width, 16, (float)gravDir, fallThrough).XZW() != vector4.XZW()) { points.Add(new Point(num, (int)(position.Y + single1) / 16)); } single1 = single1 + 16f; } int height1 = Height - (int)single1; if (!checkCardinals || !(Collision.TileCollision((position - vector2) + (Vector2.UnitY * single1), vector2, Width, height1, fallThrough, fall2, gravDir) != vector2)) { if (!checkSlopes || !(Collision.SlopeCollision(position + (Vector2.UnitY * single1), vector2, Width, height1, (float)gravDir, fallThrough).XZW() != vector4.XZW())) { break; } points.Add(new Point(num, (int)(position.Y + single1) / 16)); break; } else { points.Add(new Point(num, (int)(position.Y + single1) / 16)); break; } } case 2: case 3: { vector2 = (Direction == 2 ? Vector2.UnitY * testMagnitude : -Vector2.UnitY * testMagnitude); vector4 = new Vector4(position, vector2.X, vector2.Y); float y = position.Y; if (Direction == 2) { height = Height; } else { height = 0; } num = (int)(y + (float)height) / 16; float single2 = Math.Min(16f - position.X % 16f, (float)Width); float single3 = single2; if (checkCardinals && Collision.TileCollision(position - vector2, vector2, (int)single2, Height, fallThrough, fall2, gravDir) != vector2) { points.Add(new Point((int)position.X / 16, num)); } else if (checkSlopes && Collision.SlopeCollision(position, vector2, (int)single2, Height, (float)gravDir, fallThrough).YZW() != vector4.YZW()) { points.Add(new Point((int)position.X / 16, num)); } while (single3 + 16f <= (float)(Width - 16)) { if (checkCardinals && Collision.TileCollision((position - vector2) + (Vector2.UnitX * single3), vector2, 16, Height, fallThrough, fall2, gravDir) != vector2) { points.Add(new Point((int)(position.X + single3) / 16, num)); } else if (checkSlopes && Collision.SlopeCollision(position + (Vector2.UnitX * single3), vector2, 16, Height, (float)gravDir, fallThrough).YZW() != vector4.YZW()) { points.Add(new Point((int)(position.X + single3) / 16, num)); } single3 = single3 + 16f; } int width1 = Width - (int)single3; if (!checkCardinals || !(Collision.TileCollision((position - vector2) + (Vector2.UnitX * single3), vector2, width1, Height, fallThrough, fall2, gravDir) != vector2)) { if (!checkSlopes || !(Collision.SlopeCollision(position + (Vector2.UnitX * single3), vector2, width1, Height, (float)gravDir, fallThrough).YZW() != vector4.YZW())) { break; } points.Add(new Point((int)(position.X + single3) / 16, num)); break; } else { points.Add(new Point((int)(position.X + single3) / 16, num)); break; } } } return points; }