Esempio n. 1
0
            public int    Flags; // 0 = ?, 1 = Ignore Normal Weapon Resistance?

            public DATAField(BinaryFileReader r, int dataSize, GameFormat format)
            {
                if (format == GameFormat.TES3)
                {
                    Weight    = r.ReadSingle();
                    Value     = r.ReadInt32();
                    Type      = r.ReadUInt16();
                    Health    = r.ReadInt16();
                    Speed     = r.ReadSingle();
                    Reach     = r.ReadSingle();
                    Damage    = r.ReadInt16();
                    ChopMin   = r.ReadByte();
                    ChopMax   = r.ReadByte();
                    SlashMin  = r.ReadByte();
                    SlashMax  = r.ReadByte();
                    ThrustMin = r.ReadByte();
                    ThrustMax = r.ReadByte();
                    Flags     = r.ReadInt32();
                    return;
                }
                Type    = (ushort)r.ReadUInt32();
                Speed   = r.ReadSingle();
                Reach   = r.ReadSingle();
                Flags   = r.ReadInt32();
                Value   = r.ReadInt32();
                Health  = (short)r.ReadInt32();
                Weight  = r.ReadSingle();
                Damage  = r.ReadInt16();
                ChopMin = ChopMax = SlashMin = SlashMax = ThrustMin = ThrustMax = 0;
            }
Esempio n. 2
0
 public AI_WField(BinaryFileReader r, int dataSize)
 {
     Distance  = r.ReadInt16();
     Duration  = r.ReadInt16();
     TimeOfDay = r.ReadByte();
     Idle      = r.ReadBytes(8);
     Unknown   = r.ReadByte();
 }
 public LNAMField(BinaryFileReader r, int dataSize)
 {
     Direct = new FormId <Record>(r.ReadUInt32());
     //if (dataSize == 0)
     IndirectWorld = new FormId <WRLDRecord>(r.ReadUInt32());
     //if (dataSize == 0)
     IndirectGridX = r.ReadInt16();
     IndirectGridY = r.ReadInt16();
 }
Esempio n. 4
0
 public AI_FField(BinaryFileReader r, int dataSize)
 {
     X        = r.ReadSingle();
     Y        = r.ReadSingle();
     Z        = r.ReadSingle();
     Duration = r.ReadInt16();
     Id       = r.ReadASCIIString(32, ASCIIFormat.ZeroPadded);
     Unknown  = r.ReadInt16();
 }
Esempio n. 5
0
            public RNAMField(BinaryFileReader r, int dataSize)
            {
                GridX = r.ReadInt16();
                GridY = r.ReadInt16();
                var referenceCount = r.ReadUInt32();
                var referenceSize  = dataSize - 8;

                Assert(referenceSize >> 3 == referenceCount);
                GridReferences = r.ReadTArray <Reference>(referenceSize, referenceSize >> 3);
            }
Esempio n. 6
0
 public DATAField(BinaryFileReader r, int dataSize, GameFormat format)
 {
     if (format != GameFormat.TES3)
     {
         X          = Y = Granularity = 0;
         PointCount = r.ReadInt16();
         return;
     }
     X           = r.ReadInt32();
     Y           = r.ReadInt32();
     Granularity = r.ReadInt16();
     PointCount  = r.ReadInt16();
 }
Esempio n. 7
0
 public DATAField(BinaryFileReader r, int dataSize, GameFormat format)
 {
     if (format == GameFormat.TES3)
     {
         Type       = r.ReadInt32();
         Weight     = r.ReadSingle();
         Value      = r.ReadInt16();
         EnchantPts = r.ReadInt16();
         return;
     }
     Value      = r.ReadInt32();
     Weight     = r.ReadSingle();
     Type       = 0;
     EnchantPts = 0;
 }
