Example #1
0
        public void Act(Hero hero, Map dMap)
        {
            //check for hero in sight
            if (Vector2.Distance(new Vector2(hero.mapX, hero.mapY), new Vector2(mapX, mapY)) < 6 && dMap.LoSLine(mapX, mapY, hero.mapX, hero.mapY))
            {
                curAIMode = AIMode.Aggro;
                curTarLoc = new Point(hero.mapX, hero.mapY);
                if (Math.Abs(mapX - hero.mapX) + Math.Abs(mapY - hero.mapY) != 1)
                {
                    mQueue = dMap.PathTo(new Point(mapX, mapY), curTarLoc, false, false);
                    if (mQueue.Count > 20 || mQueue.Count == 0)
                    {
                        //Console.WriteLine(string.Format("{0} found unusable path (length {1}) - calculating direct path",name,mQueue.Count));
                        mQueue = dMap.PathTo(new Point(mapX, mapY), curTarLoc, false, true);
                        //Console.WriteLine(string.Format("{0} found direct path (length {1})", name, mQueue.Count));
                    }
                }
            }

            //act accordingly
            if (curAIMode == AIMode.Wander)
            {
                while (mQueue.Count == 0)
                {
                    curTarLoc = dMap.openSquares[rando.Next(dMap.openSquares.Count)];
                    if (dMap.blocks[curTarLoc.X, curTarLoc.Y])
                    {
                        mQueue = dMap.PathTo(new Point(mapX, mapY), curTarLoc, false);
                    }
                }
                MoveFromQueue(dMap);
            }
            if (curAIMode == AIMode.Alert)
            {
                MoveFromQueue(dMap);
                if (mQueue.Count == 0) curAIMode = AIMode.Wander;
            }
            if (curAIMode == AIMode.Aggro)
            {
                if (dMap.LoSLine(mapX, mapY, hero.mapX, hero.mapY))
                {
                    //Console.WriteLine(string.Format("Moving from {0}, {1} to {2}, {3}", mapX, mapY, mQueue[0].X, mQueue[0].Y));
                    if (Math.Abs(mapX - hero.mapX) + Math.Abs(mapY - hero.mapY) == 1)
                    {
                        Attack(hero);
                    }
                    else  MoveFromQueue(dMap);
                }
                else
                {
                    curAIMode = AIMode.Alert;
                }
            }
        }
Example #2
0
 public void MoveFromQueue(Map dMap)
 {
     bool didMove = false;
     if (mQueue.Count > 0)
     {
         didMove = Move(mQueue[0].X, mQueue[0].Y, dMap, false);
         mQueue.RemoveAt(0);
     }
     if (!didMove)
     {
         mQueue.Clear();
         delay += 0.5f;
     }
 }
Example #3
0
 public void RandLocation(Map dMap)
 {
     while (dMap.blocks[mapX, mapY])
     {
         int pointchoice = rando.Next(dMap.openSquares.Count);
         mapX = dMap.openSquares[pointchoice].X;
         mapY = dMap.openSquares[pointchoice].Y;
     }
 }
Example #4
0
 public void Kill(Map dMap)
 {
     alive = false;
     dMap.blocks[mapX, mapY] = true;
     Console.WriteLine("Killed a monster!");
 }
Example #5
0
 public bool Move(int newX, int newY, Map dMap, bool clearQueue = true)
 {
     if (clearQueue) mQueue.Clear();
     if (dMap.IsInMap(new Point(newX, newY)) && dMap.blocks[newX, newY])
     {
         dMap.blocks[mapX, mapY] = true;
         dMap.blocks[newX, newY] = false;
         mapX = newX;
         mapY = newY;
         delay += 1;
         //Console.WriteLine(string.Format("{0} moved!",name));
         return true;
     }
     //Console.WriteLine(string.Format("{0} unable to move!", name));
     return false;
 }
Example #6
0
 public void Move(int newX, int newY, Map dMap, bool clearQueue = true)
 {
     if (clearQueue) mQueue.Clear();
     if (delay == 0 && dMap.IsInMap(new Point(newX, newY)) && dMap.blocks[newX, newY])
     {
         dMap.blocks[mapX, mapY] = true;
         mapX = newX;
         mapY = newY;
         delay += 1;
     }
     dMap.blocks[mapX, mapY] = false;
 }
