Esempio n. 1
0
 public static void ExtraInteractionBank(GBFile gb, Program.GameTypes game)
 {
     if (game == Program.GameTypes.Ages)
     {
         // Call ASM script
         gb.WriteBytes(0x54328, new byte[] { 0xC3, 0xFC, 0x7B });
         // ASM script
         gb.WriteBytes(0x57bfc, new byte[] {
             0x56, 0x5F, 0xCB, 0x7A, 0xC8, 0xCB, 0xBA, 0x62, 0x6B, 0x0E, 0x08, 0x11,
             0x00, 0xC3, 0x06, 0xFA, 0xCD, 0x83, 0x1A, 0x0D, 0x20, 0xF8, 0x11, 0x00,
             0xC3, 0xC9
         });
     }
     else // Seasons
     {
         // Call ASM script
         gb.WriteBytes(0x458d7, new byte[] { 0x1E, 0x7F, 0x21, 0x00, 0x40, 0xCD, 0x8A, 0x00 });
         // ASM script
         gb.WriteBytes(0x1fc000, new byte[] {
             0xFA, 0x49, 0xCC, 0x21, 0x3B, 0x5B, 0xDF, 0x06, 0x11, 0x11, 0x00, 0xC3,
             0xD5, 0xCD, 0x49, 0x1A, 0xE1, 0x54, 0x5D, 0x2A, 0x66, 0x6F, 0xFA, 0x4C,
             0xCC, 0xDF, 0x06, 0x11, 0xD5, 0xCD, 0x49, 0x1A, 0xE1, 0x2A, 0x56, 0x5F,
             0xCB, 0x7A, 0xC8, 0xCB, 0xBA, 0x62, 0x6B, 0x06, 0x00, 0x11, 0x00, 0xC3,
             0xD5, 0xCD, 0x62, 0x04, 0xD1, 0xC9, 0xFF
         });
     }
 }
Esempio n. 2
0
 public void dump(GBFile gb, TextLoader tl)
 {
     byte bank = 0x1D;
     for (int i = 2; i < 6; i++)
     {
         switch (i)
         {
             case 02:
                 gb.BufferLocation = bank * 0x4000 + 0x1ED8;
                 break;
             case 03:
                 gb.BufferLocation = bank * 0x4000 + 0x2928;
                 break;
             case 04:
                 gb.BufferLocation = bank * 0x4000 + 0x30C1;
                 break;
             case 05:
                 gb.BufferLocation = bank * 0x4000 + 0x3781;
                 break;
         }
         StreamWriter sw = new StreamWriter(File.Open(System.Windows.Forms.Application.StartupPath + "/dictionary" + i + ".txt", FileMode.OpenOrCreate));
         for (int k = 0; k < 256; k++)
         {
             string s = k.ToString("X");
             if (s.Length == 1)
                 s = "0" + s;
             sw.WriteLine(s + " = " + tl.getFinalText(gb.BufferLocation));
         }
         sw.Close();
     }
 }
Esempio n. 3
0
 public Chest(GBHL.GBFile g, bool overWorld, byte dung, byte Map)
 {
     gb        = g;
     dungeon   = dung;
     map       = Map;
     overworld = overWorld;
     loadChestData();
 }
 public frmDungeonMinimapEditor(GBFile g, Image image, byte[] minimapData, int group)
 {
     InitializeComponent();
     gb                     = g;
     pMinimap.Image         = image;
     this.minimapData       = minimapData;
     this.group             = group - 4;
     pMinimap.SelectedIndex = 0;
     pMinimap_MouseDown(null, null);
 }
        public frmRepointInteractions(GBFile g, InteractionLoader i, int map, int group, Program.GameTypes game)
        {
            InitializeComponent();
            gb         = g;
            loader     = i;
            this.map   = map;
            this.group = group;
            this.game  = game;

            i.loadInteractions(map, group);
            nAddress.Value = i.getInteractionLocation();
        }
 public void LoadTeleports(GBFile gb)
 {
     teleports         = new EssenceTeleport[8];
     gb.BufferLocation = 0x2874F;
     for (int i = 0; i < 8; i++)
     {
         EssenceTeleport t = new EssenceTeleport();
         t.realmapgroup = gb.ReadByte();
         t.mapgroup     = (byte)(t.realmapgroup & 0xF);
         t.map          = gb.ReadByte();
         t.yx           = gb.ReadByte();
         t.unknown      = gb.ReadByte();
         teleports[i]   = t;
     }
 }
 public void SaveTeleports(GBFile gb, EssenceTeleport[] teleports)
 {
     gb.BufferLocation = 0x2874F;
     for (int i = 0; i < 8; i++)
     {
         if (teleports[i].realmapgroup == 0)
         {
             teleports[i].realmapgroup = 0x80;
         }
         gb.WriteByte((byte)(((teleports[i].realmapgroup >> 4) << 4) + teleports[i].mapgroup));
         gb.WriteByte(teleports[i].map);
         gb.WriteByte(teleports[i].yx);
         gb.WriteByte(teleports[i].unknown);
     }
 }
