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,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