Skip to content

Commit c8201cc

Browse files
committed
xml support for sonlvl
1 parent b68a2db commit c8201cc

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
- Fixed a keycombination event bug [#29](/../../issues/29)
2222
- Fixed corrupted art when importing transparent PNGs [#22](/../../issues/22)
2323
- Performance improvements to remove lag
24+
- Created project files for s1disasm
2425

2526
## [0.0.8]
2627
- Changed default palette from Sonic 2 to the SCH unified palette

development/sonlvl.js

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,40 @@ levels.forEach(filename => {
3535

3636
if (obj.xmlfile) {
3737
const xml = readFileSync(join(base, obj.xmlfile), 'utf8');
38-
console.log(xml);
39-
process.exit()
38+
const flexObj = {
39+
name: '???',
40+
palettes,
41+
format,
42+
art: {
43+
path: '',
44+
compression: defaultCmp,
45+
offset: 0,
46+
},
47+
mappings: {
48+
path: '',
49+
label: '',
50+
},
51+
dplcs: {
52+
enabled: false,
53+
path: '',
54+
label: '',
55+
},
56+
};
57+
58+
const name = xml.match(/Name="(.+?)"/);
59+
if (name) {
60+
flexObj.name = name[1];
61+
}
62+
const art = xml.match(/<ArtFile filename="(.+?)"/);
63+
if (art) {
64+
flexObj.art.path = pathMod(art[1]);
65+
}
66+
const map = xml.match(/<MapFile type="(.+?)" filename="(.+?)"/);
67+
if (map) {
68+
flexObj.mappings.path = pathMod(map[2]);
69+
}
70+
71+
folder.children.push(flexObj);
4072
}
4173
if (obj.art && obj.mapasm) {
4274
const flexObj = {
@@ -81,4 +113,4 @@ const config = {
81113
objects,
82114
}
83115

84-
// console.log(JSON.stringify(config, 0, 4));
116+
console.log(JSON.stringify(config, 0, 4));

0 commit comments

Comments
 (0)