diff --git a/Core/Objects/BuildingObject.cs b/Core/Objects/BuildingObject.cs index ce5eb93a..cfd28713 100644 --- a/Core/Objects/BuildingObject.cs +++ b/Core/Objects/BuildingObject.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; using Core.Objects; using OpenLoco.ObjectEditor.Data; using OpenLoco.ObjectEditor.DatFileParsing; @@ -38,15 +38,15 @@ public record BuildingObject( [property: LocoStructOffset(0x9D)] Colour ScaffoldingColour, [property: LocoStructOffset(0x9E)] uint8_t GeneratorFunction, [property: LocoStructOffset(0x9F)] uint8_t var_9F, - //[property: LocoStructOffset(0xA0), LocoStructVariableLoad, LocoArrayLength(2)] List ProducedQuantity, - //[property: LocoStructOffset(0xA2), LocoStructVariableLoad, LocoArrayLength(MaxProducedCargoType)] List ProducedCargoType, - //[property: LocoStructOffset(0xA4), LocoStructVariableLoad, LocoArrayLength(MaxRequiredCargoType)] List RequiredCargoType, + [property: LocoStructOffset(0xA0), LocoStructVariableLoad, LocoArrayLength(2)] List _ProducedQuantity, + [property: LocoStructOffset(0xA2), LocoStructVariableLoad, LocoArrayLength(BuildingObject.MaxProducedCargoType), Browsable(false)] List _ProducedCargoType, + [property: LocoStructOffset(0xA4), LocoStructVariableLoad, LocoArrayLength(BuildingObject.MaxRequiredCargoType), Browsable(false)] List _RequiredCargoType, [property: LocoStructOffset(0xA6), LocoStructVariableLoad, LocoArrayLength(2)] List var_A6, [property: LocoStructOffset(0xA8), LocoStructVariableLoad, LocoArrayLength(2)] List var_A8, [property: LocoStructOffset(0xA4), LocoStructVariableLoad, LocoArrayLength(2)] List var_A4, // Some type of Cargo [property: LocoStructOffset(0xAA)] int16_t DemolishRatingReduction, [property: LocoStructOffset(0xAC)] uint8_t var_AC, - [property: LocoStructOffset(0xAD)] uint8_t var_AD + [property: LocoStructOffset(0xAD)] uint8_t NumAnimationSequences //[property: LocoStructOffset(0xAE), LocoStructVariableLoad, LocoArrayLength(4)] uint8_t[][] var_AE // 0xAE ->0xB2->0xB6->0xBA->0xBE (4 byte pointers) ) : ILocoStruct, ILocoStructVariableData { @@ -57,7 +57,7 @@ public record BuildingObject( public List ProducedCargo { get; set; } = []; public List RequiredCargo { get; set; } = []; - public List var_AE { get; set; } = []; + public List AnimationSequences { get; set; } = []; // known issues: // HOSPITL1.dat - loads without error but graphics are bugged @@ -100,14 +100,14 @@ public ReadOnlySpan Load(ReadOnlySpan remainingData) RequiredCargo = SawyerStreamReader.LoadVariableCountS5Headers(remainingData, MaxRequiredCargoType); remainingData = remainingData[(S5Header.StructLength * MaxRequiredCargoType)..]; - // load ?? - var_AE.Clear(); - for (var i = 0; i < var_AD; ++i) + // animation sequences + AnimationSequences.Clear(); + for (var i = 0; i < NumAnimationSequences; ++i) { var size = BitConverter.ToUInt16(remainingData[..2]); remainingData = remainingData[2..]; - var_AE.Add(remainingData[..size].ToArray()); + AnimationSequences.Add(remainingData[..size].ToArray()); remainingData = remainingData[size..]; } @@ -150,7 +150,7 @@ public ReadOnlySpan Save() ms.Write(obj.Write()); } - foreach (var unk in var_AE) + foreach (var unk in AnimationSequences) { ms.Write(BitConverter.GetBytes((uint16_t)unk.Length)); foreach (var x in unk) diff --git a/Gui/MainFormModel.cs b/Gui/MainFormModel.cs index 5dc76a56..d09e83de 100644 --- a/Gui/MainFormModel.cs +++ b/Gui/MainFormModel.cs @@ -337,17 +337,17 @@ public void LoadObjDirectory(string directory, IProgress? progress, bool if (a.Any() || b.Any()) { logger.Warning("Selected directory had an index file but it was outdated; suggest recreating it when you have a moment"); - logger.Warning("Files in index that weren't in the directory:"); - foreach (var aa in a) - { - logger.Warning($" {aa}"); - } - - logger.Warning("Files in directory that weren't in the index:"); - foreach (var bb in b) - { - logger.Warning($" {bb}"); - } + //logger.Warning("Files in index that weren't in the directory:"); + //foreach (var aa in a) + //{ + // logger.Warning($" {aa}"); + //} + + //logger.Warning("Files in directory that weren't in the index:"); + //foreach (var bb in b) + //{ + // logger.Warning($" {bb}"); + //} } } else diff --git a/Tests/LoadSaveTests.cs b/Tests/LoadSaveTests.cs index 94990c83..c2dd664e 100644 --- a/Tests/LoadSaveTests.cs +++ b/Tests/LoadSaveTests.cs @@ -179,7 +179,7 @@ void assertFunc(ILocoObject obj, BuildingObject struc) => Assert.Multiple(() => // CollectionAssert.AreEqual(struc.var_A4, Array.CreateInstance(typeof(byte), 2), nameof(struc.var_A4)); Assert.That(struc.DemolishRatingReduction, Is.EqualTo(0), nameof(struc.DemolishRatingReduction)); Assert.That(struc.var_AC, Is.EqualTo(255), nameof(struc.var_AC)); - Assert.That(struc.var_AD, Is.EqualTo(0), nameof(struc.var_AD)); + Assert.That(struc.NumAnimationSequences, Is.EqualTo(0), nameof(struc.NumAnimationSequences)); }); LoadSaveGenericTest(objectName, assertFunc); }