Skip to content

Commit 355ec4c

Browse files
committed
add forgotten IsOriginal check
1 parent d2b2cd2 commit 355ec4c

File tree

3 files changed

+56
-3
lines changed

3 files changed

+56
-3
lines changed

AvaGui/ViewModels/DatTypes/DatObjectEditorViewModel.cs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using AvaGui.Models;
2+
using Avalonia.Media.Imaging;
23
using OpenLoco.Common.Logging;
34
using OpenLoco.Dat;
45
using OpenLoco.Dat.FileParsing;
@@ -17,7 +18,7 @@ namespace AvaGui.ViewModels
1718
{
1819
public record HexAnnotationLine(string Address, string Data, int? SelectionStart, int? SelectionEnd);
1920

20-
public record AnimationSequence(string Name, int StartIndex, int EndIndex);
21+
public record AnimationSequence(string Name, int StartIndex, int EndIndex, int CurrentFrame = 0);
2122

2223
public class DatObjectEditorViewModel : ReactiveObject, ILocoFileViewModel
2324
{
@@ -34,6 +35,24 @@ public class DatObjectEditorViewModel : ReactiveObject, ILocoFileViewModel
3435
[Reactive]
3536
public ObservableCollection<AnimationSequence> CurrentAnimations { get; set; }
3637

38+
public AnimationSequence CurrentAnimation => CurrentAnimations[0];
39+
40+
[Reactive]
41+
public int CurrentFrame { get; set; }
42+
43+
[Reactive]
44+
public Bitmap? CurrentAnimationFrame
45+
{
46+
get
47+
{
48+
if (ExtraContentViewModel is ImageTableViewModel itvm)
49+
{
50+
return itvm.Images[CurrentFrame];
51+
}
52+
return null;
53+
}
54+
}
55+
3756
ObjectEditorModel Model { get; init; }
3857

3958
[Reactive]
@@ -82,6 +101,9 @@ public DatObjectEditorViewModel(FileSystemItem currentFile, ObjectEditorModel mo
82101

83102
_ = this.WhenAnyValue(o => o.CurrentlySelectedHexAnnotation)
84103
.Subscribe(_ => UpdateHexDumpView());
104+
105+
_ = this.WhenAnyValue(o => o.CurrentFrame)
106+
.Subscribe(_ => this.RaisePropertyChanged(nameof(CurrentAnimationFrame)));
85107
}
86108

87109
public void UpdateHexDumpView()
@@ -125,11 +147,13 @@ public void LoadObject()
125147
var (treeView, annotationIdentifiers) = AnnotateFile(cf.Filename, false, null);
126148
CurrentHexAnnotations = new(treeView);
127149
DATDumpAnnotationIdentifiers = annotationIdentifiers;
150+
CurrentAnimations = [new AnimationSequence("Normal", 0, 63)];
128151
}
129152
else
130153
{
131154
StringTableViewModel = null;
132155
ExtraContentViewModel = null;
156+
CurrentAnimations = [];
133157
}
134158
}
135159
else

AvaGui/Views/MainWindow.axaml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,36 @@
336336
</ItemsRepeater>
337337
</DockPanel>
338338
</TabItem>
339-
<TabItem Header="Animations" DataContext="{Binding CurrentAnimations}">
339+
<TabItem Header="Animations">
340+
<StackPanel>
341+
<Slider Value="{Binding CurrentFrame}" Minimum="0" Maximum="63"/>
342+
<Image Source="{Binding CurrentAnimationFrame}" Stretch="None" />
343+
<TextBlock Text="{Binding CurrentFrame}"/>
344+
</StackPanel>
345+
<!--<ItemsRepeater ItemsSource="{Binding CurrentAnimations}" Background="{DynamicResource ButtonBackground}">
346+
<ItemsRepeater.ItemTemplate>
347+
<DataTemplate>
348+
<StackPanel>
349+
<Slider Value="{Binding CurrentFrame}" Minimum="{Binding StartIndex}" Maximum="{Binding EndIndex}"/>
350+
<Image Source="{Binding CurrentAnimationFrame}" />
351+
<TextBlock Text="{Binding CurrentFrame}"/>
352+
</StackPanel>
353+
-->
354+
<!--<Grid DockPanel.Dock="Left" Margin="4" x:DataType="vm:AnimationSequence">
355+
<Grid.ColumnDefinitions>
356+
<ColumnDefinition Width="Auto"/>
357+
<ColumnDefinition Width="*"/>
358+
</Grid.ColumnDefinitions>
359+
<Border Grid.Column="0" Grid.ColumnSpan="1" Background="{DynamicResource ButtonBackgroundPointerOver}">
360+
<TextBlock Text="{Binding Address}" VerticalAlignment="Center" Margin="4" FontFamily="Courier New" FontWeight="Bold" />
361+
362+
</Border>
363+
<SelectableTextBlock Grid.Column="1" Margin="4" Text="{Binding Data}" VerticalAlignment="Center" FontFamily="Courier New" SelectionStart="{Binding SelectionStart}" SelectionEnd="{Binding SelectionEnd}" />
364+
</Grid>-->
365+
<!--
366+
</DataTemplate>
367+
</ItemsRepeater.ItemTemplate>
368+
</ItemsRepeater>-->
340369

341370
</TabItem>
342371
</TabControl>

Dat/FileParsing/SawyerStreamReader.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static void ValidateLocoStruct(S5Header s5Header, ILocoStruct locoStruct, ILogge
183183
if (s5Header.SourceGame == SourceGame.Vanilla)
184184
{
185185
var s5Name = s5Header.Name;
186-
if (!OriginalObjectFiles.Names.TryGetValue(s5Name, out var value) || s5Header.Checksum != value.SteamChecksum || s5Header.Checksum != value.GoGChecksum)
186+
if (!s5Header.IsOriginal())
187187
{
188188
warnings.Add($"\"{s5Header.Name}\" is not a vanilla object but is marked as such.");
189189
}

0 commit comments

Comments
 (0)