public void SetRandomTilesMode(TileInfo[] tileList) { lock (Board.ParentControl) { Clear(); tileRandomList = tileList; SetHeldInfo(tileRandomList[NextInt32(tileRandomList.Length)]); state = MouseState.RandomTiles; } }
private static void MoveFootholdX(TileInfo result, bool first, bool left, int width) { if (result.footholdOffsets.Count < 1) return; int idx = first ? 0 : result.footholdOffsets.Count - 1; int x = left ? 0 : (width * result.mag); if (result.footholdOffsets[idx].X != x) { result.footholdOffsets[idx] = new XNA.Point(x, result.footholdOffsets[idx].Y); } }
private static void MoveFootholdY(TileInfo result, bool first, bool top, int height) { if (result.footholdOffsets.Count < 1) return; int idx = first ? 0 : result.footholdOffsets.Count - 1; int y = top ? 0 : (height * result.mag); if (result.footholdOffsets[idx].Y != y) { result.footholdOffsets[idx] = new XNA.Point(result.footholdOffsets[idx].X, y); } }
private static TileInfo Load(WzCanvasProperty parentObject, string tS, string u, string no, int? mag) { WzImageProperty zProp = parentObject["z"]; int z = zProp == null ? 0 : InfoTool.GetInt(zProp); TileInfo result = new TileInfo(parentObject.PngProperty.GetPNG(false), WzInfoTools.VectorToSystemPoint((WzVectorProperty)parentObject["origin"]), tS, u, no, mag.HasValue ? mag.Value : 1, z, parentObject); WzConvexProperty footholds = (WzConvexProperty)parentObject["foothold"]; if (footholds != null) foreach (WzVectorProperty foothold in footholds.WzProperties) result.footholdOffsets.Add(WzInfoTools.VectorToXNAPoint(foothold)); if (UserSettings.FixFootholdMispositions) { FixFootholdMispositions(result); } return result; }
/* The sole reason behind this function's existence is that Nexon's designers are a bunch of incompetent goons. * In a nutshell, some tiles (mostly old ones) have innate footholds that do not overlap when snapping them to each other, causing a weird foothold structure. * I do not know how Nexon's editor overcame this; I am assuming they manually connected the footholds to sort that out. However, since HaCreator only allows automatic * connection of footholds, we need to sort these cases out preemptively here. */ private static void FixFootholdMispositions(TileInfo result) { switch (result.u) { case "enV0": MoveFootholdY(result, true, false, 60); MoveFootholdY(result, false, true, 60); break; case "enV1": MoveFootholdY(result, true, true, 60); MoveFootholdY(result, false, false, 60); break; case "enH0": MoveFootholdX(result, true, true, 90); MoveFootholdX(result, false, false, 90); break; case "slLU": MoveFootholdX(result, true, false, -90); MoveFootholdX(result, false, true, -90); break; case "slRU": MoveFootholdX(result, true, true, 90); MoveFootholdX(result, false, false, 90); break; case "edU": MoveFootholdY(result, true, false, 0); MoveFootholdY(result, false, false, 0); break; } }
public TileInstance(Board board, SerializationForm json) : base(board, json) { baseInfo = TileInfo.Get(json.ts, json.u, json.no); }
public TileInstance(TileInfo baseInfo, Layer layer, Board board, int x, int y, int z, int zM) : base(board, layer, zM, x, y, z) { this.baseInfo = baseInfo; AttachToLayer(layer); }
// Only to be used by layer TS changing, do not use this for ANYTHING else. public void SetBaseInfo(TileInfo newInfo) { this.baseInfo = newInfo; }