@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
@@ -0,0 +1,169 @@
1
+ import type { ExtrudedText } from './sdftext.js';
2
+ export type V = [number, number, number];
3
+ export declare const add: (a: V, b: V) => V;
4
+ export declare const sub: (a: V, b: V) => V;
5
+ export declare const scale: (a: V, k: number) => V;
6
+ export declare const dot: (a: V, b: V) => number;
7
+ export declare const cross: (a: V, b: V) => V;
8
+ export declare const mix: (a: V, b: V, t: number) => V;
9
+ export declare const clamp01: (v: number) => number;
10
+ export declare function norm(v: V): V;
11
+ /** A 3x3 rotation as rows (object to world). */
12
+ type M3 = number[];
13
+ export declare function rotX(a: number): M3;
14
+ export declare function rotY(a: number): M3;
15
+ /** a then b: the rotation that applies `b` first, then `a`. */
16
+ export declare function mulM(a: M3, b: M3): M3;
17
+ /** The rotation whose columns are these axes (object x, y, z in world space). */
18
+ export declare const fromAxes: (x: V, y: V, z: V) => M3;
19
+ export declare const apply: (m: M3, v: V) => V;
20
+ /** Where a shape sits: object point p is at rot * (p * size) + pos in the world. */
21
+ interface Place {
22
+ rot: M3;
23
+ pos: V;
24
+ size: number;
25
+ }
26
+ export declare const placed: (pos?: V, rot?: M3, size?: number) => Place;
27
+ /** What a ray found, in object space (`p`, `n`) and the world (`n` is world). */
28
+ interface LocalHit {
29
+ t: number;
30
+ /** Object-space normal. */
31
+ n: V;
32
+ }
33
+ export interface Hit {
34
+ t: number;
35
+ p: V;
36
+ /** The point in the shape's own coordinates (for textures). */
37
+ local: V;
38
+ /** World-space unit normal, facing the ray. */
39
+ n: V;
40
+ shape: Shape;
41
+ }
42
+ /** Surface look: the shader gets the hit and returns a base color and how shiny it is. */
43
+ export interface Surface {
44
+ color: V;
45
+ /** Diffuse share of the light. */
46
+ kd: number;
47
+ /** Specular highlight strength and sharpness (Phong). */
48
+ ks: number;
49
+ shine: number;
50
+ /** How much of the sky the surface mirrors (0 = none). */
51
+ mirror: number;
52
+ /** Extra light the surface gives off (a highlight sweep). */
53
+ glow?: V;
54
+ }
55
+ export type Material = (h: Hit) => Surface;
56
+ export declare abstract class Shape {
57
+ at: Place;
58
+ material: Material;
59
+ /** World-space bounding box, [min, max]. */
60
+ box: [V, V];
61
+ /** Whether the shape throws a shadow. */
62
+ shadows: boolean;
63
+ constructor(at: Place, material: Material);
64
+ /** The nearest hit of an object-space ray after EPS, or undefined. */
65
+ protected abstract local(o: V, d: V, tmax: number): LocalHit | undefined;
66
+ /** The shape's own bounding box in object space. */
67
+ protected abstract bounds(): [V, V];
68
+ /** Recomputes the world box after `at` changes. */
69
+ update(): this;
70
+ toWorld(p: V): V;
71
+ /** The world box's eight corners. */
72
+ corners(): V[];
73
+ hit(o: V, d: V, tmax: number): Hit | undefined;
74
+ }
75
+ export declare class Box extends Shape {
76
+ readonly mn: V;
77
+ readonly mx: V;
78
+ constructor(mn: V, mx: V, at: Place, material: Material);
79
+ protected bounds(): [V, V];
80
+ protected local(o: V, d: V, tmax: number): LocalHit | undefined;
81
+ }
82
+ /** A cone frustum (or cylinder when r0 = r1) around the object y axis, y0 to y1, its ends capped or open. */
83
+ export declare class Cone extends Shape {
84
+ readonly r0: number;
85
+ readonly r1: number;
86
+ readonly y0: number;
87
+ readonly y1: number;
88
+ readonly caps: {
89
+ bottom?: boolean;
90
+ top?: boolean;
91
+ };
92
+ constructor(r0: number, r1: number, y0: number, y1: number, at: Place, material: Material, caps?: {
93
+ bottom?: boolean;
94
+ top?: boolean;
95
+ });
96
+ protected bounds(): [V, V];
97
+ protected local(o: V, d: V, tmax: number): LocalHit | undefined;
98
+ }
99
+ /** A flat ring (or disc when inner = 0) in the object's y = 0 plane. */
100
+ export declare class Ring extends Shape {
101
+ readonly inner: number;
102
+ readonly outer: number;
103
+ constructor(inner: number, outer: number, at: Place, material: Material);
104
+ protected bounds(): [V, V];
105
+ protected local(o: V, d: V, tmax: number): LocalHit | undefined;
106
+ }
107
+ export declare class Sphere extends Shape {
108
+ readonly r: number;
109
+ constructor(r: number, at: Place, material: Material);
110
+ protected bounds(): [V, V];
111
+ protected local(o: V, d: V, tmax: number): LocalHit | undefined;
112
+ }
113
+ /** A rod with round ends from a to b. */
114
+ export declare class Capsule extends Shape {
115
+ readonly a: V;
116
+ readonly b: V;
117
+ readonly r: number;
118
+ constructor(a: V, b: V, r: number, at: Place, material: Material);
119
+ protected bounds(): [V, V];
120
+ protected local(o: V, d: V, tmax: number): LocalHit | undefined;
121
+ }
122
+ /** A flat triangle, seen from both sides. */
123
+ export declare class Tri extends Shape {
124
+ readonly a: V;
125
+ readonly b: V;
126
+ readonly c: V;
127
+ constructor(a: V, b: V, c: V, at: Place, material: Material);
128
+ protected bounds(): [V, V];
129
+ protected local(o: V, d: V, tmax: number): LocalHit | undefined;
130
+ }
131
+ /** Beveled 3D lettering (sdftext.ts), found by sphere tracing. */
132
+ export declare class Lettering extends Shape {
133
+ readonly text: ExtrudedText;
134
+ constructor(text: ExtrudedText, at: Place, material: Material);
135
+ protected bounds(): [V, V];
136
+ protected local(o: V, d: V, tmax: number): LocalHit | undefined;
137
+ }
138
+ /** Shapes kept together behind one bounding box, so a ray that misses the box skips them all. */
139
+ export declare class Group extends Shape {
140
+ readonly parts: Shape[];
141
+ constructor(parts: Shape[]);
142
+ protected bounds(): [V, V];
143
+ protected local(): LocalHit | undefined;
144
+ update(): this;
145
+ hit(o: V, d: V, tmax: number): Hit | undefined;
146
+ }
147
+ /** The nearest hit among shapes, or undefined. */
148
+ export declare function nearest(shapes: Shape[], o: V, d: V, tmax?: number): Hit | undefined;
149
+ /** Is anything between a point and the light along direction l? */
150
+ export declare function blocked(shapes: Shape[], o: V, l: V, tmax?: number): boolean;
151
+ /** A pinhole camera for a 320x200 screen shown 4:3 (tall pixels). */
152
+ export declare class Camera {
153
+ readonly eye: V;
154
+ readonly focal: number;
155
+ readonly w: number;
156
+ readonly h: number;
157
+ readonly aspect: number;
158
+ readonly fw: V;
159
+ readonly right: V;
160
+ readonly up: V;
161
+ constructor(eye: V, target: V, focal: number, w?: number, h?: number, aspect?: number);
162
+ ray(sx: number, sy: number): V;
163
+ project(p: V): [number, number] | undefined;
164
+ }
165
+ export declare function noise(x: number, y: number, z: number): number;
166
+ export declare function fbm(x: number, y: number, z: number, octaves?: number): number;
167
+ /** A grainy hash in 0..1 for a point (sand). */
168
+ export declare const grain: (x: number, y: number, z: number, k: number) => number;
169
+ export {};
@@ -0,0 +1 @@
1
+ export declare function recordedDemo(pairs: readonly number[], waitTicks?: number, releaseTicks?: number): Uint8Array;
@@ -0,0 +1,71 @@
1
+ import { Pixels } from './pixels.js';
2
+ /** The road in perspective: half its width on each screen row, and where its lanes and lines run. */
3
+ export interface RoadView {
4
+ /** The lane's half width at screen row y (its rails sit at vx +- this). */
5
+ halfWidth: (y: number) => number;
6
+ /** Where lane k (-1 left, 0 middle, 1 right) runs at screen row y: two thirds of the way out for the side lanes. */
7
+ laneX: (k: number, y: number) => number;
8
+ /** Where the lines between the lanes run (side -1 or 1). */
9
+ dividerX: (side: number, y: number) => number;
10
+ }
11
+ /** A three-lane road from the vanishing point (vx, horizon), its half width growing `spread` pixels a row. */
12
+ export declare function roadView(horizon: number, vx: number, spread: number): RoadView;
13
+ /** One entry of a timetable: [tick after the scene starts, lane, what comes]. */
14
+ export type RoadEntry<K> = readonly [tick: number, lane: number, kind: K];
15
+ /** A spawner block of a lane's chain: on the map from the last entry's tick until just after its own. */
16
+ export interface SpawnBlock<K> {
17
+ name: string;
18
+ kind: K;
19
+ /** Its birth time: the entry's tick (its first birth is its only one on the map). */
20
+ birthTime: number;
21
+ /** The next block of the chain, and when it takes over. */
22
+ next: string;
23
+ ntime: number;
24
+ }
25
+ /** A lane's chain of spawner blocks, its first block (the one on the map) and the blank it ends on. */
26
+ export interface SpawnChain<K> {
27
+ lane: number;
28
+ first: string;
29
+ blocks: SpawnBlock<K>[];
30
+ end: string;
31
+ }
32
+ /**
33
+ * The spawner chains for a timetable, one per lane: a block per entry, each giving birth once.
34
+ * Every block's clock starts with the scene, so a block whose birth time is its entry's tick, on
35
+ * the map only around that tick, gives birth exactly then. Blocks are named `${prefix}${lane}_${i}`
36
+ * and `${prefix}${lane}_end`.
37
+ */
38
+ export declare function spawnChains<K>(waves: readonly RoadEntry<K>[], lanes: readonly number[], prefix?: string): SpawnChain<K>[];
39
+ /** A path step: [blocks across, blocks down, pixels a tick]. */
40
+ export type RoadStep = [dx: number, dy: number, speed: number];
41
+ /** A Game-Maker path corner: [x, y] from the start, the speed, the orientation. */
42
+ export type RoadCorner = [x: number, y: number, speed: number, orient: number];
43
+ /** A path as steps from where the last one ended (Game-Maker stores corners from the start). */
44
+ export declare function roadCorners(steps: RoadStep[], orient: number): RoadCorner[];
45
+ /**
46
+ * Lane k's slide from the vanishing point: -1 left, 0 middle, 1 right, outward along its line
47
+ * and faster as it comes (a block in 20 ticks, the next in 10, then 4 and 5 pixels a tick).
48
+ */
49
+ export declare const laneSlide: (k: number) => RoadStep[];
50
+ /** Leap speed: more than any spawner is from the vanishing point, in pixels a tick. */
51
+ export declare const ROAD_LEAP = 240;
52
+ /** The first step, from a spawner's cell onto the vanishing point's in one tick. */
53
+ export declare const leapTo: (from: [number, number], vp: [number, number]) => RoadStep;
54
+ /** A monster's sizes in step with its slide: a dot while it crawls the first block, then nearer and nearer. */
55
+ export declare const growPics: (name: string) => [string, number][];
56
+ /** How big each size is, and the row of the sprite its bottom sits on (lower as it nears). */
57
+ export declare const ROAD_SIZES: readonly [{
58
+ readonly scale: 0.25;
59
+ readonly bottom: 6;
60
+ }, {
61
+ readonly scale: 0.45;
62
+ readonly bottom: 11;
63
+ }, {
64
+ readonly scale: 0.72;
65
+ readonly bottom: 16;
66
+ }, {
67
+ readonly scale: 1;
68
+ readonly bottom: 19;
69
+ }];
70
+ /** A full-size 20x20 picture shrunk (nearest pixel), centered, its bottom row on `bottom`; `clear` is transparent. */
71
+ export declare function shrinkSprite(src: Pixels, scale: number, bottom: number, clear: number): Pixels;
@@ -0,0 +1,6 @@
1
+ export declare function expectScene(bot: {
2
+ sim: {
3
+ scene: number;
4
+ };
5
+ log: readonly string[];
6
+ }, scene: number, what: string): void;
@@ -0,0 +1,17 @@
1
+ import type { Pixels } from './pixels.js';
2
+ /** The dark strip under name i (0..9): the marker and the 20 letters with their margin. */
3
+ export declare const SLOT: {
4
+ readonly x: 54;
5
+ readonly w: 196;
6
+ readonly h: 14;
7
+ readonly y: (i: number) => number;
8
+ };
9
+ /** The light strip under the message line. */
10
+ export declare const STATUS: {
11
+ readonly x: 34;
12
+ readonly y: 181;
13
+ readonly w: 246;
14
+ readonly h: 15;
15
+ };
16
+ /** Paints the ten name strips in `fill` (an optional 1 pixel `edge` round each), and the message strip. */
17
+ export declare function saveSlots(p: Pixels, fill: number, status: number, edge?: number): Pixels;
@@ -0,0 +1,11 @@
1
+ import { type World } from '@lewismoten/gamemaker-sandbox-engine/engine/world';
2
+ export { changeBlocks } from '@lewismoten/gamemaker-sandbox-engine/engine/scene';
3
+ export declare function initializeScene(w: World, start: {
4
+ x: number;
5
+ y: number;
6
+ }, spawnWhenMonstersDisabled?: boolean): void;
7
+ /** Compatibility for simulators that kept block birth schedules even with monsters disabled. */
8
+ export declare const legacySceneInits: (w: World, start: {
9
+ x: number;
10
+ y: number;
11
+ }) => void;
@@ -1,8 +1,8 @@
1
- import { type CharInfo, type World } from '../../web/src/engine/world.js';
2
- import { type Block } from '../../web/src/formats/blocks.js';
3
- import type { Character } from '../../web/src/formats/character.js';
4
- import type { GameMap } from '../../web/src/formats/map.js';
5
- import type { Monster } from '../../web/src/formats/monster.js';
1
+ import { type CharInfo, type World } from '@lewismoten/gamemaker-sandbox-engine/engine/world';
2
+ import { type Block } from '@lewismoten/gamemaker-sandbox-engine/formats/blocks';
3
+ import type { Character } from '@lewismoten/gamemaker-sandbox-engine/formats/character';
4
+ import type { GameMap } from '@lewismoten/gamemaker-sandbox-engine/formats/map';
5
+ import type { Monster } from '@lewismoten/gamemaker-sandbox-engine/formats/monster';
6
6
  export interface SimScene {
7
7
  map: GameMap;
8
8
  bbl: Block[];
@@ -0,0 +1,3 @@
1
+ import { Pixels } from './pixels.js';
2
+ export declare const page: (lines: string[], pages?: number) => string;
3
+ export declare const sprite: (set: Map<string, Pixels>, name: string) => Pixels;
@@ -0,0 +1,34 @@
1
+ /** A stroke piece: x0, y0, x1, y1 (center line) and its radius. */
2
+ export type Seg = [number, number, number, number, number];
3
+ /**
4
+ * One line of text as stroke pieces, centered on x = 0 with its baseline at `y`.
5
+ * `height` is the cap height; `gap` the space between letters (in cap heights).
6
+ */
7
+ export declare function textStrokes(text: string, height: number, y: number, gap?: number): Seg[];
8
+ /** Distances to the strokes' outsides on a grid (negative inside), capped at `cap`. */
9
+ export declare class DistanceGrid {
10
+ readonly cell: number;
11
+ readonly cap: number;
12
+ readonly x0: number;
13
+ readonly y0: number;
14
+ readonly x1: number;
15
+ readonly y1: number;
16
+ readonly nx: number;
17
+ readonly ny: number;
18
+ readonly d: Float32Array;
19
+ constructor(segs: Seg[], cell?: number, cap?: number);
20
+ /** The distance at (x, y), bilinear between cells; outside the grid, a safe lower bound. */
21
+ at(x: number, y: number): number;
22
+ }
23
+ /** The letters as a solid: the 2D outline pushed `depth` deep (z from -depth/2 to depth/2), its edges rounded by `bevel`. */
24
+ export declare class ExtrudedText {
25
+ readonly grid: DistanceGrid;
26
+ readonly bevel: number;
27
+ readonly half: number;
28
+ constructor(grid: DistanceGrid, depth: number, bevel: number);
29
+ sdf(x: number, y: number, z: number): number;
30
+ /** Where a ray (object space, unit direction) first meets the letters, or -1. */
31
+ trace(ox: number, oy: number, oz: number, dx: number, dy: number, dz: number): number;
32
+ /** The surface normal at a point (object space), from the field's gradient. */
33
+ normal(x: number, y: number, z: number): [number, number, number];
34
+ }
@@ -0,0 +1,23 @@
1
+ import { Pixels } from './pixels.js';
2
+ /** A shade between ramp[lo] and ramp[hi] for level 0..1, ordered-dithered at (x, y). */
3
+ export declare function shadeAt(ramp: number[], lo: number, hi: number, level: number, x: number, y: number): number;
4
+ /**
5
+ * A vertical gradient across a rectangle. With `rows`, the blend between two ramp steps is
6
+ * dithered by whole rows (each row one color) instead of the 4x4 pattern: it reads as fine
7
+ * horizontal lines, and a GIF of it is far smaller, because a row of one color packs into a
8
+ * few LZW codes while a dither pattern costs codes all along the row.
9
+ */
10
+ export declare function gradient(p: Pixels, x0: number, y0: number, w: number, h: number, ramp: number[], lo: number, hi: number, rows?: boolean): Pixels;
11
+ /** A lit ellipsoid lump, light from the upper left. */
12
+ export declare function blob(p: Pixels, cx: number, cy: number, rx: number, ry: number, ramp: number[], lo?: number, hi?: number, light?: number): Pixels;
13
+ /** A raised box: light top/left edge, dark bottom/right edge. */
14
+ export declare function bevel(p: Pixels, x: number, y: number, w: number, h: number, ramp: number[], face: number, depth?: number, edges?: readonly [number, number, number, number]): Pixels;
15
+ /** Fills a rectangle with a speckled texture from ramp[lo..hi]. */
16
+ export declare function speckle(p: Pixels, x0: number, y0: number, w: number, h: number, ramp: number[], base: number, spread: number, seed: number, density?: number): Pixels;
17
+ /**
18
+ * Steps every pixel that belongs to one of `ramps` by `steps` along its own ramp (negative darkens, positive
19
+ * lightens), where `level(x, y)` (0..1) is ordered-dithered in: a cast shadow, or a painted pool of light, that
20
+ * keeps the colors of whatever it falls on. Pixels in no ramp are left alone.
21
+ */
22
+ export declare function rampShift(p: Pixels, ramps: number[][], steps: number, level: (x: number, y: number) => number): Pixels;
23
+ export declare function pool(p: Pixels, cx: number, cy: number, rx: number, ry: number, r: number[], lo: number, hi: number): Pixels;
@@ -0,0 +1,20 @@
1
+ import { type Block } from '@lewismoten/gamemaker-sandbox-engine/formats/blocks';
2
+ import type { GameMap } from '@lewismoten/gamemaker-sandbox-engine/formats/map';
3
+ export interface SceneBlocks {
4
+ blocks: Block[];
5
+ map: GameMap;
6
+ }
7
+ export interface SharedBlocks {
8
+ /** The shared set, BACKBL blocks (empty ones after the used). */
9
+ blocks: Block[];
10
+ /** Per scene, local block number to the shared one (-1: unused). */
11
+ numbers: number[][];
12
+ /** Per scene, its map with the shared numbers. */
13
+ maps: GameMap[];
14
+ }
15
+ /**
16
+ * One set for `scenes`. Scene 0's block 0 stays block 0; a block at a number listed in `pin`
17
+ * (such as a felt egg the desk knows by number) keeps that number. Throws when the used blocks
18
+ * don't fit BACKBL or two different blocks want one pinned number.
19
+ */
20
+ export declare function shareBlocks(scenes: SceneBlocks[], pin?: number[]): SharedBlocks;
@@ -0,0 +1,89 @@
1
+ import { type CmfEvent } from '@lewismoten/gamemaker-sandbox-engine/formats/cmf';
2
+ /** A reedy, slightly bleating lead with vibrato (the singer). */
3
+ export declare const VOICE: Uint8Array<ArrayBufferLike>;
4
+ /** Oboe-ish double reed. */
5
+ export declare const REED: Uint8Array<ArrayBufferLike>;
6
+ /** Gospel drawbar organ for the comping. */
7
+ export declare const ORGAN: Uint8Array<ArrayBufferLike>;
8
+ /** A soft flute. */
9
+ export declare const FLUTE: Uint8Array<ArrayBufferLike>;
10
+ /** A plucked "oud". */
11
+ export declare const OUD: Uint8Array<ArrayBufferLike>;
12
+ /** Celesta / music box. */
13
+ export declare const CELESTA: Uint8Array<ArrayBufferLike>;
14
+ /** Electric piano for comping. */
15
+ export declare const EPIANO: Uint8Array<ArrayBufferLike>;
16
+ /** A rounder fingered bass. */
17
+ export declare const BASS: Uint8Array<ArrayBufferLike>;
18
+ export interface Section {
19
+ /** One chord per bar, or two ("D A": half a bar each). */
20
+ chords: string[];
21
+ /** One string of notes per bar (4 beats each), "G4 q, r e, ..." as in kit/music. */
22
+ tune: string[];
23
+ }
24
+ /** Bars of one section, sliced (e.g. the chorus without its pickup). */
25
+ export declare const slice: (s: Section, from: number, to?: number) => Section;
26
+ /** A section with its last bar's tune replaced (to change the pickup into the next part). */
27
+ export declare const ending: (s: Section, last: string) => Section;
28
+ /** Bars of band alone, one per chord. */
29
+ export declare const vamp: (chords: string[], tune?: string) => Section;
30
+ /** How the band voices chords: three comping tones (MIDI, low to high) and the bass root. */
31
+ interface ChordBook {
32
+ voicing: (chord: string) => number[];
33
+ root: (chord: string) => number;
34
+ }
35
+ /** A chord book from tables of note names and bass roots (a song's own hand-picked voicings). */
36
+ export declare function chordTable(voicing: Record<string, string[]>, root: Record<string, number>): ChordBook;
37
+ type Drum = 'k' | 's' | 't' | 'c' | 'h';
38
+ /** One bar of drums: per drum an 8th-note (8 chars) or 16th-note (16 chars) grid; 'x' hits, 'X' accents, '.' rests. */
39
+ export type Groove = Partial<Record<Drum, string>>;
40
+ export interface Part {
41
+ section: Section;
42
+ /** Melody patch on channel 0 (and the optional double on channel 1). */
43
+ lead: Uint8Array;
44
+ leadVel?: number;
45
+ /** Transpose the whole part (semitones). */
46
+ shift?: number;
47
+ /** Play the tune this much higher than written (12 for the flute and celesta). */
48
+ up?: number;
49
+ /** Channel 1: 'double' the tune an octave under the lead, 'octave' an octave over it, or none. */
50
+ second?: 'double' | 'octave' | 'none';
51
+ secondPatch?: Uint8Array;
52
+ secondVel?: number;
53
+ bass: 'whole' | 'half' | 'pump' | 'walk' | 'eighths';
54
+ bassPatch?: Uint8Array;
55
+ bassVel?: number;
56
+ /** Comping rhythm for one bar: 'x' chord, 'r' rest, each with a length, e.g. 'r e, x e, r e, x e, ...'. */
57
+ comp: string;
58
+ compPatch: Uint8Array;
59
+ compVel?: number;
60
+ /** A groove name per bar (the last one repeats). */
61
+ drums: string[];
62
+ drumVel?: number;
63
+ /** Leave the tune out (bars of band only). */
64
+ noTune?: boolean;
65
+ }
66
+ export declare class Writer {
67
+ private chords;
68
+ readonly tpb: number;
69
+ readonly events: CmfEvent[];
70
+ readonly instruments: Uint8Array[];
71
+ bar: number;
72
+ private current;
73
+ constructor(bpm: number, chords?: ChordBook);
74
+ private tick;
75
+ /** A note from beat `at` lasting `len` beats; it lets go a little early so the next one retriggers. */
76
+ note(ch: number, at: number, len: number, n: number, vel: number, legato?: number): void;
77
+ /** Plays a note string from beat `at`; returns its length in beats. */
78
+ line(ch: number, at: number, s: string, vel: number, shift?: number, legato?: number): number;
79
+ drums(at: number, g: Groove, vel: number): void;
80
+ /** The bass for `beats` beats from `at` under one chord. */
81
+ private bassLine;
82
+ /** Writes a section's bars: tune, second voice, bass, three comping voices and drums. */
83
+ part(p: Part): this;
84
+ /** Puts each melodic channel's patch in place for a part: the first part's are the file's instruments 0-5; later changes add an instrument and a program change. */
85
+ private patches;
86
+ /** The .CMF: ends exactly on the bar line, so PLAYGAME's restart keeps time. */
87
+ cmf(): Uint8Array;
88
+ }
89
+ export {};
@@ -0,0 +1,99 @@
1
+ import type { Writer } from './song.js';
2
+ /** Rhythm mode drum channels: bass drum (its own voice, FM channel 6), snare, tom-tom, cymbal, hi-hat. */
3
+ export declare const DRUM: {
4
+ readonly kick: 11;
5
+ readonly snare: 12;
6
+ readonly tom: 13;
7
+ readonly cymbal: 14;
8
+ readonly hat: 15;
9
+ };
10
+ /** One note of a phrase: MIDI (null for a rest), its length in beats, and how it moves. */
11
+ interface Tone {
12
+ n: number | null;
13
+ beats: number;
14
+ /** Slide up into the note from this many semitones below. */
15
+ scoop: number;
16
+ /** Fall away this many semitones as it ends. */
17
+ fall: number;
18
+ /** Velocity added (an accent) or taken away. */
19
+ accent: number;
20
+ /** Tied on from the note before (no new attack). */
21
+ tie: boolean;
22
+ }
23
+ /**
24
+ * Notes as text, as in kit/music but with triplets ("t", a third of a beat, "x" a sixth) and
25
+ * marks: "~C5 q" scoops up into the note, "C5 q\" falls off it, "C5 q!" accents it, "C5 q-"
26
+ * plays it softer, "_ q" holds the note before for longer.
27
+ */
28
+ export declare function tones(s: string): Tone[];
29
+ /** A patch with its levels changed (total level 0 loudest .. 63 silent; the key scaling bits are kept). */
30
+ export declare function leveled(inst: Uint8Array, o: {
31
+ mod?: number;
32
+ car?: number;
33
+ }): Uint8Array;
34
+ /** The twin of a patch with vibrato on both operators (or off, if it had it): play both for a choir. */
35
+ export declare function detuned(inst: Uint8Array): Uint8Array;
36
+ /** A patch with its waveforms set (0 sine, 1 half sine, 2 absolute sine, 3 pulse sine). */
37
+ export declare function waved(inst: Uint8Array, mod: number, car: number): Uint8Array;
38
+ /** `steps` copies of a patch whose levels move from `from` to `to` (each { mod, car }), for swell(). */
39
+ export declare function sweep(inst: Uint8Array, steps: number, from: {
40
+ mod?: number;
41
+ car?: number;
42
+ }, to: {
43
+ mod?: number;
44
+ car?: number;
45
+ }): Uint8Array[];
46
+ export declare class Fx {
47
+ readonly w: Writer;
48
+ /** The patch each channel has now (after its program changes). */
49
+ private now;
50
+ /** Where each section starts (beat), for the preview tools. */
51
+ readonly sections: {
52
+ at: number;
53
+ name: string;
54
+ }[];
55
+ constructor(w: Writer);
56
+ private tick;
57
+ /** The channel's opening patch (instrument n for channel n, loaded before the first note). */
58
+ open(ch: number, inst: Uint8Array): this;
59
+ /** The instrument number of a patch: a channel's own opening patch, or one of the extra ones from 16 up (128 at most). */
60
+ patch(inst: Uint8Array): number;
61
+ /** A program change at beat `at` (nothing if the channel already has the patch). */
62
+ program(ch: number, at: number, inst: Uint8Array): this;
63
+ /** A section's start: a CMF marker (controller 0x66, value = its number) that PLAYGAME skips. */
64
+ marker(at: number, name: string): this;
65
+ /** One note, `len` beats from `at` (legato: the part of it held before letting go). */
66
+ note(ch: number, at: number, len: number, n: number, vel: number, legato?: number): this;
67
+ /**
68
+ * A phrase from beat `at` on one channel (see tones()): scoops slide up into their note in
69
+ * two-tick steps, falls slide away at the end, ties hold on. Returns its length in beats.
70
+ */
71
+ phrase(ch: number, at: number, s: string, vel: number, shift?: number, legato?: number): number;
72
+ /** Semitone steps from `from` to `to`, `ticks` timer ticks each, on one channel; returns the beat it ends on. */
73
+ slide(ch: number, at: number, from: number, to: number, ticks: number, vel: number): number;
74
+ /** The same notes on two channels at once, the second with the twin patch (a two-voice choir). */
75
+ choir(chA: number, chB: number, at: number, s: string, vel: number, shift?: number): number;
76
+ /** Program changes on `chs` stepping through `patches` evenly over `beats` from `at` (a swell or a filter sweep). */
77
+ swell(chs: number[], at: number, beats: number, patches: Uint8Array[]): this;
78
+ /** A chord on one channel: its notes in turn, one every `every` beats, for `beats` ('up', 'down', 'updown'). */
79
+ arp(ch: number, at: number, beats: number, notes: number[], every: number, vel: number, shape?: 'up' | 'down' | 'updown'): this;
80
+ /** A chord spread round several channels, a note every `every` beats; each rings on until its channel's next note (a harp). */
81
+ harp(chs: number[], at: number, beats: number, notes: number[], every: number, vel: number | ((k: number) => number)): this;
82
+ /** The phrase again on `ch`, `delay` beats later, `times` times, each softer (an echo). */
83
+ echo(ch: number, at: number, s: string, vel: number, delay: number, times?: number, decay?: number, shift?: number): this;
84
+ /** One note retriggered on its own channel `times` times, `gap` beats apart, each softer. */
85
+ stutter(ch: number, at: number, n: number, times: number, gap: number, vel: number, decay?: number): this;
86
+ /** The bass drum as a pitched voice (its patch from boomPatch). */
87
+ boom(at: number, len: number, n: number, vel: number): this;
88
+ /** A drum hit every `every` beats for `beats`, velocity ramping (a roll); tuned drums (tom, kick) walk through `notes`. */
89
+ drumRoll(drum: number, at: number, beats: number, every: number, velFrom: number, velTo: number, notes?: number[]): this;
90
+ /** Puts every drum channel back on its opening patch and the song's length in bars, then writes the CMF. */
91
+ cmf(bars: number): Uint8Array;
92
+ }
93
+ /** The bass drum as a sub bass: a sine that sustains while the note is held and rings out. */
94
+ export declare function boomPatch(o?: {
95
+ decay?: number;
96
+ release?: number;
97
+ growl?: number;
98
+ }): Uint8Array;
99
+ export {};
@@ -0,0 +1,7 @@
1
+ import { type Synth } from './sound.js';
2
+ /** White noise through a one-pole low-pass (0..1: how much of the new sample passes). */
3
+ export declare function lowNoise(seed: number, cutoff: number | ((t: number) => number)): Synth;
4
+ export declare const gate: (v: Synth, from: number, to: number) => Synth;
5
+ export declare const env: (attack: number, decay: number) => (u: number) => number;
6
+ /** A one-pole low-pass over a synth (for growly, dull noises). */
7
+ export declare function lowpass(v: Synth, k: number): Synth;
@@ -0,0 +1,13 @@
1
+ export interface TarEntry {
2
+ /** A/B/c, with "/" between folders; a folder ends with "/". */
3
+ path: string;
4
+ data?: Uint8Array;
5
+ /** Unix permission bits (0o755 for a program, 0o644 for a file). */
6
+ mode?: number;
7
+ }
8
+ /** An uncompressed tar archive. */
9
+ export declare function createTar(entries: TarEntry[], date?: Date): Uint8Array;
10
+ /** A .tar.gz archive. */
11
+ export declare function createTarGz(entries: TarEntry[], date?: Date): Promise<Uint8Array>;
12
+ /** Reads a tar (or .tar.gz) archive's entries: path, mode and data. */
13
+ export declare function readTar(bytes: Uint8Array): Promise<Required<TarEntry>[]>;