Reconstruct lab story, interactions, patrol and jet pack practice flow
This commit is contained in:
1 parent
58424120bb
commit
c929f942e1
84 files changed
+7957
-305
No files matched your search
@@ -17,6 +17,31 @@ foreach (var file in files)
|
||||
}
|
||||
Require(entities == 3299, "Original entity total differs");
|
||||
var initial = GamLevel.Load(Path.Combine(root, "gam/level1b.gam"));
|
||||
var saves = Directory.GetFiles(root, "*.tsk");
|
||||
Require(saves.Length == 12, "Expected original save corpus");
|
||||
foreach (var file in saves)
|
||||
{
|
||||
var raw = File.ReadAllBytes(file);
|
||||
var save = OriginalSave.Parse(raw);
|
||||
Require(save.Encode().SequenceEqual(raw), $"TSK byte round-trip differs: {file}");
|
||||
foreach (var length in new[] { 0, 4, 18, 16000, raw.Length - 1 }) RejectSave(raw[..length]);
|
||||
RejectSave([.. raw, 0]);
|
||||
}
|
||||
var newGame = OriginalSave.Load(Path.Combine(root, "NewGame.tsk"));
|
||||
Require(newGame.LevelCode == "LV1B" && newGame.StartPoint == "STARTEXP", "Wrong new-game resume data");
|
||||
var tasks = new TaskStates(newGame.Tasks);
|
||||
Require(tasks.Get("scene") == 30 && tasks.Get("missing") == 0, "Original task query semantics differ");
|
||||
var assignments = 0;
|
||||
tasks.Assigned += (_, _) => assignments++;
|
||||
tasks.SetExisting("ScEnE", 35);
|
||||
tasks.SetExisting("missing", 77);
|
||||
tasks.SetExisting("SCENE", 35);
|
||||
Require(tasks.Get("SCENE") == 35 && tasks.Get("missing") == 0 && tasks.Snapshot().Length == 12 && assignments == 3,
|
||||
"Task assignment must broadcast without creating missing entries");
|
||||
var changed = newGame with { Score = 15, Tasks = tasks.Snapshot() };
|
||||
Require(OriginalSave.Parse(changed.Encode()).Score == 15 && OriginalSave.Parse(changed.Encode()).Tasks[3].State == 35,
|
||||
"Modified original save did not persist recovered fields");
|
||||
Console.WriteLine("PASS: all12 original TSK files byte-round-trip, malformed saves reject, task query/assignment and mutations persist.");
|
||||
Require(initial.Code == "LV1B" && initial.Entities.Count == 129, "Wrong initial scene");
|
||||
Require(initial.Player!.Position.X == 5071.93310546875f, "Original player X changed");
|
||||
Require(initial.FindStart()!.CameraPosition.Y == 235.64761352539062f, "Original camera Y changed");
|
||||
@@ -113,6 +138,29 @@ foreach (var key in new[] { 31u, 32u, 33u })
|
||||
Require(clips.Select(30) && !clips.Current.HasVertexMotion, "Idle selection did not restore original still pose");
|
||||
Console.WriteLine($"PASS: original lab grounding (+{placement.VerticalCorrection:F3} Y), ceiling/proxy rejection, and explicit idle/run/jump/scratch selection.");
|
||||
|
||||
var preparedFixture = Path.Combine(Path.GetTempPath(), "neutron-bank-" + Guid.NewGuid().ToString("N"));
|
||||
Directory.CreateDirectory(preparedFixture);
|
||||
try
|
||||
{
|
||||
string WaveManifest(string name, string database, string payload)
|
||||
{
|
||||
File.WriteAllText(Path.Combine(preparedFixture, name + ".wav"), payload);
|
||||
var path = Path.Combine(preparedFixture, name + ".json");
|
||||
File.WriteAllText(path, System.Text.Json.JsonSerializer.Serialize(new { resources = new[] {
|
||||
new { database, type = "Wave", id = 59, path = name + ".wav", audio = new { seconds = 1.0 } } } }));
|
||||
return path;
|
||||
}
|
||||
var first = WaveManifest("scene", "omt/soundeffects.omt", "same-source-riff");
|
||||
var second = WaveManifest("bank", "SoundEffects.omt", "same-source-riff");
|
||||
var merged = new PreparedEntityResources(first, second);
|
||||
Require(merged.Wave("SOUNDEFFECTS.OMT", 59)?.Seconds == 1, "Explicit bank/scene identity did not merge");
|
||||
File.WriteAllText(Path.Combine(preparedFixture, "bank.wav"), "different-source-riff");
|
||||
try { _ = new PreparedEntityResources(first, second); throw new Exception("Conflicting audio identities accepted"); }
|
||||
catch (InvalidDataException) { }
|
||||
Console.WriteLine("PASS: explicit bank/scene resource merge accepts identical waves and rejects conflicting identities.");
|
||||
}
|
||||
finally { Directory.Delete(preparedFixture, true); }
|
||||
|
||||
static void Require(bool condition, string message)
|
||||
{
|
||||
if (!condition) throw new Exception(message);
|
||||
@@ -124,3 +172,10 @@ static void Reject(byte[] data)
|
||||
catch (InvalidDataException) { return; }
|
||||
throw new Exception("Malformed GAM was accepted");
|
||||
}
|
||||
|
||||
static void RejectSave(byte[] data)
|
||||
{
|
||||
try { OriginalSave.Parse(data); }
|
||||
catch (InvalidDataException) { return; }
|
||||
throw new Exception("Malformed TSK was accepted");
|
||||
}
|
||||
Reference in new issue
Block a user