示例#1
0
        public Enemy(string spriteMap, Vector2 pos, Globals.SpriteFace sprFace, Globals.battleEnemyTypes type)
        {
            sprites    = Globals.Content.Load <Texture2D>("Assets/" + spriteMap);
            spriteFace = sprFace;

            position = pos;

            moving = false;
            timer.Restart();
            count       = 0;
            delay       = 500;
            aggro       = false;
            aggroDelay  = 100;
            aggroRadius = 5;

            types.Add(type);
        }
示例#2
0
        public void Update()
        {
            if (!moving)
            {
                if (!Globals.pause && !Globals.sleep)
                {
                    int direction = 5;
                    if (!aggro && timer.ElapsedMilliseconds >= delay)
                    {
                        if (Math.Round(Math.Abs(Globals.position.X - position.X) + Math.Abs(Globals.position.Y - position.Y)) <= aggroRadius)
                        {
                            aggro = true;
                        }
                        direction = rand.Next(5);
                    }
                    else if (aggro && timer.ElapsedMilliseconds >= aggroDelay)
                    {
                        if (Math.Round(Math.Abs(Globals.position.X - position.X)) >= Math.Round(Math.Abs(Globals.position.Y - position.Y)))
                        {
                            if (Globals.position.X > position.X)
                            {
                                direction = 3;
                            }
                            else
                            {
                                direction = 2;
                            }
                        }
                        else if (Math.Round(Math.Abs(Globals.position.Y - position.Y)) > Math.Round(Math.Abs(Globals.position.X - position.X)))
                        {
                            if (Globals.position.Y > position.Y)
                            {
                                direction = 1;
                            }
                            else
                            {
                                direction = 0;
                            }
                        }

                        if (Math.Round(Globals.position.X) == Math.Round(position.X) && Math.Round(Globals.position.Y) == Math.Round(position.Y))
                        {
                            direction = 5;
                        }
                    }
                    if ((!aggro && timer.ElapsedMilliseconds >= delay) || (aggro && timer.ElapsedMilliseconds >= aggroDelay))
                    {
                        switch (direction)
                        {
                        case 0:                         // Up
                            spriteFace = Globals.SpriteFace.Up;
                            if (Math.Round(position.Y) > 0 && Globals.permissions[Convert.ToInt32(Math.Round(position.Y) - 1)][Convert.ToInt32(Math.Round(position.X))] == Globals.Permissions.Open && Globals.overlayPerms[Convert.ToInt32(Math.Round(position.Y) - 1)][Convert.ToInt32(Math.Round(position.X))] == Globals.Permissions.Open)
                            {
                                step   = Globals.spriteSrcUp.Count;
                                moving = true;
                                timer.Start();
                            }
                            break;

                        case 1:                         // Down
                            spriteFace = Globals.SpriteFace.Down;
                            if (Math.Round(position.Y) < Globals.mapBounds.Height / Globals.bitWidth - 1 && Globals.permissions[Convert.ToInt32(Math.Round(position.Y) + 1)][Convert.ToInt32(Math.Round(position.X))] == Globals.Permissions.Open && Globals.overlayPerms[Convert.ToInt32(Math.Round(position.Y) + 1)][Convert.ToInt32(Math.Round(position.X))] == Globals.Permissions.Open)
                            {
                                step   = Globals.spriteSrcDown.Count;
                                moving = true;
                                timer.Start();
                            }
                            break;

                        case 2:                         // Left
                            spriteFace = Globals.SpriteFace.Left;
                            if (Math.Round(position.X) > 0 && Globals.permissions[Convert.ToInt32(Math.Round(position.Y))][Convert.ToInt32(Math.Round(position.X) - 1)] == Globals.Permissions.Open && Globals.overlayPerms[Convert.ToInt32(Math.Round(position.Y))][Convert.ToInt32(Math.Round(position.X) - 1)] == Globals.Permissions.Open)
                            {
                                step   = Globals.spriteSrcLeft.Count;
                                moving = true;
                                timer.Start();
                            }
                            break;

                        case 3:                         // Right
                            spriteFace = Globals.SpriteFace.Right;
                            if (Math.Round(position.X) < Globals.mapBounds.Width / Globals.bitWidth - 1 && Globals.permissions[Convert.ToInt32(Math.Round(position.Y))][Convert.ToInt32(Math.Round(position.X) + 1)] == Globals.Permissions.Open && Globals.overlayPerms[Convert.ToInt32(Math.Round(position.Y))][Convert.ToInt32(Math.Round(position.X) + 1)] == Globals.Permissions.Open)
                            {
                                step   = Globals.spriteSrcRight.Count;
                                moving = true;
                                timer.Start();
                            }
                            break;

                        default:
                            timer.Restart();
                            break;
                        }
                    }
                }
            }
            else if (timer.ElapsedMilliseconds >= Globals.STEP_DELAY)
            {
                if (spriteFace == Globals.SpriteFace.Up)
                {
                    position.Y -= (float)1 / Globals.spriteSrcUp.Count;
                }
                if (spriteFace == Globals.SpriteFace.Down)
                {
                    position.Y += (float)1 / Globals.spriteSrcDown.Count;
                }
                if (spriteFace == Globals.SpriteFace.Left)
                {
                    position.X -= (float)1 / Globals.spriteSrcLeft.Count;
                }
                if (spriteFace == Globals.SpriteFace.Right)
                {
                    position.X += (float)1 / Globals.spriteSrcRight.Count;
                }

                count++;
                step--;
                timer.Restart();
                // When movement is done
                if (step == 0)
                {
                    moving = false;
                    count  = 0;
                    timer.Restart();
                }
            }
        }