Example #7
0
 public void MoveFromQueue(Map dMap)
 {
     if (delay == 0 && mQueue.Count > 0)
     {
         Move(mQueue[0].X, mQueue[0].Y, dMap, false);
         mQueue.RemoveAt(0);
         if (mQueue.Count == 0 || delay == 0) mQueue.Clear();
     }
     else mQueue.Clear();
 }
Example #8
0
        public void DrawAll(GameState gameState, SpriteBatch screen, Hero hero, Map dMap)
        {
            if (gameState == GameState.Running)
            {
                //map overlays
                if (hero.mQueue.Count > 0)
                {
                    Color olcol = new Color(70, 210, 100, 50);
                    screen.Draw(overlays[1], new Rectangle(hero.mQueue[hero.mQueue.Count - 1].X * dMap.tileSizeX + dMap.xOffset, hero.mQueue[hero.mQueue.Count - 1].Y * dMap.tileSizeY + dMap.yOffset, dMap.tileSizeX, dMap.tileSizeY), olcol);
                    if (hero.mQueue.Count > 1)
                    {
                        for (int i = 0; i < hero.mQueue.Count - 1; i++)
                        {
                            screen.Draw(overlays[0], new Rectangle(hero.mQueue[i].X * dMap.tileSizeX + dMap.xOffset, hero.mQueue[i].Y * dMap.tileSizeY + dMap.yOffset, dMap.tileSizeX, dMap.tileSizeY), olcol);
                        }
                    }
                }

                //box backgrounds
                foreach (Box thisbox in boxes)
                {
                    thisbox.Draw(screen);
                }

                //log
                int firstL = logLines.Count - 6 - logOff;
                if (firstL < 0) firstL = 0;
                int lastL = logLines.Count - 1 - logOff;
                for (int i = firstL; i <= lastL; i++)
                {
                    Vector2 FontPos = new Vector2(boxes[0].contRect.Left + 3, boxes[0].contRect.Top + (15 * (i - firstL)));
                    screen.DrawString(logFont, logLines[i], FontPos, logColors[i]);
                }

                //minimap
                int lX, lY, uX, uY;
                int tX = hero.mapX - (boxes[1].contRect.Width / 8);
                if (tX < 0)
                {
                    lX = ((-4 * tX) + boxes[1].contRect.Left);
                    tX = 0;
                }
                else lX = (boxes[1].contRect.Left);

                int tY = hero.mapY - (boxes[1].contRect.Height / 8);
                if (tY < 0)
                {
                    lY = ((-4 * tY) + boxes[1].contRect.Top);
                    tY = 0;
                }
                else lY = (boxes[1].contRect.Left);

                uX = boxes[1].contRect.Left + boxes[1].contRect.Width;
                uY = boxes[1].contRect.Top + boxes[1].contRect.Height;

                Rectangle prect;
                int dx = lX;
                int dy = lY;
                while (tX < dMap.bounds.X && dx < uX)
                {
                    while (tY < dMap.bounds.Y && dy < uY)
                    {
                        if (dMap.vision[tX, tY] > 0)
                        {
                            prect = new Rectangle(dx, dy, 4, 4);
                            if (dMap.floor[tX, tY] == FloorTypes.Wall) screen.Draw(mmtile, prect, Color.DarkSlateGray);
                            else if (dMap.floor[tX, tY] == FloorTypes.Floor) screen.Draw(mmtile, prect, Color.LightGray);
                            else if (dMap.floor[tX, tY] == FloorTypes.Feature) screen.Draw(mmblock, prect, Color.Gray);
                        }
                        dy += 4;
                        tY += 1;
                    }
                    dy = lY;
                    tY = hero.mapY - (boxes[1].contRect.Height / 8);
                    if (tY < 0) tY = 0;
                    tX += 1;
                    dx += 4;
                }

                foreach (Item wonder in dMap.items)
                {
                    int mx = boxes[1].contRect.Center.X - (4 * (hero.mapX - wonder.MapX));
                    int my = boxes[1].contRect.Center.Y - (4 * (hero.mapY - wonder.MapY));
                    if (dMap.vision[wonder.MapX, wonder.MapY] == Vision.Visible && boxes[1].contRect.Contains(new Point(mx, my)))
                    {
                        prect = new Rectangle(mx, my, 4, 4);
                        screen.Draw(mmmark, prect, Color.Gold);
                    }
                }

                foreach (Monster fiend in dMap.monsters)
                {
                    int mx = boxes[1].contRect.Center.X - (4 * (hero.mapX - fiend.mapX));
                    int my = boxes[1].contRect.Center.Y - (4 * (hero.mapY - fiend.mapY));
                    if (dMap.vision[fiend.mapX, fiend.mapY] == Vision.Visible && boxes[1].contRect.Contains(new Point(mx, my)))
                    {
                        prect = new Rectangle(mx, my, 4, 4);
                        screen.Draw(mmmark, prect, Color.Red);
                    }
                }

                prect = new Rectangle(boxes[1].contRect.Center.X, boxes[1].contRect.Center.Y, 4, 4);
                screen.Draw(mmmark, prect, Color.Lime);

                //stats
                //screen.Draw(statBar, new Rectangle(boxes[2].contRect.Left + 5, boxes[2].contRect.Top + 5, boxes[2].contRect.Width - 10, 20), Color.Green);
                //screen.Draw(statBar, new Rectangle(boxes[2].contRect.Left + 5, boxes[2].contRect.Top + 30, boxes[2].contRect.Width - 10, 20), Color.BlueViolet);
                screen.Draw(statglobe, new Rectangle(statsLoc.X, statsLoc.Y - 40, 60, 60), Color.Red);
                screen.DrawString(statFont, hero.stats.Health.ToString(), new Vector2(statsLoc.X + 30 - (int)statFont.MeasureString(hero.stats.Health.ToString()).X / 2, statsLoc.Y - 10 - (int)statFont.MeasureString(hero.stats.Health.ToString()).Y / 2), Color.LightGray);
                screen.Draw(statglobe, new Rectangle(statsLoc.X - 35, statsLoc.Y + 20, 60, 60), Color.Green);
                screen.DrawString(statFont, hero.stats.Vitality.ToString(), new Vector2(statsLoc.X - 5 - (int)statFont.MeasureString(hero.stats.Vitality.ToString()).X / 2, statsLoc.Y + 50 - (int)statFont.MeasureString(hero.stats.Vitality.ToString()).Y / 2), Color.LightGray);
                screen.Draw(statglobe, new Rectangle(statsLoc.X + 35, statsLoc.Y + 20, 60, 60), Color.Blue);
                screen.DrawString(statFont, hero.stats.Sanity.ToString(), new Vector2(statsLoc.X + 65 - (int)statFont.MeasureString(hero.stats.Sanity.ToString()).X / 2, statsLoc.Y + 50 - (int)statFont.MeasureString(hero.stats.Sanity.ToString()).Y / 2), Color.LightGray);

                //action bar
                for (int i = 0; i < 10; i++)
                {
                    if (i == selAct) screen.Draw(itemcircle, new Rectangle(boxes[3].contRect.Left + (50 * i), boxes[3].contRect.Top, 50, 50), Color.DarkGreen);
                    else screen.Draw(itemcircle, new Rectangle(boxes[3].contRect.Left + (50 * i), boxes[3].contRect.Top, 50, 50), Color.Blue);
                    Vector2 FontPos = new Vector2(boxes[3].contRect.Left + 1 + (50 * i), boxes[3].contRect.Top + 1);
                    screen.DrawString(logFont, ((i + 1) % 10).ToString(), FontPos, Color.White);
                }
                for (int i = 0; i < actIcons.Count && i < 10; i++)
                {
                    screen.Draw(actIcons[i], new Rectangle(boxes[3].contRect.Left + 5 + (50 * i), boxes[3].contRect.Top + 5, 40, 40), Color.White);
                }
            }
            else if (gameState == GameState.MainMenu)
            {
                mainMenu.DrawMenu(screen, hlCol);
            }
            else if (gameState == GameState.Graveyard)
            {
                for (int i = graves.Count - 1; i >= 0; i--)
                {
                    int row = (int)Math.Floor((double)i / 4);
                    int col = i % 4;
                    Color drawcol = new Color(220 - (40 * row), 220 - (40 * row), 220 - (40 * row));
                    screen.Draw(graveTex, new Rectangle(20 + (200 - (30 * row)) * col + (60 * row), (1500 / (10 + row ^ 2)), 180 - 50 * row, 360 - 100 * row), new Rectangle(10 * (graves[i].level / 4), 0, 10, 20), drawcol);
                }
            }
        }
