Example #1
0
 internal bool IsFootholdBelow(double x, double y, int height, MapFoothold ofh)
 {
     foreach (MapLayer layer in layers)
     {
         foreach (MapFootholds group in layer.footholdGroups.Values)
         {
             foreach (MapFoothold fh in group.footholds.Values)
             {
                 if (fh == ofh || fh.m_x1 == fh.m_x2)
                 {
                     continue;
                 }
                 if (x >= fh.m_x1 && x <= fh.m_x2 && Math.Max(fh.m_y1, fh.m_y2) >= y && Math.Min(fh.m_y1, fh.m_y2) <= y + height)
                 {
                     double ty = ((x - fh.m_x1) * (fh.m_y2 - fh.m_y1) / (double)(fh.m_x2 - fh.m_x1) + fh.m_y1);
                     if (ty >= y && ty <= y + height)
                     {
                         return(true);
                     }
                 }
             }
         }
     }
     return(false);
 }
Example #2
0
        public override bool IsPointInArea(int x, int y)
        {
            if (Object.GetChild("script") != null)
            {
                return(false);
            }
            switch (Object.GetInt("pt"))
            {
            case 0:
            case 1:
            case 3:
            case 10: return(MapFoothold.Distance(x, y, Map.Instance.CenterX + Object.GetInt("x"), Map.Instance.CenterY + Object.GetInt("y")) <= 5);

            case 2:
            {
                int topLeftX = Map.Instance.CenterX + Object.GetInt("x") - Image.GetVector("origin").x;
                int topLeftY = Map.Instance.CenterY + Object.GetInt("y") - Image.GetVector("origin").y;
                int width    = Image.GetCanvas().width;
                int height   = Image.GetCanvas().height;
                if (x >= topLeftX && x < topLeftX + width && y >= topLeftY && y < topLeftY + height)
                {
                    return(Image.GetCanvas().GetBitmap().GetPixel(x - topLeftX, y - topLeftY).A > 0);
                }
                return(false);
            }

            default: return(false);
            }
        }
Example #3
0
        public override bool IsPointInArea(int x, int y)
        {
            int    cX       = Map.Instance.CenterX;
            int    cY       = Map.Instance.CenterY;
            double distance = MapFoothold.DistanceBetweenPointToLine(x, y, cX + Object.GetInt("x"), cY + Object.GetInt("y1"), cX + Object.GetInt("x"), cY + Object.GetInt("y2"));

            return(distance <= 5);
        }
Example #4
0
 public MapFoothold GetFootholdAt(int x, int y)
 {
     foreach (MapFootholds f in footholdGroups.Values)
     {
         MapFoothold fh = f.GetFootholdAt(x, y);
         if (fh != null)
         {
             return(fh);
         }
     }
     return(null);
 }
Example #5
0
        public override void Draw(DevicePanel d)
        {
            if (Object.GetChild("script") != null)
            {
                return;
            }
            int  type  = Object.GetInt("pt");
            bool arrow = ((type == 1 || type == 3 || type == 10) && Object.GetInt("tm") == int.Parse(MapEditor.Instance.MapID) && Map.Instance.GetPortal(Object.GetString("tn")) != null);

            int cx = Map.Instance.CenterX;
            int cy = Map.Instance.CenterY;

            switch (Object.GetInt("pt"))
            {
            case 0:
            case 1:
            case 10:
                d.DrawCircle(cx + Object.GetInt("x"), cy + Object.GetInt("y"), Color.FromArgb(Transparency, (Selected) ? Color.Blue : Color.RoyalBlue)); break;

            case 3:
                d.DrawCircle(cx + Object.GetInt("x"), cy + Object.GetInt("y"), Color.FromArgb(Transparency, (Selected) ? Color.Blue : Color.RoyalBlue));
                d.DrawEmptyCircle(cx + Object.GetInt("x"), cy + Object.GetInt("y"), Color.FromArgb(Transparency, (Selected) ? Color.Blue : Color.RoyalBlue)); break;

            case 2:
                d.DrawBitmap(Image.GetCanvas().GetTexture(d._device), cx + Object.GetInt("x") - Image.GetVector("origin").x, cy + Object.GetInt("y") - Image.GetVector("origin").y, Image.GetCanvas().width, Image.GetCanvas().height, Selected, (Transparency == 50) ? 100 : Transparency); break;
            }

            if (arrow)
            {
                MapPortal p  = Map.Instance.GetPortal(Object.GetString("tn"));
                int       x  = p.Object.GetInt("x");
                int       y  = p.Object.GetInt("y");
                double    di = MapFoothold.Distance(Object.GetInt("x"), Object.GetInt("y"), x, y);
                if (di != 0)
                {
                    double xp = (Object.GetInt("x") * 5 + x * (di - 5)) / di;
                    double yp = (Object.GetInt("y") * 5 + y * (di - 5)) / di;
                    d.DrawArrow(Object.GetInt("x") + cx, Object.GetInt("y") + cy, (int)xp + cx, (int)yp + cy, Color.FromArgb(Transparency, (Selected) ? Color.Blue : Color.RoyalBlue));
                }
            }
        }
