1- // Flex2 Mapping Definition - Sonic 3
1+ // Flex2 Mapping Definition - Sonic 3 Player
22
33const {
44 mappings,
@@ -16,59 +16,61 @@ const {
1616mappings ( [
1717 offsetTable ( dc . w ) ,
1818 [
19- ( { mapping, ref } , i ) => {
20- if ( i === 0 ) {
21- ref . quantity = read ( dc . w ) ;
22- if ( ref . quantity === 0 ) return skipFrame ;
23- }
24- mapping . top = read ( dc . b , signed ) ;
25- read ( nybble ) ;
26- mapping . width = read ( 2 ) + 1 ;
27- mapping . height = read ( 2 ) + 1 ;
28- mapping . priority = read ( 1 ) ;
29- mapping . palette = read ( 2 ) ;
30- mapping . vflip = read ( 1 ) ;
31- mapping . hflip = read ( 1 ) ;
32- mapping . art = read ( 11 ) ;
33- mapping . left = read ( dc . w , signed ) ;
34- if ( i === ref . quantity - 1 ) return endFrame ;
19+ ( ) => {
20+ const quantity = read ( dc . w ) ;
21+ return quantity > 0 && ( ( { mapping } , frameIndex ) => {
22+ mapping . top = read ( dc . b , signed ) ;
23+ read ( nybble ) ;
24+ mapping . width = read ( 2 ) + 1 ;
25+ mapping . height = read ( 2 ) + 1 ;
26+ mapping . priority = read ( 1 ) ;
27+ mapping . palette = read ( 2 ) ;
28+ mapping . vflip = read ( 1 ) ;
29+ mapping . hflip = read ( 1 ) ;
30+ mapping . art = read ( 11 ) ;
31+ mapping . left = read ( dc . w , signed ) ;
32+ if ( frameIndex === quantity - 1 ) return endFrame ;
33+ } ) ;
3534 } ,
36- ( { mapping, sprite } , i ) => {
37- if ( i === 0 ) write ( dc . w , sprite . length ) ;
38- // top
39- write ( dc . b , mapping . top ) ;
40- write ( nybble , 0 ) ;
41- // size
42- write ( 2 , mapping . width - 1 ) ;
43- write ( 2 , mapping . height - 1 ) ;
44- // 1 player
45- write ( 1 , mapping . priority ) ;
46- write ( 2 , mapping . palette ) ;
47- write ( 1 , mapping . vflip ) ;
48- write ( 1 , mapping . hflip ) ;
49- write ( 11 , mapping . offset ) ;
50- // left
51- write ( dc . w , mapping . left ) ;
35+ ( { sprite } ) => {
36+ write ( dc . w , sprite . length ) ;
37+ return ( { mapping } ) => {
38+ // top
39+ write ( dc . b , mapping . top ) ;
40+ write ( nybble , 0 ) ;
41+ // size
42+ write ( 2 , mapping . width - 1 ) ;
43+ write ( 2 , mapping . height - 1 ) ;
44+ // 1 player
45+ write ( 1 , mapping . priority ) ;
46+ write ( 2 , mapping . palette ) ;
47+ write ( 1 , mapping . vflip ) ;
48+ write ( 1 , mapping . hflip ) ;
49+ write ( 11 , mapping . art ) ;
50+ // left
51+ write ( dc . w , mapping . left ) ;
52+ } ;
5253 } ,
5354 ] ,
5455] ) ;
5556
5657dplcs ( [
5758 offsetTable ( dc . w ) ,
5859 [
59- ( { mapping, ref } , i ) => {
60- if ( i === 0 ) {
61- ref . quantity = read ( dc . w ) ;
62- if ( ref . quantity === 0 ) return skipFrame ;
63- }
64- mapping . size = read ( nybble ) + 1 ;
65- mapping . art = read ( nybble * 3 ) ;
66- if ( i === ref . quantity - 1 ) return endFrame ;
60+ ( ) => {
61+ const quantity = read ( dc . w ) ;
62+ return quantity > 0 && ( ( { mapping } , frameIndex ) => {
63+ mapping . size = read ( nybble ) + 1 ;
64+ mapping . art = read ( nybble * 3 ) ;
65+ if ( frameIndex === quantity - 1 ) return endFrame ;
66+ } ) ;
6767 } ,
68- ( { mapping, sprite } , i ) => {
69- if ( i === 0 ) write ( dc . w , sprite . length ) ;
70- write ( nybble , mapping . size ) ;
71- write ( nybblr * 3 , mapping . art ) ;
68+ ( { sprite } ) => {
69+ write ( dc . w , sprite . length ) ;
70+ return ( { mapping } ) => {
71+ write ( nybble , mapping . size - 1 ) ;
72+ write ( nybble * 3 , mapping . art ) ;
73+ } ;
7274 } ,
7375 ] ,
7476] ) ;
0 commit comments