Пример #1
0
        public void Draw(int transparency, Graphics g)
        {
            for (int i = 0; i < 0x13; i++)
            {
                g.CompositingMode = CompositingMode.SourceOver;
                EntranceOWEditor e        = jsonData.holesOWsEditor[i];
                Brush            bgrBrush = new SolidBrush(Color.FromArgb((int)transparency, 20, 20, 20));
                Pen contourPen            = new Pen(Color.FromArgb((int)transparency, 0, 0, 0));
                if (e.mapId < scene.offset + 64 && e.mapId >= scene.offset)
                {
                    if (selectedHole != null)
                    {
                        if (e == selectedHole)
                        {
                            bgrBrush = new SolidBrush(Color.FromArgb((int)transparency, 0, 55, 240));
                        }
                        else
                        {
                            bgrBrush = new SolidBrush(Color.FromArgb((int)transparency, 255, 200, 16));
                        }
                    }

                    g.FillRectangle(bgrBrush, new Rectangle((e.x), (e.y), 16, 16));
                    g.DrawRectangle(contourPen, new Rectangle((e.x), (e.y), 16, 16));
                    scene.DrawText(g, e.entranceId.ToString("X2") + "- " + scene.roomsNames[jsonData.entrances[e.entranceId].room], new Point((e.x), (e.y)));
                    g.CompositingMode = CompositingMode.SourceCopy;
                }
            }
        }
Пример #2
0
 public void onMouseDown(MouseEventArgs e, int mouse_x, int mouse_y, bool mouse_down)
 {
     for (int i = 0; i < 128; i++)
     {
         EntranceOWEditor en = jsonData.entranceOWsEditor[i];
         if (en.mapId >= scene.offset && en.mapId < 64 + scene.offset)
         {
             if (mouse_x >= en.x && mouse_x < en.x + 16 && mouse_y >= en.y && mouse_y < en.y + 16)
             {
                 if (mouse_down == false)
                 {
                     if (e.Button == MouseButtons.Left)
                     {
                         selectedEntrance     = en;
                         lastselectedEntrance = en;
                         scene.refresh        = true;
                     }
                     else if (e.Button == MouseButtons.Right)
                     {
                         lastselectedEntrance = en;
                         scene.refresh        = true;
                     }
                 }
             }
         }
     }
 }
