@@ -78,4 +78,71 @@ SonicMappingsVer := 1
78
78
SonicDplcVer = 1
79
79
` ) ;
80
80
importScript ( 'MapMacros.asm' ) ;
81
+
82
+ writeMappings ( ( { label, sprites, renderHex } ) => {
83
+ const list = [ ] ;
84
+
85
+ list . push ( `${ label } : mappingsTable` ) ;
86
+ sprites . forEach ( ( _ , i ) => {
87
+ list . push ( `\tmappingsTableEntry.w\t${ label } _${ i } ` ) ;
88
+ } ) ;
89
+ list . push ( '' ) ;
90
+
91
+ sprites . forEach ( ( sprite , i ) => {
92
+ list . push ( `${ label } _${ i } :\tspriteHeader` ) ;
93
+
94
+ sprite . mappings . forEach ( mapping => {
95
+ const pieceInfo = [
96
+ mapping . left ,
97
+ mapping . top ,
98
+ mapping . width ,
99
+ mapping . height ,
100
+ mapping . art ,
101
+ mapping . hflip ,
102
+ mapping . vflip ,
103
+ mapping . palette ,
104
+ mapping . priority ,
105
+ ] . map ( renderHex ) . join ( ', ' ) ;
106
+
107
+ list . push ( ` spritePiece ${ pieceInfo } ` ) ;
108
+ } ) ;
109
+
110
+ list . push ( `${ label } _${ i } _End` ) ;
111
+ list . push ( '' ) ;
112
+ } ) ;
113
+
114
+ list . push ( '\teven' ) ;
115
+
116
+ return list . join ( '\n' ) ;
117
+ } ) ;
118
+
119
+ writeDPLCs ( ( { label, sprites, renderHex } ) => {
120
+ const list = [ ] ;
121
+
122
+ list . push ( `${ label } : mappingsTable` ) ;
123
+ sprites . forEach ( ( _ , i ) => {
124
+ list . push ( `\tmappingsTableEntry.w\t${ label } _${ i } ` ) ;
125
+ } ) ;
126
+ list . push ( '' ) ;
127
+
128
+ sprites . forEach ( ( sprite , i ) => {
129
+ list . push ( `${ label } _${ i } :\tdplcHeader` ) ;
130
+
131
+ sprite . dplcs . forEach ( dplc => {
132
+ const pieceInfo = [
133
+ dplc . size ,
134
+ dplc . art ,
135
+ ] . map ( renderHex ) . join ( ', ' ) ;
136
+
137
+ list . push ( ` dplcEntry ${ pieceInfo } ` ) ;
138
+ } ) ;
139
+
140
+ list . push ( `${ label } _${ i } _End` ) ;
141
+ list . push ( '' ) ;
142
+ } ) ;
143
+
144
+ list . push ( '\teven' ) ;
145
+
146
+ return list . join ( '\n' ) ;
147
+ } ) ;
81
148
} ) ;
0 commit comments