Skip to content

Commit d2b2cd2

Browse files
committed
add image id names for streetlight
1 parent 2e23980 commit d2b2cd2

File tree

4 files changed

+46
-20
lines changed

4 files changed

+46
-20
lines changed

AvaGui/ViewModels/DatTypes/DatObjectEditorViewModel.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ namespace AvaGui.ViewModels
1717
{
1818
public record HexAnnotationLine(string Address, string Data, int? SelectionStart, int? SelectionEnd);
1919

20+
public record AnimationSequence(string Name, int StartIndex, int EndIndex);
21+
2022
public class DatObjectEditorViewModel : ReactiveObject, ILocoFileViewModel
2123
{
2224
public ReactiveCommand<Unit, Unit> ReloadObjectCommand { get; init; }
@@ -29,6 +31,9 @@ public class DatObjectEditorViewModel : ReactiveObject, ILocoFileViewModel
2931
[Reactive]
3032
public IExtraContentViewModel? ExtraContentViewModel { get; set; }
3133

34+
[Reactive]
35+
public ObservableCollection<AnimationSequence> CurrentAnimations { get; set; }
36+
3237
ObjectEditorModel Model { get; init; }
3338

3439
[Reactive]
@@ -54,7 +59,6 @@ public class DatObjectEditorViewModel : ReactiveObject, ILocoFileViewModel
5459
public string SaveIcon => CurrentFile.FileLocation == FileLocation.Local ? "ContentSave" : "FileDownload";
5560
public string SaveAsIcon => CurrentFile.FileLocation == FileLocation.Local ? "ContentSavePlus" : "FileDownloadOutline";
5661

57-
5862
byte[] currentByteList;
5963

6064
Dictionary<string, (int Start, int End)> DATDumpAnnotationIdentifiers = [];

AvaGui/Views/MainWindow.axaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@
336336
</ItemsRepeater>
337337
</DockPanel>
338338
</TabItem>
339+
<TabItem Header="Animations" DataContext="{Binding CurrentAnimations}">
340+
341+
</TabItem>
339342
</TabControl>
340343
</StackPanel>
341344
</DataTemplate>

Dat/Objects/StreetLightObject.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,29 @@ namespace OpenLoco.Dat.Objects
1212
public record StreetLightObject(
1313
[property: LocoStructOffset(0x00), LocoString, Browsable(false)] string_id Name,
1414
[property: LocoStructOffset(0x02), LocoArrayLength(StreetLightObject.DesignedYearLength)] uint16_t[] DesignedYear
15-
) : ILocoStruct
15+
) : ILocoStruct, ILocoImageTableNames
1616
{
1717
public const int DesignedYearLength = 3;
1818

1919
public bool Validate() => true;
20+
21+
public bool TryGetImageName(int id, out string? value)
22+
=> ImageIdNameMap.TryGetValue(id, out value);
23+
24+
public static Dictionary<int, string> ImageIdNameMap = new()
25+
{
26+
{ 0, "style0NE" },
27+
{ 1, "style0SE" },
28+
{ 2, "style0SW" },
29+
{ 3, "style0NW" },
30+
{ 4, "style1NE" },
31+
{ 5, "style1SE" },
32+
{ 6, "style1SW" },
33+
{ 7, "style1NW" },
34+
{ 8, "style2NE" },
35+
{ 9, "style2SE" },
36+
{ 10, "style2SW" },
37+
{ 11, "style2NW" },
38+
};
2039
}
2140
}

Dat/Objects/TrackObject.cs

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -166,24 +166,24 @@ public bool Validate()
166166
// taken from OpenLoco TrackObject.h
167167
public static Dictionary<int, string> ImageIdNameMap = new()
168168
{
169-
{ 0, "previewImage0" },
170-
{ 1, "previewImage1" },
171-
{ 2, "previewImage2" },
172-
{ 3, "previewImage3" },
173-
{ 4, "previewImage4" },
174-
{ 5, "previewImage5" },
175-
{ 6, "previewImage6" },
176-
{ 7, "previewImage7" },
177-
{ 8, "previewImage8" },
178-
{ 9, "previewImage9" },
179-
{ 10, "previewImage10" },
180-
{ 11, "previewImage11" },
181-
{ 12, "previewImage12" },
182-
{ 13, "previewImage13" },
183-
{ 14, "previewImage14" },
184-
{ 15, "previewImage15" },
185-
{ 16, "pickupFromTrack" },
186-
{ 17, "placeOnTrack" },
169+
{ 0, "uiPreviewImage0" },
170+
{ 1, "uiPreviewImage1" },
171+
{ 2, "uiPreviewImage2" },
172+
{ 3, "uiPreviewImage3" },
173+
{ 4, "uiPreviewImage4" },
174+
{ 5, "uiPreviewImage5" },
175+
{ 6, "uiPreviewImage6" },
176+
{ 7, "uiPreviewImage7" },
177+
{ 8, "uiPreviewImage8" },
178+
{ 9, "uiPreviewImage9" },
179+
{ 10, "uiPreviewImage10" },
180+
{ 11, "uiPreviewImage11" },
181+
{ 12, "uiPreviewImage12" },
182+
{ 13, "uiPreviewImage13" },
183+
{ 14, "uiPreviewImage14" },
184+
{ 15, "uiPreviewImage15" },
185+
{ 16, "uiPickupFromTrack" },
186+
{ 17, "uiPlaceOnTrack" },
187187
//
188188
{ 18, "straight0BallastNE" },
189189
{ 19, "straight0BallastSE" },

0 commit comments

Comments
 (0)