Example #6
0
 public override bool IsPointInArea(int x, int y)
 {
     return(MapFoothold.Distance(x, y, GetX(), GetY()) <= 7);
 }
Example #7
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");
            }
        }
Example #8
0
 public override bool IsPointInArea(int x, int y)
 {
     return(MapFoothold.Distance(x, y, Map.Instance.CenterX + Object.GetInt("x"), Map.Instance.CenterY + Object.GetInt("y" + ID.ToString())) <= 5);
 }
Example #9
0
 public static double DistanceBetweenPointToLine(Point p, Point p1, Point p2)
 {
     return(MapFoothold.DistanceBetweenPointToLine(p.X, p.Y, p1.X, p1.Y, p2.X, p2.Y));
 }
Example #10
0
        private void GraphicPanel_OnMouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (EditFH.Checked && !FootholdsCreator.Checked)
            {
                if (selected.Count == 1)
                {
                    MapFootholdSide fh = (MapFootholdSide)selected[0];
                    IMGEntry entry = new IMGEntry();
                    entry.Name = Map.Instance.GenerateFootholdID().ToString();
                    if(fh.ID == 1)
                    {
                        entry.SetInt("x1", fh.Object.GetInt("x1") - 20);
                        entry.SetInt("y1", fh.Object.GetInt("y1"));
                        entry.SetInt("x2", fh.Object.GetInt("x1"));
                        entry.SetInt("y2", fh.Object.GetInt("y1"));
                        entry.SetInt("prev", 0);
                        entry.SetInt("next", fh.Foothold.ID);                        
                    }
                    else if (fh.ID == 2)
                    {
                        entry.SetInt("x1", fh.Object.GetInt("x2"));
                        entry.SetInt("y1", fh.Object.GetInt("y2"));
                        entry.SetInt("x2", fh.Object.GetInt("x2") + 20);
                        entry.SetInt("y2", fh.Object.GetInt("y2"));
                        entry.SetInt("prev", fh.Foothold.ID);
                        entry.SetInt("next", 0);                        
                    }
                    fh.Foothold.Group.Object.Add(entry);
                    MapFoothold nFH = new MapFoothold(int.Parse(entry.Name));
                    nFH.Object = entry;
                    nFH.s1 = new MapFootholdSide();
                    nFH.s2 = new MapFootholdSide();
                    nFH.s1.ID = 1;
                    nFH.s2.ID = 2;
                    nFH.s1.Object = entry;
                    nFH.s2.Object = entry;
                    nFH.s1.Foothold = nFH;
                    nFH.s2.Foothold = nFH;
                    nFH.Group = fh.Foothold.Group;
                    fh.Foothold.Group.footholds.Add(nFH.ID, nFH);
                    if (fh.ID == 1)
                    {
                        fh.Object.SetInt("prev", nFH.ID);
                        selected.Add(nFH.s2);
                        nFH.s2.Selected = true;
                    }
                    else
                    {
                        fh.Object.SetInt("next", nFH.ID);
                        selected.Add(nFH.s1);
                        nFH.s1.Selected = true;
                    }
                }
                else if (selected.Count == 0)
                {
                    MapFoothold fh = Map.Instance.layers[(int)Layer.Value].GetFootholdAt((int)(e.X / Zoom), (int)(e.Y / Zoom));
                    if (fh != null)
                    {
                        MapFoothold next = (MapFoothold)fh.Group.footholds[fh.Object.GetInt("next")];
                        IMGEntry entry = new IMGEntry();
                        entry.Name = Map.Instance.GenerateFootholdID().ToString();
                        entry.SetInt("x1", e.X - Map.Instance.CenterX);
                        entry.SetInt("y1", e.Y - Map.Instance.CenterY);
                        entry.SetInt("x2", fh.Object.GetInt("x2"));
                        entry.SetInt("y2", fh.Object.GetInt("y2"));
                        entry.SetInt("prev", fh.ID);
                        entry.SetInt("next", (next == null) ? 0 : next.ID);
                        fh.Object.SetInt("x2", e.X - Map.Instance.CenterX);
                        fh.Object.SetInt("y2", e.Y - Map.Instance.CenterY);
                        fh.Object.SetInt("next", int.Parse(entry.Name));
                        if(next != null) next.Object.SetInt("prev", int.Parse(entry.Name));
                        fh.Group.Object.Add(entry);
                        MapFoothold nFH = new MapFoothold(int.Parse(entry.Name));
                        nFH.Object = entry;
                        nFH.s1 = new MapFootholdSide();
                        nFH.s2 = new MapFootholdSide();
                        nFH.s1.ID = 1;
                        nFH.s2.ID = 2;
                        nFH.s1.Object = entry;
                        nFH.s2.Object = entry;
                        nFH.s1.Foothold = nFH;
                        nFH.s2.Foothold = nFH;
                        nFH.Group = fh.Group;
                        fh.Group.footholds.Add(nFH.ID, nFH);
                        selected.Add(nFH.s1);
                        selected.Add(fh.s2);
                        nFH.s1.Selected = true;
                        fh.s2.Selected = true;
                    }
                }
            }
            else if (EditLife.Checked && selected.Count > 0)
            {
                int value = -1;
                foreach(MapLife life in selected)
                {
                    if (life is MapMob)
                    {
                        int mobTime = life.Object.GetInt("mobTime");
                        if (value != -1 && value != mobTime)
                        {
                            value = -1;
                            break;
                        }
                        if (value == -1)
                        {
                            value = mobTime;
                        }
                    }
                }
                if (value != -1)
                {
                    GetRespawnTime t = new GetRespawnTime(value);
                    t.ShowDialog();
                    value = int.Parse(t.RespawnTime.Text);

                    foreach (MapLife life in selected)
                    {
                        if (life is MapMob)
                        {
                            life.Object.SetInt("mobTime", value);
                        }
                    }
                }

            }
            else if (EditReactor.Checked && selected.Count > 0)
            {
                MapReactor reactor = (MapReactor)Map.Instance.layers[(int)Layer.Value].GetItemAt((int)(e.X / Zoom), (int)(e.Y / Zoom));
                if (reactor != null)
                {
                    GetReactorInfo t = new GetReactorInfo(reactor.Object.GetString("name"), reactor.Object.GetInt("reactorTime"));
                    t.ShowDialog();

                    reactor.Object.SetString("name", t.RName.Text);

                    reactor.Object.SetInt("reactorTime", int.Parse(t.RespawnTime.Text));
                }
            }
            else if (EditLR.Checked && !FootholdsCreator.Checked)
            {
                MapLR lr = null;
                if (selected.Count > 0)
                {
                    lr = ((MapLRSide)selected[0]).LR;
                }
                else
                {
                    lr = Map.Instance.layers[(int)Layer.Value].GetLRAt((int)(e.X / Zoom), (int)(e.Y / Zoom));
                }
                if (lr != null)
                {
                    GetLRType t = new GetLRType(lr.Object.GetInt("l"));
                    t.ShowDialog();
                    lr.Object.SetInt("l", t.Type.SelectedIndex);
                }

            }
            else if (EditPortal.Checked)
            {
                MapPortal portal = Map.Instance.GetItemAt((int)(e.X / Zoom), (int)(e.Y / Zoom)) as MapPortal;
                if (portal != null)
                {
                    GetPortalInfo t = new GetPortalInfo(portal.Object.GetInt("pt"), portal.Object.GetString("pn"), portal.Object.GetInt("tm"), portal.Object.GetString("tn"));
                    t.ShowDialog();
                    int type = t.PortalType.SelectedIndex;
                    switch (type)
                    {
                        case 4: type = 10; break;
                    }
                    portal.Object.SetInt("pt", type);
                    if (type == 0)
                    {
                        portal.Object.SetString("pn", "sp");
                        portal.Object.SetInt("tm", 999999999);
                        portal.Object.SetString("tn", "");
                    }
                    else if (type == 1)
                    {
                        portal.Object.SetString("pn", t.PortalName.Text);
                        if (t.IsTeleport.Checked)
                        {
                            if (t.ThisMap.Checked)
                            {
                                portal.Object.SetInt("tm", int.Parse(MapID));
                            }
                            else
                            {
                                portal.Object.SetInt("tm", int.Parse(t.ToMap.Text));
                            }
                            portal.Object.SetString("tn", t.ToName.Text);
                        }
                        else
                        {
                            portal.Object.SetInt("tm", 999999999);
                            portal.Object.SetString("tn", "");
                        }
                    }
                    else if (type == 2)
                    {
                        portal.Object.SetString("pn", t.PortalName.Text);
                        portal.Object.SetInt("tm", int.Parse(t.ToMap.Text));
                        portal.Object.SetString("tn", t.ToName.Text);
                    }
                    else if (type == 10 || type == 3)
                    {
                        portal.Object.SetString("pn", t.PortalName.Text);
                        if (t.ThisMap.Checked)
                        {
                            portal.Object.SetInt("tm", int.Parse(MapID));
                        }
                        else
                        {
                            portal.Object.SetInt("tm", int.Parse(t.ToMap.Text));
                        }
                        portal.Object.SetString("tn", t.ToName.Text);
                    }
                }

            }
            else if (EditToolTip.Checked)
            {
                MapItem item = Map.Instance.GetItemAt((int)(e.X / Zoom), (int)(e.Y / Zoom));
                if (item != null)
                {
                    MapToolTip tt;
                    if (item is MapToolTipCorner)
                    {
                        tt = (item as MapToolTipCorner).ToolTip;
                    }
                    else
                    {
                        tt = item as MapToolTip;
                    }
                    GetToolTipInfo info = new GetToolTipInfo(tt.Image.GetString("Title"), tt.Image.GetString("Desc"));
                    info.ShowDialog();
                    tt.Image.SetString("Title", info.Title.Text);
                    if (info.Desc.Text == "")
                    {
                        tt.Image.childs.Remove("Desc");
                    }
                    else
                    {
                        tt.Image.SetString("Desc", info.Desc.Text);
                    }
                    tt.Image.parent.parent.parent.ToSave = true;
                }
            }
        }
