Пример #1
0
        private static Overlay[] loadOvTable(File table)
        {
            Overlay[] ovs = new Overlay[table.fileSize / 32];

            ByteArrayInputStream tbl = new ByteArrayInputStream(table.getContents());

            int i = 0;

            while (tbl.lengthAvailable(32))
            {
                uint   ovId            = tbl.readUInt();
                uint   ramAddr         = tbl.readUInt();
                uint   ramSize         = tbl.readUInt();
                uint   bssSize         = tbl.readUInt();
                uint   staticInitStart = tbl.readUInt();
                uint   staticInitEnd   = tbl.readUInt();
                ushort fileID          = tbl.readUShort();
                tbl.skip(6); //unused 0's

                ovs[ovId] = new Overlay(FS.getFileById(fileID), table, (uint)i * 32);

                i++;
            }

            return(ovs);
        }
Пример #2
0
        public static NSMBView read(ByteArrayInputStream inp, ByteArrayInputStream cam)
        {
            NSMBView v = new NSMBView();

            v.X      = inp.readUShort();
            v.Y      = inp.readUShort();
            v.Width  = inp.readUShort();
            v.Height = inp.readUShort();
            v.Number = inp.readByte();
            int camID = inp.readByte();

            v.Music      = inp.readByte();
            v.Unknown1   = inp.readByte();
            v.Unknown2   = inp.readByte();
            v.Unknown3   = inp.readByte();
            v.Lighting   = inp.readByte();
            v.FlagpoleID = inp.readByte();

            cam.seek(0);
            int camCount = (int)cam.available / 24;
//            Console.Out.WriteLine("CamCount: " + camCount);
            int goodCam = -1;

            for (int i = 0; i < camCount; i++)
            {
                cam.seek(i * 24 + 16);
                int thisCam = cam.readUShort();
//                Console.Out.WriteLine("Cam ID: " + thisCam);
                if (thisCam == camID)
                {
                    goodCam = i;
                    break;
                }
            }

            if (goodCam == -1)
            {
                Console.Out.WriteLine("Warning: Could not find camera ID " + camID);
            }
            else
            {
                cam.seek(goodCam * 24);
                v.CameraTop        = cam.readInt();
                v.CameraBottom     = cam.readInt();
                v.CameraTopSpin    = cam.readInt();
                v.CameraBottomSpin = cam.readInt();
                cam.skip(2);
                v.CameraBottomStick = cam.readUShort();
            }
            return(v);
        }
Пример #3
0
        public static NSMBView readZone(ByteArrayInputStream inp)
        {
            NSMBView v = new NSMBView();

            v.X      = inp.readUShort();
            v.Y      = inp.readUShort();
            v.Width  = inp.readUShort();
            v.Height = inp.readUShort();
            v.Number = inp.readByte();
            v.isZone = true;
            inp.skip(3);

            return(v);
        }
Пример #4
0
        public static NSMBPath read(ByteArrayInputStream inp, ByteArrayInputStream nodes, bool isProgressPath)
        {
            NSMBPath p = new NSMBPath();
            p.isProgressPath = isProgressPath;

            p.id = inp.readUShort();
            int row = inp.readUShort();
            int len = inp.readUShort();
            inp.skip(2); //unused values

            nodes.seek(row*16);
            for (int i = 0; i < len; i++)
                p.points.Add(NSMBPathPoint.read(nodes, p));
            return p;
        }
Пример #5
0
        public static NSMBPath read(ByteArrayInputStream inp, ByteArrayInputStream nodes, bool isProgressPath)
        {
            NSMBPath p = new NSMBPath();

            p.isProgressPath = isProgressPath;

            p.id = inp.readUShort();
            int row = inp.readUShort();
            int len = inp.readUShort();

            inp.skip(2); //unused values

            nodes.seek(row * 16);
            for (int i = 0; i < len; i++)
            {
                p.points.Add(NSMBPathPoint.read(nodes, p));
            }
            return(p);
        }
Пример #6
0
        private static Overlay[] loadOvTable(File table)
        {
            Overlay[] ovs = new Overlay[table.fileSize/32];

            ByteArrayInputStream tbl = new ByteArrayInputStream(table.getContents());

            int i = 0;
            while (tbl.lengthAvailable(32))
            {
                uint ovId = tbl.readUInt();
                uint ramAddr = tbl.readUInt();
                uint ramSize = tbl.readUInt();
                uint bssSize = tbl.readUInt();
                uint staticInitStart = tbl.readUInt();
                uint staticInitEnd = tbl.readUInt();
                ushort fileID = tbl.readUShort();
                tbl.skip(6); //unused 0's

                ovs[ovId] = new Overlay(FS.getFileById(fileID), table, (uint)i*32);

                i++;
            }

            return ovs;
        }
Пример #7
0
        public static NSMBView readZone(ByteArrayInputStream inp)
        {
            NSMBView v = new NSMBView();

            v.X = inp.readUShort();
            v.Y = inp.readUShort();
            v.Width = inp.readUShort();
            v.Height = inp.readUShort();
            v.Number = inp.readByte();
            v.isZone = true;
            inp.skip(3);

            return v;
        }
Пример #8
0
        public static NSMBView read(ByteArrayInputStream inp, ByteArrayInputStream cam)
        {
            NSMBView v = new NSMBView();

            v.X = inp.readUShort();
            v.Y = inp.readUShort();
            v.Width = inp.readUShort();
            v.Height = inp.readUShort();
            v.Number = inp.readByte();
            int camID = inp.readByte();
            v.Music = inp.readByte();
            v.Unknown1 = inp.readByte();
            v.Unknown2 = inp.readByte();
            v.Unknown3 = inp.readByte();
            v.Lighting = inp.readByte();
            v.FlagpoleID = inp.readByte();

            cam.seek(0);
            int camCount = (int)cam.available / 24;
//            Console.Out.WriteLine("CamCount: " + camCount);
            int goodCam = -1;
            for (int i = 0; i < camCount; i++)
            {
                cam.seek(i * 24 + 16);
                int thisCam = cam.readUShort();
//                Console.Out.WriteLine("Cam ID: " + thisCam);
                if (thisCam == camID)
                {
                    goodCam = i;
                    break;
                }
            }

            if (goodCam == -1)
                Console.Out.WriteLine("Warning: Could not find camera ID " + camID);
            else
            {
                cam.seek(goodCam * 24);
                v.CameraTop = cam.readInt();
                v.CameraBottom = cam.readInt();
                v.CameraTopSpin = cam.readInt();
                v.CameraBottomSpin = cam.readInt();
                cam.skip(2);
                v.CameraBottomStick = cam.readUShort();
            }
            return v;
        }