// Test/play the world. public void TestWorld() { if (IsWorldOpen) { string worldPath = Path.Combine(Directory.GetParent(Application.ExecutablePath).FullName, "testing.zwd"); WorldFile worldFile = new WorldFile(); worldFile.Save(worldPath, world); string exePath = Path.Combine(Directory.GetParent(Application.ExecutablePath).FullName, "ZeldaOracle.exe"); Process.Start(exePath, "\"" + worldPath + "\""); } }
//----------------------------------------------------------------------------- // World //----------------------------------------------------------------------------- // Save the world file to the given filename. public void SaveFileAs(string fileName) { if (IsWorldOpen) { WorldFile saveFile = new WorldFile(); saveFile.Save(fileName, world); hasMadeChanges = false; worldFilePath = fileName; worldFileName = Path.GetFileName(fileName); } }
// Test/play the world with the player placed at the given room and point. public void TestWorld(Point2I roomCoord, Point2I playerCoord) { if (IsWorldOpen) { playerPlaceMode = false; int levelIndex = 0; for (levelIndex = 0; levelIndex < world.Levels.Count; levelIndex++) { if (world.Levels[levelIndex] == level) { break; } } string worldPath = Path.Combine(Directory.GetParent(Application.ExecutablePath).FullName, "testing.zwd"); WorldFile worldFile = new WorldFile(); worldFile.Save(worldPath, world); string exePath = Path.Combine(Directory.GetParent(Application.ExecutablePath).FullName, "ZeldaOracle.exe"); Process.Start(exePath, "\"" + worldPath + "\" -test " + levelIndex + " " + roomCoord.X + " " + roomCoord.Y + " " + playerCoord.X + " " + playerCoord.Y); // TODO: editorForm.ButtonTestPlayerPlace.Checked = false; } }
// Test/play the world with the player placed at the given room and point. public void TestWorld(Point2I roomCoord, Point2I playerCoord) { if (IsWorldOpen) { playerPlaceMode = false; int levelIndex = 0; for (levelIndex = 0; levelIndex < world.Levels.Count; levelIndex++) { if (world.Levels[levelIndex] == level) break; } string worldPath = Path.Combine(Directory.GetParent(Application.ExecutablePath).FullName, "testing.zwd"); WorldFile worldFile = new WorldFile(); worldFile.Save(worldPath, world); string exePath = Path.Combine(Directory.GetParent(Application.ExecutablePath).FullName, "ZeldaOracle.exe"); Process.Start(exePath, "\"" + worldPath + "\" -test " + levelIndex + " " + roomCoord.X + " " + roomCoord.Y + " " + playerCoord.X + " " + playerCoord.Y); // TODO: editorForm.ButtonTestPlayerPlace.Checked = false; } }
// Test/play the world. public void TestWorld() { if (IsWorldOpen) { string worldPath = Path.Combine(Directory.GetParent(Application.ExecutablePath).FullName, "testing.zwd"); WorldFile worldFile = new WorldFile(); worldFile.Save(worldPath, world); string exePath = Path.Combine(Directory.GetParent(Application.ExecutablePath).FullName, "ZeldaOracle.exe"); Process.Start(exePath, "\"" + worldPath + "\""); } }
//----------------------------------------------------------------------------- // World //----------------------------------------------------------------------------- // Save the world file to the given filename. public void SaveFileAs(string fileName) { if (IsWorldOpen) { WorldFile saveFile = new WorldFile(); saveFile.Save(fileName, world); hasMadeChanges = false; } }
public static World CreateTestWorld() { // Create the world. World world = new World(); world.StartLevelIndex = 0; world.StartRoomLocation = new Point2I(2, 1); world.StartTileLocation = new Point2I(3, 2); // Load the levels from java level files. world.Levels.Add(LoadJavaLevel("Content/Worlds/test_level.zwd")); world.Levels.Add(LoadJavaLevel("Content/Worlds/interiors.zwd")); world.Levels.Add(LoadJavaLevel("Content/Worlds/big_interiors.zwd")); world.Levels[0].Properties.Set("id", "overworld"); world.Levels[1].Properties.Set("id", "interiors"); world.Levels[2].Properties.Set("id", "big_interiors"); TileData tdBlock = Resources.GetResource<TileData>("movable_block"); TileData tdDiamond = Resources.GetResource<TileData>("diamond_rock"); TileData tdBush = Resources.GetResource<TileData>("bush"); TileData tdPot = Resources.GetResource<TileData>("pot"); TileData tdRock = Resources.GetResource<TileData>("rock"); TileData tdGrass = Resources.GetResource<TileData>("grass"); TileData tdOwl = Resources.GetResource<TileData>("owl"); TileData tdLantern = Resources.GetResource<TileData>("lantern"); TileData tdSign = Resources.GetResource<TileData>("sign"); TileData tdChest = Resources.GetResource<TileData>("chest"); TileData tdReward = Resources.GetResource<TileData>("reward"); EventTileData etdWarp = Resources.GetResource<EventTileData>("warp"); Level level; Room r; TileDataInstance t; EventTileDataInstance e; // Setup the overworld rooms. level = world.Levels[0]; r = level.GetRoomAt(2, 1); t = r.CreateTile(tdOwl, 8, 1, 1); t.Properties.Set("text", "Hello, World!"); t = r.CreateTile(tdChest, 7, 1, 1); t.Properties.Set("reward", "heart_piece"); t = r.CreateTile(tdReward, 6, 3, 1); t.Properties.Set("reward", "item_flippers_1"); t = r.CreateTile(tdSign, 1, 1, 1); t.Properties.Set("text", "This will<n> prime your load catchers and boost your desktop wallpaper."); t = r.CreateTile(tdReward, 2, 6, 1); t.Properties.Set("reward", "heart_piece"); r.CreateTile(tdBlock, 2, 5, 1); r.CreateTile(tdGrass, 2, 2, 1); r.CreateTile(tdGrass, 2, 3, 1); r.CreateTile(tdGrass, 2, 4, 1); r.CreateTile(tdGrass, 3, 4, 1); r.CreateTile(tdGrass, 4, 5, 1); r.CreateTile(tdGrass, 3, 6, 1); r.CreateTile(tdGrass, 4, 6, 1); r.CreateTile(tdGrass, 5, 6, 1); r.CreateTile(tdGrass, 4, 7, 1); r.CreateTile(tdGrass, 5, 7, 1); r.CreateTile(tdGrass, 6, 7, 1); r.CreateTile(tdGrass, 7, 7, 1); r.CreateTile(tdGrass, 7, 2, 1); r.CreateTile(tdGrass, 8, 2, 1); r.CreateTile(tdGrass, 8, 3, 1); r = level.GetRoomAt(2, 2); e = r.CreateEventTile(etdWarp, 16, 64); e.Properties.Add(Property.CreateString("id", "warp_a")); e.Properties.Add(Property.CreateString("warp_type", "tunnel")); e.Properties.Add(Property.CreateString("destination_level", "overworld")); e.Properties.Add(Property.CreateString("destination_warp_point", "warp_b")); r = level.GetRoomAt(1, 1); e = r.CreateEventTile(etdWarp, 64, 96); e.Properties.Add(Property.CreateString("id", "warp_b")); e.Properties.Add(Property.CreateString("warp_type", "stairs")); e.Properties.Add(Property.CreateString("destination_level", "overworld")); e.Properties.Add(Property.CreateString("destination_warp_point", "warp_a")); r = level.GetRoomAt(new Point2I(1, 1)); r.CreateTile(tdDiamond, 1, 1, 1); r.CreateTile(tdDiamond, 2, 2, 1); r.CreateTile(tdDiamond, 2, 4, 1); r.CreateTile(tdPot, 8, 2, 1); r = level.GetRoomAt(new Point2I(3, 0)); r.CreateTile(tdLantern, 3, 2, 1); r = level.GetRoomAt(new Point2I(1, 0)); r.CreateTile(tdRock, 8, 2, 1); r = level.GetRoomAt(new Point2I(2, 0)); for (int x = 1; x < 8; x++) { for (int y = 2; y < 6; y++) { r.CreateTile(tdBush, x, y, 1); } } // Set the rooms to random zones. /*Random random = new Random(); for (int x = 0; x < level.Width; x++) { for (int y = 0; y < level.Height; y++) { int index = random.Next(0, 3); Zone zone = GameData.ZONE_SUMMER; if (index == 1) zone = GameData.ZONE_GRAVEYARD; else if (index == 2) zone = GameData.ZONE_FOREST; level.GetRoom(new Point2I(x, y)).Zone = zone; } }*/ // Setup the interior rooms. level = world.Levels[1]; r = level.GetRoomAt(2, 1); r.Zone = GameData.ZONE_INTERIOR; r.CreateTile(tdPot, 1, 2, 1); r.CreateTile(tdPot, 1, 3, 1); r.CreateTile(tdPot, 5, 1, 1); r = level.GetRoomAt(3, 1); r.Zone = GameData.ZONE_INTERIOR; r.CreateTile(tdChest, 8, 1, 1); r.CreateTile(tdPot, 8, 2, 1); r.CreateTile(tdPot, 4, 6, 1); r.CreateTile(tdPot, 5, 6, 1); r.CreateTile(tdPot, 6, 6, 1); r.CreateTile(tdPot, 7, 6, 1); r.CreateTile(tdPot, 8, 6, 1); // Save and load the world. { WorldFile worldFile = new WorldFile(); worldFile.Save("Content/Worlds/custom_world.zwd", world); } { WorldFile worldFile = new WorldFile(); world = worldFile.Load("Content/Worlds/custom_world.zwd"); } return world; }
public static World CreateTestWorld() { // Create the world. World world = new World(); world.StartLevelIndex = 0; world.StartRoomLocation = new Point2I(2, 1); world.StartTileLocation = new Point2I(3, 2); // Load the levels from java level files. world.Levels.Add(LoadJavaLevel("Content/Worlds/test_level.zwd")); world.Levels.Add(LoadJavaLevel("Content/Worlds/interiors.zwd")); world.Levels.Add(LoadJavaLevel("Content/Worlds/big_interiors.zwd")); world.Levels[0].Properties.Set("id", "overworld"); world.Levels[1].Properties.Set("id", "interiors"); world.Levels[2].Properties.Set("id", "big_interiors"); TileData tdBlock = Resources.GetResource <TileData>("movable_block"); TileData tdDiamond = Resources.GetResource <TileData>("diamond_rock"); TileData tdBush = Resources.GetResource <TileData>("bush"); TileData tdPot = Resources.GetResource <TileData>("pot"); TileData tdRock = Resources.GetResource <TileData>("rock"); TileData tdGrass = Resources.GetResource <TileData>("grass"); TileData tdOwl = Resources.GetResource <TileData>("owl"); TileData tdLantern = Resources.GetResource <TileData>("lantern"); TileData tdSign = Resources.GetResource <TileData>("sign"); TileData tdChest = Resources.GetResource <TileData>("chest"); TileData tdReward = Resources.GetResource <TileData>("reward"); EventTileData etdWarp = Resources.GetResource <EventTileData>("warp"); Level level; Room r; TileDataInstance t; EventTileDataInstance e; // Setup the overworld rooms. level = world.Levels[0]; r = level.GetRoomAt(2, 1); t = r.CreateTile(tdOwl, 8, 1, 1); t.Properties.Set("text", "Hello, World!"); t = r.CreateTile(tdChest, 7, 1, 1); t.Properties.Set("reward", "heart_piece"); t = r.CreateTile(tdReward, 6, 3, 1); t.Properties.Set("reward", "item_flippers_1"); t = r.CreateTile(tdSign, 1, 1, 1); t.Properties.Set("text", "This will<n> prime your load catchers and boost your desktop wallpaper."); t = r.CreateTile(tdReward, 2, 6, 1); t.Properties.Set("reward", "heart_piece"); r.CreateTile(tdBlock, 2, 5, 1); r.CreateTile(tdGrass, 2, 2, 1); r.CreateTile(tdGrass, 2, 3, 1); r.CreateTile(tdGrass, 2, 4, 1); r.CreateTile(tdGrass, 3, 4, 1); r.CreateTile(tdGrass, 4, 5, 1); r.CreateTile(tdGrass, 3, 6, 1); r.CreateTile(tdGrass, 4, 6, 1); r.CreateTile(tdGrass, 5, 6, 1); r.CreateTile(tdGrass, 4, 7, 1); r.CreateTile(tdGrass, 5, 7, 1); r.CreateTile(tdGrass, 6, 7, 1); r.CreateTile(tdGrass, 7, 7, 1); r.CreateTile(tdGrass, 7, 2, 1); r.CreateTile(tdGrass, 8, 2, 1); r.CreateTile(tdGrass, 8, 3, 1); r = level.GetRoomAt(2, 2); e = r.CreateEventTile(etdWarp, 16, 64); e.Properties.Set("id", "warp_a"); e.Properties.Set("warp_type", "tunnel"); e.Properties.Set("destination_level", "overworld"); e.Properties.Set("destination_warp_point", "warp_b"); r = level.GetRoomAt(1, 1); e = r.CreateEventTile(etdWarp, 64, 96); e.Properties.Set("id", "warp_b"); e.Properties.Set("warp_type", "stairs"); e.Properties.Set("destination_level", "overworld"); e.Properties.Set("destination_warp_point", "warp_a"); r = level.GetRoomAt(new Point2I(1, 1)); r.CreateTile(tdDiamond, 1, 1, 1); r.CreateTile(tdDiamond, 2, 2, 1); r.CreateTile(tdDiamond, 2, 4, 1); r.CreateTile(tdPot, 8, 2, 1); r = level.GetRoomAt(new Point2I(3, 0)); r.CreateTile(tdLantern, 3, 2, 1); r = level.GetRoomAt(new Point2I(1, 0)); r.CreateTile(tdRock, 8, 2, 1); r = level.GetRoomAt(new Point2I(2, 0)); for (int x = 1; x < 8; x++) { for (int y = 2; y < 6; y++) { r.CreateTile(tdBush, x, y, 1); } } // Set the rooms to random zones. /*Random random = new Random(); * for (int x = 0; x < level.Width; x++) { * for (int y = 0; y < level.Height; y++) { * int index = random.Next(0, 3); * Zone zone = GameData.ZONE_SUMMER; * if (index == 1) * zone = GameData.ZONE_GRAVEYARD; * else if (index == 2) * zone = GameData.ZONE_FOREST; * level.GetRoom(new Point2I(x, y)).Zone = zone; * } * }*/ // Setup the interior rooms. level = world.Levels[1]; r = level.GetRoomAt(2, 1); r.Zone = GameData.ZONE_INTERIOR; r.CreateTile(tdPot, 1, 2, 1); r.CreateTile(tdPot, 1, 3, 1); r.CreateTile(tdPot, 5, 1, 1); r = level.GetRoomAt(3, 1); r.Zone = GameData.ZONE_INTERIOR; r.CreateTile(tdChest, 8, 1, 1); r.CreateTile(tdPot, 8, 2, 1); r.CreateTile(tdPot, 4, 6, 1); r.CreateTile(tdPot, 5, 6, 1); r.CreateTile(tdPot, 6, 6, 1); r.CreateTile(tdPot, 7, 6, 1); r.CreateTile(tdPot, 8, 6, 1); // Save and load the world. { WorldFile worldFile = new WorldFile(); worldFile.Save("Content/Worlds/custom_world.zwd", world); } { WorldFile worldFile = new WorldFile(); world = worldFile.Load("Content/Worlds/custom_world.zwd"); } return(world); }