Example #11
0
        private void AddLine_Click(object sender, EventArgs e)
        {
            Point pos = new Point((int)(ShiftX / Zoom), (int)(ShiftY / Zoom));
            pos.X += Math.Min(splitContainer1.SplitterDistance, GraphicPanel.Width)/2 - Map.Instance.CenterX;
            pos.Y += Math.Min(splitContainer1.Height, GraphicPanel.Height) / 2 - Map.Instance.CenterY;
            if (EditFH.Checked)
            {
                IMGEntry gentry = new IMGEntry();
                gentry.Name = Map.Instance.GenerateFootholdsGroupID().ToString();
                IMGEntry entry = new IMGEntry();
                entry.Name = Map.Instance.GenerateFootholdID().ToString();
                entry.SetInt("x1", pos.X);
                entry.SetInt("y1", pos.Y);
                entry.SetInt("x2", pos.X + 20);
                entry.SetInt("y2", pos.Y);
                entry.SetInt("prev", 0);
                entry.SetInt("next", 0);
                gentry.Add(entry);
                IMGEntry layer = Map.Instance.map.GetChild("foothold/" + (int)Layer.Value);
                if(layer == null)
                {
                    layer = new IMGEntry();
                    layer.Name = ((int)Layer.Value).ToString();
                    Map.Instance.map.GetChild("foothold").Add(layer);
                }
                layer.Add(gentry);
                MapFootholds group = new MapFootholds(int.Parse(gentry.Name));
                group.Object = gentry;
                MapFoothold fh = new MapFoothold(int.Parse(entry.Name));
                fh.Object = entry;
                fh.s1 = new MapFootholdSide();
                fh.s2 = new MapFootholdSide();
                fh.s1.ID = 1;
                fh.s2.ID = 2;
                fh.s1.Object = entry;
                fh.s2.Object = entry;
                fh.s1.Foothold = fh;
                fh.s2.Foothold = fh;
                fh.Group = group;
                group.footholds.Add(fh.ID, fh);
                group.ToFix = true;
                Map.Instance.layers[(int)Layer.Value].footholdGroups.Add(group.ID, group);
            }
            if (EditLR.Checked)
            {
                IMGEntry entry = new IMGEntry();
                entry.SetInt("l", 1);
                entry.SetInt("uf", 1);
                entry.SetInt("x", pos.X);
                entry.SetInt("y1", pos.Y);
                entry.SetInt("y2", pos.Y + 20);
                entry.SetInt("page", (int)Layer.Value);
                MapLR lr = new MapLR();
                lr.Object = entry;
                lr.s1 = new MapLRSide();
                lr.s2 = new MapLRSide();
                lr.s1.ID = 1;
                lr.s2.ID = 2;
                lr.s1.Object = entry;
                lr.s2.Object = entry;
                lr.s1.LR = lr;
                lr.s2.LR = lr;
                Map.Instance.Add(lr);
            }
            else if (EditSeat.Checked)
            {
                IMGEntry entry = new IMGEntry();
                entry.SetVector(new WZVector(pos.X, pos.Y));

                MapSeat seat = new MapSeat();
                seat.Object = entry;

                Map.Instance.Add(seat);
                undo.Push(new ActionAdd(seat));
                redo.Clear();
            }
            else if (EditPortal.Checked)
            {
                IMGEntry entry = new IMGEntry();

                entry.SetString("pn", "sp");
                entry.SetInt("pt", 0);
                entry.SetInt("x", pos.X);
                entry.SetInt("y", pos.Y);
                entry.SetInt("tm", 999999999);
                entry.SetString("tn", "");

                MapPortal portal = new MapPortal();
                portal.Object = entry;

                Map.Instance.Add(portal);
                undo.Push(new ActionAdd(portal));
                redo.Clear();
            }
            else if (EditToolTip.Checked)
            {
                IMGEntry entry = new IMGEntry();
                entry.SetInt("x1", pos.X);
                entry.SetInt("y1", pos.Y);
                entry.SetInt("x2", pos.X + 40);
                entry.SetInt("y2", pos.Y + 20);
                MapToolTip tt = new MapToolTip();

                tt.Object = entry;
                tt.c1 = new MapToolTipCorner();
                tt.c1.Object = entry;
                tt.c1.type = MapToolTipCornerType.TopLeft;
                tt.c1.ToolTip = tt;
                tt.c2 = new MapToolTipCorner();
                tt.c2.Object = entry;
                tt.c2.type = MapToolTipCornerType.TopRight;
                tt.c2.ToolTip = tt;
                tt.c3 = new MapToolTipCorner();
                tt.c3.Object = entry;
                tt.c3.type = MapToolTipCornerType.BottomLeft;
                tt.c3.ToolTip = tt;
                tt.c4 = new MapToolTipCorner();
                tt.c4.Object = entry;
                tt.c4.type = MapToolTipCornerType.BottomRight;
                tt.c4.ToolTip = tt;
                Map.Instance.Add(tt);
                lock (StringLock)
                {
                    IMGEntry ToolTipsStrings = stringf.Directory.GetIMG("ToolTipHelp.img").GetChild("Mapobject").GetChild(int.Parse(MapEditor.Instance.MapID).ToString());
                    if (ToolTipsStrings == null)
                    {
                        ToolTipsStrings = new IMGEntry();
                        ToolTipsStrings.Name = int.Parse(MapID).ToString();
                        stringf.Directory.GetIMG("ToolTipHelp.img").GetChild("Mapobject").Add(ToolTipsStrings);
                    }
                    IMGEntry strings = new IMGEntry(tt.Object.Name);
                    strings.SetString("Title", "Title");
                    strings.SetString("Desc", "Desc");
                    ToolTipsStrings.Add(strings);
                    stringf.Directory.GetIMG("ToolTipHelp.img").ToSave = true;
                    tt.Image = strings;
                }
            }
            else if (EditClock.Checked)
            {
                if (Map.Instance.clock == null)
                {
                    IMGEntry entry = new IMGEntry();

                    entry.SetInt("x", pos.X - 100);
                    entry.SetInt("y", pos.Y - 100);
                    entry.SetInt("width", 200);
                    entry.SetInt("height", 200);

                    MapClock clock = new MapClock();
                    clock.Object = entry;

                    lock(MapLock)
                        Map.Instance.Add(clock);
                    undo.Push(new ActionAdd(clock));
                    redo.Clear();
                }
            }
        }
