Esempio n. 1
0
        /// <summary>
        /// Updates and resigns the save data, writing any changes back to a stream.
        /// </summary>
        /// <exception cref="ArgumentException">Thrown if the stream cannot be written to or does not support seeking</exception>
        public void Update(Stream stream)
        {
            if (!stream.CanWrite || !stream.CanSeek)
            {
                throw new ArgumentException("Campaign save output streams must be writable and seekable");
            }

            SaveIO.SaveWriter writer = new SaveIO.SaveWriter(stream);

            // Update each object
            Player.ResolvePlayerRefs();
            foreach (GameObject obj in _objects)
            {
                if (obj != null)
                {
                    obj.Update(writer);
                }
            }
            _objectChunk.Update(writer);

            // Update player information
            Player.Update(writer);

            // Update each squad
            foreach (Squad squad in _squads)
            {
                if (squad != null)
                {
                    squad.Update(writer);
                }
            }

            // Update each actor
            foreach (Actor actor in _actors)
            {
                if (actor != null)
                {
                    actor.Update(writer);
                }
            }

            // Gravity
            writer.Seek(0x68EBF4, SeekOrigin.Begin);
            writer.WriteFloat(_gravity);

            // Target locator ammo
            writer.Seek(0x915E1A, SeekOrigin.Begin);
            writer.WriteInt16(_targetLocatorAmmo);

            // Checkpoint message
            writer.Seek(0x9DF9E0, SeekOrigin.Begin);
            writer.WriteUTF16(_checkpointMsg);

            // Resign the file
            Resign(stream);
        }
Esempio n. 2
0
        internal void Update(SaveIO.SaveWriter writer)
        {
            writer.SeekTo(_dataPosition + 2);
            writer.WriteInt16((short)_flags.Data);

            /*writer.SeekTo(_dataPosition + 0xA0);
             * writer.WriteUInt32(_actorIndex);*/

            writer.SeekTo(_dataPosition + 0xE7);
            writer.WriteByte(_team);
        }