Implement evidence-backed VR02 Rocketship flight and ownership
This commit is contained in:
1 parent
312efccb77
commit
e77add5fdf
50 files changed
+4326
-66
No files matched your search
@@ -0,0 +1,44 @@
|
||||
"""Source guards and31 captured component cases, not original gameplay."""
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
import unittest
|
||||
|
||||
ROOT=Path(__file__).resolve().parents[1]
|
||||
sys.path.insert(0,str(ROOT/'tools/binary'))
|
||||
from rocketship_motion_camera import collect,rotate,facing,horizontal,camera
|
||||
|
||||
|
||||
class RocketMotionTests(unittest.TestCase):
|
||||
def vector(self,actual,expected):
|
||||
for a,b in zip(actual,expected,strict=True):self.assertAlmostEqual(a,b,delta=.002)
|
||||
|
||||
def test_guarded_source_both_original_images_and_dispatch(self):
|
||||
report=collect(ROOT.parent/'Original')
|
||||
self.assertEqual(len(report['bodies']),10)
|
||||
self.assertEqual(len(report['vtables']),7)
|
||||
self.assertTrue(all(int(b['va'],16)-int(b['file_offset'],16)==0x400000 for b in report['bodies']))
|
||||
|
||||
def test_31_original_transform_motion_facing_and_camera_cases(self):
|
||||
reference=json.loads((ROOT/'tests/GamePort.RocketFlightTests/original-motion-reference.json').read_text())
|
||||
self.assertEqual(len(reference['cases']),31)
|
||||
for case in reference['cases']:
|
||||
with self.subTest(case['name']):
|
||||
p=case['values'];kind=case['kind']
|
||||
if kind=='TRANSFORM':self.vector(rotate(p['vector'],p['euler']),p['observed'])
|
||||
elif kind=='FACING':self.vector(facing(p['euler'],p['dest'],p['dt'])[0],p['observed_rotation'])
|
||||
elif kind in ('MOTION','AUX'):
|
||||
if kind=='MOTION':
|
||||
actual=horizontal(p['incoming'],p['euler'],p['speed'],p['bank'],p['previous'],p['dt'])
|
||||
else:
|
||||
actual=horizontal((10,p['vy'],100),(0,0,0),400,16,7,p['dt'],turn_timer=p['timer'][0],roll_timer=p['timer'][1],
|
||||
turn_latch=bool(p['latch'][0]),roll_latch=bool(p['latch'][1]),turn_pressed=bool(p['pressed'][0]),
|
||||
roll_pressed=bool(p['pressed'][1]),suppressed=bool(p['suppressed']))
|
||||
self.vector((actual['turn_timer'],actual['roll_timer']),p['observed_timer'])
|
||||
self.vector(actual['rotation'],p['observed_rotation']);self.vector(actual['velocity'],p['observed_velocity'])
|
||||
self.assertAlmostEqual(actual['previous_bank'],p['observed_previous'],delta=.002)
|
||||
elif kind=='CAMERA':
|
||||
actual=camera((100,200,300),p['euler'],p['old'],p['dt'],p['detail'],(80,250,100)if p['hit']else None)
|
||||
self.vector(actual['eye'],p['observed_eye']);self.vector(actual['look'],p['trace_start'])
|
||||
self.assertEqual((actual['pitch'],actual['yaw']),(p['pitch'],p['yaw']))
|
||||
else:self.fail('Unknown component case')
|
||||
Reference in new issue
Block a user