示例#3
0
        /* DEPRECATED. Also was getting in the way of the overloaded constructor. And that's kinda annoying.
         * public Map(ContentManager c, SpriteBatch s, Vector2 screenBounds, Rectangle windowBounds, string spriteMap)
         * {
         *  Globals.Content = c;
         *  Globals.spriteBatch = s;
         *  Globals.screenBounds = screenBounds;
         *  Globals.windowBounds = windowBounds;
         *
         *  sprites = Globals.Content.Load<Texture2D>(spriteMap);
         *
         *  Globals.map = new List<List<Vector2>>();
         *  for (int y = 0; y < 20; y++)
         *  {
         *      List<Vector2> newRow = new List<Vector2>();
         *      for (int x = 0; x < 20; x++)
         *      {
         *          newRow.Add(new Vector2(10, 4));
         *      }
         *      Globals.map.Add(newRow);
         *  }
         *
         *  Globals.startPoint = Vector2.Zero; // Change this ASAP
         * }*/

        public Map(ContentManager c, SpriteBatch s, Vector2 screenBounds, Rectangle windowBounds, string spriteMap)
        {
            Globals.Content      = c;
            Globals.spriteBatch  = s;
            Globals.screenBounds = screenBounds;
            Globals.windowBounds = windowBounds;

            sprites = Globals.Content.Load <Texture2D>(spriteMap);

            Globals.map     = new List <List <Vector2> >();
            Globals.enemies = new List <Enemy>();

            XmlDocument reader        = new XmlDocument();
            XmlDocument overlayReader = new XmlDocument();
            string      filename      = "Maps/";

            if (Globals.fileOpen)
            {
                filename = "Saves/" + Globals.slotOpen + "/" + filename;
            }

            if (!File.Exists(filename + Globals.currentMap + "_new.xml"))
            {
                reader.Load(filename + Globals.currentMap + ".xml");
            }
            else
            {
                reader.Load(filename + Globals.currentMap + "_new.xml");
            }

            if (!File.Exists(filename + Globals.currentMap + "_events_new.xml"))
            {
                overlayReader.Load(filename + Globals.currentMap + "_events.xml");
            }
            else
            {
                overlayReader.Load(filename + Globals.currentMap + "_events_new.xml");
            }

            XmlNodeList mapx       = reader.GetElementsByTagName("mapx");
            XmlNodeList mapy       = reader.GetElementsByTagName("mapy");
            XmlNodeList tileset    = reader.GetElementsByTagName("tileset");
            XmlNodeList overlayset = overlayReader.GetElementsByTagName("overlayset");

            mapSize = new Vector2(Convert.ToInt32(mapx[0].InnerText), Convert.ToInt32(mapy[0].InnerText));
            fillEmptyMap(mapSize);
            fillEmptyOverlayMap(mapSize);
            fillEmptyPerms(mapSize);
            fillEmptyOverlayPerms(mapSize);
            fillEmptyEvents(mapSize);
            fillEmptyThrows(mapSize);

            foreach (XmlNode i in tileset)
            {
                int x     = Convert.ToInt32(i.Attributes["x"].Value);
                int y     = Convert.ToInt32(i.Attributes["y"].Value);
                int tilex = Convert.ToInt32(i.SelectSingleNode("tilex").InnerText);
                int tiley = Convert.ToInt32(i.SelectSingleNode("tiley").InnerText);
                Globals.Permissions perm = (Globals.Permissions)Enum.Parse(typeof(Globals.Permissions), i.SelectSingleNode("perms").InnerText);

                Globals.map[y][x]         = new Vector2(tilex, tiley);
                Globals.permissions[y][x] = perm;
            }

            foreach (XmlNode i in overlayset)
            {
                int x     = Convert.ToInt32(i.Attributes["x"].Value);
                int y     = Convert.ToInt32(i.Attributes["y"].Value);
                int tilex = Convert.ToInt32(i.SelectSingleNode("tilex").InnerText);
                int tiley = Convert.ToInt32(i.SelectSingleNode("tiley").InnerText);
                Globals.Permissions perm = (Globals.Permissions)Enum.Parse(typeof(Globals.Permissions), i.SelectSingleNode("perms").InnerText);

                if (i.SelectSingleNode("enemies") != null)
                {
                    XmlNodeList        enemies = i.SelectSingleNode("enemies").ChildNodes;
                    string             src     = "Paul";
                    Globals.SpriteFace sprFace = Globals.SpriteFace.Down;
                    foreach (XmlAttribute j in i.SelectSingleNode("enemies").Attributes)
                    {
                        if (j.Name == "src")
                        {
                            src = j.Value;
                        }
                        if (j.Name == "facing")
                        {
                            sprFace = (Globals.SpriteFace)Enum.Parse(typeof(Globals.SpriteFace), j.Value);
                        }
                    }

                    for (int j = 0; j < enemies.Count; j++)
                    {
                        Globals.battleEnemyTypes type = (Globals.battleEnemyTypes)Enum.Parse(typeof(Globals.battleEnemyTypes), enemies[j].InnerText);
                        if (j == 0)
                        {
                            Globals.enemies.Add(new Enemy(src, new Vector2(x, y), sprFace, type));
                        }
                        else
                        {
                            Globals.enemies[Globals.enemies.Count - 1].addEnemy(type);
                        }
                    }
                }

                string evnt = i.SelectSingleNode("event").InnerText;
                foreach (XmlAttribute j in i.SelectSingleNode("event").Attributes)
                {
                    if (j.Name == "throw")
                    {
                        Globals.eventThrows[y][x] = (Globals.EventThrow)Enum.Parse(typeof(Globals.EventThrow), j.Value);
                    }
                }
                Globals.overlayMap[y][x]   = new Vector2(tilex, tiley);
                Globals.overlayPerms[y][x] = perm;
                if (evnt != "nil")
                {
                    Globals.events[y][x] = evnt;
                }
            }
        }