Example #9
0
        public void ProcessInput(GameLogic gamelogic, GameState gameState, KeyboardState oKS, KeyboardState nKS, MouseState oMS, MouseState nMS, Hero hero, Map dMap)
        {
            if (gameState == GameState.Running)
            {
                if (nKS.IsKeyDown(Keys.Escape) && !oKS.IsKeyDown(Keys.Escape))
                {
                    gamelogic.OpenMainMenu("blank");
                }

                //adjust log
                if (nKS.IsKeyDown(Keys.OemMinus) && oKS.IsKeyUp(Keys.OemMinus)) LogScrollUp();
                else if (nKS.IsKeyDown(Keys.OemPlus) && oKS.IsKeyUp(Keys.OemPlus)) LogScrollDown();

                //select actions
                if (nKS.IsKeyDown(Keys.D1) && oKS.IsKeyUp(Keys.D1)) selAct = 0;
                else if (nKS.IsKeyDown(Keys.D2) && oKS.IsKeyUp(Keys.D2)) selAct = 1;
                else if (nKS.IsKeyDown(Keys.D3) && oKS.IsKeyUp(Keys.D3)) selAct = 2;
                else if (nKS.IsKeyDown(Keys.D4) && oKS.IsKeyUp(Keys.D4)) selAct = 3;
                else if (nKS.IsKeyDown(Keys.D5) && oKS.IsKeyUp(Keys.D5)) selAct = 4;
                else if (nKS.IsKeyDown(Keys.D6) && oKS.IsKeyUp(Keys.D6)) selAct = 5;
                else if (nKS.IsKeyDown(Keys.D7) && oKS.IsKeyUp(Keys.D7)) selAct = 6;
                else if (nKS.IsKeyDown(Keys.D8) && oKS.IsKeyUp(Keys.D8)) selAct = 7;
                else if (nKS.IsKeyDown(Keys.D9) && oKS.IsKeyUp(Keys.D9)) selAct = 8;
                else if (nKS.IsKeyDown(Keys.D0) && oKS.IsKeyUp(Keys.D0)) selAct = 9;

                //Mouse Input
                Point mPoint = new Point(nMS.X, nMS.Y);
                Point mapMLoc = dMap.XYtoMap(nMS.X, nMS.Y);
                if (gD.Viewport.Bounds.Contains(mPoint))
                {
                    if (oMS.LeftButton != ButtonState.Pressed && nMS.LeftButton == ButtonState.Pressed)
                    {
                        if (CatchClick(mPoint, nMS))
                        {

                        }
                        else
                        {
                            //clicks on map
                            //Console.WriteLine(string.Format("Click at {0}, {1}",tarpoint.X, tarpoint.Y));
                            if (dMap.IsInMap(mapMLoc) && dMap.vision[mapMLoc.X, mapMLoc.Y] > 0 && dMap.blocks[mapMLoc.X, mapMLoc.Y] && !(hero.mapX == mapMLoc.X && hero.mapY == mapMLoc.Y))
                            {
                                hero.mQueue = dMap.PathTo(new Point(hero.mapX, hero.mapY), mapMLoc);
                            }
                        }
                    }

                    if (oMS.RightButton != ButtonState.Pressed && nMS.RightButton == ButtonState.Pressed)
                    {
                        if (CatchClick(mPoint, nMS))
                        {

                        }
                        else
                        {
                            //clicks on map
                            //Console.WriteLine(string.Format("Click at {0}, {1}",tarpoint.X, tarpoint.Y));
                            if (dMap.IsInMap(mapMLoc) && dMap.blocks[mapMLoc.X, mapMLoc.Y] && !(hero.mapX == mapMLoc.X && hero.mapY == mapMLoc.Y))
                            {
                                dMap.monsters.Add(new Monster(string.Format("M{0}", dMap.monsters.Count), 0, mapMLoc.X, mapMLoc.Y));
                                dMap.monsters[dMap.monsters.Count - 1].Move(mapMLoc.X, mapMLoc.Y, dMap);
                            }
                            else
                            {
                                foreach (Monster fiend in dMap.monsters)
                                {
                                    if (fiend.mapX == mapMLoc.X && fiend.mapY == mapMLoc.Y)
                                    {
                                        dMap.alts[fiend.mapX, fiend.mapY] = 17 + rando.Next(3);
                                        fiend.Kill(dMap);
                                    }
                                }
                            }
                        }
                    }
                }
            }
            else if (gameState == GameState.MainMenu)
            {
                mainMenu.ClearHighlight();
                mainMenu.MenuHover(nMS.X, nMS.Y);
                if (nMS.LeftButton == ButtonState.Pressed && oMS.LeftButton == ButtonState.Released)
                {
                    mainMenu.MenuClick(nMS.X, nMS.Y);
                }

            }
            else if (gameState == GameState.Graveyard)
            {
                if (nKS.IsKeyDown(Keys.Escape) && !oKS.IsKeyDown(Keys.Escape))
                {
                    gamelogic.OpenMainMenu("blank");
                }
            }
        }
