Exemple #1
0
 public MapBackground GetMapBackground()
 {
     if (maps.Contains((String)MapsList.SelectedItem))
     {
         return((MapBackground)maps[(String)MapsList.SelectedItem]);
     }
     else
     {
         IMGEntry entry = MapEditor.file.Directory.GetIMG("Map/" + (String)MapsList.SelectedItem);
         if (entry == null)
         {
             maps.Add((String)MapsList.SelectedItem, null);
             return(null);
         }
         else
         {
             MapBackground bg = new MapBackground();
             MapBackground.Object = entry;
             lock (MapEditor.MapLock)
                 bg.Load();
             maps.Add((String)MapsList.SelectedItem, bg);
             return(bg);
         }
     }
 }
Exemple #2
0
        public static void SwapInt(IMGEntry e1, IMGEntry e2)
        {
            int temp = e1.GetInt();

            e1.SetInt(e2.GetInt());
            e2.SetInt(temp);
        }
Exemple #3
0
 public MaplePyhsics(IMGEntry physics, int x, int y)
 {
     this.physics = physics;
     this.x       = x;
     this.y       = y;
     new Thread(new ThreadStart(UpdateThread)).Start();
 }
        public void Load()
        {
            IMGEntry back = Object.GetChild("back");

            if (back == null)
            {
                return;
            }

            foreach (IMGEntry b in back.childs.Values)
            {
                if (b.GetInt("ani") != 1 && b.GetString("bS") != "")
                {
                    MapBack mb = new MapBack();

                    mb.Object = b;
                    mb.Image  = MapEditor.file.Directory.GetIMG("Back/" + b.GetString("bS") + ".img").GetChild("back/" + b.GetInt("no").ToString());
                    mb.ID     = int.Parse(b.Name);

                    backs.Add(mb);
                }
            }

            backs = backs.OrderBy(o => o.ID).ToList <MapBack>();

            Bitmap = new Bitmap(800, 600);
            using (Graphics g = Graphics.FromImage(Bitmap))
            {
                foreach (MapBack b in backs)
                {
                    b.Draw(g);
                }
            }
        }
Exemple #5
0
        public void GenerateFrames()
        {
            if (Image.GetChild("delay") == null)
            {
                return;
            }
            frames = new List <MapObjectFrame>();
            IMGEntry originalImage = Image.parent;

            foreach (IMGEntry frame in originalImage.childs.Values)
            {
                MapObjectFrame f = new MapObjectFrame();
                try
                {
                    f.ID = int.Parse(frame.Name);
                }
                catch
                {
                    continue; // to handle:"blend"
                }
                f.Image  = Map.GetRealImage(frame);
                f.Object = Object;

                animationTime += f.Image.GetInt("delay");

                frames.Add(f);
            }
            frames = frames.OrderBy(x => x.ID).ToList <MapObjectFrame>();
        }