示例#4
0
        public static void modMapEnemy(string mapName, Vector2 pos, string src, Globals.SpriteFace sprFace, List <Globals.battleEnemyTypes> types)
        {
            XmlDocument doc      = new XmlDocument();
            string      filename = "Maps/" + mapName;

            if (Globals.fileOpen)
            {
                filename = "Saves/" + Globals.slotOpen + "/" + filename;
            }
            filename += "_events";
            if (!File.Exists(filename + "_new.xml"))
            {
                FileInfo fi = new FileInfo(filename + ".xml");
                fi.CopyTo(filename + "_new.xml");
            }
            filename += "_new";
            doc.Load(filename + ".xml");

            XmlNodeList docset;

            docset = doc.GetElementsByTagName("overlayset");

            bool xFound, yFound;

            foreach (XmlNode i in docset)
            {
                xFound = false;
                yFound = false;
                foreach (XmlAttribute j in i.Attributes)
                {
                    if (j.Name == "x" && j.Value == Convert.ToInt32(pos.X).ToString())
                    {
                        xFound = true;
                    }
                    if (j.Name == "y" && j.Value == Convert.ToInt32(pos.Y).ToString())
                    {
                        yFound = true;
                    }
                }
                if (xFound && yFound)
                {
                    if (i.SelectSingleNode("enemies") != null)
                    {
                        i.RemoveChild(i.SelectSingleNode("enemies"));
                    }
                    XmlNode newenemy = doc.CreateElement("enemies");

                    XmlAttribute newAttr = doc.CreateAttribute("src");
                    newAttr.Value = src;
                    newenemy.Attributes.Append(newAttr);

                    newAttr       = doc.CreateAttribute("facing");
                    newAttr.Value = sprFace.ToString();
                    newenemy.Attributes.Append(newAttr);

                    foreach (Globals.battleEnemyTypes type in types)
                    {
                        XmlNode childenemy = doc.CreateElement("enemy");
                        childenemy.InnerText = type.ToString();
                        newenemy.AppendChild(childenemy);
                    }
                    i.AppendChild(newenemy);
                }
            }

            doc.Save(filename + ".xml");
        }