Esempio n. 8
0
 public static void removeStartLock(GBFile gb, Program.GameTypes game)
 {
     //ASM script
     if (game == Program.GameTypes.Ages)
     {
         gb.WriteBytes(0x1FF00, new byte[] { 0xEA, 0x11, 0x11, 0x3E, 0xDD, 0xEA, 0xD1, 0xC6, 0xC9 });
     }
     else
     {
         gb.WriteBytes(0x1FF00, new byte[] { 0xEA, 0x11, 0x11, 0x3E, 0xDD, 0xEA, 0xCB, 0xC6, 0xC9 });
     }
     //Calling of ASM script
     if (game == Program.GameTypes.Ages)
     {
         gb.WriteBytes(0x1C10B, new byte[] { 0xCD, 0x00, 0x7F });
     }
     else
     {
         gb.WriteBytes(0x1C103, new byte[] { 0xCD, 0x00, 0x7F });
     }
 }
Esempio n. 9
0
        public frmSign(GBFile g, Image img, int group, int map, Bitmap signImage)
        {
            InitializeComponent();
            gb                   = g;
            lblGroup.Text        = "Map Group: " + group;
            pMap.BackgroundImage = img;
            this.group           = group;
            signLoader           = new SignLoader(g);
            signLoader.LoadSigns(group);
            nSign.Maximum = signLoader.signs.Count - 1;
            if (signLoader.signs.Count == 0)
            {
                MessageBox.Show("There are no signs to edit in this map group.", "Notice");
                this.Close();
            }
            for (int i = 0; i < signLoader.signs.Count; i++)
            {
                if (signLoader.signs[i].map == map)
                {
                    nSign.Value = i;
                    break;
                }
            }
            signImage.MakeTransparent(Color.Magenta);
            for (int x = 0; x < 16; x++)
            {
                signImage.SetPixel(x, 0, Color.Red);
                signImage.SetPixel(x, 15, Color.Red);
                signImage.SetPixel(0, x, Color.Red);
                signImage.SetPixel(15, x, Color.Red);
            }

            this.signImage = signImage;
            if (img.Width > 160)
            {
                pMap.CanvasSize = new Size(240, 176);
            }
            nSign_ValueChanged(null, null);
        }
Esempio n. 10
0
 public static void setMakuGate(GBFile gb, byte b)
 {
 }
Esempio n. 11
0
 public DungeonDrawer(GBFile g)
 {
     gb = g;
 }
Esempio n. 12
0
 public static void sixteenOverworld(GBFile gb)
 {
     gb.WriteByte(0x41A5, 0xF);
     gb.WriteByte(0x41AE, 0xF0);
 }
Esempio n. 13
0
 public TextLoader(GBFile g)
 {
     gb = g;
 }
Esempio n. 14
0
 public Patch(GBFile g)
 {
     gb = g;
 }
Esempio n. 15
0
        public MinimapEditor(GBHL.GBFile g, Image map, byte[] roomindexes, byte[, ,] graphicsdata, byte[] minimapdata, bool overWorld, byte[] overworldPal, byte dungeon)
        {
            InitializeComponent();
            gb   = g;
            dung = dungeon;
            if (!overWorld)
            {
                this.Width            = 215;
                this.Height           = 263;
                gBoxDungeon.Visible   = true;
                gBoxOverWorld.Visible = false;
                gBoxDungeon.Location  = new Point(4, 4);
                pMinimap.Image        = map;
                roomIndexes           = roomindexes;
                if (dungeon == 0xFF)
                {
                    nMap.Maximum        = 0x15;
                    gb.BufferLocation   = 0x19B3;
                    nDeathMinimap.Value = gb.ReadByte();
                    gb.BufferLocation   = 0x50E3D;
                    nDeathDungeon.Value = gb.ReadByte();
                    nDeathMap.Value     = gb.ReadByte();
                    gb.BufferLocation   = 0x6E8D + (0xF * 2);
                    nArrow.Value        = gb.ReadByte() - 0xB;
                }
                else
                {
                    gb.BufferLocation   = 0x50E41 + dungeon;
                    nDeathMinimap.Value = gb.ReadByte();
                    gb.BufferLocation   = 0x6E8D + (dungeon * 2);
                    nArrow.Value        = gb.ReadByte() - 0xB;
                    gb.BufferLocation   = 0x50DF2 + (dungeon * 5);
                    nDeathDungeon.Value = gb.ReadByte();
                    nDeathMap.Value     = gb.ReadByte();
                }
            }
            else
            {
                gb.BufferLocation = 0x8786E;
                for (int i = 0; i < 8; i++)
                {
                    for (int k = 0; k < 4; k++)
                    {
                        palette[i, k] = GetColor(gb.BufferLocation);
                    }
                }
                pMinimapO.Image = map;
                overworldpal    = overworldPal;
            }
            graphicsData = graphicsdata;
            minimapData  = minimapdata;

            if (!overWorld)
            {
                drawDungeonItems();
            }
            else
            {
                pTile.Image = drawOverworldTile();
            }
        }
