@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,72 @@
1
+ import { type D2, type D3 } from './sdfShapes.js';
2
+ export interface FlatKind {
3
+ /** A 2D outline of the flat part (a circle, a rounded rectangle). */
4
+ outline: D2;
5
+ /** Thickness of the plate in mm. */
6
+ thick: number;
7
+ /** Width of the raised rim in mm (0 for none), and how far it stands above the face. */
8
+ rim?: {
9
+ width: number;
10
+ height: number;
11
+ };
12
+ /** Raised artwork (lettering, a crown) and how far it stands above the face. */
13
+ relief?: {
14
+ shape: D2;
15
+ height: number;
16
+ };
17
+ /** Sunk artwork and how deep it goes. */
18
+ engrave?: {
19
+ shape: D2;
20
+ depth: number;
21
+ };
22
+ /** Holes through the plate (a key-chain hole). */
23
+ holes?: D2[];
24
+ /** A recess in the back (the floor) for gluing in a pin back or a magnet, as a solid to cut away (see pinBack). */
25
+ pocket?: D3;
26
+ }
27
+ /** A plate with its rim, relief, engraving and holes: the face is at z = thick. */
28
+ export declare function plate(k: FlatKind): D3;
29
+ /** The outline for a key-chain tag: a rounded rectangle of half sizes hx, hy. */
30
+ export declare const tagOutline: (hx: number, hy: number, r: number) => D2;
31
+ export declare const holeAt: (x: number, y: number, r: number) => D2;
32
+ /**
33
+ * A die: a rounded cube of `size` mm with a dimple of radius `pipR` for each pip (the usual 1..6 on opposite faces summing to 7).
34
+ * The dimples are deep (about three quarters of a radius), so the pips read in plain light; `pips` is the union of them, to color
35
+ * the pips apart (a point on a dimple's surface has `pips` near zero).
36
+ */
37
+ export declare function die(size: number, pipR: number, corner?: number): D3 & {
38
+ pips: D3;
39
+ };
40
+ /** A regular polygon outline (a hexagonal badge, a shield point up), `n` sides, radius `r`. */
41
+ export declare const regular2: (n: number, r: number, turn?: number) => D2;
42
+ /**
43
+ * The pocket for a pin back: a bar-shaped recess `len` mm long and `w` mm wide at the floor, centered on (cx, cy), to glue a
44
+ * bar pin into (give it as `pocket`). Its roof is a gable at 45 degrees, so it prints without supports.
45
+ */
46
+ export declare const pinBack: (cx?: number, cy?: number, len?: number, w?: number) => D3;
47
+ /** A key-chain ring tab: a round lug of outer radius `r + wall` with a hole of radius `r`, at (x, y). Join `shape` to the outline with union2 and give `hole` to `holes`. */
48
+ export declare const ringTab: (x: number, y: number, r?: number, wall?: number) => {
49
+ shape: D2;
50
+ hole: D2;
51
+ };
52
+ export interface GemShape {
53
+ /** Sides of the table and girdle (6 or 8). */
54
+ sides: number;
55
+ /** Apothems in mm: the flat table the gem stands on, and the widest part (the girdle). */
56
+ table: number;
57
+ girdle: number;
58
+ /** Height of the crown (table to girdle) and of the pavilion (girdle to the point), in mm. */
59
+ crown: number;
60
+ pavilion: number;
61
+ /** Turn the pavilion's facets by half a side, as a brilliant cut does (default true). */
62
+ offset?: boolean;
63
+ }
64
+ /**
65
+ * A faceted gem standing on its table (flat down), the crown flaring out as it rises and the pavilion narrowing to the point:
66
+ * the crown leans out at under 45 degrees from vertical, so it prints without supports. Also the shape of a crystal shard.
67
+ * `facet(x, y, z)` is the number of the facet a surface point belongs to, for coloring.
68
+ */
69
+ export declare function gem(g: GemShape): {
70
+ field: D3;
71
+ facet: (x: number, y: number, z: number) => number;
72
+ };
@@ -0,0 +1,26 @@
1
+ import type { FieldTrinket } from './fieldTrinket.js';
2
+ export interface TrinketToolDef {
3
+ id: string;
4
+ title: string;
5
+ blurb: string;
6
+ /** Printed height and width in mm, only to start the biggest first. */
7
+ height: number;
8
+ maxWidth: number;
9
+ /** How many separate solids it is (default 1), such as a coin printed in three pieces. */
10
+ pieces?: number;
11
+ }
12
+ export interface TrinketTool<D extends TrinketToolDef> {
13
+ /** The folder id in web/public/trinkets and the manifest's `game`. */
14
+ game: string;
15
+ /** The game's title, in the STL and 3MF names. */
16
+ gameTitle: string;
17
+ out: string;
18
+ /** The files, and folders (each file in them, sorted), the trinkets are made from: the key of the manifest. */
19
+ keyFiles: string[];
20
+ defs: D[];
21
+ make: (def: D) => FieldTrinket;
22
+ args: string[];
23
+ }
24
+ /** A hash of the sources, so an up-to-date set of trinkets is not made again. */
25
+ export declare function sourceKey(entries: string[]): string;
26
+ export declare function runTrinketTool<D extends TrinketToolDef>(tool: TrinketTool<D>): Promise<void>;
@@ -0,0 +1,10 @@
1
+ import type { Mesh } from './mesh.js';
2
+ export interface VoxelGrid {
3
+ nx: number;
4
+ ny: number;
5
+ nz: number;
6
+ /** True where a voxel is filled. Outside the grid is empty. */
7
+ has: (x: number, y: number, z: number) => boolean;
8
+ }
9
+ /** The surface of the filled voxels as a mesh. A voxel touching another only along an edge makes a non-manifold edge: avoid that in the grid. */
10
+ export declare function voxelMesh(g: VoxelGrid, size?: number): Mesh;
@@ -0,0 +1,13 @@
1
+ export interface ZipEntry {
2
+ name: string;
3
+ data: Uint8Array;
4
+ }
5
+ export interface ZipCodec {
6
+ /** Raw deflate (no zlib header). */
7
+ deflate?: (data: Uint8Array) => Uint8Array;
8
+ /** Raw inflate, needed to read deflated entries. */
9
+ inflate?: (data: Uint8Array) => Uint8Array;
10
+ }
11
+ export declare function crc32(data: Uint8Array): number;
12
+ export declare function writeZip(entries: ZipEntry[], codec?: ZipCodec): Uint8Array;
13
+ export declare function readZip(data: Uint8Array, codec?: ZipCodec): ZipEntry[];
@@ -0,0 +1,6 @@
1
+ export type MicroGlyphs = Readonly<Record<string, string>>;
2
+ export declare const MICRO_GLYPHS: MicroGlyphs;
3
+ /** Square letterforms for technical labels, with the full punctuation repertoire. */
4
+ export declare const MICRO_SQUARE_GLYPHS: MicroGlyphs;
5
+ /** Select an exact repertoire when preserving an existing font's fallback behavior. */
6
+ export declare function microGlyphs(characters: string, square?: boolean): MicroGlyphs;
@@ -0,0 +1,51 @@
1
+ /** An SBI instrument from its operator settings (modulator, carrier). */
2
+ export declare function sbi(o: {
3
+ modChar: number;
4
+ carChar: number;
5
+ modLevel: number;
6
+ carLevel: number;
7
+ modAD: number;
8
+ carAD: number;
9
+ modSR: number;
10
+ carSR: number;
11
+ modWave?: number;
12
+ carWave?: number;
13
+ feedback: number;
14
+ }): Uint8Array;
15
+ /**
16
+ * A few classic FM patches, written for this project. (The piano and the brass were once
17
+ * AdLib's STANDARD.BNK PIANO1 and BRASS1 register values; they are now our own.)
18
+ */
19
+ export declare const INSTRUMENTS: {
20
+ piano: Uint8Array<ArrayBufferLike>;
21
+ bass: Uint8Array<ArrayBufferLike>;
22
+ strings: Uint8Array<ArrayBufferLike>;
23
+ brass: Uint8Array<ArrayBufferLike>;
24
+ lead: Uint8Array<ArrayBufferLike>;
25
+ bell: Uint8Array<ArrayBufferLike>;
26
+ organ: Uint8Array<ArrayBufferLike>;
27
+ pad: Uint8Array<ArrayBufferLike>;
28
+ pluck: Uint8Array<ArrayBufferLike>;
29
+ };
30
+ /** "C#4" → MIDI 61; "r" → rest. */
31
+ export declare function midi(name: string): number | null;
32
+ export interface Voice {
33
+ /** MIDI channel 0..8 (each gets its own instrument). */
34
+ channel: number;
35
+ instrument: Uint8Array;
36
+ /** "C4 q, E4 e., r e, [C4 E4 G4] h" — brackets play a chord, its notes on this channel and the next ones (leave them free). */
37
+ notes: string;
38
+ velocity?: number;
39
+ /** Shift every note by semitones. */
40
+ transpose?: number;
41
+ }
42
+ /**
43
+ * Writes the song. `bpm` sets the speed; Game-Maker plays 146 ticks a second. Songs loop
44
+ * when they end, as PLAYGAME restarts them.
45
+ */
46
+ export declare function song(bpm: number, voices: Voice[]): Uint8Array;
47
+ /**
48
+ * A new, empty song: piano on every channel and one silent bar at `bpm` (a song with nothing
49
+ * in it at all would end the moment it starts, and PLAYGAME restarts a song when it ends).
50
+ */
51
+ export declare function blankSong(bpm?: number): Uint8Array;
@@ -0,0 +1,26 @@
1
+ /** Bytes of `size`-byte values split into planes: every value's first byte, then every second byte... */
2
+ export declare function toPlanes(data: Uint8Array, size: number): Uint8Array;
3
+ /** `toPlanes` undone. */
4
+ export declare function fromPlanes(data: Uint8Array, size: number): Uint8Array;
5
+ /** Vertex numbers as varints: each one's distance back from one past the highest so far, zigzagged; `starts` restart the count (a block per part). */
6
+ export declare function packIndices(ix: ArrayLike<number>, starts?: Set<number>): Uint8Array;
7
+ /** `count` vertex numbers from `packIndices`'s bytes. */
8
+ export declare function unpackIndices(data: Uint8Array, count: number, starts?: Set<number>): Uint32Array;
9
+ /** A binary STL packed: its header, a table of its distinct corners, each triangle's corner numbers and attribute, and any normal that is not the one worked out again. */
10
+ export declare function packStl(stl: Uint8Array): Uint8Array;
11
+ /** The binary STL `packStl` packed, byte for byte. */
12
+ export declare function unpackStl(pack: Uint8Array): Uint8Array;
13
+ /** Several named files in one pack (a ZIP's worth, to zip in the browser): each binary STL packed by `packStl`, the rest as they are. */
14
+ export declare function packFiles(files: {
15
+ name: string;
16
+ data: Uint8Array;
17
+ }[]): Uint8Array;
18
+ /** The files `packFiles` packed, each byte for byte. */
19
+ export declare function unpackFiles(pack: Uint8Array): {
20
+ name: string;
21
+ data: Uint8Array;
22
+ }[];
23
+ /** A file of float32s then uint32 vertex numbers (little-endian, as the phone kit's parts.bin), packed: the floats in byte planes, the numbers as varints counted afresh at each of `starts` (a part's first number). */
24
+ export declare function packFloatsAndIndices(bin: Uint8Array, floats: number, starts: number[]): Uint8Array;
25
+ /** The file `packFloatsAndIndices` packed, byte for byte. */
26
+ export declare function unpackFloatsAndIndices(pack: Uint8Array): Uint8Array;
@@ -0,0 +1,11 @@
1
+ import { type Part } from '../mesh/threeMf.js';
2
+ import { type ZipCodec, type ZipEntry } from '../mesh/zipFile.js';
3
+ /** The files inside the 3MF write3mf writes for these parts, before any deflate (write3mf stores them when given no codec). */
4
+ export declare function threeMfEntries(parts: Part[], title: string): ZipEntry[];
5
+ /** A 3MF from write3mf, packed (deflate the result); throws when its inner files would not come back the same. */
6
+ export declare function pack3mf(file: Uint8Array, codec: Pick<ZipCodec, 'inflate'>): Uint8Array;
7
+ /** A packed 3MF's title and parts, ready for write3mf or threeMfEntries. */
8
+ export declare function unpack3mf(pack: Uint8Array): {
9
+ title: string;
10
+ parts: Part[];
11
+ };
@@ -0,0 +1,4 @@
1
+ export declare const ATARI_NTSC_RGB = "\n000000 404040 6c6c6c 909090 b0b0b0 c8c8c8 dcdcdc ececec\n444400 646410 848424 a0a034 b8b840 d0d050 e8e85c fcfc68\n702800 844414 985c28 ac783c bc8c4c cca05c dcb468 e8cc7c\n841800 983418 ac5030 c06848 d0805c e09470 eca880 fcbc94\n880000 9c2020 b03c3c c05858 d07070 e08888 eca0a0 fcb4b4\n78005c 8c2074 a03c88 b0589c c070b0 d084c0 dc9cd0 ecb0e0\n480078 602090 783ca4 8c58b8 a070cc b484dc c49cec d4b0fc\n140084 302098 4c3cac 6858c0 7c70d0 9488e0 a8a0ec bcb4fc\n000088 1c209c 3840b0 505cc0 6874d0 7c8ce0 90a4ec a4b8fc\n00187c 1c3890 3854a8 5070bc 6888cc 7c9cdc 90b4ec a4c8fc\n002c5c 1c4c78 386890 5084ac 689cc0 7cb4d4 90cce8 a4e0fc\n00402c 1c5c48 387c64 509c80 68b494 7cd0ac 90e4c0 a4fcd4\n003c00 205c20 407c40 5c9c5c 74b474 8cd08c a4e4a4 b8fcb8\n143800 345c1c 507c38 6c9850 84b468 9ccc7c b4e490 c8fca4\n2c3000 4c501c 687034 848c4c 9ca864 b4c078 ccd488 e0ec9c\n442800 644818 846830 a08444 b89c58 d0b46c e8cc7c fce08c\n";
2
+ export declare const ATARI_PAL_RGB = "\n000000 404040 6c6c6c 909090 b0b0b0 c8c8c8 dcdcdc ececec\n805800 947020 a8843c bc9c58 ccac70 dcc084 ecd09c fce0b0\n445c00 5c7820 74903c 8cac58 a0c070 b0d484 c0e89c d4fcb0\n703400 885020 a0683c b48458 c89870 dcac84 ecc09c fcd4b0\n006414 208034 3c9850 58b06c 70c484 84d89c 9ce8b4 b0fcc8\n700014 882034 a03c50 b4586c c87084 dc849c ec9cb4 fcb0c8\n005c5c 207474 3c8c8c 58a4a4 70b8b8 84c8c8 9cdcdc b0ecec\n70005c 842074 943c88 a8589c b470b0 c484c0 d09cd0 e0b0e0\n003c70 1c5888 3874a0 508cb4 68a4c8 7cb8dc 90ccec a4e0fc\n580070 6c2088 803ca0 9458b4 a470c8 b484dc c49cec d4b0fc\n002070 1c3c88 3858a0 5074b4 6888c8 7ca0dc 90b4ec a4c8fc\n3c0080 542094 6c3ca8 8058bc 9470cc a884dc b89cec c8b0fc\n000088 20209c 3c3cb0 5858c0 7070d0 8484e0 9c9cec b0b0fc\n";
3
+ export declare const NES_RGB = "\n575757 000c8e 0800a6 340096 550061 630015 5a0000 3c0e00\n112800 003b00 004200 003a05 002652 000000 a5a5a5 0041d9\n2f1eff 6704f2 9400b4 aa0057 a31800 803900 4b5b00 137600\n008100 007923 006288 ffffff 4a9fff 797eff af63ff dd55ff\nf757c2 f76a63 dc8810 aea900 78c400 4ad211 2fcf64 2fbdc4\n414141 b9ddff cad1ff dec6ff f0c0ff fcc0ee fdc6ca f5d0aa\ne4dd95 d0e892 bdeea2 b2eec0 b0e8e3 b3b3b3\n";
4
+ export declare const C64_RGB = "\n000000 ffffff fa3200 1de0ff a84bcc 68ba51 004ad0 ffe94d\nff5b00 c13e00 ff723e 605e62 8c937f b2ff90 458aff c3b8d7\n";
@@ -0,0 +1,12 @@
1
+ import type { Palette } from '@lewismoten/gamemaker-sandbox-engine/formats/palette';
2
+ export interface PalettePreset {
3
+ readonly id: string;
4
+ readonly name: string;
5
+ readonly stem: string;
6
+ /** Occupied entries, including menu black; index 255 is always reserved. */
7
+ readonly entries: number;
8
+ readonly description: string;
9
+ }
10
+ export declare const PALETTE_PRESETS: readonly PalettePreset[];
11
+ /** A fresh 768-byte VGA palette. Black is moved to index 0; unused entries and 255 are black. */
12
+ export declare function createPalettePreset(id: string): Palette;
@@ -0,0 +1,52 @@
1
+ import type { Block } from '@lewismoten/gamemaker-sandbox-engine/formats/blocks';
2
+ import { type ReduceScore } from './colorReduce.js';
3
+ /** Color numbers 1-15 hold the engine's own interface colors (an inference from PLAYGAME's Box calls), so a proposed range starts at 16. */
4
+ export declare const FIRST_FREE = 16;
5
+ export declare const LAST_FREE = 254;
6
+ /** A sprite range never grows past this many colors; blocks with more get reduced. */
7
+ export declare const RANGE_CAP = 48;
8
+ export interface RoleDemand {
9
+ role: 'monster' | 'character';
10
+ /** Different colors (by RGB) the role's shown blocks draw. */
11
+ distinct: number;
12
+ /** How many pixels of the role's blocks use each color number, as drawn in their first palette. */
13
+ usage: number[];
14
+ }
15
+ export interface Proposed {
16
+ first: number;
17
+ last: number;
18
+ role: 'monster' | 'character';
19
+ /** Pixels of other blocks that already use a color number in this range (the sync must move or reduce them first). */
20
+ conflicts: number;
21
+ }
22
+ /** Windows for each sprite role, biggest first. `others[i]` counts pixels of other (background) blocks using color i. */
23
+ export declare function planRanges(demands: readonly RoleDemand[], others: readonly number[]): Proposed[];
24
+ export interface SyncFile {
25
+ blocks: Block[];
26
+ /** The block numbers scenes show. */
27
+ shown: ReadonlySet<number>;
28
+ /** Keys of the palettes the file is shown with; the first is its reference. */
29
+ palettes: string[];
30
+ }
31
+ export interface SyncResult {
32
+ ok: true;
33
+ /** Per file, the blocks whose pixels were renumbered. */
34
+ pixels: Map<number, Map<number, Uint8Array>>;
35
+ /** Per palette key, the new 768 bytes (only palettes that changed). */
36
+ palettes: Map<string, Uint8Array>;
37
+ score: ReduceScore;
38
+ /** Blocks (file index, number) whose picture changes, worst first. */
39
+ changed: {
40
+ file: number;
41
+ n: number;
42
+ mean: number;
43
+ }[];
44
+ /** Colors the range holds, and colors that were more than it holds. */
45
+ used: number;
46
+ reduced: number;
47
+ }
48
+ /** Makes `first..last` the same in every palette: the role's colors move in, scored. `blocked` is per palette the color numbers other files draw with. */
49
+ export declare function syncRange(files: readonly SyncFile[], palettes: ReadonlyMap<string, Uint8Array>, first: number, last: number, blocked: ReadonlyMap<string, ReadonlySet<number>>): SyncResult | {
50
+ ok: false;
51
+ why: string;
52
+ };
@@ -0,0 +1,4 @@
1
+ import type { Palette } from '@lewismoten/gamemaker-sandbox-engine/formats/palette';
2
+ export { PALETTE_PRESETS, createPalettePreset, type PalettePreset } from './palettePresets.js';
3
+ /** A fresh copy of the original Library palette (768 VGA bytes, black at index zero). */
4
+ export declare function libraryDefaultPalette(): Palette;
@@ -0,0 +1,3 @@
1
+ import type { DiskDiff } from './diskDiff.js';
2
+ /** Release-note text for a diff, or '' when nothing differs. Sentences: Changed, Added, Removed. */
3
+ export declare function releaseNotes(d: DiskDiff): string;
@@ -0,0 +1,6 @@
1
+ export { Sim, type SimScene } from './kit/sceneSim.js';
2
+ export { GameSim, readDisk, diskSim, TICKS_PER_SECOND } from './kit/gameSim.js';
3
+ export { newCharInfo, type CharInfo } from '@lewismoten/gamemaker-sandbox-engine/engine/world';
4
+ export * from './kit/sceneInit.js';
5
+ export * from './kit/routeChecks.js';
6
+ export { type State as GameSimState } from './kit/gameSim.js';
@@ -0,0 +1,41 @@
1
+ import { FONT_CP437 } from '@lewismoten/gamemaker-sandbox-engine/gfx/cp437Glyphs';
2
+ import { toCp437, fromCp437 } from '@lewismoten/gamemaker-sandbox-engine/text/cp437';
3
+ import { Pixels } from './kit/pixels.js';
4
+ import { MICRO_GLYPHS, MICRO_SQUARE_GLYPHS } from './microFont.js';
5
+ export { FONT_CP437, toCp437, fromCp437, MICRO_GLYPHS, MICRO_SQUARE_GLYPHS };
6
+ export type TextFont = 'cp437' | 'micro' | 'micro-square';
7
+ /** Encode Unicode DOS symbols, including box drawing. Unsupported characters throw. */
8
+ export declare function encodeText(s: string): Uint8Array;
9
+ /** A fresh copy of a glyph's rows; bit 0 is the leftmost pixel. */
10
+ export declare function glyphRows(code: number, font?: TextFont): Uint8Array;
11
+ export interface TextOptions {
12
+ font?: TextFont;
13
+ /** Palette index, 0..254; 255 is reserved for transparent pixels. */
14
+ color?: number;
15
+ scale?: number;
16
+ /** A one-output-pixel outline, including diagonal neighbors. */
17
+ outline?: number;
18
+ /** Shadow offset in output pixels, independent of glyph scale. */
19
+ shadow?: {
20
+ color: number;
21
+ dx?: number;
22
+ dy?: number;
23
+ };
24
+ }
25
+ export interface TextImage {
26
+ width: number;
27
+ height: number;
28
+ /** Row-major palette indexes; transparent pixels are 255. */
29
+ pixels: Uint8Array;
30
+ /** Where the unadorned first text cell begins within the image. */
31
+ originX: number;
32
+ originY: number;
33
+ }
34
+ /** Same-size shadowed sprite; pixels beyond the source canvas are clipped. */
35
+ export declare function dropShadow(src: Pixels, ink: number, dx?: number, dy?: number): Pixels;
36
+ /**
37
+ * Render Unicode text (LF/CRLF separated lines) or raw CP437 bytes (one row, including
38
+ * control-code glyphs). Returns native indexed pixels, with enough padding for effects.
39
+ * CP437 cells are 8×8; micro cells are 3×5 plus a 1px gap, with no trailing gap.
40
+ */
41
+ export declare function renderText(text: string | Uint8Array, options?: TextOptions): TextImage;
package/package.json CHANGED
@@ -1,6 +1,192 @@
1
1
  {
2
2
  "name": "@lewismoten/gamemaker-sandbox-tools",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "3.4.0",
4
+ "description": "Development tools for building and checking games in RSD Game-Maker formats",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/lewismoten/GameMaker-SandboxEdition.git",
10
+ "directory": "web/packages/tools"
11
+ },
12
+ "engines": {
13
+ "node": ">=22.12.0"
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "CHANGELOG.md",
19
+ "LICENSE",
20
+ "NOTICE.md"
21
+ ],
22
+ "exports": {
23
+ "./drawing": {
24
+ "types": "./dist/types/drawing.d.ts",
25
+ "browser": null,
26
+ "gamemaker-source": "./src/drawing.ts",
27
+ "import": "./dist/drawing.js"
28
+ },
29
+ "./audio": {
30
+ "types": "./dist/types/audio.d.ts",
31
+ "gamemaker-source": "./src/audio.ts",
32
+ "import": "./dist/audio.js"
33
+ },
34
+ "./images": {
35
+ "types": "./dist/types/images.d.ts",
36
+ "gamemaker-source": "./src/images.ts",
37
+ "import": "./dist/images.js"
38
+ },
39
+ "./simulation": {
40
+ "types": "./dist/types/simulation.d.ts",
41
+ "browser": null,
42
+ "gamemaker-source": "./src/simulation.ts",
43
+ "import": "./dist/simulation.js"
44
+ },
45
+ "./formats/*": {
46
+ "types": "./dist/types/formats/*.d.ts",
47
+ "browser": null,
48
+ "gamemaker-source": "./src/formats/*.ts",
49
+ "import": "./dist/formats/*.js"
50
+ },
51
+ "./kit/tar": {
52
+ "types": "./dist/types/kit/tar.d.ts",
53
+ "gamemaker-source": "./src/kit/tar.ts",
54
+ "import": "./dist/kit/tar.js"
55
+ },
56
+ "./kit/fliShrink": {
57
+ "types": "./dist/types/kit/fliShrink.d.ts",
58
+ "gamemaker-source": "./src/kit/fliShrink.ts",
59
+ "import": "./dist/kit/fliShrink.js"
60
+ },
61
+ "./kit/blockRoles": {
62
+ "types": "./dist/types/kit/blockRoles.d.ts",
63
+ "gamemaker-source": "./src/kit/blockRoles.ts",
64
+ "import": "./dist/kit/blockRoles.js"
65
+ },
66
+ "./kit/levelGen": {
67
+ "types": "./dist/types/kit/levelGen/index.d.ts",
68
+ "gamemaker-source": "./src/kit/levelGen/index.ts",
69
+ "import": "./dist/kit/levelGen.js"
70
+ },
71
+ "./kit/*": {
72
+ "types": "./dist/types/kit/*.d.ts",
73
+ "browser": null,
74
+ "gamemaker-source": "./src/kit/*.ts",
75
+ "import": "./dist/kit/*.js"
76
+ },
77
+ "./music/*": {
78
+ "types": "./dist/types/music/*.d.ts",
79
+ "gamemaker-source": "./src/music/*.ts",
80
+ "import": "./dist/music/*.js"
81
+ },
82
+ "./embroidery/*": {
83
+ "types": "./dist/types/embroidery/*.d.ts",
84
+ "gamemaker-source": "./src/embroidery/*.ts",
85
+ "import": "./dist/embroidery/*.js"
86
+ },
87
+ "./mesh/*": {
88
+ "types": "./dist/types/mesh/*.d.ts",
89
+ "gamemaker-source": "./src/mesh/*.ts",
90
+ "import": "./dist/mesh/*.js"
91
+ },
92
+ "./pack/*": {
93
+ "types": "./dist/types/pack/*.d.ts",
94
+ "gamemaker-source": "./src/pack/*.ts",
95
+ "import": "./dist/pack/*.js"
96
+ },
97
+ "./image/*": {
98
+ "types": "./dist/types/image/*.d.ts",
99
+ "gamemaker-source": "./src/image/*.ts",
100
+ "import": "./dist/image/*.js"
101
+ },
102
+ "./audio-files": {
103
+ "types": "./dist/types/audioFiles.d.ts",
104
+ "browser": null,
105
+ "gamemaker-source": "./src/audioFiles.ts",
106
+ "import": "./dist/audio-files.js"
107
+ },
108
+ "./block-merge": {
109
+ "types": "./dist/types/blockMerge.d.ts",
110
+ "gamemaker-source": "./src/blockMerge.ts",
111
+ "import": "./dist/block-merge.js"
112
+ },
113
+ "./look-alike": {
114
+ "types": "./dist/types/lookAlike.d.ts",
115
+ "gamemaker-source": "./src/lookAlike.ts",
116
+ "import": "./dist/look-alike.js"
117
+ },
118
+ "./palette-reserve": {
119
+ "types": "./dist/types/paletteReserve.d.ts",
120
+ "gamemaker-source": "./src/paletteReserve.ts",
121
+ "import": "./dist/palette-reserve.js"
122
+ },
123
+ "./gif-shrink": {
124
+ "types": "./dist/types/gifShrink.d.ts",
125
+ "gamemaker-source": "./src/gifShrink.ts",
126
+ "import": "./dist/gif-shrink.js"
127
+ },
128
+ "./color-reduce": {
129
+ "types": "./dist/types/colorReduce.d.ts",
130
+ "gamemaker-source": "./src/colorReduce.ts",
131
+ "import": "./dist/color-reduce.js"
132
+ },
133
+ "./delta": {
134
+ "types": "./dist/types/delta.d.ts",
135
+ "gamemaker-source": "./src/delta.ts",
136
+ "import": "./dist/delta.js"
137
+ },
138
+ "./disk-diff": {
139
+ "types": "./dist/types/diskDiff.d.ts",
140
+ "gamemaker-source": "./src/diskDiff.ts",
141
+ "import": "./dist/disk-diff.js"
142
+ },
143
+ "./release-notes": {
144
+ "types": "./dist/types/releaseNotes.d.ts",
145
+ "gamemaker-source": "./src/releaseNotes.ts",
146
+ "import": "./dist/release-notes.js"
147
+ },
148
+ "./menu-version": {
149
+ "types": "./dist/types/menuVersionEntry.d.ts",
150
+ "gamemaker-source": "./src/menuVersionEntry.ts",
151
+ "import": "./dist/menu-version.js"
152
+ },
153
+ "./microFont": {
154
+ "types": "./dist/types/microFont.d.ts",
155
+ "gamemaker-source": "./src/microFont.ts",
156
+ "import": "./dist/microFont.js"
157
+ },
158
+ "./colors": {
159
+ "types": "./dist/types/colors.d.ts",
160
+ "gamemaker-source": "./src/colors.ts",
161
+ "import": "./dist/colors.js"
162
+ },
163
+ "./text": {
164
+ "types": "./dist/types/text.d.ts",
165
+ "gamemaker-source": "./src/text.ts",
166
+ "import": "./dist/text.js"
167
+ },
168
+ "./palettes": {
169
+ "types": "./dist/types/palettes.d.ts",
170
+ "gamemaker-source": "./src/palettes.ts",
171
+ "import": "./dist/palettes.js"
172
+ }
173
+ },
174
+ "scripts": {
175
+ "build": "node build.js",
176
+ "prepack": "npm run build",
177
+ "verify": "npm run build && node verify.js"
178
+ },
179
+ "devDependencies": {
180
+ "@types/node": "^22.20.5",
181
+ "typescript": "~5.9.0",
182
+ "vite": "^7.1.0"
183
+ },
184
+ "publishConfig": {
185
+ "registry": "https://npm.pkg.github.com/"
186
+ },
187
+ "dependencies": {
188
+ "@lewismoten/gamemaker-sandbox-engine": "^3.2.0",
189
+ "@lewismoten/gamemaker-sandbox-archives": "^3.2.0"
190
+ },
191
+ "author": "Lewis Moten"
192
+ }