@lewismoten/gamemaker-sandbox-tools 0.0.0-stage → 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 (252) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/LICENSE +24 -0
  3. package/NOTICE.md +121 -0
  4. package/README.md +362 -2
  5. package/dist/audio-files.js +82 -0
  6. package/dist/audio.js +25 -0
  7. package/dist/block-merge.js +43 -0
  8. package/dist/color-reduce.js +44 -0
  9. package/dist/colors.js +87 -0
  10. package/dist/delta.js +75 -0
  11. package/dist/disk-diff.js +220 -0
  12. package/dist/drawing.js +85 -0
  13. package/dist/embroidery/compile.js +85 -0
  14. package/dist/embroidery/dst.js +79 -0
  15. package/dist/embroidery/exp.js +26 -0
  16. package/dist/embroidery/fill.js +49 -0
  17. package/dist/embroidery/geom.js +82 -0
  18. package/dist/embroidery/pes.js +79 -0
  19. package/dist/embroidery/satin.js +29 -0
  20. package/dist/embroidery/simulate.js +30 -0
  21. package/dist/embroidery/strokeFont.js +253 -0
  22. package/dist/embroidery/svg.js +24 -0
  23. package/dist/embroidery/types.js +13 -0
  24. package/dist/embroidery/units.js +26 -0
  25. package/dist/embroidery/validate.js +15 -0
  26. package/dist/formats/blocks.js +1 -0
  27. package/dist/formats/character.js +1 -0
  28. package/dist/formats/cmf.js +1 -0
  29. package/dist/formats/fli.js +1 -0
  30. package/dist/formats/fliLimits.js +1 -0
  31. package/dist/formats/game.js +1 -0
  32. package/dist/formats/gif.js +1 -0
  33. package/dist/formats/graphicScripts.js +1 -0
  34. package/dist/formats/map.js +1 -0
  35. package/dist/formats/monster.js +1 -0
  36. package/dist/formats/palette.js +1 -0
  37. package/dist/formats/recording.js +1 -0
  38. package/dist/formats/sound.js +1 -0
  39. package/dist/formats/voc.js +1 -0
  40. package/dist/gif-shrink.js +56 -0
  41. package/dist/image/png.js +42 -0
  42. package/dist/images.js +88 -0
  43. package/dist/kit/actors.js +19 -0
  44. package/dist/kit/align.js +204 -0
  45. package/dist/kit/blit.js +45 -0
  46. package/dist/kit/blockRoles.js +97 -0
  47. package/dist/kit/clips.js +40 -0
  48. package/dist/kit/coverPaint.js +18 -0
  49. package/dist/kit/disk.js +76 -0
  50. package/dist/kit/fadeOut.js +13 -0
  51. package/dist/kit/fliClips.js +133 -0
  52. package/dist/kit/fliShrink.js +277 -0
  53. package/dist/kit/gameSim.js +235 -0
  54. package/dist/kit/hopBot.js +142 -0
  55. package/dist/kit/levelGen.js +1423 -0
  56. package/dist/kit/levelGrid.js +33 -0
  57. package/dist/kit/levelPicture.js +27 -0
  58. package/dist/kit/menuVersion.js +19 -0
  59. package/dist/kit/microText.js +35 -0
  60. package/dist/kit/mumble.js +74 -0
  61. package/dist/kit/music.js +8 -0
  62. package/dist/kit/palRamps.js +32 -0
  63. package/dist/kit/palette.js +49 -0
  64. package/dist/kit/pcText.js +72 -0
  65. package/dist/kit/photo.js +150 -0
  66. package/dist/kit/pixels.js +79 -0
  67. package/dist/kit/png.js +40 -0
  68. package/dist/kit/quantize.js +72 -0
  69. package/dist/kit/raytrace.js +379 -0
  70. package/dist/kit/recordedDemo.js +10 -0
  71. package/dist/kit/reel.js +77 -0
  72. package/dist/kit/road3d.js +67 -0
  73. package/dist/kit/routeChecks.js +8 -0
  74. package/dist/kit/saveSlots.js +11 -0
  75. package/dist/kit/sceneInit.js +13 -0
  76. package/dist/kit/sceneSim.js +112 -0
  77. package/dist/kit/screenText.js +15 -0
  78. package/dist/kit/sdftext.js +237 -0
  79. package/dist/kit/shading.js +69 -0
  80. package/dist/kit/song.js +251 -0
  81. package/dist/kit/songFx.js +179 -0
  82. package/dist/kit/sound.js +52 -0
  83. package/dist/kit/synthParts.js +20 -0
  84. package/dist/kit/tar.js +53 -0
  85. package/dist/kit/textBounds.js +84 -0
  86. package/dist/kit/textfit.js +246 -0
  87. package/dist/kit/transforms.js +57 -0
  88. package/dist/kit/tune.js +21 -0
  89. package/dist/look-alike.js +50 -0
  90. package/dist/menu-version.js +4 -0
  91. package/dist/mesh/colorBodies.js +137 -0
  92. package/dist/mesh/decimate.js +207 -0
  93. package/dist/mesh/meshCheck.js +51 -0
  94. package/dist/mesh/overhang.js +41 -0
  95. package/dist/mesh/sampledField.js +12 -0
  96. package/dist/mesh/stl.js +36 -0
  97. package/dist/mesh/surfaceNets.js +79 -0
  98. package/dist/mesh/tetraMesh.js +62 -0
  99. package/dist/mesh/threeMf.js +58 -0
  100. package/dist/mesh/zipFile.js +52 -0
  101. package/dist/microFont.js +101 -0
  102. package/dist/music/compose.js +72 -0
  103. package/dist/pack/meshPack.js +198 -0
  104. package/dist/pack/threeMfPack.js +92 -0
  105. package/dist/palette-reserve.js +116 -0
  106. package/dist/palettes.js +138 -0
  107. package/dist/release-notes.js +40 -0
  108. package/dist/simulation.js +18 -0
  109. package/dist/text.js +74 -0
  110. package/dist/types/audio.d.ts +4 -0
  111. package/dist/types/audioFiles.d.ts +22 -0
  112. package/dist/types/audioWav.d.ts +4 -0
  113. package/dist/types/blockMerge.d.ts +24 -0
  114. package/dist/types/colorReduce.d.ts +23 -0
  115. package/dist/types/colors.d.ts +26 -0
  116. package/dist/types/delta.d.ts +32 -0
  117. package/dist/types/diskDiff.d.ts +47 -0
  118. package/dist/types/drawing.d.ts +15 -0
  119. package/dist/types/embroidery/compile.d.ts +3 -0
  120. package/dist/types/embroidery/dst.d.ts +13 -0
  121. package/dist/types/embroidery/exp.d.ts +8 -0
  122. package/dist/types/embroidery/fill.d.ts +6 -0
  123. package/dist/types/embroidery/geom.d.ts +19 -0
  124. package/dist/types/embroidery/pes.d.ts +10 -0
  125. package/dist/types/embroidery/satin.d.ts +11 -0
  126. package/dist/types/embroidery/simulate.d.ts +19 -0
  127. package/dist/types/embroidery/strokeFont.d.ts +20 -0
  128. package/dist/types/embroidery/svg.d.ts +3 -0
  129. package/dist/types/embroidery/types.d.ts +70 -0
  130. package/dist/types/embroidery/units.d.ts +10 -0
  131. package/dist/types/embroidery/validate.d.ts +22 -0
  132. package/dist/types/formats/blocks.d.ts +1 -0
  133. package/dist/types/formats/character.d.ts +1 -0
  134. package/dist/types/formats/cmf.d.ts +1 -0
  135. package/dist/types/formats/fli.d.ts +1 -0
  136. package/dist/types/formats/fliLimits.d.ts +1 -0
  137. package/dist/types/formats/game.d.ts +1 -0
  138. package/dist/types/formats/gif.d.ts +1 -0
  139. package/dist/types/formats/graphicScripts.d.ts +1 -0
  140. package/dist/types/formats/map.d.ts +1 -0
  141. package/dist/types/formats/monster.d.ts +1 -0
  142. package/dist/types/formats/palette.d.ts +1 -0
  143. package/dist/types/formats/recording.d.ts +1 -0
  144. package/dist/types/formats/sound.d.ts +1 -0
  145. package/dist/types/formats/voc.d.ts +1 -0
  146. package/dist/types/gifShrink.d.ts +8 -0
  147. package/dist/types/image/animatedGif.d.ts +9 -0
  148. package/dist/types/image/png.d.ts +10 -0
  149. package/dist/types/image/surface.d.ts +26 -0
  150. package/dist/types/images.d.ts +13 -0
  151. package/dist/types/kit/actors.d.ts +7 -0
  152. package/dist/types/kit/align.d.ts +93 -0
  153. package/dist/types/kit/audioEvents.d.ts +26 -0
  154. package/dist/types/kit/blit.d.ts +20 -0
  155. package/dist/types/kit/blockRoles.d.ts +243 -0
  156. package/dist/types/kit/clips.d.ts +36 -0
  157. package/dist/types/kit/coverPaint.d.ts +7 -0
  158. package/dist/types/kit/disk.d.ts +15 -0
  159. package/dist/types/kit/fadeOut.d.ts +12 -0
  160. package/dist/types/kit/fliClips.d.ts +32 -0
  161. package/dist/types/kit/fliShrink.d.ts +149 -0
  162. package/dist/types/kit/gameSim.d.ts +112 -0
  163. package/dist/types/kit/hopBot.d.ts +72 -0
  164. package/dist/types/kit/laserClearance.d.ts +16 -0
  165. package/dist/types/kit/laserJoints.d.ts +39 -0
  166. package/dist/types/kit/laserLayout.d.ts +54 -0
  167. package/dist/types/kit/laserPixels.d.ts +52 -0
  168. package/dist/types/kit/laserPreview.d.ts +9 -0
  169. package/dist/types/kit/laserSvg.d.ts +35 -0
  170. package/dist/types/kit/levelGen/castle.d.ts +17 -0
  171. package/dist/types/kit/levelGen/dungeon.d.ts +11 -0
  172. package/dist/types/kit/levelGen/forest.d.ts +17 -0
  173. package/dist/types/kit/levelGen/furnish.d.ts +31 -0
  174. package/dist/types/kit/levelGen/grid.d.ts +46 -0
  175. package/dist/types/kit/levelGen/index.d.ts +138 -0
  176. package/dist/types/kit/levelGen/interior.d.ts +18 -0
  177. package/dist/types/kit/levelGen/jumpModel.d.ts +78 -0
  178. package/dist/types/kit/levelGen/needs.d.ts +44 -0
  179. package/dist/types/kit/levelGen/overworld.d.ts +21 -0
  180. package/dist/types/kit/levelGen/platform.d.ts +59 -0
  181. package/dist/types/kit/levelGen/platformCap.d.ts +13 -0
  182. package/dist/types/kit/levelGen/platformReach.d.ts +37 -0
  183. package/dist/types/kit/levelGen/props.d.ts +37 -0
  184. package/dist/types/kit/levelGen/town.d.ts +24 -0
  185. package/dist/types/kit/levelGrid.d.ts +16 -0
  186. package/dist/types/kit/levelPicture.d.ts +9 -0
  187. package/dist/types/kit/menuVersion.d.ts +7 -0
  188. package/dist/types/kit/microText.d.ts +18 -0
  189. package/dist/types/kit/mumble.d.ts +41 -0
  190. package/dist/types/kit/music.d.ts +1 -0
  191. package/dist/types/kit/palMerge.d.ts +10 -0
  192. package/dist/types/kit/palRamps.d.ts +28 -0
  193. package/dist/types/kit/palette.d.ts +16 -0
  194. package/dist/types/kit/pcText.d.ts +19 -0
  195. package/dist/types/kit/photo.d.ts +69 -0
  196. package/dist/types/kit/pixels.d.ts +26 -0
  197. package/dist/types/kit/png.d.ts +7 -0
  198. package/dist/types/kit/quantize.d.ts +20 -0
  199. package/dist/types/kit/raytrace.d.ts +169 -0
  200. package/dist/types/kit/recordedDemo.d.ts +1 -0
  201. package/dist/types/kit/reel.d.ts +34 -0
  202. package/dist/types/kit/road3d.d.ts +71 -0
  203. package/dist/types/kit/routeChecks.d.ts +6 -0
  204. package/dist/types/kit/saveSlots.d.ts +17 -0
  205. package/dist/types/kit/sceneInit.d.ts +11 -0
  206. package/dist/types/kit/sceneSim.d.ts +84 -0
  207. package/dist/types/kit/screenText.d.ts +3 -0
  208. package/dist/types/kit/sdftext.d.ts +34 -0
  209. package/dist/types/kit/shading.d.ts +23 -0
  210. package/dist/types/kit/shareBlocks.d.ts +20 -0
  211. package/dist/types/kit/song.d.ts +89 -0
  212. package/dist/types/kit/songFx.d.ts +99 -0
  213. package/dist/types/kit/sound.d.ts +29 -0
  214. package/dist/types/kit/synthParts.d.ts +7 -0
  215. package/dist/types/kit/tar.d.ts +13 -0
  216. package/dist/types/kit/textBounds.d.ts +51 -0
  217. package/dist/types/kit/textfit.d.ts +74 -0
  218. package/dist/types/kit/transforms.d.ts +8 -0
  219. package/dist/types/kit/tune.d.ts +6 -0
  220. package/dist/types/lookAlike.d.ts +31 -0
  221. package/dist/types/menuVersionEntry.d.ts +1 -0
  222. package/dist/types/mesh/colorBodies.d.ts +18 -0
  223. package/dist/types/mesh/decimate.d.ts +10 -0
  224. package/dist/types/mesh/fieldTrinket.d.ts +40 -0
  225. package/dist/types/mesh/figureShapes.d.ts +24 -0
  226. package/dist/types/mesh/mesh.d.ts +9 -0
  227. package/dist/types/mesh/meshCheck.d.ts +22 -0
  228. package/dist/types/mesh/overhang.d.ts +24 -0
  229. package/dist/types/mesh/pixelFigure.d.ts +41 -0
  230. package/dist/types/mesh/sampledField.d.ts +3 -0
  231. package/dist/types/mesh/sdfShapes.d.ts +20 -0
  232. package/dist/types/mesh/stl.d.ts +9 -0
  233. package/dist/types/mesh/strokeText.d.ts +8 -0
  234. package/dist/types/mesh/surfaceNets.d.ts +14 -0
  235. package/dist/types/mesh/tetraMesh.d.ts +4 -0
  236. package/dist/types/mesh/threeMf.d.ts +12 -0
  237. package/dist/types/mesh/trinketKinds.d.ts +72 -0
  238. package/dist/types/mesh/trinketTool.d.ts +26 -0
  239. package/dist/types/mesh/voxel.d.ts +10 -0
  240. package/dist/types/mesh/zipFile.d.ts +13 -0
  241. package/dist/types/microFont.d.ts +6 -0
  242. package/dist/types/music/compose.d.ts +51 -0
  243. package/dist/types/pack/meshPack.d.ts +26 -0
  244. package/dist/types/pack/threeMfPack.d.ts +11 -0
  245. package/dist/types/palettePresetData.d.ts +4 -0
  246. package/dist/types/palettePresets.d.ts +12 -0
  247. package/dist/types/paletteReserve.d.ts +52 -0
  248. package/dist/types/palettes.d.ts +4 -0
  249. package/dist/types/releaseNotes.d.ts +3 -0
  250. package/dist/types/simulation.d.ts +6 -0
  251. package/dist/types/text.d.ts +41 -0
  252. package/package.json +190 -4
