internal override void Load(SaveFileReader reader) { reader.ReadVersion(1); var unknownBool1 = reader.ReadBoolean(); var unknownBool2 = reader.ReadBoolean(); }
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(); }
internal override void Load(SaveFileReader reader) { reader.ReadVersion(1); base.Load(reader); var unknown1 = reader.ReadUInt32(); var unknown2 = reader.ReadBoolean(); var unknown3 = reader.ReadBoolean(); }
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(); }
internal override void Load(SaveFileReader reader) { reader.ReadVersion(1); var unknownBool1 = reader.ReadBoolean(); if (!unknownBool1) { throw new InvalidDataException(); } _stateMachine.Load(reader); var unknownBool2 = reader.ReadBoolean(); }
internal void Load(SaveFileReader reader) { reader.ReadVersion(2); var playerId = reader.ReadUInt32(); if (playerId != Owner.Id) { throw new InvalidDataException(); } _attackPriorityName = reader.ReadAsciiString(); var unknown2 = reader.ReadBoolean(); _templateData.Load(reader); var teamCount = reader.ReadUInt16(); for (var i = 0; i < teamCount; i++) { var id = reader.ReadUInt32(); var team = FindTeamById(id); if (team == null) { team = TeamFactory.AddTeam(this); team.Id = id; } team.Load(reader); } }
internal void Load(SaveFileReader reader, Game game) { reader.ReadVersion(2); reader.ReadVersion(1); var unknownBool1 = reader.ReadBoolean(); if (unknownBool1) { throw new InvalidDataException(); } var area = reader.ReadUInt32(); if (area != game.Scene3D.MapFile.HeightMapData.Area) { throw new InvalidDataException(); } var width = game.Scene3D.MapFile.HeightMapData.Width; var height = game.Scene3D.MapFile.HeightMapData.Height; var elevations = game.Scene3D.MapFile.HeightMapData.Elevations; for (var y = 0; y < height; y++) { for (var x = 0; x < width; x++) { elevations[x, y] = reader.ReadByte(); } } // TODO: Not great to create the initial patches, // then recreate them here. game.Scene3D.Terrain.OnHeightMapChanged(); }
internal void Load(SaveFileReader reader) { reader.ReadVersion(1); var numLocomotorTemplates = reader.ReadUInt16(); for (var i = 0; i < numLocomotorTemplates; i++) { var locomotorTemplateName = reader.ReadAsciiString(); var locomotorTemplate = _gameObject.GameContext.AssetLoadContext.AssetStore.LocomotorTemplates.GetByName(locomotorTemplateName); var locomotor = new Locomotor(_gameObject, locomotorTemplate, 100); locomotor.Load(reader); _locomotors.Add(locomotor); } _surfaces = reader.ReadEnumFlags <Surfaces>(); var unknownBool1 = reader.ReadBoolean(); if (unknownBool1 != false) { throw new InvalidDataException(); } }
internal void Load(SaveFileReader reader, PlayerManager players) { reader.ReadVersion(2); // This will be the same as the existing Owner, unless control of this team has been transferred. var ownerPlayerId = reader.ReadUInt32(); Owner = players.GetPlayerByIndex(ownerPlayerId); _attackPriorityName = reader.ReadAsciiString(); var unknown2 = reader.ReadBoolean(); _templateData.Load(reader); var teamCount = reader.ReadUInt16(); for (var i = 0; i < teamCount; i++) { var id = reader.ReadUInt32(); var team = FindTeamById(id); if (team == null) { team = TeamFactory.AddTeam(this); team.Id = id; } team.Load(reader); } }
internal override void Load(SaveFileReader reader) { reader.ReadVersion(1); var unknownBool1 = reader.ReadBoolean(); _stateMachine.Load(reader); }
internal override void Load(SaveFileReader reader) { reader.ReadVersion(1); var unknownBool2 = reader.ReadBoolean(); var positionSomething = reader.ReadVector3(); _stateMachine.Load(reader); }
public void Load(SaveFileReader reader) { reader.ReadVersion(1); Type = reader.ReadEnum <ObjectGeometry>(); IsSmall = reader.ReadBoolean(); Height = reader.ReadSingle(); MajorRadius = reader.ReadSingle(); MinorRadius = reader.ReadSingle(); var unknown1 = reader.ReadSingle(); var unknown2 = reader.ReadSingle(); }
internal override void Load(SaveFileReader reader) { reader.ReadVersion(1); var unknownBool = reader.ReadBoolean(); if (!unknownBool) { throw new InvalidDataException(); } }
// 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>(); }
internal void Load(SaveFileReader reader) { reader.ReadVersion(1); // This is the object definition which defined the WeaponSet // (either a normal object or DefaultThingTemplate) var objectDefinitionName = reader.ReadAsciiString(); var conditions = reader.ReadBitArray <WeaponSetConditions>(); _currentWeaponTemplateSet = _gameObject.Definition.WeaponSets[conditions]; // In Generals there are 3 possible weapons. // Later games have up to 5. for (var i = 0; i < 3; i++) { var slotFilled = reader.ReadBoolean(); if (slotFilled) { _weapons[i] = new Weapon(_gameObject, _currentWeaponTemplateSet.Slots[i].Weapon.Value, (WeaponSlot)i, _gameObject.GameContext); _weapons[i].Load(reader); } else { _weapons[i] = null; } } _currentWeaponSlot = reader.ReadEnum <WeaponSlot>(); var unknown2 = reader.ReadUInt32(); _filledWeaponSlots = reader.ReadUInt32(); _combinedAntiMask = reader.ReadEnumFlags <WeaponAntiFlags>(); var unknown5 = reader.ReadUInt32(); var unknownBool1 = reader.ReadBoolean(); var unknownBool2 = reader.ReadBoolean(); }
internal void Load(SaveFileReader reader) { reader.ReadVersion(2); reader.ReadUInt32(); // 0 reader.ReadBoolean(); reader.ReadBoolean(); reader.ReadBoolean(); reader.ReadUInt32(); // 0 // TODO: Superweapon something... var something = reader.ReadUInt32(); while (something != uint.MaxValue) // A way to store things the engine doesn't know the length of? { var someString1 = reader.ReadAsciiString(); var someString2 = reader.ReadAsciiString(); var unknown1 = reader.ReadUInt32(); var unknown2 = reader.ReadUInt32(); // 0xFFFFFFFF reader.ReadBoolean(); reader.ReadBoolean(); reader.ReadBoolean(); something = reader.ReadUInt32(); } }
internal override void Load(SaveFileReader reader) { reader.ReadVersion(1); base.Load(reader); var unknownInt0 = reader.ReadUInt32(); var unknownInt1 = reader.ReadUInt32(); var unknownInt2 = reader.ReadUInt32(); var unknownInt3 = reader.ReadUInt32(); var waypointIdMaybe = reader.ReadUInt32(); var waypointId2Maybe = reader.ReadUInt32(); var unknownBool1 = reader.ReadBoolean(); }
internal void Load(SaveFileReader reader, Game game) { reader.ReadVersion(2); reader.ReadVersion(1); var unknownBool1 = reader.ReadBoolean(); if (unknownBool1) { reader.ReadVersion(1); // Matches VertexWaterXGridCellsN and VertexWaterYGridCellsN in GameData.ini var gridCellsX = reader.ReadInt32(); var gridCellsY = reader.ReadInt32(); // Don't know why, but this gives the correct length for this array. var dataCount = (gridCellsX + 3) * (gridCellsY + 3) * 10; for (var i = 0; i < dataCount; i++) { var unknown3 = reader.ReadByte(); if (unknown3 != 0) { throw new InvalidDataException(); } } } var area = reader.ReadUInt32(); if (area != game.Scene3D.MapFile.HeightMapData.Area) { throw new InvalidDataException(); } var width = game.Scene3D.MapFile.HeightMapData.Width; var height = game.Scene3D.MapFile.HeightMapData.Height; var elevations = game.Scene3D.MapFile.HeightMapData.Elevations; for (var y = 0; y < height; y++) { for (var x = 0; x < width; x++) { elevations[x, y] = reader.ReadByte(); } } // TODO: Not great to create the initial patches, // then recreate them here. game.Scene3D.Terrain.OnHeightMapChanged(); }
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(); } } }
internal void Load(SaveFileReader reader) { reader.ReadVersion(1); var numPoints = reader.ReadUInt32(); if (numPoints != Points.Length) { throw new InvalidDataException(); } for (var i = 0; i < numPoints; i++) { Points[i] = MapVector3i.Parse(reader.Inner); } var topLeft = reader.ReadPoint2D(); var bottomRight = reader.ReadPoint2D(); Bounds = Rectangle.FromCorners(topLeft, bottomRight); // The following value is what you get if you do this calculation: // width = (bottomRight.X - topLeft.X) * 0.5 // height = (bottomRight.Y + topLeft.Y) * 0.5 // value = sqrt(width * width + height * height) // // This looks like it's supposed to be a radius for this polygon trigger, // presumably used for quick distance tests prior to testing if // a point is inside the actual polygon. // // But there's a mistake... the height should instead be: // height = (bottomRight.Y - topLeft.Y) * 0.5 // // As it is, this "radius" is significantly larger than it should be. var _ = reader.ReadSingle(); Radius = MathF.Sqrt(Bounds.Width * Bounds.Width + Bounds.Height * Bounds.Height); var unknown = reader.ReadBoolean(); if (unknown) { throw new InvalidDataException(); } }
internal void Load(SaveFileReader reader) { reader.ReadVersion(1); var numSides = reader.ReadUInt32(); if (numSides != ScriptLists.Length) { throw new InvalidDataException(); } for (var i = 0; i < numSides; i++) { var hasScripts = reader.ReadBoolean(); if (hasScripts) { ScriptLists[i].Load(reader); } } }
internal void Load(SaveFileReader reader) { reader.ReadVersion(2); _playerId = reader.ReadUInt32(); _attackPriorityName = reader.ReadAsciiString(); var unknown2 = reader.ReadBoolean(); _templateData.Load(reader); var teamCount = reader.ReadUInt16(); for (var i = 0; i < teamCount; i++) { var id = reader.ReadUInt32(); var team = new Team { ID = id }; team.Load(reader); } }
public void Load(SaveFileReader reader) { reader.ReadVersion(9); _currentFrame = reader.ReadUInt32(); _objectDefinitionLookupTable.Load(reader); var gameObjectsCount = reader.ReadUInt32(); _objects.Clear(); _objects.Capacity = (int)gameObjectsCount; for (var i = 0; i < gameObjectsCount; i++) { var objectDefinitionId = reader.ReadUInt16(); var objectDefinition = _objectDefinitionLookupTable.GetById(objectDefinitionId); var gameObject = _scene3D.GameObjects.Add(objectDefinition, _scene3D.LocalPlayer); reader.BeginSegment(); gameObject.Load(reader); while (_objects.Count <= gameObject.ID) { _objects.Add(null); } _objects[(int)gameObject.ID] = gameObject; reader.EndSegment(); } reader.ReadByte(); // 3 var sideName = reader.ReadAsciiString(); var missionName = reader.ReadAsciiString(); reader.__Skip(12); var someCount4 = reader.ReadUInt32(); for (var i = 0; i < someCount4; i++) { var maybeIndex = reader.ReadUInt32(); reader.ReadBoolean(); // 1 var someCount5 = reader.ReadUInt32(); for (var j = 0; j < someCount5; j++) { reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); } reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadUInt32(); reader.ReadSingle(); reader.ReadBoolean(); } reader.ReadUInt32(); // 1000 reader.ReadUInt32(); // 0 reader.ReadBoolean(); // 0 reader.ReadBoolean(); // 1 reader.ReadBoolean(); // 1 reader.ReadBoolean(); // 1 reader.ReadUInt32(); // 0xFFFFFFFF reader.ReadUInt32(); // 0 reader.ReadBoolean(); // 0 }
internal void Load(SaveFileReader reader) { reader.ReadVersion(1); var id = reader.ReadUInt32(); if (id != Id) { throw new InvalidDataException(); } var numObjects = reader.ReadUInt16(); for (var i = 0; i < numObjects; i++) { ObjectIds.Add(reader.ReadObjectID()); } for (var i = 0; i < 1; i++) { var unknownByte = reader.ReadByte(); if (unknownByte != 0) { throw new InvalidDataException(); } } _enteredOrExitedPolygonTrigger = reader.ReadBoolean(); _isAlive = reader.ReadBoolean(); for (var i = 0; i < 5; i++) { var unknown1 = reader.ReadBoolean(); if (unknown1 != false) { throw new InvalidDataException(); } } _numDestroyedSomething = reader.ReadUInt32(); var unknown11 = reader.ReadUInt32(); if (unknown11 != 0 && unknown11 != ObjectIds.Count) { throw new InvalidDataException(); } var waypointID = reader.ReadUInt32(); var unknown13 = reader.ReadUInt16(); if (unknown13 != 16) { throw new InvalidDataException(); } for (var i = 0; i < unknown13; i++) { var unknown19 = reader.ReadBoolean(); if (unknown19 != false) { //throw new InvalidDataException(); } } var unknown14 = reader.ReadBoolean(); if (unknown14 != false) { throw new InvalidDataException(); } var unknown15 = reader.ReadBoolean(); if (unknown15 != false) { throw new InvalidDataException(); } TargetObjectID = reader.ReadObjectID(); TeamToTeamRelationships.Load(reader); TeamToPlayerRelationships.Load(reader); }
public void Load(SaveFileReader reader) { reader.ReadVersion(9); _currentFrame = reader.ReadUInt32(); _objectDefinitionLookupTable.Load(reader); var gameObjectsCount = reader.ReadUInt32(); _objects.Clear(); _objects.Capacity = (int)gameObjectsCount; for (var i = 0; i < gameObjectsCount; i++) { var objectDefinitionId = reader.ReadUInt16(); var objectDefinition = _objectDefinitionLookupTable.GetById(objectDefinitionId); var gameObject = _scene3D.GameObjects.Add(objectDefinition, _scene3D.LocalPlayer); reader.BeginSegment(); gameObject.Load(reader); while (_objects.Count <= gameObject.ID) { _objects.Add(null); } _objects[(int)gameObject.ID] = gameObject; reader.EndSegment(); } reader.ReadByte(); // 3 var sideName = reader.ReadAsciiString(); var missionName = reader.ReadAsciiString(); reader.__Skip(12); var numPolygonTriggers = reader.ReadUInt32(); if (numPolygonTriggers != _scene3D.MapFile.PolygonTriggers.Triggers.Length) { throw new InvalidDataException(); } for (var i = 0; i < numPolygonTriggers; i++) { var id = reader.ReadUInt32(); var polygonTrigger = _scene3D.MapFile.PolygonTriggers.GetPolygonTriggerById(id); polygonTrigger.Load(reader); } _rankLevelLimit = reader.ReadUInt32(); var unknown2 = reader.ReadUInt32(); if (unknown2 != 0) { throw new InvalidDataException(); } while (true) { var objectDefinitionName = reader.ReadAsciiString(); if (objectDefinitionName == "") { break; } var buildableStatus = reader.ReadEnum <ObjectBuildableType>(); _techTreeOverrides.Add( objectDefinitionName, buildableStatus); } if (!reader.ReadBoolean()) { throw new InvalidDataException(); } if (!reader.ReadBoolean()) { throw new InvalidDataException(); } if (!reader.ReadBoolean()) { throw new InvalidDataException(); } var unknown3 = reader.ReadUInt32(); if (unknown3 != uint.MaxValue) { throw new InvalidDataException(); } // Command button overrides while (true) { var commandSetNamePrefixedWithCommandButtonIndex = reader.ReadAsciiString(); if (commandSetNamePrefixedWithCommandButtonIndex == "") { break; } var unknownBool1 = reader.ReadBoolean(); if (unknownBool1) { throw new InvalidDataException(); } } var unknown4 = reader.ReadUInt32(); if (unknown4 != 0) { throw new InvalidDataException(); } }
internal void Load(SaveFileReader reader) { reader.ReadVersion(1); IsActive = reader.ReadBoolean(); }
internal void Load(SaveFileReader reader) { reader.ReadVersion(5); var numSequentialScripts = reader.ReadUInt16(); for (var i = 0; i < numSequentialScripts; i++) { var sequentialScript = new SequentialScript(); sequentialScript.Load(reader); } var numTimersAndCounters = reader.ReadUInt32(); var unknown2 = reader.ReadUInt32(); if (unknown2 != 0) { throw new InvalidDataException(); } for (var i = 1; i < numTimersAndCounters; i++) { var value = reader.ReadInt32(); var name = reader.ReadAsciiString(); var active = reader.ReadBoolean(); } var numTimersAndCounters2 = reader.ReadUInt32(); if (numTimersAndCounters2 != numTimersAndCounters) { throw new InvalidDataException(); } var numFlags = reader.ReadUInt32(); for (var i = 1; i < numFlags; i++) { var value = reader.ReadBoolean(); var name = reader.ReadAsciiString(); } var numFlags2 = reader.ReadUInt32(); if (numFlags2 != numFlags) { throw new InvalidDataException(); } var numAttackPrioritySets = reader.ReadUInt16(); reader.__Skip(8); // TODO for (var i = 1; i < numAttackPrioritySets; i++) { var attackPriority = new AttackPriority(); attackPriority.Load(reader); } var numAttackPrioritySets2 = reader.ReadUInt32(); if (numAttackPrioritySets2 != numAttackPrioritySets) { throw new InvalidDataException(); } var unknown7 = reader.ReadInt32(); if (unknown7 != -1) { throw new InvalidDataException(); } var unknown8 = reader.ReadInt32(); if (unknown8 != -1) { throw new InvalidDataException(); } var unknownCount = reader.ReadUInt16(); for (var i = 0; i < unknownCount; i++) { var objectName = reader.ReadAsciiString(); var someId = reader.ReadUInt32(); } var unknown9 = reader.ReadByte(); if (unknown9 != 0) { throw new InvalidDataException(); } CameraFadeOverlay.Load(reader); reader.__Skip(12); var numSpecialPowerSets = reader.ReadUInt16(); // Maybe not sides, maybe player count? for (var i = 0; i < numSpecialPowerSets; i++) { var version = reader.ReadByte(); var numSpecialPowers = reader.ReadUInt16(); for (var j = 0; j < numSpecialPowers; j++) { var name = reader.ReadAsciiString(); var timestamp = reader.ReadUInt32(); } } var numUnknown1Sets = reader.ReadUInt16(); for (var i = 0; i < numUnknown1Sets; i++) { var version = reader.ReadByte(); var count = reader.ReadUInt16(); if (count != 0) { throw new InvalidDataException(); } } var numUnknown2Sets = reader.ReadUInt16(); for (var i = 0; i < numUnknown2Sets; i++) { var version = reader.ReadByte(); var count = reader.ReadUInt16(); if (count != 0) { throw new InvalidDataException(); } } var numUpgradeSets = reader.ReadUInt16(); for (var i = 0; i < numUpgradeSets; i++) { var version = reader.ReadByte(); var numUpgrades = reader.ReadUInt16(); for (var j = 0; j < numUpgrades; j++) { var name = reader.ReadAsciiString(); var timestamp = reader.ReadUInt32(); } } var numScienceSets = reader.ReadUInt16(); for (var i = 0; i < numScienceSets; i++) { var version = reader.ReadByte(); var numSciences = reader.ReadUInt16(); for (var j = 0; j < numSciences; j++) { var name = reader.ReadAsciiString(); } } var unknown14_1 = reader.ReadByte(); if (unknown14_1 != 1) { throw new InvalidDataException(); } var unknown14_2 = reader.ReadUInt16(); if (unknown14_2 != 0) { throw new InvalidDataException(); } for (var i = 0; i < 6; i++) { var unknown15 = reader.ReadSingle(); } var unknown16 = reader.ReadUInt32(); if (unknown16 != 150) { throw new InvalidDataException(); } var unknown17 = reader.ReadUInt32(); if (unknown17 != 0 && unknown17 != 1 && unknown17 != 2) { throw new InvalidDataException(); } var unknown18 = reader.ReadByte(); if (unknown18 != 0) { throw new InvalidDataException(); } var numMapReveals = reader.ReadUInt16(); for (var i = 0; i < numMapReveals; i++) { var revealName = reader.ReadAsciiString(); var waypoint = reader.ReadAsciiString(); var radius = reader.ReadSingle(); var player = reader.ReadAsciiString(); } var numObjectTypeLists = reader.ReadUInt16(); for (var i = 0; i < numObjectTypeLists; i++) { var objectTypeList = new ObjectTypeList(); objectTypeList.Load(reader); } var unknown20 = reader.ReadByte(); if (unknown20 != 1) { throw new InvalidDataException(); } var musicTrack = reader.ReadAsciiString(); var unknown21 = reader.ReadByte(); if (unknown21 != 0) { throw new InvalidDataException(); } }
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(); } }
internal void Load(SaveFileReader reader) { reader.ReadVersion(1); var id = reader.ReadUInt32(); if (id != ID) { throw new InvalidDataException(); } var numObjects = reader.ReadUInt16(); for (var i = 0; i < numObjects; i++) { ObjectIds.Add(reader.ReadObjectID()); } for (var i = 0; i < 2; i++) { var unknown1 = reader.ReadBoolean(); if (unknown1 != false) { throw new InvalidDataException(); } } var unknown2 = reader.ReadBoolean(); if (unknown2 != true) { //throw new InvalidDataException(); } for (var i = 0; i < 5; i++) { var unknown1 = reader.ReadBoolean(); if (unknown1 != false) { throw new InvalidDataException(); } } var unknown10 = reader.ReadUInt32(); if (unknown10 != 0) { throw new InvalidDataException(); } var unknown11 = reader.ReadUInt32(); if (unknown11 != 0 && unknown11 != ObjectIds.Count) { throw new InvalidDataException(); } var waypointID = reader.ReadUInt32(); var unknown13 = reader.ReadUInt16(); if (unknown13 != 16) { throw new InvalidDataException(); } for (var i = 0; i < unknown13; i++) { var unknown19 = reader.ReadBoolean(); if (unknown19 != false) { //throw new InvalidDataException(); } } var unknown14 = reader.ReadBoolean(); if (unknown14 != false) { throw new InvalidDataException(); } var unknown15 = reader.ReadBoolean(); if (unknown15 != false) { throw new InvalidDataException(); } TargetObjectID = reader.ReadObjectID(); TeamToTeamRelationships.Load(reader.Inner); TeamToPlayerRelationships.Load(reader.Inner); }