Example #10
0
        /// <summary>
        /// Handles keyboard and mouse input.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        private void UpdateInput(GameTime gameTime)
        {
            KeyboardState newKState = Keyboard.GetState();
            MouseState newMState = Mouse.GetState();

            //gui interaction
            Point mpoint = new Point(0,0);
            gui.ProcessInput(this, gameState, oldKState, newKState, oldMState, newMState, hero, dMap);

            if (gameState == GameState.Running)
            {
                //save & menu functions

                if (newKState.IsKeyDown(Keys.F5) && !oldKState.IsKeyDown(Keys.F5))
                {
                    heroGen.SaveHero(hero);
                    mapGen.SaveMap(hero.name, dMap);
                    gui.LogEntry(string.Format("Saving {0}...", hero.name), Color.Brown);
                }
                if (newKState.IsKeyDown(Keys.F9) && !oldKState.IsKeyDown(Keys.F9))
                {
                    dMap = mapGen.LoadMap(hero.name, 0);
                    hero = heroGen.LoadHero(hero.name);
                    AlignMap(hero);
                    FixMap();
                    gui.LogEntry(string.Format("Loading {0}...", hero.name), Color.Brown);
                }

                //movement
                if ((gameTime.TotalGameTime - lastTurnTime).Milliseconds >= repTime)
                {
                    if (newKState.IsKeyDown(Keys.Down) || newKState.IsKeyDown(Keys.S))
                    {
                        hero.Move(hero.mapX, hero.mapY + 1, dMap);
                    }
                    if (newKState.IsKeyDown(Keys.Up) || newKState.IsKeyDown(Keys.W))
                    {
                        hero.Move(hero.mapX, hero.mapY - 1, dMap);
                    }
                    if (newKState.IsKeyDown(Keys.Left) || newKState.IsKeyDown(Keys.A))
                    {
                        hero.Move(hero.mapX - 1, hero.mapY, dMap);
                    }
                    if (newKState.IsKeyDown(Keys.Right) || newKState.IsKeyDown(Keys.D))
                    {
                        hero.Move(hero.mapX + 1, hero.mapY, dMap);
                    }
                    if (newKState.IsKeyDown(Keys.Space))
                    {
                        if (hero.delay == 0) hero.delay += 1;
                    }
                }

                //queued moves
                if (hero.mQueue.Count > 0 && (gameTime.TotalGameTime - lastTurnTime).Milliseconds >= repTime)
                {
                    hero.MoveFromQueue(dMap);
                }

                // Realign the map
                if (hero.delay > 0)
                {
                    FixMap();
                    EndTurn(gameTime);
                }
            }

            // Update saved state.
            oldKState = newKState;
            oldMState = newMState;
        }
