Ejemplo n.º 1
0
 public void SavePos(ReadAndWrite rw, int index)
 {
     rw.Seek(enymyyTable + index * 4 + 1);
     rw.Bw.Write(pos[1]);
     rw.Seek(playeryTable + index * 4 + 1);
     rw.Bw.Write(pos[0]);
     rw.Seek(altitudeTable + index);
     rw.Bw.Write(pos[2]);
 }
Ejemplo n.º 2
0
 public void GetPos(ReadAndWrite rw, int index)
 {
     rw.Seek(enymyyTable + index * 4 + 1);
     pos[1] = rw.Br.ReadByte();
     rw.Seek(playeryTable + index * 4 + 1);
     pos[0] = rw.Br.ReadByte();
     rw.Seek(altitudeTable + index);
     pos[2] = rw.Br.ReadByte();
 }
Ejemplo n.º 3
0
        public void Import(ReadAndWrite rw, Bitmap bm, int frame, int pal, bool clear, bool find)
        {
            int gfx_offset = npc.gfx_table + (frame << 3);
            int img_offset;

            try {
                img_offset = rw.ReadPointer(gfx_offset);
                if (clear)
                {
                    rw.FillWith0xFF(img_offset, rw.Br.ReadInt16());
                    goto FIND;
                }
                if (clear || find)
                {
                    goto FIND;
                }
                goto NOT_FIND;
            } catch (NullReferenceException) { }
FIND:
            img_offset = rw.FindFreeOffset0xFF(PokeConfig.ini.start_offset, bm.Width * bm.Height / 2);
NOT_FIND:
            byte[] img = ImgFunction.ConvertNormalImagToGBA(bm, new List <Color>(palletes[pal]), false);
            rw.WriteBytes(img_offset, 0, img);
            rw.Seek(gfx_offset);
            rw.Bw.Write(img_offset + ReadAndWrite.ROM);
            rw.Bw.Write(bm.Width * bm.Height >> 1);
            npc.width  = (short)bm.Width;
            npc.height = (short)bm.Height;
            Save(rw);
        }
Ejemplo n.º 4
0
        public Bitmap GetIcoin(ReadAndWrite rw)
        {
            rw.Seek(icoinPalleteIndexTable + index);
            byte palindex = rw.Br.ReadByte();

            byte[] img = rw.ReadBytes(rw.ReadPointer(icoinTable + (index << 2))
                                      , 0, 0x400);
            return(ImgFunction.ConvertGBAImageToBitmap(img, icoinPalltes[palindex],
                                                       32, 64, icoinImage));
        }
Ejemplo n.º 5
0
 private Evo[] getEvo(ReadAndWrite rw, int num)
 {
     //Console.WriteLine(Operation.Hex(rw.getStructOffset(typeof(Evo), evo_table, num * EVO_PER_POKE)));
     rw.Seek(rw.getStructOffset(typeof(Evo), evo_table, num * EVO_PER_POKE));
     for (int x = 0; x < EVO_PER_POKE; x++)
     {
         byte[] data = rw.Br.ReadBytes(8);
         evo[x] = (Evo)StructsUtil.ByteToStruct(data, typeof(Evo));
     }
     return(evo);
 }
Ejemplo n.º 6
0
 public void Save(ReadAndWrite rw, int num)
 {
     rw.Seek(rw.getStructOffset(typeof(Evo), evo_table, num * EVO_PER_POKE));
     for (int i = 0; i < EVO_PER_POKE; i++)
     {
         Evo e = evo[i];
         DataGridViewCellCollection cell = grid.Rows[i].Cells;
         e.method    = (byte)(int)cell[0].Value;
         e.padd0     = Operation.ParseByte((string)cell[1].Value);
         e.parameter = (ushort)Operation.ParseShort((string)cell[3].Value);
         e.padd1     = Operation.ParseShort((string)cell[4].Value);
         rw.Bw.Write(StructsUtil.StructToByte(e));
     }
 }
Ejemplo n.º 7
0
        public void LoadPalletes(ReadAndWrite rw)
        {
            byte[] data = new byte[0x20];
            Stream s    = rw.Br.BaseStream;

            for (int x = 0; x < PAL_NUM - 1; x++)
            {
                int off = rw.ReadPointer(PAL_SPRITE + (x << 3));
                int num = s.ReadByte();
                rw.Seek(off);
                s.Read(data, 0, 0x20);
                palletes[num] = ImgFunction.ConvertGBAPalTo24Bit(data);
            }
        }
Ejemplo n.º 8
0
 public void InIt(ReadAndWrite rw, INI_init ini)
 {
     front_offset           = rw.ReadPointer(ini.frontspritetable);
     back_offset            = rw.ReadPointer(ini.backspritetable);
     normal_pal_off         = rw.ReadPointer(ini.frontpalettetable);
     shiny_pal_off          = rw.ReadPointer(ini.shinypalettetable);
     icoinTable             = rw.ReadPointer(ini.icointable);
     icoinPalleteIndexTable = rw.ReadPointer(ini.icoinindextable);
     icoinPalltes           = new Color[3][];
     rw.Seek(ini.icoinpallete);
     for (byte x = 0; x < 3; x++)
     {
         byte[] pal = rw.Br.ReadBytes(32);
         icoinPalltes[x] = ImgFunction.ConvertGBAPalTo24Bit(pal);
     }
 }
Ejemplo n.º 9
0
        public void Resize(ReadAndWrite rw, int old, int new_, bool clear)
        {
            if (new_ < old)
            {
                return;
            }
            int start = rw.FindFreeOffset0xFF(new_ * 8);

            rw.Seek(start);
            for (int i = 0; i < new_; i++)
            {
                rw.Bw.Write(0x1010101010001000);
            }
            byte[] a = rw.ReadAndClear(npc.gfx_table, 8 * old, clear);
            rw.WriteBytes(start, 0, a);
            npc.gfx_table = start + ReadAndWrite.ROM;
            Save(rw);
        }