Skip to content

Commit 83ade4f

Browse files
committed
support for scraping sonic1 from sonLVL
1 parent 73cf6df commit 83ade4f

File tree

1 file changed

+56
-3
lines changed

1 file changed

+56
-3
lines changed

development/sonlvl.js

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
1+
// quick, and super dirty
2+
13
const { readFileSync } = require('fs');
24
const { join } = require('path');
35

46
const base = __dirname + '/../../flex2_test/s1disasm/SonLVL INI Files/';
5-
67
const levels = ['objGHZ.ini'];
8+
const format = 'Sonic 1.js';
9+
const defaultCmp = 'Nemesis';
10+
const pathMod = (str) => str.slice(3);
11+
const palettes = []; // TODO - use SonLVL.ini
712

813
const objects = [];
914

1015
levels.forEach(filename => {
11-
const folder = [];
16+
const folder = {
17+
name: filename,
18+
children: [],
19+
isDirectory: true,
20+
expanded: false,
21+
};
1222

1323
ini = readFileSync(join(base, filename), 'utf8');
1424
ini = ini.match(/\[.+\][^[]+/gm);
@@ -22,7 +32,50 @@ levels.forEach(filename => {
2232
}
2333
})
2434
if (obj.name && obj.art && obj.mapasm) {
25-
console.log(obj);
35+
const flexObj = {
36+
name: obj.name,
37+
palettes,
38+
format,
39+
art: {
40+
path: pathMod(obj.art),
41+
compression: defaultCmp,
42+
offset: 0,
43+
},
44+
mappings: {
45+
path: pathMod(obj.mapasm),
46+
label: '',
47+
},
48+
dplcs: {
49+
enabled: false,
50+
path: '',
51+
label: '',
52+
},
53+
};
54+
55+
if (obj.dplcasm) {
56+
flexObj.dplcs.enabed = true;
57+
flexObj.dplcs.path = pathMod(obj.dplcasm);
58+
}
59+
60+
if (obj.artcmp) {
61+
flexObj.art.compression = obj.artcmp;
62+
}
63+
64+
folder.children.push(flexObj);
2665
}
2766
})
67+
68+
objects.push(folder);
2869
});
70+
71+
72+
// [Sonic]
73+
// art=../artunc/Sonic.bin
74+
// artcmp=Uncompressed
75+
// mapasm=../_maps/Sonic.asm
76+
// dplcasm=../_maps/Sonic - Dynamic Gfx Script.asm
77+
// frame=1
78+
// [0D]
79+
// name=Signpost
80+
// art=../artnem/Signpost.bin
81+
// mapasm=../_maps/Signpost.asm

0 commit comments

Comments
 (0)