@lewismoten/gamemaker-sandbox-tools 3.1.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (343) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/NOTICE.md +105 -3
  3. package/README.md +301 -15
  4. package/dist/audio-files.js +82 -0
  5. package/dist/audio.js +23 -138
  6. package/dist/block-merge.js +43 -0
  7. package/dist/color-reduce.js +44 -0
  8. package/dist/colors.js +87 -0
  9. package/dist/delta.js +75 -0
  10. package/dist/disk-diff.js +220 -0
  11. package/dist/drawing.js +83 -869
  12. package/dist/embroidery/compile.js +85 -0
  13. package/dist/embroidery/dst.js +79 -0
  14. package/dist/embroidery/exp.js +26 -0
  15. package/dist/embroidery/fill.js +49 -0
  16. package/dist/embroidery/geom.js +82 -0
  17. package/dist/embroidery/pes.js +79 -0
  18. package/dist/embroidery/satin.js +29 -0
  19. package/dist/embroidery/simulate.js +30 -0
  20. package/dist/embroidery/strokeFont.js +253 -0
  21. package/dist/embroidery/svg.js +24 -0
  22. package/dist/embroidery/types.js +13 -0
  23. package/dist/embroidery/units.js +26 -0
  24. package/dist/embroidery/validate.js +15 -0
  25. package/dist/formats/blocks.js +1 -103
  26. package/dist/formats/character.js +1 -83
  27. package/dist/formats/cmf.js +1 -37
  28. package/dist/formats/fli.js +1 -296
  29. package/dist/formats/fliLimits.js +1 -54
  30. package/dist/formats/game.js +1 -193
  31. package/dist/formats/gif.js +1 -125
  32. package/dist/formats/graphicScripts.js +1 -44
  33. package/dist/formats/map.js +1 -38
  34. package/dist/formats/monster.js +1 -69
  35. package/dist/formats/palette.js +1 -58
  36. package/dist/formats/recording.js +1 -17
  37. package/dist/formats/sound.js +1 -44
  38. package/dist/formats/voc.js +1 -303
  39. package/dist/gif-shrink.js +56 -0
  40. package/dist/image/png.js +42 -0
  41. package/dist/images.js +81 -43
  42. package/dist/kit/actors.js +19 -0
  43. package/dist/kit/align.js +204 -0
  44. package/dist/kit/blit.js +45 -0
  45. package/dist/kit/blockRoles.js +97 -0
  46. package/dist/kit/clips.js +40 -0
  47. package/dist/kit/coverPaint.js +18 -0
  48. package/dist/kit/disk.js +76 -0
  49. package/dist/kit/fadeOut.js +13 -0
  50. package/dist/kit/fliClips.js +133 -0
  51. package/dist/kit/fliShrink.js +277 -0
  52. package/dist/kit/gameSim.js +235 -0
  53. package/dist/kit/hopBot.js +142 -0
  54. package/dist/kit/levelGen.js +1423 -0
  55. package/dist/kit/levelGrid.js +33 -0
  56. package/dist/kit/levelPicture.js +27 -0
  57. package/dist/kit/menuVersion.js +19 -0
  58. package/dist/kit/microText.js +35 -0
  59. package/dist/kit/mumble.js +74 -0
  60. package/dist/kit/music.js +8 -0
  61. package/dist/kit/palRamps.js +32 -0
  62. package/dist/kit/palette.js +49 -0
  63. package/dist/kit/pcText.js +72 -0
  64. package/dist/kit/photo.js +150 -0
  65. package/dist/kit/pixels.js +79 -0
  66. package/dist/kit/png.js +40 -0
  67. package/dist/kit/quantize.js +72 -0
  68. package/dist/kit/raytrace.js +379 -0
  69. package/dist/kit/recordedDemo.js +10 -0
  70. package/dist/kit/reel.js +77 -0
  71. package/dist/kit/road3d.js +67 -0
  72. package/dist/kit/routeChecks.js +8 -0
  73. package/dist/kit/saveSlots.js +11 -0
  74. package/dist/kit/sceneInit.js +13 -0
  75. package/dist/kit/sceneSim.js +112 -0
  76. package/dist/kit/screenText.js +15 -0
  77. package/dist/kit/sdftext.js +237 -0
  78. package/dist/kit/shading.js +69 -0
  79. package/dist/kit/song.js +251 -0
  80. package/dist/kit/songFx.js +179 -0
  81. package/dist/kit/sound.js +52 -0
  82. package/dist/kit/synthParts.js +20 -0
  83. package/dist/kit/tar.js +53 -0
  84. package/dist/kit/textBounds.js +84 -0
  85. package/dist/kit/textfit.js +246 -0
  86. package/dist/kit/transforms.js +57 -0
  87. package/dist/kit/tune.js +21 -0
  88. package/dist/look-alike.js +50 -0
  89. package/dist/menu-version.js +4 -0
  90. package/dist/mesh/colorBodies.js +137 -0
  91. package/dist/mesh/decimate.js +207 -0
  92. package/dist/mesh/meshCheck.js +51 -0
  93. package/dist/mesh/overhang.js +41 -0
  94. package/dist/mesh/sampledField.js +12 -0
  95. package/dist/mesh/stl.js +36 -0
  96. package/dist/mesh/surfaceNets.js +79 -0
  97. package/dist/mesh/tetraMesh.js +62 -0
  98. package/dist/mesh/threeMf.js +58 -0
  99. package/dist/mesh/zipFile.js +52 -0
  100. package/dist/microFont.js +101 -0
  101. package/dist/music/compose.js +72 -0
  102. package/dist/pack/meshPack.js +198 -0
  103. package/dist/pack/threeMfPack.js +92 -0
  104. package/dist/palette-reserve.js +116 -0
  105. package/dist/palettes.js +138 -0
  106. package/dist/release-notes.js +40 -0
  107. package/dist/simulation.js +16 -2774
  108. package/dist/text.js +74 -0
  109. package/dist/types/audio.d.ts +4 -0
  110. package/dist/types/audioFiles.d.ts +22 -0
  111. package/dist/types/audioWav.d.ts +4 -0
  112. package/dist/types/blockMerge.d.ts +24 -0
  113. package/dist/types/colorReduce.d.ts +23 -0
  114. package/dist/types/{web/packages/tools/src/colors.d.ts → colors.d.ts} +6 -0
  115. package/dist/types/delta.d.ts +32 -0
  116. package/dist/types/diskDiff.d.ts +47 -0
  117. package/dist/types/drawing.d.ts +15 -0
  118. package/dist/types/embroidery/compile.d.ts +3 -0
  119. package/dist/types/embroidery/dst.d.ts +13 -0
  120. package/dist/types/embroidery/exp.d.ts +8 -0
  121. package/dist/types/embroidery/fill.d.ts +6 -0
  122. package/dist/types/embroidery/geom.d.ts +19 -0
  123. package/dist/types/embroidery/pes.d.ts +10 -0
  124. package/dist/types/embroidery/satin.d.ts +11 -0
  125. package/dist/types/embroidery/simulate.d.ts +19 -0
  126. package/dist/types/embroidery/strokeFont.d.ts +20 -0
  127. package/dist/types/embroidery/svg.d.ts +3 -0
  128. package/dist/types/embroidery/types.d.ts +70 -0
  129. package/dist/types/embroidery/units.d.ts +10 -0
  130. package/dist/types/embroidery/validate.d.ts +22 -0
  131. package/dist/types/formats/blocks.d.ts +1 -0
  132. package/dist/types/formats/character.d.ts +1 -0
  133. package/dist/types/formats/cmf.d.ts +1 -0
  134. package/dist/types/formats/fli.d.ts +1 -0
  135. package/dist/types/formats/fliLimits.d.ts +1 -0
  136. package/dist/types/formats/game.d.ts +1 -0
  137. package/dist/types/formats/gif.d.ts +1 -0
  138. package/dist/types/formats/graphicScripts.d.ts +1 -0
  139. package/dist/types/formats/map.d.ts +1 -0
  140. package/dist/types/formats/monster.d.ts +1 -0
  141. package/dist/types/formats/palette.d.ts +1 -0
  142. package/dist/types/formats/recording.d.ts +1 -0
  143. package/dist/types/formats/sound.d.ts +1 -0
  144. package/dist/types/formats/voc.d.ts +1 -0
  145. package/dist/types/gifShrink.d.ts +8 -0
  146. package/dist/types/image/animatedGif.d.ts +9 -0
  147. package/dist/types/image/surface.d.ts +26 -0
  148. package/dist/types/images.d.ts +13 -0
  149. package/dist/types/kit/actors.d.ts +7 -0
  150. package/dist/types/kit/align.d.ts +93 -0
  151. package/dist/types/kit/audioEvents.d.ts +26 -0
  152. package/dist/types/kit/blit.d.ts +20 -0
  153. package/dist/types/kit/blockRoles.d.ts +243 -0
  154. package/dist/types/{games/kit → kit}/clips.d.ts +1 -1
  155. package/dist/types/kit/coverPaint.d.ts +7 -0
  156. package/dist/types/kit/disk.d.ts +15 -0
  157. package/dist/types/kit/fadeOut.d.ts +12 -0
  158. package/dist/types/kit/fliClips.d.ts +32 -0
  159. package/dist/types/kit/fliShrink.d.ts +149 -0
  160. package/dist/types/{games/kit → kit}/gameSim.d.ts +9 -5
  161. package/dist/types/kit/hopBot.d.ts +72 -0
  162. package/dist/types/kit/laserClearance.d.ts +16 -0
  163. package/dist/types/kit/laserJoints.d.ts +39 -0
  164. package/dist/types/kit/laserLayout.d.ts +54 -0
  165. package/dist/types/kit/laserPixels.d.ts +52 -0
  166. package/dist/types/kit/laserPreview.d.ts +9 -0
  167. package/dist/types/kit/laserSvg.d.ts +35 -0
  168. package/dist/types/kit/levelGen/castle.d.ts +17 -0
  169. package/dist/types/kit/levelGen/dungeon.d.ts +11 -0
  170. package/dist/types/kit/levelGen/forest.d.ts +17 -0
  171. package/dist/types/kit/levelGen/furnish.d.ts +31 -0
  172. package/dist/types/kit/levelGen/grid.d.ts +46 -0
  173. package/dist/types/kit/levelGen/index.d.ts +138 -0
  174. package/dist/types/kit/levelGen/interior.d.ts +18 -0
  175. package/dist/types/kit/levelGen/jumpModel.d.ts +78 -0
  176. package/dist/types/kit/levelGen/needs.d.ts +44 -0
  177. package/dist/types/kit/levelGen/overworld.d.ts +21 -0
  178. package/dist/types/kit/levelGen/platform.d.ts +59 -0
  179. package/dist/types/kit/levelGen/platformCap.d.ts +13 -0
  180. package/dist/types/kit/levelGen/platformReach.d.ts +37 -0
  181. package/dist/types/kit/levelGen/props.d.ts +37 -0
  182. package/dist/types/kit/levelGen/town.d.ts +24 -0
  183. package/dist/types/kit/levelGrid.d.ts +16 -0
  184. package/dist/types/kit/levelPicture.d.ts +9 -0
  185. package/dist/types/kit/menuVersion.d.ts +7 -0
  186. package/dist/types/kit/microText.d.ts +18 -0
  187. package/dist/types/kit/mumble.d.ts +41 -0
  188. package/dist/types/kit/music.d.ts +1 -0
  189. package/dist/types/kit/palMerge.d.ts +10 -0
  190. package/dist/types/kit/palRamps.d.ts +28 -0
  191. package/dist/types/kit/pcText.d.ts +19 -0
  192. package/dist/types/kit/photo.d.ts +69 -0
  193. package/dist/types/kit/png.d.ts +7 -0
  194. package/dist/types/kit/quantize.d.ts +20 -0
  195. package/dist/types/kit/raytrace.d.ts +169 -0
  196. package/dist/types/kit/recordedDemo.d.ts +1 -0
  197. package/dist/types/kit/road3d.d.ts +71 -0
  198. package/dist/types/kit/routeChecks.d.ts +6 -0
  199. package/dist/types/kit/saveSlots.d.ts +17 -0
  200. package/dist/types/kit/sceneInit.d.ts +11 -0
  201. package/dist/types/{games/kit → kit}/sceneSim.d.ts +5 -5
  202. package/dist/types/kit/screenText.d.ts +3 -0
  203. package/dist/types/kit/sdftext.d.ts +34 -0
  204. package/dist/types/kit/shading.d.ts +23 -0
  205. package/dist/types/kit/shareBlocks.d.ts +20 -0
  206. package/dist/types/kit/song.d.ts +89 -0
  207. package/dist/types/kit/songFx.d.ts +99 -0
  208. package/dist/types/kit/synthParts.d.ts +7 -0
  209. package/dist/types/kit/tar.d.ts +13 -0
  210. package/dist/types/kit/textfit.d.ts +74 -0
  211. package/dist/types/kit/transforms.d.ts +8 -0
  212. package/dist/types/lookAlike.d.ts +31 -0
  213. package/dist/types/menuVersionEntry.d.ts +1 -0
  214. package/dist/types/mesh/colorBodies.d.ts +18 -0
  215. package/dist/types/mesh/decimate.d.ts +10 -0
  216. package/dist/types/mesh/fieldTrinket.d.ts +40 -0
  217. package/dist/types/mesh/figureShapes.d.ts +24 -0
  218. package/dist/types/mesh/mesh.d.ts +9 -0
  219. package/dist/types/mesh/meshCheck.d.ts +22 -0
  220. package/dist/types/mesh/overhang.d.ts +24 -0
  221. package/dist/types/mesh/pixelFigure.d.ts +41 -0
  222. package/dist/types/mesh/sampledField.d.ts +3 -0
  223. package/dist/types/mesh/sdfShapes.d.ts +20 -0
  224. package/dist/types/mesh/stl.d.ts +9 -0
  225. package/dist/types/mesh/strokeText.d.ts +8 -0
  226. package/dist/types/mesh/surfaceNets.d.ts +14 -0
  227. package/dist/types/mesh/tetraMesh.d.ts +4 -0
  228. package/dist/types/mesh/threeMf.d.ts +12 -0
  229. package/dist/types/mesh/trinketKinds.d.ts +72 -0
  230. package/dist/types/mesh/trinketTool.d.ts +26 -0
  231. package/dist/types/mesh/voxel.d.ts +10 -0
  232. package/dist/types/mesh/zipFile.d.ts +13 -0
  233. package/dist/types/microFont.d.ts +6 -0
  234. package/dist/types/pack/meshPack.d.ts +26 -0
  235. package/dist/types/pack/threeMfPack.d.ts +11 -0
  236. package/dist/types/palettePresetData.d.ts +4 -0
  237. package/dist/types/palettePresets.d.ts +12 -0
  238. package/dist/types/paletteReserve.d.ts +52 -0
  239. package/dist/types/palettes.d.ts +4 -0
  240. package/dist/types/releaseNotes.d.ts +3 -0
  241. package/dist/types/simulation.d.ts +6 -0
  242. package/dist/types/{web/packages/tools/src/text.d.ts → text.d.ts} +6 -6
  243. package/package.json +145 -15
  244. package/dist/binary-D7wuaC5g.js +0 -120
  245. package/dist/pixels-DzfIIUOl.js +0 -76
  246. package/dist/types/games/kit/blit.d.ts +0 -10
  247. package/dist/types/games/kit/music.d.ts +0 -1
  248. package/dist/types/games/kit/pcText.d.ts +0 -8
  249. package/dist/types/games/kit/shading.d.ts +0 -11
  250. package/dist/types/web/packages/tools/src/audio.d.ts +0 -3
  251. package/dist/types/web/packages/tools/src/drawing.d.ts +0 -10
  252. package/dist/types/web/packages/tools/src/images.d.ts +0 -2
  253. package/dist/types/web/packages/tools/src/microFont.d.ts +0 -1
  254. package/dist/types/web/packages/tools/src/simulation.d.ts +0 -3
  255. package/dist/types/web/scripts/cdGames.d.ts +0 -103
  256. package/dist/types/web/scripts/gameShots.d.ts +0 -12
  257. package/dist/types/web/scripts/ogImage.d.ts +0 -21
  258. package/dist/types/web/src/audio/cmfLoad.d.ts +0 -7
  259. package/dist/types/web/src/audio/cmfPlayer.d.ts +0 -69
  260. package/dist/types/web/src/audio/context.d.ts +0 -12
  261. package/dist/types/web/src/audio/engine.d.ts +0 -39
  262. package/dist/types/web/src/audio/music.worklet.d.ts +0 -14
  263. package/dist/types/web/src/audio/opl.d.ts +0 -37
  264. package/dist/types/web/src/audio/output.d.ts +0 -13
  265. package/dist/types/web/src/desk/boxes/boxFacts.d.ts +0 -85
  266. package/dist/types/web/src/dosPlayer/fileExtensions.d.ts +0 -44
  267. package/dist/types/web/src/dosPlayer/patchRules.d.ts +0 -24
  268. package/dist/types/web/src/dosPlayer/patchTable.d.ts +0 -80
  269. package/dist/types/web/src/edition.d.ts +0 -6
  270. package/dist/types/web/src/eggs/eggState.d.ts +0 -26
  271. package/dist/types/web/src/eggs/eggs.d.ts +0 -31
  272. package/dist/types/web/src/engine/character.d.ts +0 -30
  273. package/dist/types/web/src/engine/funcKeys.d.ts +0 -33
  274. package/dist/types/web/src/engine/game.d.ts +0 -52
  275. package/dist/types/web/src/engine/keys.d.ts +0 -17
  276. package/dist/types/web/src/engine/machine.d.ts +0 -99
  277. package/dist/types/web/src/engine/menus.d.ts +0 -46
  278. package/dist/types/web/src/engine/monsters.d.ts +0 -19
  279. package/dist/types/web/src/engine/playGain.d.ts +0 -11
  280. package/dist/types/web/src/engine/playerLook.d.ts +0 -26
  281. package/dist/types/web/src/engine/recorder.d.ts +0 -60
  282. package/dist/types/web/src/engine/render.d.ts +0 -8
  283. package/dist/types/web/src/engine/scene.d.ts +0 -156
  284. package/dist/types/web/src/engine/scroll.d.ts +0 -16
  285. package/dist/types/web/src/engine/showGraphic.d.ts +0 -39
  286. package/dist/types/web/src/engine/slowPc.d.ts +0 -62
  287. package/dist/types/web/src/engine/touch.d.ts +0 -33
  288. package/dist/types/web/src/engine/world.d.ts +0 -215
  289. package/dist/types/web/src/export/gameAbout.d.ts +0 -15
  290. package/dist/types/web/src/formats/binary.d.ts +0 -44
  291. package/dist/types/web/src/formats/blocks.d.ts +0 -52
  292. package/dist/types/web/src/formats/character.d.ts +0 -65
  293. package/dist/types/web/src/formats/cmf.d.ts +0 -33
  294. package/dist/types/web/src/formats/fli.d.ts +0 -45
  295. package/dist/types/web/src/formats/fliLimits.d.ts +0 -13
  296. package/dist/types/web/src/formats/game.d.ts +0 -72
  297. package/dist/types/web/src/formats/gif.d.ts +0 -15
  298. package/dist/types/web/src/formats/graphicScripts.d.ts +0 -18
  299. package/dist/types/web/src/formats/highscore.d.ts +0 -10
  300. package/dist/types/web/src/formats/map.d.ts +0 -24
  301. package/dist/types/web/src/formats/monster.d.ts +0 -48
  302. package/dist/types/web/src/formats/palette.d.ts +0 -15
  303. package/dist/types/web/src/formats/recording.d.ts +0 -7
  304. package/dist/types/web/src/formats/sound.d.ts +0 -13
  305. package/dist/types/web/src/formats/voc.d.ts +0 -13
  306. package/dist/types/web/src/gfx/cp437Glyphs.d.ts +0 -2
  307. package/dist/types/web/src/gfx/font8x8.d.ts +0 -2
  308. package/dist/types/web/src/gfx/levelPicture.d.ts +0 -81
  309. package/dist/types/web/src/gfx/screen.d.ts +0 -46
  310. package/dist/types/web/src/gfx/titlePicture.d.ts +0 -21
  311. package/dist/types/web/src/input/chords.d.ts +0 -22
  312. package/dist/types/web/src/input/deskMouse.d.ts +0 -14
  313. package/dist/types/web/src/input/keyboard.d.ts +0 -39
  314. package/dist/types/web/src/input/scancodes.d.ts +0 -3
  315. package/dist/types/web/src/manual/printables/types.d.ts +0 -277
  316. package/dist/types/web/src/project/bizarre.d.ts +0 -28
  317. package/dist/types/web/src/project/companion.d.ts +0 -35
  318. package/dist/types/web/src/project/diskFacts.d.ts +0 -30
  319. package/dist/types/web/src/project/files.d.ts +0 -124
  320. package/dist/types/web/src/project/gameFiles.d.ts +0 -49
  321. package/dist/types/web/src/project/gamePack.d.ts +0 -17
  322. package/dist/types/web/src/project/health.d.ts +0 -30
  323. package/dist/types/web/src/project/secretGames.d.ts +0 -19
  324. package/dist/types/web/src/project/storage.d.ts +0 -46
  325. package/dist/types/web/src/project/streamGame.d.ts +0 -38
  326. package/dist/types/web/src/project/zip.d.ts +0 -33
  327. package/dist/types/web/src/retro/dos/disks.d.ts +0 -33
  328. package/dist/types/web/src/retro/text/cp437.d.ts +0 -4
  329. package/dist/types/web/src/seededRandom.d.ts +0 -6
  330. package/dist/types/web/src/tinHearts/deskHearts.d.ts +0 -33
  331. package/dist/types/web/src/tinHearts/manifest.d.ts +0 -30
  332. package/dist/types/web/src/tinHearts/tinHearts.d.ts +0 -84
  333. package/dist/types/web/src/walkthrough/format.d.ts +0 -92
  334. package/dist/types/web/src/walkthrough/madeUpScores.d.ts +0 -6
  335. package/dist/types/web/src/walkthrough/runtime.d.ts +0 -134
  336. /package/dist/types/{web/src/assistant → image}/png.d.ts +0 -0
  337. /package/dist/types/{games/kit → kit}/palette.d.ts +0 -0
  338. /package/dist/types/{games/kit → kit}/pixels.d.ts +0 -0
  339. /package/dist/types/{games/kit → kit}/reel.d.ts +0 -0
  340. /package/dist/types/{games/kit → kit}/sound.d.ts +0 -0
  341. /package/dist/types/{games/kit → kit}/textBounds.d.ts +0 -0
  342. /package/dist/types/{games/kit → kit}/tune.d.ts +0 -0
  343. /package/dist/types/{web/src/audio → music}/compose.d.ts +0 -0