Esempio n. 16
0
 public Decompressor(GBFile g)
 {
     gb = g;
 }
Esempio n. 17
0
 public TreeTopLoader(GBFile g)
 {
     gb = g;
 }
Esempio n. 18
0
 public static void InstantAwake(GBFile gb)
 {
 }
Esempio n. 19
0
 public static void removeForestRand(GBFile gb)
 {
     gb.WriteByte(0x5F54, 0x18);
 }
Esempio n. 20
0
 public StaticObjectLoader(GBFile g)
 {
     gb = g;
 }
Esempio n. 21
0
 public MapLoader(GBFile g)
 {
     gb         = g;
     areaLoader = new AreaLoader(g);
 }
Esempio n. 22
0
 public MinimapDrawer(GBFile g)
 {
     gb = g;
 }
Esempio n. 23
0
 public static void crystalSwitches(GBFile gb)
 {
     gb.WriteByte(0x3657, 0xFF);
 }
Esempio n. 24
0
 public MapSaver(GBFile g)
 {
     gb = g;
 }
Esempio n. 25
0
        public void Analyze(string filename)
        {
            if (File.Exists(filename))
            {
                byte[] buffer;
                spritebankinfo        = new SortedDictionary <int, HashSet <byte> >();
                reversespritebankinfo = new SortedDictionary <byte, HashSet <int> >();
                spritelocationinfo    = new SortedDictionary <byte, HashSet <Room> >();

                using (BinaryReader br = new BinaryReader(File.OpenRead(filename)))
                {
                    buffer = br.ReadBytes((Int32)br.BaseStream.Length);
                }

                gb = new GBHL.GBFile(buffer);

                tileLoader      = new TileLoader(gb);
                dungeonDrawer   = new DungeonDrawer(gb);
                minimapDrawer   = new MinimapDrawer(gb);
                overworldDrawer = new OverworldDrawer(gb);
                patches         = new Patch(gb);
                sprites         = new Sprites(gb);

                AELogger.Log("BEGIN ANALYSIS");
                for (int room_index = 0; room_index < 0xFF; room_index++)
                {
                    DoOverworld((byte)room_index);
                    DoDungeon(0, (byte)room_index);
                    DoDungeon(0x6, (byte)room_index);
                }

                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("\n\n================================================\nSprite banks contain these sprites:\n");
                    foreach (KeyValuePair <int, HashSet <byte> > pair in spritebankinfo)
                    {
                        sb.Append("bank ");
                        sb.Append(pair.Key.ToString("X2"));
                        foreach (byte id in pair.Value)
                        {
                            sb.Append("\n\t");
                            sb.Append(Names.GetName(Names.sprites, id));
                            sb.Append(",");
                        }
                        sb.Length = sb.Length - 1;
                        sb.Append("\n");
                    }
                    AELogger.Log(sb);
                }



                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("\n\n================================================\nSprites are used in these rooms:\n");
                    foreach (KeyValuePair <byte, HashSet <Room> > pair in spritelocationinfo)
                    {
                        sb.Append("sprite  '");
                        sb.Append(Names.GetName(Names.sprites, pair.Key));
                        sb.Append("' in rooms:\n");
                        foreach (Room room in pair.Value)
                        {
                            if (room.bOverworld)
                            {
                                sb.Append("\tOVE ---: ");
                            }
                            else if (room.dungeonIndex < 6)
                            {
                                sb.Append("\tDUN 0-5: ");
                            }
                            else
                            {
                                sb.Append("\tDUN 6-?: ");
                            }
                            sb.Append(room.mapIndex.ToString("X2"));
                            sb.Append(" (bank ");
                            sb.Append(room.bank.ToString("X2"));
                            sb.Append("),\n");
                        }
                        sb.Length = sb.Length - 1;
                        sb.Append("\n");
                    }
                    AELogger.Log(sb);
                }

                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append("\n\n================================================\nSprites are pickable in these sprite banks:\n");
                    foreach (KeyValuePair <byte, HashSet <int> > pair in reversespritebankinfo)
                    {
                        sb.Append("sprite '");
                        sb.Append(Names.GetName(Names.sprites, pair.Key));
                        sb.Append("':\n\t");
                        foreach (int id in pair.Value)
                        {
                            sb.Append(id.ToString("X2"));
                            sb.Append(", ");
                        }
                        sb.Length = sb.Length - 1;
                        sb.Append("\n");
                    }
                    AELogger.Log(sb);
                }
            } // if file.exists
        }     // analyze
Esempio n. 26
0
 public SignLoader(GBFile g)
 {
     gb = g;
 }
Esempio n. 27
0
 public TileLoader(GBFile g)
 {
     gb = g;
 }
Esempio n. 28
0
 public Sprites(GBFile g)
 {
     gb = g;
 }
Esempio n. 29
0
 public EnemyLoader(GBFile g)
 {
     gb = g;
 }