Implement original gadget panel and playable shrink ray
This commit is contained in:
1 parent
0272f7bef7
commit
7b5230ceb8
57 files changed
+3545
-48
No files matched your search
@@ -0,0 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks><EnableDefaultCompileItems>false</EnableDefaultCompileItems>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="../../src/GamePort/Assets/Mesh.cs" />
|
||||
<Compile Include="../../src/GamePort/Assets/PngImage.cs" />
|
||||
<Compile Include="../../src/GamePort/Platform/Sdl.cs" />
|
||||
<Compile Include="../../src/GamePort/Rendering/Vulkan/VulkanRenderer.cs" />
|
||||
<PackageReference Include="Silk.NET.Vulkan" Version="2.23.0" />
|
||||
<PackageReference Include="Silk.NET.Vulkan.Extensions.KHR" Version="2.23.0" />
|
||||
<PackageReference Include="Silk.NET.Vulkan.Extensions.EXT" Version="2.23.0" />
|
||||
<Content Include="../../src/GamePort/Rendering/Shaders/*.spv" CopyToOutputDirectory="PreserveNewest" Link="Shaders/%(Filename)%(Extension)" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,85 @@
|
||||
using System.Numerics;
|
||||
using GamePort.Assets;
|
||||
using GamePort.Rendering.Vulkan;
|
||||
|
||||
// These tests read back actual Vulkan color attachments. No window or original
|
||||
// executable is needed. The source-linked project avoids rebuilding GamePort.
|
||||
var white=PngImage.White;
|
||||
var count=0;
|
||||
using var renderer=new VulkanRenderer(Scene(new Layer(Vector3.UnitZ,.8f)),white,64,64,validation:true);
|
||||
Console.WriteLine($"Blend test GPU: {renderer.DeviceName}");
|
||||
|
||||
Check("opaque default",Scene(new Layer(Vector3.UnitX,.4f)),255,0,0);
|
||||
Check("alpha half opacity",Scene(new(Vector3.UnitX,.4f,MeshBlend.Alpha,.5f),new(Vector3.UnitZ,.8f)),128,0,128);
|
||||
Check("additive half opacity",Scene(new(Vector3.UnitX,.4f,MeshBlend.Additive,.5f),new(Vector3.UnitZ,.8f)),128,0,255);
|
||||
Check("opaque depth occludes blend",Scene(new(Vector3.UnitX,.4f,MeshBlend.Alpha,.5f),new(Vector3.UnitZ,.2f)),0,0,255);
|
||||
Check("blend does not write depth",Scene(new(Vector3.UnitX,.2f,MeshBlend.Alpha,.5f),new(Vector3.UnitY,.4f,MeshBlend.Alpha,.5f),new(Vector3.UnitZ,.8f)),64,128,64);
|
||||
Check("UI follows blended world",Scene(new(Vector3.UnitY,.9f,Screen:true),new(Vector3.UnitX,.4f,MeshBlend.Additive,.5f),new(Vector3.UnitZ,.8f)),0,255,0);
|
||||
Check("UI alpha ignores depth",Scene(new(Vector3.UnitX,.9f,MeshBlend.Alpha,.5f,true),new(Vector3.UnitZ,.2f)),128,0,128);
|
||||
Check("UI additive ignores depth",Scene(new(Vector3.UnitX,.9f,MeshBlend.Additive,.5f,true),new(Vector3.UnitZ,.2f)),128,0,255);
|
||||
Check("zero opacity",Scene(new(Vector3.UnitX,.4f,MeshBlend.Alpha,0),new(Vector3.UnitZ,.8f)),0,0,255);
|
||||
|
||||
// Texture coverage is tested before material opacity: a solid texture at .5
|
||||
// opacity must draw, while a cutout remains absent even at full opacity.
|
||||
var cutout=Scene(new(Vector3.UnitX,.4f,MeshBlend.Alpha,.5f),new(Vector3.UnitZ,.8f));
|
||||
cutout.Draws[0]=cutout.Draws[0] with {TextureId=7};
|
||||
cutout.Textures[7]=new PngImage(1,1,[255,255,255,0]);
|
||||
Check("texture cutout unchanged",cutout,0,0,255);
|
||||
|
||||
var invalid=Scene(new Layer(Vector3.UnitX,.4f));
|
||||
renderer.ReplaceScene(invalid,white);
|
||||
foreach(var opacity in new[]{float.NaN,float.PositiveInfinity,-.01f,1.01f})
|
||||
{
|
||||
invalid.Draws[0].Opacity=opacity;
|
||||
Throws("invalid mutable opacity",()=>renderer.Render(Matrix4x4.Identity));
|
||||
}
|
||||
invalid.Draws[0].Opacity=1;
|
||||
invalid.Draws[0].Blend=(MeshBlend)99;
|
||||
invalid.Draws[0].Visible=false;
|
||||
Throws("invalid hidden blend",()=>renderer.Render(Matrix4x4.Identity));
|
||||
Throws("replacement rejects invalid blend",()=>renderer.ReplaceScene(invalid,white));
|
||||
invalid.Draws[0].Blend=MeshBlend.Opaque;
|
||||
invalid.Draws[0].Visible=true;
|
||||
renderer.Render(Matrix4x4.Identity);
|
||||
AssertPixel("renderer usable after rejected state",255,0,0);
|
||||
if(renderer.ValidationErrors!=0)throw new Exception($"Vulkan reported {renderer.ValidationErrors} validation errors.");
|
||||
if(args.Length>0)renderer.SavePpm(args[0]);
|
||||
Console.WriteLine($"PASS: {count} Vulkan material/readback checks; validation errors: {renderer.ValidationErrors}.");
|
||||
|
||||
void Check(string name,Mesh scene,int r,int g,int b)
|
||||
{
|
||||
renderer.ReplaceScene(scene,white);
|
||||
renderer.Render(Matrix4x4.Identity);
|
||||
AssertPixel(name,r,g,b);
|
||||
}
|
||||
void AssertPixel(string name,int r,int g,int b)
|
||||
{
|
||||
var pixels=renderer.ReadPixels();
|
||||
var offset=(32*64+32)*4;
|
||||
var expected=new[]{r,g,b};
|
||||
for(var channel=0;channel<3;channel++)
|
||||
if(Math.Abs(pixels[offset+channel]-expected[channel])>2)
|
||||
throw new Exception($"{name}: expected ({r},{g},{b}), got ({pixels[offset]},{pixels[offset+1]},{pixels[offset+2]}).");
|
||||
count++;
|
||||
Console.WriteLine($"PASS: {name}");
|
||||
}
|
||||
void Throws(string name,Action action)
|
||||
{
|
||||
try {action();}
|
||||
catch(ArgumentException){count++;Console.WriteLine($"PASS: {name}");return;}
|
||||
throw new Exception($"{name}: expected ArgumentException.");
|
||||
}
|
||||
static Mesh Scene(params Layer[] layers)
|
||||
{
|
||||
var vertices=new List<MeshVertex>();var indices=new List<uint>();var draws=new List<MeshDraw>();
|
||||
foreach(var layer in layers)
|
||||
{
|
||||
uint start=(uint)vertices.Count,first=(uint)indices.Count;
|
||||
foreach(var xy in new[]{new Vector2(-1,-1),new Vector2(1,-1),new Vector2(1,1),new Vector2(-1,1)})
|
||||
vertices.Add(new MeshVertex(new Vector3(xy,layer.Z),new Vector2(.5f),layer.Color));
|
||||
indices.AddRange(new[]{start,start+1,start+2,start+2,start+3,start});
|
||||
draws.Add(new MeshDraw(first,6,-1){Blend=layer.Blend,Opacity=layer.Opacity,ScreenSpace=layer.Screen});
|
||||
}
|
||||
return new Mesh(vertices.ToArray(),indices.ToArray()){HasExplicitDraws=true,Draws=draws.ToArray()};
|
||||
}
|
||||
readonly record struct Layer(Vector3 Color,float Z,MeshBlend Blend=MeshBlend.Opaque,float Opacity=1,bool Screen=false);
|
||||
@@ -0,0 +1,12 @@
|
||||
<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/UiViewport.cs" />
|
||||
<Compile Include="../../src/GamePort/Application/GadgetMenuOverlay.cs" />
|
||||
<Compile Include="../../src/GamePort/Application/ShrinkRayVisuals.cs" />
|
||||
<Compile Include="../../src/GamePort/Application/ShrinkSoldierVisuals.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,179 @@
|
||||
using System.Numerics;
|
||||
using GamePort.Assets;
|
||||
using GamePort.Game;
|
||||
using GamePort.Application;
|
||||
|
||||
void Check(bool value,string message) { if(!value)throw new Exception(message); }
|
||||
var count=0;
|
||||
void Test(string name,Action action) {action();count++;Console.WriteLine($"PASS {name}");}
|
||||
SceneInventory Inventory() {var values=new int[19];values[3]=1;return new(values);}
|
||||
Test("source control gate and combined default device",()=>{
|
||||
var inventory=Inventory();inventory.SelectGadget(3);
|
||||
var screen=new GadgetScreen(inventory);
|
||||
Check(GadgetScreen.EquippedMode(3)==-1,"display3 must not become equipped mode3");
|
||||
Check(!screen.Toggle(false)&&!screen.Open,"script ownership prohibits opening");
|
||||
Check(screen.Toggle(true)&&screen.Open,"owned default device opens on first Tab");
|
||||
screen.Toggle(true);Check(!screen.Open,"open panel closes on Tab");
|
||||
});
|
||||
Test("strict original card bounds and raw ownership",()=>{
|
||||
var inventory=Inventory();var screen=new GadgetScreen(inventory);screen.Toggle(true);
|
||||
foreach(var p in new[]{new Vector2(157,380),new(298,380),new(200,327),new(200,468)})
|
||||
{screen.Point(p,"LV1B",60);Check(screen.Hovered==-1,"exact tile boundary must miss");}
|
||||
screen.Point(new(200,380),"LV1B",60);Check(screen.Hovered==3,"owned shrink/jetpack tile hits");
|
||||
inventory.SetState(0,3,4);screen.Point(new(200,380),"LV1B",60);
|
||||
Check(screen.Hovered==-1,"unavailable ownership must not select");
|
||||
inventory.SetState(0,3,3);screen.Point(new(200,380),"LV1B",60);
|
||||
Check(screen.Hovered==3&&!screen.Canvases("LV1B",60).Any(c=>c.Id==14),"raw3 hits without green hover");
|
||||
});
|
||||
Test("original background and white/green owned art",()=>{
|
||||
var screen=new GadgetScreen(Inventory());screen.Toggle(true);
|
||||
Check(screen.Canvases("LV1B",60).Select(c=>c.Id).SequenceEqual(new[]{20,48,182,180}),"unowned art remains base grey");
|
||||
screen.Point(new(200,380),"LV1B",60);
|
||||
Check(screen.Canvases("LV1B",60).Any(c=>c.Id==14)&&!screen.Canvases("LV1B",60).Any(c=>c.Id==48),"green selected by hover");
|
||||
});
|
||||
Test("Return closes without selecting or leaving practice armed",()=>{
|
||||
var inventory=Inventory();var screen=new GadgetScreen(inventory);screen.Toggle(true);
|
||||
screen.Point(new(520,120),"LV1B",60);screen.Activate("LV1B",60);
|
||||
Check(screen.PracticeArmed,"Practice arms on click");
|
||||
screen.Point(new(50,120),"LV1B",60);screen.Activate("LV1B",60);
|
||||
Check(!screen.Open&&!screen.PracticeArmed&&inventory.SelectedGadget==-1,"Return closes/disarms only");
|
||||
});
|
||||
Test("armed gadget choice requests direct original tutorial",()=>{
|
||||
var inventory=Inventory();var screen=new GadgetScreen(inventory);var chosen=-1;
|
||||
var selectedAfterClose=false;inventory.GadgetSelected+=_=>selectedAfterClose=!screen.Open;
|
||||
screen.PracticeRequested+=i=>chosen=i;screen.Toggle(true);
|
||||
screen.Point(new(520,120),"LV1B",60);screen.Activate("LV1B",60);
|
||||
screen.Point(new(200,380),"LV1B",60);screen.Activate("LV1B",60);
|
||||
Check(chosen==3&&!screen.Open&&inventory.SelectedGadget==3&&selectedAfterClose,"source close-before-selection/direct item3→VR04");
|
||||
screen.Toggle(true);screen.Point(new(520,120),"VR04",60);
|
||||
Check(screen.Hovered==-1,"tutorial cannot recursively arm practice");
|
||||
screen.Point(new(520,120),"LV1B",500);Check(screen.Hovered==-1,"scene500 blocks practice toggle");
|
||||
});
|
||||
Test("special equipped mode unequips before next Tab opens",()=>{
|
||||
var inventory=Inventory();inventory.SetState(0,0,1);inventory.SelectGadget(0);
|
||||
var screen=new GadgetScreen(inventory);screen.Toggle(true);
|
||||
Check(!screen.Open&&inventory.SelectedGadget==-1,"first Tab unequips");
|
||||
screen.Toggle(true);Check(screen.Open,"second Tab opens");
|
||||
});
|
||||
Test("real54-canvas overlay scales uniformly and preserves world",()=>{
|
||||
var screen=new GadgetScreen(Inventory());screen.Toggle(true);screen.Point(new(200,380),"LV1B",60);
|
||||
var world=new Mesh([new(new(1,2,3),Vector2.Zero,Vector3.One)],[0,0,0])
|
||||
{Textures=new(){[int.MinValue]=PngImage.White},HasCollisionMaterialIds=true};
|
||||
var overlay=new GadgetMenuOverlay(world,"artifacts/extracted/gadgets/gadgets.json");
|
||||
Check(overlay.Mesh.Vertices.Length==217&&overlay.Mesh.Textures.Count==55,"bounded original resources and unique texture IDs");
|
||||
var final=overlay.Mesh with {Vertices=overlay.Mesh.Vertices.ToArray(),Draws=overlay.Mesh.Draws.Select(d=>d with{}).ToArray()};
|
||||
foreach(var (width,height) in new[]{(1920u,1080u),(3440u,1440u),(1280u,1024u)})
|
||||
{
|
||||
overlay.Update(final,screen.Canvases("LV1B",60),width,height);
|
||||
Check(final.Vertices[0].Position==new Vector3(1,2,3),"world vertices unchanged");
|
||||
var a=final.Vertices[1].Position;var b=final.Vertices[3].Position;
|
||||
var pixelsX=(b.X-a.X)*width/2;var pixelsY=(b.Y-a.Y)*height/2;
|
||||
Check(MathF.Abs(pixelsX/pixelsY-640f/480)<.00001f,"original panel aspect ratio");
|
||||
Check(final.Draws.Count(d=>d.ScreenSpace&&d.Visible)==4,"only source menu ranges visible");
|
||||
var view=new UiViewport(width,height);var reference=new Vector2(200,380);
|
||||
var ndc=view.ToNdc(reference+view.CenterOffset);
|
||||
var point=view.InverseModal(new((ndc.X+1)*width/2,(ndc.Y+1)*height/2));
|
||||
screen.Point(point,"LV1B",60);Check(screen.Hovered==3,"render and hit mapping agree");
|
||||
}
|
||||
overlay.Update(final,[],1920,1080);Check(final.Draws.Skip(1).All(d=>!d.Visible),"closing hides all gadget art");
|
||||
});
|
||||
Test("original menu pointer accumulation and neutral reset",()=>{
|
||||
var screen=new GadgetScreen(Inventory());screen.Toggle(true);
|
||||
var p=screen.MovePointer(new(200,200),Vector2.UnitX,.25f);
|
||||
Check(p==new Vector2(220,200),"source80*dt pointer offset");
|
||||
p=screen.MovePointer(p,Vector2.UnitX,.25f);Check(p==new Vector2(260,200),"held axis accumulates offset");
|
||||
Check(screen.MovePointer(p,Vector2.Zero,.25f)==p,"neutral discards accumulated axis");
|
||||
});
|
||||
Test("ray texture phase float/double boundary and discarded overshoot",()=>{
|
||||
var ray=new ShrinkRay();ray.StepTexture(.1f);Check(ray.TexturePhase==1,"float.1 exceeds source double.1");
|
||||
ray.StepTexture(.35f);Check(ray.TexturePhase==2,"one phase per invocation, no catchup");
|
||||
ray.StepTexture(.1f);Check(ray.TexturePhase==0,"three source texture slots wrap");
|
||||
ray.Reset();ray.StepTexture(.099f);Check(ray.TexturePhase==0,"below source boundary");
|
||||
});
|
||||
Test("continuous source target gates and no angle seam wrap",()=>{
|
||||
var ray=new ShrinkRay();SupportHit? Clear(Vector3 a,Vector3 b)=>null;
|
||||
var targets=new[]{new ShrinkCandidate("valid",new(0,0,1000)),new("body-off",new(0,0,800),false),
|
||||
new("immune",new(0,0,800),ShrinkEnabled:false),new("already",new(0,0,800),Shrunk:true),
|
||||
new("range",new(0,0,1500)),new("high",new(0,60,800)),new("low",new(0,-150,800)),
|
||||
new("seam",new(1,0,1000)),new("near-zero",new(-1,0,1000)),new("last",new(0,0,900))};
|
||||
Check(ray.Fire(Vector3.Zero,0,1f/60,targets,Clear).SequenceEqual(new[]{"valid","near-zero","last"}),
|
||||
"source eligibility, strict range/height and input-order multi-hit");
|
||||
Check(ray.Fire(Vector3.Zero,0,1f/60,targets,(a,b)=>new(Vector3.Zero,0,0,0)).Count==0,"any accepted static hit blocks");
|
||||
var angle=OriginalHeading.Degrees(new(-1,0,1000));
|
||||
Check(ray.Fire(Vector3.Zero,angle-5,1f/60,[new("edge",new(-1,0,1000))],Clear).Count==0,"exact yaw+5 is excluded");
|
||||
});
|
||||
var original=Path.GetFullPath("../Original");
|
||||
var level=GamLevel.Load(AssetPath.Resolve(original,"gam/VR04.gam"));
|
||||
var save=OriginalSave.Load(AssetPath.Resolve(original,"NewGame.tsk"));
|
||||
Test("actual soldier shrink mode and strict timer expiry",()=>{
|
||||
var director=new SceneDirector(level,new(save.Tasks),(_,_)=>0);
|
||||
var actor=director.Actors.First(a=>a.Kind=="3SOL");var old=actor.AIstate;
|
||||
var soldier=new ShrinkSoldier(actor);soldier.Shrink();
|
||||
Check(actor.Animation=="SHRINK"&&actor.AIstate==5&&soldier.Remaining==30,"source target callback state");
|
||||
for(var i=0;i<40;i++)soldier.StepTimer(.75f);
|
||||
Check(soldier.Remaining==0&&soldier.Shrunk,"exact source timer0 does not expire");
|
||||
soldier.StepTimer(.1f);Check(soldier.Shrunk,"timer0 skips future positive-only countdown");
|
||||
soldier.Reset();actor.AIstate=7;soldier.Shrink();
|
||||
Check(soldier.PreviousMode==7&&soldier.AuthoredMode==old,"authored AIState is distinct from previous dynamic mode");
|
||||
for(var i=0;i<34;i++)soldier.StepTimer(.9f);
|
||||
Check(!soldier.Shrunk&&actor.Animation=="WALK"&&actor.AIstate==old&&actor.Speed==200,"negative crossing restores authored mode/WALK");
|
||||
});
|
||||
Test("source shrink morph reaches and holds authored endpoint",()=>{
|
||||
var director=new SceneDirector(level,new(save.Tasks),(_,_)=>0);
|
||||
var soldier=new ShrinkSoldier(director.Actors.First(a=>a.Kind=="3SOL"));
|
||||
var scene=new Mesh([],[]);var visuals=new ShrinkSoldierVisuals(scene,[soldier],"artifacts/extracted","VR04");
|
||||
soldier.Shrink();visuals.Update(1,visuals.Mesh);
|
||||
var height=visuals.RenderedHeight(soldier.Actor.Tag,visuals.Mesh);
|
||||
Check(MathF.Abs(height-55.1186f)<.002f,"authored last shrink frame, no invented uniformscale");
|
||||
visuals.Update(5,visuals.Mesh);Check(visuals.RenderedHeight(soldier.Actor.Tag,visuals.Mesh)==height,"nonloop endpoint stays small");
|
||||
});
|
||||
Test("ordinary primary fire, energy, sound transitions and release",()=>{
|
||||
var lab=GamLevel.Load(AssetPath.Resolve(original,"gam/level1b.gam"));var start=lab.FindStart()!;
|
||||
var world=Mesh.LoadSceneJson("artifacts/extracted/level1b/scene.json");
|
||||
var player=new LabSimulation(new(world),AseMesh.Load(AssetPath.Resolve(original,"ASE/jimstop.ase")),start.Position,start.Rotation.Y);
|
||||
var director=new SceneDirector(lab,new(save.Tasks),(_,_)=>0);
|
||||
var inventory=Inventory();using var gadgets=new SceneGadgets(director,inventory,player,world);
|
||||
var loops=0;var stops=0;var clicks=0;
|
||||
gadgets.Sound+=(id,loop)=>{if(id==0&&loop)loops++;if(id==117)clicks++;};gadgets.StopSound+=()=>stops++;
|
||||
player.Step(new(true,false,false,false,false,Fire:true));
|
||||
Check(gadgets.Ray.Visible&&player.Shooting&&player.Speed==0&&player.Velocity.X==0&&player.Velocity.Z==0,"grounded fire stops controller movement before apply");
|
||||
Check(MathF.Abs(player.Energy-(20-1f/60))<.0001f&&loops==1,"held beam charges once even without target");
|
||||
player.Step(new(false,false,false,false,false,Fire:true));Check(loops==1,"owned loop is not restarted every tick");
|
||||
player.Step(default);Check(!gadgets.Ray.Visible&&!player.Shooting&&stops==1,"release hides/stops effect");
|
||||
inventory.SetState(0,3,0);player.Step(new(false,false,false,false,false,Fire:true));
|
||||
player.Step(new(false,false,false,false,false,Fire:true));Check(clicks==1,"dry click latches until release");
|
||||
});
|
||||
Test("ray visual uses original geometry and single half-opacity additive material",()=>{
|
||||
var visuals=new ShrinkRayVisuals(new Mesh([],[]),"artifacts/extracted",original);var ray=new ShrinkRay();
|
||||
ray.Fire(Vector3.Zero,0,1f/60,[],(a,b)=>null);visuals.Update(visuals.Mesh,ray,0);
|
||||
Check(visuals.Mesh.Vertices.Length==9&&visuals.Mesh.Indices.Length==9
|
||||
&& visuals.Mesh.Vertices.Select(v=>v.Position).Distinct().Count()==5,"original five source vertices expanded by UV corners");
|
||||
var beamDraws=visuals.Mesh.Draws.Where(d=>d.IndexCount!=0).ToArray();
|
||||
Check(beamDraws.Count(d=>d.Visible)==1&&beamDraws.All(d=>d.Opacity==.5f&&d.Blend==MeshBlend.Additive),"source alpha replaces once and one texture phase renders");
|
||||
ray.Hide();visuals.Update(visuals.Mesh,ray,0);Check(beamDraws.All(d=>!d.Visible),"release hides all phases");
|
||||
});
|
||||
Test("ordinary hit score order, repeated-hit guard and original save persistence",()=>{
|
||||
//Explicit synthetic floor for deterministic actor settling; actual original
|
||||
//VR04 soldier records are used, never substituted into the playable level.
|
||||
var floor=new Mesh([new(new(-10000,0,-10000),Vector2.Zero,Vector3.One),
|
||||
new(new(10000,0,-10000),Vector2.Zero,Vector3.One),new(new(0,0,10000),Vector2.Zero,Vector3.One)],[0,1,2])
|
||||
{CollisionPolygons=[new(0,0,Vector3.UnitY,null)],HasCollisionMaterialIds=true};
|
||||
var director=new SceneDirector(level,new(save.Tasks),(_,_)=>0);
|
||||
var interactions=new SceneInteractions(director,new(save.Tasks),save);
|
||||
interactions.Inventory.SetState(0,3,1);
|
||||
var player=new LabSimulation(new(floor),AseMesh.Load(AssetPath.Resolve(original,"ASE/jimstop.ase")),Vector3.Zero,0,
|
||||
originalCollision:OriginalStaticCollision.FromRouteScene(floor,"VR04")){LevelCode="VR04"};
|
||||
using var gadgets=new SceneGadgets(director,interactions.Inventory,player,floor);
|
||||
for(var i=0;i<600;i++)gadgets.StepBodies(1f/60);
|
||||
var target=gadgets.Soldiers[0];
|
||||
player.ApplyAuthoredTransform(new(target.Actor.Position.X,75.9f,target.Actor.Position.Z-500),0);
|
||||
var observed=false;
|
||||
gadgets.ScoreAwarded+=points=>{observed=points==10&&target.Shrunk&&target.Actor.AIstate==5&&target.HitMarker==0;interactions.ChangeScore(points);};
|
||||
player.Step(new(false,false,false,false,false,Fire:true));
|
||||
Check(observed&&target.HitMarker==1&&interactions.Score==save.Score+10,"source score callback follows shrink and precedes94C marker");
|
||||
for(var i=0;i<10;i++)player.Step(new(false,false,false,false,false,Fire:true));
|
||||
Check(interactions.Score==save.Score+10&&gadgets.ShrinkHits==1,"already-shrunk flag prevents repeated awards");
|
||||
Check(OriginalSave.Parse(interactions.Snapshot().Encode()).Score==save.Score+10,"source-format save preserves gadget reward");
|
||||
Check(player.Energy==20,"original VR energy exemption also applies to primary fire");
|
||||
});
|
||||
Console.WriteLine($"Gadgets:{count} groups passed; other gadget effects and complete enemy AI remain separate.");
|
||||
@@ -0,0 +1,13 @@
|
||||
<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/Game/OriginalHeading.cs" Link="OriginalHeading.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,47 @@
|
||||
using System.Numerics;
|
||||
using GamePort.Game;
|
||||
|
||||
// Source vector::angles cardinal/quadrant results, plus copied-DLL references.
|
||||
var samples = new (Vector3 Direction, int Units)[]
|
||||
{
|
||||
(Vector3.Zero, 0), (Vector3.UnitZ, 0), (-Vector3.UnitX, 4096),
|
||||
(-Vector3.UnitZ, 8192), (Vector3.UnitX, 12288),
|
||||
(new(-1, 0, 1), 2048), (new(-1, 0, -1), 6144),
|
||||
(new(1, 0, -1), 10240), (new(1, 0, 1), 14336),
|
||||
(new(1, 100, 1000), 16364), (new(-1, -100, 1000), 20),
|
||||
(new(1000, 0, 1), 12288), (new(-1000, 0, 1), 4096),
|
||||
(new(.1234567f, 88, .7654321f), 15967), (new(-99.1f, -20, 15.7f), 3686),
|
||||
};
|
||||
foreach (var (direction, units) in samples)
|
||||
{
|
||||
float actual = OriginalHeading.Degrees(direction);
|
||||
if (actual != units * 0.02197265625f)
|
||||
throw new Exception($"Heading {direction}: expected {units} units, got {actual} degrees");
|
||||
}
|
||||
foreach (var bad in new[] { new Vector3(float.NaN, 0, 1), new Vector3(0, float.PositiveInfinity, 1) })
|
||||
{
|
||||
try { OriginalHeading.Degrees(bad); throw new Exception("Nonfinite vector accepted"); }
|
||||
catch (ArgumentOutOfRangeException) { }
|
||||
}
|
||||
// A seam-crossing near-forward direction remains near360; the caller performs
|
||||
// the original strict comparisons against Jimmy's EulerY without wrapping.
|
||||
float seam = OriginalHeading.Degrees(new Vector3(1, 0, 1000));
|
||||
if (seam is not (> 355 and < 360)) throw new Exception("Heading seam normalized away");
|
||||
if (-5 < seam && seam < 5) throw new Exception("Source seam comparison changed");
|
||||
uint hash = 2166136261;
|
||||
int cases = 0;
|
||||
for (int i = 0; i <= 16384; i++)
|
||||
{
|
||||
float a = (float)Math.Sqrt((i + .25) / 16384.5);
|
||||
float b = (float)Math.Sqrt(1 - (i + .25) / 16384.5);
|
||||
for (int quadrant = 0; quadrant < 4; quadrant++)
|
||||
{
|
||||
var direction = new Vector3((quadrant & 1) != 0 ? -b : b, 0, (quadrant & 2) != 0 ? -a : a);
|
||||
ushort units = (ushort)(OriginalHeading.Degrees(direction) / .02197265625f);
|
||||
hash = unchecked((hash ^ units) * 16777619);
|
||||
cases++;
|
||||
}
|
||||
}
|
||||
// Observed through the copied OMT2.dll export, heading-probe/wine.log.
|
||||
if (hash != 0x24e64f91) throw new Exception($"Original-DLL sweep mismatch: {hash:x8}");
|
||||
Console.WriteLine($"Heading: {samples.Length} copied-DLL references, {cases} sweep cases, finite guards and unwrapped seam passed.");
|
||||
@@ -0,0 +1,69 @@
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT/'tools/binary'))
|
||||
from gadget_controls import (collect, tab_action, hit_gadgets, practice_toggle,
|
||||
default_device_selection, TILES)
|
||||
|
||||
|
||||
class GadgetControlTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.report = collect(ROOT.parent/'Original')
|
||||
|
||||
def test_source_identity_spans_and_virtual_targets(self):
|
||||
self.assertEqual(len(self.report['bodies']), 9)
|
||||
self.assertEqual(len(self.report['sites']), 40)
|
||||
self.assertEqual(len(self.report['vtables']), 10)
|
||||
sites = {s['name']: s for s in self.report['sites']}
|
||||
self.assertEqual(sites['tab_byte']['bytes'], 'a041985000')
|
||||
self.assertEqual(sites['space_byte']['bytes'], 'a058985000')
|
||||
self.assertEqual(sites['unequip_global']['file_offset'], '0x25ac2')
|
||||
|
||||
def test_tab_distinguishes_close_unequip_and_open_and_held_edge(self):
|
||||
self.assertEqual(tab_action(True, -1), 'close')
|
||||
self.assertEqual(tab_action(False, 5), 'unequip')
|
||||
self.assertEqual(tab_action(False, -1), 'open_gadgets')
|
||||
for opened in (True, False):
|
||||
self.assertEqual(tab_action(opened, -1, latched=True), 'none')
|
||||
|
||||
def test_exact_tile_layout_and_strict_boundaries(self):
|
||||
self.assertEqual(TILES[3], (157, 327))
|
||||
for item, (x, y) in enumerate(TILES):
|
||||
self.assertEqual(hit_gadgets([1]*8, x+70, y+70), item)
|
||||
for a, b in ((x, y+70), (x+141, y+70), (x+70, y), (x+70, y+141)):
|
||||
self.assertIsNone(hit_gadgets([1]*8, a, b))
|
||||
|
||||
def test_hit_filter_is_raw_state_not_owned_boolean(self):
|
||||
x, y = TILES[3]
|
||||
for state in (0, 4):
|
||||
self.assertIsNone(hit_gadgets([state]*8, x+70, y+70))
|
||||
for state in (1, 2, 3, -1):
|
||||
self.assertEqual(hit_gadgets([state]*8, x+70, y+70), 3)
|
||||
|
||||
def test_display_highlight_three_is_not_equipped_mode_three(self):
|
||||
table = self.report['selection_table']
|
||||
self.assertEqual(table[0], table[4]) # Requested−1 and3 share branch428DE0.
|
||||
state = default_device_selection(3)
|
||||
self.assertEqual((state['highlight'], state['equipped_mode']), (3, -1))
|
||||
self.assertIsNone(state['practice_level'])
|
||||
|
||||
def test_practice_toggles_only_outside_tutorial_and_before_scene500(self):
|
||||
self.assertEqual(practice_toggle(3, 'LV1B', 60), 2)
|
||||
self.assertEqual(practice_toggle(2, 'LV1B', 60), 3)
|
||||
self.assertEqual(practice_toggle(3, 'LV1B', 500), 3)
|
||||
for i in range(1, 9):
|
||||
self.assertEqual(practice_toggle(3, f'VR0{i}', 60), 3)
|
||||
state = default_device_selection(2)
|
||||
self.assertEqual((state['practice_level'], state['practice_state']), ('VR04', 1))
|
||||
|
||||
def test_practice_destination_calls_match_all_eight_item_indices(self):
|
||||
self.assertEqual([p['level'] for p in self.report['practice']], [f'vr0{i}.gam' for i in range(1,9)])
|
||||
sites = {s['name']: s for s in self.report['sites']}
|
||||
self.assertEqual(sites['initial_practice_return_state1']['bytes'], '6a016a0953e8f814feff6a016a0a53e8ee14feff')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,57 @@
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
from unittest.mock import patch
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
ORIGINAL = ROOT.parent/'Original'
|
||||
sys.path.insert(0, str(ROOT/'tools/extractors'))
|
||||
from gadget_resources import CANVASES, export_gadget_resources
|
||||
from omt import Database, FormatError
|
||||
|
||||
|
||||
@unittest.skipUnless(ORIGINAL.exists(), 'Original assets are local integration fixtures')
|
||||
class GadgetResourceTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.database = Database(ORIGINAL/'omt/screens.omt')
|
||||
|
||||
def test_exact_original_pixels_identities_and_dimensions_are_preserved(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
output = Path(directory)/'gadgets'
|
||||
manifest = export_gadget_resources(self.database, output)
|
||||
self.assertEqual(manifest['sourceSha256'], 'e8e95231f5d302b41f4fbf33df1c5a08ce4645370f9f519527ff1727b73b7a5e')
|
||||
self.assertEqual((manifest['referenceWidth'], manifest['referenceHeight']), (640, 480))
|
||||
self.assertEqual(len(manifest['textures']), 54)
|
||||
self.assertEqual(len({texture['id'] for texture in manifest['textures']}), 54)
|
||||
self.assertEqual(manifest, json.loads((output/'gadgets.json').read_text()))
|
||||
by_id = {texture['id']: texture for texture in manifest['textures']}
|
||||
self.assertEqual(by_id[14]['name'], 'item04')
|
||||
self.assertEqual(manifest['tiles'][3]['label'], 'SHRINK RAY')
|
||||
self.assertEqual(by_id[119]['name'], '9jetpack')
|
||||
self.assertEqual((by_id[253]['width'], by_id[253]['height']), (15, 210))
|
||||
for texture in manifest['textures']:
|
||||
rgba = (output/texture['path']).read_bytes()
|
||||
self.assertEqual(len(rgba), texture['width']*texture['height']*4)
|
||||
self.assertEqual(hashlib.sha256(rgba).hexdigest(), texture['rgbaSha256'])
|
||||
self.assertTrue((output/texture['png']).is_file())
|
||||
|
||||
def test_exports_cannot_overwrite_any_original_asset_subtree(self):
|
||||
for output in (ORIGINAL, ORIGINAL/'omt/generated', ORIGINAL/'ASE/generated', ORIGINAL/'png/generated'):
|
||||
with self.subTest(output=output), self.assertRaises(ValueError):
|
||||
export_gadget_resources(self.database, output)
|
||||
|
||||
def test_changed_resource_contract_rejects_before_writing(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
output = Path(directory)/'gadgets'
|
||||
with patch('gadget_resources.read_canvas', return_value=dict(width=1, height=1, rgba=b'\0'*4)):
|
||||
with self.assertRaises(FormatError):
|
||||
export_gadget_resources(self.database, output)
|
||||
self.assertFalse(output.exists())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,59 @@
|
||||
import math
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
PROJECT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(PROJECT / 'tools/binary'))
|
||||
import shrink_heading as heading
|
||||
|
||||
|
||||
class ShrinkHeadingTests(unittest.TestCase):
|
||||
def test_quadrants(self):
|
||||
for x, z, units in [(0, 0, 0), (0, 1, 0), (-1, 0, 4096),
|
||||
(0, -1, 8192), (1, 0, 12288),
|
||||
(-1, 1, 2048), (-1, -1, 6144),
|
||||
(1, -1, 10240), (1, 1, 14336)]:
|
||||
self.assertEqual(heading.heading_units(x, z), units)
|
||||
|
||||
def test_strict_window_and_no_seam_wrap(self):
|
||||
self.assertTrue(heading.within_heading_window(0, 1, 0))
|
||||
self.assertFalse(heading.within_heading_window(0, 1, 5))
|
||||
self.assertFalse(heading.within_heading_window(0, 1, -5))
|
||||
self.assertFalse(heading.within_heading_window(1, 1000, 0))
|
||||
self.assertTrue(heading.within_heading_window(-1, 1000, 0))
|
||||
|
||||
def test_nonfinite(self):
|
||||
for value in [math.nan, math.inf, -math.inf]:
|
||||
with self.assertRaises(ValueError):
|
||||
heading.heading_units(value, 1)
|
||||
|
||||
def test_copied_dll_samples(self):
|
||||
for x, z, expected in [(1, 1000, 16364), (-1, 1000, 20),
|
||||
(1000, 1, 12288), (-1000, 1, 4096),
|
||||
(.1234567, .7654321, 15967), (-99.1, 15.7, 3686)]:
|
||||
self.assertEqual(heading.heading_units(x, z), expected)
|
||||
|
||||
def test_copied_dll_full_bin_quadrant_sweep(self):
|
||||
fingerprint = 2166136261
|
||||
for i in range(16385):
|
||||
a = heading.f32(math.sqrt((i + .25) / 16384.5))
|
||||
b = heading.f32(math.sqrt(1 - (i + .25) / 16384.5))
|
||||
for quadrant in range(4):
|
||||
value = heading.heading_units(-b if quadrant & 1 else b,
|
||||
-a if quadrant & 2 else a)
|
||||
fingerprint = ((fingerprint ^ value) * 16777619) & 0xffffffff
|
||||
self.assertEqual(fingerprint, 0x24e64f91)
|
||||
|
||||
def test_full_source_identity(self):
|
||||
exe = PROJECT / 'artifacts/uncontrolled-phases/rea/Neutron.exe'
|
||||
dll = PROJECT / 'artifacts/asset-probe/game/OMT2.dll'
|
||||
if not exe.exists() or not dll.exists():
|
||||
self.skipTest('generated original copies unavailable')
|
||||
report = heading.evidence(exe, dll)
|
||||
self.assertEqual(report['table_fnv32'], '4f800433')
|
||||
self.assertEqual(report['exported']['ordinal'], 278)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,67 @@
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT/'tools/binary'))
|
||||
from shrink_ray import collect, target_eligible, texture_step, f32
|
||||
|
||||
|
||||
class ShrinkRaySourceTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.report = collect(ROOT.parent/'Original')
|
||||
|
||||
def test_source_bodies_constants_assets_and_opacity(self):
|
||||
self.assertEqual(len(self.report['bodies']), 8)
|
||||
self.assertEqual(self.report['constants'], dict(lower_y=150, upper_y=60, range=1500,
|
||||
yaw_half_angle=5, angle_unit_degrees=.02197265625, texture_period=.1))
|
||||
self.assertEqual(self.report['strings']['0x4ef71c'], 'SHRINK')
|
||||
self.assertEqual(self.report['strings']['0x4f0b78'], 'ray.ase')
|
||||
names = {site['name'] for site in self.report['sites']}
|
||||
self.assertTrue({'alpha_not_scale', 'blend_src6', 'ray_rotation_copy', 'target_callback'}.issubset(names))
|
||||
|
||||
def test_default_owned3_uses_mode_minus1_not_menu_highlight3(self):
|
||||
p, t = (0, 0, 0), (0, 0, 100)
|
||||
self.assertTrue(target_eligible(p, t, 0, 0))
|
||||
for state in (0, 2, 3, 4):
|
||||
self.assertFalse(target_eligible(p, t, 0, 0, owned_state=state))
|
||||
for mode in range(8):
|
||||
self.assertFalse(target_eligible(p, t, 0, 0, equipped_mode=mode))
|
||||
|
||||
def test_target_class_enabled_and_already_shrunk_gates_are_independent(self):
|
||||
p, t = (0, 0, 0), (0, 0, 100)
|
||||
for kw in (dict(integrates=False), dict(enemy=False), dict(enabled=False), dict(shrunk=True), dict(wall_hit=True)):
|
||||
self.assertFalse(target_eligible(p, t, 0, 0, **kw))
|
||||
|
||||
def test_strict_range_and_height(self):
|
||||
p = (0, 0, 0)
|
||||
self.assertTrue(target_eligible(p, (0, 0, 1499.99), 0, 0))
|
||||
self.assertFalse(target_eligible(p, (0, 0, 1500), 0, 0))
|
||||
for y in (-150, 60):
|
||||
self.assertFalse(target_eligible(p, (0, y, 100), 0, 0))
|
||||
for y in (-149.999, 59.999):
|
||||
self.assertTrue(target_eligible(p, (0, y, 100), 0, 0))
|
||||
|
||||
def test_strict_quantized_yaw_window_does_not_add_seam_wrapping(self):
|
||||
p, t = (0, 0, 0), (0, 0, 100)
|
||||
for angle in (-5, 5, 359):
|
||||
self.assertFalse(target_eligible(p, t, 0, angle))
|
||||
for angle in (-4.999, 0, 4.999):
|
||||
self.assertTrue(target_eligible(p, t, 0, angle))
|
||||
|
||||
def test_texture_float_accumulator_double_threshold_and_single_advance(self):
|
||||
self.assertEqual(texture_step(0, 0, .099999994), (0, f32(.099999994)))
|
||||
self.assertEqual(texture_step(0, 0, f32(.1)), (1, 0))
|
||||
self.assertEqual(texture_step(2, 0, .5), (0, 0))
|
||||
self.assertEqual(texture_step(1, .09, .02), (2, 0))
|
||||
|
||||
def test_original_engine_blend_table_distinguishes_additive_and_alpha(self):
|
||||
blend = self.report['blend']
|
||||
self.assertEqual((blend['source_alpha'], blend['additive_destination'], blend['alpha_destination']), (5, 2, 6))
|
||||
self.assertEqual(blend['body_file_offset'], '0x36ab0')
|
||||
self.assertEqual(blend['table_file_offset'], '0x13667c')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
@@ -0,0 +1,65 @@
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0, str(ROOT / 'tools' / 'binary'))
|
||||
from shrink_targets import collect, timer_step
|
||||
|
||||
|
||||
class ShrinkTargetSourceTests(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.report = collect(ROOT.parent / 'Original')
|
||||
|
||||
def test_original_byte_body_and_dispatch_identity(self):
|
||||
self.assertTrue(self.report['known_binary'])
|
||||
for group in ('bodies', 'sites', 'vtables', 'strings', 'clips'):
|
||||
with self.subTest(group=group):
|
||||
self.assertTrue(all(x['matches'] for x in self.report[group]))
|
||||
self.assertEqual(len(self.report['bodies']), 8)
|
||||
self.assertEqual((self.report['radius'], self.report['factor']), (90, 1))
|
||||
modes = self.report['modes']
|
||||
self.assertFalse(modes['shrink_snapshots_authored'])
|
||||
self.assertEqual((modes['current_complete'], modes['previous_complete'], modes['authored_complete']),
|
||||
('0x6c8', '0x6cc', '0x93c'))
|
||||
self.assertEqual((modes['authored_property'], modes['initial_authored'], modes['expiry_restores']),
|
||||
('AIState', 2, 'authored'))
|
||||
|
||||
def test_shrink_is_authored_geometry_with_compatible_topology(self):
|
||||
clips = {c['name'].casefold(): c for c in self.report['clips']}
|
||||
shrink = clips['soldshrink.ase']
|
||||
self.assertEqual(shrink['times'], [0, 960, 1920, 2880, 3840])
|
||||
self.assertEqual((shrink['frames_per_second'], shrink['ticks_per_frame']), (5, 960))
|
||||
heights = [high-low for low, high in shrink['y_bounds']]
|
||||
self.assertTrue(all(a > b for a, b in zip(heights, heights[1:])))
|
||||
self.assertAlmostEqual(heights[0], 315.8297)
|
||||
self.assertAlmostEqual(heights[-1], 55.1186)
|
||||
for clip in clips.values():
|
||||
self.assertEqual(set(clip['vertex_counts']), {190})
|
||||
self.assertEqual(set(clip['face_counts']), {377})
|
||||
self.assertEqual({t['name'].casefold() for t in self.report['textures']},
|
||||
{'vryoksoldier.png', 'yoksold.png', 'yoksoldtalk.png'})
|
||||
|
||||
def test_timer_preserves_strict_original_expiry_boundary(self):
|
||||
self.assertEqual(timer_step(30, 1), (29, True, False))
|
||||
self.assertEqual(timer_step(.25, .5), (0, False, True))
|
||||
self.assertEqual(timer_step(.25, .25), (0, True, False))
|
||||
self.assertEqual(timer_step(0, 1), (0, True, False))
|
||||
self.assertEqual(timer_step(0, 1, False), (0, False, False))
|
||||
|
||||
def test_original_vr04_has_three_authored_soldiers(self):
|
||||
targets = self.report['vr04']['targets']
|
||||
self.assertEqual([t['file_offset'] for t in targets], ['0x4431', '0x582c', '0x67c5'])
|
||||
self.assertEqual([t['fields']['ObjectTag'] for t in targets],
|
||||
['yoke1', 'C3DYOKIANSOLDIER', 'yoke2'])
|
||||
for target in targets:
|
||||
fields = target['fields']
|
||||
self.assertEqual((fields['HasCollision'], fields['CanMove'], fields['AIState']), (1, 1, 2))
|
||||
self.assertGreater(fields['PositionY'], 6300)
|
||||
self.assertAlmostEqual(targets[0]['fields']['PositionX'], -2463.103515625)
|
||||
self.assertAlmostEqual(targets[2]['fields']['PositionZ'], 1319.027587890625)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Reference in new issue
Block a user