Exemple #6
0
 private static bool IsPadded(IMGEntry entry, int startID)
 {
     for (int i = startID; i < entry.childs.Count + startID; i++)
     {
         if (!entry.childs.Contains(i.ToString()))
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #7
0
 public static IMGEntry GetRealImage(IMGEntry entry)
 {
     if (entry.value.type == WZObject.WZObjectType.WZ_CANVAS)
     {
         return(entry);
     }
     else if (entry.value.type == WZObject.WZObjectType.WZ_UOL)
     {
         return(GetRealImage(entry.parent.GetChild(((WZUOL)entry.value).path)));
     }
     return(null);
 }
Exemple #8
0
        public void Add(MapItem item)
        {
            if (item is MapObject)
            {
                MapObject o  = (MapObject)item;
                int       id = 0;
                while (layer.GetChild("obj").childs.Contains(id.ToString()))
                {
                    id++;
                }
                o.ID          = id;
                o.Object.Name = o.ID.ToString();
                objects.Add(o);
                objects.Sort(Map.CompareItems);
                layer.GetChild("obj").Add(o.Object);
                OrderObjects();
            }
            else if (item is MapTile)
            {
                MapTile t = (MapTile)item;

                string style = info.GetString("tS");

                IMGFile tilesF = MapEditor.file.Directory.GetIMG("Tile/" + style + ".img");

                if (tilesF.GetChild(t.Object.GetString("u") + "/" + t.Object.GetInt("no").ToString()) == null)
                {
                    t.Object.SetInt("no", MapEditor.Instance.random.Next(tilesF.GetChild(t.Object.GetString("u")).childs.Count));
                }
                IMGEntry image = MapEditor.file.Directory.GetIMG("Tile/" + style + ".img").GetChild(t.Object.GetString("u") + "/" + t.Object.GetInt("no").ToString());
                if (t.Image != image)
                {
                    t.Image = image;
                }

                int id = 0;
                while (layer.GetChild("tile").childs.Contains(id.ToString()))
                {
                    id++;
                }
                t.ID          = id;
                t.Object.Name = t.ID.ToString();
                tiles.Add(t);
                tiles.Sort(Map.CompareItems);
                layer.GetChild("tile").Add(t.Object);
                OrderTiles();
            }
            else
            {
                Map.Instance.Add(item);
            }
        }
Exemple #9
0
        public MapMarkSelect()
        {
            InitializeComponent();

            IMGEntry Marks = MapEditor.file.Directory.GetIMG("MapHelper.img").GetChild("mark");

            foreach (IMGEntry mark in Marks.childs.Values)
            {
                ImageViewer imageViewer = Panel.Add(mark.GetCanvas().GetBitmap(), mark.Name, false);
                imageViewer.MouseClick       += new MouseEventHandler(ImageViewer_MouseClick);
                imageViewer.MouseDoubleClick += new MouseEventHandler(ImageViewer_MouseDoubleClick);
            }
        }
Exemple #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofdOpen = new OpenFileDialog();

            ofdOpen.Filter = "Mark|*.png";
            if (ofdOpen.ShowDialog() != DialogResult.Cancel)
            {
                string FileName  = ofdOpen.FileName;
                string ImageName = Path.GetFileNameWithoutExtension(FileName);
                foreach (ImageViewer iv in Panel.Controls)
                {
                    if (iv.Name == ImageName)
                    {
                        Error.Text = "Error: There is already a mark with this name.";
                        return;
                    }
                }
                Image i = Bitmap.FromFile(FileName);
                if (i.Width > 38 || i.Height > 38)
                {
                    Error.Text = "Error: The size of the image must not be larger than 38x38";
                    return;
                }
                IMGEntry marks = MapEditor.file.Directory.GetIMG("MapHelper.img").GetChild("mark");
                IMGEntry entry = new IMGEntry();

                WZCanvas c = new WZCanvas();
                c.SetBitmap((Bitmap)i);
                c.format = WZCanvas.ImageFormat.FORMAT_4444;
                entry.SetCanvas(c);
                entry.Name = ImageName;

                marks.Add(entry);

                marks.parent.ToSave = true;
                Error.Text          = "";
                ImageViewer imageViewer = new ImageViewer();
                imageViewer.Dock = DockStyle.Bottom;

                imageViewer.Image             = c.GetBitmap();
                imageViewer.Width             = c.GetBitmap().Width + 6;
                imageViewer.Height            = c.GetBitmap().Height + 6;
                imageViewer.Name              = entry.Name;
                imageViewer.MouseClick       += new MouseEventHandler(ImageViewer_MouseClick);
                imageViewer.MouseDoubleClick += new MouseEventHandler(ImageViewer_MouseDoubleClick);
                imageViewer.IsThumbnail       = false;

                Panel.Controls.Add(imageViewer);
            }
        }
Exemple #11
0
        public void CreateFootholdDesignList()
        {
            IMGEntry entry = Image.GetChild("foothold");

            if (entry != null)
            {
                foreach (IMGEntry e in entry.childs.Values)
                {
                    MapFootholdDesign fh = new MapFootholdDesign();
                    fh.Object = Object;
                    fh.Image  = e;
                    Footholds.Add(fh);
                }
            }
        }
Exemple #12
0
        public void GenerateFrames()
        {
            frames = new List <MapBackFrame>();
            IMGEntry originalImage = Image.parent;

            foreach (IMGEntry frame in originalImage.childs.Values)
            {
                MapBackFrame f = new MapBackFrame();
                f.ID     = int.Parse(frame.Name);
                f.Image  = Map.GetRealImage(frame);
                f.Object = Object;

                animationTime += f.Image.GetInt("delay");

                frames.Add(f);
            }
            frames = frames.OrderBy(x => x.ID).ToList <MapBackFrame>();
        }
Exemple #13
0
 public static void Pad(IMGEntry entry, MapItem[] items, int startID)
 {
     while (!IsPadded(entry, startID))
     {
         foreach (IMGEntry e in entry.childs.Values)
         {
             int ID = int.Parse(e.Name);
             if (ID > startID)
             {
                 if (!entry.childs.Contains((ID - 1).ToString()))
                 {
                     e.Rename((ID - 1).ToString());
                     break;
                 }
             }
         }
     }
     UpdateMapItems(items);
 }
Exemple #14
0
        public Map(IMGEntry map)
        {
            Instance = this;

            MapEditor.Instance.EditBack.Enabled = false;

            this.map = map;

            IMGEntry Info    = map.GetChild("info");
            IMGEntry MiniMap = map.GetChild("miniMap");

            if (Info.GetChild("VRTop") != null)
            {
                VRLeft   = Info.GetInt("VRLeft");
                VRTop    = Info.GetInt("VRTop");
                VRRight  = Info.GetInt("VRRight");
                VRBottom = Info.GetInt("VRBottom");
            }
            if (MiniMap == null)
            {
                if (VRTop == 0)
                {
                    throw new Exception("Unhandled Map");
                }
                CenterX = -VRLeft + 50;
                CenterY = -VRTop + 50;
                Width   = VRRight + CenterX + 100;
                Height  = VRBottom + CenterY + 100;
            }
            else
            {
                CenterX = MiniMap.GetInt("centerX");
                CenterY = MiniMap.GetInt("centerY");
                Width   = MiniMap.GetInt("width");
                Height  = MiniMap.GetInt("height");
                if (VRTop == 0)
                {
                    VRLeft   = -CenterX + 69;
                    VRTop    = -CenterY + 86;
                    VRRight  = Width - CenterX - 69;
                    VRBottom = Height - CenterY - 86;
                }
            }

            fly = Info.GetBool("swim") ? -1 : 1;

            int maxX = Int32.MinValue;
            int maxY = Int32.MinValue;
            int minX = Int32.MaxValue;
            int minY = Int32.MaxValue;

            for (int i = 0; i < 8; i++)
            {
                MapLayer layer = new MapLayer();

                IMGEntry layerEntry = map.GetChild(i.ToString());

                layer.layer = layerEntry;
                layer.info  = layerEntry.GetChild("info");
                layer.ID    = i;

                IMGEntry objects = layerEntry.GetChild("obj");
                foreach (IMGEntry o in objects.childs.Values)
                {
                    MapObject mo = new MapObject();

                    mo.Object = o;
                    mo.Image  = GetRealImage(MapEditor.file.Directory.GetIMG("Obj/" + o.GetString("oS") + ".img").GetChild(o.GetString("l0") + "/" + o.GetString("l1") + "/" + o.GetString("l2") + "/0"));
                    mo.ID     = int.Parse(o.Name);

                    mo.CreateFootholdDesignList();

                    footholdsGroups.Add(o.GetInt("zM"));

                    layer.objects.Add(mo);
                }

                layer.objects.Sort(CompareItems);

                layer.OrderObjects();

                IMGEntry tiles = layerEntry.GetChild("tile");
                foreach (IMGEntry t in tiles.childs.Values)
                {
                    MapTile mt = new MapTile();

                    mt.Object = t;
                    mt.Image  = MapEditor.file.Directory.GetIMG("Tile/" + layer.info.GetString("tS") + ".img").GetChild(t.GetString("u") + "/" + t.GetInt("no").ToString());
                    //mt.Image = MapEditor.file.Directory.GetIMG("Tile/blackTile.img").GetChild(t.GetString("u") + "/0");
                    mt.ID = int.Parse(t.Name);

                    mt.SetDesign(t.GetString("u"));

                    mt.CreateFootholdDesignList();

                    footholdsGroups.Add(t.GetInt("zM"));

                    layer.tiles.Add(mt);
                }

                layer.tiles.Sort(CompareItems);

                layer.OrderTiles();

                IMGEntry footholds = map.GetChild("foothold/" + i.ToString());
                if (footholds != null)
                {
                    foreach (IMGEntry group in footholds.childs.Values)
                    {
                        //if (group.Name != "3") continue;
                        MapFootholds f = new MapFootholds(int.Parse(group.Name));

                        f.Object = group;

                        layer.footholdGroups.Add(f.ID, f);

                        foreach (IMGEntry fhe in group.childs.Values)
                        {
                            MapFoothold fh = new MapFoothold(int.Parse(fhe.Name));

                            fh.Object      = fhe;
                            fh.Group       = f;
                            fh.s1          = new MapFootholdSide();
                            fh.s2          = new MapFootholdSide();
                            fh.s1.Object   = fhe;
                            fh.s2.Object   = fhe;
                            fh.s1.ID       = 1;
                            fh.s2.ID       = 2;
                            fh.s1.Foothold = fh;
                            fh.s2.Foothold = fh;

                            if (fhe.GetInt("x1") < minX)
                            {
                                minX = fhe.GetInt("x1");
                            }
                            if (fhe.GetInt("y1") < minY)
                            {
                                minY = fhe.GetInt("y1");
                            }
                            if (fhe.GetInt("x2") < minX)
                            {
                                minX = fhe.GetInt("x2");
                            }
                            if (fhe.GetInt("y2") < minY)
                            {
                                minY = fhe.GetInt("y2");
                            }
                            if (fhe.GetInt("x1") > maxX)
                            {
                                maxX = fhe.GetInt("x1");
                            }
                            if (fhe.GetInt("y1") > maxY)
                            {
                                maxY = fhe.GetInt("y1");
                            }
                            if (fhe.GetInt("x2") > maxX)
                            {
                                maxX = fhe.GetInt("x2");
                            }
                            if (fhe.GetInt("y2") > maxY)
                            {
                                maxY = fhe.GetInt("y2");
                            }

                            f.footholds.Add(fh.ID, fh);
                        }
                    }
                }


                layers.Add(layer);
            }

            /*if (VRTop == 0)
             * {
             *  if (maxX != Int32.MinValue)
             *  {
             *      VRLeft = minX + 30;
             *      VRRight = maxX - 30;
             *      VRTop = minY - 300;
             *      VRBottom = maxY + 10;
             *  }
             * }*/
            left   = minX + 30;
            right  = maxX - 30;
            top    = minY - 300;
            bottom = maxY + 10;
            if (Info.GetChild("VRLeft") != null)
            {
                if (left < Info.GetInt("VRLeft") + 20)
                {
                    left = Info.GetInt("VRLeft") + 20;
                }
                if (right > Info.GetInt("VRRight"))
                {
                    right = Info.GetInt("VRRight");
                }
                if (top < Info.GetInt("VRTop") + 65)
                {
                    top = Info.GetInt("VRTop") + 65;
                }
                if (bottom > Info.GetInt("VRBottom"))
                {
                    bottom = Info.GetInt("VRBottom");
                }
            }
            left   -= 10;
            right  += 10;
            top    -= 10;
            bottom += 10;

            IMGEntry back = map.GetChild("back");

            foreach (IMGEntry b in back.childs.Values)
            {
                if (b.GetString("bS") != "")
                {
                    MapBack mb = new MapBack();

                    mb.Object = b;
                    if (b.GetInt("ani") == 0)
                    {
                        mb.Image = MapEditor.file.Directory.GetIMG("Back/" + b.GetString("bS") + ".img").GetChild("back/" + b.GetInt("no").ToString());
                    }
                    else
                    {
                        mb.Image = MapEditor.file.Directory.GetIMG("Back/" + b.GetString("bS") + ".img").GetChild("ani/" + b.GetInt("no").ToString() + "/0");
                    }
                    mb.ID = int.Parse(b.Name);

                    if (b.GetInt("ani") == 1)
                    {
                        mb.GenerateFrames();
                    }

                    backs.Add(mb);
                }
            }

            backs = backs.OrderBy(o => o.ID).ToList <MapBack>();

            IMGEntry elr = map.GetChild("ladderRope");

            if (elr != null)
            {
                foreach (IMGEntry lr in elr.childs.Values)
                {
                    MapLR mlr = new MapLR();

                    mlr.Object    = lr;
                    mlr.ID        = int.Parse(lr.Name);
                    mlr.s1        = new MapLRSide();
                    mlr.s2        = new MapLRSide();
                    mlr.s1.Object = lr;
                    mlr.s2.Object = lr;
                    mlr.s1.ID     = 1;
                    mlr.s2.ID     = 2;
                    mlr.s1.LR     = mlr;
                    mlr.s2.LR     = mlr;

                    lrs.Add(mlr);
                }
            }

            lrs = lrs.OrderBy(l => l.ID).ToList <MapLR>();

            IMGEntry eseats = map.GetChild("seat");

            if (eseats != null)
            {
                foreach (IMGEntry s in eseats.childs.Values)
                {
                    MapSeat ms = new MapSeat();

                    ms.Object = s;
                    ms.ID     = int.Parse(s.Name);

                    seats.Add(ms);
                }
            }

            seats = seats.OrderBy(l => l.ID).ToList <MapSeat>();


            IMGEntry eLifes = map.GetChild("life");

            if (eLifes != null)
            {
                foreach (IMGEntry l in eLifes.childs.Values)
                {
                    MapLife ml;
                    if (l.GetString("type") == "n")
                    {
                        ml = new MapNPC();
                    }
                    else
                    {
                        ml = new MapMob();
                    }

                    ml.Object = l;

                    if (ml is MapNPC)
                    {
                        IMGFile npc = MapEditor.npc.Directory.GetIMG(l.GetString("id") + ".img");
                        if (npc.GetChild("info/link") != null)
                        {
                            npc = MapEditor.npc.Directory.GetIMG(npc.GetString("info/link") + ".img");
                        }
                        ml.Image = npc.GetChild("stand/0");
                    }
                    else
                    {
                        IMGFile mob = MapEditor.mob.Directory.GetIMG(l.GetString("id") + ".img");
                        if (mob.GetChild("info/link") != null)
                        {
                            mob = MapEditor.mob.Directory.GetIMG(mob.GetString("info/link") + ".img");
                        }
                        ml.Image = mob.GetChild("stand/0");
                        if (ml.Image == null)
                        {
                            ml.Image = mob.GetChild("fly/0");
                        }
                    }
                    ml.Image = GetRealImage(ml.Image);
                    ml.ID    = int.Parse(l.Name);

                    lifes.Add(ml);
                }
            }

            lifes = lifes.OrderBy(l => l.ID).ToList <MapLife>();

            IMGEntry eReactors = map.GetChild("reactor");

            if (eReactors != null)
            {
                foreach (IMGEntry r in eReactors.childs.Values)
                {
                    MapReactor mr = new MapReactor();
                    mr.Object = r;

                    IMGFile reactor = MapEditor.reactor.Directory.GetIMG(r.GetString("id") + ".img");
                    if (reactor.GetChild("info/link") != null)
                    {
                        reactor = MapEditor.reactor.Directory.GetIMG(reactor.GetString("info/link") + ".img");
                    }
                    mr.Image = reactor.GetChild("0/0");
                    mr.Image = GetRealImage(mr.Image);
                    mr.ID    = int.Parse(r.Name);

                    reactors.Add(mr);
                }
            }

            lifes = lifes.OrderBy(l => l.ID).ToList <MapLife>();

            IMGEntry pImage = MapEditor.file.Directory.GetIMG("MapHelper.img").GetChild("portal/game/pv/0");

            IMGEntry ePortals = map.GetChild("portal");

            if (ePortals != null)
            {
                foreach (IMGEntry p in ePortals.childs.Values)
                {
                    MapPortal mp = new MapPortal();

                    mp.Object = p;
                    mp.ID     = int.Parse(p.Name);
                    mp.Image  = pImage;

                    portals.Add(mp);
                }
            }

            seats = seats.OrderBy(l => l.ID).ToList <MapSeat>();

            IMGEntry tooltipsE = map.GetChild("ToolTip");

            if (tooltipsE != null)
            {
                foreach (IMGEntry tte in tooltipsE.childs.Values)
                {
                    if (tte.Name.Contains("char"))
                    {
                        continue;
                    }
                    MapToolTip tt = new MapToolTip();

                    tt.Object     = tte;
                    tt.ID         = int.Parse(tte.Name);
                    tt.Image      = MapEditor.stringf.Directory.GetIMG("ToolTipHelp.img").GetChild("Mapobject").GetChild(int.Parse(MapEditor.Instance.MapID).ToString()).GetChild(tte.Name);
                    tt.c1         = new MapToolTipCorner();
                    tt.c1.Object  = tte;
                    tt.c1.type    = MapToolTipCornerType.TopLeft;
                    tt.c1.ToolTip = tt;
                    tt.c2         = new MapToolTipCorner();
                    tt.c2.Object  = tte;
                    tt.c2.type    = MapToolTipCornerType.TopRight;
                    tt.c2.ToolTip = tt;
                    tt.c3         = new MapToolTipCorner();
                    tt.c3.Object  = tte;
                    tt.c3.type    = MapToolTipCornerType.BottomLeft;
                    tt.c3.ToolTip = tt;
                    tt.c4         = new MapToolTipCorner();
                    tt.c4.Object  = tte;
                    tt.c4.type    = MapToolTipCornerType.BottomRight;
                    tt.c4.ToolTip = tt;

                    tooltips.Add(tt);
                }
            }
            IMGEntry clockEntry = map.GetChild("clock");

            if (clockEntry != null)
            {
                clock = new MapClock();

                clock.Object = clockEntry;
                clock.Image  = MapEditor.file.Directory.GetIMG("Obj/etc.img").GetChild("clock/fontTime");
            }
        }
Exemple #15
0
 public void Add(MapItem item)
 {
     if (item is MapLife)
     {
         MapLife  l  = (MapLife)item;
         int      id = 0;
         IMGEntry le = map.GetChild("life");
         if (le == null)
         {
             le      = new IMGEntry();
             le.Name = "life";
             Map.Instance.map.Add(le);
         }
         while (le.childs.Contains(id.ToString()))
         {
             id++;
         }
         l.ID          = id;
         l.Object.Name = l.ID.ToString();
         lifes.Add(l);
         lifes.Sort(Map.CompareItems);
         le.Add(l.Object);
     }
     else if (item is MapReactor)
     {
         MapReactor r  = (MapReactor)item;
         int        id = 0;
         IMGEntry   re = map.GetChild("reactor");
         if (re == null)
         {
             re      = new IMGEntry();
             re.Name = "reactor";
             Map.Instance.map.Add(re);
         }
         while (re.childs.Contains(id.ToString()))
         {
             id++;
         }
         r.ID          = id;
         r.Object.Name = r.ID.ToString();
         reactors.Add(r);
         reactors.Sort(Map.CompareItems);
         re.Add(r.Object);
     }
     else if (item is MapLR)
     {
         MapLR    l    = (MapLR)item;
         int      id   = 1;
         IMGEntry lrse = map.GetChild("ladderRope");
         if (lrse == null)
         {
             lrse      = new IMGEntry();
             lrse.Name = "ladderRope";
             Map.Instance.map.Add(lrse);
         }
         while (lrse.childs.Contains(id.ToString()))
         {
             id++;
         }
         l.ID          = id;
         l.Object.Name = l.ID.ToString();
         lrs.Add(l);
         lrs.Sort(Map.CompareItems);
         lrse.Add(l.Object);
     }
     else if (item is MapSeat)
     {
         MapSeat  s     = (MapSeat)item;
         int      id    = 0;
         IMGEntry seate = map.GetChild("seat");
         if (seate == null)
         {
             seate      = new IMGEntry();
             seate.Name = "seat";
             Map.Instance.map.Add(seate);
         }
         while (seate.childs.Contains(id.ToString()))
         {
             id++;
         }
         s.ID          = id;
         s.Object.Name = s.ID.ToString();
         seats.Add(s);
         seats.Sort(Map.CompareItems);
         seate.Add(s.Object);
     }
     else if (item is MapPortal)
     {
         MapPortal p        = (MapPortal)item;
         int       id       = 0;
         IMGEntry  portalse = map.GetChild("portal");
         if (portalse == null)
         {
             portalse      = new IMGEntry();
             portalse.Name = "portal";
             Map.Instance.map.Add(portalse);
         }
         while (portalse.childs.Contains(id.ToString()))
         {
             id++;
         }
         p.ID          = id;
         p.Object.Name = p.ID.ToString();
         p.Image       = MapEditor.file.Directory.GetIMG("MapHelper.img").GetChild("portal/game/pv/0");
         portals.Add(p);
         portals.Sort(Map.CompareItems);
         portalse.Add(p.Object);
     }
     else if (item is MapToolTip)
     {
         MapToolTip t        = (MapToolTip)item;
         int        id       = 0;
         IMGEntry   ToolTips = map.GetChild("ToolTip");
         if (ToolTips == null)
         {
             ToolTips      = new IMGEntry();
             ToolTips.Name = "ToolTip";
             Map.Instance.map.Add(ToolTips);
         }
         while (ToolTips.childs.Contains(id.ToString()))
         {
             id++;
         }
         t.ID          = id;
         t.Object.Name = t.ID.ToString();
         tooltips.Add(t);
         tooltips.Sort(Map.CompareItems);
         ToolTips.Add(t.Object);
     }
     else if (item is MapClock)
     {
         if (clock == null)
         {
             clock             = item as MapClock;
             clock.Object.Name = "clock";
             clock.Image       = MapEditor.file.Directory.GetIMG("Obj/etc.img").GetChild("clock/fontTime");
             map.Add(clock.Object);
         }
     }
     else
     {
         layers[(int)MapEditor.Instance.Layer.Value].Add(item);
     }
 }
Exemple #16
0
 public static void Pad(IMGEntry entry, MapItem[] items)
 {
     Pad(entry, items, 0);
 }
Exemple #17
0
        public void CreateFootholdDesignList()
        {
            GenerateFrames();

            IMGEntry entry = Image.GetChild("foothold");

            if (entry != null)
            {
                List <MapFootholdDesign> list = new List <MapFootholdDesign>();
                for (int i = 0; i < entry.childs.Count; i++)
                {
                    if (entry.childs[i].value == null)
                    {
                        List <MapFootholdDesign> l = new List <MapFootholdDesign>();
                        for (int j = 0; j < entry.childs[i].childs.Count; j++)
                        {
                            MapFootholdDesign fh = new MapFootholdDesign();
                            fh.Object = Object;
                            fh.Image  = entry.childs[i].childs[j];
                            l.Add(fh);
                        }
                        Footholds.Add(l);
                    }
                    else
                    {
                        MapFootholdDesign fh = new MapFootholdDesign();
                        fh.Object = Object;
                        fh.Image  = entry.childs[i];
                        list.Add(fh);
                    }
                }
                if (list.Count > 0)
                {
                    Footholds.Add(list);
                }
            }
            entry = Image.GetChild("ladder");
            if (entry != null)
            {
                foreach (IMGEntry e in entry.childs.Values)
                {
                    MapLRDesign lr = new MapLRDesign(true);
                    lr.Object = Object;
                    lr.Image  = e;
                    LRs.Add(lr);
                }
            }
            entry = Image.GetChild("rope");
            if (entry != null)
            {
                foreach (IMGEntry e in entry.childs.Values)
                {
                    MapLRDesign lr = new MapLRDesign(false);
                    lr.Object = Object;
                    lr.Image  = e;
                    LRs.Add(lr);
                }
            }
            entry = Image.GetChild("..").GetChild("seat");
            if (entry != null)
            {
                foreach (IMGEntry e in entry.childs.Values)
                {
                    MapSeatDesign s = new MapSeatDesign();
                    s.Object = Object;
                    s.Image  = e;
                    Seats.Add(s);
                }
            }
        }
Exemple #18
0
        public GetMapInfo(IMGEntry info)
        {
            InitializeComponent();
            List <string> MusicNames = new List <string>();

            lock (MapEditor.SoundLock)
            {
                foreach (IMGFile bgms in MapEditor.sound.Directory.IMGs.Values)
                {
                    if (bgms.Name.Substring(0, 3) == "Bgm")
                    {
                        foreach (IMGEntry sound in bgms.childs.Values)
                        {
                            MusicNames.Add(bgms.Name + "/" + sound.Name);
                        }
                    }
                }
            }

            MusicNames.Sort();

            BGMsList.Items.AddRange(MusicNames.ToArray());

            BGMsList.SelectedItem = info.GetString("bgm").Replace("/", ".img/");
            int returnMap = info.GetInt("returnMap");

            if (returnMap == 999999999)
            {
                IsReturnMap.Checked = true;
                ReturnMap.Enabled   = false;
            }
            else
            {
                IsReturnMap.Checked = false;
                ReturnMap.Enabled   = true;
            }
            ReturnMap.Text    = returnMap.ToString();
            IsTown.Checked    = info.GetInt("town") == 1;
            IsSwim.Checked    = info.GetInt("swim") == 1;
            IsMiniMap.Checked = info.parent.GetChild("miniMap") != null;
            selectedMark      = info.GetString("mapMark");
            MarkPreview.Image = MapMarkSelect.GetMark(selectedMark);

            Bitmap background = new Bitmap(800, 600);

            using (Graphics g = Graphics.FromImage(background))
            {
                foreach (MapBack b in Map.Instance.backs)
                {
                    b.Draw(g);
                }
            }
            Bitmap thumb = new Bitmap(160, 120);

            using (Graphics g = Graphics.FromImage(thumb))
            {
                g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                g.DrawImage(background, 0, 0, 160, 120);
                g.Dispose();
            }

            BackgroundPreview.Image = thumb;
        }