コード例 #1
0
        void Core_LoadMap()
        {
            try
            {
                CurrentMap = new Map(
                    CurrentTileset,
                    Core.ReadData(MapData_PointerBox.Value, 0),
                    Changes_PointerBox.Value);

                Map_GridBox.Load(CurrentMap);
            }
            catch (Exception ex)
            {
                CurrentMap = null;
                Map_GridBox.Load(CurrentMap);
                Program.ShowError("Could not read the map for this chapter.", ex);
            }
        }
コード例 #2
0
        void Core_LoadMap()
        {
            Pointer address         = Core.GetPointer("Map Data Array");
            Pointer poin_palette    = Core.ReadPointer(address + 4 * (byte)Current["Palette"]);
            Pointer poin_tileset1   = Core.ReadPointer(address + 4 * (byte)Current["Tileset1"]);
            Pointer poin_tileset2   = Core.ReadPointer(address + 4 * (byte)Current["Tileset2"]);
            Pointer poin_tsa        = Core.ReadPointer(address + 4 * (byte)Current["TSA"]);
            Pointer poin_mapdata    = Core.ReadPointer(address + 4 * (byte)Current["Map"]);
            Pointer poin_mapchanges = Core.ReadPointer(address + 4 * (byte)Current["MapChanges"]);

            MapTileset map_tileset;

            try
            {
                map_tileset = new MapTileset(
                    Core.ReadData(poin_palette, Map.PALETTES * Palette.LENGTH),
                    Core.ReadData(poin_tileset1, 0),
                    Core.ReadData(poin_tileset2, 0),
                    Core.ReadData(poin_tsa, 0));
            }
            catch (Exception ex)
            {
                map_tileset = null;
                Program.ShowError("Could not load the the tileset for this chapter.", ex);
            }

            try
            {
                CurrentMap = new Map(map_tileset,
                                     Core.ReadData(poin_mapdata, 0),
                                     poin_mapchanges, false);
            }
            catch (Exception ex)
            {
                CurrentMap = null;
                Program.ShowError("Could not load the map for this chapter.", ex);
            }

            if (CurrentMap.Changes != null)
            {
                MapChanges_ListBox.ItemCheck -= MapChanges_ListBox_ItemCheck;
                if (MapChanges_ListBox.Items.Count > 0)
                {
                    for (int i = 0; i < CurrentMap.ShowChanges.Length; i++)
                    {
                        CurrentMap.ShowChanges[i] = MapChanges_ListBox.GetItemChecked(i);
                    }
                    MapChanges_ListBox.Items.Clear();
                }
                for (int i = 0; i < CurrentMap.Changes.Count; i++)
                {
                    MapChanges_ListBox.Items.Add(
                        "0x" + Util.ByteToHex(CurrentMap.Changes.GetNumber(i)),
                        CurrentMap.ShowChanges[i]);
                }
                MapChanges_ListBox.ItemCheck += MapChanges_ListBox_ItemCheck;
            }

            GBA.Bitmap result = new GBA.Bitmap(CurrentMap);

            if (View_Units.Checked)
            {
                Core_LoadMap_Units(result);
            }

            MapViewBox.Size = new Size(CurrentMap.Width, CurrentMap.Height);
            MapViewBox.Load(result);
        }