//an initial create-map method public override void Generate(int seed, RDungeonFloor entry, List <FloorBorder> floorBorders, Dictionary <int, List <int> > borderLinks) { //TODO: make sure that this algorithm follows floorBorders and borderLinks constraints this.seed = seed; this.entry = entry; FloorBorders = floorBorders; BorderLinks = borderLinks; BorderPoints = new Loc2D[1]; rand = new Random(seed); MapArray = new Tile[10, 10]; MapLayer ground = new MapLayer(Width, Height); GroundLayers.Add(ground); for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { MapArray[x, y] = new Tile(PMDToolkit.Enums.TileType.Walkable, 0, 0, 0); GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } } BorderPoints[0] = new Loc2D(0, 0); }
//an initial create-map method public override void Generate(int seed, RDungeonFloor entry, List <FloorBorder> floorBorders, Dictionary <int, List <int> > borderLinks) { //TODO: make sure that this algorithm follows floorBorders and borderLinks constraints this.seed = seed; this.entry = entry; FloorBorders = floorBorders; BorderLinks = borderLinks; BorderPoints = new Loc2D[2]; AgeArray = new int[20, 20]; TopLeft = new Loc2D(-AgeArray.GetLength(0) / 2, -AgeArray.GetLength(1) / 2); rand = new Random(seed); maxDepth = 8; branches = 5; startLine = new BranchLine(new PointF(0, 0), new PointF(0, 0)); CreatePath(startLine, 0); AddBranches(branches); AddBlobs(3, 500, 3, 6, 1, 2, 0, 3); if (rand.Next() % 100 < 30) { AddBlob(startLine, 100, 3, 6, 1, 4, 0, 3); } BorderPoints[0] = TopLeft * -1; BorderPoints[1] = TopLeft * -1; ConvertToMapArray(); }
public static RDungeon LoadRDungeon(int dungeonNum) { RDungeon dungeon = new RDungeon(dungeonNum); string FilePath = IO.Paths.RDungeonsFolder + "rdungeon" + dungeonNum.ToString() + ".dat"; using (System.IO.StreamReader reader = new System.IO.StreamReader(FilePath)) { while (!(reader.EndOfStream)) { string[] parse = reader.ReadLine().Split('|'); switch (parse[0].ToLower()) { case "rdungeondata": if (parse[1].ToLower() != "v2") { reader.Close(); reader.Dispose(); return null; } break; case "data": dungeon.DungeonName = parse[1]; dungeon.Direction = (Enums.Direction)parse[2].ToInt(); dungeon.MaxFloors = parse[3].ToInt(); dungeon.Recruitment = parse[4].ToBool(); dungeon.Exp = parse[5].ToBool(); dungeon.WindTimer = parse[6].ToInt(); break; case "floor": { RDungeonFloor floor = new RDungeonFloor(); //floor.Options.TrapFrequency = parse[1].ToInt(); floor.Options.TrapMin = parse[2].ToInt(); floor.Options.TrapMax = parse[3].ToInt(); floor.Options.RoomWidthMin = parse[4].ToInt(); floor.Options.RoomWidthMax = parse[5].ToInt(); floor.Options.RoomLengthMin = parse[6].ToInt(); floor.Options.RoomLengthMax = parse[7].ToInt(); floor.Options.HallTurnMin = parse[8].ToInt(); floor.Options.HallTurnMax = parse[9].ToInt(); floor.Options.HallVarMin = parse[10].ToInt(); floor.Options.HallVarMax = parse[11].ToInt(); floor.Options.WaterFrequency = parse[12].ToInt(); floor.Options.Craters = parse[13].ToInt(); floor.Options.CraterMinLength = parse[14].ToInt(); floor.Options.CraterMaxLength = parse[15].ToInt(); floor.Options.CraterFuzzy = parse[16].ToBool(); floor.Darkness = parse[17].ToInt(); floor.GoalType = (Enums.RFloorGoalType)parse[18].ToInt(); floor.GoalMap = parse[19].ToInt(); floor.GoalX = parse[20].ToInt(); floor.GoalY = parse[21].ToInt(); floor.Music = parse[22]; #region terrain #region wall floor.StairsX = parse[23].ToInt(); floor.StairsSheet = parse[24].ToInt(); floor.mGroundX = parse[25].ToInt(); floor.mGroundSheet = parse[26].ToInt(); floor.mTopLeftX = parse[27].ToInt(); floor.mTopLeftSheet = parse[28].ToInt(); floor.mTopCenterX = parse[29].ToInt(); floor.mTopCenterSheet = parse[30].ToInt(); floor.mTopRightX = parse[31].ToInt(); floor.mTopRightSheet = parse[32].ToInt(); floor.mCenterLeftX = parse[33].ToInt(); floor.mCenterLeftSheet = parse[34].ToInt(); floor.mCenterCenterX = parse[35].ToInt(); floor.mCenterCenterSheet = parse[36].ToInt(); floor.mCenterRightX = parse[37].ToInt(); floor.mCenterRightSheet = parse[38].ToInt(); floor.mBottomLeftX = parse[39].ToInt(); floor.mBottomLeftSheet = parse[40].ToInt(); floor.mBottomCenterX = parse[41].ToInt(); floor.mBottomCenterSheet = parse[42].ToInt(); floor.mBottomRightX = parse[43].ToInt(); floor.mBottomRightSheet = parse[44].ToInt(); floor.mInnerTopLeftX = parse[45].ToInt(); floor.mInnerTopLeftSheet = parse[46].ToInt(); floor.mInnerBottomLeftX = parse[47].ToInt(); floor.mInnerBottomLeftSheet = parse[48].ToInt(); floor.mInnerTopRightX = parse[49].ToInt(); floor.mInnerTopRightSheet = parse[50].ToInt(); floor.mInnerBottomRightX = parse[51].ToInt(); floor.mInnerBottomRightSheet = parse[52].ToInt(); floor.mColumnTopX = parse[53].ToInt(); floor.mColumnTopSheet = parse[54].ToInt(); floor.mColumnCenterX = parse[55].ToInt(); floor.mColumnCenterSheet = parse[56].ToInt(); floor.mColumnBottomX = parse[57].ToInt(); floor.mColumnBottomSheet = parse[58].ToInt(); floor.mRowLeftX = parse[59].ToInt(); floor.mRowLeftSheet = parse[60].ToInt(); floor.mRowCenterX = parse[61].ToInt(); floor.mRowCenterSheet = parse[62].ToInt(); floor.mRowRightX = parse[63].ToInt(); floor.mRowRightSheet = parse[64].ToInt(); floor.mIsolatedWallX = parse[65].ToInt(); floor.mIsolatedWallSheet = parse[66].ToInt(); #endregion #region water floor.mWaterX = parse[67].ToInt(); floor.mWaterSheet = parse[68].ToInt(); floor.mWaterAnimX = parse[69].ToInt(); floor.mWaterAnimSheet = parse[70].ToInt(); floor.mShoreTopLeftX = parse[71].ToInt(); floor.mShoreTopLeftSheet = parse[72].ToInt(); floor.mShoreTopRightX = parse[73].ToInt(); floor.mShoreTopRightSheet = parse[74].ToInt(); floor.mShoreBottomRightX = parse[75].ToInt(); floor.mShoreBottomRightSheet = parse[76].ToInt(); floor.mShoreBottomLeftX = parse[77].ToInt(); floor.mShoreBottomLeftSheet = parse[78].ToInt(); floor.mShoreDiagonalForwardX = parse[79].ToInt(); floor.mShoreDiagonalForwardSheet = parse[80].ToInt(); floor.mShoreDiagonalBackX = parse[81].ToInt(); floor.mShoreDiagonalBackSheet = parse[82].ToInt(); floor.mShoreTopX = parse[83].ToInt(); floor.mShoreTopSheet = parse[84].ToInt(); floor.mShoreRightX = parse[85].ToInt(); floor.mShoreRightSheet = parse[86].ToInt(); floor.mShoreBottomX = parse[87].ToInt(); floor.mShoreBottomSheet = parse[88].ToInt(); floor.mShoreLeftX = parse[89].ToInt(); floor.mShoreLeftSheet = parse[90].ToInt(); floor.mShoreVerticalX = parse[91].ToInt(); floor.mShoreVerticalSheet = parse[92].ToInt(); floor.mShoreHorizontalX = parse[93].ToInt(); floor.mShoreHorizontalSheet = parse[94].ToInt(); floor.mShoreInnerTopLeftX = parse[95].ToInt(); floor.mShoreInnerTopLeftSheet = parse[96].ToInt(); floor.mShoreInnerTopRightX = parse[97].ToInt(); floor.mShoreInnerTopRightSheet = parse[98].ToInt(); floor.mShoreInnerBottomRightX = parse[99].ToInt(); floor.mShoreInnerBottomRightSheet = parse[100].ToInt(); floor.mShoreInnerBottomLeftX = parse[101].ToInt(); floor.mShoreInnerBottomLeftSheet = parse[102].ToInt(); floor.mShoreInnerTopX = parse[103].ToInt(); floor.mShoreInnerTopSheet = parse[104].ToInt(); floor.mShoreInnerRightX = parse[105].ToInt(); floor.mShoreInnerRightSheet = parse[106].ToInt(); floor.mShoreInnerBottomX = parse[107].ToInt(); floor.mShoreInnerBottomSheet = parse[108].ToInt(); floor.mShoreInnerLeftX = parse[109].ToInt(); floor.mShoreInnerLeftSheet = parse[110].ToInt(); floor.mShoreSurroundedX = parse[111].ToInt(); floor.mShoreSurroundedSheet = parse[112].ToInt(); #endregion #endregion floor.ItemSpawnRate = parse[113].ToInt(); int maxTraps = parse[114].ToInt(); int maxWeather = parse[115].ToInt(); int n = 116; for (int i = 0; i < 16; i++) { floor.Items[i] = parse[n].ToInt(); n++; } for (int i = 0; i < Constants.MAX_MAP_NPCS; i++) { floor.Npc[i].NpcNum = parse[n].ToInt(); floor.Npc[i].MinLevel = parse[n + 1].ToInt(); n+= 2; } for (int i = 0; i < maxTraps; i++) { floor.Traps.Add(parse[n].ToInt()); n++; } for (int i = 0; i < maxWeather; i++) { floor.Weather.Add((Enums.Weather)parse[n].ToInt()); n++; } dungeon.Floors.Add(floor); } break; } } } return dungeon; }
//an initial create-map method public override void Generate(int seed, RDungeonFloor entry, List <FloorBorder> floorBorders, Dictionary <int, List <int> > borderLinks) { //TODO: make sure that this algorithm follows floorBorders and borderLinks constraints this.seed = seed; this.entry = entry; FloorBorders = floorBorders; BorderLinks = borderLinks; BorderPoints = new Loc2D[floorBorders.Count]; rand = new Random(seed); MapArray = new Tile[entry.FloorSettings["CellX"] * entry.FloorSettings["CellWidth"] + 2, entry.FloorSettings["CellY"] * entry.FloorSettings["CellHeight"] + 2]; GridArray = new GridType[entry.FloorSettings["CellX"] * entry.FloorSettings["CellWidth"] + 2, entry.FloorSettings["CellY"] * entry.FloorSettings["CellHeight"] + 2]; Rooms = new DungeonArrayRoom[entry.FloorSettings["CellX"], entry.FloorSettings["CellY"]]; //array of all rooms VHalls = new DungeonArrayHall[entry.FloorSettings["CellX"], entry.FloorSettings["CellY"] - 1]; //vertical halls HHalls = new DungeonArrayHall[entry.FloorSettings["CellX"] - 1, entry.FloorSettings["CellY"]]; //horizontal halls StartRoom = new Loc2D(-1, -1); //marks spawn point bool isDone; // bool used for various purposes //initialize map array to empty for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { GridArray[x, y] = GridType.Blocked; } } //initialize all rooms+halls to closed by default for (int x = 0; x < entry.FloorSettings["CellX"]; x++) { for (int y = 0; y < entry.FloorSettings["CellY"]; y++) { Rooms[x, y] = new DungeonArrayRoom(); } } for (int x = 0; x < entry.FloorSettings["CellX"]; x++) { for (int y = 0; y < entry.FloorSettings["CellY"] - 1; y++) { VHalls[x, y] = new DungeonArrayHall(); } } for (int x = 0; x < entry.FloorSettings["CellX"] - 1; x++) { for (int y = 0; y < entry.FloorSettings["CellY"]; y++) { HHalls[x, y] = new DungeonArrayHall(); } } // path generation algorithm StartRoom = new Loc2D(rand.Next(0, entry.FloorSettings["CellX"]), rand.Next(0, entry.FloorSettings["CellY"])); // randomly determine start room Loc2D wanderer = StartRoom; int pathsMade = 0; int pathsNeeded = rand.Next(0, 6) + 5; // magic numbers, determine what the dungeon looks like (in general, paths) Direction4 prevDir = Direction4.None; // direction of movement do { if (rand.Next(0, (2 + pathsMade)) == 0) //will end the current path and start a new one from the start { if (rand.Next(0, 2) == 0) //determine if the room should be open or a hall { Rooms[wanderer.X, wanderer.Y].Opened = DungeonArrayRoom.RoomState.Open; } else { Rooms[wanderer.X, wanderer.Y].Opened = DungeonArrayRoom.RoomState.Hall; } pathsMade++; wanderer = StartRoom; prevDir = Direction4.None; } else { bool working = true; do { Loc2D sample = wanderer; Direction4 nextDir = (Direction4)rand.Next(0, 4); if (nextDir != prevDir) //makes sure there is no backtracking { Operations.MoveInDirection4(ref sample, nextDir, 1); prevDir = Operations.ReverseDir(nextDir); if (sample.X >= 0 && sample.X < entry.FloorSettings["CellX"] && sample.Y >= 0 && sample.Y < entry.FloorSettings["CellY"]) // a is the room to be checked after making a move between rooms { openHallBetween(wanderer, sample); wanderer = sample; working = false; } } else { prevDir = Direction4.None; } } while (working); if (rand.Next(0, 2) == 0) //determine if the room should be open or a hall { Rooms[wanderer.X, wanderer.Y].Opened = DungeonArrayRoom.RoomState.Open; } else { Rooms[wanderer.X, wanderer.Y].Opened = DungeonArrayRoom.RoomState.Hall; } } } while (pathsMade < pathsNeeded); Rooms[StartRoom.X, StartRoom.Y].Opened = DungeonArrayRoom.RoomState.Open; //Determine key rooms isDone = false; do //determine ending room randomly { int x = rand.Next(0, Rooms.GetLength(0)); int y = rand.Next(0, Rooms.GetLength(1)); if (Rooms[x, y].Opened == DungeonArrayRoom.RoomState.Open) { EndRoom = new Loc2D(x, y); isDone = true; } } while (!isDone); StartRoom = new Loc2D(-1, -1); isDone = false; do //determine starting room randomly { int x = rand.Next(0, Rooms.GetLength(0)); int y = rand.Next(0, Rooms.GetLength(1)); if (Rooms[x, y].Opened == DungeonArrayRoom.RoomState.Open) { StartRoom = new Loc2D(x, y); isDone = true; } } while (!isDone); // begin part 2, creating ASCII map //create rooms for (int i = 0; i < Rooms.GetLength(0); i++) { for (int j = 0; j < Rooms.GetLength(1); j++) { if (Rooms[i, j].Opened != DungeonArrayRoom.RoomState.Closed) { createRoom(i, j); } } } for (int i = 0; i < Rooms.GetLength(0); i++) { for (int j = 0; j < Rooms.GetLength(1); j++) { if (Rooms[i, j].Opened != DungeonArrayRoom.RoomState.Closed) { drawRoom(i, j); } } } for (int i = 0; i < Rooms.GetLength(0); i++) { for (int j = 0; j < Rooms.GetLength(1); j++) { if (Rooms[i, j].Opened != DungeonArrayRoom.RoomState.Closed) { padSingleRoom(i, j); } } } for (int i = 0; i < VHalls.GetLength(0); i++) { for (int j = 0; j < VHalls.GetLength(1); j++) { if (VHalls[i, j].Open) { createVHall(i, j); } } } for (int i = 0; i < HHalls.GetLength(0); i++) { for (int j = 0; j < HHalls.GetLength(1); j++) { if (HHalls[i, j].Open) { createHHall(i, j); } } } for (int i = 0; i < VHalls.GetLength(0); i++) { for (int j = 0; j < VHalls.GetLength(1); j++) { if (VHalls[i, j].Open) { DrawHalls(VHalls[i, j]); } } } for (int i = 0; i < HHalls.GetLength(0); i++) { for (int j = 0; j < HHalls.GetLength(1); j++) { if (HHalls[i, j].Open) { DrawHalls(HHalls[i, j]); } } } addSEpos(StartRoom, true); addSEpos(EndRoom, false); //texturing MapLayer ground = new MapLayer(Width, Height); GroundLayers.Add(ground); for (int y = 0; y < Height; y++) { for (int x = 0; x < Width; x++) { if (GridArray[x, y] == GridType.End) { MapArray[x, y] = new Tile(PMDToolkit.Enums.TileType.ChangeFloor, 1, 0, 0); GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(47, 0), 0); } else if (GridArray[x, y] == GridType.Blocked) { MapArray[x, y] = new Tile(PMDToolkit.Enums.TileType.Blocked, 0, 0, 0); bool[] blockedDirs = new bool[8]; for (int n = 0; n < 8; n++) { blockedDirs[n] = IsBlocked(x, y, (Direction8)n); } if (blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 0; if (!blockedDirs[(int)Direction8.DownLeft]) { layer += 8 * 2; } if (!blockedDirs[(int)Direction8.UpLeft]) { layer += 1; } if (!blockedDirs[(int)Direction8.UpRight]) { layer += 8; } if (!blockedDirs[(int)Direction8.DownRight]) { layer += 2; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (!blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 6; if (blockedDirs[(int)Direction8.UpRight]) { layer += 1 * 8; } if (blockedDirs[(int)Direction8.UpLeft]) { layer += 2 * 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 7; if (blockedDirs[(int)Direction8.DownRight]) { layer += 1 * 8; } if (blockedDirs[(int)Direction8.UpRight]) { layer += 2 * 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 4; if (blockedDirs[(int)Direction8.DownLeft]) { layer += 1 * 8; } if (blockedDirs[(int)Direction8.DownRight]) { layer += 2 * 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { int layer = 5; if (blockedDirs[(int)Direction8.UpLeft]) { layer += 1 * 8; } if (blockedDirs[(int)Direction8.DownLeft]) { layer += 2 * 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (!blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 34; if (blockedDirs[(int)Direction8.UpRight]) { layer += 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { int layer = 35; if (blockedDirs[(int)Direction8.DownRight]) { layer += 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { int layer = 32; if (blockedDirs[(int)Direction8.DownLeft]) { layer += 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (!blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { int layer = 33; if (blockedDirs[(int)Direction8.UpLeft]) { layer += 8; } GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(), 0); } else if (blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(36, 0), 0); } else if (!blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(37, 0), 0); } else if (!blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(38, 0), 0); } else if (!blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(39, 0), 0); } else if (!blockedDirs[(int)Direction8.Down] && blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(44, 0), 0); } else if (blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(45, 0), 0); } else if (!blockedDirs[(int)Direction8.Down] && !blockedDirs[(int)Direction8.Left] && !blockedDirs[(int)Direction8.Up] && !blockedDirs[(int)Direction8.Right]) { GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(46, 0), 0); } } else { MapArray[x, y] = new Tile(PMDToolkit.Enums.TileType.Walkable, 0, 0, 0); GroundLayers[0].Tiles[x, y] = new TileAnim(new Loc2D(47, 0), 0); } } } GenItems(); SpawnNpcs(); }
public static RDungeon LoadRDungeon(int dungeonNum) { RDungeon dungeon = new RDungeon(dungeonNum); string FilePath = IO.Paths.RDungeonsFolder + "rdungeon" + dungeonNum.ToString() + ".dat"; using (System.IO.StreamReader reader = new System.IO.StreamReader(FilePath)) { while (!(reader.EndOfStream)) { string[] parse = reader.ReadLine().Split('|'); switch (parse[0].ToLower()) { case "rdungeondata": if (parse[1].ToLower() != "v1") { reader.Close(); reader.Dispose(); return null; } break; case "data": dungeon.DungeonName = parse[1]; dungeon.Direction = (Enums.Direction)parse[2].ToInt(); dungeon.MaxFloors = parse[3].ToInt(); dungeon.Recruitment = parse[4].ToBool(); dungeon.Exp = parse[5].ToBool(); break; case "terrain": { #region Terrain dungeon.StairsX = parse[1].ToInt(); dungeon.StairsSheet = parse[2].ToInt(); dungeon.mGroundX = parse[3].ToInt(); dungeon.mGroundSheet = parse[4].ToInt(); dungeon.mTopLeftX = parse[5].ToInt(); dungeon.mTopLeftSheet = parse[6].ToInt(); dungeon.mTopCenterX = parse[7].ToInt(); dungeon.mTopCenterSheet = parse[8].ToInt(); dungeon.mTopRightX = parse[9].ToInt(); dungeon.mTopRightSheet = parse[10].ToInt(); dungeon.mCenterLeftX = parse[11].ToInt(); dungeon.mCenterLeftSheet = parse[12].ToInt(); dungeon.mCenterCenterX = parse[13].ToInt(); dungeon.mCenterCenterSheet = parse[14].ToInt(); dungeon.mCenterRightX = parse[15].ToInt(); dungeon.mCenterRightSheet = parse[16].ToInt(); dungeon.mBottomLeftX = parse[17].ToInt(); dungeon.mBottomLeftSheet = parse[18].ToInt(); dungeon.mBottomCenterX = parse[19].ToInt(); dungeon.mBottomCenterSheet = parse[20].ToInt(); dungeon.mBottomRightX = parse[21].ToInt(); dungeon.mBottomRightSheet = parse[22].ToInt(); dungeon.mInnerTopLeftX = parse[23].ToInt(); dungeon.mInnerTopLeftSheet = parse[24].ToInt(); dungeon.mInnerBottomLeftX = parse[25].ToInt(); dungeon.mInnerBottomLeftSheet = parse[26].ToInt(); dungeon.mInnerTopRightX = parse[27].ToInt(); dungeon.mInnerTopRightSheet = parse[28].ToInt(); dungeon.mInnerBottomRightX = parse[29].ToInt(); dungeon.mInnerBottomRightSheet = parse[30].ToInt(); if (parse.Length > 32) { dungeon.mWaterX = parse[31].ToInt(); dungeon.mWaterSheet = parse[32].ToInt(); dungeon.mWaterAnimX = parse[33].ToInt(); dungeon.mWaterAnimSheet = parse[34].ToInt(); dungeon.mIsolatedWallX = parse[35].ToInt(); dungeon.mIsolatedWallSheet = parse[36].ToInt(); dungeon.mColumnTopX = parse[37].ToInt(); dungeon.mColumnTopSheet = parse[38].ToInt(); dungeon.mColumnCenterX = parse[39].ToInt(); dungeon.mColumnCenterSheet = parse[40].ToInt(); dungeon.mColumnBottomX = parse[41].ToInt(); dungeon.mColumnBottomSheet = parse[42].ToInt(); dungeon.mRowLeftX = parse[43].ToInt(); dungeon.mRowLeftSheet = parse[44].ToInt(); dungeon.mRowCenterX = parse[45].ToInt(); dungeon.mRowCenterSheet = parse[46].ToInt(); if (parse.Length > 48) { dungeon.mRowRightX = parse[47].ToInt(); dungeon.mRowRightSheet = parse[48].ToInt(); if (parse.Length > 50) { dungeon.mShoreTopLeftX = parse[49].ToInt(); dungeon.mShoreTopLeftSheet = parse[50].ToInt(); dungeon.mShoreTopRightX = parse[51].ToInt(); dungeon.mShoreTopRightSheet = parse[52].ToInt(); dungeon.mShoreBottomRightX = parse[53].ToInt(); dungeon.mShoreBottomRightSheet = parse[54].ToInt(); dungeon.mShoreBottomLeftX = parse[55].ToInt(); dungeon.mShoreBottomLeftSheet = parse[56].ToInt(); dungeon.mShoreDiagonalForwardX = parse[57].ToInt(); dungeon.mShoreDiagonalForwardSheet = parse[58].ToInt(); dungeon.mShoreDiagonalBackX = parse[59].ToInt(); dungeon.mShoreDiagonalBackSheet = parse[60].ToInt(); dungeon.mShoreTopX = parse[61].ToInt(); dungeon.mShoreTopSheet = parse[62].ToInt(); dungeon.mShoreRightX = parse[63].ToInt(); dungeon.mShoreRightSheet = parse[64].ToInt(); dungeon.mShoreBottomX = parse[65].ToInt(); dungeon.mShoreBottomSheet = parse[66].ToInt(); dungeon.mShoreLeftX = parse[67].ToInt(); dungeon.mShoreLeftSheet = parse[68].ToInt(); dungeon.mShoreVerticalX = parse[69].ToInt(); dungeon.mShoreVerticalSheet = parse[70].ToInt(); dungeon.mShoreHorizontalX = parse[71].ToInt(); dungeon.mShoreHorizontalSheet = parse[72].ToInt(); dungeon.mShoreInnerTopLeftX = parse[73].ToInt(); dungeon.mShoreInnerTopLeftSheet = parse[74].ToInt(); dungeon.mShoreInnerTopRightX = parse[75].ToInt(); dungeon.mShoreInnerTopRightSheet = parse[76].ToInt(); dungeon.mShoreInnerBottomRightX = parse[77].ToInt(); dungeon.mShoreInnerBottomRightSheet = parse[78].ToInt(); dungeon.mShoreInnerBottomLeftX = parse[79].ToInt(); dungeon.mShoreInnerBottomLeftSheet = parse[80].ToInt(); dungeon.mShoreInnerTopX = parse[81].ToInt(); dungeon.mShoreInnerTopSheet = parse[82].ToInt(); dungeon.mShoreInnerRightX = parse[83].ToInt(); dungeon.mShoreInnerRightSheet = parse[84].ToInt(); dungeon.mShoreInnerBottomX = parse[85].ToInt(); dungeon.mShoreInnerBottomSheet = parse[86].ToInt(); dungeon.mShoreInnerLeftX = parse[87].ToInt(); dungeon.mShoreInnerLeftSheet = parse[88].ToInt(); dungeon.mShoreSurroundedX = parse[89].ToInt(); dungeon.mShoreSurroundedSheet = parse[90].ToInt(); } } } #endregion } break; case "floor": { RDungeonFloor floor = new RDungeonFloor(); floor.WeatherIntensity = parse[1].ToInt(); floor.Weather = (Enums.Weather)parse[2].ToInt(); floor.Music = parse[3]; floor.GoalType = (Enums.RFloorGoalType)parse[4].ToInt(); floor.GoalMap = parse[5].ToInt(); floor.GoalX = parse[6].ToInt(); floor.GoalY = parse[7].ToInt(); floor.ItemSpawnRate = parse[8].ToInt(); int maxTraps = parse[9].ToInt(); int n = 10; for (int i = 0; i < 15; i++) { floor.Npc[i] = parse[n].ToInt(); n++; } for (int i = 0; i < 8; i++) { floor.Items[i] = parse[n].ToInt(); n++; } for (int i = 0; i < maxTraps; i++) { floor.Traps.Add(parse[n].ToInt()); n++; } dungeon.Floors.Add(floor); } break; case "cratersettings": { dungeon.Options.Craters = parse[1].ToInt(); dungeon.Options.CraterMinLength = parse[2].ToInt(); dungeon.Options.CraterMaxLength = parse[3].ToInt(); dungeon.Options.CraterFuzzy = parse[4].ToBool(); } break; } } } return dungeon; }