Restore ADV wait indicator
This commit is contained in:
@@ -30,4 +30,27 @@ public class AdvTextOpsTests
|
||||
Assert.Equal((1, 75, 47), Assert.Single(host.TextCursors));
|
||||
Assert.Equal((13, 1, 1, "speaker"), Assert.Single(host.SurfaceStrings));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WaitIndicatorConfigurationReachesHost()
|
||||
{
|
||||
var table = OpcodeTableJson.Load(Paths.OpcodesJson);
|
||||
var script = ScriptAssembler.Assemble(table, "WAITMARK",
|
||||
new List<(int, Operand[])>
|
||||
{
|
||||
(0x73, new[]
|
||||
{
|
||||
new Operand(0, 1), new Operand(0, 385), new Operand(0, 140), new Operand(0, 12),
|
||||
new Operand(0, 0), new Operand(0, 0), new Operand(0, 30), new Operand(0, 27),
|
||||
new Operand(0, 12), new Operand(0, 48),
|
||||
}),
|
||||
(0x2, Array.Empty<Operand>()),
|
||||
}, Array.Empty<string>());
|
||||
var host = new RecordingHost();
|
||||
|
||||
new VirtualMachine(script, table, host).Run();
|
||||
|
||||
Assert.Equal(new Age.Engine.Hosting.AdvWaitIndicatorConfig(1, 385, 140, 12, 0, 0, 30, 27, 12, 48),
|
||||
Assert.Single(host.WaitIndicators));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ internal sealed class RecordingHost : IHost
|
||||
public readonly List<(int Offset, string Text)> Lines = new();
|
||||
public readonly List<(int Slot, int X, int Y)> TextCursors = new();
|
||||
public readonly List<(int Surface, int X, int Y, string Text)> SurfaceStrings = new();
|
||||
public readonly List<AdvWaitIndicatorConfig> WaitIndicators = new();
|
||||
public readonly List<long> SleptDurations = new();
|
||||
public readonly List<(long Resource, int Channel)> SfxLoads = new();
|
||||
public readonly List<int> SfxStarts = new();
|
||||
@@ -26,6 +27,7 @@ internal sealed class RecordingHost : IHost
|
||||
public void SetAdvTextCursor(int layoutSlot, int x, int y) => TextCursors.Add((layoutSlot, x, y));
|
||||
public void DrawStringToSurface(int surfaceSlot, int x, int y, string text)
|
||||
=> SurfaceStrings.Add((surfaceSlot, x, y, text));
|
||||
public void ConfigureAdvWaitIndicator(AdvWaitIndicatorConfig config) => WaitIndicators.Add(config);
|
||||
public void WaitForInput() => Waits++;
|
||||
public void Sleep(long duration) => SleptDurations.Add(duration);
|
||||
public void FrameYield() { }
|
||||
|
||||
Reference in New Issue
Block a user