@@ -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,29 @@
1
+ /** A PC speaker sound from a function of step (0..35) → Hz (0 = silence). */
2
+ export declare function speaker(fn: (i: number, t: number) => number): Uint16Array;
3
+ export declare const SPEAKER: {
4
+ rise: (from?: number, to?: number) => Uint16Array<ArrayBufferLike>;
5
+ fall: (from?: number, to?: number) => Uint16Array<ArrayBufferLike>;
6
+ coin: () => Uint16Array<ArrayBufferLike>;
7
+ hurt: () => Uint16Array<ArrayBufferLike>;
8
+ zap: () => Uint16Array<ArrayBufferLike>;
9
+ chirp: () => Uint16Array<ArrayBufferLike>;
10
+ arpeggio: (notes?: number[]) => Uint16Array<ArrayBufferLike>;
11
+ noise: (seed?: number, low?: number, high?: number) => Uint16Array<ArrayBufferLike>;
12
+ warble: (base?: number, depth?: number, speed?: number) => Uint16Array<ArrayBufferLike>;
13
+ };
14
+ /** A synthesizer voice for samples: time (s) → -1..1. */
15
+ export type Synth = (t: number) => number;
16
+ export declare const osc: {
17
+ sine: (hz: number | ((t: number) => number)) => Synth;
18
+ square: (hz: number | ((t: number) => number)) => Synth;
19
+ noise: (seed?: number) => Synth;
20
+ };
21
+ /** Renders `seconds` of a synth through an envelope (attack, decay to 0) as a .VOC. */
22
+ export declare function sample(seconds: number, voice: Synth, opts?: {
23
+ rate?: number;
24
+ attack?: number;
25
+ gain?: number;
26
+ envelope?: (t: number) => number;
27
+ }): Uint8Array;
28
+ /** Mixes synths. */
29
+ export declare const mix: (...voices: [Synth, number][]) => Synth;
@@ -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>[]>;
@@ -0,0 +1,51 @@
1
+ /** A rectangle as [x0, y0, x1, y1], x1 and y1 exclusive. */
2
+ type Box = [number, number, number, number];
3
+ /** One string that ran past its picture or clip area. */
4
+ export interface TextOverflow {
5
+ s: string;
6
+ /** The picture's size. */
7
+ w: number;
8
+ h: number;
9
+ /** Where the ink was, and the area it had to stay inside. */
10
+ ink: Box;
11
+ area: Box;
12
+ /** The drawing call's source: the game code that drew it, and the code that called that. */
13
+ at: string;
14
+ /** Every call from the game code down to the helper (an outline and its fill differ). */
15
+ via: string;
16
+ /** Characters the 8x8 font draws as an empty box (a curly quote, an accent), if any. */
17
+ missing?: string;
18
+ }
19
+ /** Collects one string's ink as a helper draws it; `end()` checks it against the area. */
20
+ declare class TextInk {
21
+ private readonly w;
22
+ private readonly h;
23
+ private readonly s;
24
+ private readonly area;
25
+ private readonly has;
26
+ private x0;
27
+ private y0;
28
+ private x1;
29
+ private y1;
30
+ constructor(w: number, h: number, s: string, area: Box, has: (ch: string) => boolean);
31
+ /** A lit rectangle of the string (a font pixel, scaled). */
32
+ add(x: number, y: number, w?: number, h?: number): void;
33
+ end(): void;
34
+ }
35
+ /**
36
+ * A recorder for one string drawn on picture `p`, or undefined when the audit is off. `clip`
37
+ * is an area inside the picture the text must keep to (a frame, a sign's face); `has` says
38
+ * which characters the font draws (the PC font's printable ASCII unless a helper says).
39
+ */
40
+ export declare function textInk(p: {
41
+ readonly w: number;
42
+ readonly h: number;
43
+ }, s: string, clip?: Box, has?: (ch: string) => boolean): TextInk | undefined;
44
+ /** One line about an overflow: the string, its ink box, the area and where it was drawn. */
45
+ export declare function describe(o: TextOverflow): string;
46
+ /** Reads a build's TEXT_BOUNDS file: the cut strings, and how many moved. */
47
+ export declare function readBounds(file: string): {
48
+ cut: TextOverflow[];
49
+ moving: TextOverflow[];
50
+ };
51
+ export {};
@@ -0,0 +1,74 @@
1
+ export declare const W = 320;
2
+ export declare const H = 200;
3
+ type RGB = [number, number, number];
4
+ /** A string PLAYGAME writes, in a palette index, at a pixel position. */
5
+ interface TextItem {
6
+ x: number;
7
+ y: number;
8
+ col: number;
9
+ text: string;
10
+ /** The color PLAYGAME asked for (RGBRed and friends); flagged when the screen shows something else. */
11
+ want?: RGB;
12
+ /** Marker boxes (menu cursors) are solid fills, not glyphs. */
13
+ box?: {
14
+ w: number;
15
+ h: number;
16
+ };
17
+ }
18
+ /** One screen as shown: the picture under the text, the palette on the DAC and the text. */
19
+ export interface TextScreen {
20
+ /** Where it comes from, e.g. "help.lst > help.txt p1". */
21
+ name: string;
22
+ kind: 'page' | 'menu' | 'scores' | 'load' | 'save';
23
+ pixels: Uint8Array;
24
+ palette: Uint8Array;
25
+ texts: TextItem[];
26
+ }
27
+ export interface TextFitIssue {
28
+ screen: string;
29
+ text: string;
30
+ x: number;
31
+ y: number;
32
+ /** Background pixels near the letters that are not the paper under them. */
33
+ artPixels: number;
34
+ /** WCAG contrast ratio of the text color against its paper. */
35
+ contrast: number;
36
+ problems: string[];
37
+ }
38
+ interface TextFitOptions {
39
+ /** Pixels around each line that must be plain paper (default 2). */
40
+ margin?: number;
41
+ /** RGB distance (8-bit) from the paper that counts as art (default 72). */
42
+ artDistance?: number;
43
+ /** Art pixels tolerated per line (default 0). */
44
+ allowArt?: number;
45
+ /** Lowest contrast ratio allowed (default 3). */
46
+ minContrast?: number;
47
+ }
48
+ export declare function readDisk(dir: string): Map<string, Uint8Array>;
49
+ /**
50
+ * Every screen where PLAYGAME draws text over this game's pictures. `ink` is the text pages' RGB
51
+ * (6-bit), when a game's player patches color.rgb.purple.
52
+ */
53
+ export declare function textScreens(files: Map<string, Uint8Array>, ink?: RGB): TextScreen[];
54
+ /** Marks every art pixel (not paper) inside a text zone; returns the issues. */
55
+ export declare function checkTextScreen(s: TextScreen, opts?: TextFitOptions, marks?: Uint8Array): TextFitIssue[];
56
+ /** The screen as the player sees it, as 8-bit RGB, with art pixels near text tinted magenta when `marks` is given. */
57
+ export declare function renderRgb(s: TextScreen, marks?: Uint8Array): Uint8Array;
58
+ /** A picture shown between levels (a level scene's intro or ending list), with its palette. */
59
+ export interface CardScreen {
60
+ name: string;
61
+ pixels: Uint8Array;
62
+ palette: Uint8Array;
63
+ }
64
+ /** The pictures every level scene shows around play (slots 9 and 10), as the player sees them. */
65
+ export declare function levelCards(files: Map<string, Uint8Array>): CardScreen[];
66
+ /**
67
+ * Words baked into a Starter card (games/kit/starter/screens.ts cardPicture) that run past its
68
+ * parchment box. The box is found from the pixel at (24, 16): the run of that color left, right,
69
+ * up and down. Text colors are the other colors inside the box; the frame's colors (read just
70
+ * outside the box above the text) are not counted. Returns a problem per side, or none. A picture
71
+ * with no such box (a card of another design) is skipped, since there is no box to measure.
72
+ */
73
+ export declare function cardOverflow(c: CardScreen): string[];
74
+ export {};
@@ -0,0 +1,8 @@
1
+ import { Pixels } from './pixels.js';
2
+ export declare function resampleBlit(dst: Pixels, src: Pixels, x: number, y: number, s: number, flip?: boolean): Pixels;
3
+ export declare function turn45(src: Pixels, scale?: number): Pixels;
4
+ export declare function turn90(src: Pixels): Pixels;
5
+ export declare function turn180(src: Pixels): Pixels;
6
+ export declare function flipX(src: Pixels): Pixels;
7
+ export declare function flipY(src: Pixels): Pixels;
8
+ export declare function rotate(src: Pixels, deg: number): Pixels;
@@ -0,0 +1,6 @@
1
+ import { type Voice } from './music.js';
2
+ export declare const LEN: Record<string, number>;
3
+ export declare function tune(bpm: number, voices: Voice[]): Uint8Array;
4
+ export declare const v: (channel: number, instrument: Uint8Array, notes: string, velocity?: number, transpose?: number) => Voice;
5
+ export declare const join: (...parts: string[]) => string;
6
+ export declare const times: (n: number, s: string) => string;
@@ -0,0 +1,31 @@
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 LookInput {
4
+ blocks: Block[];
5
+ /** Every palette (768 bytes) a scene using this set shows. */
6
+ palettes: Uint8Array[];
7
+ /** Block numbers the set's maps draw, plus what they turn into (the closure). */
8
+ used: ReadonlySet<number>;
9
+ /** Numbers that must keep their number and picture game-wide (block 0, pickups, required and starting inventory). */
10
+ pinned: ReadonlySet<number>;
11
+ }
12
+ export interface LookGroup {
13
+ /** The block that stays: the pinned one if any, else the lowest number. */
14
+ keep: number;
15
+ /** The blocks that go; each is drawn exactly as `keep` is, and plays the same. */
16
+ fold: number[];
17
+ }
18
+ export interface LookResult {
19
+ groups: LookGroup[];
20
+ /** Groups left alone because two of their blocks are pinned. */
21
+ pinnedGroups: number[][];
22
+ /** Blocks of one shape in different colors (not folded). */
23
+ colorVariants: number[][];
24
+ }
25
+ export declare function findLookAlikes({ blocks, palettes, used, pinned }: LookInput): LookResult;
26
+ /** The set with every folded block gone: `to[n]` is where block n went (itself if it stayed), maps renumbered. */
27
+ export declare function applyFold(blocks: Block[], maps: GameMap[], groups: LookGroup[]): {
28
+ blocks: Block[];
29
+ maps: GameMap[];
30
+ to: number[];
31
+ };
@@ -0,0 +1 @@
1
+ export { stampMenuVersion, type MenuVersionSpot } from './kit/menuVersion.js';
@@ -0,0 +1,18 @@
1
+ import type { Mesh, Vec3 } from './mesh.js';
2
+ export type Rgb = [number, number, number];
3
+ /** Up to `max` colors that stand for the mesh's triangle colors (by area), those closer than `merge` joined. */
4
+ export declare function pickPalette(mesh: Mesh, max?: number, merge?: number): Rgb[];
5
+ export interface BodiesOptions {
6
+ min: Vec3;
7
+ max: Vec3;
8
+ cell: number;
9
+ /** Thin each body's mesh to within this distance of its surface (see decimate.ts). */
10
+ simplify?: number;
11
+ /** The volume the bodies together should have (the whole figure's): they are grown a hair if the mesher left them short. */
12
+ volume?: number;
13
+ }
14
+ /** One closed body per palette color (a color with no solid of its own is left out). */
15
+ export declare function colorBodies(mesh: Mesh, palette: Rgb[], field: (x: number, y: number, z: number) => number, o: BodiesOptions): {
16
+ color: Rgb;
17
+ mesh: Mesh;
18
+ }[];
@@ -0,0 +1,10 @@
1
+ import type { Mesh } from './mesh.js';
2
+ export interface DecimateOptions {
3
+ /** The largest distance, in the mesh's units, a collapse may move the surface (the cost limit is its square, times the planes meeting there). */
4
+ maxError: number;
5
+ /** Colors further apart than this (0-255 steps) make an edge a color border to hold in place (default 30). */
6
+ colorStep?: number;
7
+ /** Never go below this many triangles (default 4). */
8
+ minTriangles?: number;
9
+ }
10
+ export declare function decimate(mesh: Mesh, o: DecimateOptions): Mesh;
@@ -0,0 +1,40 @@
1
+ import { type MeshReport } from './meshCheck.js';
2
+ import type { Mesh } from './mesh.js';
3
+ import { type Rgb } from './colorBodies.js';
4
+ import { type Overhang } from './overhang.js';
5
+ export type V3 = [number, number, number];
6
+ export interface FieldTrinketInput {
7
+ /** Signed distance in mm (negative inside); must be positive below z = 0 so the floor is flat. */
8
+ mm: (x: number, y: number, z: number) => number;
9
+ /** The 0-255 color of the surface at a point, given its outward normal. */
10
+ colorAt: (x: number, y: number, z: number, normal: V3) => Rgb;
11
+ /** The box the mesh is sampled in, in mm. */
12
+ box: {
13
+ min: V3;
14
+ max: V3;
15
+ };
16
+ /** Filament colors (at most four), when the automatic pick would join two the eye must tell apart. */
17
+ palette?: Rgb[];
18
+ /** The grid of the color bodies in mm (default 1.5): finer when the trinket has gaps or details under 1.5 mm. */
19
+ bodyCell?: number;
20
+ /** How many separate solids the trinket is made of (default 1): a coin cut into pieces is 3. */
21
+ pieces?: number;
22
+ }
23
+ export interface FieldTrinket {
24
+ mesh: Mesh;
25
+ report: MeshReport;
26
+ /** The pieces left when the surface is eroded by half a millimeter (of at least a speck's size). */
27
+ erodedPieces: number;
28
+ /** Specks the eroded surface leaves: parts thinner than a millimeter that would not print. */
29
+ erodedSpecks: number;
30
+ overhang: Overhang;
31
+ bodies: {
32
+ color: Rgb;
33
+ mesh: Mesh;
34
+ }[];
35
+ wholeVolume: number;
36
+ field: (x: number, y: number, z: number) => number;
37
+ support?: Mesh;
38
+ }
39
+ /** Mesh and check a trinket's field. `cell` is the mesh's cell in mm (default 0.95). */
40
+ export declare function meshFieldTrinket(input: FieldTrinketInput, cell?: number): FieldTrinket;
@@ -0,0 +1,24 @@
1
+ import type { Rgb } from './colorBodies.js';
2
+ import type { D3 } from './sdfShapes.js';
3
+ /** An ellipsoid centered at (cx, cy, cz) with radii rx, ry, rz (a close estimate of the distance, good for meshing). */
4
+ export declare const ellipsoid3: (cx: number, cy: number, cz: number, rx: number, ry: number, rz: number) => D3;
5
+ /** A rounded cone (a capsule that is r0 wide at a and r1 wide at b). */
6
+ export declare const roundCone3: (ax: number, ay: number, az: number, r0: number, bx: number, by: number, bz: number, r1: number) => D3;
7
+ /** The smooth union of fields: parts melt together over about `k` mm. */
8
+ export declare const smoothUnion3: (k: number, ...fs: D3[]) => D3;
9
+ /** A field turned about the z axis by `a` radians and moved by (dx, dy, dz). */
10
+ export declare const place3: (f: D3, a: number, dx?: number, dy?: number, dz?: number) => D3;
11
+ /** A field made bigger (or smaller) by `k`, about the origin. */
12
+ export declare const scale3: (f: D3, k: number) => D3;
13
+ export interface FigurePart {
14
+ d: D3;
15
+ color: Rgb;
16
+ }
17
+ /**
18
+ * A figure of colored parts: the parts melt together over `blend` mm, the floor is flattened onto z = 0, and a surface point
19
+ * takes the color of the part whose own surface it is nearest to (so a comb or an eye keeps its color where it meets the head).
20
+ */
21
+ export declare function figure(parts: FigurePart[], blend?: number): {
22
+ mm: D3;
23
+ colorAt: (x: number, y: number, z: number) => Rgb;
24
+ };
@@ -0,0 +1,9 @@
1
+ export interface Mesh {
2
+ /** x, y, z per vertex. */
3
+ positions: Float32Array;
4
+ /** Three vertex numbers per triangle. */
5
+ indices: Uint32Array;
6
+ /** Optional color per triangle: r, g, b (0-255) each. */
7
+ colors?: Uint8Array;
8
+ }
9
+ export type Vec3 = [number, number, number];
@@ -0,0 +1,22 @@
1
+ import type { Mesh, Vec3 } from './mesh.js';
2
+ export interface MeshReport {
3
+ triangles: number;
4
+ vertices: number;
5
+ /** Edges that belong to one triangle or three or more (a closed mesh has none). */
6
+ badEdges: number;
7
+ /** Edges two triangles walk the same way (a flipped triangle). */
8
+ flippedEdges: number;
9
+ /** Triangles with no area. */
10
+ degenerate: number;
11
+ /** Separate pieces; a print wants 1 (or pieces that rest on the bed). */
12
+ pieces: number;
13
+ /** Triangles in each piece, largest first. */
14
+ pieceTriangles: number[];
15
+ min: Vec3;
16
+ max: Vec3;
17
+ /** Enclosed volume (positive when the triangles face outward). */
18
+ volume: number;
19
+ /** Surface area. */
20
+ area: number;
21
+ }
22
+ export declare function inspectMesh(mesh: Mesh): MeshReport;
@@ -0,0 +1,24 @@
1
+ import type { Mesh, Vec3 } from './mesh.js';
2
+ export interface Overhang {
3
+ /** Area of the faces tipped more than the limit from upright and off the bed, in the mesh's units squared. */
4
+ area: number;
5
+ /** Their share of the whole surface. */
6
+ share: number;
7
+ }
8
+ /** Faces whose normal points down past `limit` degrees from upright (45 is the usual FDM limit) and that are above the bed (z = 0). */
9
+ export declare function overhang(mesh: Mesh, limit?: number, bed?: number): Overhang;
10
+ export interface SupportOptions {
11
+ min: Vec3;
12
+ max: Vec3;
13
+ /** Voxel size. */
14
+ cell: number;
15
+ /** Air kept between a support and the model so they part cleanly. */
16
+ gap: number;
17
+ }
18
+ /**
19
+ * Support pillars for `field` (negative inside, floor at z = 0): under every part that leans out more than
20
+ * 45 degrees (a voxel with nothing solid straight below it or to its four sides below), a column straight
21
+ * down to the model or the bed, a voxel wider all round, kept `gap` away from the model. Undefined when
22
+ * nothing needs support.
23
+ */
24
+ export declare function supportBody(field: (x: number, y: number, z: number) => number, o: SupportOptions): Mesh | undefined;
@@ -0,0 +1,41 @@
1
+ import type { Mesh } from './mesh.js';
2
+ export declare const TRANSPARENT = 255;
3
+ export interface PixelPicture {
4
+ w: number;
5
+ h: number;
6
+ /** Palette index per pixel, row major from the top; 255 is empty. */
7
+ cells: Uint8Array;
8
+ /** 6-bit VGA palette (768 bytes). */
9
+ palette: Uint8Array;
10
+ }
11
+ export interface FigureOptions {
12
+ /** Most colors (the base counts as the outline color): 4, or 3. */
13
+ colors?: number;
14
+ /** Palette indices that must keep a color of their own, the first one being the outline and base; the rest of the colors are chosen farthest-first. */
15
+ keep?: number[];
16
+ /** Millimeters per pixel block. */
17
+ block?: number;
18
+ /** Blocks deep the figure is. */
19
+ layers?: number;
20
+ /** Rows of base plate under the feet. */
21
+ baseRows?: number;
22
+ /** Blocks the base sticks out each side, and front and back. */
23
+ baseMargin?: number;
24
+ }
25
+ export interface Figure {
26
+ /** One closed mesh per color, darkest (outline and base) first. */
27
+ bodies: {
28
+ color: [number, number, number];
29
+ mesh: Mesh;
30
+ }[];
31
+ /** The whole solid as one mesh. */
32
+ solid: Mesh;
33
+ /** Cleaned color map (width x height, with the base), for previews: index into `bodies`, -1 empty. */
34
+ map: Int8Array;
35
+ w: number;
36
+ h: number;
37
+ droppedSpecks: number;
38
+ bridged: number;
39
+ }
40
+ /** The figure of a picture. */
41
+ export declare function pixelFigure(pic: PixelPicture, o?: FigureOptions): Figure;
@@ -0,0 +1,3 @@
1
+ import type { NetsOptions } from './surfaceNets.js';
2
+ /** `field` sampled over the box; outside the grid the nearest sample is read, which is air. */
3
+ export declare function sampledField(field: (x: number, y: number, z: number) => number, o: Pick<NetsOptions, 'min' | 'max' | 'cell'>): (x: number, y: number, z: number) => number;
@@ -0,0 +1,20 @@
1
+ export type D2 = (x: number, y: number) => number;
2
+ export type D3 = (x: number, y: number, z: number) => number;
3
+ export declare const circle2: (r: number, cx?: number, cy?: number) => D2;
4
+ export declare const ring2: (r0: number, r1: number) => D2;
5
+ export declare const roundRect2: (hx: number, hy: number, r: number, cx?: number, cy?: number) => D2;
6
+ /** A capsule: the line from (ax, ay) to (bx, by), `r` wide each side. */
7
+ export declare const capsule2: (ax: number, ay: number, bx: number, by: number, r: number) => D2;
8
+ /** A convex or concave polygon (counter-clockwise or not), by points. */
9
+ export declare function polygon2(pts: [number, number][]): D2;
10
+ /** Lines of text in the 3x5 micro font, each pixel a rounded square `px` mm wide, the block centered on (cx, cy). Letters are `px` apart, lines 2 px. */
11
+ export declare function pixelText2(lines: string[], px: number, cx?: number, cy?: number, round?: number): D2;
12
+ /** A flat shape standing from z0 to z1. */
13
+ export declare const extrude: (d2: D2, z0: number, z1: number) => D3;
14
+ export declare const sphere3: (cx: number, cy: number, cz: number, r: number) => D3;
15
+ /** A box with rounded edges, centered, half sizes hx, hy, hz and corner radius r. */
16
+ export declare const roundBox3: (cx: number, cy: number, cz: number, hx: number, hy: number, hz: number, r: number) => D3;
17
+ export declare const union3: (...fs: D3[]) => D3;
18
+ export declare const subtract3: (a: D3, ...cuts: D3[]) => D3;
19
+ export declare const intersect3: (a: D3, b: D3) => D3;
20
+ export declare const union2: (...fs: D2[]) => D2;
@@ -0,0 +1,9 @@
1
+ import type { Mesh } from './mesh.js';
2
+ export interface StlOptions {
3
+ /** Written into the header (80 bytes at most). */
4
+ name?: string;
5
+ }
6
+ /** The mesh as a binary STL file. */
7
+ export declare function writeStl(mesh: Mesh, options?: StlOptions): Uint8Array;
8
+ /** A binary STL read back, its corners that coincide joined into shared vertices. */
9
+ export declare function readStl(data: Uint8Array): Mesh;
@@ -0,0 +1,8 @@
1
+ import { type D2 } from './sdfShapes.js';
2
+ /** Lines of capitals, digits and marks, `cap` mm tall, drawn with a pen `pen` mm wide, the block centered on (cx, cy). */
3
+ export declare function strokeText2(lines: string[], cap: number, pen: number, cx?: number, cy?: number): D2;
4
+ /**
5
+ * Characters set round a circle of `radius` mm (their feet toward the middle), clockwise from `startDeg` (90 is the top),
6
+ * `stepDeg` apart: a decoder coin's ring of digits, or a coin's legend. Each is `cap` mm tall, drawn with a pen `pen` mm wide.
7
+ */
8
+ export declare function ringText2(text: string, radius: number, cap: number, pen: number, stepDeg: number, startDeg?: number): D2;
@@ -0,0 +1,14 @@
1
+ import type { Mesh, Vec3 } from './mesh.js';
2
+ export interface NetsOptions {
3
+ /** The box to sample: the surface must lie inside it. */
4
+ min: Vec3;
5
+ max: Vec3;
6
+ /** The grid spacing, in the field's units. */
7
+ cell: number;
8
+ /** Retry a grid that splits the surface into more separate pieces than this (default: any number is fine). */
9
+ maxPieces?: number;
10
+ /** How many grids to try before settling for the best (default 30). */
11
+ attempts?: number;
12
+ }
13
+ /** The closed surface of `field` = 0 over the box. */
14
+ export declare function surfaceNets(field: (x: number, y: number, z: number) => number, o: NetsOptions): Mesh;
@@ -0,0 +1,4 @@
1
+ import type { Mesh } from './mesh.js';
2
+ import type { NetsOptions } from './surfaceNets.js';
3
+ /** The closed surface of `field` = 0 over the box (the grid starts a fixed cell outside it). */
4
+ export declare function tetraMesh(field: (x: number, y: number, z: number) => number, o: Pick<NetsOptions, 'min' | 'max' | 'cell'>): Mesh;
@@ -0,0 +1,12 @@
1
+ import type { Mesh } from './mesh.js';
2
+ import { type ZipCodec } from './zipFile.js';
3
+ export interface Part {
4
+ name: string;
5
+ mesh: Mesh;
6
+ /** 0-255 each. */
7
+ color: [number, number, number];
8
+ }
9
+ /** The parts as a 3MF file. */
10
+ export declare function write3mf(parts: Part[], title: string, codec?: ZipCodec): Uint8Array;
11
+ /** A 3MF written by `write3mf` read back (its parts, meshes and colors). */
12
+ export declare function read3mf(data: Uint8Array, codec?: ZipCodec): Part[];