Skip to content

Commit 827a047

Browse files
authored
Update variable names from loco (#169)
* update interfaceskinobject * update drivingsoundtype
1 parent 091cf9c commit 827a047

File tree

8 files changed

+82
-83
lines changed

8 files changed

+82
-83
lines changed

Dat/Objects/InterfaceSkinObject.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,24 @@ namespace OpenLoco.Dat.Objects
1212
public record InterfaceSkinObject(
1313
[property: LocoStructOffset(0x00), LocoString, Browsable(false)] string_id Name,
1414
[property: LocoStructOffset(0x02), Browsable(false)] image_id Image,
15-
[property: LocoStructOffset(0x06)] Colour Colour_06,
16-
[property: LocoStructOffset(0x07)] Colour Colour_07,
15+
[property: LocoStructOffset(0x06)] Colour MapTooltipObjectColour,
16+
[property: LocoStructOffset(0x07)] Colour MapTooltipCargoColour,
1717
[property: LocoStructOffset(0x08)] Colour TooltipColour,
1818
[property: LocoStructOffset(0x09)] Colour ErrorColour,
19-
[property: LocoStructOffset(0x0A)] Colour Colour_0A,
20-
[property: LocoStructOffset(0x0B)] Colour Colour_0B,
21-
[property: LocoStructOffset(0x0C)] Colour Colour_0C,
22-
[property: LocoStructOffset(0x0D)] Colour Colour_0D,
23-
[property: LocoStructOffset(0x0E)] Colour Colour_0E,
24-
[property: LocoStructOffset(0x0F)] Colour Colour_0F,
25-
[property: LocoStructOffset(0x10)] Colour Colour_10,
19+
[property: LocoStructOffset(0x0A)] Colour WindowPlayerColor,
20+
[property: LocoStructOffset(0x0B)] Colour WindowTitlebarColour,
21+
[property: LocoStructOffset(0x0C)] Colour WindowColour,
22+
[property: LocoStructOffset(0x0D)] Colour WindowConstructionColour,
23+
[property: LocoStructOffset(0x0E)] Colour WindowTerraFormColour,
24+
[property: LocoStructOffset(0x0F)] Colour WindowMapColour,
25+
[property: LocoStructOffset(0x10)] Colour WindowOptionsColour,
2626
[property: LocoStructOffset(0x11)] Colour Colour_11,
27-
[property: LocoStructOffset(0x12)] Colour Colour_12,
28-
[property: LocoStructOffset(0x13)] Colour Colour_13,
29-
[property: LocoStructOffset(0x14)] Colour Colour_14,
30-
[property: LocoStructOffset(0x15)] Colour Colour_15,
31-
[property: LocoStructOffset(0x16)] Colour Colour_16,
32-
[property: LocoStructOffset(0x17)] Colour Colour_17
27+
[property: LocoStructOffset(0x12)] Colour TopToolbarPrimaryColour,
28+
[property: LocoStructOffset(0x13)] Colour TopToolbarSecondaryColour,
29+
[property: LocoStructOffset(0x14)] Colour TopToolbarTertiaryColour,
30+
[property: LocoStructOffset(0x15)] Colour TopToolbarQuaternaryColour,
31+
[property: LocoStructOffset(0x16)] Colour PlayerInfoToolbarColour,
32+
[property: LocoStructOffset(0x17)] Colour TimeToolbarColour
3333
) : ILocoStruct, IImageTableNameProvider
3434
{
3535
public bool TryGetImageName(int id, out string? value)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
namespace OpenLoco.Dat.Objects
1+
namespace OpenLoco.Dat.Objects
22
{
33
public enum DrivingSoundType : uint8_t
44
{
55
None,
66
Friction,
7-
Engine1,
8-
Engine2
7+
SimpleMotor,
8+
GearboxMotor
99
};
1010
}

Dat/Objects/Vehicle/Engine1Sound.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

Dat/Objects/Vehicle/Engine2Sound.cs renamed to Dat/Objects/Vehicle/GearboxMotorSound.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,27 @@ namespace OpenLoco.Dat.Objects
66
{
77
[TypeConverter(typeof(ExpandableObjectConverter))]
88
[LocoStructSize(0x1B)]
9-
public record Engine2Sound(
9+
public record GearboxMotorSound(
1010
[property: LocoStructOffset(0x00), Browsable(false)] uint8_t SoundObjectId,
11-
[property: LocoStructOffset(0x01)] uint16_t DefaultFrequency,
12-
[property: LocoStructOffset(0x02)] uint8_t DefaultVolume,
11+
[property: LocoStructOffset(0x01)] uint16_t IdleFrequency,
12+
[property: LocoStructOffset(0x02)] uint8_t IdleVolume,
1313
[property: LocoStructOffset(0x04)] uint16_t FirstGearFrequency, // All subsequent gears are based on this frequency
1414
[property: LocoStructOffset(0x06)] Speed16 FirstGearSpeed,
15-
[property: LocoStructOffset(0x08)] uint16_t SecondGearFreqFactor,
15+
[property: LocoStructOffset(0x08)] uint16_t SecondGearFrequencyOffset,
1616
[property: LocoStructOffset(0x0A)] Speed16 SecondGearSpeed,
17-
[property: LocoStructOffset(0x0C)] uint16_t ThirdGearFreqFactor,
17+
[property: LocoStructOffset(0x0C)] uint16_t ThirdGearFrequencyOffset,
1818
[property: LocoStructOffset(0x0E)] Speed16 ThirdGearSpeed,
19-
[property: LocoStructOffset(0x10)] uint16_t FourthGearFreqFactor,
20-
[property: LocoStructOffset(0x12)] uint8_t var_12,
21-
[property: LocoStructOffset(0x13)] uint8_t var_13,
19+
[property: LocoStructOffset(0x10)] uint16_t FourthGearFrequencyOffset,
20+
[property: LocoStructOffset(0x12)] uint8_t CoastingVolume,
21+
[property: LocoStructOffset(0x13)] uint8_t AcceleratingVolume,
2222
[property: LocoStructOffset(0x14)] uint16_t FreqIncreaseStep,
2323
[property: LocoStructOffset(0x16)] uint16_t FreqDecreaseStep,
2424
[property: LocoStructOffset(0x18)] uint8_t VolumeIncreaseStep,
2525
[property: LocoStructOffset(0x19)] uint8_t VolumeDecreaseStep,
26-
[property: LocoStructOffset(0x1A)] uint8_t SpeedFreqFactor
26+
[property: LocoStructOffset(0x1A)] uint8_t SpeedFrequencyFactor // bit-shift right of vehicle speed, added to calculated base frequency
2727
) : ILocoStruct
2828
{
29-
public Engine2Sound() : this(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
29+
public GearboxMotorSound() : this(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
3030
{ }
3131

3232
public bool Validate() => true;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using OpenLoco.Dat.FileParsing;
2+
using OpenLoco.Dat.Types;
3+
using System.ComponentModel;
4+
5+
namespace OpenLoco.Dat.Objects
6+
{
7+
[TypeConverter(typeof(ExpandableObjectConverter))]
8+
[LocoStructSize(0x11)]
9+
public record SimpleMotorSound(
10+
[property: LocoStructOffset(0x00), Browsable(false)] uint8_t SoundObjectId,
11+
[property: LocoStructOffset(0x01)] uint16_t IdleFrequency,
12+
[property: LocoStructOffset(0x03)] uint8_t IdleVolume,
13+
[property: LocoStructOffset(0x04)] uint16_t CoastingFrequency,
14+
[property: LocoStructOffset(0x06)] uint8_t CoastingVolume,
15+
[property: LocoStructOffset(0x07)] uint16_t AccelerationBaseFrequency,
16+
[property: LocoStructOffset(0x08)] uint8_t AccelerationVolume,
17+
[property: LocoStructOffset(0x0A)] uint16_t FreqIncreaseStep,
18+
[property: LocoStructOffset(0x0C)] uint16_t FreqDecreaseStep,
19+
[property: LocoStructOffset(0x0E)] uint8_t VolumeIncreaseStep,
20+
[property: LocoStructOffset(0x0F)] uint8_t VolumeDecreaseStep,
21+
[property: LocoStructOffset(0x10)] uint8_t SpeedFrequencyFactor // bit-shift right of vehicle speed, added to calculated base frequency
22+
) : ILocoStruct
23+
{
24+
public SimpleMotorSound() : this(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)
25+
{ }
26+
27+
public bool Validate() => true;
28+
}
29+
}

Dat/Objects/Vehicle/VehicleObject.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
namespace OpenLoco.Dat.Objects
77
{
8-
98
[TypeConverter(typeof(ExpandableObjectConverter))]
109
[LocoStructSize(0x15E)]
1110
[LocoStructType(ObjectType.Vehicle)]
@@ -93,9 +92,9 @@ public FrictionSound? SoundPropertyFriction
9392
}
9493
}
9594

96-
public Engine1Sound? SoundPropertyEngine1
95+
public SimpleMotorSound? SoundPropertyEngine1
9796
{
98-
get => DrivingSoundType == DrivingSoundType.Engine1 ? GetSoundAs<Engine1Sound>() : null;
97+
get => DrivingSoundType == DrivingSoundType.SimpleMotor ? GetSoundAs<SimpleMotorSound>() : null;
9998
set
10099
{
101100
if (value != null)
@@ -105,9 +104,9 @@ public Engine1Sound? SoundPropertyEngine1
105104
}
106105
}
107106

108-
public Engine2Sound? SoundPropertyEngine2
107+
public GearboxMotorSound? SoundPropertyEngine2
109108
{
110-
get => DrivingSoundType == DrivingSoundType.Engine2 ? GetSoundAs<Engine2Sound>() : null;
109+
get => DrivingSoundType == DrivingSoundType.GearboxMotor ? GetSoundAs<GearboxMotorSound>() : null;
111110
set
112111
{
113112
if (value != null)

Gui/ViewModels/DatTypes/Objects/VehicleViewModel.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ public class VehicleViewModel : LocoObjectViewModel<VehicleObject>
4747
// SoundPropertiesData
4848
// these next 3 properties are a union in the dat file
4949
[Reactive, Category("Sound")] public FrictionSound? FrictionSound { get; set; }
50-
[Reactive, Category("Sound")] public Engine1Sound? Engine1Sound { get; set; }
51-
[Reactive, Category("Sound")] public Engine2Sound? Engine2Sound { get; set; }
50+
[Reactive, Category("Sound")] public SimpleMotorSound? SimpleMotorSound { get; set; }
51+
[Reactive, Category("Sound")] public GearboxMotorSound? GearboxMotorSound { get; set; }
5252
[Reactive, Category("Sound")] public BindingList<S5HeaderViewModel> StartSounds { get; set; }
5353

5454
public VehicleViewModel(VehicleObject vo)
@@ -86,8 +86,8 @@ public VehicleViewModel(VehicleObject vo)
8686
StartSounds = new(vo.StartSounds.ConvertAll(x => new S5HeaderViewModel(x)));
8787
SoundType = vo.DrivingSoundType;
8888
FrictionSound = vo.SoundPropertyFriction;
89-
Engine1Sound = vo.SoundPropertyEngine1;
90-
Engine2Sound = vo.SoundPropertyEngine2;
89+
SimpleMotorSound = vo.SoundPropertyEngine1;
90+
GearboxMotorSound = vo.SoundPropertyEngine2;
9191
}
9292

9393
public override VehicleObject GetAsStruct(VehicleObject vo)
@@ -125,8 +125,8 @@ public override VehicleObject GetAsStruct(VehicleObject vo)
125125
AnimationHeaders = AnimationHeaders.ToList().ConvertAll(x => x.GetAsUnderlyingType()),
126126
DrivingSoundType = SoundType,
127127
SoundPropertyFriction = FrictionSound,
128-
SoundPropertyEngine1 = Engine1Sound,
129-
SoundPropertyEngine2 = Engine2Sound,
128+
SoundPropertyEngine1 = SimpleMotorSound,
129+
SoundPropertyEngine2 = GearboxMotorSound,
130130
NumCompatibleVehicles = (uint8_t)CompatibleVehicles.Count,
131131
NumRequiredTrackExtras = (uint8_t)RequiredTrackExtras.Count,
132132
NumStartSounds = (uint8_t)StartSounds.Count,

Tests/LoadSaveTests.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -518,24 +518,24 @@ void assertFunc(ILocoObject obj, InterfaceSkinObject struc) => Assert.Multiple((
518518
Assert.That(struc.Name, Is.EqualTo(0), nameof(struc.Name));
519519
Assert.That(struc.Image, Is.EqualTo(0), nameof(struc.Image));
520520

521-
Assert.That(struc.Colour_06, Is.EqualTo(Colour.Orange), nameof(struc.Colour_06));
522-
Assert.That(struc.Colour_07, Is.EqualTo(Colour.DarkOrange), nameof(struc.Colour_07));
521+
Assert.That(struc.MapTooltipObjectColour, Is.EqualTo(Colour.Orange), nameof(struc.MapTooltipObjectColour));
522+
Assert.That(struc.MapTooltipCargoColour, Is.EqualTo(Colour.DarkOrange), nameof(struc.MapTooltipCargoColour));
523523
Assert.That(struc.TooltipColour, Is.EqualTo(Colour.Orange), nameof(struc.TooltipColour));
524524
Assert.That(struc.ErrorColour, Is.EqualTo(Colour.DarkRed), nameof(struc.ErrorColour));
525-
Assert.That(struc.Colour_0A, Is.EqualTo(Colour.Grey), nameof(struc.Colour_0A));
526-
Assert.That(struc.Colour_0B, Is.EqualTo(Colour.Black), nameof(struc.Colour_0B));
527-
Assert.That(struc.Colour_0C, Is.EqualTo(Colour.Grey), nameof(struc.Colour_0C));
528-
Assert.That(struc.Colour_0D, Is.EqualTo(Colour.Brown), nameof(struc.Colour_0D));
529-
Assert.That(struc.Colour_0E, Is.EqualTo(Colour.Brown), nameof(struc.Colour_0E));
530-
Assert.That(struc.Colour_0F, Is.EqualTo(Colour.MutedSeaGreen), nameof(struc.Colour_0F));
531-
Assert.That(struc.Colour_10, Is.EqualTo(Colour.Blue), nameof(struc.Colour_10));
525+
Assert.That(struc.WindowPlayerColor, Is.EqualTo(Colour.Grey), nameof(struc.WindowPlayerColor));
526+
Assert.That(struc.WindowTitlebarColour, Is.EqualTo(Colour.Black), nameof(struc.WindowTitlebarColour));
527+
Assert.That(struc.WindowColour, Is.EqualTo(Colour.Grey), nameof(struc.WindowColour));
528+
Assert.That(struc.WindowConstructionColour, Is.EqualTo(Colour.Brown), nameof(struc.WindowConstructionColour));
529+
Assert.That(struc.WindowTerraFormColour, Is.EqualTo(Colour.Brown), nameof(struc.WindowTerraFormColour));
530+
Assert.That(struc.WindowMapColour, Is.EqualTo(Colour.MutedSeaGreen), nameof(struc.WindowMapColour));
531+
Assert.That(struc.WindowOptionsColour, Is.EqualTo(Colour.Blue), nameof(struc.WindowOptionsColour));
532532
Assert.That(struc.Colour_11, Is.EqualTo(Colour.Black), nameof(struc.Colour_11));
533-
Assert.That(struc.Colour_12, Is.EqualTo(Colour.Blue), nameof(struc.Colour_12));
534-
Assert.That(struc.Colour_13, Is.EqualTo(Colour.MutedSeaGreen), nameof(struc.Colour_13));
535-
Assert.That(struc.Colour_14, Is.EqualTo(Colour.Brown), nameof(struc.Colour_14));
536-
Assert.That(struc.Colour_15, Is.EqualTo(Colour.Grey), nameof(struc.Colour_15));
537-
Assert.That(struc.Colour_16, Is.EqualTo(Colour.Grey), nameof(struc.Colour_16));
538-
Assert.That(struc.Colour_17, Is.EqualTo(Colour.Grey), nameof(struc.Colour_17));
533+
Assert.That(struc.TopToolbarPrimaryColour, Is.EqualTo(Colour.Blue), nameof(struc.TopToolbarPrimaryColour));
534+
Assert.That(struc.TopToolbarSecondaryColour, Is.EqualTo(Colour.MutedSeaGreen), nameof(struc.TopToolbarSecondaryColour));
535+
Assert.That(struc.TopToolbarTertiaryColour, Is.EqualTo(Colour.Brown), nameof(struc.TopToolbarTertiaryColour));
536+
Assert.That(struc.TopToolbarQuaternaryColour, Is.EqualTo(Colour.Grey), nameof(struc.TopToolbarQuaternaryColour));
537+
Assert.That(struc.PlayerInfoToolbarColour, Is.EqualTo(Colour.Grey), nameof(struc.PlayerInfoToolbarColour));
538+
Assert.That(struc.TimeToolbarColour, Is.EqualTo(Colour.Grey), nameof(struc.TimeToolbarColour));
539539

540540
Assert.That(obj.G1Elements, Has.Count.EqualTo(470));
541541
});

0 commit comments

Comments
 (0)