SetMarquees() public method

public SetMarquees ( bool a, bool b ) : void
a bool
b bool
return void
コード例 #1
0
ファイル: frmMain.cs プロジェクト: herpit/MineEdit
 private void recalcLightingToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (ActiveMdiChild != null)
     {
         if ((ActiveMdiChild as frmMap).Map != null)
         {
             Profiler profSky = new Profiler("Sky Lighting");
             Profiler profBlock = new Profiler("Block Lighting");
             tsbStatus.Text = "Waiting for user response lol";
             DialogResult dr = MessageBox.Show("MineEdit will remove lighting data from all chunks, forcing a lighting recalculation (according to advice from Notch, anyway).\n\nThis will inevitably take a long time.  ARE YOU SURE?", "DO YOU HAVE THE PATIENCE", MessageBoxButtons.YesNo);
             if (dr == DialogResult.No)
             {
                 ResetStatus();
                 return;
             }
             dlgLongTask dlt = new dlgLongTask();
             dlt.Start(delegate()
             {
                 int NumChunks = 0;
                 dlt.VocabSubtask = "Chunk";
                 dlt.VocabSubtasks = "Chunks";
                 dlt.Title = "Stripping lighting from chunks.";
                 dlt.Subtitle = "This will take a while.  Go take a break.";
                 dlt.SetMarquees(false, false);
                 dlt.CurrentTask = "Replacing stuff in chunks...";
                 dlt.TasksComplete = 0;
                 dlt.TasksTotal = 1;
                 dlt.SubtasksTotal = 1;
                 (ActiveMdiChild as frmMap).Map.ForEachProgress += new ForEachProgressHandler(delegate(int Total, int Progress)
                 {
                     dlt.TasksTotal = Total;
                     dlt.TasksComplete = Progress;
                 });
                 int NumSkipped=0;
                 (ActiveMdiChild as frmMap).Map.ForEachChunk(delegate(long X, long Y)
                 {
                     Chunk c = (ActiveMdiChild as frmMap).Map.GetChunk(X, Y);
                     if (c == null)
                     {
                         ++NumSkipped;
                         return;
                     }
                     c.Save();
                     dlt.CurrentTask= string.Format("Stripping lighting... ({0}/{1}, {2} skipped)", dlt.TasksComplete, dlt.TasksTotal, NumSkipped);
                 });
                 dlt.Done();
             });
             dlt.ShowDialog();
             MessageBox.Show("Lighting stripped from "+dlt.TasksComplete+" chunks.", "Report");
             //(ActiveMdiChild as frmMap).Enabled = true;
             (ActiveMdiChild as frmMap).ReloadAll();
             ResetStatus();
         }
     }
 }
コード例 #2
0
ファイル: frmMain.cs プロジェクト: herpit/MineEdit
 private void randomSeedToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     if (ActiveMdiChild != null)
     {
         if ((ActiveMdiChild as frmMap).Map != null)
         {
             OpenFileDialog sfd = new OpenFileDialog();
             sfd.Filter = "Random Seed File|*.rnd|Any file|*.*";
             DialogResult dr = sfd.ShowDialog();
             if (dr == System.Windows.Forms.DialogResult.OK)
             {
                 long random;
                 if(!long.TryParse(File.ReadAllText(sfd.FileName),out random))
                 {
                     MessageBox.Show("Use a valid Random Seed File (all it can contain is the random seed value).");
                     return;
                 }
                 (ActiveMdiChild as frmMap).Map.RandomSeed = random;
                 (ActiveMdiChild as frmMap).Map.Save();
                 DialogResult dr2 = MessageBox.Show("Would you also like to REMOVE ALL CHUNKS?  This will allow you to regenerate the entire map, but it will REMOVE ALL CHANGES APPLIED TO THE MAP.", "Regenerate?", MessageBoxButtons.YesNo);
                 if (dr2 == System.Windows.Forms.DialogResult.Yes)
                 {
                     dlgLongTask dlt = new dlgLongTask();
                     dlt.Start(delegate()
                     {
                         int NumChunks = 0;
                         dlt.SetMarquees(true, true);
                         dlt.VocabSubtask = "Chunk";
                         dlt.VocabSubtasks = "Chunks";
                         dlt.Title = "Removing chunks.";
                         dlt.Subtitle = "This will take a while.  Go take a break.";
                         dlt.CurrentSubtask = "Counting chunks (0)...";
                         dlt.CurrentTask = "Replacing stuff in chunks...";
                         dlt.TasksComplete = 0;
                         dlt.TasksTotal = NumChunks;
                         dlt.SubtasksTotal = 2;
                         (ActiveMdiChild as frmMap).Map.ForEachProgress += new ForEachProgressHandler(delegate(int Total, int Progress)
                         {
                             dlt.TasksTotal = Total;
                             dlt.TasksComplete = Progress;
                         });
                         (ActiveMdiChild as frmMap).Map.ForEachChunk(new Chunk.ChunkModifierDelegate(delegate(long x, long y)
                         {
                             if (dlt.STOP) return;
                             dlt.CurrentTask = string.Format("Deleting chunk ({0},{1})...", x, y);
                             dlt.CurrentSubtask = string.Format("Loading chunk ({0},{1})...", x, y);
                             dlt.SubtasksComplete = 0;
                             Chunk c = (ActiveMdiChild as frmMap).Map.GetChunk(x, y);
                             if (c == null) return;
                             dlt.CurrentSubtask = string.Format("Deleting chunk ({0},{1})...", x, y);
                             dlt.SubtasksComplete = 1;
                             File.Delete(c.Filename);
                             dlt.SubtasksComplete = 2;
                         }));
                         dlt.Done();
                         MessageBox.Show("Done.");
                     });
                     dlt.ShowDialog();
                 }
             }
         }
     }
 }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: N3X15/MineEdit
        private void generateTerrainToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null)
            {
                if ((ActiveMdiChild as frmMap).Map != null)
                {
                    dlgTerrainGen terragen = new dlgTerrainGen((ActiveMdiChild as frmMap).Map);
                    if(terragen.ShowDialog() == DialogResult.Cancel)
                    {
                        ResetStatus();
                        return;
                    }
                    DialogResult dr = MessageBox.Show("This could DELETE EVERYTHING. ARE YOU SURE?", "ARE YOU NUTS", MessageBoxButtons.YesNo);
                    if (dr == DialogResult.No)
                    {
                        ResetStatus();
                        return;
                    }
                    IMapGenerator mg = (IMapGenerator)terragen.pgMapGen.SelectedObject;

                    (ActiveMdiChild as frmMap).Map.Generator = mg;
                    dlgLongTask dlt = new dlgLongTask();
                    dlt.Start(delegate()
                    {
                        // ACTIVATE AUTOREPAIR
                        (ActiveMdiChild as frmMap).Map.Autorepair = true;

                        /////////////////////////////////////////////////////////////////
                        // UI Stuff
                        /////////////////////////////////////////////////////////////////
                        dlt.SetMarquees(true, true);
                        dlt.VocabSubtask = "chunk";
                        dlt.VocabSubtasks = "chunks";
                        dlt.Title = "Generating chunks.";
                        dlt.Subtitle = "This will take a while.  Go take a break.";
                        dlt.SetMarquees(false, false);
                        dlt.CurrentTask = "Replacing stuff in chunks...";
                        dlt.TasksComplete = 0;
                        dlt.TasksTotal = 1;
                        dlt.SubtasksTotal = 1;

                        int numchunks = 0;
                        // Generate terrain
                        // Drop soil
                        // Add pbarriers
                        // Add dungeons
                        // Add trees
                        // Fix fluids
                        // Fix lava

                        int stage = 0;
                        int numstages = 1;
                        ForEachProgressHandler feph = new ForEachProgressHandler(delegate(int Total, int Progress)
                        {
                            numchunks = Total;
                            dlt.TasksTotal = numchunks * numstages;
                            dlt.TasksComplete = Progress + (stage * numchunks);
                            dlt.SubtasksComplete = Progress;
                            dlt.SubtasksTotal = Total;
                        });
                        ForEachProgressHandler fl_feph = new ForEachProgressHandler(delegate(int Total, int Progress)
                        {
                            numchunks = Total;
                            dlt.TasksTotal = numchunks * numstages;
                            dlt.TasksComplete = Progress + (stage * numchunks);
                            dlt.SubtasksComplete = Progress;
                            dlt.SubtasksTotal = Total;

                            dlt.perfChart.AddValue((ActiveMdiChild as frmMap).Map.ChunksLoaded);
                        });

                        Vector3i Max = new Vector3i(0,0,0);
                        Vector3i Min = new Vector3i(int.MaxValue, int.MaxValue, int.MaxValue);
                        dlt.CurrentTask = "Determining map scale...";
                        (ActiveMdiChild as frmMap).Map.ForEachProgress += feph;
                        dlt.ShowPerfChart(true);
                        dlt.perfChart.Clear();
                        dlt.perfChart.ScaleMode = SpPerfChart.ScaleMode.Relative;
                        (ActiveMdiChild as frmMap).Map.ForEachChunk(delegate(IMapHandler _mh, long X, long Z)
                        {
                            if (Min.X > X) Min.X = X;
                            if (Max.X < X) Max.X = X;
                            if (Min.Z > Z) Min.Z = Z;
                            if (Max.Z < Z) Max.Z = Z;
                            dlt.CurrentSubtask = string.Format("Map Scale: ({0},{1})", Max.X - Min.X, Max.Z - Min.Z);
                            _mh.SaveAll();
                        });

                        (ActiveMdiChild as frmMap).Map.Cache.Enabled = false;

                        int total = (int)((Max.X - Min.X) * (Max.Z - Min.Z));
                        int completed = 0;
                        (ActiveMdiChild as frmMap).Map.ForEachKnownChunk(0,delegate(IMapHandler _mh, long X, long Z)
                        {
                            if (dlt.STOP) return;
                            dlt.CurrentSubtask = string.Format("Generating chunk ({0},{1})", X, Z);
                            double min, max;
                            (ActiveMdiChild as frmMap).Map.Generate(X, Z, out min, out max);
                            dlt.grpPerformance.Text = string.Format("Terrain Profile [{0},{1}]m", (int)(min * 100), (int)(max * 100));
                            dlt.perfChart.AddValue((decimal)max);
                            feph(total, completed++);
                        });

                        if ((ActiveMdiChild as frmMap).Map.Generator.GenerateCaves)
                        {
                            dlt.CurrentTask = "Generating caves...";
                            dlt.grpPerformance.Text = "Generation time (ms)";
                            Random rand = new Random((int)(ActiveMdiChild as frmMap).Map.RandomSeed);
                            Profiler profCaves = new Profiler("Cave");
                            (ActiveMdiChild as frmMap).Map.ForEachKnownChunk(0, delegate(IMapHandler _mh, long X, long Z)
                            {
                                if (dlt.STOP) return;
                                dlt.CurrentSubtask = string.Format("Generating caves in chunk ({0},{1})", X, Z);
                                if (rand.Next(3) != 0)
                                {
                                    int xo = (int)(X * _mh.ChunkScale.X);
                                    int zo = (int)(Z * _mh.ChunkScale.Z);
                                    int x = rand.Next((int)_mh.ChunkScale.X - 1);
                                    int z = rand.Next((int)_mh.ChunkScale.Z - 1);
                                    int y = rand.Next((int)(_mh.GetHeightAt(x, z) * 127) + 5);
                                    profCaves.Start();
                                    new Cave(ref rand, ref _mh, new Vector3i(x + xo, y, z + zo));
                                    Console.WriteLine("LOLDONE");
                                    dlt.perfChart.AddValue(profCaves.Stop());
                                    feph(total, completed++);
                                }
                            });
                        }
                        completed = 0;
                        /*
                        Profiler profTrees = new Profiler("Trees");
                        for (int X = (int)Min.X; X < Max.X + 1; X++)
                        {
                            for (int Z = (int)Min.Z; Z < Max.Z + 1; Z++)
                            {
                                profTrees.Start();
                                if (dlt.STOP) return;
                                dlt.CurrentSubtask = string.Format("Adding trees to chunk ({0},{1})", X, Z);
                                (ActiveMdiChild as frmMap).Map.Populate(X, Z);
                                dlt.grpPerformance.Text = "Performance";
                                profTrees.Stop();
                                dlt.perfChart.AddValue(profTrees.Stop());
                                feph(total, completed++);
                            }
                        }
                        */
                        /*
                        stage++;
                        dlt.CurrentTask = "Eroding chunk surfaces...";
                        (ActiveMdiChild as frmMap).Map.ForEachProgress += feph;
                        (ActiveMdiChild as frmMap).Map.ForEachChunk(delegate(IMapHandler _mh, long X, long Y)
                        {
                            dlt.CurrentSubtask = string.Format("Eroding chunk ({0},{1}, thermal)", X, Y);
                            //(ActiveMdiChild as frmMap).Map.ErodeThermal(5, 10, (int)X, (int)Y);

                            dlt.CurrentSubtask = string.Format("Eroding chunk ({0},{1}, hydraulic)", X, Y);
                            //(ActiveMdiChild as frmMap).Map.Erode(5, 10, (int)X, (int)Y);

                            dlt.CurrentSubtask = string.Format("Eroding chunk ({0},{1}, silt)", X, Y);
                            //(ActiveMdiChild as frmMap).Map.Silt(63,true, (int)X, (int)Y);

                            dlt.grpPerformance.Text = string.Format("Chunks in-memory ({0})", _mh.ChunksLoaded);
                            dlt.perfChart.AddValue(_mh.ChunksLoaded);
                        });
                        */

                        dlt.CurrentSubtask = "SAVING CHUNKS";
                        (ActiveMdiChild as frmMap).Map.SaveAll();
                        dlt.SetMarquees(false,false);
                        dlt.Done();
                        ClearReport();
                        (ActiveMdiChild as frmMap).Map.Time = 0;
                        //Utils.FixPlayerPlacement(ref (ActiveMdiChild as frmMap).Map);
                        (ActiveMdiChild as frmMap).Map.Save();

                        (ActiveMdiChild as frmMap).Map.Cache.Enabled = true;

                        MessageBox.Show("Done.  Keep in mind that loading may initially be slow.");

                        // DEACTIVATE AUTOREPAIR
                        (ActiveMdiChild as frmMap).Map.Autorepair = false;
                    });
                    dlt.ShowDialog();
                }
            }
        }
コード例 #4
0
ファイル: frmMain.cs プロジェクト: herpit/MineEdit
        private void generateTerrainToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null)
            {
                if ((ActiveMdiChild as frmMap).Map != null)
                {
                    dlgTerrainGen terragen = new dlgTerrainGen((ActiveMdiChild as frmMap).Map);
                    if(terragen.ShowDialog() == DialogResult.Cancel)
                    {
                        ResetStatus();
                        return;
                    }
                    DialogResult dr = MessageBox.Show("This could DELETE EVERYTHING. ARE YOU SURE?", "ARE YOU NUTS", MessageBoxButtons.YesNo);
                    if (dr == DialogResult.No)
                    {
                        ResetStatus();
                        return;
                    }
                    IMapGenerator mg = (IMapGenerator)terragen.pgMapGen.SelectedObject;
                    (ActiveMdiChild as frmMap).Map.Generator = mg;
                    dlgLongTask dlt = new dlgLongTask();
                    dlt.Start(delegate()
                    {
                        dlt.SetMarquees(true, true);
                        dlt.VocabSubtask = "Chunk";
                        dlt.VocabSubtasks = "Chunks";
                        dlt.Title = "Generating chunks.";
                        dlt.Subtitle = "This will take a while.  Go take a break.";
                        dlt.SetMarquees(false, false);
                        dlt.CurrentTask = "Replacing stuff in chunks...";
                        dlt.TasksComplete = 0;
                        dlt.TasksTotal = 1;
                        dlt.SubtasksTotal = 1;

                        (ActiveMdiChild as frmMap).Map.ForEachProgress +=new ForEachProgressHandler(delegate(int Total, int Progress){
                            dlt.TasksTotal = Total;
                            dlt.TasksComplete = Progress;
                        });
                        (ActiveMdiChild as frmMap).Map.ForEachChunk(delegate(long X, long Y)
                        {
                            if (dlt.STOP) return;
                            dlt.SubtasksComplete = 0;
                            dlt.CurrentSubtask = string.Format("Generating chunk ({0},{1})", X, Y);
                            (ActiveMdiChild as frmMap).Map.Generate((ActiveMdiChild as frmMap).Map, X, Y);
                            dlt.SubtasksComplete = 1;
                        });
                        dlt.CurrentTask = "Fixing fluids, may take a while...";
                        dlt.SubtasksTotal = 2;
                        dlt.SubtasksComplete = 0;
                        IMapHandler mh = (ActiveMdiChild as frmMap).Map;
                        dlt.CurrentSubtask = "Fixing water...";
                        int hurr = 1;
                        int hurrT = 0;
                        int passes = 0;
                        while (hurr != 0)
                        {
                            passes++;
                            dlt.CurrentSubtask = string.Format("Fixing water (Pass #{0}, {1} blocks added)...", passes, hurrT);
                            hurr = mh.ExpandFluids(09, false, delegate(int Total,int Complete){
                                dlt.SubtasksTotal = Total;
                                dlt.SubtasksComplete = Complete;
                            });
                            hurrT += hurr;
                        }
                        dlt.SubtasksComplete++;
                        dlt.CurrentSubtask = "Fixing lava...";
                        passes = 0;
                        hurrT = 0;
                        hurr = 1;
                        while (hurr != 0)
                        {
                            passes++;
                            dlt.CurrentSubtask = string.Format("Fixing lava ({0} passes, {1} blocks added)...", passes, hurrT);
                            hurr = mh.ExpandFluids(11, false, delegate(int Total, int Complete)
                            {
                                dlt.SubtasksTotal = Total;
                                dlt.SubtasksComplete = Complete;
                            });
                            hurrT += hurr;
                        }
                        dlt.SubtasksComplete++;
                        (ActiveMdiChild as frmMap).Map = mh;
                        dlt.Done();
                        MessageBox.Show("Done.  Keep in mind that loading may initially be slow.");
                    });
                    dlt.ShowDialog();
                }
            }
        }