@@ -1,52 +0,0 @@
1
- import { Machine } from './machine.js';
2
- import { type Session, type SpeedSetting } from './scene.js';
3
- import type { PlayerPatches } from '../dosPlayer/patchRules.js';
4
- import { type Game } from '../formats/game.js';
5
- export interface RunOptions {
6
- /** Called when the player picks Quit; return true to show the menu again. */
7
- onQuit?: () => Promise<boolean> | boolean;
8
- speakerOnly?: boolean;
9
- /** No Sound Blaster (PLAYGAME's SoundCard() found none): no songs, every sound on the PC speaker. */
10
- noSoundCard?: boolean;
11
- joystick?: Session['joystick'];
12
- /** Play a .rec demo immediately instead of showing the menu. */
13
- playback?: Uint8Array;
14
- /** Start playing at once, recording the keys (for making a demo); the menu is skipped. */
15
- record?: boolean;
16
- /** Receives the game session as it starts (e.g. to read the recording so far). */
17
- onSession?: (s: Session) => void;
18
- /** Called every frame while a level is being played. */
19
- onFrame?: Session['onFrame'];
20
- /** Emulated PC speed (shared object: change slowPc at any time). */
21
- speed?: SpeedSetting;
22
- /**
23
- * Play as PLAYGAME.EXE, Game-Maker's own player: F1 shows this file (GMHELP.TXT from
24
- * Game-Maker's directory) before the game's instructions. Left out, the game plays as
25
- * XFERPLAY.EXE, the stand-alone player every transferred game runs on, whose F1 shows only
26
- * the instructions (PLAYGAME.C HelpFiles: the gmhelp.txt part is #ifndef TRANSFER).
27
- */
28
- gmHelp?: Uint8Array;
29
- /**
30
- * The project's DOS player customizations (dosPlayer/): XFERPLAY's words, colors, frames,
31
- * positions, times and F-keys as its patched .EXE shows them. Left out, the CD's player.
32
- */
33
- player?: PlayerPatches;
34
- /** A touch changed a map cell while the player played (never during a demo's playback). */
35
- onTouched?: Session['onTouched'];
36
- /** Play ended with this score (never during a demo's playback; see Session.onPlayEnd). */
37
- onPlayEnd?: Session['onPlayEnd'];
38
- /**
39
- * The editor's Play Level test only (never a saved, exported or DOS game): skip the title, its
40
- * song and the menu, and start play at once by scene 0's first link (which the test copy points
41
- * at the picked level and spot, editor/editors/integrator/startAt.ts) with a new game's
42
- * character, as the menu's Play would. When that play ends (won, lost or Esc), the usual end
43
- * follows (the won or dead picture, the high scores) and then the menu, as after any play.
44
- */
45
- skipTitle?: boolean;
46
- }
47
- export declare function gameNameOf(gamFile: string): string;
48
- export declare function loadGameFile(m: Machine, gamFile: string): Game;
49
- /** Runs a game until the player quits. */
50
- export declare function runGame(m: Machine, gamFile: string, opts?: RunOptions): Promise<void>;
51
- /** play(curlink): from scene 0's link to the end. */
52
- export declare function play(s: Session, startLink: number): Promise<void>;
@@ -1,17 +0,0 @@
1
- import { type Frame, type Sequence } from '../formats/character.js';
2
- import { type World } from './world.js';
3
- export declare function chrSeq(w: World): Sequence;
4
- /** CHRFRAME. cframe can be -1 between sequences; the original then read stray memory. */
5
- export declare function chrFrame(w: World): Frame;
6
- /**
7
- * SimKeyPress. A press starts the matching sequence only if the character isn't dying,
8
- * the running sequence can be interrupted (not `ground`), the sequence still has uses
9
- * (meter > 0) and is turned on (seqon, e.g. its inventory block is carried).
10
- */
11
- export declare function simKeyPress(w: World, key: number): void;
12
- /** PushKey. The overflow handling is the port's; the C pushed without a bounds check. */
13
- export declare function pushKey(w: World): void;
14
- /** PopKey: drop `key` from the stack and resume what is under it, or idle when empty. */
15
- export declare function popKey(w: World, key: number): void;
16
- /** The key down and key stack reset at the end of StartSceneInits (also used after F-keys). */
17
- export declare function resetKeys(w: World): void;
@@ -1,99 +0,0 @@
1
- import { Screen } from '../gfx/screen.js';
2
- import { Keyboard, type TypedKey } from '../input/keyboard.js';
3
- import { AudioEngine } from '../audio/engine.js';
4
- import { GameFiles } from '../project/gameFiles.js';
5
- /** Thrown to unwind the game when the player is closed. */
6
- export declare class GameAborted extends Error {
7
- constructor();
8
- }
9
- interface PointerState {
10
- /** Screen coordinates (0..319, 0..199) of the last pointer position. */
11
- x: number;
12
- y: number;
13
- clicks: number;
14
- }
15
- /** How a Machine is driven (the defaults are a live player's). */
16
- interface MachineOptions {
17
- /**
18
- * 'manual': no animation frame loop; whoever made the Machine calls presentFrame() for
19
- * each frame, and now() is theirs too (a walkthrough steps the game on a clock of its own).
20
- */
21
- frames?: 'auto' | 'manual';
22
- /** False: the pointer, the desk mouse and the keyboard never reach the game. */
23
- input?: boolean;
24
- }
25
- export declare class Machine {
26
- readonly screen: Screen;
27
- readonly keyboard: Keyboard;
28
- readonly audio: AudioEngine;
29
- files: GameFiles;
30
- readonly pointer: PointerState;
31
- aborted: boolean;
32
- private frameWaiters;
33
- private raf;
34
- /** The ball mouse on the desk moves the pointer and clicks too. */
35
- private offDeskMouse;
36
- /** The engine was made here (not passed in): it goes with the Machine. */
37
- private ownsAudio;
38
- constructor(canvas: HTMLCanvasElement, files: GameFiles, audio?: AudioEngine, opts?: MachineOptions);
39
- private listen;
40
- /** The time in ms the game goes by (waits, fades, animations, the game clock). */
41
- now(): number;
42
- /** One display frame: the screen is shown (unless `show` is false) and everything waiting for a frame goes on. */
43
- presentFrame(show?: boolean): void;
44
- /** How many are waiting for the next frame (a stepped Machine's game is idle when one is). */
45
- get frameWaiting(): number;
46
- private toScreen;
47
- private onPointer;
48
- private onMove;
49
- destroy(): void;
50
- /** Told when the game waits for files still on their way (true) and when they are in. */
51
- onLoading?: (loading: boolean) => void;
52
- /**
53
- * Waits for game files still on their way from the site (a hosted game starts before
54
- * all its files are in, project/streamGame.ts); a short wait shows no cue. Names the
55
- * game doesn't have, or that are in already, return at once.
56
- */
57
- need(...names: (string | undefined)[]): Promise<void>;
58
- /** Fetches these game files next, if they are still on their way, without waiting. */
59
- want(...names: (string | undefined)[]): void;
60
- checkAbort(): void;
61
- /** Waits for the next animation frame (the screen is presented every frame). */
62
- frame(): Promise<void>;
63
- sleep(ms: number): Promise<void>;
64
- takeClick(): boolean;
65
- /**
66
- * PauseTimeKey: waits up to `seconds` (forever if omitted) for a key or click.
67
- * Returns the key, a pseudo key for a click (ascii 1, as the C returned 1 for a mouse
68
- * button; scan 28 is Enter's), or undefined on time out (the C returned FALSE).
69
- */
70
- pauseTimeKey(seconds?: number): Promise<TypedKey | undefined>;
71
- private waitDepth;
72
- private polledAt;
73
- /**
74
- * Runs `fn` as PLAYGAME code that read keys through GetKey (key waits, pictures,
75
- * animations, text pages): while it runs, each frame hands the demo recorder the polls
76
- * the DOS PC would have made meanwhile (keyPoll). Gameplay itself stole the keyboard
77
- * interrupt and never called GetKey, so it does not count.
78
- */
79
- waiting<T>(fn: () => Promise<T>): Promise<T>;
80
- private pollKeys;
81
- /**
82
- * Demo playback: called while a screen waits for a key with how many GetKey polls the
83
- * DOS PC would have made meanwhile; returns recorded keys that become pending.
84
- */
85
- keyPoll?: (polls: number) => number[];
86
- /** Demo playback: a key-reading screen ended; returns recorded keys it must have taken. */
87
- keyPollEnd?: () => number[];
88
- /** Clears keyboard input (while (GetKey(1)) GetKey(0)). */
89
- flushKeys(): void;
90
- /**
91
- * FadeTo: 65 retrace-synchronized steps from the current palette to `dest`. The C
92
- * waited for one VGA vertical retrace (70 Hz in mode 13h) per step, hence steps/70 s;
93
- * it stepped each channel Bresenham-style, which the truncated d*step/steps matches
94
- * at every step.
95
- */
96
- fadeTo(dest: ArrayLike<number>, steps?: number): Promise<void>;
97
- fadeAllTo(r: number, g: number, b: number, steps?: number): Promise<void>;
98
- }
99
- export {};
@@ -1,46 +0,0 @@
1
- import type { Machine } from './machine.js';
2
- import type { Screen } from '../gfx/screen.js';
3
- import { type PlayerLook } from './playerLook.js';
4
- import { type HighScore } from '../formats/highscore.js';
5
- /**
6
- * GVertMenu: a marker box left of `count` rows (`dy` pixels apart starting at y).
7
- * Returns 1..count, 0 for Esc, count+1 when idle for `idleSeconds`. The C timed the
8
- * idle wait in game ticks (IdleTime*18 of TimerCounter); this uses wall-clock time.
9
- *
10
- * The C cleared only the mouse buttons (mouclearbut), not the keyboard: a key typed
11
- * while the menu picture faded in (after the one ShowGraphic's PauseTimeKey(0) took)
12
- * was the menu's. `flushKeys` false keeps that; the default clears keys too, for menus
13
- * opened mid-level, where this port's keyboard also queues the keys gameplay used
14
- * (PLAYGAME's own keyboard interrupt kept those out of the BIOS buffer).
15
- */
16
- export declare function gVertMenu(m: Machine, x: number, y: number, dy: number, count: number, color: number, idleSeconds?: number, choice?: number, flushKeys?: boolean,
17
- /** The marker's width minus 1 (the player's border.marker.width patch). */
18
- markerWidth?: number): Promise<number>;
19
- /** GGet: line editor with a blinking box cursor. Returns null on Esc. */
20
- export declare function gGet(m: Machine, x: number, y: number, col: number, bcol: number, initial: string, maxlen: number): Promise<string | null>;
21
- /** DrawDefaultScrn: concentric colored frames when a game has no menu graphic. */
22
- export declare function drawDefaultScreen(m: {
23
- screen: Screen;
24
- }, colors: Uint8Array, rand?: () => number): void;
25
- export declare function highScoreFile(gamename: string): string;
26
- export declare function readHighScores(m: Machine, gamename: string): HighScore[];
27
- /** The main menu's words over the menu picture: the game's name and the six choices (DoGame). Returns their color. */
28
- export declare function drawMenu(screen: Screen, look: PlayerLook, colors: Uint8Array, title: string): number;
29
- /** The menu's GVertMenu call (x, first y, spacing, idle seconds, marker width), as the player's patches set them. */
30
- export declare function menuMarker(look: PlayerLook): {
31
- x: number;
32
- y: number;
33
- dy: number;
34
- idle: number;
35
- width: number;
36
- };
37
- /** One of the menu's "No game-specific ..." lines (they share one GWrite: one position, one color). */
38
- export declare function drawNoFile(screen: Screen, look: PlayerLook, colors: Uint8Array, id: 'noInstructions' | 'noStoryline' | 'noCredits'): void;
39
- /** The high score table's words and rows; the rows get closer together further down. */
40
- export declare function drawHighScores(screen: Screen, look: PlayerLook, colors: Uint8Array, top: HighScore[], score: number): void;
41
- /** ShowHighScores (HISCOREL.C). */
42
- export declare function showHighScores(m: Machine, gamename: string, colors: Uint8Array, score?: number, look?: PlayerLook): Promise<void>;
43
- /** CheckHighScores' words for a new high score (place is 1-based); returns the name's color. */
44
- export declare function drawNewHighScore(screen: Screen, look: PlayerLook, colors: Uint8Array, place: number): number;
45
- /** CheckHighScores: asks for a name when the score makes the top ten; returns the 1-based place or 0. */
46
- export declare function checkHighScores(m: Machine, gamename: string, colors: Uint8Array, score: number, look?: PlayerLook): Promise<number>;
@@ -1,19 +0,0 @@
1
- import { type MonInfo, type World } from './world.js';
2
- export declare function resetMonInfo(mi: MonInfo): void;
3
- export declare function monPicNum(w: World, mm: number): number;
4
- /** minfo::CalcDraw */
5
- export declare function calcDraw(w: World, mi: MonInfo): boolean;
6
- /** BirthMon: puts monster `mon` in slot mm (or the first empty slot when mm >= LASTMM). */
7
- export declare function birthMon(w: World, mm: number, mon: number, x: number, y: number): number;
8
- /** BlocBirthMon: blocks that give birth to monsters near the screen. */
9
- export declare function blockBirthMonsters(w: World): void;
10
- /** CharBirthMon: a character sequence frame that fires a monster (a shot, a bomb…). */
11
- export declare function charBirthMon(w: World, x: number, y: number, monNum: number): void;
12
- /**
13
- * PicChkTouch: pixel-exact overlap of two 20x20 sprites (255 = transparent).
14
- * Both positions are shifted so the overlap is measured from the nearer corner;
15
- * each of the four branches handles one relative placement of sprite 2.
16
- */
17
- export declare function picChkTouch(x1: number, y1: number, pic1: Uint8Array, x2: number, y2: number, pic2: Uint8Array): boolean;
18
- /** moveallmons: animate and move every live monster one game tick. */
19
- export declare function moveAllMonsters(w: World): void;
@@ -1,11 +0,0 @@
1
- export interface PlayGain {
2
- /** Points from the stretches F6 closed. */
3
- banked: number;
4
- /** The score the current stretch started from (0, or the score a load put in place). */
5
- base: number;
6
- }
7
- export declare const newPlayGain: () => PlayGain;
8
- /** F6 loaded a save: the score went from `before` to the save's `after`. */
9
- export declare function gainAtLoad(g: PlayGain, before: number, after: number): void;
10
- /** The points this play scored, ending on `score`. */
11
- export declare const gainAtEnd: (g: PlayGain, score: number) => number;
@@ -1,26 +0,0 @@
1
- import { type PlayerPatches } from '../dosPlayer/patchRules.js';
2
- type Rgb = [number, number, number];
3
- type Frame = [number, number, number, number];
4
- export interface PlayerLook {
5
- /** A word or line (str.*). */
6
- text(id: string): string;
7
- /** A printf format (str.*) filled in as sprintf would. */
8
- format(id: string, ...args: (number | string)[]): string;
9
- /** The palette index a screen's color selector (color.select.*) matches in `pal`. */
10
- color(pal: Uint8Array, select: string): number;
11
- /** A color's levels (color.rgb.*, color.missing.*). */
12
- rgb(id: string): Rgb;
13
- frame(id: string): Frame;
14
- /** A position or count (layout.*, border.marker.width). */
15
- num(id: string): number;
16
- /** A wait in seconds (timing.*); -1 is PauseTimeKey's unsigned 65535 (until a key). */
17
- seconds(id: string): number;
18
- /** False when the player's patches turned this F-key off. */
19
- fkeyOn(key: number): boolean;
20
- }
21
- /** sprintf for the player's formats: %d, %ld, %s with a width and the 0 and - flags. */
22
- export declare function sprintf(format: string, args: (number | string)[]): string;
23
- export declare function playerLook(patches?: PlayerPatches): PlayerLook;
24
- /** The CD player's own look. */
25
- export declare const STOCK_LOOK: PlayerLook;
26
- export {};
@@ -1,60 +0,0 @@
1
- import { type RecordedKey } from '../formats/recording.js';
2
- export declare const RECORD = 1;
3
- export declare class Recorder {
4
- mode: number;
5
- private keys;
6
- private index;
7
- private timer;
8
- private lastKeyPress;
9
- private paused;
10
- initRecord(): void;
11
- /**
12
- * Whether waits for a key count toward playback time. PLAYGAME's GetKey called
13
- * DoPlayBack on every poll, so while a "hit any key" screen waited the timer raced
14
- * ahead (thousands of polls a second), and a demo recorded in DOS stores those polls
15
- * as one huge DeltaTime before the key that dismissed the screen (Nebula's 26058).
16
- * Demos recorded here count game ticks only, so for them waits must not count.
17
- */
18
- countsWaits: boolean;
19
- initPlayback(bytes: Uint8Array | undefined): boolean;
20
- stop(): void;
21
- restart(): void;
22
- pause(): void;
23
- unpause(): void;
24
- /** Game ticks counted since the recording or playback (re)started; the playback position. */
25
- get tick(): number;
26
- get playing(): boolean;
27
- /** Paused: play has left the levels (the won/lost pictures and score table follow). */
28
- get halted(): boolean;
29
- /** DoPlayBack: advance one tick; returns the keys that become pending now. */
30
- doPlayback(): number[];
31
- /**
32
- * GetKey polls while a screen waits for a key: `polls` calls to DoPlayBack at once.
33
- * Returns the recorded keys that become pending (only for recordings made in DOS).
34
- */
35
- advanceWait(polls: number): number[];
36
- /**
37
- * A screen that read keys has finished. In DOS the next key may have come during it
38
- * (the recording shows a gap of many thousands of polls), however fast that PC polled;
39
- * catch up to it, and to keys a poll or two behind it (taken by the keyboard flush that
40
- * follows every screen), so gameplay resumes in step. Only for DOS recordings.
41
- */
42
- finishWait(): number[];
43
- /**
44
- * DoRecord: called when a key is actually applied to the character (keys held back
45
- * while a sequence can't be interrupted are recorded on the tick they take effect).
46
- * DeltaTime is a 16-bit uint in the C, and at most RECLEN keys are kept.
47
- */
48
- doRecord(key: number): void;
49
- /** The recording so far, in .rec format. */
50
- save(): Uint8Array;
51
- /** For save games (the C wrote the Recording object and its keys into the .sav). */
52
- snapshot(): unknown;
53
- restore(s: {
54
- mode: number;
55
- keys: RecordedKey[];
56
- index: number;
57
- timer: number;
58
- lastKeyPress: number;
59
- }): void;
60
- }
@@ -1,8 +0,0 @@
1
- import type { Screen } from '../gfx/screen.js';
2
- import { type World } from './world.js';
3
- /** CropScreen: the CRTC was reprogrammed to show only 312x196 pixels while playing. */
4
- export declare const VISIBLE_W = 312;
5
- export declare const VISIBLE_H = 196;
6
- /** drawchars' bookkeeping without the drawing: whether top/bottom blocks are shown (used by GetTouchbl). */
7
- export declare function updateCharDrawState(w: World): void;
8
- export declare function renderWorld(screen: Screen, w: World): void;
@@ -1,156 +0,0 @@
1
- import type { Machine } from './machine.js';
2
- import type { Recorder } from './recorder.js';
3
- import { type PlayerLook } from './playerLook.js';
4
- import { type CharInfo, type Coord, type World } from './world.js';
5
- import { type SoundSet } from '../formats/sound.js';
6
- import { type Game } from '../formats/game.js';
7
- import { type PcCosts } from './slowPc.js';
8
- import { type PlayGain } from './playGain.js';
9
- /** How a play ended: the Game Won scene, no lives left, or Esc (or a scene that could not load). */
10
- type PlayEnd = 'won' | 'lost' | 'quit';
11
- /** Everything that lives across scenes (playgame's globals outside a level). */
12
- export interface Session {
13
- m: Machine;
14
- game: Game;
15
- gameName: string;
16
- ci: CharInfo;
17
- /** The `colors` global: the palette of the current scene or menu screen. */
18
- colors: Uint8Array;
19
- rec: Recorder;
20
- sndClock: number;
21
- timerCounter: number;
22
- soundOn: boolean;
23
- musicOn: boolean;
24
- /** Use the PC speaker even when a .voc name is given (no Sound Blaster). */
25
- speakerOnly: boolean;
26
- joystick?: () => {
27
- pos: number;
28
- buttons: number;
29
- } | null;
30
- /** Called every rendered frame with the live world (for HUD overlays, touch controls…). */
31
- onFrame?: (w: World) => void;
32
- /** Emulated PC speed; read every tick so it can change while playing. */
33
- speed: SpeedSetting;
34
- /** RunOptions.gmHelp: Game-Maker's own GMHELP.TXT, which F1 shows first (PLAYGAME.EXE only). */
35
- gmHelp?: Uint8Array;
36
- /** RunOptions.player as the screens use it (engine/playerLook.ts); left out, the CD player's look. */
37
- look?: PlayerLook;
38
- /** The random numbers a level's monsters get as it loads (default Math.random; a walkthrough seeds them). */
39
- rand?: () => () => number;
40
- /** Told the scene number each time play() enters a scene (before its picture). */
41
- onScene?: (scene: number) => void;
42
- /** Not PLAYGAME's: a touch in `scene` changed map cell (x, y), shown as block `bnum` (World.onTouched). */
43
- onTouched?: (scene: number, x: number, y: number, bnum: number) => void;
44
- /**
45
- * Not PLAYGAME's: play ended (won, lost, or left with Esc) with this score, just before the
46
- * high score table. Never told during a demo's playback. It only listens: nothing changes.
47
- * `gained` is the points the play scored itself, leaving out those F6 loaded (playGain.ts).
48
- */
49
- onPlayEnd?: (score: number, how: PlayEnd, gained: number) => void;
50
- /** Not PLAYGAME's: the stretches of this play between F6 loads (playGain.ts). */
51
- gain?: PlayGain;
52
- /**
53
- * The last level played. loadscene loads into globals, so a level that leaves its
54
- * palette, block or character slot blank keeps the previous level's (PLAYGAME.C 4239).
55
- */
56
- lastWorld?: World;
57
- }
58
- /**
59
- * How fast the emulated PC is. The game clock always runs at 18.2 Hz, but playgame
60
- * skips (rather than catches up) ticks its main loop was too slow to handle, and loses
61
- * the scroll steps of interrupts that went by while it was busy. `slowPc` (see slowPc.ts)
62
- * charges each pass of the loop what it cost on a slower PC; left out, the PC is fast
63
- * enough for every pass (a 486 in turbo).
64
- */
65
- export interface SpeedSetting {
66
- slowPc?: PcCosts;
67
- }
68
- export declare function sceneFile(game: Game, scene: number, slot: number): string | undefined;
69
- interface LoadedScene {
70
- world: World;
71
- sounds?: SoundSet;
72
- song?: Uint8Array;
73
- }
74
- /**
75
- * loadscene: returns the names of missing files on failure. Scene file slots are
76
- * 0 palette, 1 map, 2 background blocks, 3 monsters, 4 monster blocks, 5 character,
77
- * 6 character blocks, 7 sound set, 8 song. In the C a slot left blank keeps whatever
78
- * the previous scene loaded into the globals; `prev` stands in for those globals.
79
- */
80
- export declare function loadScene(s: Pick<Session, 'game' | 'rand' | 'onTouched'> & {
81
- m: {
82
- files: {
83
- get(name: string): Uint8Array | undefined;
84
- };
85
- };
86
- }, scnum: number, prev?: World): LoadedScene | string[];
87
- /** StartGameInits */
88
- export declare function startGameInits(s: Session): void;
89
- /** StartSceneInits */
90
- export declare function startSceneInits(w: World, start: Coord): void;
91
- /**
92
- * keydn[CHRSEQ.key] = 1 at the end of the C's scene inits (PLAYGAME.C). keydn is a 128 byte
93
- * array indexed by scan code, but a sequence's key is the whole 16 bit word (scan code in the
94
- * high byte, ASCII in the low byte, CHAR.H), so the C only set a keydn entry when the key had
95
- * no scan code: key 0 (no key, which every idle sequence on the CD has) sets keydn[0], and
96
- * the idle sequence's "quit if key lifted" test (keydn[key>>8]==0) then reads it as held.
97
- * For a real key the write landed key bytes past keydn (DGROUP:4C4E in PLAYGAME.MAP), never
98
- * on another keydn entry: scan 1..4 in dirtrect.c's DirtyBoxes, scan 5 in the next modules'
99
- * buffers, scan 5..0x48 in gifc.c's decoder tables, 0x49..0x4A in the atexit table and higher
100
- * in the far end of the 15000 byte stack. Those are all written before they are read, so the
101
- * stray byte had no effect: the key does not read as held (keydn[scan] stays 0).
102
- */
103
- export declare function setStartKey(keydn: Uint8Array, key: number): void;
104
- /** changeblks: animate background blocks. */
105
- export declare function changeBlocks(w: World): void;
106
- interface SceneResult {
107
- ok: boolean;
108
- link: number;
109
- /**
110
- * The level played at the end and the one before it: another level's after F6 loaded a game
111
- * saved there (LoadGame sets play's curscene and oldscene, globals in the C).
112
- */
113
- doscene?: number;
114
- prevscene?: number;
115
- }
116
- /** What F5 writes to game<n>.sav (this port's JSON in place of SaveGame's binary records). */
117
- export interface Saved {
118
- version: 1;
119
- prevscene: number;
120
- doscene: number;
121
- linkin: number;
122
- sndClock: number;
123
- world: Pick<World, 'nxtchg' | 'ci' | 'mx' | 'my' | 'mi' | 'mm' | 'noMons' | 'blkMon'> & {
124
- blkmap: number[];
125
- map: number[];
126
- mapMon: number[];
127
- chr: {
128
- x: number[];
129
- y: number[];
130
- cframe: number;
131
- cseq: number;
132
- };
133
- };
134
- rec: ReturnType<Recorder['snapshot']>;
135
- }
136
- /** playscene: plays one level. link in/out follows the original's conventions. */
137
- export declare function playScene(s: Session, dosc: number, prev: number, linkIn: number): Promise<SceneResult>;
138
- /** The save of a game at this moment (F5; project/saveData's newGameSave makes one at the start). */
139
- export declare function savedState(w: World, where: {
140
- prevscene: number;
141
- doscene: number;
142
- linkin: number;
143
- }, sndClock: number, rec: Pick<Recorder, 'snapshot'>): Saved;
144
- /**
145
- * F6's LoadGame once the save is read: the saved level loaded fresh, then the saved state put
146
- * over it (also how project/saveData's tests check a save it made). Undefined when the
147
- * level's files are missing.
148
- */
149
- export declare function restoreSaved(s: Pick<Session, 'game' | 'rand' | 'ci' | 'rec' | 'sndClock' | 'onTouched'> & {
150
- m: {
151
- files: {
152
- get(name: string): Uint8Array | undefined;
153
- };
154
- };
155
- }, w: World | undefined, data: Saved): LoadedScene | undefined;
156
- export {};
@@ -1,16 +0,0 @@
1
- import { type World } from './world.js';
2
- /**
3
- * Scene setup: Scroll.up/down/left/right are stored mirrored in the .gam file (the
4
- * flags here name the way the map moves, e.g. `left` lets the map slide left as the
5
- * character walks right). 0xff means that direction is allowed.
6
- */
7
- export declare function initScroll(w: World, s: {
8
- up: number;
9
- down: number;
10
- left: number;
11
- right: number;
12
- }): void;
13
- /** ChangeScroll: decide scrolling speed from how far the character is from center. */
14
- export declare function changeScroll(w: World): number;
15
- /** DrawScroll: one 1/145.6 s scroll step. Returns how many new 4 pixel edge strips it took. */
16
- export declare function drawScroll(w: World): number;
@@ -1,39 +0,0 @@
1
- import type { Machine } from './machine.js';
2
- import { type PlayerLook } from './playerLook.js';
3
- export declare const RGB_RED: [number, number, number];
4
- export declare const RGB_BLUE: [number, number, number];
5
- export declare const RGB_YELLOW: [number, number, number];
6
- export declare const RGB_PURPLE: [number, number, number];
7
- export declare const match: (pal: Uint8Array, c: [number, number, number]) => number;
8
- interface GraphicOptions {
9
- /** Receives the palette of the shown picture (the NewCols argument). */
10
- cols?: Uint8Array;
11
- /** Seconds to wait for a key; -1 = the default for the file type. */
12
- pause?: number;
13
- /** The game's current palette, used to pick text colors (`colors` global). */
14
- gamePalette: Uint8Array;
15
- /** The player's look (RunOptions.player): text page colors, default times. */
16
- look?: PlayerLook;
17
- }
18
- /** Returns false when the player pressed Esc (which aborts slide shows). */
19
- export declare function showGraphic(m: Machine, file: string, opts: GraphicOptions): Promise<boolean>;
20
- /**
21
- * FLI::View: every frame once, `speed` vertical retraces (1/70 s) apart. The C drew
22
- * straight onto the VGA screen, so the animation starts over whatever is shown.
23
- *
24
- * A speed of 0 waits no retrace at all: the C's delay loop is
25
- * for (uint Delay=0;Delay<Head.FrameSpd;Delay++) { wait out retrace; wait for retrace; }
26
- * so with FrameSpd 0 the next frame was decoded into video memory straight away, as fast
27
- * as the PC could read and draw it, and the monitor showed whatever was in video memory at
28
- * each refresh (frames in between were never seen). The port does the same: it draws the
29
- * next frame at once, only yielding to the event loop (no frame wait) so the page stays
30
- * responsive, and each browser repaint shows the frame that is current then. Speed 0 FLIs
31
- * on the CD (black.fli, menubkg.fli, textbkg.fli, ...) are one or two frame backgrounds.
32
- */
33
- export declare function playFli(m: Machine, file: string): Promise<boolean>;
34
- /**
35
- * Display_File: text pages over the current picture, 16 lines (rows 5..20 of 8 pixels)
36
- * per page. fgets(…, 32) read at most 31 characters at a time, so long lines wrap.
37
- */
38
- export declare function displayFile(m: Machine, file: string, col: number, pause: number, gamePalette: Uint8Array, bytes?: Uint8Array<ArrayBufferLike> | undefined, look?: PlayerLook): Promise<boolean>;
39
- export {};
@@ -1,62 +0,0 @@
1
- /**
2
- * The emulated slow PC behind the desk's TURBO button (turbo off).
3
- *
4
- * A 486DX2-66's turbo switch did not make it a 286. On most boards turbo off turned off
5
- * the CPU cache (some also dropped the bus or core clock), which left the machine at
6
- * roughly 286-16 to 386-25 speed, depending on the board. So turbo off here is "about a
7
- * fast 286": the PC Lewis played these games on, where they ran fine.
8
- *
9
- * Why they ran fine: playgame's main loop (PLAYGAME.C playscene) does two kinds of work.
10
- * - Once per NewTimer interrupt (8 per game tick, 145.6 Hz), DrawScroll while the view
11
- * scrolls. On a VGA/SVGA card this is hardware scrolling: it moves the CRTC start
12
- * address, draws only the new 4 pixel strips at the edge (drawhorizside/
13
- * drawvertside: 320x4 or 4x200 pixels each) and erases/redraws the character. It never
14
- * redraws the whole screen.
15
- * - Once per 18.2 Hz game tick: move and redraw the character and the monsters on screen,
16
- * animate blocks, copy the dirty rectangles to the screen, check links.
17
- * On a 286-class PC a still tick costs about 15 ms plus a millisecond or so per monster on
18
- * screen, well under the 55 ms a tick lasts, so the game keeps full pace. Scrolling only
19
- * runs once per pass of the loop, and the pass that runs the game tick takes several
20
- * interrupts' worth of time; DrawScroll is called with a step of 1 however many
21
- * interrupts went by (its `speed` argument is commented out), so those scroll steps are
22
- * simply lost and the view trails the character a little more. Only a crowded screen
23
- * that is also scrolling can take longer than a tick, and then playgame skips the missed
24
- * tick (OldClock jumps to TimerCounter) instead of catching up.
25
- *
26
- * The figures below are estimates for that machine, in milliseconds. They are kept
27
- * deliberately simple and deterministic (no wall clock): the same keys give the same
28
- * game, and recordings replay the same way.
29
- */
30
- export interface PcCosts {
31
- /** A game tick with nothing on screen but the character. */
32
- tickMs: number;
33
- /** Each monster drawn on screen that tick (move, erase, masked draw, dirty rect). */
34
- monsterMs: number;
35
- /** One DrawScroll call (Bresenham step, CRTC update, character erase/redraw). */
36
- scrollPassMs: number;
37
- /** Each new 4 pixel edge strip DrawScroll draws and copies to the screen. */
38
- stripMs: number;
39
- }
40
- /** A 486DX2-66 with turbo off: about a 286-16. */
41
- export declare const TURBO_OFF: PcCosts;
42
- /**
43
- * Keeps track of the time the slow PC still owes on work it started, counted in NewTimer
44
- * interrupts. While it owes a whole interrupt or more, that loop pass never happens.
45
- */
46
- export declare class SlowCpu {
47
- private readonly interruptMs;
48
- /** Milliseconds of work still running. */
49
- owed: number;
50
- constructor(interruptMs: number);
51
- /**
52
- * Called once per NewTimer interrupt: true when the PC is still busy with earlier work
53
- * and this interrupt's pass of the main loop (scroll step, game tick) is lost.
54
- */
55
- busy(): boolean;
56
- spend(ms: number): void;
57
- reset(): void;
58
- }
59
- /** What one game tick costs with `monsters` drawn on screen. */
60
- export declare function tickCost(pc: PcCosts, monsters: number): number;
61
- /** What one DrawScroll call costs when it drew `strips` new 4 pixel strips. */
62
- export declare function scrollCost(pc: PcCosts, strips: number): number;