Example #12
0
 private MapFootholds CreateFootholds(List<List<MapFootholdDesign>> footholdslist)
 {
     IMGEntry gentry = new IMGEntry();
     gentry.Name = Map.Instance.GenerateFootholdsGroupID().ToString();
     IMGEntry layer = Map.Instance.map.GetChild("foothold/" + (int)Layer.Value);
     if (layer == null)
     {
         layer = new IMGEntry();
         layer.Name = ((int)Layer.Value).ToString();
         Map.Instance.map.GetChild("foothold").Add(layer);
     }
     layer.Add(gentry);
     MapFootholds group = new MapFootholds(int.Parse(gentry.Name));
     group.Object = gentry;
     Map.Instance.layers[(int)Layer.Value].footholdGroups.Add(group.ID, group);
     foreach (List<MapFootholdDesign> footholds in footholdslist)
     {
         List<IMGEntry> fhs = new List<IMGEntry>();
         for (int i = 0; i < footholds.Count - 1; i++)
         {
             IMGEntry entry = new IMGEntry();
             entry.Name = Map.Instance.GenerateFootholdID().ToString();
             entry.SetInt("x1", footholds[i].GetX() - Map.Instance.CenterX);
             entry.SetInt("y1", footholds[i].GetY() - Map.Instance.CenterY);
             entry.SetInt("x2", footholds[i + 1].GetX() - Map.Instance.CenterX);
             entry.SetInt("y2", footholds[i + 1].GetY() - Map.Instance.CenterY);
             if (i == 0)
             {
                 entry.SetInt("prev", 0);
             }
             else
             {
                 entry.SetInt("prev", int.Parse(fhs[i - 1].Name));
                 fhs[i - 1].SetInt("next", int.Parse(entry.Name));
             }
             entry.SetInt("next", 0);
             gentry.Add(entry);
             MapFoothold fh = new MapFoothold(int.Parse(entry.Name));
             fh.Object = entry;
             fh.s1 = new MapFootholdSide();
             fh.s2 = new MapFootholdSide();
             fh.s1.ID = 1;
             fh.s2.ID = 2;
             fh.s1.Object = entry;
             fh.s2.Object = entry;
             fh.s1.Foothold = fh;
             fh.s2.Foothold = fh;
             fh.Group = group;
             group.footholds.Add(fh.ID, fh);
             fhs.Add(entry);
         }
     }
     return group;
 }
Example #13
0
 public bool IsMatch(string type, int x, int y, int multi)
 {
     return(this.type == type && MapFoothold.Distance(this.x * multi, this.y * multi, x, y) <= 15);
 }
Example #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");
            }

        }
Example #15
0
 internal bool IsFootholdBelow(double x, double y, int height, MapFoothold ofh)
 {
     foreach (MapLayer layer in layers)
     {
         foreach (MapFootholds group in layer.footholdGroups.Values)
         {
             foreach (MapFoothold fh in group.footholds.Values)
             {
                 if (fh == ofh || fh.m_x1 == fh.m_x2) continue;
                 if (x >= fh.m_x1 && x <= fh.m_x2 && Math.Max(fh.m_y1, fh.m_y2) >= y && Math.Min(fh.m_y1, fh.m_y2) <= y + height)
                 {
                     double ty = ((x - fh.m_x1) * (fh.m_y2 - fh.m_y1) / (double)(fh.m_x2 - fh.m_x1) + fh.m_y1);
                     if (ty >= y && ty <= y + height) return true;
                 }
             }
         }
     }
     return false;
 }