Example #11
0
        public void NewGame(string hclass)
        {
            dMap = mapGen.GenerateMap();

            gui.LogEntry("Welcome to Sprite Strife!", Color.LightGray);

            //create the hero
            hero = new Hero("testchar", 0);
            hero.mapX = dMap.startingLocation.X;
            hero.mapY = dMap.startingLocation.Y;

            FixMap();

            mapGen.SaveMap("testchar", dMap);
            heroGen.SaveHero(hero);

            gameState = GameState.Running;
        }
Example #12
0
        public void ContinueGame(string hname)
        {
            if (System.IO.Directory.Exists("testchar"))
            {
                dMap = mapGen.LoadMap("testchar", 0);
                hero = heroGen.LoadHero("testchar");

                FixMap();

                gameState = GameState.Running;
            }
        }
Example #13
0
        public void SaveMap(string saveName, Map mapToSave)
        {
            //try
            //{
                if (!System.IO.Directory.Exists(saveName)) System.IO.Directory.CreateDirectory(saveName);
                BinaryFormatter bf = new BinaryFormatter();
                FileStream outstream = File.OpenWrite(string.Format("{0}\\floor{1}.map", saveName, mapToSave.floorLevel));
                bf.Serialize(outstream, mapToSave);
                outstream.Close();
            //}
            //catch (Exception)
            //{

            //}
        }
