Esempio n. 1
0
        public static List <string> Read(FileReader reader, BLOHeader header)
        {
            List <string> values = new List <string>();

            ushort count = reader.ReadUInt16();

            if (count == 0)
            {
                return(values);
            }

            ushort unk        = reader.ReadUInt16(); //0xFFFF
            uint   headerSize = reader.ReadUInt32(); //0x10

            long startpos = reader.Position;

            ushort count2 = reader.ReadUInt16(); //Same as count

            ushort[] offsets = reader.ReadUInt16s((int)count);
            for (int i = 0; i < count; i++)
            {
                reader.SeekBegin(startpos + offsets[i]);
                values.Add(BloResource.Read(reader, header));
            }
            return(values);
        }
Esempio n. 2
0
        public WIN1(FileReader reader, BLOHeader header) : base(reader, header)
        {
            byte  numParams = reader.ReadByte();
            short transX    = reader.ReadInt16();
            short transY    = reader.ReadInt16();

            Width  = reader.ReadInt16();
            Height = reader.ReadInt16();

            Translate = GetPosition() + new Syroot.Maths.Vector3F(transX, transY, 0);

            Content                      = new BxlytWindowContent(header);
            Content.Material             = new Material();
            Content.Material.TextureMaps = new BxlytTextureRef[0];

            Console.WriteLine($"numParams {numParams}");
            FrameCount = 4;
            WindowKind = WindowKind.Around;

            numParams -= 5;
            if (numParams > 0)
            {
                WindowFrames = new List <BxlytWindowFrame>();
                for (int i = 0; i < 4; i++)
                {
                    string texName = BloResource.Read(reader, header);
                    Console.WriteLine($"texName {texName}");

                    var frame = new WindowFrame(texName);
                    WindowFrames.Add(frame);
                }
            }

            /*       if (numParams > 0) {
             *         PaletteName = BloResource.Read(reader, header);
             *         numParams--;
             *     }
             *
             *     PaletteName = BloResource.Read(reader, header);
             *     byte src = reader.ReadByte();
             *
             *     for (int i = 0; i < 4; i++)
             *     {
             *         var mirror = (byte)((src >> (6 - (i * 2))) & 0x3);
             *         if (mirror == 1)
             *             WindowFrames[i].TextureFlip = WindowFrameTexFlip.FlipV;
             *     }*/
        }
Esempio n. 3
0
        public static void Write(List <string> values, FileWriter writer, BLOHeader header)
        {
            writer.Write(values.Count);
            writer.Write((ushort)0xFFFF);
            writer.Write((ushort)0x10);

            long startpos = writer.Position;

            writer.Write(values.Count);
            writer.Write(new ushort[values.Count]);
            for (int i = 0; i < values.Count; i++)
            {
                writer.WriteUint16Offset(startpos + (i * 4), startpos);
                BloResource.Write(writer, values[i], header);
            }
        }
Esempio n. 4
0
        public PIC1(FileReader reader, BLOHeader header) : base(reader, header)
        {
            byte numParams = reader.ReadByte();

            if (numParams > 0)
            {
                TextureName = BloResource.Read(reader, header);
                numParams--;
            }
            if (numParams > 0)
            {
                PaletteName = BloResource.Read(reader, header);
                numParams--;
            }
            if (numParams > 0)
            {
                Binding = reader.ReadByte();
                numParams--;
            }

            Material = new Material();

            if (TextureName == string.Empty)
            {
                Material.TextureMaps = new BxlytTextureRef[0];
            }
            else
            {
                Material.TextureMaps    = new BxlytTextureRef[1];
                Material.TextureMaps[0] = new BxlytTextureRef()
                {
                    Name = TextureName,
                };
            }


            TexCoords    = new TexCoord[1];
            TexCoords[0] = new TexCoord();
        }