@lewismoten/gamemaker-sandbox-tools 3.1.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/NOTICE.md +105 -3
  3. package/README.md +301 -15
  4. package/dist/audio-files.js +82 -0
  5. package/dist/audio.js +23 -138
  6. package/dist/block-merge.js +43 -0
  7. package/dist/color-reduce.js +44 -0
  8. package/dist/colors.js +87 -0
  9. package/dist/delta.js +75 -0
  10. package/dist/disk-diff.js +220 -0
  11. package/dist/drawing.js +83 -869
  12. package/dist/embroidery/compile.js +85 -0
  13. package/dist/embroidery/dst.js +79 -0
  14. package/dist/embroidery/exp.js +26 -0
  15. package/dist/embroidery/fill.js +49 -0
  16. package/dist/embroidery/geom.js +82 -0
  17. package/dist/embroidery/pes.js +79 -0
  18. package/dist/embroidery/satin.js +29 -0
  19. package/dist/embroidery/simulate.js +30 -0
  20. package/dist/embroidery/strokeFont.js +253 -0
  21. package/dist/embroidery/svg.js +24 -0
  22. package/dist/embroidery/types.js +13 -0
  23. package/dist/embroidery/units.js +26 -0
  24. package/dist/embroidery/validate.js +15 -0
  25. package/dist/formats/blocks.js +1 -103
  26. package/dist/formats/character.js +1 -83
  27. package/dist/formats/cmf.js +1 -37
  28. package/dist/formats/fli.js +1 -296
  29. package/dist/formats/fliLimits.js +1 -54
  30. package/dist/formats/game.js +1 -193
  31. package/dist/formats/gif.js +1 -125
  32. package/dist/formats/graphicScripts.js +1 -44
  33. package/dist/formats/map.js +1 -38
  34. package/dist/formats/monster.js +1 -69
  35. package/dist/formats/palette.js +1 -58
  36. package/dist/formats/recording.js +1 -17
  37. package/dist/formats/sound.js +1 -44
  38. package/dist/formats/voc.js +1 -303
  39. package/dist/gif-shrink.js +56 -0
  40. package/dist/image/png.js +42 -0
  41. package/dist/images.js +81 -43
  42. package/dist/kit/actors.js +19 -0
  43. package/dist/kit/align.js +204 -0
  44. package/dist/kit/blit.js +45 -0
  45. package/dist/kit/blockRoles.js +97 -0
  46. package/dist/kit/clips.js +40 -0
  47. package/dist/kit/coverPaint.js +18 -0
  48. package/dist/kit/disk.js +76 -0
  49. package/dist/kit/fadeOut.js +13 -0
  50. package/dist/kit/fliClips.js +133 -0
  51. package/dist/kit/fliShrink.js +277 -0
  52. package/dist/kit/gameSim.js +235 -0
  53. package/dist/kit/hopBot.js +142 -0
  54. package/dist/kit/levelGen.js +1423 -0
  55. package/dist/kit/levelGrid.js +33 -0
  56. package/dist/kit/levelPicture.js +27 -0
  57. package/dist/kit/menuVersion.js +19 -0
  58. package/dist/kit/microText.js +35 -0
  59. package/dist/kit/mumble.js +74 -0
  60. package/dist/kit/music.js +8 -0
  61. package/dist/kit/palRamps.js +32 -0
  62. package/dist/kit/palette.js +49 -0
  63. package/dist/kit/pcText.js +72 -0
  64. package/dist/kit/photo.js +150 -0
  65. package/dist/kit/pixels.js +79 -0
  66. package/dist/kit/png.js +40 -0
  67. package/dist/kit/quantize.js +72 -0
  68. package/dist/kit/raytrace.js +379 -0
  69. package/dist/kit/recordedDemo.js +10 -0
  70. package/dist/kit/reel.js +77 -0
  71. package/dist/kit/road3d.js +67 -0
  72. package/dist/kit/routeChecks.js +8 -0
  73. package/dist/kit/saveSlots.js +11 -0
  74. package/dist/kit/sceneInit.js +13 -0
  75. package/dist/kit/sceneSim.js +112 -0
  76. package/dist/kit/screenText.js +15 -0
  77. package/dist/kit/sdftext.js +237 -0
  78. package/dist/kit/shading.js +69 -0
  79. package/dist/kit/song.js +251 -0
  80. package/dist/kit/songFx.js +179 -0
  81. package/dist/kit/sound.js +52 -0
  82. package/dist/kit/synthParts.js +20 -0
  83. package/dist/kit/tar.js +53 -0
  84. package/dist/kit/textBounds.js +84 -0
  85. package/dist/kit/textfit.js +246 -0
  86. package/dist/kit/transforms.js +57 -0
  87. package/dist/kit/tune.js +21 -0
  88. package/dist/look-alike.js +50 -0
  89. package/dist/menu-version.js +4 -0
  90. package/dist/mesh/colorBodies.js +137 -0
  91. package/dist/mesh/decimate.js +207 -0
  92. package/dist/mesh/meshCheck.js +51 -0
  93. package/dist/mesh/overhang.js +41 -0
  94. package/dist/mesh/sampledField.js +12 -0
  95. package/dist/mesh/stl.js +36 -0
  96. package/dist/mesh/surfaceNets.js +79 -0
  97. package/dist/mesh/tetraMesh.js +62 -0
  98. package/dist/mesh/threeMf.js +58 -0
  99. package/dist/mesh/zipFile.js +52 -0
  100. package/dist/microFont.js +101 -0
  101. package/dist/music/compose.js +72 -0
  102. package/dist/pack/meshPack.js +198 -0
  103. package/dist/pack/threeMfPack.js +92 -0
  104. package/dist/palette-reserve.js +116 -0
  105. package/dist/palettes.js +138 -0
  106. package/dist/release-notes.js +40 -0
  107. package/dist/simulation.js +16 -2774
  108. package/dist/text.js +74 -0
  109. package/dist/types/audio.d.ts +4 -0
  110. package/dist/types/audioFiles.d.ts +22 -0
  111. package/dist/types/audioWav.d.ts +4 -0
  112. package/dist/types/blockMerge.d.ts +24 -0
  113. package/dist/types/colorReduce.d.ts +23 -0
  114. package/dist/types/{web/packages/tools/src/colors.d.ts → colors.d.ts} +6 -0
  115. package/dist/types/delta.d.ts +32 -0
  116. package/dist/types/diskDiff.d.ts +47 -0
  117. package/dist/types/drawing.d.ts +15 -0
  118. package/dist/types/embroidery/compile.d.ts +3 -0
  119. package/dist/types/embroidery/dst.d.ts +13 -0
  120. package/dist/types/embroidery/exp.d.ts +8 -0
  121. package/dist/types/embroidery/fill.d.ts +6 -0
  122. package/dist/types/embroidery/geom.d.ts +19 -0
  123. package/dist/types/embroidery/pes.d.ts +10 -0
  124. package/dist/types/embroidery/satin.d.ts +11 -0
  125. package/dist/types/embroidery/simulate.d.ts +19 -0
  126. package/dist/types/embroidery/strokeFont.d.ts +20 -0
  127. package/dist/types/embroidery/svg.d.ts +3 -0
  128. package/dist/types/embroidery/types.d.ts +70 -0
  129. package/dist/types/embroidery/units.d.ts +10 -0
  130. package/dist/types/embroidery/validate.d.ts +22 -0
  131. package/dist/types/formats/blocks.d.ts +1 -0
  132. package/dist/types/formats/character.d.ts +1 -0
  133. package/dist/types/formats/cmf.d.ts +1 -0
  134. package/dist/types/formats/fli.d.ts +1 -0
  135. package/dist/types/formats/fliLimits.d.ts +1 -0
  136. package/dist/types/formats/game.d.ts +1 -0
  137. package/dist/types/formats/gif.d.ts +1 -0
  138. package/dist/types/formats/graphicScripts.d.ts +1 -0
  139. package/dist/types/formats/map.d.ts +1 -0
  140. package/dist/types/formats/monster.d.ts +1 -0
  141. package/dist/types/formats/palette.d.ts +1 -0
  142. package/dist/types/formats/recording.d.ts +1 -0
  143. package/dist/types/formats/sound.d.ts +1 -0
  144. package/dist/types/formats/voc.d.ts +1 -0
  145. package/dist/types/gifShrink.d.ts +8 -0
  146. package/dist/types/image/animatedGif.d.ts +9 -0
  147. package/dist/types/image/surface.d.ts +26 -0
  148. package/dist/types/images.d.ts +13 -0
  149. package/dist/types/kit/actors.d.ts +7 -0
  150. package/dist/types/kit/align.d.ts +93 -0
  151. package/dist/types/kit/audioEvents.d.ts +26 -0
  152. package/dist/types/kit/blit.d.ts +20 -0
  153. package/dist/types/kit/blockRoles.d.ts +243 -0
  154. package/dist/types/{games/kit → kit}/clips.d.ts +1 -1
  155. package/dist/types/kit/coverPaint.d.ts +7 -0
  156. package/dist/types/kit/disk.d.ts +15 -0
  157. package/dist/types/kit/fadeOut.d.ts +12 -0
  158. package/dist/types/kit/fliClips.d.ts +32 -0
  159. package/dist/types/kit/fliShrink.d.ts +149 -0
  160. package/dist/types/{games/kit → kit}/gameSim.d.ts +9 -5
  161. package/dist/types/kit/hopBot.d.ts +72 -0
  162. package/dist/types/kit/laserClearance.d.ts +16 -0
  163. package/dist/types/kit/laserJoints.d.ts +39 -0
  164. package/dist/types/kit/laserLayout.d.ts +54 -0
  165. package/dist/types/kit/laserPixels.d.ts +52 -0
  166. package/dist/types/kit/laserPreview.d.ts +9 -0
  167. package/dist/types/kit/laserSvg.d.ts +35 -0
  168. package/dist/types/kit/levelGen/castle.d.ts +17 -0
  169. package/dist/types/kit/levelGen/dungeon.d.ts +11 -0
  170. package/dist/types/kit/levelGen/forest.d.ts +17 -0
  171. package/dist/types/kit/levelGen/furnish.d.ts +31 -0
  172. package/dist/types/kit/levelGen/grid.d.ts +46 -0
  173. package/dist/types/kit/levelGen/index.d.ts +138 -0
  174. package/dist/types/kit/levelGen/interior.d.ts +18 -0
  175. package/dist/types/kit/levelGen/jumpModel.d.ts +78 -0
  176. package/dist/types/kit/levelGen/needs.d.ts +44 -0
  177. package/dist/types/kit/levelGen/overworld.d.ts +21 -0
  178. package/dist/types/kit/levelGen/platform.d.ts +59 -0
  179. package/dist/types/kit/levelGen/platformCap.d.ts +13 -0
  180. package/dist/types/kit/levelGen/platformReach.d.ts +37 -0
  181. package/dist/types/kit/levelGen/props.d.ts +37 -0
  182. package/dist/types/kit/levelGen/town.d.ts +24 -0
  183. package/dist/types/kit/levelGrid.d.ts +16 -0
  184. package/dist/types/kit/levelPicture.d.ts +9 -0
  185. package/dist/types/kit/menuVersion.d.ts +7 -0
  186. package/dist/types/kit/microText.d.ts +18 -0
  187. package/dist/types/kit/mumble.d.ts +41 -0
  188. package/dist/types/kit/music.d.ts +1 -0
  189. package/dist/types/kit/palMerge.d.ts +10 -0
  190. package/dist/types/kit/palRamps.d.ts +28 -0
  191. package/dist/types/kit/pcText.d.ts +19 -0
  192. package/dist/types/kit/photo.d.ts +69 -0
  193. package/dist/types/kit/png.d.ts +7 -0
  194. package/dist/types/kit/quantize.d.ts +20 -0
  195. package/dist/types/kit/raytrace.d.ts +169 -0
  196. package/dist/types/kit/recordedDemo.d.ts +1 -0
  197. package/dist/types/kit/road3d.d.ts +71 -0
  198. package/dist/types/kit/routeChecks.d.ts +6 -0
  199. package/dist/types/kit/saveSlots.d.ts +17 -0
  200. package/dist/types/kit/sceneInit.d.ts +11 -0
  201. package/dist/types/{games/kit → kit}/sceneSim.d.ts +5 -5
  202. package/dist/types/kit/screenText.d.ts +3 -0
  203. package/dist/types/kit/sdftext.d.ts +34 -0
  204. package/dist/types/kit/shading.d.ts +23 -0
  205. package/dist/types/kit/shareBlocks.d.ts +20 -0
  206. package/dist/types/kit/song.d.ts +89 -0
  207. package/dist/types/kit/songFx.d.ts +99 -0
  208. package/dist/types/kit/synthParts.d.ts +7 -0
  209. package/dist/types/kit/tar.d.ts +13 -0
  210. package/dist/types/kit/textfit.d.ts +74 -0
  211. package/dist/types/kit/transforms.d.ts +8 -0
  212. package/dist/types/lookAlike.d.ts +31 -0
  213. package/dist/types/menuVersionEntry.d.ts +1 -0
  214. package/dist/types/mesh/colorBodies.d.ts +18 -0
  215. package/dist/types/mesh/decimate.d.ts +10 -0
  216. package/dist/types/mesh/fieldTrinket.d.ts +40 -0
  217. package/dist/types/mesh/figureShapes.d.ts +24 -0
  218. package/dist/types/mesh/mesh.d.ts +9 -0
  219. package/dist/types/mesh/meshCheck.d.ts +22 -0
  220. package/dist/types/mesh/overhang.d.ts +24 -0
  221. package/dist/types/mesh/pixelFigure.d.ts +41 -0
  222. package/dist/types/mesh/sampledField.d.ts +3 -0
  223. package/dist/types/mesh/sdfShapes.d.ts +20 -0
  224. package/dist/types/mesh/stl.d.ts +9 -0
  225. package/dist/types/mesh/strokeText.d.ts +8 -0
  226. package/dist/types/mesh/surfaceNets.d.ts +14 -0
  227. package/dist/types/mesh/tetraMesh.d.ts +4 -0
  228. package/dist/types/mesh/threeMf.d.ts +12 -0
  229. package/dist/types/mesh/trinketKinds.d.ts +72 -0
  230. package/dist/types/mesh/trinketTool.d.ts +26 -0
  231. package/dist/types/mesh/voxel.d.ts +10 -0
  232. package/dist/types/mesh/zipFile.d.ts +13 -0
  233. package/dist/types/microFont.d.ts +6 -0
  234. package/dist/types/pack/meshPack.d.ts +26 -0
  235. package/dist/types/pack/threeMfPack.d.ts +11 -0
  236. package/dist/types/palettePresetData.d.ts +4 -0
  237. package/dist/types/palettePresets.d.ts +12 -0
  238. package/dist/types/paletteReserve.d.ts +52 -0
  239. package/dist/types/palettes.d.ts +4 -0
  240. package/dist/types/releaseNotes.d.ts +3 -0
  241. package/dist/types/simulation.d.ts +6 -0
  242. package/dist/types/{web/packages/tools/src/text.d.ts → text.d.ts} +6 -6
  243. package/package.json +145 -15
  244. package/dist/binary-D7wuaC5g.js +0 -120
  245. package/dist/pixels-DzfIIUOl.js +0 -76
  246. package/dist/types/games/kit/blit.d.ts +0 -10
  247. package/dist/types/games/kit/music.d.ts +0 -1
  248. package/dist/types/games/kit/pcText.d.ts +0 -8
  249. package/dist/types/games/kit/shading.d.ts +0 -11
  250. package/dist/types/web/packages/tools/src/audio.d.ts +0 -3
  251. package/dist/types/web/packages/tools/src/drawing.d.ts +0 -10
  252. package/dist/types/web/packages/tools/src/images.d.ts +0 -2
  253. package/dist/types/web/packages/tools/src/microFont.d.ts +0 -1
  254. package/dist/types/web/packages/tools/src/simulation.d.ts +0 -3
  255. package/dist/types/web/scripts/cdGames.d.ts +0 -103
  256. package/dist/types/web/scripts/gameShots.d.ts +0 -12
  257. package/dist/types/web/scripts/ogImage.d.ts +0 -21
  258. package/dist/types/web/src/audio/cmfLoad.d.ts +0 -7
  259. package/dist/types/web/src/audio/cmfPlayer.d.ts +0 -69
  260. package/dist/types/web/src/audio/context.d.ts +0 -12
  261. package/dist/types/web/src/audio/engine.d.ts +0 -39
  262. package/dist/types/web/src/audio/music.worklet.d.ts +0 -14
  263. package/dist/types/web/src/audio/opl.d.ts +0 -37
  264. package/dist/types/web/src/audio/output.d.ts +0 -13
  265. package/dist/types/web/src/desk/boxes/boxFacts.d.ts +0 -85
  266. package/dist/types/web/src/dosPlayer/fileExtensions.d.ts +0 -44
  267. package/dist/types/web/src/dosPlayer/patchRules.d.ts +0 -24
  268. package/dist/types/web/src/dosPlayer/patchTable.d.ts +0 -80
  269. package/dist/types/web/src/edition.d.ts +0 -6
  270. package/dist/types/web/src/eggs/eggState.d.ts +0 -26
  271. package/dist/types/web/src/eggs/eggs.d.ts +0 -31
  272. package/dist/types/web/src/engine/character.d.ts +0 -30
  273. package/dist/types/web/src/engine/funcKeys.d.ts +0 -33
  274. package/dist/types/web/src/engine/game.d.ts +0 -52
  275. package/dist/types/web/src/engine/keys.d.ts +0 -17
  276. package/dist/types/web/src/engine/machine.d.ts +0 -99
  277. package/dist/types/web/src/engine/menus.d.ts +0 -46
  278. package/dist/types/web/src/engine/monsters.d.ts +0 -19
  279. package/dist/types/web/src/engine/playGain.d.ts +0 -11
  280. package/dist/types/web/src/engine/playerLook.d.ts +0 -26
  281. package/dist/types/web/src/engine/recorder.d.ts +0 -60
  282. package/dist/types/web/src/engine/render.d.ts +0 -8
  283. package/dist/types/web/src/engine/scene.d.ts +0 -156
  284. package/dist/types/web/src/engine/scroll.d.ts +0 -16
  285. package/dist/types/web/src/engine/showGraphic.d.ts +0 -39
  286. package/dist/types/web/src/engine/slowPc.d.ts +0 -62
  287. package/dist/types/web/src/engine/touch.d.ts +0 -33
  288. package/dist/types/web/src/engine/world.d.ts +0 -215
  289. package/dist/types/web/src/export/gameAbout.d.ts +0 -15
  290. package/dist/types/web/src/formats/binary.d.ts +0 -44
  291. package/dist/types/web/src/formats/blocks.d.ts +0 -52
  292. package/dist/types/web/src/formats/character.d.ts +0 -65
  293. package/dist/types/web/src/formats/cmf.d.ts +0 -33
  294. package/dist/types/web/src/formats/fli.d.ts +0 -45
  295. package/dist/types/web/src/formats/fliLimits.d.ts +0 -13
  296. package/dist/types/web/src/formats/game.d.ts +0 -72
  297. package/dist/types/web/src/formats/gif.d.ts +0 -15
  298. package/dist/types/web/src/formats/graphicScripts.d.ts +0 -18
  299. package/dist/types/web/src/formats/highscore.d.ts +0 -10
  300. package/dist/types/web/src/formats/map.d.ts +0 -24
  301. package/dist/types/web/src/formats/monster.d.ts +0 -48
  302. package/dist/types/web/src/formats/palette.d.ts +0 -15
  303. package/dist/types/web/src/formats/recording.d.ts +0 -7
  304. package/dist/types/web/src/formats/sound.d.ts +0 -13
  305. package/dist/types/web/src/formats/voc.d.ts +0 -13
  306. package/dist/types/web/src/gfx/cp437Glyphs.d.ts +0 -2
  307. package/dist/types/web/src/gfx/font8x8.d.ts +0 -2
  308. package/dist/types/web/src/gfx/levelPicture.d.ts +0 -81
  309. package/dist/types/web/src/gfx/screen.d.ts +0 -46
  310. package/dist/types/web/src/gfx/titlePicture.d.ts +0 -21
  311. package/dist/types/web/src/input/chords.d.ts +0 -22
  312. package/dist/types/web/src/input/deskMouse.d.ts +0 -14
  313. package/dist/types/web/src/input/keyboard.d.ts +0 -39
  314. package/dist/types/web/src/input/scancodes.d.ts +0 -3
  315. package/dist/types/web/src/manual/printables/types.d.ts +0 -277
  316. package/dist/types/web/src/project/bizarre.d.ts +0 -28
  317. package/dist/types/web/src/project/companion.d.ts +0 -35
  318. package/dist/types/web/src/project/diskFacts.d.ts +0 -30
  319. package/dist/types/web/src/project/files.d.ts +0 -124
  320. package/dist/types/web/src/project/gameFiles.d.ts +0 -49
  321. package/dist/types/web/src/project/gamePack.d.ts +0 -17
  322. package/dist/types/web/src/project/health.d.ts +0 -30
  323. package/dist/types/web/src/project/secretGames.d.ts +0 -19
  324. package/dist/types/web/src/project/storage.d.ts +0 -46
  325. package/dist/types/web/src/project/streamGame.d.ts +0 -38
  326. package/dist/types/web/src/project/zip.d.ts +0 -33
  327. package/dist/types/web/src/retro/dos/disks.d.ts +0 -33
  328. package/dist/types/web/src/retro/text/cp437.d.ts +0 -4
  329. package/dist/types/web/src/seededRandom.d.ts +0 -6
  330. package/dist/types/web/src/tinHearts/deskHearts.d.ts +0 -33
  331. package/dist/types/web/src/tinHearts/manifest.d.ts +0 -30
  332. package/dist/types/web/src/tinHearts/tinHearts.d.ts +0 -84
  333. package/dist/types/web/src/walkthrough/format.d.ts +0 -92
  334. package/dist/types/web/src/walkthrough/madeUpScores.d.ts +0 -6
  335. package/dist/types/web/src/walkthrough/runtime.d.ts +0 -134
  336. /package/dist/types/{web/src/assistant → image}/png.d.ts +0 -0
  337. /package/dist/types/{games/kit → kit}/palette.d.ts +0 -0
  338. /package/dist/types/{games/kit → kit}/pixels.d.ts +0 -0
  339. /package/dist/types/{games/kit → kit}/reel.d.ts +0 -0
  340. /package/dist/types/{games/kit → kit}/sound.d.ts +0 -0
  341. /package/dist/types/{games/kit → kit}/textBounds.d.ts +0 -0
  342. /package/dist/types/{games/kit → kit}/tune.d.ts +0 -0
  343. /package/dist/types/{web/src/audio → music}/compose.d.ts +0 -0
