/* private void chkSnapFull_CheckedChanged(object sender, EventArgs e) { SnapGrid = false; SnapHalfGrid = chkSnapFull.Checked; }*/ // // Add tiles to the screen // private void AddTile(Point tilePt) { if (CurrentMode == Mode.MAKE_FLOOR) { int tileGraph = (((ThingDb.Tile)(tileGraphic.SelectedItem)).Id); Map.Tile tile = Map.Tiles.ContainsKey(tilePt) ? Map.Tiles[tilePt] : null; if (tile == null && !threeFloorBox.Checked) { ushort variation = CreateVariation(tilePt, (ushort)(tileVar.SelectedIndex-1), (byte)tileGraph); ArrayList newblends = new ArrayList(); if (!chkAutoEdge.Checked) { for (int ve = 0; ve < blendDialog.Blends.Count; ve++) { Map.Tile.EdgeTile old = (Map.Tile.EdgeTile)blendDialog.Blends[ve]; Map.Tile.EdgeTile tr = new Map.Tile.EdgeTile(old.Graphic, (ushort)CreateVariation(tilePt, (ushort)old.Variation, (byte)old.Graphic), old.Dir, old.Edge); newblends.Add(tr); } } tile = new Map.Tile( tilePt, (byte)tileGraph,//tileGraphic.SelectedIndex, variation, newblends ); unsafe { Map.Tiles.Add(tilePt, tile); if (chkAutoEdge.Checked) { AutoEdge(tilePt); } IntPtr ptr = Marshal.StringToHGlobalAnsi(tile.Graphic); MainWindow.myMap.AddTile(ptr.ToPointer(), tilePt.Y, tilePt.X, tile.Variation); tilePt.X++; //tileDrag = tilePt; // Re-enable to allow tile dragging again //dragging = true; } } else if(threeFloorBox.Checked == true) { unsafe { Point pat = new Point(); int i = 0; int cols = 3;//ThingDb.FloorTiles[(byte)tileGraphic.SelectedIndex].numCols; int rows = 3;//ThingDb.FloorTiles[(byte)tileGraphic.SelectedIndex].numRows; for (pat = tilePt; i < rows; i++, pat.X--, pat.Y++) { for (int j = 0; j < cols; j++) { Point pat2 = new Point(); pat2 = pat; pat2.X += j * 1; pat2.Y += j * 1; //pat2.X -= 1; pat2.Y -= 2; ushort variation = CreateVariation(pat2, (ushort)(tileVar.SelectedIndex-1), (byte)tileGraph); ArrayList newblends = new ArrayList(); if (!chkAutoEdge.Checked) { for (int ve = 0; ve < blendDialog.Blends.Count; ve++) { Map.Tile.EdgeTile old = (Map.Tile.EdgeTile)blendDialog.Blends[ve]; Map.Tile.EdgeTile tr = new Map.Tile.EdgeTile(old.Graphic, (ushort)CreateVariation(pat2, (ushort)old.Variation, (byte)old.Graphic), old.Dir, old.Edge); newblends.Add(tr); } } tile = new Map.Tile( new Point(pat2.X, pat2.Y), (byte)tileGraph,//tileGraphic.SelectedIndex, variation, newblends ); IntPtr ptr = Marshal.StringToHGlobalAnsi(tile.Graphic); if (!Map.Tiles.ContainsKey(tile.Location)) { Map.Tiles.Add(tile.Location, tile); if (chkAutoEdge.Checked) { AutoEdge(tile.Location); } MainWindow.myMap.AddTile(ptr.ToPointer(), pat2.Y, pat2.X, variation); } } } } } } }
private void EditEdge(Point tilePt) { if (chkAutoEdge.Checked) { if (Map.Tiles.ContainsKey(tilePt)) { Map.Tiles[tilePt].EdgeTiles.Clear(); AutoEdge(tilePt); } } else { if (Map.Tiles.ContainsKey(tilePt)) { Map.Tiles[tilePt].EdgeTiles.Clear(); ArrayList newblends = new ArrayList(); for (int ve = 0; ve < blendDialog.Blends.Count; ve++) { Map.Tile.EdgeTile old = (Map.Tile.EdgeTile)blendDialog.Blends[ve]; Map.Tile.EdgeTile tr = new Map.Tile.EdgeTile(old.Graphic, (ushort)CreateVariation(tilePt, (ushort)old.Variation, (byte)old.Graphic), old.Dir, old.Edge); Map.Tiles[tilePt].EdgeTiles.Add(tr); } } } }