@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,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,34 @@
1
+ import { Pixels } from './pixels.js';
2
+ /** The palette (6-bit VGA) faded toward black: light 0 is black, 1 is unchanged. */
3
+ export declare function dimmed(pal: Uint8Array, light: number): Uint8Array;
4
+ export declare class Reel {
5
+ /** The reel's palette (6-bit VGA, 768 bytes). */
6
+ readonly pal: Uint8Array;
7
+ readonly w: number;
8
+ readonly h: number;
9
+ readonly frames: Uint8Array[];
10
+ readonly palettes: Uint8Array[];
11
+ private last?;
12
+ constructor(
13
+ /** The reel's palette (6-bit VGA, 768 bytes). */
14
+ pal: Uint8Array, w?: number, h?: number);
15
+ /** Adds a picture for `hold` frames, its palette faded to `light`. */
16
+ add(p: Pixels, hold?: number, light?: number, pal?: Uint8Array<ArrayBufferLike>): this;
17
+ /** A picture drawn over a copy of `bg` (the actors over the scenery), for `hold` frames. */
18
+ frame(bg: Pixels, draw: (p: Pixels) => void, hold?: number, light?: number, pal?: Uint8Array<ArrayBufferLike>): this;
19
+ /** The picture fading in from black over `n` frames (the last at full light). */
20
+ fadeIn(p: Pixels, n: number, pal?: Uint8Array<ArrayBufferLike>): this;
21
+ /** The last picture fading out to black over `n` frames. */
22
+ fadeOut(n: number): this;
23
+ /**
24
+ * A cartoon's closing iris: black closes in on (cx, cy) over `n` frames from the last picture
25
+ * down to a circle `end` pixels across (round on a 4:3 screen: VGA's pixels are taller than
26
+ * wide), and holds there `hold` frames. Follow it with fadeOut. Gives an intro whose pictures
27
+ * are the title's art a last view that isn't the title.
28
+ */
29
+ irisOut(cx: number, cy: number, n: number, end?: number, hold?: number): this;
30
+ /** The .FLI: `speed` is the wait after each frame in 1/70 s (5 = 14 frames a second). */
31
+ fli(speed: number): Uint8Array;
32
+ /** How long it plays, in seconds. */
33
+ seconds(speed: number): number;
34
+ }
@@ -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;
@@ -0,0 +1,84 @@
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
+ export interface SimScene {
7
+ map: GameMap;
8
+ bbl: Block[];
9
+ mbl?: Block[];
10
+ mon?: Monster[];
11
+ chr: Character;
12
+ cbl: Block[];
13
+ links?: {
14
+ from: {
15
+ x: number;
16
+ y: number;
17
+ };
18
+ to: {
19
+ x: number;
20
+ y: number;
21
+ };
22
+ }[];
23
+ /** Monster names by number (for bots that look for one). */
24
+ names?: string[];
25
+ }
26
+ /** What Sim.snapshot() keeps. */
27
+ interface SimState {
28
+ w: Omit<World, 'sound' | 'rand' | 'joystick' | 'bg' | 'mblk' | 'cblk' | 'mon' | 'palette' | 'chr'>;
29
+ chr: Character;
30
+ randA: number;
31
+ held: number[];
32
+ pending: number[];
33
+ doScroll: boolean;
34
+ sounds: number;
35
+ ticks: number;
36
+ link: number;
37
+ dead: boolean;
38
+ }
39
+ export declare class Sim {
40
+ readonly scene: SimScene;
41
+ readonly w: World;
42
+ private held;
43
+ private doScroll;
44
+ sounds: number[];
45
+ /** Ticks played so far. */
46
+ ticks: number;
47
+ /** Called with every key event (scan, bit 7 = released), e.g. to record a demo. */
48
+ onKey?: (key: number) => void;
49
+ /** Link index reached (-1 = none yet). */
50
+ link: number;
51
+ dead: boolean;
52
+ constructor(scene: SimScene, start: {
53
+ x: number;
54
+ y: number;
55
+ }, ci?: CharInfo, seed?: number,
56
+ /** False for games whose scenes never scroll (one screen each): the scroll window is shut. */
57
+ scroll?: boolean);
58
+ /** kit/pixels.ts rng() (mulberry32), with its state out where a snapshot can keep it. */
59
+ private randA;
60
+ private rand;
61
+ /** Everything that changes as the scene plays, to try a move and take it back with restore(). */
62
+ snapshot(): SimState;
63
+ restore(s: SimState): void;
64
+ press(scan: number): void;
65
+ release(scan: number): void;
66
+ private pending;
67
+ private event;
68
+ /** One 18.2 Hz game tick (8 scroll steps + tick()). */
69
+ tick(): Promise<void>;
70
+ run(ticks: number, each?: (t: number) => void | boolean): Promise<void>;
71
+ /** Live monsters called `name`, with their block positions. */
72
+ monsters(name: string): {
73
+ x: number;
74
+ y: number;
75
+ }[];
76
+ /** Character position in pixels (x of its column, y of its bottom block). */
77
+ get pos(): {
78
+ x: number;
79
+ y: number;
80
+ bx: number;
81
+ by: number;
82
+ };
83
+ }
84
+ export {};
@@ -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 {};