public static void Init()
        {
            for (int i = 0; i < 4; i++)
            {
                Entries[i]     = Rom.ReadInt(Address[i]);
                InfoEntries[i] = new SpriteInfo[Entries[i]];

                for (int j = 0; j < Entries[i]; j++)
                {
                    int a = GetPointer(i, j);
                    if (a == -1)
                    {
                        continue;
                    }

                    var ie = new SpriteInfo();
                    ie.bank  = i;
                    ie.index = j;

                    Rom.Seek(a);
                    Rom.SeekAdd(8);

                    ie.SpriteCount = Rom.ReadUShort();
                    ie.Sprites     = new Sprite[ie.SpriteCount];
                    for (int k = 0; k < ie.SpriteCount; k++)
                    {
                        var s = new Sprite();
                        s.index = k;

                        s.SpriteCount = Rom.ReadUShort();
                        s.Sprites     = new OamSprite[s.SpriteCount];
                        for (int m = 0; m < s.SpriteCount; m++)
                        {
                            var o = new OamSprite();

                            o.CoordY = Rom.ReadSByte();
                            o.CoordX = (short)Rom.ReadSByte();

                            ushort ch = Rom.ReadUShort();
                            o.Tile     = (ushort)(ch & 0x3FF);
                            o.FlipH    = (ch & 0x400) != 0;
                            o.FlipV    = (ch & 0x800) != 0;
                            o.ObjSize  = (byte)((ch >> 12) & 3);
                            o.ObjShape = (byte)((ch >> 14) & 3);

                            s.Sprites[m] = o;
                        }
                        Rom.SeekAdd(2);

                        ie.Sprites[k] = s;
                    }

                    InfoEntries[i][j] = ie;
                }
            }
        }
Beispiel #2
0
        public static void Init()
        {
            for (int i = 0; i < 4; i++)
            {
                Entries[i] = Rom.ReadInt(Address[i]);
                InfoEntries[i] = new SpriteInfo[Entries[i]];

                for (int j = 0; j < Entries[i]; j++)
                {
                    int a = GetPointer(i, j);
                    if (a == -1) continue;

                    var ie = new SpriteInfo();
                    ie.bank = i;
                    ie.index = j;

                    Rom.Seek(a);
                    Rom.SeekAdd(8);

                    ie.SpriteCount = Rom.ReadUShort();
                    ie.Sprites = new Sprite[ie.SpriteCount];
                    for (int k = 0; k < ie.SpriteCount; k++)
                    {
                        var s = new Sprite();
                        s.index = k;

                        s.SpriteCount = Rom.ReadUShort();
                        s.Sprites = new OamSprite[s.SpriteCount];
                        for (int m = 0; m < s.SpriteCount; m++)
                        {
                            var o = new OamSprite();

                            o.CoordY = Rom.ReadSByte();
                            o.CoordX = (short)Rom.ReadSByte();

                            ushort ch = Rom.ReadUShort();
                            o.Tile = (ushort)(ch & 0x3FF);
                            o.FlipH = (ch & 0x400) != 0;
                            o.FlipV = (ch & 0x800) != 0;
                            o.ObjSize = (byte)((ch >> 12) & 3);
                            o.ObjShape = (byte)((ch >> 14) & 3);

                            s.Sprites[m] = o;
                        }
                        Rom.SeekAdd(2);

                        ie.Sprites[k] = s;
                    }

                    InfoEntries[i][j] = ie;
                }
            }
        }
 public static void Init()
 {
     SpriteGfx.Init();
     SpritePalettes.Init();
     SpriteInfo.Init();
 }