Example #14
0
        public Map GenerateMap(int floorLevel = 0, int genMethod = 1)
        {
            //initialize map array
            Map newMap = new Map(xSize, ySize, 40, 40);
            //newMap.floor = new FloorTypes[xSize, ySize];
            //newMap.alts = new int[xSize, ySize];
            for (int y = 0; y < ySize; y++)
            {
                for (int x = 0; x < xSize; x++)
                {
                    newMap.floor[x, y] = FloorTypes.Empty;
                    newMap.alts[x, y] = 0;
                    newMap.objects[x, y] = new MapObject(-1, 0);
                }
            }

            //generate map
            if (genMethod == 1)
            {
                //SEED + EROSION
                List<Point> seeds = new List<Point>();
                for (int s = 0; s < 3; s++) seeds.Add(new Point(rand.Next((xSize / 2) - 6) + 3, rand.Next((ySize / 2) - 6) + 3));
                for (int s = 0; s < 3; s++) seeds.Add(new Point(rand.Next((xSize / 2) - 6) + 2 + (xSize / 2), rand.Next((ySize / 2) - 6) + 3));
                for (int s = 0; s < 3; s++) seeds.Add(new Point(rand.Next((xSize / 2) - 6) + 2 + (xSize / 2), rand.Next((ySize / 2) - 6) + 2 + (ySize / 2)));
                for (int s = 0; s < 3; s++) seeds.Add(new Point(rand.Next((xSize / 2) - 6) + 3, rand.Next((ySize / 2) - 6) + 2 + (ySize / 2)));

                //erode rooms
                foreach (Point s in seeds)
                {
                    List<Point> erode = new List<Point>();
                    int esize = 15 + rand.Next(15);

                    foreach (Point thispoint in ringAround)
                    {
                        if (newMap.floor[s.X + thispoint.X, s.Y + thispoint.Y] == FloorTypes.Empty)
                        {
                            newMap.floor[s.X + thispoint.X, s.Y + thispoint.Y] = FloorTypes.Floor;
                            if (rand.Next(2) == 1) erode.Add(new Point(s.X + thispoint.X, s.Y + thispoint.Y));
                        }
                    }

                    //newMap.objects[s.X, s.Y] = new MapObject(0, 0);

                    //Console.WriteLine(string.Format("Eroding {0} points from seed...", erode.Count));

                    while (erode.Count > 0)
                    {
                        foreach (Point thispoint in ringAround)
                        {
                            if (newMap.floor[erode[0].X + thispoint.X, erode[0].Y + thispoint.Y] == FloorTypes.Empty)
                            {
                                if (rand.Next(10) < 7 && erode[0].X > 2 && erode[0].X < xSize - 2 && erode[0].Y > 2 && erode[0].Y < ySize - 2)
                                {
                                    newMap.floor[erode[0].X + thispoint.X, erode[0].Y + thispoint.Y] = FloorTypes.Floor;
                                    if (rand.Next(3) == 1 && esize > 0)
                                    {
                                        erode.Add(new Point(erode[0].X + thispoint.X, erode[0].Y + thispoint.Y));
                                        esize -= 1;

                                        //Console.WriteLine(string.Format("New erosion seed at {0}, {1} ({2} unexpanded, {3} remaining)", erode[0].X + thispoint.X, erode[0].Y + thispoint.Y, erode.Count, esize));
                                    }
                                }
                            }
                        }

                        erode.RemoveAt(0);
                    }
                }

                //connect hallways
                int tx = seeds[seeds.Count - 1].X;
                int ty = seeds[seeds.Count - 1].Y;
                while (tx != seeds[0].X)
                {
                    if (tx < seeds[0].X) tx += 1;
                    else if (tx > seeds[0].X) tx -= 1;
                    newMap.floor[tx, ty] = FloorTypes.Floor;
                }
                while (ty != seeds[0].Y)
                {
                    if (ty < seeds[0].Y) ty += 1;
                    else if (ty > seeds[0].Y) ty -= 1;
                    newMap.floor[tx, ty] = FloorTypes.Floor;
                }
                for (int i = 1; i < seeds.Count; i++)
                {
                    tx = seeds[i - 1].X;
                    ty = seeds[i - 1].Y;
                    while (tx != seeds[i].X)
                    {
                        if (tx < seeds[i].X) tx += 1;
                        else if (tx > seeds[i].X) tx -= 1;
                        newMap.floor[tx, ty] = FloorTypes.Floor;
                    }
                    while (ty != seeds[i].Y)
                    {
                        if (ty < seeds[i].Y) ty += 1;
                        else if (ty > seeds[i].Y) ty -= 1;
                        newMap.floor[tx, ty] = FloorTypes.Floor;
                    }
                }

                //expand walls
                for (int y = 1; y < ySize - 1; y++)
                {
                    for (int x = 1; x < xSize - 1; x++)
                    {
                        if (newMap.floor[x, y] == FloorTypes.Floor)
                        {
                            foreach (Point thispoint in ringAround)
                            {
                                if (newMap.floor[x + thispoint.X, y + thispoint.Y] == FloorTypes.Empty)
                                {
                                    newMap.floor[x + thispoint.X, y + thispoint.Y] = FloorTypes.Wall;
                                }
                            }
                        }
                    }
                }

                //clean up bits
                for (int y = 1; y < ySize - 1; y++)
                {
                    for (int x = 1; x < xSize - 1; x++)
                    {
                        if (newMap.floor[x, y] == FloorTypes.Wall)
                        {
                            int floorcheck = 0;
                            foreach (Point thispoint in boxAround)
                            {
                                if (newMap.floor[x + thispoint.X, y + thispoint.Y] == FloorTypes.Floor)
                                {
                                    floorcheck += 1;
                                }
                            }
                            if (floorcheck == 4)
                            {
                                newMap.floor[x, y] = FloorTypes.Floor;
                                //Console.WriteLine(string.Format("Removing stray wall bit at {0}, {1}", x, y));
                            }
                        }
                        else if (newMap.floor[x, y] == FloorTypes.Floor)
                        {
                            int floorcheck = 0;
                            foreach (Point thispoint in boxAround)
                            {
                                if (newMap.floor[x + thispoint.X, y + thispoint.Y] == FloorTypes.Floor)
                                {
                                    floorcheck += 1;
                                }
                            }
                            if (floorcheck == 0)
                            {
                                newMap.floor[x, y] = FloorTypes.Wall;
                                //Console.WriteLine(string.Format("Removing stray floor bit at {0}, {1}", x, y));
                            }
                        }
                    }
                }

                //random alts
                for (int y = 0; y < ySize; y++)
                {
                    for (int x = 0; x < xSize; x++)
                    {
                        if (newMap.floor[x, y] == FloorTypes.Floor || newMap.floor[x, y] == FloorTypes.Wall)
                        {
                            if (rand.Next(10) == 0) //common
                            {
                                if (rand.Next(10) == 0) //rare
                                {
                                    newMap.alts[x, y] = rand.Next(6, 11);
                                }
                                else
                                {
                                    newMap.alts[x, y] = rand.Next(1, 6);
                                }
                            }
                        }
                    }
                }

                foreach (Point s in seeds)
                {
                    newMap.floor[s.X, s.Y] = FloorTypes.Feature;
                    newMap.alts[s.X, s.Y] = 3;
                }
            }

            newMap.Recalc();

            //throw in some items
            for (int i = 0; i < 10; i++)
            {
                Point itemloc = newMap.openSquares[rand.Next(newMap.openSquares.Count)];
                //newMap.items.Add(new Item(String.Format("I{0}", newMap.items.Count), 0, itemloc.X, itemloc.Y));
            }

            newMap.startingLocation = newMap.openSquares[rand.Next(newMap.openSquares.Count)];

            return newMap;
        }