@lewismoten/gamemaker-sandbox-tools 3.1.0 → 3.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -0
- package/NOTICE.md +105 -3
- package/README.md +301 -15
- package/dist/audio-files.js +82 -0
- package/dist/audio.js +23 -138
- package/dist/block-merge.js +43 -0
- package/dist/color-reduce.js +44 -0
- package/dist/colors.js +87 -0
- package/dist/delta.js +75 -0
- package/dist/disk-diff.js +220 -0
- package/dist/drawing.js +83 -869
- package/dist/embroidery/compile.js +85 -0
- package/dist/embroidery/dst.js +79 -0
- package/dist/embroidery/exp.js +26 -0
- package/dist/embroidery/fill.js +49 -0
- package/dist/embroidery/geom.js +82 -0
- package/dist/embroidery/pes.js +79 -0
- package/dist/embroidery/satin.js +29 -0
- package/dist/embroidery/simulate.js +30 -0
- package/dist/embroidery/strokeFont.js +253 -0
- package/dist/embroidery/svg.js +24 -0
- package/dist/embroidery/types.js +13 -0
- package/dist/embroidery/units.js +26 -0
- package/dist/embroidery/validate.js +15 -0
- package/dist/formats/blocks.js +1 -103
- package/dist/formats/character.js +1 -83
- package/dist/formats/cmf.js +1 -37
- package/dist/formats/fli.js +1 -296
- package/dist/formats/fliLimits.js +1 -54
- package/dist/formats/game.js +1 -193
- package/dist/formats/gif.js +1 -125
- package/dist/formats/graphicScripts.js +1 -44
- package/dist/formats/map.js +1 -38
- package/dist/formats/monster.js +1 -69
- package/dist/formats/palette.js +1 -58
- package/dist/formats/recording.js +1 -17
- package/dist/formats/sound.js +1 -44
- package/dist/formats/voc.js +1 -303
- package/dist/gif-shrink.js +56 -0
- package/dist/image/png.js +42 -0
- package/dist/images.js +81 -43
- package/dist/kit/actors.js +19 -0
- package/dist/kit/align.js +204 -0
- package/dist/kit/blit.js +45 -0
- package/dist/kit/blockRoles.js +97 -0
- package/dist/kit/clips.js +40 -0
- package/dist/kit/coverPaint.js +18 -0
- package/dist/kit/disk.js +76 -0
- package/dist/kit/fadeOut.js +13 -0
- package/dist/kit/fliClips.js +133 -0
- package/dist/kit/fliShrink.js +277 -0
- package/dist/kit/gameSim.js +235 -0
- package/dist/kit/hopBot.js +142 -0
- package/dist/kit/levelGen.js +1423 -0
- package/dist/kit/levelGrid.js +33 -0
- package/dist/kit/levelPicture.js +27 -0
- package/dist/kit/menuVersion.js +19 -0
- package/dist/kit/microText.js +35 -0
- package/dist/kit/mumble.js +74 -0
- package/dist/kit/music.js +8 -0
- package/dist/kit/palRamps.js +32 -0
- package/dist/kit/palette.js +49 -0
- package/dist/kit/pcText.js +72 -0
- package/dist/kit/photo.js +150 -0
- package/dist/kit/pixels.js +79 -0
- package/dist/kit/png.js +40 -0
- package/dist/kit/quantize.js +72 -0
- package/dist/kit/raytrace.js +379 -0
- package/dist/kit/recordedDemo.js +10 -0
- package/dist/kit/reel.js +77 -0
- package/dist/kit/road3d.js +67 -0
- package/dist/kit/routeChecks.js +8 -0
- package/dist/kit/saveSlots.js +11 -0
- package/dist/kit/sceneInit.js +13 -0
- package/dist/kit/sceneSim.js +112 -0
- package/dist/kit/screenText.js +15 -0
- package/dist/kit/sdftext.js +237 -0
- package/dist/kit/shading.js +69 -0
- package/dist/kit/song.js +251 -0
- package/dist/kit/songFx.js +179 -0
- package/dist/kit/sound.js +52 -0
- package/dist/kit/synthParts.js +20 -0
- package/dist/kit/tar.js +53 -0
- package/dist/kit/textBounds.js +84 -0
- package/dist/kit/textfit.js +246 -0
- package/dist/kit/transforms.js +57 -0
- package/dist/kit/tune.js +21 -0
- package/dist/look-alike.js +50 -0
- package/dist/menu-version.js +4 -0
- package/dist/mesh/colorBodies.js +137 -0
- package/dist/mesh/decimate.js +207 -0
- package/dist/mesh/meshCheck.js +51 -0
- package/dist/mesh/overhang.js +41 -0
- package/dist/mesh/sampledField.js +12 -0
- package/dist/mesh/stl.js +36 -0
- package/dist/mesh/surfaceNets.js +79 -0
- package/dist/mesh/tetraMesh.js +62 -0
- package/dist/mesh/threeMf.js +58 -0
- package/dist/mesh/zipFile.js +52 -0
- package/dist/microFont.js +101 -0
- package/dist/music/compose.js +72 -0
- package/dist/pack/meshPack.js +198 -0
- package/dist/pack/threeMfPack.js +92 -0
- package/dist/palette-reserve.js +116 -0
- package/dist/palettes.js +138 -0
- package/dist/release-notes.js +40 -0
- package/dist/simulation.js +16 -2774
- package/dist/text.js +74 -0
- package/dist/types/audio.d.ts +4 -0
- package/dist/types/audioFiles.d.ts +22 -0
- package/dist/types/audioWav.d.ts +4 -0
- package/dist/types/blockMerge.d.ts +24 -0
- package/dist/types/colorReduce.d.ts +23 -0
- package/dist/types/{web/packages/tools/src/colors.d.ts → colors.d.ts} +6 -0
- package/dist/types/delta.d.ts +32 -0
- package/dist/types/diskDiff.d.ts +47 -0
- package/dist/types/drawing.d.ts +15 -0
- package/dist/types/embroidery/compile.d.ts +3 -0
- package/dist/types/embroidery/dst.d.ts +13 -0
- package/dist/types/embroidery/exp.d.ts +8 -0
- package/dist/types/embroidery/fill.d.ts +6 -0
- package/dist/types/embroidery/geom.d.ts +19 -0
- package/dist/types/embroidery/pes.d.ts +10 -0
- package/dist/types/embroidery/satin.d.ts +11 -0
- package/dist/types/embroidery/simulate.d.ts +19 -0
- package/dist/types/embroidery/strokeFont.d.ts +20 -0
- package/dist/types/embroidery/svg.d.ts +3 -0
- package/dist/types/embroidery/types.d.ts +70 -0
- package/dist/types/embroidery/units.d.ts +10 -0
- package/dist/types/embroidery/validate.d.ts +22 -0
- package/dist/types/formats/blocks.d.ts +1 -0
- package/dist/types/formats/character.d.ts +1 -0
- package/dist/types/formats/cmf.d.ts +1 -0
- package/dist/types/formats/fli.d.ts +1 -0
- package/dist/types/formats/fliLimits.d.ts +1 -0
- package/dist/types/formats/game.d.ts +1 -0
- package/dist/types/formats/gif.d.ts +1 -0
- package/dist/types/formats/graphicScripts.d.ts +1 -0
- package/dist/types/formats/map.d.ts +1 -0
- package/dist/types/formats/monster.d.ts +1 -0
- package/dist/types/formats/palette.d.ts +1 -0
- package/dist/types/formats/recording.d.ts +1 -0
- package/dist/types/formats/sound.d.ts +1 -0
- package/dist/types/formats/voc.d.ts +1 -0
- package/dist/types/gifShrink.d.ts +8 -0
- package/dist/types/image/animatedGif.d.ts +9 -0
- package/dist/types/image/surface.d.ts +26 -0
- package/dist/types/images.d.ts +13 -0
- package/dist/types/kit/actors.d.ts +7 -0
- package/dist/types/kit/align.d.ts +93 -0
- package/dist/types/kit/audioEvents.d.ts +26 -0
- package/dist/types/kit/blit.d.ts +20 -0
- package/dist/types/kit/blockRoles.d.ts +243 -0
- package/dist/types/{games/kit → kit}/clips.d.ts +1 -1
- package/dist/types/kit/coverPaint.d.ts +7 -0
- package/dist/types/kit/disk.d.ts +15 -0
- package/dist/types/kit/fadeOut.d.ts +12 -0
- package/dist/types/kit/fliClips.d.ts +32 -0
- package/dist/types/kit/fliShrink.d.ts +149 -0
- package/dist/types/{games/kit → kit}/gameSim.d.ts +9 -5
- package/dist/types/kit/hopBot.d.ts +72 -0
- package/dist/types/kit/laserClearance.d.ts +16 -0
- package/dist/types/kit/laserJoints.d.ts +39 -0
- package/dist/types/kit/laserLayout.d.ts +54 -0
- package/dist/types/kit/laserPixels.d.ts +52 -0
- package/dist/types/kit/laserPreview.d.ts +9 -0
- package/dist/types/kit/laserSvg.d.ts +35 -0
- package/dist/types/kit/levelGen/castle.d.ts +17 -0
- package/dist/types/kit/levelGen/dungeon.d.ts +11 -0
- package/dist/types/kit/levelGen/forest.d.ts +17 -0
- package/dist/types/kit/levelGen/furnish.d.ts +31 -0
- package/dist/types/kit/levelGen/grid.d.ts +46 -0
- package/dist/types/kit/levelGen/index.d.ts +138 -0
- package/dist/types/kit/levelGen/interior.d.ts +18 -0
- package/dist/types/kit/levelGen/jumpModel.d.ts +78 -0
- package/dist/types/kit/levelGen/needs.d.ts +44 -0
- package/dist/types/kit/levelGen/overworld.d.ts +21 -0
- package/dist/types/kit/levelGen/platform.d.ts +59 -0
- package/dist/types/kit/levelGen/platformCap.d.ts +13 -0
- package/dist/types/kit/levelGen/platformReach.d.ts +37 -0
- package/dist/types/kit/levelGen/props.d.ts +37 -0
- package/dist/types/kit/levelGen/town.d.ts +24 -0
- package/dist/types/kit/levelGrid.d.ts +16 -0
- package/dist/types/kit/levelPicture.d.ts +9 -0
- package/dist/types/kit/menuVersion.d.ts +7 -0
- package/dist/types/kit/microText.d.ts +18 -0
- package/dist/types/kit/mumble.d.ts +41 -0
- package/dist/types/kit/music.d.ts +1 -0
- package/dist/types/kit/palMerge.d.ts +10 -0
- package/dist/types/kit/palRamps.d.ts +28 -0
- package/dist/types/kit/pcText.d.ts +19 -0
- package/dist/types/kit/photo.d.ts +69 -0
- package/dist/types/kit/png.d.ts +7 -0
- package/dist/types/kit/quantize.d.ts +20 -0
- package/dist/types/kit/raytrace.d.ts +169 -0
- package/dist/types/kit/recordedDemo.d.ts +1 -0
- package/dist/types/kit/road3d.d.ts +71 -0
- package/dist/types/kit/routeChecks.d.ts +6 -0
- package/dist/types/kit/saveSlots.d.ts +17 -0
- package/dist/types/kit/sceneInit.d.ts +11 -0
- package/dist/types/{games/kit → kit}/sceneSim.d.ts +5 -5
- package/dist/types/kit/screenText.d.ts +3 -0
- package/dist/types/kit/sdftext.d.ts +34 -0
- package/dist/types/kit/shading.d.ts +23 -0
- package/dist/types/kit/shareBlocks.d.ts +20 -0
- package/dist/types/kit/song.d.ts +89 -0
- package/dist/types/kit/songFx.d.ts +99 -0
- package/dist/types/kit/synthParts.d.ts +7 -0
- package/dist/types/kit/tar.d.ts +13 -0
- package/dist/types/kit/textfit.d.ts +74 -0
- package/dist/types/kit/transforms.d.ts +8 -0
- package/dist/types/lookAlike.d.ts +31 -0
- package/dist/types/menuVersionEntry.d.ts +1 -0
- package/dist/types/mesh/colorBodies.d.ts +18 -0
- package/dist/types/mesh/decimate.d.ts +10 -0
- package/dist/types/mesh/fieldTrinket.d.ts +40 -0
- package/dist/types/mesh/figureShapes.d.ts +24 -0
- package/dist/types/mesh/mesh.d.ts +9 -0
- package/dist/types/mesh/meshCheck.d.ts +22 -0
- package/dist/types/mesh/overhang.d.ts +24 -0
- package/dist/types/mesh/pixelFigure.d.ts +41 -0
- package/dist/types/mesh/sampledField.d.ts +3 -0
- package/dist/types/mesh/sdfShapes.d.ts +20 -0
- package/dist/types/mesh/stl.d.ts +9 -0
- package/dist/types/mesh/strokeText.d.ts +8 -0
- package/dist/types/mesh/surfaceNets.d.ts +14 -0
- package/dist/types/mesh/tetraMesh.d.ts +4 -0
- package/dist/types/mesh/threeMf.d.ts +12 -0
- package/dist/types/mesh/trinketKinds.d.ts +72 -0
- package/dist/types/mesh/trinketTool.d.ts +26 -0
- package/dist/types/mesh/voxel.d.ts +10 -0
- package/dist/types/mesh/zipFile.d.ts +13 -0
- package/dist/types/microFont.d.ts +6 -0
- package/dist/types/pack/meshPack.d.ts +26 -0
- package/dist/types/pack/threeMfPack.d.ts +11 -0
- package/dist/types/palettePresetData.d.ts +4 -0
- package/dist/types/palettePresets.d.ts +12 -0
- package/dist/types/paletteReserve.d.ts +52 -0
- package/dist/types/palettes.d.ts +4 -0
- package/dist/types/releaseNotes.d.ts +3 -0
- package/dist/types/simulation.d.ts +6 -0
- package/dist/types/{web/packages/tools/src/text.d.ts → text.d.ts} +6 -6
- package/package.json +145 -15
- package/dist/binary-D7wuaC5g.js +0 -120
- package/dist/pixels-DzfIIUOl.js +0 -76
- package/dist/types/games/kit/blit.d.ts +0 -10
- package/dist/types/games/kit/music.d.ts +0 -1
- package/dist/types/games/kit/pcText.d.ts +0 -8
- package/dist/types/games/kit/shading.d.ts +0 -11
- package/dist/types/web/packages/tools/src/audio.d.ts +0 -3
- package/dist/types/web/packages/tools/src/drawing.d.ts +0 -10
- package/dist/types/web/packages/tools/src/images.d.ts +0 -2
- package/dist/types/web/packages/tools/src/microFont.d.ts +0 -1
- package/dist/types/web/packages/tools/src/simulation.d.ts +0 -3
- package/dist/types/web/scripts/cdGames.d.ts +0 -103
- package/dist/types/web/scripts/gameShots.d.ts +0 -12
- package/dist/types/web/scripts/ogImage.d.ts +0 -21
- package/dist/types/web/src/audio/cmfLoad.d.ts +0 -7
- package/dist/types/web/src/audio/cmfPlayer.d.ts +0 -69
- package/dist/types/web/src/audio/context.d.ts +0 -12
- package/dist/types/web/src/audio/engine.d.ts +0 -39
- package/dist/types/web/src/audio/music.worklet.d.ts +0 -14
- package/dist/types/web/src/audio/opl.d.ts +0 -37
- package/dist/types/web/src/audio/output.d.ts +0 -13
- package/dist/types/web/src/desk/boxes/boxFacts.d.ts +0 -85
- package/dist/types/web/src/dosPlayer/fileExtensions.d.ts +0 -44
- package/dist/types/web/src/dosPlayer/patchRules.d.ts +0 -24
- package/dist/types/web/src/dosPlayer/patchTable.d.ts +0 -80
- package/dist/types/web/src/edition.d.ts +0 -6
- package/dist/types/web/src/eggs/eggState.d.ts +0 -26
- package/dist/types/web/src/eggs/eggs.d.ts +0 -31
- package/dist/types/web/src/engine/character.d.ts +0 -30
- package/dist/types/web/src/engine/funcKeys.d.ts +0 -33
- package/dist/types/web/src/engine/game.d.ts +0 -52
- package/dist/types/web/src/engine/keys.d.ts +0 -17
- package/dist/types/web/src/engine/machine.d.ts +0 -99
- package/dist/types/web/src/engine/menus.d.ts +0 -46
- package/dist/types/web/src/engine/monsters.d.ts +0 -19
- package/dist/types/web/src/engine/playGain.d.ts +0 -11
- package/dist/types/web/src/engine/playerLook.d.ts +0 -26
- package/dist/types/web/src/engine/recorder.d.ts +0 -60
- package/dist/types/web/src/engine/render.d.ts +0 -8
- package/dist/types/web/src/engine/scene.d.ts +0 -156
- package/dist/types/web/src/engine/scroll.d.ts +0 -16
- package/dist/types/web/src/engine/showGraphic.d.ts +0 -39
- package/dist/types/web/src/engine/slowPc.d.ts +0 -62
- package/dist/types/web/src/engine/touch.d.ts +0 -33
- package/dist/types/web/src/engine/world.d.ts +0 -215
- package/dist/types/web/src/export/gameAbout.d.ts +0 -15
- package/dist/types/web/src/formats/binary.d.ts +0 -44
- package/dist/types/web/src/formats/blocks.d.ts +0 -52
- package/dist/types/web/src/formats/character.d.ts +0 -65
- package/dist/types/web/src/formats/cmf.d.ts +0 -33
- package/dist/types/web/src/formats/fli.d.ts +0 -45
- package/dist/types/web/src/formats/fliLimits.d.ts +0 -13
- package/dist/types/web/src/formats/game.d.ts +0 -72
- package/dist/types/web/src/formats/gif.d.ts +0 -15
- package/dist/types/web/src/formats/graphicScripts.d.ts +0 -18
- package/dist/types/web/src/formats/highscore.d.ts +0 -10
- package/dist/types/web/src/formats/map.d.ts +0 -24
- package/dist/types/web/src/formats/monster.d.ts +0 -48
- package/dist/types/web/src/formats/palette.d.ts +0 -15
- package/dist/types/web/src/formats/recording.d.ts +0 -7
- package/dist/types/web/src/formats/sound.d.ts +0 -13
- package/dist/types/web/src/formats/voc.d.ts +0 -13
- package/dist/types/web/src/gfx/cp437Glyphs.d.ts +0 -2
- package/dist/types/web/src/gfx/font8x8.d.ts +0 -2
- package/dist/types/web/src/gfx/levelPicture.d.ts +0 -81
- package/dist/types/web/src/gfx/screen.d.ts +0 -46
- package/dist/types/web/src/gfx/titlePicture.d.ts +0 -21
- package/dist/types/web/src/input/chords.d.ts +0 -22
- package/dist/types/web/src/input/deskMouse.d.ts +0 -14
- package/dist/types/web/src/input/keyboard.d.ts +0 -39
- package/dist/types/web/src/input/scancodes.d.ts +0 -3
- package/dist/types/web/src/manual/printables/types.d.ts +0 -277
- package/dist/types/web/src/project/bizarre.d.ts +0 -28
- package/dist/types/web/src/project/companion.d.ts +0 -35
- package/dist/types/web/src/project/diskFacts.d.ts +0 -30
- package/dist/types/web/src/project/files.d.ts +0 -124
- package/dist/types/web/src/project/gameFiles.d.ts +0 -49
- package/dist/types/web/src/project/gamePack.d.ts +0 -17
- package/dist/types/web/src/project/health.d.ts +0 -30
- package/dist/types/web/src/project/secretGames.d.ts +0 -19
- package/dist/types/web/src/project/storage.d.ts +0 -46
- package/dist/types/web/src/project/streamGame.d.ts +0 -38
- package/dist/types/web/src/project/zip.d.ts +0 -33
- package/dist/types/web/src/retro/dos/disks.d.ts +0 -33
- package/dist/types/web/src/retro/text/cp437.d.ts +0 -4
- package/dist/types/web/src/seededRandom.d.ts +0 -6
- package/dist/types/web/src/tinHearts/deskHearts.d.ts +0 -33
- package/dist/types/web/src/tinHearts/manifest.d.ts +0 -30
- package/dist/types/web/src/tinHearts/tinHearts.d.ts +0 -84
- package/dist/types/web/src/walkthrough/format.d.ts +0 -92
- package/dist/types/web/src/walkthrough/madeUpScores.d.ts +0 -6
- package/dist/types/web/src/walkthrough/runtime.d.ts +0 -134
- /package/dist/types/{web/src/assistant → image}/png.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/palette.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/pixels.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/reel.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/sound.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/textBounds.d.ts +0 -0
- /package/dist/types/{games/kit → kit}/tune.d.ts +0 -0
- /package/dist/types/{web/src/audio → music}/compose.d.ts +0 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { type Block } from '@lewismoten/gamemaker-sandbox-engine/formats/blocks';
|
|
2
|
+
/** What a map cell holds, by block name ('' or undefined for unnamed). */
|
|
3
|
+
export type NameAt = (x: number, y: number) => string | undefined;
|
|
4
|
+
/** A wanted part: its name, or a test (a RegExp, or { test, toString } for the report). */
|
|
5
|
+
type Want = string | {
|
|
6
|
+
test(got: string): boolean;
|
|
7
|
+
toString(): string;
|
|
8
|
+
};
|
|
9
|
+
/** Where a part wants its neighbors: [dx, dy, wanted]. */
|
|
10
|
+
export type Need = [number, number, Want][];
|
|
11
|
+
/** A part and the parts that must sit beside it. `need` may be a function of the part's regex
|
|
12
|
+
* match; with several needs (a part that can stand in more than one place of its object) one
|
|
13
|
+
* of them must hold. */
|
|
14
|
+
export interface PartRule {
|
|
15
|
+
part: string | {
|
|
16
|
+
test(name: string): boolean;
|
|
17
|
+
};
|
|
18
|
+
need: Need | Need[] | ((m: RegExpExecArray) => Need);
|
|
19
|
+
/** Name for the report (default: the part's name). */
|
|
20
|
+
what?: string;
|
|
21
|
+
/** false: the neighbors it checks are not parts of its object (no art join to measure). */
|
|
22
|
+
joins?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Every part whose neighbors are wrong: "name at x,y: wanted W at dx,dy, found G". Parts must
|
|
25
|
+
* not run off the map's edge either (playgame's maps wrap, so the other side is wrong too).
|
|
26
|
+
* Right-hand and lower neighbors that are right go into `joined` (JSON [left or upper, right or
|
|
27
|
+
* lower, 'h' or 'v']), the pairs whose art must join up. */
|
|
28
|
+
export declare function checkParts(at: NameAt, rules: PartRule[], w?: number, h?: number, joined?: Set<string>): string[];
|
|
29
|
+
/** Rules for objects whose parts are named by column and row (house:0,1 or cat12): every part
|
|
30
|
+
* wants every other part of its object. `sizes` gives each object's columns and rows; `name`
|
|
31
|
+
* turns object, column and row back into a part name. `alias` lets an animation frame stand
|
|
32
|
+
* in for a part. */
|
|
33
|
+
export declare function gridParts(re: RegExp, sizes: Map<string, [number, number]>, name: (obj: string, c: number, r: number) => string, alias?: (got: string) => string): PartRule;
|
|
34
|
+
/** Rules for an object drawn as rows of parts (null: any block): each part wants every other
|
|
35
|
+
* part of the object at its place (a part found at several places: at one of them). */
|
|
36
|
+
export declare function shape(what: string, rows: (Want | null)[][]): PartRule[];
|
|
37
|
+
/** Pairs: every `a` has a `b` at dx, dy and every `b` an `a` the other way. */
|
|
38
|
+
export declare const pair: (what: string, a: Want, b: Want, dx: number, dy: number) => PartRule[];
|
|
39
|
+
/** Rules read off the maps themselves, for a game whose objects are numbered parts (sign0
|
|
40
|
+
* sign1 sign2, or sign00 sign01 down a column): where part n mostly stands (`share` of the
|
|
41
|
+
* time) with part n+1 just right of it (or just below it), that is how the object goes
|
|
42
|
+
* together, and every part n and n+1 must be so. Numbered animation frames and patterns don't
|
|
43
|
+
* stand that way, so they get no rule.
|
|
44
|
+
* `skip` leaves out stems that only look like objects. */
|
|
45
|
+
export declare function autoParts(maps: NameAt[], names: Iterable<string>, skip?: RegExp, share?: number): PartRule[];
|
|
46
|
+
/** A block book's names by block number. */
|
|
47
|
+
export declare function namesOf(index: Map<string, number>): string[];
|
|
48
|
+
/** Object sizes (columns, rows) from a block set's part names matched by `re` (object, col, row). */
|
|
49
|
+
export declare function sizesOf(names: Iterable<string>, re: RegExp): Map<string, [number, number]>;
|
|
50
|
+
/** A block's picture: palette index at x, y (0..19). */
|
|
51
|
+
type Pic = (x: number, y: number) => number;
|
|
52
|
+
interface Seam {
|
|
53
|
+
a: string;
|
|
54
|
+
b: string;
|
|
55
|
+
dir: 'h' | 'v';
|
|
56
|
+
/** Mean color distance across the shared edge. */
|
|
57
|
+
across: number;
|
|
58
|
+
/** Draws the pair joined (scaled up) into a PNG, for a look. */
|
|
59
|
+
draw?: (file: string, s?: number) => void;
|
|
60
|
+
/** Mean color distance one pixel in from the edge, on the busier side (the art's own texture,
|
|
61
|
+
* so a pattern with a line on its edge, like tile grout, is not a break). */
|
|
62
|
+
within: number;
|
|
63
|
+
}
|
|
64
|
+
/** How sharply each joined pair's art changes across its shared edge ('h': b right of a,
|
|
65
|
+
* 'v': b below a), next to how much it changes one pixel either side of the edge. A seam
|
|
66
|
+
* whose `across` is far above `within` is where the art breaks (an outline, a jump). */
|
|
67
|
+
export declare function seams(pic: (name: string) => Pic, pal: Uint8Array, pairs: [string, string, 'h' | 'v'][]): Seam[];
|
|
68
|
+
/** Seams that look broken: the colors jump across the edge much more than beside it. */
|
|
69
|
+
export declare function brokenSeams(s: Seam[], factor?: number, floor?: number): Seam[];
|
|
70
|
+
/** One adventure scene of a built disk: its name, palette, map and background blocks. */
|
|
71
|
+
export interface DiskScene {
|
|
72
|
+
desc: string;
|
|
73
|
+
map: string;
|
|
74
|
+
pal: Uint8Array;
|
|
75
|
+
blocks: Uint8Array;
|
|
76
|
+
bbl: Block[];
|
|
77
|
+
}
|
|
78
|
+
/** Every adventure scene on a built disk (the .gam's scenes, by their files). */
|
|
79
|
+
export declare function diskScenes(disk: string): DiskScene[];
|
|
80
|
+
/** A PNG of map cells x..x+w, y..y+h of a disk scene (wrapping like playgame), scaled `s`
|
|
81
|
+
* times; `blocks` overrides the scene's block pictures (to show art before a fix). */
|
|
82
|
+
export declare function writeArea(file: string, sc: DiskScene, x: number, y: number, w: number, h: number, s?: number, blocks?: Block[]): void;
|
|
83
|
+
/** Checks a built disk: every map's multi-block objects (names: each map file's block names by
|
|
84
|
+
* number, undefined to skip the map) by the rules (or each map's own rules), and the art of every pair the maps join. */
|
|
85
|
+
export declare function auditDisk(disk: string, names: (map: string) => string[] | undefined, rules: PartRule[] | ((map: string) => PartRule[]), opts?: {
|
|
86
|
+
factor?: number;
|
|
87
|
+
floor?: number;
|
|
88
|
+
}): {
|
|
89
|
+
maps: [string, string[]][];
|
|
90
|
+
seams: Seam[];
|
|
91
|
+
broken: Seam[];
|
|
92
|
+
};
|
|
93
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type AudioEvent = {
|
|
2
|
+
t: number;
|
|
3
|
+
kind: 'song';
|
|
4
|
+
bytes?: Uint8Array;
|
|
5
|
+
} | {
|
|
6
|
+
t: number;
|
|
7
|
+
kind: 'stopSong';
|
|
8
|
+
} | {
|
|
9
|
+
t: number;
|
|
10
|
+
kind: 'pause';
|
|
11
|
+
paused: boolean;
|
|
12
|
+
} | {
|
|
13
|
+
t: number;
|
|
14
|
+
kind: 'speaker';
|
|
15
|
+
freqs: ArrayLike<number>;
|
|
16
|
+
} | {
|
|
17
|
+
t: number;
|
|
18
|
+
kind: 'stopSpeaker';
|
|
19
|
+
} | {
|
|
20
|
+
t: number;
|
|
21
|
+
kind: 'voc';
|
|
22
|
+
bytes?: Uint8Array;
|
|
23
|
+
} | {
|
|
24
|
+
t: number;
|
|
25
|
+
kind: 'stopVoc';
|
|
26
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Pixels } from './pixels.js';
|
|
2
|
+
export declare const CLEAR = 255;
|
|
3
|
+
/** Copies src over dst, skipping clear pixels. */
|
|
4
|
+
export declare function over(dst: Pixels, src: Pixels, x?: number, y?: number): Pixels;
|
|
5
|
+
/** Recolors every pixel through a lookup (palette swaps for variants and hurt flashes). */
|
|
6
|
+
export declare function recolor(src: Pixels, fn: (c: number) => number): Pixels;
|
|
7
|
+
/** Nearest-neighbor scaled copy (for big sprites on screens). */
|
|
8
|
+
export declare function scaleBlit(dst: Pixels, src: Pixels, x: number, y: number, s: number, flip?: boolean, transparent?: number): void;
|
|
9
|
+
/** Adds a 1 pixel outline in `ink` around every opaque pixel. */
|
|
10
|
+
export declare function outline(src: Pixels, ink: number, options?: {
|
|
11
|
+
transparent?: number;
|
|
12
|
+
ignoreInk?: boolean;
|
|
13
|
+
}): Pixels;
|
|
14
|
+
export declare function asciiSprite(rows: string[], key: Record<string, number>, dx?: number, dy?: number, w?: number, h?: number): Pixels;
|
|
15
|
+
/** Draw ASCII art through the indexed canvas. */
|
|
16
|
+
export declare const asciiArt: (p: Pixels, x: number, y: number, rows: string[], key: Record<string, number>) => Pixels;
|
|
17
|
+
/** Scale with an explicit transparent color and no mirroring. */
|
|
18
|
+
export declare const scaleBlitTransparent: (dst: Pixels, src: Pixels, x: number, y: number, scale: number, transparent?: number) => void;
|
|
19
|
+
/** In-place variant for existing sprite canvases. */
|
|
20
|
+
export declare function outlineInPlace(p: Pixels, ink: number, transparent?: number): Pixels;
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { type Block } from '@lewismoten/gamemaker-sandbox-engine/formats/blocks';
|
|
2
|
+
export type RoleGroup = 'Ground' | 'Doors' | 'Loot' | 'Furniture' | 'Spawn';
|
|
3
|
+
export interface RoleInfo {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
group: RoleGroup;
|
|
7
|
+
hint: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const ROLES: readonly [{
|
|
10
|
+
readonly id: "floor";
|
|
11
|
+
readonly label: "Floor";
|
|
12
|
+
readonly group: "Ground";
|
|
13
|
+
readonly hint: "Something to walk on";
|
|
14
|
+
}, {
|
|
15
|
+
readonly id: "wall";
|
|
16
|
+
readonly label: "Wall";
|
|
17
|
+
readonly group: "Ground";
|
|
18
|
+
readonly hint: "Solid on every side";
|
|
19
|
+
}, {
|
|
20
|
+
readonly id: "wall-top";
|
|
21
|
+
readonly label: "Wall top";
|
|
22
|
+
readonly group: "Ground";
|
|
23
|
+
readonly hint: "The top edge of a wall";
|
|
24
|
+
}, {
|
|
25
|
+
readonly id: "wall-edge";
|
|
26
|
+
readonly label: "Wall edge or corner";
|
|
27
|
+
readonly group: "Ground";
|
|
28
|
+
readonly hint: "An edge or corner piece of a wall set";
|
|
29
|
+
}, {
|
|
30
|
+
readonly id: "path";
|
|
31
|
+
readonly label: "Path or road";
|
|
32
|
+
readonly group: "Ground";
|
|
33
|
+
readonly hint: "A path, road or trail";
|
|
34
|
+
}, {
|
|
35
|
+
readonly id: "water";
|
|
36
|
+
readonly label: "Water";
|
|
37
|
+
readonly group: "Ground";
|
|
38
|
+
readonly hint: "Water to cross or swim";
|
|
39
|
+
}, {
|
|
40
|
+
readonly id: "shore";
|
|
41
|
+
readonly label: "Shore";
|
|
42
|
+
readonly group: "Ground";
|
|
43
|
+
readonly hint: "Where land meets water";
|
|
44
|
+
}, {
|
|
45
|
+
readonly id: "tree";
|
|
46
|
+
readonly label: "Tree";
|
|
47
|
+
readonly group: "Ground";
|
|
48
|
+
readonly hint: "A tree";
|
|
49
|
+
}, {
|
|
50
|
+
readonly id: "rock";
|
|
51
|
+
readonly label: "Rock";
|
|
52
|
+
readonly group: "Ground";
|
|
53
|
+
readonly hint: "A rock or boulder";
|
|
54
|
+
}, {
|
|
55
|
+
readonly id: "sky";
|
|
56
|
+
readonly label: "Sky";
|
|
57
|
+
readonly group: "Ground";
|
|
58
|
+
readonly hint: "Open air behind a platform level";
|
|
59
|
+
}, {
|
|
60
|
+
readonly id: "decoration";
|
|
61
|
+
readonly label: "Decoration";
|
|
62
|
+
readonly group: "Ground";
|
|
63
|
+
readonly hint: "Looks nice, does nothing";
|
|
64
|
+
}, {
|
|
65
|
+
readonly id: "hazard";
|
|
66
|
+
readonly label: "Hazard";
|
|
67
|
+
readonly group: "Ground";
|
|
68
|
+
readonly hint: "Hurts the hero";
|
|
69
|
+
}, {
|
|
70
|
+
readonly id: "platform";
|
|
71
|
+
readonly label: "Platform";
|
|
72
|
+
readonly group: "Doors";
|
|
73
|
+
readonly hint: "Solid on top only: stand on it from above";
|
|
74
|
+
}, {
|
|
75
|
+
readonly id: "ladder";
|
|
76
|
+
readonly label: "Ladder";
|
|
77
|
+
readonly group: "Doors";
|
|
78
|
+
readonly hint: "Pulls the hero up or down";
|
|
79
|
+
}, {
|
|
80
|
+
readonly id: "door";
|
|
81
|
+
readonly label: "Door";
|
|
82
|
+
readonly group: "Doors";
|
|
83
|
+
readonly hint: "Open; turns into another block when touched";
|
|
84
|
+
}, {
|
|
85
|
+
readonly id: "locked-door";
|
|
86
|
+
readonly label: "Locked door";
|
|
87
|
+
readonly group: "Doors";
|
|
88
|
+
readonly hint: "Needs a key (same lock number)";
|
|
89
|
+
}, {
|
|
90
|
+
readonly id: "exit";
|
|
91
|
+
readonly label: "Exit";
|
|
92
|
+
readonly group: "Doors";
|
|
93
|
+
readonly hint: "Leads out of the level";
|
|
94
|
+
}, {
|
|
95
|
+
readonly id: "entry";
|
|
96
|
+
readonly label: "Entry";
|
|
97
|
+
readonly group: "Doors";
|
|
98
|
+
readonly hint: "Where the hero comes in";
|
|
99
|
+
}, {
|
|
100
|
+
readonly id: "stairs-up";
|
|
101
|
+
readonly label: "Stairs up";
|
|
102
|
+
readonly group: "Doors";
|
|
103
|
+
readonly hint: "Stairs going up";
|
|
104
|
+
}, {
|
|
105
|
+
readonly id: "stairs-down";
|
|
106
|
+
readonly label: "Stairs down";
|
|
107
|
+
readonly group: "Doors";
|
|
108
|
+
readonly hint: "Stairs going down";
|
|
109
|
+
}, {
|
|
110
|
+
readonly id: "chest";
|
|
111
|
+
readonly label: "Chest";
|
|
112
|
+
readonly group: "Loot";
|
|
113
|
+
readonly hint: "A chest that holds something";
|
|
114
|
+
}, {
|
|
115
|
+
readonly id: "treasure";
|
|
116
|
+
readonly label: "Treasure";
|
|
117
|
+
readonly group: "Loot";
|
|
118
|
+
readonly hint: "Money or score when picked up";
|
|
119
|
+
}, {
|
|
120
|
+
readonly id: "key";
|
|
121
|
+
readonly label: "Key";
|
|
122
|
+
readonly group: "Loot";
|
|
123
|
+
readonly hint: "Opens a locked door with the same lock number";
|
|
124
|
+
}, {
|
|
125
|
+
readonly id: "life";
|
|
126
|
+
readonly label: "Heart or life";
|
|
127
|
+
readonly group: "Loot";
|
|
128
|
+
readonly hint: "Adds a life";
|
|
129
|
+
}, {
|
|
130
|
+
readonly id: "powerup";
|
|
131
|
+
readonly label: "Power-up";
|
|
132
|
+
readonly group: "Loot";
|
|
133
|
+
readonly hint: "Picked up to help the hero";
|
|
134
|
+
}, {
|
|
135
|
+
readonly id: "chair";
|
|
136
|
+
readonly label: "Chair";
|
|
137
|
+
readonly group: "Furniture";
|
|
138
|
+
readonly hint: "Faces one way";
|
|
139
|
+
}, {
|
|
140
|
+
readonly id: "table";
|
|
141
|
+
readonly label: "Table";
|
|
142
|
+
readonly group: "Furniture";
|
|
143
|
+
readonly hint: "A table or desk";
|
|
144
|
+
}, {
|
|
145
|
+
readonly id: "bed";
|
|
146
|
+
readonly label: "Bed";
|
|
147
|
+
readonly group: "Furniture";
|
|
148
|
+
readonly hint: "A bed";
|
|
149
|
+
}, {
|
|
150
|
+
readonly id: "counter";
|
|
151
|
+
readonly label: "Counter";
|
|
152
|
+
readonly group: "Furniture";
|
|
153
|
+
readonly hint: "A shop counter or bar";
|
|
154
|
+
}, {
|
|
155
|
+
readonly id: "shelf";
|
|
156
|
+
readonly label: "Shelf";
|
|
157
|
+
readonly group: "Furniture";
|
|
158
|
+
readonly hint: "A shelf or bookcase";
|
|
159
|
+
}, {
|
|
160
|
+
readonly id: "rug";
|
|
161
|
+
readonly label: "Rug";
|
|
162
|
+
readonly group: "Furniture";
|
|
163
|
+
readonly hint: "A rug on the floor";
|
|
164
|
+
}, {
|
|
165
|
+
readonly id: "lamp";
|
|
166
|
+
readonly label: "Lamp";
|
|
167
|
+
readonly group: "Furniture";
|
|
168
|
+
readonly hint: "A lamp or torch";
|
|
169
|
+
}, {
|
|
170
|
+
readonly id: "stove";
|
|
171
|
+
readonly label: "Stove";
|
|
172
|
+
readonly group: "Furniture";
|
|
173
|
+
readonly hint: "A stove or fireplace";
|
|
174
|
+
}, {
|
|
175
|
+
readonly id: "plant";
|
|
176
|
+
readonly label: "Plant";
|
|
177
|
+
readonly group: "Furniture";
|
|
178
|
+
readonly hint: "A pot plant or flower";
|
|
179
|
+
}, {
|
|
180
|
+
readonly id: "monster-spawn";
|
|
181
|
+
readonly label: "Monster spawn";
|
|
182
|
+
readonly group: "Spawn";
|
|
183
|
+
readonly hint: "Gives birth to monsters";
|
|
184
|
+
}, {
|
|
185
|
+
readonly id: "hero-start";
|
|
186
|
+
readonly label: "Hero start";
|
|
187
|
+
readonly group: "Spawn";
|
|
188
|
+
readonly hint: "Where the hero begins";
|
|
189
|
+
}];
|
|
190
|
+
export type Role = (typeof ROLES)[number]['id'];
|
|
191
|
+
export declare const ROLE_IDS: readonly Role[];
|
|
192
|
+
export declare const ROLE_GROUPS: readonly RoleGroup[];
|
|
193
|
+
export declare const FACINGS: readonly ["N", "E", "S", "W"];
|
|
194
|
+
export type Facing = (typeof FACINGS)[number];
|
|
195
|
+
export declare const FACING_NAMES: Record<Facing, string>;
|
|
196
|
+
export declare const MAX_PAIR = 10;
|
|
197
|
+
export declare const hasFacing: (roles: readonly Role[]) => boolean;
|
|
198
|
+
export declare const hasPair: (roles: readonly Role[]) => boolean;
|
|
199
|
+
/** What is kept for one block. */
|
|
200
|
+
export interface BlockRole {
|
|
201
|
+
roles: Role[];
|
|
202
|
+
/** Which way a furniture block faces. */
|
|
203
|
+
facing?: Facing;
|
|
204
|
+
/** The lock number (1..MAX_PAIR) a locked door and its key share. */
|
|
205
|
+
pair?: number;
|
|
206
|
+
}
|
|
207
|
+
/** Roles by block number; blocks with no roles are left out. */
|
|
208
|
+
export type RoleMap = Record<number, BlockRole>;
|
|
209
|
+
/** Stored roles made safe to use: unknown roles and numbers out of range dropped, no repeats, extras only where they apply. */
|
|
210
|
+
export declare function cleanRoles(raw: unknown, count: number): RoleMap;
|
|
211
|
+
/** The map to store: only blocks that have roles, in block order (undefined when there are none). */
|
|
212
|
+
export declare function packRoles(map: RoleMap): Record<string, BlockRole> | undefined;
|
|
213
|
+
/** The blocks that hold a role (with a lock number, only those with that pair). */
|
|
214
|
+
export declare function blocksWithRole(map: RoleMap, role: Role, pair?: number): number[];
|
|
215
|
+
export interface RoleSuggestion {
|
|
216
|
+
role: Role;
|
|
217
|
+
/** Why, in a few words, for the chip's tooltip. */
|
|
218
|
+
why: string;
|
|
219
|
+
/** The lock number a door or key suggestion implies. */
|
|
220
|
+
pair?: number;
|
|
221
|
+
}
|
|
222
|
+
export interface SuggestContext {
|
|
223
|
+
/** The set's palette (768 bytes, 6-bit), to read the picture's colors. Without it the picture is not looked at. */
|
|
224
|
+
palette?: Uint8Array;
|
|
225
|
+
/** Whether the block is already in one of the set's terrains (edge sets), which suggests an edge piece. */
|
|
226
|
+
inTerrain?: boolean;
|
|
227
|
+
}
|
|
228
|
+
/** The share of the picture that is blue, and its average brightness (0..1), or undefined with no palette. */
|
|
229
|
+
export declare function pictureBlue(pixels: Uint8Array, palette: Uint8Array): {
|
|
230
|
+
blue: number;
|
|
231
|
+
light: number;
|
|
232
|
+
} | undefined;
|
|
233
|
+
/**
|
|
234
|
+
* Roles a background block seems to have. Pure and never applied by itself: the block editor shows
|
|
235
|
+
* these as dim chips. Rules (the design note's table): solid all round is a wall; solid on top only a
|
|
236
|
+
* platform; touching turns it into another block, a door; a negative counter 20..29 a lock; a
|
|
237
|
+
* pick-up that adds money or score is treasure, that adds to a counter 20..29 a key, that adds a life
|
|
238
|
+
* a life; hurting on touch a hazard; an upward pull a ladder; births monsters a spawn; a mostly
|
|
239
|
+
* blue picture water or sky.
|
|
240
|
+
*/
|
|
241
|
+
export declare function suggestRoles(b: Block, index: number, ctx?: SuggestContext): RoleSuggestion[];
|
|
242
|
+
/** Suggestions not yet chosen (what the editor shows as dim chips). */
|
|
243
|
+
export declare function pendingSuggestions(have: readonly Role[], s: RoleSuggestion[]): RoleSuggestion[];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type RGB = [number, number, number];
|
|
2
|
+
export declare const mixc: (a: RGB, b: RGB, t: number) => RGB;
|
|
3
|
+
export declare const clamp: (v: number) => number;
|
|
4
|
+
export declare const smooth: (e0: number, e1: number, x: number) => number;
|
|
5
|
+
/** Value noise (smooth, seeded) for textures. */
|
|
6
|
+
export declare function noise2(seed: number): (x: number, y: number) => number;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class Disk {
|
|
2
|
+
readonly dir: string;
|
|
3
|
+
readonly files: Map<string, Uint8Array<ArrayBufferLike>>;
|
|
4
|
+
constructor(dir: string);
|
|
5
|
+
/** Adds a file (8.3 name, lower case on disk). */
|
|
6
|
+
put(name: string, bytes: Uint8Array | string): void;
|
|
7
|
+
/**
|
|
8
|
+
* Replace the selected output directory's contents with the collected native files. Each file
|
|
9
|
+
* is written beside its place and renamed over it, and leftovers go last, so a server reading
|
|
10
|
+
* the folder during a rebuild never finds a file missing or half written.
|
|
11
|
+
*/
|
|
12
|
+
write(dir?: string): number;
|
|
13
|
+
}
|
|
14
|
+
/** Legacy eight-bit text with CR LF line endings; out-of-range characters become question marks. */
|
|
15
|
+
export declare function dosText(s: string): Uint8Array;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { encodeFli } from '@lewismoten/gamemaker-sandbox-engine/formats/fli';
|
|
2
|
+
/** Frames in a fade at `speed` (1/70 s per frame): about `seconds` long, and at least 4. */
|
|
3
|
+
export declare function fadeOutLength(speed: number, seconds?: number): number;
|
|
4
|
+
type FliOpts = NonNullable<Parameters<typeof encodeFli>[2]>;
|
|
5
|
+
/**
|
|
6
|
+
* encodeFli with a fade to black after the last frame: `fade` palette-only frames (by default
|
|
7
|
+
* about half a second at the FLI's speed). `palettes`, when given, is a palette per frame.
|
|
8
|
+
*/
|
|
9
|
+
export declare function encodeFliFadeOut(frames: Uint8Array[], palette: Uint8Array, opts?: FliOpts & {
|
|
10
|
+
fade?: number;
|
|
11
|
+
}): Uint8Array;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ShrinkStep } from './fliShrink.js';
|
|
2
|
+
import { type SlideEntry } from '@lewismoten/gamemaker-sandbox-engine/formats/graphicScripts';
|
|
3
|
+
/** How long an FLI plays, in seconds (FLI::View waits `speed` 1/70 s after each frame). */
|
|
4
|
+
export declare function fliSeconds(fli: Uint8Array): number;
|
|
5
|
+
/** How cartoons are cut and written (both off by default, so other games' bytes stay the same). */
|
|
6
|
+
export interface ClipOptions {
|
|
7
|
+
/** Each clip without encodeFli's closing ring frame, which nothing plays. */
|
|
8
|
+
noLoopFrame?: boolean;
|
|
9
|
+
/** Cut where opening on a whole frame costs the fewest extra bytes, not where least changes. */
|
|
10
|
+
cheapCuts?: boolean;
|
|
11
|
+
/** Shrink steps (fliShrink.ts) run on every FLI's frames before it is cut and written. */
|
|
12
|
+
shrink?: ShrinkStep[];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The FLI as clips of at most `seconds` each, by file name in play order. One that plays no
|
|
16
|
+
* longer than a quarter more than `seconds` stays whole, under its own name.
|
|
17
|
+
*/
|
|
18
|
+
export declare function fliClips(name: string, source: Uint8Array, seconds?: number, opts?: ClipOptions): Record<string, Uint8Array>;
|
|
19
|
+
/** The clips' slide-list entries: no pause between them, `pause` after the last. */
|
|
20
|
+
export declare function clipEntries(clips: Record<string, Uint8Array>, pause?: number): SlideEntry[];
|
|
21
|
+
/**
|
|
22
|
+
* On a whole disk (lower-case file name to bytes, as Disk keeps them): every long FLI the
|
|
23
|
+
* lists named in `lists` play is cut into clips, and every slide list on the disk that plays it
|
|
24
|
+
* plays the clips instead, the entry's pause after the last. For a build whose lists are
|
|
25
|
+
* written in several places.
|
|
26
|
+
*/
|
|
27
|
+
export declare function clipLists(files: Map<string, Uint8Array>, lists: string[], seconds?: number, opts?: ClipOptions): void;
|
|
28
|
+
/**
|
|
29
|
+
* `clipLists` on every slide list on the disk: the title's, story's and help's, and the
|
|
30
|
+
* game's own (endings, game over, cut scenes), so Esc answers within a few seconds anywhere.
|
|
31
|
+
*/
|
|
32
|
+
export declare function clipEveryList(files: Map<string, Uint8Array>, seconds?: number, opts?: ClipOptions): void;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/** An FLI's frames as the player shows them: pixels and the (6-bit) palette per frame. */
|
|
2
|
+
export interface FliFrames {
|
|
3
|
+
frames: Uint8Array[];
|
|
4
|
+
palettes: Uint8Array[];
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
/** The wait after each frame, in 1/70 s. */
|
|
8
|
+
speed: number;
|
|
9
|
+
}
|
|
10
|
+
/** How the encoder writes the frames (set by steps, passed to encodeFrames). */
|
|
11
|
+
export interface FliEncodeOptions {
|
|
12
|
+
sparsePalettes?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** How much a step changes what shows, frame for frame against the frames the step was given (0 to 255 per color channel). */
|
|
15
|
+
export interface Visibility {
|
|
16
|
+
/** The mean over every pixel of every frame (0 = identical). */
|
|
17
|
+
mean: number;
|
|
18
|
+
/** The biggest single difference. */
|
|
19
|
+
worst: number;
|
|
20
|
+
/** How many pixels differ at all, as a share of all of them (0 to 1). */
|
|
21
|
+
changedShare: number;
|
|
22
|
+
}
|
|
23
|
+
export interface StepResult {
|
|
24
|
+
name: string;
|
|
25
|
+
/** True when what shows is exactly the same. */
|
|
26
|
+
lossless: boolean;
|
|
27
|
+
frames: FliFrames;
|
|
28
|
+
encode: FliEncodeOptions;
|
|
29
|
+
bytesBefore: number;
|
|
30
|
+
bytesAfter: number;
|
|
31
|
+
savedBytes: number;
|
|
32
|
+
visibility: Visibility;
|
|
33
|
+
}
|
|
34
|
+
/** Every frame's pixels and palette, as FLI::View leaves the screen after it (the ring frame is not one). */
|
|
35
|
+
export declare function decodeFli(fli: Uint8Array): FliFrames;
|
|
36
|
+
/** The frames as an FLI (no ring frame, run packets on). */
|
|
37
|
+
export declare function encodeFrames(f: FliFrames, opts?: FliEncodeOptions): Uint8Array;
|
|
38
|
+
export interface FrameReport {
|
|
39
|
+
frame: number;
|
|
40
|
+
bytes: number;
|
|
41
|
+
/** Bytes by chunk type name (the frame header's 16 bytes under 'header'). */
|
|
42
|
+
chunks: Record<string, number>;
|
|
43
|
+
/** Pixels that differ from the frame before. */
|
|
44
|
+
changedPixels: number;
|
|
45
|
+
}
|
|
46
|
+
export interface FliReport {
|
|
47
|
+
totalBytes: number;
|
|
48
|
+
frames: FrameReport[];
|
|
49
|
+
/** Bytes by chunk type name over every frame. */
|
|
50
|
+
byChunk: Record<string, number>;
|
|
51
|
+
/** Plain-words reasons the file is big, biggest first; suggestions, not verdicts. */
|
|
52
|
+
findings: string[];
|
|
53
|
+
}
|
|
54
|
+
/** Bytes per chunk type for every frame, and why the file is the size it is. */
|
|
55
|
+
export declare function fliReport(fli: Uint8Array): FliReport;
|
|
56
|
+
/** What shows, original against `result` (frame i of the original is `map(i)` of the result). */
|
|
57
|
+
export declare function visibilityOf(orig: FliFrames, result: FliFrames, map?: (i: number) => number): Visibility;
|
|
58
|
+
/**
|
|
59
|
+
* Lossy: a pixel alone between two pixels (left and right, or above and below) of one other
|
|
60
|
+
* color within `tolerance` takes that color, so dithering and speckle between close shades
|
|
61
|
+
* flatten into runs. Gradients show as bands; edges and sprites keep their shape.
|
|
62
|
+
*/
|
|
63
|
+
export declare function flattenDitherStep(orig: FliFrames, opts: {
|
|
64
|
+
tolerance: number;
|
|
65
|
+
}, base?: FliEncodeOptions): StepResult;
|
|
66
|
+
/** Lossless: palette changes only for the colors a frame draws. */
|
|
67
|
+
export declare function sparsePalettesStep(orig: FliFrames, base?: FliEncodeOptions): StepResult;
|
|
68
|
+
/**
|
|
69
|
+
* Lossy: a pixel whose color is within `tolerance` (0 to 255 per channel) of what it was the
|
|
70
|
+
* frame before keeps the old index, so dither or noise that shifts a little stops costing
|
|
71
|
+
* bytes. Frames whose palette changes (fades) are left alone.
|
|
72
|
+
*/
|
|
73
|
+
export declare function holdStillStep(orig: FliFrames, opts: {
|
|
74
|
+
tolerance: number;
|
|
75
|
+
}, base?: FliEncodeOptions): StepResult;
|
|
76
|
+
/**
|
|
77
|
+
* Lossy: colors within `tolerance` of a more used color in the first frame's palette are
|
|
78
|
+
* merged into it in every frame, so near-identical shades stop making changes.
|
|
79
|
+
*/
|
|
80
|
+
export declare function snapColorsStep(orig: FliFrames, opts: {
|
|
81
|
+
tolerance: number;
|
|
82
|
+
}, base?: FliEncodeOptions): StepResult;
|
|
83
|
+
/** Lossy: at most `colors` different colors drawn in the whole animation; the least used are replaced by their nearest kept one. */
|
|
84
|
+
export declare function maxColorsStep(orig: FliFrames, opts: {
|
|
85
|
+
colors: number;
|
|
86
|
+
}, base?: FliEncodeOptions): StepResult;
|
|
87
|
+
/**
|
|
88
|
+
* Lossy: every other frame is dropped and the wait doubles, so the cartoon lasts as long.
|
|
89
|
+
* The result is steppier. Fades keep their last frames; a wait over 255 is not offered.
|
|
90
|
+
*/
|
|
91
|
+
export declare function dropFramesStep(orig: FliFrames, base?: FliEncodeOptions): StepResult;
|
|
92
|
+
export type ShrinkStep = {
|
|
93
|
+
step: 'sparsePalettes';
|
|
94
|
+
} | {
|
|
95
|
+
step: 'holdStill';
|
|
96
|
+
tolerance: number;
|
|
97
|
+
} | {
|
|
98
|
+
step: 'snapColors';
|
|
99
|
+
tolerance: number;
|
|
100
|
+
} | {
|
|
101
|
+
step: 'flattenDither';
|
|
102
|
+
tolerance: number;
|
|
103
|
+
} | {
|
|
104
|
+
step: 'maxColors';
|
|
105
|
+
colors: number;
|
|
106
|
+
} | {
|
|
107
|
+
step: 'onePalette';
|
|
108
|
+
colors: number;
|
|
109
|
+
} | ({
|
|
110
|
+
step: 'frame';
|
|
111
|
+
} & FrameOptions) | {
|
|
112
|
+
step: 'dropFrames';
|
|
113
|
+
};
|
|
114
|
+
/** Runs the steps in order, each on the one before's frames; the last result's `frames` and `encode` make the file. */
|
|
115
|
+
export declare function shrinkFrames(orig: FliFrames, steps: ShrinkStep[]): StepResult[];
|
|
116
|
+
/** What shows over a whole chain of steps: the end result against the original, exactly (a dropped frame's picture stands for the two it replaces). */
|
|
117
|
+
export declare function chainVisibility(orig: FliFrames, last: FliFrames): Visibility;
|
|
118
|
+
/**
|
|
119
|
+
* Lossy (lossless when the animation already draws no more than `colors` shades): one palette
|
|
120
|
+
* for the whole animation, the `colors` (up to 256) that best stand for every shade it shows, and
|
|
121
|
+
* every frame redrawn in it. No COLOR chunk follows the first frame, so a fade becomes pixel
|
|
122
|
+
* changes, which often cost more than the palette changes did. The numbers say which way it went.
|
|
123
|
+
*/
|
|
124
|
+
export declare function onePaletteStep(orig: FliFrames, opts: {
|
|
125
|
+
colors: number;
|
|
126
|
+
}, base?: FliEncodeOptions): StepResult;
|
|
127
|
+
/** How `frameStep` frames the picture; every number is in pixels except `zoom`. */
|
|
128
|
+
export interface FrameOptions {
|
|
129
|
+
/** Solid bands left at each edge. */
|
|
130
|
+
top: number;
|
|
131
|
+
bottom: number;
|
|
132
|
+
left: number;
|
|
133
|
+
right: number;
|
|
134
|
+
/** The picture's scale inside the bands: 1 = its own pixels, under 1 shrinks it, over 1 magnifies it. */
|
|
135
|
+
zoom: number;
|
|
136
|
+
/** Where the picture's center sits in the original's pixels, from the middle (0 = centered). */
|
|
137
|
+
panX: number;
|
|
138
|
+
panY: number;
|
|
139
|
+
}
|
|
140
|
+
/** The palette entry bands are drawn in: color 0 when the first palette makes it black, else its darkest color. */
|
|
141
|
+
export declare function bandColor(pal: Uint8Array): number;
|
|
142
|
+
/**
|
|
143
|
+
* Lossy (lossless when nothing is set): the picture stays the same size, but only the area inside
|
|
144
|
+
* the bands shows it. The bands are one solid color (`bandColor`) and never change after the first
|
|
145
|
+
* frame, so they cost next to nothing. At zoom 1 the bands just cover the picture's edges. Otherwise the picture is scaled by `zoom` about its center, moved by
|
|
146
|
+
* the pan, into the middle of that area: smaller by averaging the pixels it covers into the nearest
|
|
147
|
+
* color of the frame's own palette, larger by repeating pixels (no new colors, edges stay crisp).
|
|
148
|
+
*/
|
|
149
|
+
export declare function frameStep(orig: FliFrames, o: FrameOptions, base?: FliEncodeOptions): StepResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { type CharInfo, type World } from '
|
|
2
|
-
import { type Game } from '
|
|
3
|
-
import type { RecordedKey } from '
|
|
1
|
+
import { type CharInfo, type World } from '@lewismoten/gamemaker-sandbox-engine/engine/world';
|
|
2
|
+
import { type Game } from '@lewismoten/gamemaker-sandbox-engine/formats/game';
|
|
3
|
+
import type { RecordedKey } from '@lewismoten/gamemaker-sandbox-engine/formats/recording';
|
|
4
4
|
/** PLAYGAME's game clock. */
|
|
5
5
|
export declare const TICKS_PER_SECOND = 18.2;
|
|
6
6
|
/** A built disk's files (in games/<id>/disk), by lower-case name. */
|
|
@@ -10,7 +10,7 @@ interface SceneKeys {
|
|
|
10
10
|
scene: number;
|
|
11
11
|
keys: RecordedKey[];
|
|
12
12
|
}
|
|
13
|
-
interface State {
|
|
13
|
+
export interface State {
|
|
14
14
|
w: World;
|
|
15
15
|
rand: number;
|
|
16
16
|
scene: number;
|
|
@@ -55,6 +55,8 @@ export declare class GameSim {
|
|
|
55
55
|
private rand;
|
|
56
56
|
ended: 'won' | 'lost' | undefined;
|
|
57
57
|
deaths: number;
|
|
58
|
+
/** The inventory slot the drop picker answers with once (set it before pressing the drop key; -1, the default, is Esc). */
|
|
59
|
+
dropSlot: number;
|
|
58
60
|
/**
|
|
59
61
|
* The .VOC clip the Sound Blaster is playing (PlaySbVocFile: a new one cuts it off), with
|
|
60
62
|
* the game clock tick it ends on; a scene's exit or intro picture cuts it too (ShowGraphic).
|
|
@@ -72,6 +74,8 @@ export declare class GameSim {
|
|
|
72
74
|
releaseAll(): void;
|
|
73
75
|
isHeld(scan: number): boolean;
|
|
74
76
|
private event;
|
|
77
|
+
/** Writes key `k` into the segment (without playing it in this sim): the drop picker's own keys, which the real engine reads. */
|
|
78
|
+
private record;
|
|
75
79
|
/** One game tick; returns 'link' (into another scene), 'dead' or 'end'. */
|
|
76
80
|
tick(): Promise<'link' | 'dead' | 'end' | undefined>;
|
|
77
81
|
/** Game ticks until the clip playing now ends (0 when none is). */
|
|
@@ -95,7 +99,7 @@ export declare class GameSim {
|
|
|
95
99
|
/** The block number at (x, y) as it is now (a block taken or pushed is a new block number). */
|
|
96
100
|
blockAt(x: number, y: number): number;
|
|
97
101
|
/** The block's attributes as shown now (timed blocks change by themselves). */
|
|
98
|
-
shown(x: number, y: number): import("
|
|
102
|
+
shown(x: number, y: number): import("@lewismoten/gamemaker-sandbox-engine/formats/blocks").Block;
|
|
99
103
|
solidAt(x: number, y: number): boolean;
|
|
100
104
|
snapshot(): State;
|
|
101
105
|
restore(s: State): void;
|