Add a bunch of graphics, log failures
This commit is contained in:
parent
7888b92c41
commit
fd2f21c9b4
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
*.bin
|
|
@ -7,5 +7,6 @@
|
|||
</head>
|
||||
<body>
|
||||
<div id="cels"></div>
|
||||
<div id="errors"></div>
|
||||
</body>
|
||||
</html>
|
44
index.js
44
index.js
|
@ -336,7 +336,9 @@ const showStates = (prop) => {
|
|||
const container = document.getElementById("cels")
|
||||
for (const celmask of prop.celmasks) {
|
||||
const state = compositeCels(celsFromMask(prop, celmask))
|
||||
container.appendChild(imageFromCanvas(state.canvas))
|
||||
const img = imageFromCanvas(state.canvas)
|
||||
img.alt = prop.filename
|
||||
container.appendChild(img)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -348,13 +350,43 @@ const showCels = (prop) => {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
const decodeBinary = async (filename) => {
|
||||
try {
|
||||
const prop = decodeProp(await readBinary(`props/${filename}`))
|
||||
prop.filename = filename
|
||||
return prop
|
||||
} catch (e) {
|
||||
return { filename: filename, error: e }
|
||||
}
|
||||
}
|
||||
|
||||
const fetchImages = async () => {
|
||||
const response = await fetch("props/index.json")
|
||||
const filenames = await response.json()
|
||||
return await Promise.all(filenames.map(decodeBinary))
|
||||
}
|
||||
|
||||
const showError = (e, filename) => {
|
||||
const container = document.getElementById("errors")
|
||||
const errNode = document.createElement("p")
|
||||
console.error(e)
|
||||
errNode.innerHTML = `${filename}<br/>${e.toString()}`
|
||||
container.appendChild(errNode)
|
||||
}
|
||||
|
||||
const doTheThing = async () => {
|
||||
const prop = decodeProp(await readBinary("picture2.bin"))
|
||||
console.log(prop)
|
||||
for (const prop of await fetchImages()) {
|
||||
if (prop.error) {
|
||||
showError(prop.error, prop.filename)
|
||||
} else {
|
||||
try {
|
||||
showStates(prop)
|
||||
showStates(decodeProp(await readBinary("picture1.bin")))
|
||||
showStates(decodeProp(await readBinary("picture3.bin")))
|
||||
showStates(decodeProp(await readBinary("afro0.bin")))
|
||||
} catch (e) {
|
||||
showError(e, prop.filename)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doTheThing()
|
BIN
props/Tentacle.bin
Normal file
BIN
props/Tentacle.bin
Normal file
Binary file not shown.
BIN
props/amulet.bin
Normal file
BIN
props/amulet.bin
Normal file
Binary file not shown.
BIN
props/ans.bin
Normal file
BIN
props/ans.bin
Normal file
Binary file not shown.
BIN
props/atm.bin
Normal file
BIN
props/atm.bin
Normal file
Binary file not shown.
BIN
props/bag.bin
Normal file
BIN
props/bag.bin
Normal file
Binary file not shown.
BIN
props/ball1.bin
Normal file
BIN
props/ball1.bin
Normal file
Binary file not shown.
BIN
props/banner.bin
Normal file
BIN
props/banner.bin
Normal file
Binary file not shown.
BIN
props/barred.bin
Normal file
BIN
props/barred.bin
Normal file
Binary file not shown.
BIN
props/bboard.bin
Normal file
BIN
props/bboard.bin
Normal file
Binary file not shown.
BIN
props/bbox0.bin
Normal file
BIN
props/bbox0.bin
Normal file
Binary file not shown.
BIN
props/bbush.bin
Normal file
BIN
props/bbush.bin
Normal file
Binary file not shown.
BIN
props/beds.bin
Normal file
BIN
props/beds.bin
Normal file
Binary file not shown.
BIN
props/booke.bin
Normal file
BIN
props/booke.bin
Normal file
Binary file not shown.
BIN
props/bookf.bin
Normal file
BIN
props/bookf.bin
Normal file
Binary file not shown.
BIN
props/bottle.bin
Normal file
BIN
props/bottle.bin
Normal file
Binary file not shown.
BIN
props/box1.bin
Normal file
BIN
props/box1.bin
Normal file
Binary file not shown.
BIN
props/brang.bin
Normal file
BIN
props/brang.bin
Normal file
Binary file not shown.
BIN
props/bridgef.bin
Normal file
BIN
props/bridgef.bin
Normal file
Binary file not shown.
BIN
props/bridges.bin
Normal file
BIN
props/bridges.bin
Normal file
Binary file not shown.
BIN
props/bush1.bin
Normal file
BIN
props/bush1.bin
Normal file
Binary file not shown.
BIN
props/bush2.bin
Normal file
BIN
props/bush2.bin
Normal file
Binary file not shown.
BIN
props/bush3.bin
Normal file
BIN
props/bush3.bin
Normal file
Binary file not shown.
BIN
props/bush4.bin
Normal file
BIN
props/bush4.bin
Normal file
Binary file not shown.
BIN
props/bwall3.bin
Normal file
BIN
props/bwall3.bin
Normal file
Binary file not shown.
BIN
props/bwall4.bin
Normal file
BIN
props/bwall4.bin
Normal file
Binary file not shown.
BIN
props/bwall5.bin
Normal file
BIN
props/bwall5.bin
Normal file
Binary file not shown.
BIN
props/bwall6.bin
Normal file
BIN
props/bwall6.bin
Normal file
Binary file not shown.
BIN
props/bwall7.bin
Normal file
BIN
props/bwall7.bin
Normal file
Binary file not shown.
BIN
props/bwall8.bin
Normal file
BIN
props/bwall8.bin
Normal file
Binary file not shown.
BIN
props/bwall9.bin
Normal file
BIN
props/bwall9.bin
Normal file
Binary file not shown.
0
props/c.bin
Normal file
0
props/c.bin
Normal file
BIN
props/cafechair.bin
Normal file
BIN
props/cafechair.bin
Normal file
Binary file not shown.
0
props/cage2.bin
Normal file
0
props/cage2.bin
Normal file
BIN
props/camera0.bin
Normal file
BIN
props/camera0.bin
Normal file
Binary file not shown.
BIN
props/car4.bin
Normal file
BIN
props/car4.bin
Normal file
Binary file not shown.
0
props/carb.bin
Normal file
0
props/carb.bin
Normal file
0
props/carf.bin
Normal file
0
props/carf.bin
Normal file
BIN
props/cassette.bin
Normal file
BIN
props/cassette.bin
Normal file
Binary file not shown.
BIN
props/cat.bin
Normal file
BIN
props/cat.bin
Normal file
Binary file not shown.
BIN
props/cave0.bin
Normal file
BIN
props/cave0.bin
Normal file
Binary file not shown.
BIN
props/cball0.bin
Normal file
BIN
props/cball0.bin
Normal file
Binary file not shown.
0
props/cbolt.bin
Normal file
0
props/cbolt.bin
Normal file
BIN
props/ccard.bin
Normal file
BIN
props/ccard.bin
Normal file
Binary file not shown.
BIN
props/chairfb.bin
Normal file
BIN
props/chairfb.bin
Normal file
Binary file not shown.
BIN
props/chairs.bin
Normal file
BIN
props/chairs.bin
Normal file
Binary file not shown.
BIN
props/chango.bin
Normal file
BIN
props/chango.bin
Normal file
Binary file not shown.
BIN
props/chess0.bin
Normal file
BIN
props/chess0.bin
Normal file
Binary file not shown.
BIN
props/chestf.bin
Normal file
BIN
props/chestf.bin
Normal file
Binary file not shown.
BIN
props/chests.bin
Normal file
BIN
props/chests.bin
Normal file
Binary file not shown.
BIN
props/cinder.bin
Normal file
BIN
props/cinder.bin
Normal file
Binary file not shown.
BIN
props/club2.bin
Normal file
BIN
props/club2.bin
Normal file
Binary file not shown.
BIN
props/coke1.bin
Normal file
BIN
props/coke1.bin
Normal file
Binary file not shown.
BIN
props/compass.bin
Normal file
BIN
props/compass.bin
Normal file
Binary file not shown.
BIN
props/copier.bin
Normal file
BIN
props/copier.bin
Normal file
Binary file not shown.
BIN
props/couchfb.bin
Normal file
BIN
props/couchfb.bin
Normal file
Binary file not shown.
BIN
props/couchs.bin
Normal file
BIN
props/couchs.bin
Normal file
Binary file not shown.
BIN
props/counter0.bin
Normal file
BIN
props/counter0.bin
Normal file
Binary file not shown.
BIN
props/crack0.bin
Normal file
BIN
props/crack0.bin
Normal file
Binary file not shown.
BIN
props/cups0.bin
Normal file
BIN
props/cups0.bin
Normal file
Binary file not shown.
BIN
props/dcase.bin
Normal file
BIN
props/dcase.bin
Normal file
Binary file not shown.
BIN
props/dials.bin
Normal file
BIN
props/dials.bin
Normal file
Binary file not shown.
BIN
props/die.bin
Normal file
BIN
props/die.bin
Normal file
Binary file not shown.
BIN
props/die2.bin
Normal file
BIN
props/die2.bin
Normal file
Binary file not shown.
BIN
props/doll.bin
Normal file
BIN
props/doll.bin
Normal file
Binary file not shown.
BIN
props/door1.bin
Normal file
BIN
props/door1.bin
Normal file
Binary file not shown.
BIN
props/door2.bin
Normal file
BIN
props/door2.bin
Normal file
Binary file not shown.
BIN
props/dungdoor.bin
Normal file
BIN
props/dungdoor.bin
Normal file
Binary file not shown.
0
props/empty.bin
Normal file
0
props/empty.bin
Normal file
BIN
props/escaper.bin
Normal file
BIN
props/escaper.bin
Normal file
Binary file not shown.
0
props/explo1.bin
Normal file
0
props/explo1.bin
Normal file
0
props/explo2.bin
Normal file
0
props/explo2.bin
Normal file
0
props/explo3.bin
Normal file
0
props/explo3.bin
Normal file
BIN
props/eye0.bin
Normal file
BIN
props/eye0.bin
Normal file
Binary file not shown.
BIN
props/fence1.bin
Normal file
BIN
props/fence1.bin
Normal file
Binary file not shown.
BIN
props/fgun1.bin
Normal file
BIN
props/fgun1.bin
Normal file
Binary file not shown.
BIN
props/filecabinet.bin
Normal file
BIN
props/filecabinet.bin
Normal file
Binary file not shown.
BIN
props/flag.bin
Normal file
BIN
props/flag.bin
Normal file
Binary file not shown.
BIN
props/flamp.bin
Normal file
BIN
props/flamp.bin
Normal file
Binary file not shown.
BIN
props/flat.bin
Normal file
BIN
props/flat.bin
Normal file
Binary file not shown.
BIN
props/flite.bin
Normal file
BIN
props/flite.bin
Normal file
Binary file not shown.
BIN
props/floor0.bin
Normal file
BIN
props/floor0.bin
Normal file
Binary file not shown.
BIN
props/floor1.bin
Normal file
BIN
props/floor1.bin
Normal file
Binary file not shown.
BIN
props/fortun.bin
Normal file
BIN
props/fortun.bin
Normal file
Binary file not shown.
BIN
props/fount2.bin
Normal file
BIN
props/fount2.bin
Normal file
Binary file not shown.
BIN
props/fris.bin
Normal file
BIN
props/fris.bin
Normal file
Binary file not shown.
BIN
props/ftank2.bin
Normal file
BIN
props/ftank2.bin
Normal file
Binary file not shown.
BIN
props/gcan.bin
Normal file
BIN
props/gcan.bin
Normal file
Binary file not shown.
BIN
props/gdoor.bin
Normal file
BIN
props/gdoor.bin
Normal file
Binary file not shown.
BIN
props/gem.bin
Normal file
BIN
props/gem.bin
Normal file
Binary file not shown.
BIN
props/glassdoor.bin
Normal file
BIN
props/glassdoor.bin
Normal file
Binary file not shown.
BIN
props/glue0.bin
Normal file
BIN
props/glue0.bin
Normal file
Binary file not shown.
BIN
props/grass0.bin
Normal file
BIN
props/grass0.bin
Normal file
Binary file not shown.
BIN
props/gren.bin
Normal file
BIN
props/gren.bin
Normal file
Binary file not shown.
BIN
props/gun1.bin
Normal file
BIN
props/gun1.bin
Normal file
Binary file not shown.
BIN
props/gun2.bin
Normal file
BIN
props/gun2.bin
Normal file
Binary file not shown.
BIN
props/gun3.bin
Normal file
BIN
props/gun3.bin
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue