示例#1
0
        /// <summary>
        /// Updates any changes made to the object data.
        /// </summary>
        /// <param name="reader">
        /// The SaveWriter to write to.
        /// It should point to the same stream that was used to load the object data, as seeking will be done automatically.
        /// </param>
        public virtual void Update(SaveWriter writer)
        {
            long chunkStartOffset = _entry.FileOffset + 0x08 + (long)TableOffset.ObjectPool;

            // Strength info
            writer.SeekTo(chunkStartOffset + StrengthInfoOffset);
            _healthInfo.WriteTo(writer);

            // Position1
            writer.SeekTo(chunkStartOffset + PositionOffset1);
            writer.WriteFloat(_positionMain.X);
            writer.WriteFloat(_positionMain.Y);
            writer.WriteFloat(_positionMain.Z);

            // Calculate extra position vectors
            Vector3 position2 = Vector3.Add(_position2Delta, _positionMain);
            Vector3 position3 = Vector3.Add(_position3Delta, _positionMain);

            // Position2
            writer.SeekTo(chunkStartOffset + PositionOffset2);
            writer.WriteFloat(position2.X);
            writer.WriteFloat(position2.Y);
            writer.WriteFloat(position2.Z);

            // Position3
            writer.SeekTo(chunkStartOffset + PositionOffset3);
            writer.WriteFloat(position3.X);
            writer.WriteFloat(position3.Y);
            writer.WriteFloat(position3.Z);
        }
示例#2
0
        /// <summary>
        /// Write data to the mmiof.bmf file
        /// </summary>
        /// <param name="stream">Stream of the mmiof.bmf file.</param>
        private void WriteToStream(Stream stream)
        {
            SaveIO.SaveWriter writer = new SaveWriter(stream);

            // Write Save Header
            _saveHeader.WriteTo(writer);
            writer.SeekTo(0);

            // Write the object list
            _objectList.Update(writer);
            writer.SeekTo(0);

            // Resign the Save
            _saveHeader.Resign(writer, stream);
        }
示例#3
0
        public override void Update(SaveWriter writer)
        {
            base.Update(writer);

            writer.SeekTo(SourceOffset + AmmoOffset);
            writer.WriteInt16(_remainingAmmo);
            writer.WriteInt16(_clipAmmo);
        }
示例#4
0
        public override void Update(SaveWriter writer)
        {
            base.Update(writer);

            // Grenades
            writer.SeekTo(SourceOffset + GrenadesOffset);
            writer.WriteSByte(_fragGrenades);
            writer.WriteSByte(_plasmaGrenades);
        }
示例#5
0
        /// <summary>
        /// Updates any changes made to the object data.
        /// </summary>
        /// <param name="reader">
        /// The SaveWriter to write to.
        /// It should point to the same stream that was used to load the object data, as seeking will be done automatically.
        /// </param>
        public virtual void Update(SaveWriter writer)
        {
            // Strength info
            writer.SeekTo(SourceOffset + StrengthInfoOffset);
            _healthInfo.WriteTo(writer);

            // Position
            writer.SeekTo(SourceOffset + PositionOffset1);
            writer.WriteFloat(Position.X);
            writer.WriteFloat(Position.Y);
            writer.WriteFloat(Position.Z);

            Vector3 position2 = Vector3.Add(_unkPosition, _position);

            writer.SeekTo(SourceOffset + PositionOffset2);
            writer.WriteFloat(position2.X);
            writer.WriteFloat(position2.Y);
            writer.WriteFloat(position2.Z);
        }
示例#6
0
        private void WriteToStream(Stream stream)
        {
            SaveWriter writer = new SaveWriter(stream);

            // Update the object list
            _objectList.Update(writer);

            // Now update the file header (this is done last so the file is resigned correctly)
            writer.SeekTo(0);
            _fileHeader.Update(writer, stream);
        }
示例#7
0
        /// <summary>
        /// Updates any changes made to the object data.
        /// </summary>
        /// <param name="reader">
        /// The SaveWriter to write to.
        /// It should point to the same stream that was used to load the object data, as seeking will be done automatically.
        /// </param>
        public virtual void Update(SaveWriter writer)
        {
            // Strength info
            long chunkStartOffset = _entry.ObjectAddress + (long)TableOffset.ObjectPool;

            writer.SeekTo(chunkStartOffset + StrengthInfoOffset);
            _healthInfo.WriteTo(writer);

            // BSP Zone
            writer.SeekTo(chunkStartOffset + 0x18);
            writer.WriteUInt16(_zone);

            // Position1
            writer.SeekTo(chunkStartOffset + PositionOffset1);
            writer.WriteFloat(_positionMain.X);
            writer.WriteFloat(_positionMain.Y);
            writer.WriteFloat(_positionMain.Z);

            // Calculate extra position vectors
            Vector3 position2 = Vector3.Add(_position2Delta, _positionMain);
            Vector3 position3 = Vector3.Add(_position3Delta, _positionMain);
            Vector3 position4 = Vector3.Add(_position4Delta, _positionMain);

            // Position2
            writer.SeekTo(chunkStartOffset + PositionOffset2);
            writer.WriteFloat(position2.X);
            writer.WriteFloat(position2.Y);
            writer.WriteFloat(position2.Z);

            // Position3
            writer.SeekTo(chunkStartOffset + PositionOffset3);
            writer.WriteFloat(position3.X);
            writer.WriteFloat(position3.Y);
            writer.WriteFloat(position3.Z);

            // Position4
            writer.SeekTo(chunkStartOffset + PositionOffset4);
            writer.WriteFloat(position4.X);
            writer.WriteFloat(position4.Y);
            writer.WriteFloat(position4.Z);
        }