private void GenerateParticles_Click(object sender, RoutedEventArgs e) { Randomizer.saveDir = RSettings.ToolsOutDirectory; for (int i = 0; i < 50; i++) { ParticleGenerator.GetParticle(RSettings); } MessageBox.Show($"Successfully Generated Particles", "Info", MessageBoxButton.OK, MessageBoxImage.Information); }
public static void RandomizeMod(MainWindow mw) { //ShadersList = mw.ShadersList; saveDir = settings.GameDirectory; PrepModFolders(); // level corruptions string dir = $"{saveDir}tilemaps"; if (Directory.Exists(dir)) { string[] paths = Directory.GetFiles(dir); foreach (var file in paths) { LevelFile level = LevelManip.Load(file); //if(settings.MirrorMode) //{ // LevelManip.FlipLevelH(ref level); // FlipCSV(saveDir + "data/map.csv"); //} if (settings.DoCorruptions) { LevelCorruptors.CorruptLevel(ref level); } LevelManip.Save(level, file); } } // data folder dir = $"{saveDir}data"; if (Directory.Exists(dir)) { // tilesets.txt var file = $"{dir}/tilesets.txt"; if (File.Exists(file)) { string[] text = File.ReadAllLines(file); for (int i = 0; i < text.Length; i++) { if (text[i].Contains("palette")) { text[i] = TilesetManip.GetPalette(); } if (text[i].Contains("tile_graphics")) { text[i] = TilesetManip.GetTile(); } if (text[i].Contains("overlay_graphics")) { text[i] = TilesetManip.GetOverlay(); } if (text[i].Contains("global_particle")) { var split = text[i].Trim().Split(Convert.ToChar(" ")); text[i] = split[0] + " " + ParticleGenerator.GetParticle(settings); } } File.Delete(file); File.WriteAllLines(file, text); } } }
public static Tileset GetTileset(SettingsFile settings, bool isAreaTS) { Tileset tileset = new Tileset(); try { // Select Tileset Info if (isAreaTS) { //if (settings.DeadRacer) tileset.AreaType = "glitch"; if (settings.RandomizeAreaType) { tileset.AreaType = AreaTypes[RNG.random.Next(0, 5)]; } else { tileset.AreaType = settings.AreaType; } } tileset.Tile = ($" tile_graphics { TileGraphicsPool[RNG.random.Next(0, TileGraphicsPool.Count())] }\n"); tileset.Overlay = ($" overlay_graphics { OverlayGraphicsPool[RNG.random.Next(0, OverlayGraphicsPool.Count())] }\n"); tileset.Palette = ($" palette { RNG.random.Next(1, NumPalettes) }\n"); tileset.Music = ($" music { MusicPool[RNG.random.Next(0, MusicPool.Count())] }\n"); if (RNG.random.Next(0, 2) == 0) // set shader { tileset.Shader = ($" { ShaderPool[RNG.random.Next(0, ShaderPool.Count())] }\n"); } tileset.Shader += "shader_param " + ((float)RNG.random.Next(0, 101) / 100); // set particles if (settings.DoParticles) { var loop = RNG.random.Next(1, settings.MaxParticleEffects); if (settings.GenerateCustomParticles) { for (int i = 0; i < loop; i++) { tileset.Particles += (" global_particle_" + (i + 1).ToString() + $" { ParticleGenerator.GetParticle(settings) }\n"); } } else { for (int i = 0; i < loop; i++) { tileset.Particles += (" global_particle_" + (i + 1).ToString() + $" { ParticlePool[RNG.random.Next(0, ParticlePool.Count())] }\n"); } } } // bgsolid for auto-refresh //if (settings.AutoRefresh || settings.LevelMerge) // Extras += "background_graphics bgsolid\n"; if (settings.LevelMerge) { tileset.Extras += "global_particle_1 None\nglobal_particle_2 None\nglobal_particle_3 None tile_particle_1 None tile_particle_2 None tile_particle_3 None tile_particle_4 None tile_particle_5 None\n"; } // generate Art Alts if (settings.AltLevel != "None") { tileset.ArtAlts = GetArtAlts(settings); } // extras and physics if (settings.UseAreaTileset == isAreaTS) { if (settings.DoNevermoreTilt && RNG.random.Next(0, 6) == 0 /*!(isAreaTS && !settings.UseAreaTileset)*/) { tileset.DoTilt = ($" do_tilt true\n"); } if (settings.DoExodusWobble && RNG.random.Next(0, 6) == 0 /*!(isAreaTS && !settings.UseAreaTileset)*/) { tileset.DoWobble = ($" do_wobble true\n"); } if (settings.DoPhysics) { if (settings.PlatformPhysics) { tileset.Extras += " platform_physics " + Physics.PlatformPhysics() + "\n"; } if (settings.WaterPhysics) { tileset.Extras += " water_physics " + Physics.WaterPhysics() + "\n"; } if (settings.PlayerPhysics) { tileset.Extras += " player_physics " + Physics.PlayerPhysics() + "\n"; } if (settings.LowGravPhysics) { tileset.Extras += " lowgrav_physics " + Physics.LowGravPhysics() + "\n"; } } } // create "all", which is just the entire tileset in one string tileset.All = $"area_type {tileset.AreaType}\n" + tileset.Tile + "\n" + tileset.Overlay + "\n" + tileset.Particles + "\n" + tileset.Shader + "\n" + tileset.Palette + "\n" + tileset.Music + "\n" + tileset.Extras; } catch (Exception ex) { MessageBox.Show($"Error creating tileset. Exception {ex}", "Error", MessageBoxButton.OK, MessageBoxImage.Error); throw; } return(tileset); }