Skip to content

Commit 8a5551c

Browse files
committed
Improved sonlvl parse script
1 parent 860db81 commit 8a5551c

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ The UI layout is fully customisable by moving or resizing tabs.
2424

2525
## File Screen
2626

27-
After selecting a game format, individual assets can be saved and loaded. Art based assetts can specify an offset to load from (for example, for loading HUD graphics from a VRAM dump).
27+
After selecting a game format, individual assets can be saved and loaded. Art based assetts can specify an offset to load from (for example, for loading HUD graphics from a VRAM dump). To load every asset as once, use the load/save in the 'Object' line.
2828

2929
The 'label' specified in the mapping and DPLC definitions will be used as the main label in ASM file output.
3030

TODO

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ definition([
2121

2222
// project files
2323
// check palette copy to file works correctly
24+
// drag project error (check other files too)
2425

2526
/* https://unix.stackexchange.com/questions/585645/launch-an-application-by-a-double-click */
2627
// provide a custom definition, but have a default
@@ -72,6 +73,7 @@ copy / paste mappings
7273
time travel for undo/redo
7374
import palette from spritesheet https://yarnpkg.com/en/package/node-vibrant
7475
==
76+
21:08 <+dIRCord> <R​andomName> Not this. For example look at ArtScaled_EggRoboFly, which is art that's used by s3k art scaler. It's uncompressed art,tho it looks transformed in some way, but not like random mess of pixels.
7577
uses a grayscale copy of another frame that you selected separately from the current one as a "background" frame.
7678
drawing mode fill !
7779
S - scroll to sprite

development/sonlvl.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const base = __dirname + '/../../flex2_test/s1disasm/SonLVL INI Files/';
77
const format = 'Sonic 1.js';
88
const projectName = 'Sonic 1';
99
const defaultCmp = 'Nemesis';
10-
// const folders = ['objGHZ.ini'];
1110
const folders = [
1211
'obj.ini',
1312
'objGHZ.ini',
@@ -17,7 +16,7 @@ const folders = [
1716
'objSLZ.ini',
1817
'objSYZ.ini',
1918
];
20-
const pathMod = (str) => str.slice(3);
19+
const pathMod = (str) => str.slice(3).replace(/&amp;/g, '&').replace(/\|.+/, '');
2120
const basePalette = [
2221
{ path: 'palette/Sonic.bin', length: 1 }
2322
];
@@ -43,7 +42,9 @@ const sonlvl = readFileSync(join(base, 'SonLVL.ini'), 'utf8')
4342

4443
parseINI(sonlvl).forEach(obj => {
4544
if (obj.objlst && obj.palette) {
46-
paletteLookup[obj.objlst] = pathMod(obj.palette.split('|').pop().replace(/:.+/, ''));
45+
paletteLookup[obj.objlst] = pathMod(
46+
obj.palette.split('|').pop().replace(/:.+/, '')
47+
);
4748
}
4849
})
4950

@@ -89,7 +90,7 @@ folders.forEach(filename => {
8990
flexObj.name = name[1];
9091
}
9192
const art = xml.match(/<ArtFile filename="(.+?)"/);
92-
if (art) {
93+
if (art && art[1] !== 'LevelArt') {
9394
flexObj.art.path = pathMod(art[1]);
9495
}
9596
const map = xml.match(/<MapFile type="(.+?)" filename="(.+?)"/);
@@ -101,7 +102,7 @@ folders.forEach(filename => {
101102
}
102103
if (obj.art && obj.mapasm) {
103104
const flexObj = {
104-
name: obj.name,
105+
name: obj.name || '???',
105106
palettes,
106107
format,
107108
art: {
@@ -121,7 +122,7 @@ folders.forEach(filename => {
121122
};
122123

123124
if (obj.dplcasm) {
124-
flexObj.dplcs.enabed = true;
125+
flexObj.dplcs.enabled = true;
125126
flexObj.dplcs.path = pathMod(obj.dplcasm);
126127
}
127128

0 commit comments

Comments
 (0)