示例#5
0
        public bool Parse(string script)
        {
            if (!Globals.sleep)
            {
                if (eoe)                         // Previous event ended, or none have started, read new event
                {
                    reader = new XmlDocument();
                    string filename = "Maps/" + script + ".xml";
                    if (Globals.fileOpen)
                    {
                        filename = "Saves/" + Globals.slotOpen + "/" + filename;
                    }
                    reader.Load(filename);
                    commands = reader.GetElementsByTagName("root");
                    t        = commands[0].FirstChild;

                    eoe  = false;
                    line = "";

                    Globals.fade = new Fade();

                    Globals.sleep = false;
                }

                if (advance)                    // Ready to advance, parse next line
                {
                    advance = false;
                    if (tStack.Count == 0 && commands[0].LastChild != t)
                    {
                        t = t.NextSibling;
                    }
                    else if (tStack.Count > 0 && tStack.Peek().LastChild != t)
                    {
                        t = t.NextSibling;
                    }
                    else if (tStack.Count > 0)
                    {
                        while (tStack.Count > 0 && tStack.Peek().LastChild == t)
                        {
                            t = tStack.Pop();
                        }
                        if (commands[0].LastChild == t)
                        {
                            eoe           = true;
                            Globals.pause = false;
                            return(false);
                        }
                        t = t.NextSibling;
                    }
                    else
                    {
                        eoe           = true;
                        Globals.pause = false;
                        return(false);
                    }

                    if (t.Name == "fadefrom")
                    {
                        Globals.fade.level = 1f;
                    }
                }
            }

            Globals.pause = false;

            if (t.Name == "if")
            {
                bool stack = true;

                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "has" && Globals.keyItems.ContainsKey(t.Attributes[i].Value) && !Globals.keyItems[t.Attributes[i].Value])
                    {
                        stack = false;
                    }
                    if (t.Attributes[i].Name == "flagged" && Globals.flags.ContainsKey(t.Attributes[i].Value) && !Globals.flags[t.Attributes[i].Value])
                    {
                        stack = false;
                    }
                }

                if (stack)
                {
                    tStack.Push(t);
                    t = t.FirstChild;
                }
            }
            if (t.Name == "nif")
            {
                bool stack = true;

                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "has" && Globals.keyItems.ContainsKey(t.Attributes[i].Value) && Globals.keyItems[t.Attributes[i].Value])
                    {
                        stack = false;
                    }
                    if (t.Attributes[i].Name == "flagged" && Globals.flags.ContainsKey(t.Attributes[i].Value) && Globals.flags[t.Attributes[i].Value])
                    {
                        stack = false;
                    }
                }

                if (stack)
                {
                    tStack.Push(t);
                    t = t.FirstChild;
                }
            }
            if (t.Name == "cutscene")
            {
                profile   = Globals.Content.Load <Texture2D>("Assets/full/" + Globals.currentPlayer);
                profileTo = Globals.Content.Load <Texture2D>("Assets/full/" + Globals.currentPlayer);
                speaker   = Globals.currentPlayer;
                ifTo      = false;
                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "speaker" && t.Attributes[i].Value != "this")
                    {
                        speaker = t.Attributes[i].Value;
                    }
                    if (t.Attributes[i].Name == "from" && t.Attributes[i].Value != "this")
                    {
                        profile = Globals.Content.Load <Texture2D>("Assets/full/" + t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "to")
                    {
                        ifTo = true;
                        if (t.Attributes[i].Value != "this")
                        {
                            profileTo = Globals.Content.Load <Texture2D>("Assets/full/" + t.Attributes[i].Value);
                        }
                    }
                    if (t.Attributes[i].Name == "audio")
                    {
                        dialogue = Globals.Content.Load <SoundEffect>("Audio/" + t.Attributes[i].Value);
                        lineInst = dialogue.CreateInstance();
                        lineInst.Stop();
                        lineInst.Play();
                    }
                }
                line          = t.InnerText;
                Globals.pause = true;
            }
            if (t.Name == "message")
            {
                profile = Globals.Content.Load <Texture2D>("Assets/pixel");
                speaker = "";
                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "from")
                    {
                        if (t.Attributes[i].Value != "this")
                        {
                            profile = Globals.Content.Load <Texture2D>("Assets/message/" + t.Attributes[i].Value);
                            speaker = t.Attributes[i].Value;
                        }
                        else
                        {
                            profile = Globals.Content.Load <Texture2D>("Assets/message/" + Globals.currentPlayer);
                            speaker = Globals.currentPlayer;
                        }
                    }
                }
                line          = t.InnerText;
                Globals.pause = true;
            }
            if (t.Name == "give")
            {
                if (Globals.keyItems.ContainsKey(t.InnerText))
                {
                    Globals.keyItems[t.InnerText] = !Globals.keyItems[t.InnerText];
                }
            }
            if (t.Name == "flag")
            {
                if (Globals.flags.ContainsKey(t.InnerText))
                {
                    Globals.flags[t.InnerText] = !Globals.flags[t.InnerText];
                }
            }
            if (t.Name == "warp")
            {
                Vector2 startPos = new Vector2();
                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "x")
                    {
                        startPos.X = Convert.ToInt32(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "y")
                    {
                        startPos.Y = Convert.ToInt32(t.Attributes[i].Value);
                    }
                }
                Map.changeMap(t.InnerText, startPos);
            }
            if (t.Name == "fadeto")
            {
                if (t.InnerText != "nil")
                {
                    Globals.fade.delay = Convert.ToInt32(t.InnerText);
                }
                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "r")
                    {
                        Globals.fade.color.R = Convert.ToByte(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "g")
                    {
                        Globals.fade.color.G = Convert.ToByte(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "b")
                    {
                        Globals.fade.color.B = Convert.ToByte(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "step")
                    {
                        Globals.fade.step = (float)double.Parse(t.Attributes[i].Value);
                    }
                }
                Globals.sleep = true;

                Globals.timer.Start();
                if (Globals.timer.ElapsedMilliseconds >= Globals.fade.delay)
                {
                    Globals.fade.stepUp();
                    Globals.timer.Restart();
                    if (Globals.fade.level >= 1.0f)
                    {
                        Globals.fade.level = 1.0f;
                        Globals.sleep      = false;
                        Globals.timer.Reset();
                    }
                }
            }
            if (t.Name == "fadefrom")
            {
                if (t.InnerText != "nil")
                {
                    Globals.fade.delay = Convert.ToInt32(t.InnerText);
                }
                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "r")
                    {
                        Globals.fade.color.R = Convert.ToByte(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "g")
                    {
                        Globals.fade.color.G = Convert.ToByte(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "b")
                    {
                        Globals.fade.color.B = Convert.ToByte(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "step")
                    {
                        Globals.fade.step = (float)double.Parse(t.Attributes[i].Value);
                    }
                }
                Globals.sleep = true;

                Globals.timer.Start();
                if (Globals.timer.ElapsedMilliseconds >= Globals.fade.delay)
                {
                    Globals.fade.stepDown();
                    Globals.timer.Restart();
                    if (Globals.fade.level <= 0f)
                    {
                        Globals.fade.level = 0f;
                        Globals.sleep      = false;
                        Globals.timer.Reset();
                    }
                }
            }
            if (t.Name == "shove")
            {
                if (t.InnerText == "up")
                {
                    Globals.spriteFace = Globals.SpriteFace.Up;
                    Globals.step       = Globals.spriteSrcUp.Count;
                    Globals.moving     = true;
                    Globals.timer.Start();
                }
                if (t.InnerText == "down")
                {
                    Globals.spriteFace = Globals.SpriteFace.Down;
                    Globals.step       = Globals.spriteSrcDown.Count;
                    Globals.moving     = true;
                    Globals.timer.Start();
                }
                if (t.InnerText == "left")
                {
                    Globals.spriteFace = Globals.SpriteFace.Left;
                    Globals.step       = Globals.spriteSrcLeft.Count;
                    Globals.moving     = true;
                    Globals.timer.Start();
                }
                if (t.InnerText == "right")
                {
                    Globals.spriteFace = Globals.SpriteFace.Right;
                    Globals.step       = Globals.spriteSrcRight.Count;
                    Globals.moving     = true;
                    Globals.timer.Start();
                }
            }
            if (t.Name == "retile")
            {
                string  mapName = Globals.currentMap;
                Vector2 pos     = Vector2.Zero;
                Vector2 newset  = Vector2.Zero;
                bool    overlay = false;
                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "x")
                    {
                        pos.X = Convert.ToInt32(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "y")
                    {
                        pos.Y = Convert.ToInt32(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "overlay" && t.Attributes[i].Value == "yes")
                    {
                        overlay = true;
                    }
                    if (t.Attributes[i].Name == "newx")
                    {
                        newset.X = Convert.ToInt32(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "newy")
                    {
                        newset.Y = Convert.ToInt32(t.Attributes[i].Value);
                    }
                }
                if (t.InnerText != "this")
                {
                    mapName = t.InnerText;
                }

                Map.modMapTile(mapName, pos, newset, overlay);

                if (mapName == Globals.currentMap && !overlay)
                {
                    Globals.map[Convert.ToInt32(pos.Y)][Convert.ToInt32(pos.X)] = newset;
                }
                else if (mapName == Globals.currentMap && overlay)
                {
                    Globals.overlayMap[Convert.ToInt32(pos.Y)][Convert.ToInt32(pos.X)] = newset;
                }
            }
            if (t.Name == "reperm")
            {
                string              mapName = Globals.currentMap;
                Vector2             pos     = Vector2.Zero;
                Globals.Permissions newperm = Globals.Permissions.Open;
                bool overlay = false;
                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "x")
                    {
                        pos.X = Convert.ToInt32(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "y")
                    {
                        pos.Y = Convert.ToInt32(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "overlay" && t.Attributes[i].Value == "yes")
                    {
                        overlay = true;
                    }
                    if (t.Attributes[i].Name == "perm")
                    {
                        newperm = (Globals.Permissions)Enum.Parse(typeof(Globals.Permissions), t.Attributes[i].Value);
                    }
                }
                if (t.InnerText != "this")
                {
                    mapName = t.InnerText;
                }

                Map.modMapPerm(mapName, pos, newperm, overlay);

                if (mapName == Globals.currentMap && !overlay)
                {
                    Globals.permissions[Convert.ToInt32(pos.Y)][Convert.ToInt32(pos.X)] = newperm;
                }
                else if (mapName == Globals.currentMap && overlay)
                {
                    Globals.overlayPerms[Convert.ToInt32(pos.Y)][Convert.ToInt32(pos.X)] = newperm;
                }
            }
            if (t.Name == "reevent")
            {
                string  mapName     = Globals.currentMap;
                Vector2 pos         = Vector2.Zero;
                string  thrower     = "None";
                string  eventscript = "nil";
                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "x")
                    {
                        pos.X = Convert.ToInt32(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "y")
                    {
                        pos.Y = Convert.ToInt32(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "throw")
                    {
                        thrower = t.Attributes[i].Value;
                    }
                    if (t.Attributes[i].Name == "script")
                    {
                        eventscript = t.Attributes[i].Value;
                    }
                }
                if (t.InnerText != "this")
                {
                    mapName = t.InnerText;
                }

                Map.modMapEvent(mapName, pos, thrower, eventscript);

                if (mapName == Globals.currentMap)
                {
                    Globals.eventThrows[Convert.ToInt32(pos.Y)][Convert.ToInt32(pos.X)] = (Globals.EventThrow)Enum.Parse(typeof(Globals.EventThrow), thrower);
                    Globals.events[Convert.ToInt32(pos.Y)][Convert.ToInt32(pos.X)]      = eventscript;
                }
            }
            if (t.Name == "reenemy")
            {
                string             mapName            = Globals.currentMap;
                Vector2            pos                = Vector2.Zero;
                string             src                = "Paul";
                Globals.SpriteFace facing             = Globals.SpriteFace.Down;
                List <Globals.battleEnemyTypes> types = new List <Globals.battleEnemyTypes>();
                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "x")
                    {
                        pos.X = Convert.ToInt32(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "y")
                    {
                        pos.Y = Convert.ToInt32(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "src")
                    {
                        src = t.Attributes[i].Value;
                    }
                    if (t.Attributes[i].Name == "facing")
                    {
                        facing = (Globals.SpriteFace)Enum.Parse(typeof(Globals.SpriteFace), t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "map" && t.Attributes[i].Value != "this")
                    {
                        mapName = t.Attributes[i].Value;
                    }
                }
                for (int i = 0; i < t.ChildNodes.Count; i++)
                {
                    types.Add((Globals.battleEnemyTypes)Enum.Parse(typeof(Globals.battleEnemyTypes), t.ChildNodes[i].InnerText));
                }

                Map.modMapEnemy(mapName, pos, src, facing, types);
            }
            if (t.Name == "remenemy")
            {
                string  mapName = Globals.currentMap;
                Vector2 pos     = Vector2.Zero;
                for (int i = 0; i < t.Attributes.Count; i++)
                {
                    if (t.Attributes[i].Name == "x")
                    {
                        pos.X = Convert.ToInt32(t.Attributes[i].Value);
                    }
                    if (t.Attributes[i].Name == "y")
                    {
                        pos.Y = Convert.ToInt32(t.Attributes[i].Value);
                    }
                }
                if (t.InnerText != "this")
                {
                    mapName = t.InnerText;
                }

                Map.modMapEnemy(mapName, pos);
            }

            advance = true;
            return(true);
        }