Esempio n. 8
0
 public LVLOField(BinaryFileReader r, int dataSize)
 {
     Level = r.ReadInt16();
     r.Skip(2); // Unused
     ItemFormId = new FormId <Record>(r.ReadUInt32());
     if (dataSize == 12)
     {
         Count = r.ReadInt16();
         r.Skip(2); // Unused
     }
     else
     {
         Count = 0;
     }
 }
            public uint Flags; // 1 = Playable 2 = Beast Race

            public DATAField(BinaryFileReader r, int dataSize, GameFormat format)
            {
                if (format == GameFormat.TES3)
                {
                    for (var i = 0; i < SkillBoosts.Length; i++)
                    {
                        SkillBoosts[i] = new SkillBoost(r, 8, format);
                    }
                    Male.Strength     = (byte)r.ReadInt32(); Female.Strength = (byte)r.ReadInt32();
                    Male.Intelligence = (byte)r.ReadInt32(); Female.Intelligence = (byte)r.ReadInt32();
                    Male.Willpower    = (byte)r.ReadInt32(); Female.Willpower = (byte)r.ReadInt32();
                    Male.Agility      = (byte)r.ReadInt32(); Female.Agility = (byte)r.ReadInt32();
                    Male.Speed        = (byte)r.ReadInt32(); Female.Speed = (byte)r.ReadInt32();
                    Male.Endurance    = (byte)r.ReadInt32(); Female.Endurance = (byte)r.ReadInt32();
                    Male.Personality  = (byte)r.ReadInt32(); Female.Personality = (byte)r.ReadInt32();
                    Male.Luck         = (byte)r.ReadInt32(); Female.Luck = (byte)r.ReadInt32();
                    Male.Height       = r.ReadSingle(); Female.Height = r.ReadSingle();
                    Male.Weight       = r.ReadSingle(); Female.Weight = r.ReadSingle();
                    Flags             = r.ReadUInt32();
                    return;
                }
                for (var i = 0; i < SkillBoosts.Length; i++)
                {
                    SkillBoosts[i] = new SkillBoost(r, 2, format);
                }
                r.ReadInt16(); // padding
                Male.Height = r.ReadSingle(); Female.Height = r.ReadSingle();
                Male.Weight = r.ReadSingle(); Female.Weight = r.ReadSingle();
                Flags       = r.ReadUInt32();
            }
Esempio n. 10
0
 public PGRLField(BinaryFileReader r, int dataSize)
 {
     Reference = new FormId <REFRRecord>(r.ReadUInt32());
     PointIds  = new short[(dataSize - 4) >> 2];
     for (var i = 0; i < PointIds.Length; i++)
     {
         PointIds[i] = r.ReadInt16();
         r.Skip(2); // Unused (can merge back)
     }
 }
Esempio n. 11
0
 public ENAMField(BinaryFileReader r, int dataSize)
 {
     EffectId    = r.ReadInt16();
     SkillId     = r.ReadByte();
     AttributeId = r.ReadByte();
     Unknown1    = r.ReadInt32();
     Unknown2    = r.ReadInt32();
     Duration    = r.ReadInt32();
     Magnitude   = r.ReadInt32();
     Unknown4    = r.ReadInt32();
 }
            //public int Gold;

            public NPDTField(BinaryFileReader r, int dataSize)
            {
                if (dataSize == 52)
                {
                    Level        = r.ReadInt16();
                    Strength     = r.ReadByte();
                    Intelligence = r.ReadByte();
                    Willpower    = r.ReadByte();
                    Agility      = r.ReadByte();
                    Speed        = r.ReadByte();
                    Endurance    = r.ReadByte();
                    Personality  = r.ReadByte();
                    Luck         = r.ReadByte();
                    Skills       = r.ReadBytes(27);
                    Reputation   = r.ReadByte();
                    Health       = r.ReadInt16();
                    SpellPts     = r.ReadInt16();
                    Fatigue      = r.ReadInt16();
                    Disposition  = r.ReadByte();
                    FactionId    = r.ReadByte();
                    Rank         = r.ReadByte();
                    Unknown1     = r.ReadByte();
                    Gold         = r.ReadInt32();
                }
                else
                {
                    Level       = r.ReadInt16();
                    Disposition = r.ReadByte();
                    FactionId   = r.ReadByte();
                    Rank        = r.ReadByte();
                    Unknown1    = r.ReadByte();
                    Unknown2    = r.ReadByte();
                    Unknown3    = r.ReadByte();
                    Gold        = r.ReadInt32();
                }
            }