Пример #3
0
        public void onMouseUp(MouseEventArgs e, int mouse_x, int mouse_y, bool mouse_down, short mouseOverMap, Map16 map)
        {
            if (e.Button == MouseButtons.Left)
            {
                if (selectedEntrance != null)
                {
                    short mid = map.parentMapId;
                    if (map.parentMapId == 255)
                    {
                        mid = (short)mouseOverMap;
                    }
                    selectedEntrance.updateMapStuff(mid);
                    selectedEntrance = null;
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                if (e.Button == MouseButtons.Left)
                {
                    if (selectedEntrance != null)
                    {
                        lastselectedEntrance = selectedEntrance;
                        selectedEntrance     = null;
                    }
                }
                else if (e.Button == MouseButtons.Right)
                {
                    for (int i = 0; i < jsonData.entranceOWsEditor.Length; i++)
                    {
                        EntranceOWEditor en = jsonData.entranceOWsEditor[i];
                        if (en.mapId >= scene.offset && en.mapId < 64 + scene.offset)
                        {
                            if (mouse_x >= en.x && mouse_x < en.x + 16 && mouse_y >= en.y && mouse_y < en.y + 16)
                            {
                                ContextMenuStrip menu = new ContextMenuStrip();
                                menu.Items.Add("Entrance Properties");
                                lastselectedEntrance = en;
                                selectedEntrance     = null;
                                mouse_down           = false;
                                if (lastselectedEntrance == null)
                                {
                                    menu.Items[0].Enabled = false;
                                }

                                menu.Items[0].Click += entranceProperty_Click;
                                menu.Show(Cursor.Position);
                            }
                        }
                    }
                }
            }
        }
Пример #4
0
 public void onMouseUp(MouseEventArgs e, int mouse_x, int mouse_y, bool mouse_down, short mouseOverMap, Map16 map)
 {
     if (e.Button == MouseButtons.Left)
     {
         if (selectedHole != null)
         {
             //Console.WriteLine("OldMPos" + selectedEntrance.mapPos);
             short mid = map.parentMapId;
             if (map.parentMapId == 255)
             {
                 mid = (short)mouseOverMap;
             }
             selectedHole.updateMapStuff(mid);
             selectedHole = null;
         }
     }
 }
Пример #5
0
        public JsonData(string projectLoaded)
        {
            this.projectLoaded = projectLoaded;
            allPalettes        = new PaletteHandler(projectLoaded);

            blocksetGroups  = JsonConvert.DeserializeObject <byte[]>(File.ReadAllText(projectLoaded + "//Overworld//BlocksetGroups.json"));
            blocksetGroups2 = JsonConvert.DeserializeObject <byte[]>(File.ReadAllText(projectLoaded + "//Overworld//BlocksetGroups2.json"));
            palettesGroups  = JsonConvert.DeserializeObject <byte[]>(File.ReadAllText(projectLoaded + "//Overworld//PalettesGroups.json"));
            spritesetGroups = JsonConvert.DeserializeObject <byte[]>(File.ReadAllText(projectLoaded + "//Overworld//SpritesetGroups.json"));

            itemsOW = JsonConvert.DeserializeObject <RoomPotSave[]>(File.ReadAllText(projectLoaded + "//Overworld//Items//Items.json"));
            createItems();

            spritesOW[0] = JsonConvert.DeserializeObject <List <Room_Sprite> >(File.ReadAllText(projectLoaded + "//Overworld//Sprites//Beginning Sprites.json"));
            spritesOW[1] = JsonConvert.DeserializeObject <List <Room_Sprite> >(File.ReadAllText(projectLoaded + "//Overworld//Sprites//ZeldaRescued Sprites.json"));
            spritesOW[2] = JsonConvert.DeserializeObject <List <Room_Sprite> >(File.ReadAllText(projectLoaded + "//Overworld//Sprites//AgahnimDefeated Sprites.json"));
            createSprites(0);
            createSprites(1);
            createSprites(2);


            for (int i = 0; i < 128; i++)
            {
                mapdata[i] = JsonConvert.DeserializeObject <MapSave>(File.ReadAllText(projectLoaded + "//Overworld//Maps//Map" + i.ToString("D3") + ".json"));
            }

            for (int i = 0; i < 223; i++)
            {
                tilesetBitmaps[i] = new Bitmap(projectLoaded + "//Graphics//" + i.ToString("D3") + ".png");
            }
            entranceOWs = JsonConvert.DeserializeObject <EntranceOW[]>(File.ReadAllText(projectLoaded + "//Overworld//Entrances//Entrances.json"));
            for (int i = 0; i < 128; i++)
            {
                byte  m = entranceOWs[i].entranceId;
                short s = (short)(entranceOWs[i].mapId);
                int   p = entranceOWs[i].mapPos >> 1;
                int   x = (p % 64);
                int   y = (p >> 6);
                entranceOWsEditor[i] = new EntranceOWEditor((x * 16) + (((s % 64) - (((s % 64) / 8) * 8)) * 512), (y * 16) + (((s % 64) / 8) * 512), m, s, entranceOWs[i].mapPos);
            }

            holes = JsonConvert.DeserializeObject <EntranceOW[]>(File.ReadAllText(projectLoaded + "//Overworld//Entrances//Holes.json"));
            for (int i = 0; i < 19; i++)
            {
                byte  m = holes[i].entranceId;
                short s = holes[i].mapId;
                int   p = (holes[i].mapPos + 0x400) >> 1;
                int   x = (p % 64);
                int   y = (p >> 6);
                holesOWsEditor[i] = new EntranceOWEditor((x * 16) + ((s - ((s / 8) * 8)) * 512), (y * 16) + ((s / 8) * 512), m, s, (short)(holes[i].mapPos + 0x400));
                //Handle hole to editorhole
            }
            entrances = JsonConvert.DeserializeObject <Entrance[]>(File.ReadAllText(projectLoaded + "//Dungeons//Entrances//Entrances.json"));

            exitsOWs = JsonConvert.DeserializeObject <ExitOW[]>(File.ReadAllText(projectLoaded + "//Overworld//Entrances//Exits.json"));

            tileTypeSet = JsonConvert.DeserializeObject <byte[][]>(File.ReadAllText(projectLoaded + "//Overworld//TilesTypes.json"));

            alltiles16 = JsonConvert.DeserializeObject <Tile16[]>(File.ReadAllText(projectLoaded + "//Overworld//Tiles16.json"));

            File.WriteAllText(projectLoaded + "//Overworld//Tiles16Backup.json", JsonConvert.SerializeObject(alltiles16));


            overlayDatas = JsonConvert.DeserializeObject <List <OverlayData>[]>(File.ReadAllText(projectLoaded + "//Overworld//Overlays.json"));

            gameTexts = JsonConvert.DeserializeObject <string[]>(File.ReadAllText(projectLoaded + "//Texts//AllTexts.json"));
            linkGfx   = new Bitmap(128, 448);
            using (Graphics g = Graphics.FromImage(linkGfx))
            {
                Bitmap templinkGfx = new Bitmap(projectLoaded + "//Graphics//Link.png");
                g.DrawImage(templinkGfx, 0, 0);
            }
            linkGfx.MakeTransparent(Color.Black);
        }