コード例 #5
0
ファイル: frmMain.cs プロジェクト: N3X15/MineEdit
        private void recalcLightingToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveMdiChild != null)
            {
                if ((ActiveMdiChild as frmMap).Map != null)
                {
                    tsbStatus.Text = "Waiting for user response lol";
                    DialogResult dr = MessageBox.Show("MineEdit will try and recalculate lighting GLOBALLY using quartz-lightgen.\n\nThis will inevitably take a long time.  ARE YOU SURE?", "DO YOU HAVE THE PATIENCE", MessageBoxButtons.YesNo);
                    if (dr == DialogResult.No)
                    {
                        ResetStatus();
                        return;
                    }
                    dlgLongTask dlt = new dlgLongTask();
                    dlt.Start(delegate()
                    {
                        ShittyLighter lighter = new ShittyLighter();
                        dlt.VocabSubtask = "chunk";
                        dlt.VocabSubtasks = "chunks";
                        dlt.Title = "Relighting Map";
                        dlt.Subtitle = "This will take a while.  Go take a break.";
                        dlt.SetMarquees(false, false);
                        dlt.CurrentTask = "Relighting...";
                        dlt.TasksComplete = 0;
                        dlt.TasksTotal = 1;
                        dlt.SubtasksTotal = 1;

                        IMapHandler mh = (ActiveMdiChild as frmMap).Map;
                        ForEachProgressHandler FEPH = new ForEachProgressHandler(delegate(int Total, int Progress)
                        {
                            dlt.TasksTotal = Total;
                            dlt.TasksComplete = Progress;

                            dlt.CurrentSubtask = "Processes";
                            dlt.SubtasksComplete = mh.ChunksLoaded;
                            dlt.SubtasksTotal = 200;
                            if (mh.ChunksLoaded>200)
                            {
                                string ot = dlt.CurrentTask;
                                Console.WriteLine("****SAVING****");
                                dlt.CurrentTask = "[Saving to avoid overusing RAM]";
                                (ActiveMdiChild as frmMap).Map.SaveAll();
                                dlt.CurrentTask = ot;
                            }
                            (ActiveMdiChild as frmMap).Map.CullUnchanged();
                        });

                        dlt.CurrentTask = "Gathering chunks needing light...";
                        mh.ForEachProgress += FEPH;
                        List<string> chunks = new List<string>();
                        string tf = Path.GetTempFileName();
                        mh.ForEachChunk(delegate(IMapHandler _map,long X, long Y)
                        {
                            chunks.Add(string.Format("{0},{1}",X,Y));
                            //_map.RegenerateLighting(X, Y);
                        });
                        File.WriteAllLines(tf, chunks.ToArray());
                        string args = "'" + Path.GetDirectoryName(mh.Filename) + Path.DirectorySeparatorChar + "' '"+tf+"'";
                        Process child = Process.Start("lightgen.exe", args);
                        //child.WaitForInputIdle();
                        /*
                        // Skylight
                        dlt.CurrentTask = "Skylight...";
                        mh.ForEachProgress += FEPH;
                        lighter.SkylightGlobal(ref mh);
                        mh.SaveAll();

                        // Blocklight
                        dlt.CurrentTask = "Relighting (BlockLight)...";
                        mh.ForEachProgress += FEPH;
                        lighter.BlocklightGlobal(ref mh);
                        mh.SaveAll();
                        */
                        (ActiveMdiChild as frmMap).Map = mh;
                        dlt.Done();
                    });

                    (ActiveMdiChild as frmMap).Map.Autorepair = true;
                    dlt.ShowDialog();
                    (ActiveMdiChild as frmMap).Map.Autorepair = false;
                    MessageBox.Show("Lighting regenerated for "+dlt.TasksComplete+" chunks.", "Report");
                    //(ActiveMdiChild as frmMap).Enabled = true;
                    (ActiveMdiChild as frmMap).ReloadAll();
                    ResetStatus();
                }
            }
        }