Esempio n. 13
0
        public static INTVField ReadINTV(this BinaryFileReader r, int length)
        {
            switch (length)
            {
            case 1: return(new INTVField {
                    Value = r.ReadByte()
                });

            case 2: return(new INTVField {
                    Value = r.ReadInt16()
                });

            case 4: return(new INTVField {
                    Value = r.ReadInt32()
                });

            case 8: return(new INTVField {
                    Value = r.ReadInt64()
                });

            default: throw new NotImplementedException($"Tried to read an INTV subrecord with an unsupported size ({length})");
            }
        }
Esempio n. 14
0
        public unsafe AnimationFrame(int uniqueAnimationIndex, object graphics, ushort[] palette, BinaryFileReader r, SittingTransformation sitting)
        {
            _animationIndex = uniqueAnimationIndex;
            int xCenter = r.ReadInt16();
            int yCenter = r.ReadInt16();
            int width   = r.ReadUInt16();
            int height  = r.ReadUInt16();

            // Fix for animations with no pixels.
            if (width == 0 || height == 0)
            {
                Texture = null;
                return;
            }
            if (sitting == SittingTransformation.StandSouth)
            {
                xCenter += 8;
                width   += 8;
                height  += 4;
            }
            var data = new byte[width * height * 4];

            // for sitting:
            // somewhere around the waist of a typical mobile animation, we take twelve rows of pixels,
            // discard every third, and shift every remaining row (total of eight) one pixel to the left
            // or right (depending on orientation), for a total skew of eight pixels.
            fixed(byte *pData = data)
            {
                ushort *dataRef  = (ushort *)pData;
                var     dataRead = 0;
                int     header;

                while ((header = r.ReadInt32()) != 0x7FFF7FFF)
                {
                    header ^= DoubleXor;
                    var x = ((header >> 22) & 0x3FF) + xCenter - 0x200;
                    var y = ((header >> 12) & 0x3FF) + yCenter + height - 0x200;
                    if (sitting == SittingTransformation.StandSouth)
                    {
                        const int skew_start = -17;
                        const int skew_end   = skew_start - 16;
                        var       iy         = y - height - yCenter;
                        if (iy > skew_start)
                        {
                            // pixels below the skew
                            x -= 8;
                            y -= 4;
                        }
                        else if (iy > skew_end)
                        {
                            // pixels within the skew
                            if ((iy - skew_end) % 4 == 0)
                            {
                                r.Position += header & 0xFFF;
                                continue;
                            }
                            x -= (iy - skew_end) / 2;
                            y -= (iy - skew_end) / 4;
                        }
                    }
                    ushort *cur         = dataRef + y * width + x;
                    ushort *end         = cur + (header & 0xFFF);
                    var     filecounter = 0;
                    var     filedata    = r.ReadBytes(header & 0xFFF);
                    while (cur < end)
                    {
                        *cur++ = palette[filedata[filecounter++]];
                    }
                    dataRead += header & 0xFFF;
                }
                Metrics.ReportDataRead(dataRead);
            }

            Center  = new Vector2Int(xCenter, yCenter);
            Texture = new Texture2DInfo(width, height, TextureFormat.BGRA32, false, data);
            _picking.Set(_animationIndex, width, height, data);
        }
Esempio n. 15
0
 public PGRIField(BinaryFileReader r, int dataSize)
 {
     PointId = r.ReadInt16();
     r.Skip(2); // Unused (can merge back)
     ForeignNode = new Vector3(r.ReadSingle(), r.ReadSingle(), r.ReadSingle());
 }
Esempio n. 16
0
 public PGRRField(BinaryFileReader r, int dataSize)
 {
     StartPointId = r.ReadInt16();
     EndPointId   = r.ReadInt16();
 }