Fix Rocketship wall damage flash misinterpreted as model scaling
This commit is contained in:
1 parent
b5ef5b8b64
commit
62e908e26d
13 files changed
+255
-21
No files matched your search
@@ -16,6 +16,7 @@ var tests=new(string,Action)[]{
|
||||
("Rocket wall374 does not inherit horizontal reflection",Wall),
|
||||
("actual passenger can activate RETURN while ship owns control",Return),
|
||||
("exact four resource families and additive fire visibility",Visuals),
|
||||
("wall impact pulses material color without deforming any owned geometry",ImpactVisuals),
|
||||
};
|
||||
foreach(var(name,check)in tests){check();Console.WriteLine("PASS "+name);}
|
||||
Console.WriteLine($"Rocketship integration: {tests.Length} groups passed; bounded static VR02, not original whole-game verification.");
|
||||
@@ -130,6 +131,56 @@ static void Visuals()
|
||||
f.Interactions.Inventory.SelectGadget(-1);visuals.Update(visuals.Mesh,f.Ship,.2,f.Player.Appearance);
|
||||
Check(visuals.Mesh.Draws.TakeLast(4).All(d=>!d.Visible),"cleanup hides every owned layer");
|
||||
}
|
||||
static void ImpactVisuals()
|
||||
{
|
||||
using var f=new Fixture();
|
||||
var points=new Vector3[]{new(0,-1000,-1000),new(0,1000,-1000),new(0,1000,1000)};
|
||||
var wall=new Mesh(points.Select(p=>new MeshVertex(p,Vector2.Zero,Vector3.One)).ToArray(),[0,1,2])
|
||||
{HasCollisionMaterialIds=true,CollisionPolygons=[new(0,0,-Vector3.UnitX,"wall","wall",0)]};
|
||||
var ship=new Rocketship(f.Ship.Actor,wall,"VR02");
|
||||
var visuals=new RocketshipVisuals(f.World,Path.GetFullPath("artifacts/extracted"));
|
||||
var clips=new[]{"strato","jimdrive","godrocket","firestrato"}
|
||||
.Select(name=>new MorphAnimation($"artifacts/extracted/rocketship/{name}/animation.json")).ToArray();
|
||||
var offsets=new int[4];offsets[0]=f.World.Vertices.Length;
|
||||
for(int i=1;i<4;i++)offsets[i]=offsets[i-1]+clips[i-1].Base.Vertices.Length;
|
||||
var tinted=false;
|
||||
for(int frame=0;frame<130;frame++)
|
||||
{
|
||||
if(frame is 0 or 65)
|
||||
{
|
||||
ship.Mount(new(-51,300,0),new(0,270,0),f.Player.CameraEye);
|
||||
ship.StepInput(new(true,false,false,false,false),FixedStepClock.Step);
|
||||
ship.StepFrame(default,FixedStepClock.Step);
|
||||
ship.StepBody(FixedStepClock.Step);
|
||||
Check(ship.ImpactActive&&ship.Contacts==(frame==0?1:2),"actual wall374 starts each impact");
|
||||
}
|
||||
ship.StepFrame(default,FixedStepClock.Step);
|
||||
double time=frame/60d;
|
||||
visuals.Update(visuals.Mesh,ship,time,f.Player.Appearance);
|
||||
var color=ship.ImpactColor;
|
||||
Check(color.X==1&&color.W==1&&color.Y==color.Z&&color.Y>=0&&color.Y<=1,"red flash RGBA bounds");
|
||||
tinted|=color.Y<.1f;
|
||||
for(int layer=0;layer<4;layer++)
|
||||
{
|
||||
var expected=new MeshVertex[clips[layer].Base.Vertices.Length];
|
||||
var root=layer==2?ship.CompanionRoot:ship.Root;
|
||||
clips[layer].Sample(time,expected,RocketOrientation.Model(ship.Rotation,root,Vector3.One));
|
||||
for(int i=0;i<expected.Length;i++)
|
||||
{
|
||||
var actual=visuals.Mesh.Vertices[offsets[layer]+i];
|
||||
Near(actual.Position,expected[i].Position,$"impact preserves layer{layer} vertex{i}");
|
||||
var tint=layer==0?new Vector3(color.X,color.Y,color.Z):Vector3.One;
|
||||
Near(actual.Color,expected[i].Color*tint,$"material tint only on ship layer{layer} vertex{i}");
|
||||
}
|
||||
}
|
||||
//A second render without a simulation step must not accumulate tint.
|
||||
var sample=visuals.Mesh.Vertices[offsets[0]];
|
||||
visuals.Update(visuals.Mesh,ship,time,f.Player.Appearance);
|
||||
Near(visuals.Mesh.Vertices[offsets[0]].Color,sample.Color,"render does not multiply prior-frame tint");
|
||||
}
|
||||
Check(tinted&&!ship.ImpactActive&&ship.ImpactColor==Vector4.One,"repeated impacts expire to untinted unit geometry");
|
||||
ship.Reset();Check(ship.ImpactColor==Vector4.One,"reset clears impact color");
|
||||
}
|
||||
static void Check(bool ok,string message){if(!ok)throw new Exception(message);}
|
||||
static void Near(Vector3 actual,Vector3 expected,string message)=>Check(float.IsFinite(actual.X+actual.Y+actual.Z)&&Vector3.Distance(actual,expected)<.002f,$"{message}: {actual} != {expected}");
|
||||
|
||||
|
||||
+1
@@ -4,6 +4,7 @@
|
||||
"executable_sha256": "82c610faabee6c1278bfe733f63d67ac5095ad2b8ff30a823d946711d1004098",
|
||||
"log_sha256": "8f286bd1c44c6cee8c2138bd3e77f4f89f241beec9b8773f7d361cfba034dcd4",
|
||||
"scope": "Copied43E6E8..43E7DB impact suffix; synthetic rider/render/queued-impulse; no original game entrypoint",
|
||||
"field_interpretation": "Historical observed.scale label preserves raw probe output; these four values are first-material RGBA at +4C/+50/+54/+58, not geometry scale. See docs/gameplay/rocketship-impact-render.md.",
|
||||
"cases": [
|
||||
{
|
||||
"name": "inactive",
|
||||
|
||||
@@ -7,10 +7,16 @@ import unittest
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0,str(ROOT/'tools/binary'))
|
||||
from rocketship_lifecycle import (ROCKET_ID,collect,engine_input,engine_transition,
|
||||
impact_tail,resolve_reused)
|
||||
impact_tail,material_color_contract,resolve_reused)
|
||||
|
||||
|
||||
class RocketLifecycleTests(unittest.TestCase):
|
||||
def test_impact_fields_belong_to_material_rgba_and_renderer_diffuse(self):
|
||||
contract=material_color_contract(ROOT.parent/'Original')
|
||||
self.assertEqual(len(contract['spans']),3)
|
||||
self.assertEqual(contract['fields'],dict(red=0x4c,green=0x50,blue=0x54,alpha=0x58))
|
||||
self.assertFalse(contract['geometry_scale'])
|
||||
|
||||
def test_eight_copied_original_impact_suffix_cases(self):
|
||||
reference=json.loads((ROOT/'tests/fixtures/rocket-impact-reference.json').read_text())
|
||||
self.assertEqual(len(reference['cases']),8)
|
||||
@@ -22,8 +28,9 @@ class RocketLifecycleTests(unittest.TestCase):
|
||||
self.assertEqual(actual['select_drive'],bool(observed['drive']))
|
||||
self.assertAlmostEqual(actual['timer'],observed['timer'],places=5)
|
||||
self.assertEqual(actual['queued_y'],observed['impulses'][:int(observed['count'])])
|
||||
if actual['scale'] is not None:
|
||||
for a,b in zip(actual['scale'],observed['scale'],strict=True):self.assertAlmostEqual(a,b,places=5)
|
||||
#Retained probe's historical 'scale' label is material RGBA.
|
||||
if actual['color'] is not None:
|
||||
for a,b in zip(actual['color'],observed['scale'],strict=True):self.assertAlmostEqual(a,b,places=5)
|
||||
|
||||
def test_source_identity_bindings_and_pointer_bases(self):
|
||||
report=collect(ROOT.parent/'Original')
|
||||
@@ -56,12 +63,12 @@ class RocketLifecycleTests(unittest.TestCase):
|
||||
self.assertEqual(engine_transition(2,False,2),dict(stop=False,start=None,mode=2))
|
||||
self.assertEqual(engine_transition(0,False,1),dict(stop=False,start=195,mode=1))
|
||||
|
||||
def test_exact_duration_remains_active_and_preserves_scale_axes(self):
|
||||
def test_exact_duration_remains_active_and_preserves_red_and_alpha(self):
|
||||
result=impact_tail(True,.5,1,False,.5)
|
||||
self.assertTrue(result['active'])
|
||||
self.assertFalse(result['select_drive'])
|
||||
self.assertEqual((result['scale'][0],result['scale'][3]),(1.,1.))
|
||||
self.assertEqual(result['scale'][1],result['scale'][2])
|
||||
self.assertEqual((result['color'][0],result['color'][3]),(1.,1.))
|
||||
self.assertEqual(result['color'][1],result['color'][2])
|
||||
self.assertEqual(result['queued_y'],[])
|
||||
|
||||
def test_expiry_keeps_pre_expiry_impulse_order_then_drive_burst(self):
|
||||
@@ -69,12 +76,12 @@ class RocketLifecycleTests(unittest.TestCase):
|
||||
self.assertFalse(result['active'])
|
||||
self.assertFalse(result['impulse_flag'])
|
||||
self.assertTrue(result['select_drive'])
|
||||
self.assertEqual(result['scale'],(1.,1.,1.,1.))
|
||||
self.assertEqual(result['color'],(1.,1.,1.,1.))
|
||||
self.assertEqual(result['queued_y'],[-700.,-750.])
|
||||
|
||||
def test_inactive_tail_retains_scale_and_timer(self):
|
||||
def test_inactive_tail_retains_color_and_timer(self):
|
||||
result=impact_tail(False,.75,1,False,.1)
|
||||
self.assertIsNone(result['scale'])
|
||||
self.assertIsNone(result['color'])
|
||||
self.assertEqual(result['timer'],.75)
|
||||
|
||||
def test_invalid_projection_states_rejected(self):
|
||||
|
||||
Reference in new issue
Block a user