Restore turning clips and attach jetpack fire to full player transform
This commit is contained in:
1 parent
fafb54730a
commit
f0be8504dd
14 files changed
+362
-9
No files matched your search
@@ -0,0 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><EnableDefaultCompileItems>false</EnableDefaultCompileItems></PropertyGroup>
|
||||
<ItemGroup><Compile Include="Program.cs"/><Compile Include="../../src/GamePort/Assets/*.cs"/><Compile Include="../../src/GamePort/Game/*.cs"/>
|
||||
<Compile Include="../../src/GamePort/Application/PreviewAnimationLibrary.cs"/>
|
||||
<Compile Include="../../src/GamePort/Application/JetpackVisuals.cs"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,54 @@
|
||||
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<expected.Length;i++)Check(Vector3.Distance(expected[i].Position,visuals.Mesh.Vertices[i].Position)<.0001f,
|
||||
"flame shares Jimmy's full visual frame, including pitch/roll and local compatibility alignment");
|
||||
Check(MathF.Abs(owner.Model.GetDeterminant()-1)<.00001f,"attachment rotation cannot scale the flame");
|
||||
}
|
||||
owner.Reset();visuals.Update(visuals.Mesh,owner);
|
||||
Check(!visuals.Mesh.Draws[^1].Visible,"reset/inactive effect stays hidden");
|
||||
Console.WriteLine("PASS original flame geometry follows combined pitch/yaw/roll, translation and owner visibility without scaling");
|
||||
static void Check(bool ok,string name){if(!ok)throw new Exception(name);}
|
||||
Reference in new issue
Block a user