Beispiel #1
0
 public override void ReadClass(Rom rom)
 {
     for (int i = 0; i < 135; i++)
     {
         BattleBGEffect e = new BattleBGEffect();
         rom.Add(e);
         e.Read(i);
     }
 }
Beispiel #2
0
            // This handler deals with background graphics and palettes as well,
            // even though those are technically separate "objects"

            public override void ReadClass(Rom rom)
            {
                // The only way to determine the bit depth of each BG palette is
                // to check the bit depth of the backgrounds that use it - so,
                // first we create an array to track palette bit depths:
                int[] palbits = new int[114];
                int[] gfxbits = new int[103];

                for (int i = 0; i < 327; i++)
                {
                    BattleBG bg = new BattleBG();
                    rom.Add(bg);
                    bg.Read(i);

                    // Now that the BG has been read, update the BPP entry for its palette
                    // We can also check to make sure palettes are used consistently:
                    int pal = bg.PaletteIndex;
                    if (palbits[pal] != 0 && palbits[pal] != bg.BitsPerPixel)
                    {
                        throw new Exception("Battle BG Palette Error - inconsistent bit depth");
                    }
                    palbits[pal] = bg.BitsPerPixel;

                    gfxbits[bg.GraphicsIndex] = bg.BitsPerPixel;
                }

                // Now load palettes
                for (int i = 0; i < 114; i++)
                {
                    BackgroundPalette p = new BackgroundPalette();
                    rom.Add(p);
                    p.BitsPerPixel = palbits[i];
                    p.Read(i);
                }

                // Load graphics
                for (int i = 0; i < 103; i++)
                {
                    BackgroundGraphics g = new BackgroundGraphics();
                    rom.Add(g);
                    g.BitsPerPixel = gfxbits[i];
                    g.Read(i);
                }
            }