예제 #1
0
        protected override void DoLoad(SaveIO.SaveReader reader, long start)
        {
            base.DoLoad(reader, start);

            reader.Seek(start + 0xD4, SeekOrigin.Begin);
            _usageInfo = reader.ReadUInt32();

            // Is this value present in other objects as well?
            reader.Seek(start + 0x1A8, SeekOrigin.Begin);
            _weaponFlags = reader.ReadUInt32();

            // User ID
            reader.Seek(start + 0x1B6, SeekOrigin.Begin);
            _userId = reader.ReadUInt16();

            reader.Seek(start + 0x1E0, SeekOrigin.Begin);
            _plasmaUsage = reader.ReadFloat();

            // Ammo
            reader.Seek(start + 0x2C6, SeekOrigin.Begin);
            _ammo = reader.ReadInt16();
            reader.Seek(2, SeekOrigin.Current);
            _clipAmmo = reader.ReadInt16();
        }
예제 #2
0
        public static ModelNode FromSaveReader(SaveIO.SaveReader reader)
        {
            ModelNode part = new ModelNode();

            part.Scale     = reader.ReadFloat();
            part.Right.X   = reader.ReadFloat();
            part.Right.Y   = -reader.ReadFloat();
            part.Right.Z   = reader.ReadFloat();
            part.Forward.X = -reader.ReadFloat();
            part.Forward.Y = reader.ReadFloat();
            part.Forward.Z = -reader.ReadFloat();
            part.Up.X      = reader.ReadFloat();
            part.Up.Y      = -reader.ReadFloat();
            part.Up.Z      = reader.ReadFloat();
            part.X         = reader.ReadFloat();
            part.Y         = reader.ReadFloat();
            part.Z         = reader.ReadFloat();

            return(part);
        }
예제 #3
0
        /// <summary>
        /// Override this to load any extra properties the object might have.
        /// </summary>
        /// <param name="reader">The SaveReader to read from</param>
        /// <param name="start">The start of the object's data</param>
        protected virtual void DoLoad(SaveIO.SaveReader reader, long start)
        {
            // Link data
            reader.Seek(start - 16, SeekOrigin.Begin);
            _linkData = new ObjectLinkData(reader);

            // Resource ID
            _mapId = reader.ReadUInt32();

            // Flags
            _flags = new BitVector32(reader.ReadInt32());

            // Zone?
            _zone = (ushort)((reader.ReadUInt32() & 0xFFFF0000) >> 16);

            // Carry info
            _nextCarriedId   = (ushort)(reader.ReadUInt32() & 0xFFFF);
            _firstCarriedId  = (ushort)(reader.ReadUInt32() & 0xFFFF);
            _carrierId       = (ushort)(reader.ReadUInt32() & 0xFFFF);
            _parentNodeIndex = reader.ReadSByte();

            // Position data
            reader.Seek(start + 0x20, SeekOrigin.Begin);
            _boundsX1 = reader.ReadFloat();
            _boundsY1 = reader.ReadFloat();
            _boundsZ1 = reader.ReadFloat();
            reader.Seek(4, SeekOrigin.Current);
            _boundsX2 = reader.ReadFloat();
            _boundsY2 = reader.ReadFloat();
            _boundsZ2 = reader.ReadFloat();
            reader.Seek(8, SeekOrigin.Current);
            _x         = reader.ReadFloat();
            _y         = reader.ReadFloat();
            _z         = reader.ReadFloat();
            _originalX = _x;
            _originalY = _y;
            _originalZ = _z;

            // Rotation data
            _right.X = reader.ReadFloat();
            _right.Y = -reader.ReadFloat(); // hax
            _right.Z = reader.ReadFloat();
            _up.X    = reader.ReadFloat();
            _up.Y    = -reader.ReadFloat(); // hax
            _up.Z    = reader.ReadFloat();

            // Velocity
            reader.Seek(start + 0x68, SeekOrigin.Begin);
            _velocity.X       = reader.ReadFloat();
            _velocity.Y       = reader.ReadFloat();
            _velocity.Z       = reader.ReadFloat();
            _originalVelocity = _velocity;

            // Calculate the forward vector with a cross product
            _forward = MathUtil.Vector3.Cross(_up, _right);

            // Scale
            reader.Seek(start + 0x80, SeekOrigin.Begin);
            _scale = reader.ReadFloat();

            // Flags
            reader.Seek(start + 0xDC, SeekOrigin.Begin);
            _physicsFlags = new BitVector32(reader.ReadInt32());

            // Health info
            reader.Seek(start + 0x110, SeekOrigin.Begin);
            _healthInfo = new HealthInfo(reader, DefaultNoble6HealthModifier, DefaultNoble6ShieldModifier);

            // Invincibility data
            reader.Seek(start + 0x13C, SeekOrigin.Begin);
            _invincibilityFlags = new BitVector32(reader.ReadInt32());

            // Node data
            reader.Seek(start + 0x17C, SeekOrigin.Begin);
            ushort _nodeDataSize = reader.ReadUInt16();

            _nodeDataOffset = reader.ReadUInt16();

            if (_nodeDataOffset != 0xFFFF)
            {
                reader.Seek(start + _nodeDataOffset, SeekOrigin.Begin);

                // Read all of the nodes into a list
                List <ModelNode> nodes = new List <ModelNode>();
                for (ushort i = 0; i < _nodeDataSize; i += ModelNode.DataSize)
                {
                    nodes.Add(ModelNode.FromSaveReader(reader));
                }

                // Now make a NodeCollection out of them
                _nodes = new NodeCollection(nodes);
            }

            // Previous/next object ID's
            if (_linkData.PreviousLinkOffset != 0)
            {
                reader.Seek(0x76844C + _linkData.PreviousLinkOffset + 6, SeekOrigin.Begin);
                _previousObjectId = reader.ReadUInt16();
            }
            if (_linkData.NextLinkOffset != 0)
            {
                reader.Seek(0x76844C + _linkData.NextLinkOffset + 6, SeekOrigin.Begin);
                _nextObjectId = reader.ReadUInt16();
            }
        }