package/dist/images.js CHANGED
@@ -1,50 +1,88 @@
1
- import { vga8 as g } from "./formats/palette.js";
2
- const m = (() => {
3
- const e = new Uint32Array(256);
4
- for (let n = 0; n < 256; n++) {
5
- let t = n;
6
- for (let o = 0; o < 8; o++) t = t & 1 ? 3988292384 ^ t >>> 1 : t >>> 1;
7
- e[n] = t >>> 0;
8
- }
9
- return e;
10
- })();
11
- function p(e) {
12
- let n = 4294967295;
13
- for (let t = 0; t < e.length; t++) n = m[(n ^ e[t]) & 255] ^ n >>> 8;
14
- return (n ^ 4294967295) >>> 0;
1
+ import { encodePng as k } from "./image/png.js";
2
+ import { crc32 as q } from "@lewismoten/gamemaker-sandbox-archives/zip";
3
+ import { Pixels as w } from "./kit/pixels.js";
4
+ import { flipX as F, flipY as G, turn180 as U, turn90 as X } from "./kit/transforms.js";
5
+ function N(n, e, h, r, i) {
6
+ const u = [[n, e]];
7
+ return (i === "h" || i === "both") && u.push([h - 1 - n, e]), (i === "v" || i === "both") && u.push([n, r - 1 - e]), i === "both" && u.push([h - 1 - n, r - 1 - e]), u.filter(([c, g], t) => u.findIndex(([o, a]) => o === c && a === g) === t);
8
+ }
9
+ function E(n, e, h) {
10
+ const r = Math.max(Math.abs(e.x - n.x), Math.abs(e.y - n.y), 1);
11
+ for (let i = 0; i <= r; i++) h(Math.round(n.x + (e.x - n.x) * i / r), Math.round(n.y + (e.y - n.y) * i / r));
15
12
  }
16
- async function D(e) {
17
- const n = new Blob([e]).stream().pipeThrough(new CompressionStream("deflate"));
18
- return new Uint8Array(await new Response(n).arrayBuffer());
13
+ function R(n, e, h) {
14
+ for (let r = Math.min(n.x, e.x); r <= Math.max(n.x, e.x); r++)
15
+ h(r, n.y), h(r, e.y);
16
+ for (let r = Math.min(n.y, e.y); r <= Math.max(n.y, e.y); r++)
17
+ h(n.x, r), h(e.x, r);
18
+ }
19
+ function y(n, e, h, r, i, u, c = () => !0, g = (t, o, a) => {
20
+ n[o * e + t] = a;
21
+ }) {
22
+ if (!Number.isSafeInteger(e) || !Number.isSafeInteger(h) || e < 1 || h < 1 || n.length !== e * h)
23
+ throw new RangeError("Expected width × height indexed pixels");
24
+ if (!Number.isInteger(r) || !Number.isInteger(i) || r < 0 || i < 0 || r >= e || i >= h || !c(r, i)) return;
25
+ const t = n.slice(), o = t[i * e + r];
26
+ if (o === u) return;
27
+ const a = new Uint8Array(n.length), l = [r, i];
28
+ for (; l.length; ) {
29
+ const f = l.pop(), s = l.pop();
30
+ s < 0 || f < 0 || s >= e || f >= h || a[f * e + s] || t[f * e + s] !== o || !c(s, f) || (a[f * e + s] = 1, g(s, f, u), l.push(s + 1, f, s - 1, f, s, f + 1, s, f - 1));
31
+ }
19
32
  }
20
- function i(e, n) {
21
- const t = new Uint8Array(12 + n.length), o = new DataView(t.buffer);
22
- o.setUint32(0, n.length);
23
- for (let s = 0; s < 4; s++) t[4 + s] = e.charCodeAt(s);
24
- return t.set(n, 8), o.setUint32(8 + n.length, p(t.subarray(4, 8 + n.length)) >>> 0), t;
33
+ function S(n, e, h) {
34
+ if (!Number.isInteger(e) || !Number.isInteger(h)) throw new RangeError("Pixel shifts must use whole numbers");
35
+ const r = (i, u) => (i % u + u) % u;
36
+ return new w(n.w, n.h).map((i, u) => n.get(r(i - e, n.w), r(u - h, n.h)));
25
37
  }
26
- async function x(e, n = 1) {
27
- const t = Math.max(1, Math.floor(n)), o = e.width * t, s = e.height * t, f = new Uint8Array((o + 1) * s);
28
- for (let r = 0; r < s; r++) {
29
- const l = r * (o + 1) | 0, A = Math.floor(r / t) * e.width;
30
- for (let a = 0; a < o; a++) f[l + 1 + a] = e.pixels[A + Math.floor(a / t)];
38
+ function P(n, e = 256) {
39
+ if (!Number.isInteger(e) || e < 1 || e > 256) throw new RangeError("Color count must be 1..256");
40
+ if (n.some(
41
+ (t) => !Number.isSafeInteger(t.width) || !Number.isSafeInteger(t.height) || t.width < 0 || t.height < 0 || t.data.length !== t.width * t.height * 4
42
+ ))
43
+ throw new RangeError("Expected width × height RGBA pixels");
44
+ if (!n.some((t) => t.data.length)) return [];
45
+ const h = n.reduce((t, o) => t + o.width * o.height, 0), r = Math.max(1, Math.floor(h / 12e4)), i = [];
46
+ for (const t of n) for (let o = 0; o < t.data.length; o += 4 * r) i.push(t.data[o] << 16 | t.data[o + 1] << 8 | t.data[o + 2]);
47
+ const u = [...new Set(i)];
48
+ if (u.length <= e) return u.map((t) => [t >> 16 & 255, t >> 8 & 255, t & 255]);
49
+ const c = [i], g = (t, o) => t >> 16 - o * 8 & 255;
50
+ for (; c.length < e; ) {
51
+ let t = -1, o = -1, a = 0;
52
+ if (c.forEach((s, b) => {
53
+ if (!(s.length < 2))
54
+ for (let d = 0; d < 3; d++) {
55
+ let p = 255, x = 0;
56
+ for (const M of s) {
57
+ const m = g(M, d);
58
+ m < p && (p = m), m > x && (x = m);
59
+ }
60
+ x - p > o && (o = x - p, t = b, a = d);
61
+ }
62
+ }), t < 0 || o === 0) break;
63
+ const l = c[t].sort((s, b) => g(s, a) - g(b, a)), f = l.length >> 1;
64
+ c.splice(t, 1, l.slice(0, f), l.slice(f));
31
65
  }
32
- const c = new Uint8Array(13), w = new DataView(c.buffer);
33
- w.setUint32(0, o), w.setUint32(4, s), c.set([8, 3, 0, 0, 0], 8);
34
- const h = new Uint8Array(768);
35
- for (let r = 0; r < 768; r++) h[r] = g(e.palette[r] ?? 0);
36
- const u = [
37
- new Uint8Array([137, 80, 78, 71, 13, 10, 26, 10]),
38
- i("IHDR", c),
39
- i("PLTE", h),
40
- i("IDAT", await D(f)),
41
- i("IEND", new Uint8Array(0))
42
- ], y = new Uint8Array(u.reduce((r, l) => r + l.length, 0));
43
- let U = 0;
44
- for (const r of u) y.set(r, U), U += r.length;
45
- return y;
66
+ return c.map((t) => {
67
+ let o = 0, a = 0, l = 0;
68
+ for (const s of t)
69
+ o += s >> 16 & 255, a += s >> 8 & 255, l += s & 255;
70
+ const f = Math.max(1, t.length);
71
+ return [Math.round(o / f), Math.round(a / f), Math.round(l / f)];
72
+ });
46
73
  }
47
74
  export {
48
- p as crc32,
49
- x as encodePng
75
+ w as Pixels,
76
+ R as box,
77
+ q as crc32,
78
+ k as encodePng,
79
+ F as flipX,
80
+ G as flipY,
81
+ y as floodFill,
82
+ E as line,
83
+ P as medianCutRgba,
84
+ N as mirrorAll,
85
+ S as shiftPixels,
86
+ U as turn180,
87
+ X as turn90
50
88
  };
@@ -0,0 +1,19 @@
1
+ import { emptyFrame as a } from "@lewismoten/gamemaker-sandbox-engine/formats/character";
2
+ import { emptyMonster as f } from "@lewismoten/gamemaker-sandbox-engine/formats/monster";
3
+ function h(r, o, n = {}) {
4
+ if (o.length > 10) throw new Error("Too many frames");
5
+ o.forEach((t, e) => r.frames[e] = t);
6
+ for (let t = o.length; t < r.frames.length; t++) r.frames[t] = a(!0);
7
+ Object.assign(r, { sound: 255, jstkBut: 4, jstkMov: 0, ...n });
8
+ }
9
+ function u(r, o, n = []) {
10
+ const t = f();
11
+ return t.used = 1, r.forEach((e, c) => t.pic[c] = e), Object.assign(t, o), n.forEach((e, c) => t.march[0][c] = e), t;
12
+ }
13
+ const m = (r, o, n, t = 0) => ({ x: r, y: o, pic: n, orient: t }), p = (r, o, n = 0) => [m(0, 0, o), m(r, n, o, 0), m(0, 0, o, 4)];
14
+ export {
15
+ m as corner,
16
+ u as mon,
17
+ p as pace,
18
+ h as set
19
+ };
@@ -0,0 +1,204 @@
1
+ import { readdirSync as P, readFileSync as A } from "node:fs";
2
+ import { join as L } from "node:path";
3
+ import { parseGame as N, ADVTYPE as C, ADV_EXTS as v } from "@lewismoten/gamemaker-sandbox-engine/formats/game";
4
+ import { MLEN as g, MWID as x, parseMap as O } from "@lewismoten/gamemaker-sandbox-engine/formats/map";
5
+ import { parseBlocks as B, BACKBL as D } from "@lewismoten/gamemaker-sandbox-engine/formats/blocks";
6
+ import { parsePalette as J } from "@lewismoten/gamemaker-sandbox-engine/formats/palette";
7
+ import { Pixels as j } from "./pixels.js";
8
+ import { writePng as E } from "./png.js";
9
+ const T = (p, c) => typeof p == "string" ? c === p : p.test(c);
10
+ function V(p, c, r = g, a = x, e) {
11
+ const f = [];
12
+ for (let o = 0; o < a; o++)
13
+ for (let n = 0; n < r; n++) {
14
+ const t = p(n, o);
15
+ if (t)
16
+ for (const s of c) {
17
+ const l = typeof s.part == "string" ? t === s.part ? /^.*$/.exec(t) : null : s.part instanceof RegExp ? s.part.exec(t) : s.part.test(t) ? /^.*$/.exec(t) : null;
18
+ if (!l) continue;
19
+ const u = typeof s.need == "function" ? [s.need(l)] : Array.isArray(s.need[0]?.[0]) ? s.need : [s.need];
20
+ let i;
21
+ for (const m of u) {
22
+ const h = [], b = [];
23
+ for (const [d, w, y] of m) {
24
+ const M = n + d, S = o + w, $ = M < 0 || S < 0 || M >= r || S >= a ? "off the map" : p(M, S) ?? "?";
25
+ T(y, $) ? s.joins !== !1 && Math.abs(d) + Math.abs(w) === 1 && b.push(JSON.stringify(d + w > 0 ? [t, $, d ? "h" : "v"] : [$, t, d ? "h" : "v"])) : h.push(`${s.what ?? t} at ${n},${o}: wanted ${String(y)} at ${d},${w}, found ${$}`);
26
+ }
27
+ if (!h.length) {
28
+ i = [];
29
+ for (const d of b) e?.add(d);
30
+ break;
31
+ }
32
+ (!i || h.length < i.length) && (i = h);
33
+ }
34
+ f.push(...i ?? []);
35
+ }
36
+ }
37
+ return f;
38
+ }
39
+ function q(p, c, r, a = (e) => e) {
40
+ return {
41
+ part: p,
42
+ need: (e) => {
43
+ const f = e[1], [o, n] = [Number(e[2]), Number(e[3])], [t, s] = c.get(f) ?? [1, 1], l = [];
44
+ for (let u = 0; u < s; u++)
45
+ for (let i = 0; i < t; i++) {
46
+ const m = r(f, i, u);
47
+ (i !== o || u !== n) && l.push([i - o, u - n, { test: (h) => a(h) === m, toString: () => m }]);
48
+ }
49
+ return l;
50
+ }
51
+ };
52
+ }
53
+ function W(p, c) {
54
+ const r = [];
55
+ c.forEach((e, f) => e.forEach((o, n) => o !== null && r.push([n, f, o])));
56
+ const a = /* @__PURE__ */ new Map();
57
+ for (const e of r) a.set(String(e[2]), [...a.get(String(e[2])) ?? [], e]);
58
+ return [...a.values()].map((e) => {
59
+ const f = e[0][2];
60
+ return {
61
+ what: `${p} (${String(f)})`,
62
+ part: typeof f == "string" ? f : { test: (o) => f.test(o) },
63
+ need: e.map(([o, n]) => r.filter((t) => t[0] !== o || t[1] !== n).map(([t, s, l]) => [t - o, s - n, l]))
64
+ };
65
+ });
66
+ }
67
+ const X = (p, c, r, a, e) => W(p, e === 0 ? a === 1 ? [[c, r]] : [[r, c]] : e === 1 ? [[c], [r]] : [[r], [c]]);
68
+ function tt(p, c, r = /$^/, a = 0.75) {
69
+ const e = new Set(c), f = /* @__PURE__ */ new Map();
70
+ for (const n of p)
71
+ for (let t = 0; t < x; t++)
72
+ for (let s = 0; s < g; s++) {
73
+ const l = /^(.*?)(\d)$/.exec(n(s, t) ?? "");
74
+ if (!l || r.test(l[1])) continue;
75
+ const u = `${l[1]}${Number(l[2]) + 1}`;
76
+ if (!e.has(u)) continue;
77
+ const i = f.get(l[0]) ?? { n: 0, h: 0, v: 0 };
78
+ i.n++, s + 1 < g && n(s + 1, t) === u && i.h++, t + 1 < x && n(s, t + 1) === u && i.v++, f.set(l[0], i);
79
+ }
80
+ const o = /* @__PURE__ */ new Map();
81
+ for (const [n, t] of f)
82
+ t.h >= a * t.n ? o.set(n, [1, 0]) : t.v >= a * t.n && o.set(n, [0, 1]);
83
+ return [...o].flatMap(
84
+ ([n, [t, s]]) => X(
85
+ `${n.replace(/\d$/, "")} (found on the maps)`,
86
+ n,
87
+ n.replace(/\d$/, (l) => String(Number(l) + 1)),
88
+ t,
89
+ s
90
+ )
91
+ );
92
+ }
93
+ function nt(p) {
94
+ const c = [];
95
+ for (const [r, a] of p) c[a] = r;
96
+ return c;
97
+ }
98
+ function et(p, c) {
99
+ const r = /* @__PURE__ */ new Map();
100
+ for (const a of p) {
101
+ const e = c.exec(a);
102
+ if (!e) continue;
103
+ const f = r.get(e[1]) ?? [0, 0];
104
+ r.set(e[1], [Math.max(f[0], Number(e[2]) + 1), Math.max(f[1], Number(e[3]) + 1)]);
105
+ }
106
+ return r;
107
+ }
108
+ const k = (p, c, r) => {
109
+ if (c === r) return 0;
110
+ if (c === 255 || r === 255) return 63;
111
+ let a = 0;
112
+ for (let e = 0; e < 3; e++) a += Math.abs(p[c * 3 + e] - p[r * 3 + e]);
113
+ return a / 3;
114
+ };
115
+ function Y(p, c, r) {
116
+ return r.map(([a, e, f]) => {
117
+ const o = p(a), n = p(e);
118
+ let t = 0, s = 0, l = 0;
119
+ for (let u = 0; u < 20; u++) {
120
+ const [i, m, h, b] = f === "h" ? [o(18, u), o(19, u), n(0, u), n(1, u)] : [o(u, 18), o(u, 19), n(u, 0), n(u, 1)];
121
+ t += k(c, m, h), s += k(c, i, m), l += k(c, h, b);
122
+ }
123
+ return { a, b: e, dir: f, across: t / 20, within: Math.max(s, l) / 20 };
124
+ });
125
+ }
126
+ function z(p, c = 2.5, r = 6) {
127
+ return p.filter((a) => a.across > r && a.across > c * a.within);
128
+ }
129
+ function F(p) {
130
+ const c = new Map(P(p).map((o) => [o.toLowerCase(), o])), r = (o) => new Uint8Array(A(L(p, c.get(o.toLowerCase()) ?? o))), a = [...c.keys()].find((o) => o.endsWith(".gam"));
131
+ if (!a) throw new Error(`no .gam in ${p}`);
132
+ const e = N(r(a)), f = [];
133
+ for (const o of e.scenes) {
134
+ if (o.gametype !== C) continue;
135
+ const n = (t) => o.files[v.indexOf(t)];
136
+ !n("map") || !n("bbl") || !n("pal") || f.push({
137
+ desc: o.desc,
138
+ map: n("map"),
139
+ pal: J(r(n("pal"))),
140
+ blocks: O(r(n("map"))).blocks,
141
+ bbl: B(r(n("bbl")), D)
142
+ });
143
+ }
144
+ return f;
145
+ }
146
+ function ot(p, c, r, a, e, f, o = 4, n = c.bbl) {
147
+ const t = new j(e * 20, f * 20);
148
+ for (let s = 0; s < f; s++)
149
+ for (let l = 0; l < e; l++) {
150
+ const u = n[c.blocks[(a + s + x) % x * g + (r + l + g) % g]];
151
+ for (let i = 0; i < 20; i++) for (let m = 0; m < 20; m++) t.px[(s * 20 + i) * t.w + l * 20 + m] = u.pixels[i * 20 + m];
152
+ }
153
+ E(p, t, c.pal, o);
154
+ }
155
+ function G(p, c, r, a, e = 4, f = 0) {
156
+ const o = Math.max(...a.map((t) => t.length)), n = new j(o * (20 + f), a.length * (20 + f), 255);
157
+ a.forEach(
158
+ (t, s) => t.forEach((l, u) => {
159
+ if (!l) return;
160
+ const i = c(l);
161
+ for (let m = 0; m < 20; m++) for (let h = 0; h < 20; h++) n.set(u * (20 + f) + h, s * (20 + f) + m, i(h, m));
162
+ })
163
+ ), E(p, n, r, e);
164
+ }
165
+ function st(p, c, r, a = {}) {
166
+ const e = [], f = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set();
167
+ for (const t of F(p)) {
168
+ const s = c(t.map.toLowerCase());
169
+ if (!s || o.has(t.map.toLowerCase())) continue;
170
+ o.add(t.map.toLowerCase());
171
+ const l = /* @__PURE__ */ new Set();
172
+ e.push([
173
+ t.map.toLowerCase(),
174
+ V((i, m) => s[t.blocks[m * g + i]], typeof r == "function" ? r(t.map.toLowerCase()) : r, g, x, l)
175
+ ]);
176
+ const u = /* @__PURE__ */ new Map();
177
+ s.forEach((i, m) => i !== void 0 && u.set(i, m));
178
+ for (const i of l) f.has(i) || f.set(i, { sc: t, ids: u });
179
+ }
180
+ const n = [];
181
+ for (const [t, { sc: s, ids: l }] of f) {
182
+ const [u, i, m] = JSON.parse(t), h = (b) => {
183
+ const d = s.bbl[l.get(b)].pixels;
184
+ return (w, y) => d[y * 20 + w];
185
+ };
186
+ for (const b of Y(h, s.pal, [[u, i, m]]))
187
+ n.push({ ...b, draw: (d, w = 8) => G(d, h, s.pal, m === "h" ? [[u, i]] : [[u], [i]], w) });
188
+ }
189
+ return { maps: e, seams: n, broken: z(n, a.factor, a.floor) };
190
+ }
191
+ export {
192
+ st as auditDisk,
193
+ tt as autoParts,
194
+ z as brokenSeams,
195
+ V as checkParts,
196
+ F as diskScenes,
197
+ q as gridParts,
198
+ nt as namesOf,
199
+ X as pair,
200
+ Y as seams,
201
+ W as shape,
202
+ et as sizesOf,
203
+ ot as writeArea
204
+ };
@@ -0,0 +1,45 @@
1
+ import { Pixels as x } from "./pixels.js";
2
+ const p = 255;
3
+ function w(t, n, e = 0, l = 0) {
4
+ return t.blit(n, e, l, p);
5
+ }
6
+ function m(t, n) {
7
+ const e = new x(t.w, t.h);
8
+ return e.px.set(t.px.map(n)), e;
9
+ }
10
+ function c(t, n, e, l, o, i = !1, a = p) {
11
+ for (let r = 0; r < n.h; r++)
12
+ for (let f = 0; f < n.w; f++) {
13
+ const u = n.get(i ? n.w - 1 - f : f, r);
14
+ u !== a && u >= 0 && t.rect(e + f * o, l + r * o, o, o, u);
15
+ }
16
+ }
17
+ function g(t, n, e = {}) {
18
+ const l = e.transparent ?? p, o = new x(t.w, t.h, p);
19
+ o.px.set(t.px);
20
+ for (let i = 0; i < t.h; i++)
21
+ for (let a = 0; a < t.w; a++) {
22
+ if (t.get(a, i) !== l) continue;
23
+ [t.get(a - 1, i), t.get(a + 1, i), t.get(a, i - 1), t.get(a, i + 1)].some((f) => f !== l && f !== -1 && (!e.ignoreInk || f !== n)) && o.set(a, i, n);
24
+ }
25
+ return o;
26
+ }
27
+ function s(t, n, e, l, o = 20, i = 20) {
28
+ const a = new x(o, i, p), r = Math.max(...t.map((f) => f.length));
29
+ return a.draw(e ?? Math.floor((o - r) / 2), l ?? i - t.length, t, n), a;
30
+ }
31
+ const d = (t, n, e, l, o) => t.draw(n, e, l, o), y = (t, n, e, l, o, i = p) => c(t, n, e, l, o, !1, i);
32
+ function A(t, n, e = p) {
33
+ return t.px.set(g(t, n, { transparent: e }).px), t;
34
+ }
35
+ export {
36
+ p as CLEAR,
37
+ d as asciiArt,
38
+ s as asciiSprite,
39
+ g as outline,
40
+ A as outlineInPlace,
41
+ w as over,
42
+ m as recolor,
43
+ c as scaleBlit,
44
+ y as scaleBlitTransparent
45
+ };
@@ -0,0 +1,97 @@
1
+ import { SOLTOP as f, SOLRIG as k, SOLBOT as S, SOLLEF as y } from "@lewismoten/gamemaker-sandbox-engine/formats/blocks";
2
+ const A = [
3
+ { id: "floor", label: "Floor", group: "Ground", hint: "Something to walk on" },
4
+ { id: "wall", label: "Wall", group: "Ground", hint: "Solid on every side" },
5
+ { id: "wall-top", label: "Wall top", group: "Ground", hint: "The top edge of a wall" },
6
+ { id: "wall-edge", label: "Wall edge or corner", group: "Ground", hint: "An edge or corner piece of a wall set" },
7
+ { id: "path", label: "Path or road", group: "Ground", hint: "A path, road or trail" },
8
+ { id: "water", label: "Water", group: "Ground", hint: "Water to cross or swim" },
9
+ { id: "shore", label: "Shore", group: "Ground", hint: "Where land meets water" },
10
+ { id: "tree", label: "Tree", group: "Ground", hint: "A tree" },
11
+ { id: "rock", label: "Rock", group: "Ground", hint: "A rock or boulder" },
12
+ { id: "sky", label: "Sky", group: "Ground", hint: "Open air behind a platform level" },
13
+ { id: "decoration", label: "Decoration", group: "Ground", hint: "Looks nice, does nothing" },
14
+ { id: "hazard", label: "Hazard", group: "Ground", hint: "Hurts the hero" },
15
+ { id: "platform", label: "Platform", group: "Doors", hint: "Solid on top only: stand on it from above" },
16
+ { id: "ladder", label: "Ladder", group: "Doors", hint: "Pulls the hero up or down" },
17
+ { id: "door", label: "Door", group: "Doors", hint: "Open; turns into another block when touched" },
18
+ { id: "locked-door", label: "Locked door", group: "Doors", hint: "Needs a key (same lock number)" },
19
+ { id: "exit", label: "Exit", group: "Doors", hint: "Leads out of the level" },
20
+ { id: "entry", label: "Entry", group: "Doors", hint: "Where the hero comes in" },
21
+ { id: "stairs-up", label: "Stairs up", group: "Doors", hint: "Stairs going up" },
22
+ { id: "stairs-down", label: "Stairs down", group: "Doors", hint: "Stairs going down" },
23
+ { id: "chest", label: "Chest", group: "Loot", hint: "A chest that holds something" },
24
+ { id: "treasure", label: "Treasure", group: "Loot", hint: "Money or score when picked up" },
25
+ { id: "key", label: "Key", group: "Loot", hint: "Opens a locked door with the same lock number" },
26
+ { id: "life", label: "Heart or life", group: "Loot", hint: "Adds a life" },
27
+ { id: "powerup", label: "Power-up", group: "Loot", hint: "Picked up to help the hero" },
28
+ { id: "chair", label: "Chair", group: "Furniture", hint: "Faces one way" },
29
+ { id: "table", label: "Table", group: "Furniture", hint: "A table or desk" },
30
+ { id: "bed", label: "Bed", group: "Furniture", hint: "A bed" },
31
+ { id: "counter", label: "Counter", group: "Furniture", hint: "A shop counter or bar" },
32
+ { id: "shelf", label: "Shelf", group: "Furniture", hint: "A shelf or bookcase" },
33
+ { id: "rug", label: "Rug", group: "Furniture", hint: "A rug on the floor" },
34
+ { id: "lamp", label: "Lamp", group: "Furniture", hint: "A lamp or torch" },
35
+ { id: "stove", label: "Stove", group: "Furniture", hint: "A stove or fireplace" },
36
+ { id: "plant", label: "Plant", group: "Furniture", hint: "A pot plant or flower" },
37
+ { id: "monster-spawn", label: "Monster spawn", group: "Spawn", hint: "Gives birth to monsters" },
38
+ { id: "hero-start", label: "Hero start", group: "Spawn", hint: "Where the hero begins" }
39
+ ], L = A.map((e) => e.id), W = ["Ground", "Doors", "Loot", "Furniture", "Spawn"], O = ["N", "E", "S", "W"], $ = { N: "north (up)", E: "east (right)", S: "south (down)", W: "west (left)" }, G = /* @__PURE__ */ new Set(["chair", "bed", "counter", "shelf", "stove", "table", "lamp", "entry", "exit"]), v = /* @__PURE__ */ new Set(["locked-door", "key"]), F = 10, P = (e) => e.some((n) => G.has(n)), R = (e) => e.some((n) => v.has(n)), D = (e) => typeof e == "string" && L.includes(e);
40
+ function I(e, n) {
41
+ const t = {};
42
+ if (!e || typeof e != "object" || Array.isArray(e)) return t;
43
+ for (const [i, o] of Object.entries(e)) {
44
+ const l = Number(i);
45
+ if (!Number.isInteger(l) || l < 0 || l >= n || !o || typeof o != "object") continue;
46
+ const r = o, s = [...new Set((Array.isArray(r.roles) ? r.roles : []).filter(D))];
47
+ if (!s.length) continue;
48
+ const a = { roles: s };
49
+ P(s) && O.includes(r.facing) && (a.facing = r.facing);
50
+ const u = Math.round(Number(r.pair));
51
+ R(s) && u >= 1 && u <= F && (a.pair = u), t[l] = a;
52
+ }
53
+ return t;
54
+ }
55
+ function T(e) {
56
+ const n = Object.keys(e).map(Number).filter((t) => e[t]?.roles.length).sort((t, i) => t - i);
57
+ if (n.length)
58
+ return Object.fromEntries(n.map((t) => [String(t), e[t]]));
59
+ }
60
+ function C(e, n, t) {
61
+ return Object.keys(e).map(Number).filter((i) => e[i].roles.includes(n) && (t === void 0 || e[i].pair === t)).sort((i, o) => i - o);
62
+ }
63
+ const c = f | k | S | y;
64
+ function E(e, n) {
65
+ let t = 0, i = 0, o = 0;
66
+ for (const l of e) {
67
+ if (l === 255) continue;
68
+ const r = n[l * 3] ?? 0, s = n[l * 3 + 1] ?? 0, a = n[l * 3 + 2] ?? 0;
69
+ t++, o += (r + s + a) / 189, a > 20 && a > r * 1.4 && a > s * 1.1 && i++;
70
+ }
71
+ return t ? { blue: i / t, light: o / t } : void 0;
72
+ }
73
+ function M(e, n, t = {}) {
74
+ const i = [], o = (p, b, m) => {
75
+ i.some((w) => w.role === p) || i.push({ role: p, why: b, pair: m });
76
+ }, l = e.solid & c, r = e.effect >= 20 && e.effect <= 29 ? e.effect - 19 : void 0, s = e.touchBl !== n, a = e.grav & 15, u = t.palette ? E(e.pixels, t.palette) : void 0, h = !!u && u.blue >= 0.6, g = e.obj !== 0 || s && !l && (e.scorePts > 0 || e.eamt > 0 && e.effect !== 0), d = e.obj ? "picked up" : "touched";
77
+ return g ? (e.effect === 3 && e.eamt > 0 ? o("treasure", `${d}, adds money`) : e.scorePts > 0 && !(r && e.eamt > 0) && o("treasure", `${d}, adds score`), r && e.eamt > 0 && o("key", `${d}, adds to special counter ${r}`, r), e.effect === 1 && e.eamt > 0 && o("life", `${d}, adds a life`), i.length || o("powerup", e.obj ? "can be picked up" : `${d}, changes the hero`)) : (l === c ? s || r && e.eamt < 0 ? o("locked-door", r ? `solid, and costs special counter ${r}` : "solid, and turns into another block when touched", r) : o("wall", "solid on every side") : l === f && o("platform", "solid on top only"), l !== c && (r && e.eamt < 0 ? o("locked-door", `costs special counter ${r} when touched`, r) : s && o("door", "turns into another block when touched"))), e.chHitPt < 0 && !e.obj && o("hazard", "hurts when touched"), a & 1 && l !== c && o("ladder", (a & 5) === 5 ? "up and down pulls cancel" : "pulls up"), e.birthTime > 0 && e.birthMon > 0 && o("monster-spawn", `gives birth to monster ${e.birthMon}`), t.inTerrain && o("wall-edge", "part of a terrain (edge set) in this block set"), h && !l && !e.obj && (u.light > 0.55 && o("sky", "a light blue picture, nothing solid"), o("water", "a mostly blue picture, nothing solid")), !l && !e.obj && !s && !e.chHitPt && !e.scorePts && !(a & 1) && !r && !h && !i.length && o("floor", "walkable and does nothing"), i;
78
+ }
79
+ function H(e, n) {
80
+ return n.filter((t) => !e.includes(t.role));
81
+ }
82
+ export {
83
+ O as FACINGS,
84
+ $ as FACING_NAMES,
85
+ F as MAX_PAIR,
86
+ A as ROLES,
87
+ W as ROLE_GROUPS,
88
+ L as ROLE_IDS,
89
+ C as blocksWithRole,
90
+ I as cleanRoles,
91
+ P as hasFacing,
92
+ R as hasPair,
93
+ T as packRoles,
94
+ H as pendingSuggestions,
95
+ E as pictureBlue,
96
+ M as suggestRoles
97
+ };
@@ -0,0 +1,40 @@
1
+ import { decodeVoc as k } from "@lewismoten/gamemaker-sandbox-engine/formats/voc";
2
+ const v = 1e3, M = 1e3, S = 30;
3
+ function g(t) {
4
+ const n = k(t);
5
+ return n.sampleRate ? n.samples.length / n.sampleRate * 1e3 : 0;
6
+ }
7
+ function _(t) {
8
+ const { events: n, scenes: f, starts: b, names: p } = t, y = (e) => {
9
+ let i = -1;
10
+ for (const o of f) o.t <= e && (i = o.n);
11
+ return i;
12
+ }, l = [];
13
+ return n.forEach((e, i) => {
14
+ if (e.kind !== "voc" || !e.bytes) return;
15
+ const o = g(e.bytes);
16
+ let r = 1 / 0, a = "picture";
17
+ for (const s of n.slice(i + 1)) {
18
+ if (s.kind === "voc") {
19
+ r = s.t, a = (s.bytes && p.get(s.bytes)) ?? "a clip";
20
+ break;
21
+ }
22
+ if (s.kind === "stopVoc") {
23
+ r = s.t;
24
+ break;
25
+ }
26
+ }
27
+ const u = r - e.t;
28
+ if (u + S >= o) return;
29
+ const d = y(e.t), m = p.get(e.bytes) ?? "?", h = a === "picture" || y(r) !== d, c = [...b].reverse().find((s) => s.t <= e.t), $ = c && c.n === d && e.t - c.t <= v && !f.some((s) => s.t > c.t && s.t <= e.t) && !n.slice(0, i).some((s) => s.kind === "voc" && s.t >= c.t) && o >= M;
30
+ h ? l.push({ kind: "end", scene: d, clip: m, ms: o, played: u, by: a, at: e.t }) : $ && l.push({ kind: "start", scene: d, clip: m, ms: o, played: u, by: a, at: e.t, since: e.t - c.t });
31
+ }), l;
32
+ }
33
+ function w(t) {
34
+ return `${t.kind === "end" ? `scene ${t.scene} ends during ${t.clip}` : `scene ${t.scene} starts with ${t.clip}`}: ${Math.round(t.played)} of ${Math.round(t.ms)} ms played, cut by ${t.by} (at ${(t.at / 1e3).toFixed(1)} s${t.since === void 0 ? "" : `, ${Math.round(t.since)} ms into the level`})`;
35
+ }
36
+ export {
37
+ _ as clipCuts,
38
+ w as describeCut,
39
+ g as vocMs
40
+ };
@@ -0,0 +1,18 @@
1
+ import { rng as e } from "./pixels.js";
2
+ const x = (t, n, c) => [t[0] + (n[0] - t[0]) * c, t[1] + (n[1] - t[1]) * c, t[2] + (n[2] - t[2]) * c], l = (t) => Math.max(0, Math.min(255, t)), g = (t, n, c) => {
3
+ const o = Math.max(0, Math.min(1, (c - t) / (n - t)));
4
+ return o * o * (3 - 2 * o);
5
+ };
6
+ function p(t) {
7
+ const n = e(t), c = Array.from({ length: 4096 }, () => n()), o = (m, h) => c[(h % 64 + 64) % 64 * 64 + (m % 64 + 64) % 64];
8
+ return (m, h) => {
9
+ const r = Math.floor(m), s = Math.floor(h), a = m - r, i = h - s, f = o(r, s) + (o(r + 1, s) - o(r, s)) * a, M = o(r, s + 1) + (o(r + 1, s + 1) - o(r, s + 1)) * a;
10
+ return f + (M - f) * i;
11
+ };
12
+ }
13
+ export {
14
+ l as clamp,
15
+ x as mixc,
16
+ p as noise2,
17
+ g as smooth
18
+ };
@@ -0,0 +1,76 @@
1
+ import { mkdirSync as d, writeFileSync as h, renameSync as u, readdirSync as g, rmSync as y } from "node:fs";
2
+ import { join as c } from "node:path";
3
+ import { parseGame as l, ADVTYPE as p, serializeGame as w } from "@lewismoten/gamemaker-sandbox-engine/formats/game";
4
+ import { normalize as m } from "@lewismoten/gamemaker-sandbox-engine/core/gameFiles";
5
+ const S = (r) => Buffer.from(r).toString("latin1");
6
+ function k(r) {
7
+ const e = [], o = /* @__PURE__ */ new Set();
8
+ for (const [t, f] of r)
9
+ if (t.endsWith(".gam"))
10
+ for (const a of l(f).scenes) {
11
+ const i = a.gametype === p ? m(a.files[0] ?? "") : "";
12
+ i.endsWith(".pal") && r.has(i) && !o.has(i) && (o.add(i), e.push(i));
13
+ }
14
+ const s = [...r.keys()].filter((t) => t.endsWith(".pal") && !o.has(t)).sort(), n = /* @__PURE__ */ new Map();
15
+ for (const t of [...e, ...s]) {
16
+ const f = S(r.get(t));
17
+ n.set(f, [...n.get(f) ?? [], t]);
18
+ }
19
+ return [...n.values()].filter((t) => t.length > 1);
20
+ }
21
+ function v(r) {
22
+ const e = /* @__PURE__ */ new Map();
23
+ let o = 0;
24
+ for (const [s, ...n] of k(r))
25
+ for (const t of n)
26
+ e.set(t, s), o += r.get(t).length;
27
+ if (!e.size) return { merged: e, saved: o };
28
+ for (const [s, n] of [...r])
29
+ if (s.endsWith(".gam")) {
30
+ const t = l(n);
31
+ let f = !1;
32
+ for (const a of t.scenes) {
33
+ const i = a.gametype === p ? e.get(m(a.files[0] ?? "")) : void 0;
34
+ i && (a.files[0] = i, f = !0);
35
+ }
36
+ f && r.set(s, w(t));
37
+ }
38
+ for (const s of e.keys()) r.delete(s);
39
+ return { merged: e, saved: o };
40
+ }
41
+ class D {
42
+ constructor(e) {
43
+ this.dir = e;
44
+ }
45
+ dir;
46
+ files = /* @__PURE__ */ new Map();
47
+ /** Adds a file (8.3 name, lower case on disk). */
48
+ put(e, o) {
49
+ if (!/^[a-z0-9_$~!#%&-]{1,8}\.[a-z0-9]{1,3}$/i.test(e)) throw new Error(`${e} is not a DOS 8.3 file name`);
50
+ this.files.set(e.toLowerCase(), typeof o == "string" ? z(o) : o);
51
+ }
52
+ /**
53
+ * Replace the selected output directory's contents with the collected native files. Each file
54
+ * is written beside its place and renamed over it, and leftovers go last, so a server reading
55
+ * the folder during a rebuild never finds a file missing or half written.
56
+ */
57
+ write(e = this.dir) {
58
+ v(this.files), d(e, { recursive: !0 });
59
+ let o = 0;
60
+ for (const [s, n] of this.files) {
61
+ const t = c(e, `.${s}.${process.pid}.part`);
62
+ h(t, n), u(t, c(e, s)), o += n.length;
63
+ }
64
+ for (const s of g(e)) this.files.has(s) || y(c(e, s), { recursive: !0, force: !0 });
65
+ return o;
66
+ }
67
+ }
68
+ function z(r) {
69
+ const e = r.replace(/\r?\n/g, `\r
70
+ `);
71
+ return Uint8Array.from([...e].map((o) => o.charCodeAt(0) < 256 ? o.charCodeAt(0) : 63));
72
+ }
73
+ export {
74
+ D as Disk,
75
+ z as dosText
76
+ };
@@ -0,0 +1,13 @@
1
+ import { encodeFli as s } from "@lewismoten/gamemaker-sandbox-engine/formats/fli";
2
+ import { dimmed as u } from "./reel.js";
3
+ function p(t, n = 0.5) {
4
+ return Math.max(4, Math.round(n * 70 / Math.max(1, t)));
5
+ }
6
+ function x(t, n, e = {}) {
7
+ const { fade: l, ...d } = e, o = l ?? p(e.speed ?? 5), a = t.map((h, r) => e.palettes?.[r] ?? n), i = t[t.length - 1], m = a[a.length - 1], c = Array.from({ length: o }, (h, r) => u(m, (o - 1 - r) / o));
8
+ return s([...t, ...c.map(() => i)], n, { ...d, palettes: [...a, ...c] });
9
+ }
10
+ export {
11
+ x as encodeFliFadeOut,
12
+ p as fadeOutLength
13
+ };