Esempio n. 1
0
        // TODO: Actual implementation

        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            _increasingColorDelta = reader.ReadVector3();
            _decreasingColorDelta = reader.ReadVector3();
            _targetColor          = reader.ReadVector3();
            _currentColor         = reader.ReadVector3();
            _holdFrames           = reader.ReadUInt32();
            _isActive             = reader.ReadBoolean();
            _state = reader.ReadEnumByte <ColorFlashState>();
        }
Esempio n. 2
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var positionSomething  = reader.ReadVector3();
            var unknownInt1        = reader.ReadUInt32();
            var unknownBool1       = reader.ReadBoolean();
            var positionSomething2 = reader.ReadVector3();
            var unknownInt2        = reader.ReadUInt32();
            var unknownInt3        = reader.ReadUInt32();
            var unknownBool2       = reader.ReadBoolean();
        }
Esempio n. 3
0
        internal virtual void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var frameSomething2 = reader.ReadUInt32();
            var unknownInt4     = reader.ReadUInt32();

            var currentStateID = reader.ReadUInt32();

            _currentState = GetState(currentStateID);

            var unknownBool1 = reader.ReadBoolean();

            if (unknownBool1)
            {
                throw new InvalidDataException();
            }

            _currentState.Load(reader);

            var unknownInt9        = reader.ReadUInt32();
            var positionSomething3 = reader.ReadVector3();
            var unknownBool4       = reader.ReadBoolean();
            var unknownBool5       = reader.ReadBoolean();
        }
Esempio n. 4
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            var unknownBool2      = reader.ReadBoolean();
            var positionSomething = reader.ReadVector3();

            _stateMachine.Load(reader);
        }
Esempio n. 5
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(2);

            base.Load(reader);

            var guardObjectId = reader.ReadObjectID();

            var guardPosition = reader.ReadVector3();
        }
Esempio n. 6
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(2);

            BuildingName = reader.ReadAsciiString();
            Name         = reader.ReadAsciiString();
            Position     = reader.ReadVector3();

            var unknown1 = reader.ReadUInt32();

            if (unknown1 != 0u)
            {
                throw new InvalidDataException();
            }

            var unknown2 = reader.ReadUInt32();

            if (unknown2 != 0u)
            {
                throw new InvalidDataException();
            }

            Angle = reader.ReadSingle();

            var unknown3 = reader.ReadBoolean();

            Rebuilds = reader.ReadByte();

            var unknown5 = reader.ReadUInt32();

            if (unknown5 != 0u)
            {
                throw new InvalidDataException();
            }

            StartingHealth = reader.ReadUInt32();

            var unknown6  = reader.ReadBoolean();
            var unknown7  = reader.ReadBoolean();
            var unknown8  = reader.ReadBoolean();
            var unknown9  = reader.ReadBoolean();
            var unknown10 = reader.ReadUInt32();
            var unknown11 = reader.ReadUInt32();
            var unknown12 = reader.ReadBoolean();

            for (var i = 0; i < 50; i++)
            {
                var unknown13 = reader.ReadByte();
                if (unknown13 != 0)
                {
                    //throw new InvalidDataException();
                }
            }
        }
Esempio n. 7
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            base.Load(reader);

            var numPositionsSomething = reader.ReadUInt32();

            for (var i = 0; i < numPositionsSomething; i++)
            {
                var positionSomething = reader.ReadVector3();
            }
        }
Esempio n. 8
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(2);

            base.Load(reader);

            var guardObjectId = reader.ReadObjectID();

            var guardObjectId2 = reader.ReadObjectID();

            var guardPosition = reader.ReadVector3();

            var guardPolygonTriggerName = reader.ReadAsciiString();
        }
Esempio n. 9
0
        internal override void Load(SaveFileReader reader)
        {
            reader.ReadVersion(1);

            base.Load(reader);

            var unknownPos = reader.ReadVector3();

            var unknownInt1 = reader.ReadUInt32();

            var unknownInt2 = reader.ReadUInt32();

            if (unknownInt2 != 0)
            {
                throw new InvalidDataException();
            }
        }
Esempio n. 10
0
        internal void Load(SaveFileReader reader, GameLogic gameLogic, Game game)
        {
            reader.ReadVersion(1);
            reader.ReadVersion(1);

            var objectId = reader.ReadObjectID();

            _gameObject = gameLogic.GetObjectById(objectId);

            _geometryType = reader.ReadEnum <ObjectGeometry>();

            // Sometimes there's a 0xC0, when it should be 0x0.
            _geometryIsSmall = reader.ReadByte() == 1;

            _geometryMajorRadius = reader.ReadSingle();
            _geometryMinorRadius = reader.ReadSingle();

            _angle    = reader.ReadSingle();
            _position = reader.ReadVector3();

            var unknown6 = reader.ReadUInt32();

            if (unknown6 != 0)
            {
                throw new InvalidDataException();
            }

            var unknown7 = reader.ReadUInt32();

            if (unknown7 != 0)
            {
                throw new InvalidDataException();
            }

            var unknown8 = reader.ReadUInt32();

            if (unknown8 != 0)
            {
                throw new InvalidDataException();
            }

            for (var i = 0; i < 16; i++)
            {
                var numModels = reader.ReadByte();

                if (numModels > 0 && i != 2)
                {
                    throw new InvalidDataException();
                }

                var modelInstances = new ModelInstance[numModels];

                for (var j = 0; j < numModels; j++)
                {
                    var modelName = reader.ReadAsciiString();

                    var model         = game.AssetStore.Models.GetByName(modelName);
                    var modelInstance = model.CreateInstance(game.AssetStore.LoadContext);
                    modelInstances[j] = modelInstance;

                    var scale = reader.ReadSingle();
                    if (scale != 1.0f)
                    {
                        throw new InvalidDataException();
                    }

                    var houseColor = reader.ReadColorRgba();
                    // TODO: Use house color.

                    reader.ReadVersion(1);

                    var modelTransform = reader.ReadMatrix4x3Transposed();

                    modelInstance.SetWorldMatrix(modelTransform.ToMatrix4x4());

                    var numMeshes = reader.ReadUInt32();
                    if (numMeshes > 0 && numMeshes != model.SubObjects.Length)
                    {
                        throw new InvalidDataException();
                    }

                    for (var k = 0; k < numMeshes; k++)
                    {
                        var meshName      = reader.ReadAsciiString();
                        var meshBool      = reader.ReadBoolean();
                        var meshTransform = reader.ReadMatrix4x3Transposed();

                        if (meshName != model.SubObjects[k].Name)
                        {
                            throw new InvalidDataException();
                        }

                        // TODO: meshTransform is actually absolute, not relative.
                        modelInstance.RelativeBoneTransforms[k] = meshTransform.ToMatrix4x4();
                    }
                }
            }

            var unknown = reader.ReadBoolean();

            if (unknown)
            {
                reader.ReadByte();
                reader.ReadUInt32();
            }
        }
Esempio n. 11
0
        internal void Load(SaveFileReader reader)
        {
            reader.ReadVersion(2);

            var partitionCellSize = reader.ReadSingle();

            if (partitionCellSize != _partitionCellSize)
            {
                throw new InvalidDataException();
            }

            var partitionCellCount = reader.ReadUInt32();

            if (partitionCellCount != _cells.Length)
            {
                throw new InvalidDataException();
            }

            for (var i = 0; i < partitionCellCount; i++)
            {
                _cells[i].Load(reader);
            }

#if DEBUG
            var builder = new System.Text.StringBuilder();
            for (var y = 0; y < _numCellsY; y++)
            {
                for (var x = 0; x < _numCellsX; x++)
                {
                    var cell  = _cells[((_numCellsY - 1 - y) * _numCellsX) + x];
                    var value = cell.Values[2];

                    char c;
                    if (value.State < 0)
                    {
                        c = (char)((-value.State) + '0');
                    }
                    else if (value.State == 0)
                    {
                        c = '-';
                    }
                    else if (value.State == 1)
                    {
                        c = '*';
                    }
                    else
                    {
                        throw new InvalidOperationException();
                    }

                    builder.Append(c);
                }
                builder.AppendLine();
            }
            File.WriteAllText($"Partition{Path.GetFileNameWithoutExtension(((FileStream) reader.Inner.BaseStream).Name)}.txt", builder.ToString());
#endif

            var someOtherCount = reader.ReadUInt32();
            for (var i = 0; i < someOtherCount; i++)
            {
                reader.ReadVersion(1);
                var position    = reader.ReadVector3();
                var visionRange = reader.ReadSingle();
                reader.ReadUInt16();
                var frameSomething = reader.ReadUInt32();
            }
        }