using System.Numerics; using GamePort.Assets; using GamePort.Game; using GamePort.Application; var original=Path.GetFullPath(args.Length==1?args[0]:"../Original"); var prepared=Path.GetFullPath("artifacts/extracted"); var standing=AseMesh.Load(AssetPath.Resolve(original,"ASE/jimstop.ase")); var floor=new Mesh(new[]{new Vector3(-10000,0,-10000),new Vector3(-10000,0,10000),new Vector3(10000,0,10000),new Vector3(10000,0,-10000)} .Select(p=>new MeshVertex(p,Vector2.Zero,Vector3.One)).ToArray(),[0,1,2,0,2,3]); LabSimulation Player()=>new(new(floor),standing,new Vector3(0,20,0),0); foreach(var left in new[]{true,false}) { var p=Player();var input=new PlayerInput(false,false,left,!left,false); for(int i=0;i<20;i++)p.Step(input); Check(p.Speed==0&&p.Grounded&&p.Pose==(left?PlayerPose.TurnLeft:PlayerPose.TurnRight),"standing turn selects directional clip"); var clips=new PreviewAnimationLibrary(Path.Combine(prepared,"animations/jimstop/animation.json")); Check(clips.SelectPose(p.Pose)&&clips.Current.HasVertexMotion&&clips.Current.FrameCount==6,"original six-frame turn clip is loaded"); var first=new MeshVertex[clips.Current.Base.Vertices.Length];var next=new MeshVertex[first.Length]; clips.Current.Sample(0,first,Matrix4x4.Identity);clips.Current.Sample(clips.Current.SampleInterval,next,Matrix4x4.Identity); Check(first.Where((v,i)=>v.Position!=next[i].Position).Any(),"turn clip advances instead of holding a static pose"); Check(!clips.SelectPose(p.Pose),"holding turn does not restart its animation every step"); Check(clips.SelectAction(left?"RIGHT":"LEFT"),"authored turn action maps to original family"); p.Step(default);Check(p.Pose==PlayerPose.Idle,"release leaves standing turn"); for(int i=0;i<20;i++)p.Step(input with{Forward=true}); Check(p.Pose==PlayerPose.Run,"forward turning keeps the run cycle"); p.Step(input with{Jump=true});Check(p.Pose==PlayerPose.Jump,"takeoff overrides ground turn"); } var both=Player();both.Step(new(false,false,true,true,false));Check(both.Pose==PlayerPose.TurnLeft,"left input wins"); var primary=Player();primary.Step(new(false,false,true,false,false,Fire:true));Check(primary.Pose!=PlayerPose.TurnLeft,"primary input suppresses a new turn pose"); primary.SetShooting(true);Check(primary.Pose==PlayerPose.Shoot,"active shot owns its pose"); Console.WriteLine("PASS source directional turn selection, six-frame motion, hold/release, run/jump/primary precedence and authored actions"); var owner=Player();owner.LevelCode="VR04"; Check(owner.ApplyRetainedLevelState(new("LV1B",3,1,.625f,6.125f)),"powered effect fixture"); owner.RestoreReturnRoot(owner.ActorRoot+Vector3.UnitY*400); var visuals=new JetpackVisuals(new Mesh([],[]),prepared); var clip=new MorphAnimation(Path.Combine(prepared,"actors/jetpack/fire/animation.json")); foreach(var rotation in new[]{new Vector3(-35,65,-20),new Vector3(15,220,25),new Vector3(0,359,0)}) { owner.ApplyAuthoredTransform(owner.ActorRoot+new Vector3(10,5,-7),rotation); owner.Step(default,controlled:false); visuals.Update(visuals.Mesh,owner); Check(visuals.Mesh.Draws[^1].Visible&&owner.JetpackEffectVisible,"active effect remains visible"); var expected=new MeshVertex[clip.Base.Vertices.Length];clip.Sample(owner.Steps/60d,expected,owner.Model); for(int i=0;i