Ejemplo n.º 1
0
        private void OnClickClear(object sender, EventArgs e)
        {
            int blockx1 = (int)numericUpDownX1.Value;
            int blockx2 = (int)numericUpDownX2.Value;
            int blocky1 = (int)numericUpDownY1.Value;
            int blocky2 = (int)numericUpDownY2.Value;
            int temp;

            if (blockx1 > blockx2)
            {
                temp    = blockx1;
                blockx1 = blockx2;
                blockx2 = temp;
            }
            if (blocky1 > blocky2)
            {
                temp    = blocky1;
                blocky1 = blocky2;
                blocky2 = temp;
            }
            blockx1 >>= 3;
            blockx2 >>= 3;
            blocky1 >>= 3;
            blocky2 >>= 3;

            for (int x = blockx1; x <= blockx2; ++x)
            {
                for (int y = blocky1; y <= blocky2; ++y)
                {
                    Ultima.HuedTile[][][] tiles = Map.Tiles.GetStaticBlock(x, y, false);
                    Map.Tiles.RemoveStaticBlock(x, y);
                }
            }
            Map.ResetCache();
            MessageBox.Show("Done", "Clear Static", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            MapParent.RefreshMap();
        }
Ejemplo n.º 2
0
        private void OnClickClear(object sender, EventArgs e)
        {
            int blockx1 = (int)numericUpDownX1.Value;
            int blockx2 = (int)numericUpDownX2.Value;
            int blocky1 = (int)numericUpDownY1.Value;
            int blocky2 = (int)numericUpDownY2.Value;
            int temp;

            if (blockx1 > blockx2)
            {
                temp    = blockx1;
                blockx1 = blockx2;
                blockx2 = temp;
            }
            if (blocky1 > blocky2)
            {
                temp    = blocky1;
                blocky1 = blocky2;
                blocky2 = temp;
            }
            blockx1 >>= 3;
            blockx2 >>= 3;
            blocky1 >>= 3;
            blocky2 >>= 3;

            for (int x = blockx1; x <= blockx2; ++x)
            {
                for (int y = blocky1; y <= blocky2; ++y)
                {
                    //HuedTile[][][] tiles = _map.Tiles.GetStaticBlock(x, y, false); // TODO: unused variable? do we need to call GetStaticBlock() here?
                    _map.Tiles.RemoveStaticBlock(x, y);
                }
            }
            _map.ResetCache();
            MessageBox.Show("Done", "Clear Static", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            _mapControlParent.RefreshMap();
        }
Ejemplo n.º 3
0
        private void OnClickMelt(object sender, EventArgs e)
        {
            SaveFileDialog dialog = new SaveFileDialog();

            dialog.CheckPathExists = true;
            dialog.Title           = "Choose the file to save to";
            if (dialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            int blockx1 = (int)numericUpDownX1.Value;
            int blockx2 = (int)numericUpDownX2.Value;
            int blocky1 = (int)numericUpDownY1.Value;
            int blocky2 = (int)numericUpDownY2.Value;
            int temp;

            if (blockx1 > blockx2)
            {
                temp    = blockx1;
                blockx1 = blockx2;
                blockx2 = temp;
            }
            if (blocky1 > blocky2)
            {
                temp    = blocky1;
                blocky1 = blocky2;
                blocky2 = temp;
            }
            blockx1 >>= 3;
            blockx2 >>= 3;
            blocky1 >>= 3;
            blocky2 >>= 3;

            int count = 1;

            using (StreamWriter Tex = new StreamWriter(new FileStream(dialog.FileName, FileMode.Create, FileAccess.Write), System.Text.Encoding.GetEncoding(1252)))
            {
                for (int x = blockx1; x <= blockx2; ++x)
                {
                    for (int y = blocky1; y <= blocky2; ++y)
                    {
                        Ultima.HuedTile[][][] tiles = Map.Tiles.GetStaticBlock(x, y, false);
                        for (int ix = 0; ix < 8; ++ix)
                        {
                            for (int iy = 0; iy < 8; ++iy)
                            {
                                foreach (Ultima.HuedTile tile in tiles[ix][iy])
                                {
                                    Tex.WriteLine(String.Format("SECTION WORLDITEM {0}", count));
                                    Tex.WriteLine("{");
                                    Tex.WriteLine("  NAME #");
                                    Tex.WriteLine(String.Format("  ID {0}", tile.ID));
                                    Tex.WriteLine(String.Format("  X {0}", (x << 3) + ix));
                                    Tex.WriteLine(String.Format("  Y {0}", (y << 3) + iy));
                                    Tex.WriteLine(String.Format("  Z {0}", tile.Z));
                                    Tex.WriteLine(String.Format("  COLOR {0}", tile.Hue));
                                    Tex.WriteLine("  CONT -1");
                                    Tex.WriteLine("  TYPE 255");
                                    Tex.WriteLine("}");
                                    ++count;
                                }
                            }
                        }
                        Map.Tiles.RemoveStaticBlock(x, y);
                    }
                }
            }
            dialog.Dispose();
            Map.ResetCache();
            MessageBox.Show("Done", "Melt Static", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
            MapParent.RefreshMap();
        }