Match Jimmy controller arithmetic and facing to original probes
This commit is contained in:
1 parent
42ea2b8cd5
commit
0e2f426d42
60 files changed
+6027
-48
No files matched your search
@@ -0,0 +1,18 @@
|
||||
using System.Text.Json;
|
||||
using GamePort.Game;
|
||||
using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-jump-reference.json")));
|
||||
int compared=0;
|
||||
foreach(var c in doc.RootElement.GetProperty("cases").EnumerateArray())
|
||||
{
|
||||
var p=c.GetProperty("input").EnumerateArray().ToArray();var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
|
||||
float F(int i)=>p[i].GetSingle();bool B(int i)=>F(i)!=0;
|
||||
var input=new JetpackBurstInput(B(3),B(4),F(5),F(6),(int)F(7),F(8),p[9].GetString()!,(int)F(10),F(11),F(12),B(13));
|
||||
var r=JetpackBurst.Step(new((int)F(0),F(1),F(2)),input);string name=c.GetProperty("name").GetString()!;
|
||||
Near(r.State.JumpState,o[0],name+" state");Near(r.State.HoldSeconds,o[1],name+" hold");Near(r.State.EffectRemaining,o[2],name+" timer");
|
||||
Near(r.ImpulseY,o[3],name+" impulse");Near(r.VelocityYOverride??input.VelocityY,o[4],name+" vertical");Near(r.ExtraAccelerationY,o[5],name+" acceleration");
|
||||
Near((int)r.Pose,o[6],name+" animation");Check(r.StartGadget==(o[7]!=0)&&r.StopGadget==(o[8]!=0),name+" effect calls");
|
||||
Near(r.RadiusOverride??60,o[9],name+" radius");Check(r.RadiusOverride.HasValue==(o[10]!=0),name+" radius write");compared++;
|
||||
}
|
||||
Check(compared==32,"complete native fixture");Console.WriteLine("PASS32 copied-original jump/hold/release/landing/jetpack suffix observations");
|
||||
static void Check(bool condition,string message){if(!condition)throw new Exception(message);}
|
||||
static void Near(float a,float b,string message)=>Check(MathF.Abs(a-b)<.0002f,$"{message}: {a} != {b}");
|
||||
Reference in new issue
Block a user