@lewismoten/gamemaker-sandbox-tools 0.0.0-stage → 3.1.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 (127) hide show
  1. package/LICENSE +24 -0
  2. package/NOTICE.md +19 -0
  3. package/README.md +76 -2
  4. package/dist/audio.js +140 -0
  5. package/dist/binary-D7wuaC5g.js +120 -0
  6. package/dist/drawing.js +871 -0
  7. package/dist/formats/blocks.js +103 -0
  8. package/dist/formats/character.js +83 -0
  9. package/dist/formats/cmf.js +37 -0
  10. package/dist/formats/fli.js +296 -0
  11. package/dist/formats/fliLimits.js +54 -0
  12. package/dist/formats/game.js +193 -0
  13. package/dist/formats/gif.js +125 -0
  14. package/dist/formats/graphicScripts.js +44 -0
  15. package/dist/formats/map.js +38 -0
  16. package/dist/formats/monster.js +69 -0
  17. package/dist/formats/palette.js +58 -0
  18. package/dist/formats/recording.js +17 -0
  19. package/dist/formats/sound.js +44 -0
  20. package/dist/formats/voc.js +303 -0
  21. package/dist/images.js +50 -0
  22. package/dist/pixels-DzfIIUOl.js +76 -0
  23. package/dist/simulation.js +2776 -0
  24. package/dist/types/games/kit/blit.d.ts +10 -0
  25. package/dist/types/games/kit/clips.d.ts +36 -0
  26. package/dist/types/games/kit/gameSim.d.ts +108 -0
  27. package/dist/types/games/kit/music.d.ts +1 -0
  28. package/dist/types/games/kit/palette.d.ts +16 -0
  29. package/dist/types/games/kit/pcText.d.ts +8 -0
  30. package/dist/types/games/kit/pixels.d.ts +26 -0
  31. package/dist/types/games/kit/reel.d.ts +34 -0
  32. package/dist/types/games/kit/sceneSim.d.ts +84 -0
  33. package/dist/types/games/kit/shading.d.ts +11 -0
  34. package/dist/types/games/kit/sound.d.ts +29 -0
  35. package/dist/types/games/kit/textBounds.d.ts +51 -0
  36. package/dist/types/games/kit/tune.d.ts +6 -0
  37. package/dist/types/web/packages/tools/src/audio.d.ts +3 -0
  38. package/dist/types/web/packages/tools/src/colors.d.ts +20 -0
  39. package/dist/types/web/packages/tools/src/drawing.d.ts +10 -0
  40. package/dist/types/web/packages/tools/src/images.d.ts +2 -0
  41. package/dist/types/web/packages/tools/src/microFont.d.ts +1 -0
  42. package/dist/types/web/packages/tools/src/simulation.d.ts +3 -0
  43. package/dist/types/web/packages/tools/src/text.d.ts +41 -0
  44. package/dist/types/web/scripts/cdGames.d.ts +103 -0
  45. package/dist/types/web/scripts/gameShots.d.ts +12 -0
  46. package/dist/types/web/scripts/ogImage.d.ts +21 -0
  47. package/dist/types/web/src/assistant/png.d.ts +10 -0
  48. package/dist/types/web/src/audio/cmfLoad.d.ts +7 -0
  49. package/dist/types/web/src/audio/cmfPlayer.d.ts +69 -0
  50. package/dist/types/web/src/audio/compose.d.ts +51 -0
  51. package/dist/types/web/src/audio/context.d.ts +12 -0
  52. package/dist/types/web/src/audio/engine.d.ts +39 -0
  53. package/dist/types/web/src/audio/music.worklet.d.ts +14 -0
  54. package/dist/types/web/src/audio/opl.d.ts +37 -0
  55. package/dist/types/web/src/audio/output.d.ts +13 -0
  56. package/dist/types/web/src/desk/boxes/boxFacts.d.ts +85 -0
  57. package/dist/types/web/src/dosPlayer/fileExtensions.d.ts +44 -0
  58. package/dist/types/web/src/dosPlayer/patchRules.d.ts +24 -0
  59. package/dist/types/web/src/dosPlayer/patchTable.d.ts +80 -0
  60. package/dist/types/web/src/edition.d.ts +6 -0
  61. package/dist/types/web/src/eggs/eggState.d.ts +26 -0
  62. package/dist/types/web/src/eggs/eggs.d.ts +31 -0
  63. package/dist/types/web/src/engine/character.d.ts +30 -0
  64. package/dist/types/web/src/engine/funcKeys.d.ts +33 -0
  65. package/dist/types/web/src/engine/game.d.ts +52 -0
  66. package/dist/types/web/src/engine/keys.d.ts +17 -0
  67. package/dist/types/web/src/engine/machine.d.ts +99 -0
  68. package/dist/types/web/src/engine/menus.d.ts +46 -0
  69. package/dist/types/web/src/engine/monsters.d.ts +19 -0
  70. package/dist/types/web/src/engine/playGain.d.ts +11 -0
  71. package/dist/types/web/src/engine/playerLook.d.ts +26 -0
  72. package/dist/types/web/src/engine/recorder.d.ts +60 -0
  73. package/dist/types/web/src/engine/render.d.ts +8 -0
  74. package/dist/types/web/src/engine/scene.d.ts +156 -0
  75. package/dist/types/web/src/engine/scroll.d.ts +16 -0
  76. package/dist/types/web/src/engine/showGraphic.d.ts +39 -0
  77. package/dist/types/web/src/engine/slowPc.d.ts +62 -0
  78. package/dist/types/web/src/engine/touch.d.ts +33 -0
  79. package/dist/types/web/src/engine/world.d.ts +215 -0
  80. package/dist/types/web/src/export/gameAbout.d.ts +15 -0
  81. package/dist/types/web/src/formats/binary.d.ts +44 -0
  82. package/dist/types/web/src/formats/blocks.d.ts +52 -0
  83. package/dist/types/web/src/formats/character.d.ts +65 -0
  84. package/dist/types/web/src/formats/cmf.d.ts +33 -0
  85. package/dist/types/web/src/formats/fli.d.ts +45 -0
  86. package/dist/types/web/src/formats/fliLimits.d.ts +13 -0
  87. package/dist/types/web/src/formats/game.d.ts +72 -0
  88. package/dist/types/web/src/formats/gif.d.ts +15 -0
  89. package/dist/types/web/src/formats/graphicScripts.d.ts +18 -0
  90. package/dist/types/web/src/formats/highscore.d.ts +10 -0
  91. package/dist/types/web/src/formats/map.d.ts +24 -0
  92. package/dist/types/web/src/formats/monster.d.ts +48 -0
  93. package/dist/types/web/src/formats/palette.d.ts +15 -0
  94. package/dist/types/web/src/formats/recording.d.ts +7 -0
  95. package/dist/types/web/src/formats/sound.d.ts +13 -0
  96. package/dist/types/web/src/formats/voc.d.ts +13 -0
  97. package/dist/types/web/src/gfx/cp437Glyphs.d.ts +2 -0
  98. package/dist/types/web/src/gfx/font8x8.d.ts +2 -0
  99. package/dist/types/web/src/gfx/levelPicture.d.ts +81 -0
  100. package/dist/types/web/src/gfx/screen.d.ts +46 -0
  101. package/dist/types/web/src/gfx/titlePicture.d.ts +21 -0
  102. package/dist/types/web/src/input/chords.d.ts +22 -0
  103. package/dist/types/web/src/input/deskMouse.d.ts +14 -0
  104. package/dist/types/web/src/input/keyboard.d.ts +39 -0
  105. package/dist/types/web/src/input/scancodes.d.ts +3 -0
  106. package/dist/types/web/src/manual/printables/types.d.ts +277 -0
  107. package/dist/types/web/src/project/bizarre.d.ts +28 -0
  108. package/dist/types/web/src/project/companion.d.ts +35 -0
  109. package/dist/types/web/src/project/diskFacts.d.ts +30 -0
  110. package/dist/types/web/src/project/files.d.ts +124 -0
  111. package/dist/types/web/src/project/gameFiles.d.ts +49 -0
  112. package/dist/types/web/src/project/gamePack.d.ts +17 -0
  113. package/dist/types/web/src/project/health.d.ts +30 -0
  114. package/dist/types/web/src/project/secretGames.d.ts +19 -0
  115. package/dist/types/web/src/project/storage.d.ts +46 -0
  116. package/dist/types/web/src/project/streamGame.d.ts +38 -0
  117. package/dist/types/web/src/project/zip.d.ts +33 -0
  118. package/dist/types/web/src/retro/dos/disks.d.ts +33 -0
  119. package/dist/types/web/src/retro/text/cp437.d.ts +4 -0
  120. package/dist/types/web/src/seededRandom.d.ts +6 -0
  121. package/dist/types/web/src/tinHearts/deskHearts.d.ts +33 -0
  122. package/dist/types/web/src/tinHearts/manifest.d.ts +30 -0
  123. package/dist/types/web/src/tinHearts/tinHearts.d.ts +84 -0
  124. package/dist/types/web/src/walkthrough/format.d.ts +92 -0
  125. package/dist/types/web/src/walkthrough/madeUpScores.d.ts +6 -0
  126. package/dist/types/web/src/walkthrough/runtime.d.ts +134 -0
  127. package/package.json +60 -4
@@ -0,0 +1,2776 @@
1
+ import { CHARBL as T, BACKBL as h, emptyBlock as kt, MONBL as z, BLEN as c, SOLRIG as x, SOLLEF as g, SOLBOT as S, SOLTOP as p, TRANSPARENT as P, parseBlocks as ae } from "./formats/blocks.js";
2
+ import { MAXSEQ as C, METERS as xt, MAXINV as D, DIESEQ as Q, IDLESEQ as K, INF_REPEAT as N, HURTSEQ as I, DROPSEQ as ye, PICKUPSEQ as qe, MAXFRAME as Y, parseCharacter as gt } from "./formats/character.js";
3
+ import "./binary-D7wuaC5g.js";
4
+ import { LASTMM as v, MLEN as m, MWID as k, parseMap as pt } from "./formats/map.js";
5
+ import { LASTMON as F, LASTSL as U, ATTACKMOVEMENT as L, MAXMARCH as Me, NORMALMOVEMENT as W, parseMonsters as bt } from "./formats/monster.js";
6
+ import { LASTSND as Z, parseSoundSet as St } from "./formats/sound.js";
7
+ import { matchColor as Mt } from "./formats/palette.js";
8
+ import { readdirSync as vt, readFileSync as At } from "node:fs";
9
+ import { join as Tt } from "node:path";
10
+ import { fileURLToPath as Et } from "node:url";
11
+ import { parseGame as zt, MAXSCENELINKS as w, NOSCENE as Pt } from "./formats/game.js";
12
+ import { decodeVoc as qt } from "./formats/voc.js";
13
+ const $ = 320, he = 200, ke = 20, V = 11, oe = 16, ie = 10, Nt = 1, Ne = 1, _ = 1, Ct = 8, Ot = 5, b = -100, Ce = 40, Oe = 40, Re = 6, Rt = 100, Ht = 4294967295;
14
+ function ve() {
15
+ return {
16
+ score: 0,
17
+ update: !1,
18
+ topthere: !1,
19
+ bottomthere: !1,
20
+ curtop: T,
21
+ curbottom: T,
22
+ nextx: b,
23
+ nexty: b,
24
+ scrx: b,
25
+ scry: b,
26
+ oldx: b,
27
+ oldy: b,
28
+ netx: 5,
29
+ nety: 0,
30
+ gravx: 0,
31
+ gravy: 0,
32
+ hitpts: -1,
33
+ lives: -1,
34
+ nextAni: 0,
35
+ inv: new Array(D).fill(h + 1),
36
+ meter: new Array(xt).fill(-1),
37
+ seqon: new Array(C).fill(!1)
38
+ };
39
+ }
40
+ function Bt() {
41
+ return {
42
+ fromchar: 0,
43
+ delta: { x: 0, y: 0 },
44
+ curx: [0, 0],
45
+ cury: [0, 0],
46
+ target: { x: 0, y: 0 },
47
+ offl: -1,
48
+ offs: 0,
49
+ curMarch: 0,
50
+ curPic: -1,
51
+ orient: 0,
52
+ picDrawn: !1,
53
+ scrPos: { x: b, y: b },
54
+ oldPos: { x: b, y: b },
55
+ dest: 0,
56
+ nextAni: 0,
57
+ nextMove: 0,
58
+ birthTime: 0
59
+ };
60
+ }
61
+ function Dt() {
62
+ return {
63
+ nx: 0,
64
+ ny: 0,
65
+ totalx: 0,
66
+ totaly: 0,
67
+ distx: 0,
68
+ disty: 0,
69
+ inMotion: 0,
70
+ maxX: 0,
71
+ maxY: 0,
72
+ minX: 0,
73
+ minY: 0,
74
+ leftStop: 0,
75
+ rightStop: 0,
76
+ upStop: 0,
77
+ downStop: 0,
78
+ movx: 0,
79
+ movy: 0,
80
+ littleShiftx: 0,
81
+ littleShifty: 0,
82
+ up: 0,
83
+ down: 0,
84
+ left: 0,
85
+ right: 0,
86
+ bx: { dscroll: 0, ctr: 0, iters: 0 },
87
+ by: { dscroll: 0, ctr: 0, iters: 0 }
88
+ };
89
+ }
90
+ function O(e, t) {
91
+ const s = (e ?? []).slice(0, t);
92
+ for (; s.length < t + 1; ) s.push(kt(s.length, !0));
93
+ return s;
94
+ }
95
+ function Ae(e, t) {
96
+ return t * m + e;
97
+ }
98
+ function ce(e, t, s) {
99
+ return e.map[Ae(t, s)] ?? 0;
100
+ }
101
+ function He(e, t, s) {
102
+ const o = Ae(t, s);
103
+ return o >= 0 && o < e.mapMon.length ? e.mapMon[o] : v;
104
+ }
105
+ function Be(e, t, s, o) {
106
+ const i = Ae(t, s);
107
+ i >= 0 && i < e.mapMon.length && (e.mapMon[i] = o);
108
+ }
109
+ function _e(e, t) {
110
+ return e.bg[e.blkmap[t] ?? t] ?? e.bg[h];
111
+ }
112
+ function J(e, t) {
113
+ return e.bg[t] ?? e.bg[h];
114
+ }
115
+ function Qe(e, t, s = Math.random) {
116
+ return {
117
+ // 256 VGA colors x 3 (r, g, b), each 0..63.
118
+ palette: new Uint8Array(768),
119
+ map: e.blocks.slice(),
120
+ mapMon: e.mons.slice(),
121
+ bg: O(void 0, h),
122
+ mblk: O(void 0, z),
123
+ cblk: O(void 0, T),
124
+ mon: [],
125
+ chr: void 0,
126
+ noMons: !1,
127
+ ci: ve(),
128
+ mi: Array.from({ length: v }, Bt),
129
+ mm: e.monsters.map((o) => ({ monnum: o.monnum, curx: o.curx, cury: o.cury })),
130
+ firstEmptyMM: 0,
131
+ monsolid: 0,
132
+ mmSolid: v,
133
+ blkMon: [],
134
+ birthFlag: new Uint8Array(h + 1),
135
+ nxtchg: new Array(h).fill(0),
136
+ blkmap: Uint8Array.from({ length: h }, (o, i) => i),
137
+ mx: 0,
138
+ my: 0,
139
+ scroll: Dt(),
140
+ clock: 1,
141
+ keydn: new Uint8Array(128),
142
+ keystack: Array.from({ length: ke + 1 }, () => ({ key: 255, seq: 0, frame: 0 })),
143
+ keystkptr: 0,
144
+ curkey: 0,
145
+ gclk: 1,
146
+ joyOldTime: 1,
147
+ joyOldBut: 0,
148
+ sound: t,
149
+ rand: s,
150
+ jstickOn: !0
151
+ };
152
+ }
153
+ const j = (e, t) => Math.floor(e.rand() * t), q = (e) => e > 0 ? 1 : e < 0 ? -1 : 0, ee = (e) => e << 16 >> 16, De = (e) => e & 65535;
154
+ function H(e) {
155
+ return e.chr.sequences[e.chr.cseq] ?? e.chr.sequences[0];
156
+ }
157
+ function Ft(e) {
158
+ const t = H(e);
159
+ return t.frames[Math.max(0, Math.min(t.frames.length - 1, e.chr.cframe))];
160
+ }
161
+ function We(e, t) {
162
+ const { chr: s, ci: o } = e;
163
+ if (t < 128) {
164
+ if (e.keydn[t] === 0) {
165
+ for (let i = 0; i < C; i++)
166
+ if (s.sequences[i].key >> 8 === t && s.cseq !== Q && !H(e).ground && o.meter[i] > 0 && o.seqon[i] && e.keystkptr < ke) {
167
+ e.keystack[e.keystkptr] = { key: e.curkey, seq: s.cseq, frame: s.cframe }, e.keystkptr++, e.keystkptr >= ke && Je(e), s.cseq = i, s.cframe = -1, o.nextAni = e.clock, e.curkey = t;
168
+ break;
169
+ }
170
+ e.keydn[t] = 1;
171
+ }
172
+ return;
173
+ }
174
+ if (t &= 127, e.keydn[t] !== 0) {
175
+ e.keydn[t] = 0;
176
+ for (let i = 0; i < e.keystkptr; i++) e.keystack[i].key === t && (e.keystack[i].key = 255);
177
+ if (t === e.curkey && e.keystkptr > 0 && !H(e).ground) {
178
+ for (; e.keystkptr > 0 && e.keystack[e.keystkptr - 1].key === 255; ) e.keystkptr--;
179
+ const i = e.keystack[Math.max(0, e.keystkptr - 1)];
180
+ e.curkey = i.key, s.cseq = i.seq, s.cframe = i.frame, o.update = !0, o.nextAni = e.clock, e.keystkptr = Math.max(0, e.keystkptr - 1);
181
+ }
182
+ s.cseq === K && (s.cframe = 0);
183
+ }
184
+ }
185
+ function Je(e) {
186
+ let t = 0;
187
+ for (let s = 0; s < e.keystkptr; s++)
188
+ e.keystack[s].key !== 255 && (e.keystack[t++] = { ...e.keystack[s] });
189
+ e.keystkptr = t;
190
+ }
191
+ function Ze(e) {
192
+ e.keystkptr >= e.keystack.length && Je(e), e.keystkptr >= e.keystack.length && (e.keystkptr = e.keystack.length - 1), e.keystack[e.keystkptr] = { key: e.curkey, seq: e.chr.cseq, frame: e.chr.cframe }, e.keystkptr++;
193
+ }
194
+ function xe(e, t) {
195
+ const { chr: s, ci: o } = e;
196
+ for (let i = 0; i < e.keystkptr; i++) e.keystack[i].key === t && (e.keystack[i].key = 255);
197
+ for (; e.keystkptr > 0 && e.keystack[e.keystkptr - 1].key === 255; ) e.keystkptr--;
198
+ if (e.keystkptr === 0)
199
+ e.curkey = 0, s.cseq = K, s.cframe = 0;
200
+ else {
201
+ const i = e.keystack[e.keystkptr - 1];
202
+ e.curkey = i.key, s.cseq = i.seq, s.cframe = i.frame, e.keystkptr--, s.cseq === K && (s.cframe = 0);
203
+ }
204
+ o.update = !0, o.nextAni = e.clock;
205
+ }
206
+ function Lt(e) {
207
+ e.keydn.fill(0);
208
+ for (const t of e.keystack)
209
+ t.seq = 0, t.frame = 0, t.key = 255;
210
+ e.keystkptr = 0, e.curkey = 0;
211
+ }
212
+ const jt = 0, ge = 1, It = 2, Kt = 3, Gt = 4, Xt = 5, Yt = 6, Ut = 7, $t = 8;
213
+ function E(e, t) {
214
+ return t >= 0 && t < Z ? e.sound.play(t) : !1;
215
+ }
216
+ function we(e) {
217
+ return e.x >= 1 && e.y >= 1 && e.x <= 320 - c && e.y <= 200 - c;
218
+ }
219
+ function et(e, t, s, o) {
220
+ return o.x = t - e.mx, e.mx > t && (o.x += m), o.x = o.x * c - e.scroll.nx, o.y = s - e.my, e.my > s && (o.y += k), o.y = o.y * c - e.scroll.ny, we(o);
221
+ }
222
+ function X(e) {
223
+ const { chr: t, ci: s } = e, o = { blks: Array.from({ length: 6 }, () => [m, k]), blknum: new Array(6).fill(h) }, i = (a, l, d) => {
224
+ o.blks[a] = [l, d], o.blknum[a] = e.blkmap[ce(e, l, d)] ?? h;
225
+ }, r = t.x[0], n = t.y[0];
226
+ if (s.topthere) {
227
+ const a = n - 1 < 0 ? n - 1 + k : n - 1;
228
+ i(0, r, a), t.x[1] > 0 && i(1, (r + 1) % m, a);
229
+ }
230
+ return i(2, r, n), t.x[1] > 0 && i(3, (r + 1) % m, n), t.y[1] > 0 && i(4, r, (n + 1) % k), t.x[1] > 0 && t.y[1] > 0 && i(5, (r + 1) % m, (n + 1) % k), o;
231
+ }
232
+ function tt(e, t, s) {
233
+ for (let o = 0; o < C; o++) e.chr.sequences[o].bloc === t && (e.ci.seqon[o] = s);
234
+ }
235
+ function st(e, t) {
236
+ const { ci: s, chr: o } = e;
237
+ let i = !1;
238
+ if ((t.effect >= 20 || t.effect === 3) && s.meter[t.effect] + t.eamt <= 0) return 0;
239
+ if (o.cseq !== Q && (t.chHitPt <= 0 || De(s.hitpts + t.chHitPt) < N ? s.hitpts = ee(s.hitpts + t.chHitPt) : s.hitpts = N - 1, t.chHitPt > 0 ? i = E(e, jt) : t.chHitPt < 0 && o.cseq !== I && (Ze(e), s.nextAni = e.clock, o.cseq = I, o.cframe = -1, e.curkey = 255, o.sequences[I].sound < Z && o.sequences[I].sound >= 0 && (i = E(e, o.sequences[I].sound))), s.hitpts <= 0 && (s.nextAni = e.clock, o.cseq = Q, o.cframe = -1, e.curkey = 0)), t.effect === 1 && (t.eamt > 0 && (i = E(e, Gt)), s.lives = ee(s.lives + t.eamt)), t.effect > 2 && s.meter[t.effect] !== N && t.effect < s.meter.length) {
240
+ i || (t.effect === 3 ? t.eamt > 0 ? i = E(e, It) : t.eamt < 0 && (i = E(e, Kt)) : t.eamt > 0 ? i = E(e, Ut) : t.eamt < 0 && (i = E(e, $t)));
241
+ const r = s.meter[t.effect];
242
+ De(r + t.eamt) < N ? r + t.eamt < -1 * (N - 128) ? s.meter[t.effect] = -1 * (N - 128) : s.meter[t.effect] = ee(r + t.eamt) : s.meter[t.effect] = N - 1;
243
+ }
244
+ return s.score += t.scorePts, i || (t.scorePts > 0 ? i = E(e, Xt) : t.scorePts < 0 && (i = E(e, Yt))), i ? 2 : 1;
245
+ }
246
+ function ot(e, t, s, o) {
247
+ if (t === m) return 1;
248
+ const i = e.bg[o] ?? e.bg[h];
249
+ return st(e, i) ? ((o !== i.touchBl || i.obj) && e.onTouched?.(t, s, o), o !== i.touchBl && et(e, t, s, { x: 0, y: 0 }) && (e.map[s * m + t] = i.touchBl), 1) : 2;
250
+ }
251
+ function Vt(e) {
252
+ const t = X(e);
253
+ for (let s = 0; s < 6; s++)
254
+ (e.bg[t.blknum[s]] ?? e.bg[h]).obj || ot(e, t.blks[s][0], t.blks[s][1], t.blknum[s]);
255
+ }
256
+ const _t = { x: 0, y: 0, pic: 0, orient: 0 };
257
+ function B(e, t, s) {
258
+ return s >= 0 ? e.march[t]?.[s] ?? _t : t === 1 ? e.march[0][Me - 1] : { x: e.end, y: e.towards, pic: e.close[0], orient: e.close[1] };
259
+ }
260
+ function Te(e) {
261
+ e.delta = { x: 0, y: 0 }, e.scrPos = { x: b, y: b }, e.oldPos = { ...e.scrPos }, e.picDrawn = !1, e.curx[1] = 0, e.cury[1] = 0, e.curPic = -1, e.offl = -1, e.offs = 0, e.curMarch = W, e.orient = 0, e.dest = 0;
262
+ }
263
+ function ne(e, t) {
264
+ const s = e.mi[t];
265
+ if (s.curPic >= 0 && s.curPic < U) {
266
+ const i = e.mon[e.mm[t].monnum]?.pic[s.curPic][0] ?? z;
267
+ return i < z && i >= 0 ? i : z;
268
+ }
269
+ return z;
270
+ }
271
+ function Qt(e, t) {
272
+ const s = et(e, t.curx[0], t.cury[0], t.scrPos);
273
+ return s && (t.scrPos.x += t.curx[1], t.scrPos.y += t.cury[1]), s;
274
+ }
275
+ function se(e, t, s) {
276
+ let o = t - e.curx[0], i = s - e.cury[0];
277
+ o > m / 2 && (o -= m), o < -m / 2 && (o += m), i > k / 2 && (i -= k), i < -k / 2 && (i += k), e.delta = { x: o * c, y: i * c };
278
+ }
279
+ function te(e, t) {
280
+ const s = { x: 0, y: 0 }, o = Math.abs(e.delta.x), i = Math.abs(e.delta.y);
281
+ if (o >= i)
282
+ for (let r = 0; r < t; r++) {
283
+ if (e.offl >= o) {
284
+ e.offl = -1;
285
+ break;
286
+ }
287
+ e.offl++, s.x += q(e.delta.x), e.offs += i, e.offs >= o && (e.offs -= o, s.y += q(e.delta.y));
288
+ }
289
+ else
290
+ for (let r = 0; r < t; r++) {
291
+ if (e.offl >= i) {
292
+ e.offl = -1;
293
+ break;
294
+ }
295
+ e.offl++, e.offs += o, s.y += q(e.delta.y), e.offs >= i && (e.offs -= i, s.x += q(e.delta.x));
296
+ }
297
+ return s;
298
+ }
299
+ function Ee(e) {
300
+ e.y < 0 ? e.y += k : e.y >= k && (e.y -= k), e.x < 0 ? e.x += m : e.x >= m && (e.x -= m);
301
+ }
302
+ const G = (e, t, s) => _e(e, ce(e, t, s)).solid;
303
+ function Fe(e, t, s, o) {
304
+ let i, r;
305
+ t.curx[1] + s.x < 0 ? (o.x--, i = x, r = 1) : (o.x++, i = g, r = 3), Ee(o);
306
+ let n = G(e, o.x, o.y);
307
+ return t.cury[1] + s.y > c / 4 && (n |= G(e, o.x, (o.y + 1) % k)), t.cury[1] + s.y < -c / 4 && (n |= G(e, o.x, (o.y - 1 + k) % k)), n & i ? (s.x = -t.curx[1], o.x += r === 1 ? 1 : -1, !0) : !1;
308
+ }
309
+ function Le(e, t, s, o) {
310
+ let i, r;
311
+ t.cury[1] + s.y < 0 ? (o.y--, i = S, r = 1) : (o.y++, i = p, r = 3), Ee(o);
312
+ let n = G(e, o.x, o.y);
313
+ return t.curx[1] + s.x > c / 4 && (n |= G(e, (o.x + 1) % m, o.y)), t.curx[1] + s.x < -c / 4 && (n |= G(e, (o.x - 1 + m) % m, o.y)), n & i ? (s.y = -t.cury[1], o.y += r === 1 ? 1 : -1, !0) : !1;
314
+ }
315
+ function Wt(e, t, s) {
316
+ const o = { x: t.curx[0], y: t.cury[0] };
317
+ let i = !1;
318
+ return Math.abs(s.x) > Math.abs(s.y) ? (i = Fe(e, t, s, o) || i, s.y && (i = Le(e, t, s, o) || i)) : (s.y && (i = Le(e, t, s, o) || i), s.x && (i = Fe(e, t, s, o) || i)), i;
319
+ }
320
+ function Jt(e, t) {
321
+ const s = e.mi[t];
322
+ return Math.abs(s.curx[0] - e.chr.x[0]) < Ct && Math.abs(s.cury[0] - e.chr.y[0]) < Ot;
323
+ }
324
+ function le(e, t, s, o, i) {
325
+ if (t >= v) {
326
+ let r = e.firstEmptyMM;
327
+ for (let n = 0; n <= v; n++) {
328
+ if (r >= 0 && r < v && e.mm[r].monnum === F) {
329
+ t = r;
330
+ break;
331
+ }
332
+ r++, r >= v && (r = 0);
333
+ }
334
+ e.firstEmptyMM = Math.max(0, r);
335
+ }
336
+ if (t < v && t >= 0) {
337
+ e.mm[t].monnum = s & 255;
338
+ const r = e.mi[t];
339
+ return r.birthTime = e.clock, r.nextAni = e.clock, r.nextMove = e.clock, r.curx[0] = o, r.cury[0] = i, r.target = { x: o, y: i }, t;
340
+ }
341
+ return v;
342
+ }
343
+ function R(e, t) {
344
+ const s = e.mon[e.mm[t].monnum];
345
+ if (!s || s.end === -2) return !1;
346
+ if (s.newmon === F || s.newmon < 0)
347
+ return e.mm[t].monnum = F, t < e.firstEmptyMM && (e.firstEmptyMM = Math.max(0, t - 1)), !0;
348
+ const o = e.mi[t];
349
+ return le(e, t, s.newmon, o.curx[0], o.cury[0]), o.offl = -1, o.curMarch = W, o.dest = 0, o.curPic = 0, o.fromchar > 0 && o.fromchar++, !1;
350
+ }
351
+ function it(e) {
352
+ e.birthFlag.fill(0);
353
+ for (const t of e.blkMon)
354
+ t.nexttime <= e.clock && (t.nexttime += e.bg[t.blnum].birthTime, e.birthFlag[t.blnum] = 1);
355
+ for (let t = e.mx - oe / 2; t < e.mx + oe * 3 / 2; t++)
356
+ for (let s = e.my - ie / 2; s < e.my + ie * 3 / 2; s++) {
357
+ const o = (t + m) % m, i = (s + k) % k, r = e.blkmap[ce(e, o, i)] ?? h;
358
+ if (!e.birthFlag[r]) continue;
359
+ const n = le(e, v, e.bg[r].birthMon, o, i);
360
+ n < v && (e.mi[n].fromchar = 0, Te(e.mi[n]));
361
+ }
362
+ }
363
+ function Zt(e, t, s, o) {
364
+ const i = le(e, v, o, t, s);
365
+ if (i >= v) return;
366
+ const r = e.mi[i];
367
+ Te(r), r.fromchar = 1, r.curx[1] = e.chr.x[1], r.cury[1] = e.chr.y[1], r.offl = -1;
368
+ const n = e.mon[o & 255];
369
+ if (n && n.towards < 64) {
370
+ const { netx: a, nety: l } = e.ci;
371
+ r.delta = { x: a * c, y: l * c }, Math.abs(a) - Math.abs(l) > 0 ? r.orient = a < 0 ? 4 : 0 : r.orient = l < 0 ? 3 : 1;
372
+ }
373
+ }
374
+ function wt(e, t, s) {
375
+ const o = e.mi[t], i = e.mon[s];
376
+ if (o.dest === Me || B(i, o.curMarch, o.dest).pic === 0) {
377
+ if (i.end === -1 && o.curMarch === W && R(e, t)) return !0;
378
+ o.dest = 0, o.curMarch = W;
379
+ }
380
+ const r = B(i, o.curMarch, o.dest), n = { x: r.x + o.curx[0], y: r.y + o.cury[0] };
381
+ if (o.dest !== 0) {
382
+ const a = B(i, o.curMarch, o.dest - 1);
383
+ n.x -= a.x, n.y -= a.y;
384
+ }
385
+ return o.orient = r.orient, Ee(n), o.target = n, se(o, n.x, n.y), o.offl = 0, o.offs = 0, o.dest++, !1;
386
+ }
387
+ function pe(e, t, s, o, i, r) {
388
+ const n = Math.abs(o - e), a = Math.abs(i - t);
389
+ if (o -= n, e -= n, i -= a, t -= a, n > c || a > c) return !1;
390
+ const l = (f) => f >= 0 && f < s.length ? s[f] : P, d = (f) => f >= 0 && f < r.length ? r[f] : P;
391
+ let u, y;
392
+ if (o >= e && i >= t) {
393
+ u = c * a, y = 0;
394
+ for (let f = 0; f < t + c - i; f++) {
395
+ u += n;
396
+ for (let M = 0; M < e + c - o; M++, u++, y++) if (l(u) !== P && d(y) !== P) return !0;
397
+ y += n;
398
+ }
399
+ return !1;
400
+ }
401
+ if (o >= e && i <= t) {
402
+ u = 0, y = a * c;
403
+ for (let f = 0; f < i + c - t; f++) {
404
+ u += n;
405
+ for (let M = 0; M < e + c - o; M++, u++, y++) if (l(u) !== P && d(y) !== P) return !0;
406
+ y += n;
407
+ }
408
+ return !1;
409
+ }
410
+ if (o <= e && i >= t) {
411
+ y = 0, u = a * c;
412
+ for (let f = 0; f < t + c - i; f++) {
413
+ y += n;
414
+ for (let M = 0; M < o + c - e; M++, u++, y++) if (l(u) !== P && d(y) !== P) return !0;
415
+ u += n;
416
+ }
417
+ return !1;
418
+ }
419
+ y = c * a, u = 0;
420
+ for (let f = 0; f < i + c - t; f++) {
421
+ y += n;
422
+ for (let M = 0; M < o + c - e; M++, u++, y++) if (l(u) !== P && d(y) !== P) return !0;
423
+ u += n;
424
+ }
425
+ return !1;
426
+ }
427
+ function es(e, t) {
428
+ const s = e.mi[t], { ci: o } = e;
429
+ if (s.scrPos.x === b) return !1;
430
+ const i = Math.min(s.scrPos.x, o.scrx), r = Math.min(s.scrPos.y, o.scry), n = { x: o.scrx - i, y: o.scry - r }, a = { x: s.scrPos.x - i, y: s.scrPos.y - r }, l = { x: Math.max(n.x, a.x), y: Math.max(n.y, a.y) };
431
+ let d = !1;
432
+ if (a.x <= n.x + c && a.x + c >= n.x && a.y <= n.y + c && a.y + c * 2 >= n.y) {
433
+ let u = ne(e, t);
434
+ if (u >= z) return !1;
435
+ const y = Ft(e), f = e.mblk[u].pixels;
436
+ y.pic2 < T && (d = pe(n.x, n.y, e.cblk[y.pic2].pixels, a.x, a.y, f)), y.pic1 < T && (d = pe(n.x, n.y, e.cblk[y.pic1].pixels, a.x, a.y + c, f) || d), d && (u = e.mblk[u].solid, u > 0 && (l.x >= l.y ? e.monsolid |= n.x === 0 ? x & u : g & u : e.monsolid |= n.y === 0 ? S & u : p & u, e.mmSolid = t)), e.monsolid & x && e.monsolid & g && (e.monsolid |= n.y === 0 ? S & u : p & u), e.monsolid & S && e.monsolid & p && (e.monsolid |= n.x === 0 ? x & u : g & u);
437
+ }
438
+ return d;
439
+ }
440
+ function ts(e, t, s, o) {
441
+ const i = e.mm[t].monnum, r = e.mm[s].monnum;
442
+ if (i >= F || r >= F) return s;
443
+ const n = e.mon[i], a = e.mon[r];
444
+ if (n.power === a.power) return s;
445
+ const l = o & 1 ? c : 0, d = o & 2 ? c : 0, u = ne(e, t);
446
+ if (u >= z) return s;
447
+ const y = ne(e, s);
448
+ if (y >= z) return t;
449
+ const f = e.mi[t], M = e.mi[s];
450
+ return pe(f.curx[1] + l, f.cury[1] + d, e.mblk[u].pixels, M.curx[1], M.cury[1], e.mblk[y].pixels) ? n.power < a.power ? (R(e, t), M.fromchar > 0 ? (e.ci.score += n.upscore, E(e, ge), R(e, s), v) : s) : (R(e, s), f.fromchar > 0 ? (e.ci.score += a.upscore, E(e, ge), R(e, t), v) : t) : s;
451
+ }
452
+ function nt(e) {
453
+ const { clock: t, chr: s } = e;
454
+ for (let o = 0; o < v; o++) {
455
+ const i = e.mm[o].monnum;
456
+ if (i >= F) continue;
457
+ const r = e.mon[i], n = e.mi[o];
458
+ if (!r || (t >= n.nextAni && (n.curPic++, (n.curPic >= U || r.pic[n.curPic][0] >= z) && (n.curPic = r.pic[0][0] < z ? 0 : U), n.nextAni = n.curPic < U ? t + r.pic[n.curPic][1] : t + 1e5), t < n.nextMove)) continue;
459
+ const a = Math.trunc((t - n.nextMove + 1) / Ne);
460
+ n.nextMove = t + Ne, r.activate !== 0 && n.curMarch !== L && Jt(e, o) && (n.curMarch = L, n.dest = 1);
461
+ let l;
462
+ if (n.curMarch === L && r.activate === 2) {
463
+ const f = B(r, L, n.dest);
464
+ n.target = { x: (f.x + s.x[0] + m) % m, y: (f.y + s.y[0] + k) % k }, se(n, n.target.x, n.target.y), n.offl = 0, l = te(n, f.pic * a), n.offl === -1 && (n.dest++, n.offs = 0, n.dest === Me || B(r, L, n.dest).pic === 0 ? (n.curMarch = W, n.dest = 0) : n.orient = B(r, L, n.dest).orient);
465
+ } else if (r.towards === 0) {
466
+ if (n.offl === -1 && wt(e, o, i)) continue;
467
+ l = te(n, B(r, n.curMarch, n.dest - 1).pic * a);
468
+ } else r.towards < 64 ? (n.fromchar || (se(n, s.x[0], s.y[0]), n.delta.x += s.x[1] - n.curx[1], n.delta.y += s.y[1] - n.cury[1], r.towards < 0 && (n.delta = { x: -n.delta.x, y: -n.delta.y }), n.delta.x < 0 ? n.orient |= 4 : n.orient = 0), l = te(n, Math.abs(r.towards) * a)) : (n.curx[0] === n.target.x && n.cury[0] === n.target.y && (j(e, 2) ? n.target.x = (n.target.x + j(e, 7) + 5) % m : (n.target.x -= j(e, 7) + 5, n.target.x < 0 && (n.target.x += m)), j(e, 2) ? n.target.y = (n.target.y + j(e, 7) + 5) % k : (n.target.y -= j(e, 7) + 5, n.target.y < 0 && (n.target.y += k)), se(n, n.target.x, n.target.y), n.offl = 0, n.offs = 0), l = te(n, (r.towards >> 6) * a));
469
+ if (r.thru && Wt(e, n, l) && n.fromchar > 0 && R(e, o)) continue;
470
+ for (l.x === 0 && l.y === 0 ? n.target = { x: n.curx[0], y: n.cury[0] } : (n.curx[1] += l.x, n.cury[1] += l.y), He(e, n.curx[0], n.cury[0]) === o && Be(e, n.curx[0], n.cury[0], v); n.curx[1] >= c; )
471
+ n.curx[1] -= c, n.curx[0]++;
472
+ for (; n.curx[1] < 0; )
473
+ n.curx[1] += c, n.curx[0]--;
474
+ for (; n.cury[1] >= c; )
475
+ n.cury[1] -= c, n.cury[0]++;
476
+ for (; n.cury[1] < 0; )
477
+ n.cury[1] += c, n.cury[0]--;
478
+ if (n.curx[0] < 0 && (n.curx[0] += m), n.cury[0] < 0 && (n.cury[0] += k), n.curx[0] >= m && (n.curx[0] -= m), n.cury[0] >= k && (n.cury[0] -= k), Qt(e, n) || (n.scrPos = { x: b, y: b }), n.curPic >= 0 && n.curPic < U && es(e, o) && n.fromchar !== 1) {
479
+ const f = ne(e, o), M = st(e, e.mblk[f]) - 1;
480
+ if (e.mon[e.mm[o].monnum]?.power < Rt && R(e, o)) {
481
+ M || E(e, ge);
482
+ continue;
483
+ }
484
+ }
485
+ let d = o;
486
+ const u = n.curx[0], y = n.cury[0];
487
+ for (const [f, M, ht] of [
488
+ [0, 0, 0],
489
+ [1, 0, 1],
490
+ [1, 1, 3],
491
+ [0, 1, 2]
492
+ ]) {
493
+ const Pe = He(e, u + f, y + M);
494
+ Pe < v && (d = ts(e, Pe, o, ht));
495
+ }
496
+ d < v && Be(e, e.mi[d].curx[0], e.mi[d].cury[0], d), r.end > 0 && n.birthTime + r.end <= t && R(e, o);
497
+ }
498
+ }
499
+ function fe(e) {
500
+ const { chr: t } = e, s = t.sequences[t.cseq] ?? t.sequences[0];
501
+ if (t.cframe >= 0 && t.cframe < Y) return s.frames[t.cframe];
502
+ if (t.cframe >= Y) return { ...s.frames[Y - 1], pic2: T + 1 };
503
+ const o = t.sequences[t.cseq - 1];
504
+ if (!o) return { x: 0, y: 0, orient: 0, pic1: 0, pic2: 0, pause: 0, extra: new Uint8Array(5) };
505
+ const i = o.frames[Y - 1].extra, r = (n) => n & 255;
506
+ return {
507
+ x: (i[3] | i[4] << 8) << 16 >> 16,
508
+ y: o.key << 16 >> 16,
509
+ orient: r(o.sound) | r(o.on) << 8,
510
+ pic1: r(o.bloc) | r(o.ground) << 8,
511
+ pic2: r(o.jstkBut) | r(o.jstkMov) << 8,
512
+ pause: r(o.norepeat) | r(o.momentum) << 8,
513
+ extra: new Uint8Array(5)
514
+ };
515
+ }
516
+ function je(e) {
517
+ const { chr: t } = e;
518
+ for (; t.x[1] < 0; )
519
+ t.x[1] += c, t.x[0]--;
520
+ for (; t.x[1] >= c; )
521
+ t.x[1] -= c, t.x[0]++;
522
+ for (; t.y[1] < 0; )
523
+ t.y[1] += c, t.y[0]--;
524
+ for (; t.y[1] >= c; )
525
+ t.y[1] -= c, t.y[0]++;
526
+ }
527
+ function ue(e) {
528
+ const { chr: t } = e;
529
+ t.x[0] >= m && (t.x[0] -= m), t.x[0] < 0 && (t.x[0] += m), t.y[0] >= k && (t.y[0] -= k), t.y[0] < 0 && (t.y[0] += k);
530
+ }
531
+ function ss(e, t) {
532
+ const { chr: s } = e, o = (n, a, l) => {
533
+ const d = n - a, u = d > 0 ? -(l - n + a) : l - a + n;
534
+ return Math.abs(u) > Math.abs(d) ? d : u;
535
+ }, i = -o(e.mx, s.x[0], m), r = -o(e.my, s.y[0], k);
536
+ t.tx < 0 && (i < 2 && s.x[1] <= Math.abs(t.tx) && (t.tx = -s.x[1]), i < 1 && (t.tx = 0)), i > oe - 2 && t.tx > 0 && (t.tx = 0), t.ty < 0 && (r < 2 && s.y[1] <= Math.abs(t.ty) && (t.ty = -s.y[1]), r < 1 && (t.ty = 0)), r > ie - 2 && t.ty > 0 && (t.ty = 0);
537
+ }
538
+ const A = (e, t) => J(e, t).solid;
539
+ function os(e, t) {
540
+ const { chr: s } = e, o = [0, 0, 0, 0], i = t.blks[0][0] !== m ? 0 : 2;
541
+ return t.blknum[i + 1] !== h && (o[1] |= A(e, t.blknum[i + 1]) & S), o[0] |= A(e, t.blknum[i]) & x, i === 0 && (o[0] |= A(e, t.blknum[2]) & x), t.blknum[4] !== h && (t.blknum[5] !== h && (o[3] |= A(e, t.blknum[5]) & p), o[3] & p || (o[2] |= A(e, t.blknum[4]) & x)), o[0] & x && !(o[2] & x) && s.y[1] > c * 2 / 4 && (s.y[1] = c), !(o[0] & x) && o[2] & x && s.y[1] < c / 2 && (s.y[1] = 0), o[0] & x || o[2] & x ? g : 0;
542
+ }
543
+ function is(e, t) {
544
+ const { chr: s } = e, o = [0, 0, 0, 0], i = t.blks[0][0] !== m ? 0 : 2;
545
+ return t.blknum[i + 1] !== h && (t.blknum[i] !== h && (o[0] |= A(e, t.blknum[i]) & S), o[0] & S || (o[1] |= A(e, t.blknum[i + 1]) & g)), i === 0 && (o[1] |= A(e, t.blknum[3]) & g), t.blknum[5] !== h && (t.blknum[4] !== h && (o[2] |= A(e, t.blknum[4]) & p), o[2] & p || (o[3] |= A(e, t.blknum[5]) & g)), o[1] & g && !(o[3] & g) && s.y[1] > c * 2 / 4 && (s.y[1] = c), !(o[1] & g) && o[3] & g && s.y[1] < c / 2 && (s.y[1] = 0), o[1] & g || o[3] & g ? x : 0;
546
+ }
547
+ function ns(e, t) {
548
+ const { chr: s } = e, o = [0, 0, 0, 0], i = t.blks[0][0] !== m ? 0 : 2;
549
+ return t.blknum[i] !== h && (t.blknum[4] !== h && (o[2] |= A(e, t.blknum[4]) & x), o[2] & x || (o[0] |= A(e, t.blknum[i]) & S)), t.blknum[i + 1] !== h && (t.blknum[5] !== h && (o[3] |= A(e, t.blknum[5]) & g), o[3] & g || (o[1] |= A(e, t.blknum[i + 1]) & S)), o[0] & S && !(o[1] & S) && s.x[1] > c * 2 / 4 && (s.x[1] = c), !(o[0] & S) && o[1] & S && s.x[1] < c / 2 && (s.x[1] = 0), o[0] & S || o[1] & S ? p : 0;
550
+ }
551
+ function rs(e, t) {
552
+ const { chr: s } = e, o = [0, 0, 0, 0], i = t.blks[0][0] !== m ? 0 : 2;
553
+ return t.blknum[4] !== h && (o[2] |= A(e, t.blknum[4]) & x, t.blknum[i] !== h && (o[0] |= A(e, t.blknum[i]) & x), o[2] & x && o[0] & x || (o[2] |= A(e, t.blknum[4]) & p)), t.blknum[5] !== h && (t.blknum[i + 1] !== h && (o[1] |= A(e, t.blknum[i + 1]) & g), o[3] |= A(e, t.blknum[5]) & g, o[1] & g & o[3] & g || (o[3] |= A(e, t.blknum[5]) & p)), o[2] & p && !(o[3] & p) && s.x[1] > c * 2 / 4 && (s.x[1] = c), !(o[2] & p) && o[3] & p && s.x[1] < c / 2 && (s.x[1] = 0), o[2] & p || o[3] & p ? S : 0;
554
+ }
555
+ function Ie(e, t, s, o) {
556
+ let i = 0;
557
+ return s > 0 && (i = rs(e, o)), s < 0 && (i = ns(e, o)), t > 0 && (i |= is(e, o)), t < 0 && (i |= os(e, o)), i;
558
+ }
559
+ function rt(e) {
560
+ const { chr: t } = e;
561
+ let s = t.y[0] + (t.y[1] > c / 2 ? 1 : 0), o = t.x[0] + (t.x[1] > c / 2 ? 1 : 0);
562
+ return s >= k && (s -= k), o >= m && (o -= m), _e(e, ce(e, o, s)).grav;
563
+ }
564
+ function Ke(e, t) {
565
+ const { ci: s } = e, o = rt(e);
566
+ (e.monsolid & S || t & S) && s.gravy > 0 && (s.gravy = 0), (e.monsolid & p || t & p) && s.gravy < 0 && (s.gravy = 0), (e.monsolid & x || t & x) && s.gravx > 0 && (s.gravx = 0), (e.monsolid & g || t & g) && s.gravx < 0 && (s.gravx = 0), H(e).momentum || (o & S || o & p || (s.gravy = Math.trunc(s.gravy * 5 / 6)), o & g || o & x || (s.gravx = Math.trunc(s.gravx * 5 / 6)));
567
+ }
568
+ function cs(e, t = !1) {
569
+ if (t)
570
+ return e.gclk = e.clock, !0;
571
+ if (e.clock < e.gclk + Nt) return !1;
572
+ e.gclk = e.clock;
573
+ const { ci: s } = e, o = rt(e);
574
+ o & 4 && (s.gravy += 1), o & 1 && (s.gravy -= 1), o & 2 && (s.gravx += 1), o & 8 && (s.gravx -= 1);
575
+ const i = s.gravx !== 0 || s.gravy !== 0, r = V * 4;
576
+ return s.gravx = Math.max(-r, Math.min(r, s.gravx)), s.gravy = Math.max(-r, Math.min(r, s.gravy)), i;
577
+ }
578
+ function ls(e, t = !1) {
579
+ if (t)
580
+ return e.joyOldTime = e.clock, !1;
581
+ if (!e.jstickOn || !e.joystick || e.joyOldTime + 1 > e.clock) return !1;
582
+ e.joyOldTime = e.clock;
583
+ const s = e.joystick();
584
+ if (!s) return !1;
585
+ const { chr: o, ci: i } = e;
586
+ if (s.pos === 0 && s.buttons === 0)
587
+ return e.joyOldBut = 0, e.curkey === _ && xe(e, _), !1;
588
+ if (o.cseq === Q) return !1;
589
+ for (let r = 3; r < C; r++) {
590
+ const n = o.sequences[r];
591
+ if (n.jstkMov !== 0 && (n.jstkMov === 9 || n.jstkMov === s.pos) && !H(e).ground && i.meter[r] > 0 && i.seqon[r] && (n.jstkBut === 0 || s.buttons === 0 && n.jstkBut === 4 || s.buttons !== e.joyOldBut && n.jstkBut === s.buttons))
592
+ return e.joyOldBut = s.buttons, o.cseq !== r ? (e.curkey !== _ && Ze(e), e.curkey = _, o.cframe = -1, o.cseq = r, i.nextAni = e.clock, n.sound < Z && n.sound >= 0 && E(e, n.sound), !0) : !1;
593
+ }
594
+ return !1;
595
+ }
596
+ function as(e) {
597
+ const { ci: t } = e;
598
+ if (t.inv[D - 1] !== h) return !1;
599
+ let s = 0;
600
+ for (; s < D && t.inv[s] !== h; ) s++;
601
+ const o = X(e);
602
+ for (let i = 0; i < 6; i++)
603
+ if (!(o.blks[i][0] === m || !J(e, o.blknum[i]).obj) && ot(e, o.blks[i][0], o.blks[i][1], o.blknum[i]) !== 2)
604
+ return t.inv[s] = o.blknum[i], tt(e, o.blknum[i], !0), !0;
605
+ return !1;
606
+ }
607
+ async function fs(e, t) {
608
+ const { ci: s, chr: o } = e;
609
+ e.ci.topthere = !1, e.ci.bottomthere = !1;
610
+ let i = !1;
611
+ for (; ; ) {
612
+ const r = await t();
613
+ if (r < 0) break;
614
+ if (s.inv[r] !== h) {
615
+ e.map[o.y[0] * m + o.x[0]] = s.inv[r], tt(e, s.inv[r], !1);
616
+ for (let n = r; n < D - 1; n++) s.inv[n] = s.inv[n + 1];
617
+ s.inv[D - 1] = h, i = !0;
618
+ break;
619
+ }
620
+ }
621
+ return e.keydn[o.sequences[ye].key >> 8] = 0, i;
622
+ }
623
+ async function ct(e, t) {
624
+ const { ci: s, chr: o } = e;
625
+ let i = 0, r = 0, n = !1, a = 0;
626
+ s.scrx = s.nextx, s.scry = s.nexty;
627
+ const l = cs(e);
628
+ if (ls(e) && (s.update = !0), e.clock >= s.nextAni) {
629
+ const d = o.cframe, u = o.cseq;
630
+ if (o.cframe === -1) {
631
+ s.meter[o.cseq] < N && o.cseq > 4 && s.meter[o.cseq]--, o.cseq === ye && !await fs(e, t) && (o.cseq = K, e.keystkptr = 0, e.curkey = 0), o.cseq === qe && !as(e) && (o.cseq = K, e.keystkptr = 0, e.curkey = 0);
632
+ const f = H(e).sound;
633
+ f < Z && f >= 0 && E(e, f);
634
+ }
635
+ let y = 0;
636
+ do {
637
+ for (o.cframe === 0 && a++, o.cframe++; (fe(e).pic2 === T + 1 || o.cframe >= Y) && y++ < 1e3; ) {
638
+ if (o.cseq === Q)
639
+ return o.cframe--, !0;
640
+ const M = H(e);
641
+ s.meter[o.cseq] <= 0 && o.cseq > 4 || o.cseq === I || o.cseq === ye || o.cseq === qe || M.norepeat || e.keydn[M.key >> 8] === 0 && e.curkey !== _ || a > 1 ? (xe(e, e.curkey), a = 0) : (o.cframe = 0, s.meter[o.cseq] < N && o.cseq > 4 && s.meter[o.cseq]--, M.frames[0].pic2 === T + 1 && (o.cseq === K ? M.frames[0].pic2 = 0 : xe(e, e.curkey), a = 0));
642
+ }
643
+ const f = fe(e);
644
+ s.nextAni = e.clock + f.pause, f.pic2 === z && !e.noMons ? (Zt(e, o.x[0], o.y[0] + Math.trunc(f.y / c) - 1, f.pic1), r = 0) : (s.curtop = f.pic1, s.curbottom = f.pic2, H(e).momentum ? (s.gravx += f.x, s.gravy += f.y, (f.x !== 0 || f.y !== 0) && (s.netx = f.x, s.nety = f.y), i = 0, r = 0) : (i = f.x, r = f.y, (i !== 0 || r !== 0) && (n = !0, s.netx = i, s.nety = r)));
645
+ } while (fe(e).pic2 > T && y++ < 1e3);
646
+ (o.cseq !== u || o.cframe !== d) && (s.update = !0);
647
+ }
648
+ if (i += s.gravx, r += s.gravy, n || l || e.monsolid || s.update) {
649
+ const d = { cx: o.x[1], cy: o.y[1], x: o.x[0], y: o.y[0] }, u = { tx: Math.max(-V, Math.min(V, i)), ty: Math.max(-V, Math.min(V, r)) };
650
+ if (ss(e, u), i = u.tx, r = u.ty, o.x[1] += i, o.y[1] += r, je(e), ue(e), Vt(e), o.x[1] = d.cx, o.y[1] = d.cy, o.x[0] = d.x, o.y[0] = d.y, !e.noMons && e.mmSolid < v) {
651
+ const f = e.mi[e.mmSolid];
652
+ e.monsolid & x && !(e.monsolid & g) && (o.x[1] = f.curx[1], o.x[0] = f.curx[0] - 1, i = 0), e.monsolid & g && !(e.monsolid & x) && (o.x[1] = f.curx[1], o.x[0] = f.curx[0] + 1, i = 0), e.monsolid & p && !(e.monsolid & S) && (o.y[1] = f.cury[1], o.y[0] = f.cury[0] + 1, r = 0), e.monsolid & S && !(e.monsolid & p) && (o.y[1] = f.cury[1], o.y[0] = f.cury[0] - 1, r = 0);
653
+ }
654
+ o.x[1] += i, je(e), ue(e);
655
+ let y = Ie(e, i, 0, X(e));
656
+ for (Ke(e, y), y & x && (o.x[1] = 0), y & g && (o.x[0]++, o.x[1] = 0), o.y[1] += r; o.y[1] < 0; )
657
+ o.y[1] += c, o.y[0]--;
658
+ for (; o.y[1] >= c; )
659
+ o.y[1] -= c, o.y[0]++;
660
+ ue(e), y = Ie(e, 0, r, X(e)), Ke(e, y), y & S && (o.y[1] = 0), y & p && (o.y[0]++, o.y[1] = 0), us(e);
661
+ }
662
+ return !1;
663
+ }
664
+ function us(e) {
665
+ const { chr: t, ci: s } = e;
666
+ let o = e.mx < t.x[0] ? (t.x[0] - e.mx) * c : (m + (t.x[0] - e.mx)) * c;
667
+ o += t.x[1], s.nextx = o - e.scroll.nx;
668
+ let i = e.my < t.y[0] ? (t.y[0] - e.my) * c : (k + (t.y[0] - e.my)) * c;
669
+ i += t.y[1], s.nexty = i - e.scroll.ny;
670
+ }
671
+ function ze(e) {
672
+ const { ci: t } = e;
673
+ t.update = !1, t.scrx > b && (t.oldx = t.scrx, t.oldy = t.scry, t.topthere = t.curtop < T, t.bottomthere = t.curbottom < T);
674
+ }
675
+ const ds = { yellow: 623, red: 626, blue: 629, purple: 632, hsRed: 5626, hsBlue: 5629, hsGreen: 5632 }, lt = [
676
+ { id: "str.menu.play", group: "words", screen: "menu", label: "Play", safety: "safe", web: !0, kind: "text", offset: 153435, length: 4, stock: "Play" },
677
+ {
678
+ id: "str.menu.instructions",
679
+ group: "words",
680
+ screen: "menu",
681
+ label: "Read Instructions",
682
+ safety: "safe",
683
+ web: !0,
684
+ kind: "text",
685
+ offset: 153440,
686
+ length: 17,
687
+ stock: "Read Instructions"
688
+ },
689
+ {
690
+ id: "str.menu.storyline",
691
+ group: "words",
692
+ screen: "menu",
693
+ label: "Read Storyline",
694
+ safety: "safe",
695
+ web: !0,
696
+ kind: "text",
697
+ offset: 153458,
698
+ length: 14,
699
+ stock: "Read Storyline"
700
+ },
701
+ {
702
+ id: "str.menu.credits",
703
+ group: "words",
704
+ screen: "menu",
705
+ label: "See Credits",
706
+ safety: "safe",
707
+ web: !0,
708
+ kind: "text",
709
+ offset: 153473,
710
+ length: 11,
711
+ stock: "See Credits"
712
+ },
713
+ {
714
+ id: "str.menu.highScores",
715
+ group: "words",
716
+ screen: "menu",
717
+ label: "See Highest Scores",
718
+ safety: "safe",
719
+ web: !0,
720
+ kind: "text",
721
+ offset: 153485,
722
+ length: 18,
723
+ stock: "See Highest Scores"
724
+ },
725
+ { id: "str.menu.quit", group: "words", screen: "menu", label: "Quit", safety: "safe", web: !0, kind: "text", offset: 153504, length: 4, stock: "Quit" },
726
+ {
727
+ id: "str.menu.noInstructions",
728
+ group: "words",
729
+ screen: "menu",
730
+ label: "No instructions",
731
+ safety: "safe",
732
+ web: !0,
733
+ kind: "text",
734
+ offset: 153344,
735
+ length: 30,
736
+ stock: "No game-specific instructions."
737
+ },
738
+ {
739
+ id: "str.menu.noStoryline",
740
+ group: "words",
741
+ screen: "menu",
742
+ label: "No storyline",
743
+ safety: "safe",
744
+ web: !0,
745
+ kind: "text",
746
+ offset: 153375,
747
+ length: 27,
748
+ stock: "No game-specific storyline."
749
+ },
750
+ {
751
+ id: "str.menu.noCredits",
752
+ group: "words",
753
+ screen: "menu",
754
+ label: "No credits",
755
+ safety: "safe",
756
+ web: !0,
757
+ kind: "text",
758
+ offset: 153403,
759
+ length: 31,
760
+ stock: "No game-specific credits given."
761
+ },
762
+ {
763
+ id: "str.hiscore.title",
764
+ group: "words",
765
+ screen: "hiscores",
766
+ label: "Heading",
767
+ safety: "safe",
768
+ web: !0,
769
+ kind: "text",
770
+ offset: 157899,
771
+ length: 14,
772
+ stock: "Top Ten Scores"
773
+ },
774
+ {
775
+ id: "str.hiscore.latest",
776
+ group: "words",
777
+ screen: "hiscores",
778
+ label: "Your latest score",
779
+ safety: "caution",
780
+ web: !0,
781
+ kind: "format",
782
+ offset: 157923,
783
+ length: 23,
784
+ stock: "%10ld Your Latest Score"
785
+ },
786
+ {
787
+ id: "str.hiscore.anyKey",
788
+ group: "words",
789
+ screen: "hiscores",
790
+ label: "Foot",
791
+ safety: "safe",
792
+ web: !0,
793
+ kind: "text",
794
+ offset: 157947,
795
+ length: 11,
796
+ stock: "Hit any key"
797
+ },
798
+ {
799
+ id: "str.hiscore.congrats",
800
+ group: "words",
801
+ screen: "newHiscore",
802
+ label: "Congratulations",
803
+ safety: "safe",
804
+ web: !0,
805
+ kind: "text",
806
+ offset: 157967,
807
+ length: 16,
808
+ stock: "Congratulations!"
809
+ },
810
+ {
811
+ id: "str.hiscore.place",
812
+ group: "words",
813
+ screen: "newHiscore",
814
+ label: "Place line",
815
+ safety: "caution",
816
+ web: !0,
817
+ kind: "format",
818
+ offset: 157984,
819
+ length: 37,
820
+ stock: "You scored number %2d on the Top Ten!"
821
+ },
822
+ {
823
+ id: "str.hiscore.enterName",
824
+ group: "words",
825
+ screen: "newHiscore",
826
+ label: "Name prompt",
827
+ safety: "safe",
828
+ web: !0,
829
+ kind: "text",
830
+ offset: 158022,
831
+ length: 16,
832
+ stock: "Enter Your Name:"
833
+ },
834
+ {
835
+ id: "str.invent.score",
836
+ group: "words",
837
+ screen: "status",
838
+ label: "Score",
839
+ safety: "caution",
840
+ web: !0,
841
+ kind: "format",
842
+ offset: 154428,
843
+ length: 14,
844
+ stock: "Score: %ld"
845
+ },
846
+ {
847
+ id: "str.invent.money",
848
+ group: "words",
849
+ screen: "status",
850
+ label: "Money",
851
+ safety: "caution",
852
+ web: !0,
853
+ kind: "format",
854
+ offset: 154443,
855
+ length: 13,
856
+ stock: "Money: %d"
857
+ },
858
+ {
859
+ id: "str.invent.hitpoints",
860
+ group: "words",
861
+ screen: "status",
862
+ label: "Hitpoints",
863
+ safety: "caution",
864
+ web: !0,
865
+ kind: "format",
866
+ offset: 154457,
867
+ length: 13,
868
+ stock: "Hitpoints: %d"
869
+ },
870
+ {
871
+ id: "str.invent.lives",
872
+ group: "words",
873
+ screen: "status",
874
+ label: "Lives",
875
+ safety: "caution",
876
+ web: !0,
877
+ kind: "format",
878
+ offset: 154471,
879
+ length: 13,
880
+ stock: "Lives: %d"
881
+ },
882
+ {
883
+ id: "str.invent.time",
884
+ group: "words",
885
+ screen: "status",
886
+ label: "Elapsed time",
887
+ safety: "caution",
888
+ web: !0,
889
+ kind: "format",
890
+ offset: 154485,
891
+ length: 37,
892
+ stock: "Elapsed Time: %02ld:%02ld:%02ld.%02ld"
893
+ },
894
+ {
895
+ id: "str.load.title",
896
+ group: "words",
897
+ screen: "load",
898
+ label: "Heading (no load picture)",
899
+ safety: "safe",
900
+ web: !0,
901
+ kind: "text",
902
+ offset: 153633,
903
+ length: 9,
904
+ stock: "Load Game"
905
+ },
906
+ {
907
+ id: "str.load.empty",
908
+ group: "words",
909
+ screen: "load",
910
+ label: "Empty slot",
911
+ safety: "safe",
912
+ web: !0,
913
+ kind: "text",
914
+ offset: 153646,
915
+ length: 29,
916
+ stock: "This game has not been saved!"
917
+ },
918
+ {
919
+ id: "str.load.done",
920
+ group: "words",
921
+ screen: "load",
922
+ label: "Loaded",
923
+ safety: "safe",
924
+ web: !0,
925
+ kind: "text",
926
+ offset: 153676,
927
+ length: 16,
928
+ stock: "Old Game Loaded!"
929
+ },
930
+ {
931
+ id: "str.save.title",
932
+ group: "words",
933
+ screen: "save",
934
+ label: "Heading (no save picture)",
935
+ safety: "safe",
936
+ web: !0,
937
+ kind: "text",
938
+ offset: 153695,
939
+ length: 9,
940
+ stock: "Save Game"
941
+ },
942
+ {
943
+ id: "str.save.marker",
944
+ group: "words",
945
+ screen: "save",
946
+ label: "Slot mark (no save picture)",
947
+ safety: "safe",
948
+ web: !0,
949
+ kind: "text",
950
+ offset: 153705,
951
+ length: 1,
952
+ stock: ">"
953
+ },
954
+ {
955
+ id: "str.save.done",
956
+ group: "words",
957
+ screen: "save",
958
+ label: "Saved",
959
+ safety: "safe",
960
+ web: !0,
961
+ kind: "text",
962
+ offset: 153735,
963
+ length: 11,
964
+ stock: "Game Saved!"
965
+ },
966
+ {
967
+ id: "str.save.failed",
968
+ group: "words",
969
+ screen: "save",
970
+ label: "Could not save (DOS only)",
971
+ safety: "safe",
972
+ web: !1,
973
+ kind: "text",
974
+ offset: 153710,
975
+ length: 24,
976
+ stock: "I cannot save your game!"
977
+ },
978
+ {
979
+ id: "str.drop.title",
980
+ group: "words",
981
+ screen: "drop",
982
+ label: "Heading",
983
+ safety: "safe",
984
+ web: !0,
985
+ kind: "text",
986
+ offset: 155007,
987
+ length: 21,
988
+ stock: "Choose object to drop"
989
+ },
990
+ {
991
+ id: "str.drop.help1",
992
+ group: "words",
993
+ screen: "drop",
994
+ label: "Help line 1",
995
+ safety: "safe",
996
+ web: !0,
997
+ kind: "text",
998
+ offset: 155029,
999
+ length: 25,
1000
+ stock: "Use arrow keys to select,"
1001
+ },
1002
+ {
1003
+ id: "str.drop.help2",
1004
+ group: "words",
1005
+ screen: "drop",
1006
+ label: "Help line 2",
1007
+ safety: "safe",
1008
+ web: !0,
1009
+ kind: "text",
1010
+ offset: 155055,
1011
+ length: 25,
1012
+ stock: "<Enter> to accept, <ESC> "
1013
+ },
1014
+ {
1015
+ id: "str.drop.help3",
1016
+ group: "words",
1017
+ screen: "drop",
1018
+ label: "Help line 3",
1019
+ safety: "safe",
1020
+ web: !0,
1021
+ kind: "text",
1022
+ offset: 155081,
1023
+ length: 25,
1024
+ stock: "to quit without dropping."
1025
+ },
1026
+ {
1027
+ id: "str.help.none",
1028
+ group: "words",
1029
+ screen: "help",
1030
+ label: "No help (F1)",
1031
+ safety: "safe",
1032
+ web: !0,
1033
+ kind: "text",
1034
+ offset: 154396,
1035
+ length: 31,
1036
+ stock: "No game-specific help included."
1037
+ },
1038
+ {
1039
+ id: "str.text.more",
1040
+ group: "words",
1041
+ screen: "text",
1042
+ label: "MORE...",
1043
+ safety: "safe",
1044
+ web: !0,
1045
+ kind: "text",
1046
+ offset: 154584,
1047
+ length: 7,
1048
+ stock: "MORE..."
1049
+ },
1050
+ {
1051
+ id: "str.text.missingTitle",
1052
+ group: "words",
1053
+ screen: "text",
1054
+ label: "Missing file",
1055
+ safety: "safe",
1056
+ web: !0,
1057
+ kind: "text",
1058
+ offset: 154526,
1059
+ length: 13,
1060
+ stock: "Missing File:"
1061
+ },
1062
+ {
1063
+ id: "str.text.missingFile",
1064
+ group: "words",
1065
+ screen: "text",
1066
+ label: "Missing file name line",
1067
+ safety: "caution",
1068
+ web: !0,
1069
+ kind: "format",
1070
+ offset: 154540,
1071
+ length: 14,
1072
+ stock: "The file %s is"
1073
+ },
1074
+ {
1075
+ id: "str.text.missingTail",
1076
+ group: "words",
1077
+ screen: "text",
1078
+ label: "Missing file, second line",
1079
+ safety: "safe",
1080
+ web: !0,
1081
+ kind: "text",
1082
+ offset: 154555,
1083
+ length: 28,
1084
+ stock: "missing or cannot be opened."
1085
+ },
1086
+ {
1087
+ id: "str.missing.title",
1088
+ group: "words",
1089
+ screen: "missing",
1090
+ label: "Heading",
1091
+ safety: "safe",
1092
+ web: !0,
1093
+ kind: "text",
1094
+ offset: 155111,
1095
+ length: 30,
1096
+ stock: "I am missing these game files:"
1097
+ },
1098
+ {
1099
+ id: "str.missing.anyKey",
1100
+ group: "words",
1101
+ screen: "missing",
1102
+ label: "Foot",
1103
+ safety: "safe",
1104
+ web: !0,
1105
+ kind: "text",
1106
+ offset: 155142,
1107
+ length: 14,
1108
+ stock: "Hit any key..."
1109
+ },
1110
+ {
1111
+ id: "color.rgb.yellow",
1112
+ group: "colors",
1113
+ screen: "all",
1114
+ label: "Yellow",
1115
+ note: "About text, load and save slot names",
1116
+ safety: "safe",
1117
+ web: !0,
1118
+ kind: "rgb",
1119
+ offsets: [90934, 90939, 90944],
1120
+ stock: [63, 63, 0]
1121
+ },
1122
+ {
1123
+ id: "color.rgb.red",
1124
+ group: "colors",
1125
+ screen: "all",
1126
+ label: "Red",
1127
+ note: '"No game-specific" lines, F1 no-help line, markers, missing-file text',
1128
+ safety: "safe",
1129
+ web: !0,
1130
+ kind: "rgb",
1131
+ offsets: [90949, 90954, 90959],
1132
+ stock: [63, 10, 10]
1133
+ },
1134
+ {
1135
+ id: "color.rgb.blue",
1136
+ group: "colors",
1137
+ screen: "all",
1138
+ label: "Blue",
1139
+ note: "Menu words and title, load/save words, status, drop picker",
1140
+ safety: "safe",
1141
+ web: !0,
1142
+ kind: "rgb",
1143
+ offsets: [90964, 90969, 90974],
1144
+ stock: [10, 10, 63]
1145
+ },
1146
+ {
1147
+ id: "color.rgb.purple",
1148
+ group: "colors",
1149
+ screen: "all",
1150
+ label: "Purple",
1151
+ note: "Text pages",
1152
+ safety: "safe",
1153
+ web: !0,
1154
+ kind: "rgb",
1155
+ offsets: [90979, 90984, 90989],
1156
+ stock: [50, 10, 50]
1157
+ },
1158
+ {
1159
+ id: "color.rgb.hsRed",
1160
+ group: "colors",
1161
+ screen: "all",
1162
+ label: "High-score red",
1163
+ note: "High-score heading, foot and prompts",
1164
+ safety: "safe",
1165
+ web: !0,
1166
+ kind: "rgb",
1167
+ offsets: [114840, 114845, 114850],
1168
+ stock: [63, 10, 10]
1169
+ },
1170
+ {
1171
+ id: "color.rgb.hsBlue",
1172
+ group: "colors",
1173
+ screen: "all",
1174
+ label: "High-score blue",
1175
+ note: "High-score rows and typed name",
1176
+ safety: "safe",
1177
+ web: !0,
1178
+ kind: "rgb",
1179
+ offsets: [114855, 114860, 114865],
1180
+ stock: [10, 10, 63]
1181
+ },
1182
+ {
1183
+ id: "color.rgb.hsGreen",
1184
+ group: "colors",
1185
+ screen: "all",
1186
+ label: "Spare (high-score green)",
1187
+ note: "Unused in the stock player: free for any screen",
1188
+ safety: "safe",
1189
+ web: !0,
1190
+ kind: "rgb",
1191
+ offsets: [114870, 114875, 114880],
1192
+ stock: [10, 63, 10]
1193
+ },
1194
+ {
1195
+ id: "color.select.menu",
1196
+ group: "colors",
1197
+ screen: "menu",
1198
+ label: "Menu words, title and marker",
1199
+ safety: "safe",
1200
+ web: !0,
1201
+ kind: "select",
1202
+ offset: 44932,
1203
+ stock: "blue"
1204
+ },
1205
+ {
1206
+ id: "color.select.menuMessages",
1207
+ group: "colors",
1208
+ screen: "menu",
1209
+ label: '"No game-specific" lines',
1210
+ safety: "safe",
1211
+ web: !0,
1212
+ kind: "select",
1213
+ offset: 44951,
1214
+ stock: "red"
1215
+ },
1216
+ {
1217
+ id: "color.select.textPages",
1218
+ group: "colors",
1219
+ screen: "text",
1220
+ label: "Text pages",
1221
+ safety: "safe",
1222
+ web: !0,
1223
+ kind: "select",
1224
+ offset: 49580,
1225
+ stock: "purple"
1226
+ },
1227
+ {
1228
+ id: "color.select.textMissing",
1229
+ group: "colors",
1230
+ screen: "text",
1231
+ label: "Missing-file text and MORE...",
1232
+ safety: "safe",
1233
+ web: !0,
1234
+ kind: "select",
1235
+ offset: 58095,
1236
+ stock: "red"
1237
+ },
1238
+ {
1239
+ id: "color.select.helpNone",
1240
+ group: "colors",
1241
+ screen: "help",
1242
+ label: "F1 no-help line",
1243
+ safety: "safe",
1244
+ web: !0,
1245
+ kind: "select",
1246
+ offset: 57338,
1247
+ stock: "red"
1248
+ },
1249
+ {
1250
+ id: "color.select.loadSlots",
1251
+ group: "colors",
1252
+ screen: "load",
1253
+ label: "Load: slot names",
1254
+ safety: "safe",
1255
+ web: !0,
1256
+ kind: "select",
1257
+ offset: 52484,
1258
+ stock: "yellow"
1259
+ },
1260
+ {
1261
+ id: "color.select.loadMarker",
1262
+ group: "colors",
1263
+ screen: "load",
1264
+ label: "Load: marker",
1265
+ safety: "safe",
1266
+ web: !0,
1267
+ kind: "select",
1268
+ offset: 52505,
1269
+ stock: "red"
1270
+ },
1271
+ {
1272
+ id: "color.select.loadText",
1273
+ group: "colors",
1274
+ screen: "load",
1275
+ label: "Load: heading and messages",
1276
+ safety: "safe",
1277
+ web: !0,
1278
+ kind: "select",
1279
+ offset: 53390,
1280
+ stock: "blue"
1281
+ },
1282
+ {
1283
+ id: "color.select.loadTextPic",
1284
+ group: "colors",
1285
+ screen: "load",
1286
+ label: "Load: messages over the load picture",
1287
+ safety: "safe",
1288
+ web: !0,
1289
+ kind: "select",
1290
+ offset: 53359,
1291
+ stock: "blue"
1292
+ },
1293
+ {
1294
+ id: "color.select.saveSlots",
1295
+ group: "colors",
1296
+ screen: "save",
1297
+ label: "Save: slot names",
1298
+ safety: "safe",
1299
+ web: !0,
1300
+ kind: "select",
1301
+ offset: 52743,
1302
+ stock: "yellow"
1303
+ },
1304
+ {
1305
+ id: "color.select.saveMarker",
1306
+ group: "colors",
1307
+ screen: "save",
1308
+ label: "Save: marker",
1309
+ safety: "safe",
1310
+ web: !0,
1311
+ kind: "select",
1312
+ offset: 52764,
1313
+ stock: "red"
1314
+ },
1315
+ {
1316
+ id: "color.select.saveText",
1317
+ group: "colors",
1318
+ screen: "save",
1319
+ label: "Save: heading, marks and messages",
1320
+ safety: "safe",
1321
+ web: !0,
1322
+ kind: "select",
1323
+ offset: 55918,
1324
+ stock: "blue"
1325
+ },
1326
+ {
1327
+ id: "color.select.saveTextPic",
1328
+ group: "colors",
1329
+ screen: "save",
1330
+ label: "Save: messages over the save picture",
1331
+ safety: "safe",
1332
+ web: !0,
1333
+ kind: "select",
1334
+ offset: 55874,
1335
+ stock: "blue"
1336
+ },
1337
+ {
1338
+ id: "color.select.status",
1339
+ group: "colors",
1340
+ screen: "status",
1341
+ label: "Status: frames, grid and words",
1342
+ safety: "safe",
1343
+ web: !0,
1344
+ kind: "select",
1345
+ offset: 57398,
1346
+ stock: "blue"
1347
+ },
1348
+ {
1349
+ id: "color.select.dropFrame",
1350
+ group: "colors",
1351
+ screen: "drop",
1352
+ label: "Drop: frames, grid and words",
1353
+ safety: "safe",
1354
+ web: !0,
1355
+ kind: "select",
1356
+ offset: 59847,
1357
+ stock: "blue"
1358
+ },
1359
+ {
1360
+ id: "color.select.dropCursor",
1361
+ group: "colors",
1362
+ screen: "drop",
1363
+ label: "Drop: selection box",
1364
+ safety: "safe",
1365
+ web: !0,
1366
+ kind: "select",
1367
+ offset: 59828,
1368
+ stock: "red"
1369
+ },
1370
+ {
1371
+ id: "color.select.aboutFrame",
1372
+ group: "colors",
1373
+ screen: "about",
1374
+ label: "About: frames",
1375
+ safety: "safe",
1376
+ web: !0,
1377
+ kind: "select",
1378
+ offset: 56613,
1379
+ stock: "blue"
1380
+ },
1381
+ {
1382
+ id: "color.select.aboutText",
1383
+ group: "colors",
1384
+ screen: "about",
1385
+ label: "About: words",
1386
+ safety: "safe",
1387
+ web: !0,
1388
+ kind: "select",
1389
+ offset: 56632,
1390
+ stock: "yellow"
1391
+ },
1392
+ { id: "color.select.joyText", group: "colors", screen: "play", label: "F9: words", safety: "safe", web: !0, kind: "select", offset: 58645, stock: "blue" },
1393
+ {
1394
+ id: "color.select.hsTitle",
1395
+ group: "colors",
1396
+ screen: "hiscores",
1397
+ label: "High scores: heading and foot",
1398
+ safety: "safe",
1399
+ web: !0,
1400
+ kind: "select",
1401
+ offset: 113918,
1402
+ stock: "hsRed"
1403
+ },
1404
+ {
1405
+ id: "color.select.hsRows",
1406
+ group: "colors",
1407
+ screen: "hiscores",
1408
+ label: "High scores: rows",
1409
+ safety: "safe",
1410
+ web: !0,
1411
+ kind: "select",
1412
+ offset: 113937,
1413
+ stock: "hsBlue"
1414
+ },
1415
+ {
1416
+ id: "color.select.hsPrompt",
1417
+ group: "colors",
1418
+ screen: "newHiscore",
1419
+ label: "New high score: Congratulations and prompt",
1420
+ safety: "safe",
1421
+ web: !0,
1422
+ kind: "select",
1423
+ offset: 114468,
1424
+ stock: "hsRed"
1425
+ },
1426
+ {
1427
+ id: "color.select.hsName",
1428
+ group: "colors",
1429
+ screen: "newHiscore",
1430
+ label: "New high score: place line and name",
1431
+ safety: "safe",
1432
+ web: !0,
1433
+ kind: "select",
1434
+ offset: 114487,
1435
+ stock: "hsBlue"
1436
+ },
1437
+ {
1438
+ id: "color.missing.1",
1439
+ group: "colors",
1440
+ screen: "missing",
1441
+ label: "Missing files: heading",
1442
+ note: "A fixed palette entry this screen sets",
1443
+ safety: "safe",
1444
+ web: !0,
1445
+ kind: "rgb",
1446
+ offsets: [80491, 80489, 80487],
1447
+ stock: [63, 63, 0]
1448
+ },
1449
+ {
1450
+ id: "color.missing.2",
1451
+ group: "colors",
1452
+ screen: "missing",
1453
+ label: "Missing files: file names",
1454
+ note: "A fixed palette entry this screen sets",
1455
+ safety: "safe",
1456
+ web: !0,
1457
+ kind: "rgb",
1458
+ offsets: [80507, 80505, 80503],
1459
+ stock: [63, 0, 33]
1460
+ },
1461
+ {
1462
+ id: "color.missing.3",
1463
+ group: "colors",
1464
+ screen: "missing",
1465
+ label: "Missing files: foot",
1466
+ note: "A fixed palette entry this screen sets",
1467
+ safety: "safe",
1468
+ web: !0,
1469
+ kind: "rgb",
1470
+ offsets: [80523, 80521, 80519],
1471
+ stock: [0, 58, 58]
1472
+ },
1473
+ {
1474
+ id: "color.missing.4",
1475
+ group: "colors",
1476
+ screen: "missing",
1477
+ label: "Missing files: frames",
1478
+ note: "A fixed palette entry this screen sets",
1479
+ safety: "safe",
1480
+ web: !0,
1481
+ kind: "rgb",
1482
+ offsets: [80539, 80537, 80535],
1483
+ stock: [63, 0, 0]
1484
+ },
1485
+ {
1486
+ id: "border.invent.outer",
1487
+ group: "frames",
1488
+ screen: "status",
1489
+ label: "Status (F2), outer frame",
1490
+ safety: "safe",
1491
+ web: !0,
1492
+ kind: "frame",
1493
+ fields: [
1494
+ { offset: 57423, size: 1 },
1495
+ { offset: 57421, size: 1 },
1496
+ { offset: 57418, size: 2 },
1497
+ { offset: 57415, size: 2 }
1498
+ ],
1499
+ stock: [10, 10, 310, 190]
1500
+ },
1501
+ {
1502
+ id: "border.invent.inner",
1503
+ group: "frames",
1504
+ screen: "status",
1505
+ label: "Status (F2), inner frame",
1506
+ safety: "safe",
1507
+ web: !0,
1508
+ kind: "frame",
1509
+ fields: [
1510
+ { offset: 57444, size: 1 },
1511
+ { offset: 57442, size: 1 },
1512
+ { offset: 57439, size: 2 },
1513
+ { offset: 57436, size: 2 }
1514
+ ],
1515
+ stock: [15, 15, 305, 185]
1516
+ },
1517
+ {
1518
+ id: "border.drop.outer",
1519
+ group: "frames",
1520
+ screen: "drop",
1521
+ label: "Drop picker, outer frame",
1522
+ safety: "safe",
1523
+ web: !0,
1524
+ kind: "frame",
1525
+ fields: [
1526
+ { offset: 59872, size: 1 },
1527
+ { offset: 59870, size: 1 },
1528
+ { offset: 59867, size: 2 },
1529
+ { offset: 59864, size: 2 }
1530
+ ],
1531
+ stock: [10, 10, 310, 190]
1532
+ },
1533
+ {
1534
+ id: "border.drop.inner",
1535
+ group: "frames",
1536
+ screen: "drop",
1537
+ label: "Drop picker, inner frame",
1538
+ safety: "safe",
1539
+ web: !0,
1540
+ kind: "frame",
1541
+ fields: [
1542
+ { offset: 59893, size: 1 },
1543
+ { offset: 59891, size: 1 },
1544
+ { offset: 59888, size: 2 },
1545
+ { offset: 59885, size: 2 }
1546
+ ],
1547
+ stock: [15, 15, 305, 185]
1548
+ },
1549
+ {
1550
+ id: "border.about.outer",
1551
+ group: "frames",
1552
+ screen: "about",
1553
+ label: "About (F10), outer frame",
1554
+ safety: "safe",
1555
+ web: !0,
1556
+ kind: "frame",
1557
+ fields: [
1558
+ { offset: 56657, size: 1 },
1559
+ { offset: 56655, size: 1 },
1560
+ { offset: 56652, size: 2 },
1561
+ { offset: 56649, size: 2 }
1562
+ ],
1563
+ stock: [10, 10, 310, 190]
1564
+ },
1565
+ {
1566
+ id: "border.about.inner",
1567
+ group: "frames",
1568
+ screen: "about",
1569
+ label: "About (F10), inner frame",
1570
+ safety: "safe",
1571
+ web: !0,
1572
+ kind: "frame",
1573
+ fields: [
1574
+ { offset: 56678, size: 1 },
1575
+ { offset: 56676, size: 1 },
1576
+ { offset: 56673, size: 2 },
1577
+ { offset: 56670, size: 2 }
1578
+ ],
1579
+ stock: [15, 15, 305, 185]
1580
+ },
1581
+ {
1582
+ id: "border.missing.outer",
1583
+ group: "frames",
1584
+ screen: "missing",
1585
+ label: "Missing files, outer frame",
1586
+ safety: "safe",
1587
+ web: !0,
1588
+ kind: "frame",
1589
+ fields: [
1590
+ { offset: 80616, size: 1 },
1591
+ { offset: 80614, size: 1 },
1592
+ { offset: 80611, size: 2 },
1593
+ { offset: 80608, size: 2 }
1594
+ ],
1595
+ stock: [10, 10, 310, 190]
1596
+ },
1597
+ {
1598
+ id: "border.missing.inner",
1599
+ group: "frames",
1600
+ screen: "missing",
1601
+ label: "Missing files, inner frame",
1602
+ safety: "safe",
1603
+ web: !0,
1604
+ kind: "frame",
1605
+ fields: [
1606
+ { offset: 80636, size: 1 },
1607
+ { offset: 80634, size: 1 },
1608
+ { offset: 80631, size: 2 },
1609
+ { offset: 80628, size: 2 }
1610
+ ],
1611
+ stock: [15, 15, 305, 185]
1612
+ },
1613
+ {
1614
+ id: "border.marker.width",
1615
+ group: "frames",
1616
+ screen: "menu",
1617
+ label: "Menu marker width (minus 1)",
1618
+ note: "Every menu marker: main menu, load and save",
1619
+ safety: "caution",
1620
+ web: !0,
1621
+ kind: "number",
1622
+ fields: [
1623
+ { offset: 43664, size: 2 },
1624
+ { offset: 43950, size: 2 }
1625
+ ],
1626
+ signed: !1,
1627
+ min: 0,
1628
+ max: 40,
1629
+ stock: 5
1630
+ },
1631
+ {
1632
+ id: "layout.menu.play.x",
1633
+ group: "positions",
1634
+ screen: "menu",
1635
+ label: '"Play" x',
1636
+ safety: "caution",
1637
+ web: !0,
1638
+ kind: "number",
1639
+ fields: [{ offset: 46782, size: 1 }],
1640
+ signed: !0,
1641
+ min: 0,
1642
+ max: 127,
1643
+ stock: 80
1644
+ },
1645
+ {
1646
+ id: "layout.menu.play.y",
1647
+ group: "positions",
1648
+ screen: "menu",
1649
+ label: '"Play" y',
1650
+ safety: "caution",
1651
+ web: !0,
1652
+ kind: "number",
1653
+ fields: [{ offset: 46780, size: 1 }],
1654
+ signed: !0,
1655
+ min: 0,
1656
+ max: 127,
1657
+ stock: 120
1658
+ },
1659
+ {
1660
+ id: "layout.menu.instructions.x",
1661
+ group: "positions",
1662
+ screen: "menu",
1663
+ label: '"Read Instructions" x',
1664
+ safety: "caution",
1665
+ web: !0,
1666
+ kind: "number",
1667
+ fields: [{ offset: 46799, size: 1 }],
1668
+ signed: !0,
1669
+ min: 0,
1670
+ max: 127,
1671
+ stock: 80
1672
+ },
1673
+ {
1674
+ id: "layout.menu.instructions.y",
1675
+ group: "positions",
1676
+ screen: "menu",
1677
+ label: '"Read Instructions" y',
1678
+ safety: "caution",
1679
+ web: !0,
1680
+ kind: "number",
1681
+ fields: [{ offset: 46796, size: 2 }],
1682
+ signed: !1,
1683
+ min: 0,
1684
+ max: 199,
1685
+ stock: 128
1686
+ },
1687
+ {
1688
+ id: "layout.menu.storyline.x",
1689
+ group: "positions",
1690
+ screen: "menu",
1691
+ label: '"Read Storyline" x',
1692
+ safety: "caution",
1693
+ web: !0,
1694
+ kind: "number",
1695
+ fields: [{ offset: 46816, size: 1 }],
1696
+ signed: !0,
1697
+ min: 0,
1698
+ max: 127,
1699
+ stock: 80
1700
+ },
1701
+ {
1702
+ id: "layout.menu.storyline.y",
1703
+ group: "positions",
1704
+ screen: "menu",
1705
+ label: '"Read Storyline" y',
1706
+ safety: "caution",
1707
+ web: !0,
1708
+ kind: "number",
1709
+ fields: [{ offset: 46813, size: 2 }],
1710
+ signed: !1,
1711
+ min: 0,
1712
+ max: 199,
1713
+ stock: 136
1714
+ },
1715
+ {
1716
+ id: "layout.menu.credits.x",
1717
+ group: "positions",
1718
+ screen: "menu",
1719
+ label: '"See Credits" x',
1720
+ safety: "caution",
1721
+ web: !0,
1722
+ kind: "number",
1723
+ fields: [{ offset: 46833, size: 1 }],
1724
+ signed: !0,
1725
+ min: 0,
1726
+ max: 127,
1727
+ stock: 80
1728
+ },
1729
+ {
1730
+ id: "layout.menu.credits.y",
1731
+ group: "positions",
1732
+ screen: "menu",
1733
+ label: '"See Credits" y',
1734
+ safety: "caution",
1735
+ web: !0,
1736
+ kind: "number",
1737
+ fields: [{ offset: 46830, size: 2 }],
1738
+ signed: !1,
1739
+ min: 0,
1740
+ max: 199,
1741
+ stock: 144
1742
+ },
1743
+ {
1744
+ id: "layout.menu.highScores.x",
1745
+ group: "positions",
1746
+ screen: "menu",
1747
+ label: '"See Highest Scores" x',
1748
+ safety: "caution",
1749
+ web: !0,
1750
+ kind: "number",
1751
+ fields: [{ offset: 46853, size: 1 }],
1752
+ signed: !0,
1753
+ min: 0,
1754
+ max: 127,
1755
+ stock: 80
1756
+ },
1757
+ {
1758
+ id: "layout.menu.highScores.y",
1759
+ group: "positions",
1760
+ screen: "menu",
1761
+ label: '"See Highest Scores" y',
1762
+ safety: "caution",
1763
+ web: !0,
1764
+ kind: "number",
1765
+ fields: [{ offset: 46850, size: 2 }],
1766
+ signed: !1,
1767
+ min: 0,
1768
+ max: 199,
1769
+ stock: 152
1770
+ },
1771
+ {
1772
+ id: "layout.menu.quit.x",
1773
+ group: "positions",
1774
+ screen: "menu",
1775
+ label: '"Quit" x',
1776
+ safety: "caution",
1777
+ web: !0,
1778
+ kind: "number",
1779
+ fields: [{ offset: 46870, size: 1 }],
1780
+ signed: !0,
1781
+ min: 0,
1782
+ max: 127,
1783
+ stock: 80
1784
+ },
1785
+ {
1786
+ id: "layout.menu.quit.y",
1787
+ group: "positions",
1788
+ screen: "menu",
1789
+ label: '"Quit" y',
1790
+ safety: "caution",
1791
+ web: !0,
1792
+ kind: "number",
1793
+ fields: [{ offset: 46867, size: 2 }],
1794
+ signed: !1,
1795
+ min: 0,
1796
+ max: 199,
1797
+ stock: 160
1798
+ },
1799
+ {
1800
+ id: "layout.menu.titleX",
1801
+ group: "positions",
1802
+ screen: "menu",
1803
+ label: "Game name x",
1804
+ safety: "safe",
1805
+ web: !0,
1806
+ kind: "number",
1807
+ fields: [{ offset: 46766, size: 1 }],
1808
+ signed: !0,
1809
+ min: 0,
1810
+ max: 127,
1811
+ stock: 96
1812
+ },
1813
+ {
1814
+ id: "layout.menu.titleY",
1815
+ group: "positions",
1816
+ screen: "menu",
1817
+ label: "Game name y",
1818
+ safety: "safe",
1819
+ web: !0,
1820
+ kind: "number",
1821
+ fields: [{ offset: 46764, size: 1 }],
1822
+ signed: !0,
1823
+ min: 0,
1824
+ max: 127,
1825
+ stock: 104
1826
+ },
1827
+ {
1828
+ id: "layout.menu.markerX",
1829
+ group: "positions",
1830
+ screen: "menu",
1831
+ label: "Marker x",
1832
+ note: "Also where a click is read",
1833
+ safety: "caution",
1834
+ web: !0,
1835
+ kind: "number",
1836
+ fields: [{ offset: 44996, size: 1 }],
1837
+ signed: !0,
1838
+ min: 0,
1839
+ max: 127,
1840
+ stock: 70
1841
+ },
1842
+ {
1843
+ id: "layout.menu.firstY",
1844
+ group: "positions",
1845
+ screen: "menu",
1846
+ label: "Marker y (first choice)",
1847
+ safety: "caution",
1848
+ web: !0,
1849
+ kind: "number",
1850
+ fields: [{ offset: 44994, size: 1 }],
1851
+ signed: !0,
1852
+ min: 0,
1853
+ max: 127,
1854
+ stock: 121
1855
+ },
1856
+ {
1857
+ id: "layout.menu.spacing",
1858
+ group: "positions",
1859
+ screen: "menu",
1860
+ label: "Marker spacing",
1861
+ safety: "caution",
1862
+ web: !0,
1863
+ kind: "number",
1864
+ fields: [{ offset: 44992, size: 1 }],
1865
+ signed: !0,
1866
+ min: 1,
1867
+ max: 20,
1868
+ stock: 8
1869
+ },
1870
+ {
1871
+ id: "layout.menu.noFile.x",
1872
+ group: "positions",
1873
+ screen: "menu",
1874
+ label: '"No game-specific" lines x',
1875
+ safety: "safe",
1876
+ web: !0,
1877
+ kind: "number",
1878
+ fields: [{ offset: 45922, size: 1 }],
1879
+ signed: !0,
1880
+ min: 0,
1881
+ max: 127,
1882
+ stock: 40
1883
+ },
1884
+ {
1885
+ id: "layout.menu.noFile.y",
1886
+ group: "positions",
1887
+ screen: "menu",
1888
+ label: '"No game-specific" lines y',
1889
+ safety: "safe",
1890
+ web: !0,
1891
+ kind: "number",
1892
+ fields: [{ offset: 45920, size: 1 }],
1893
+ signed: !0,
1894
+ min: 0,
1895
+ max: 127,
1896
+ stock: 80
1897
+ },
1898
+ {
1899
+ id: "layout.hiscore.title.x",
1900
+ group: "positions",
1901
+ screen: "hiscores",
1902
+ label: "Heading x",
1903
+ safety: "safe",
1904
+ web: !0,
1905
+ kind: "number",
1906
+ fields: [{ offset: 113969, size: 1 }],
1907
+ signed: !0,
1908
+ min: 0,
1909
+ max: 127,
1910
+ stock: 104
1911
+ },
1912
+ {
1913
+ id: "layout.hiscore.title.y",
1914
+ group: "positions",
1915
+ screen: "hiscores",
1916
+ label: "Heading y",
1917
+ safety: "safe",
1918
+ web: !0,
1919
+ kind: "number",
1920
+ fields: [{ offset: 113967, size: 1 }],
1921
+ signed: !0,
1922
+ min: 0,
1923
+ max: 127,
1924
+ stock: 0
1925
+ },
1926
+ {
1927
+ id: "layout.hiscore.anyKey.x",
1928
+ group: "positions",
1929
+ screen: "hiscores",
1930
+ label: "Foot x",
1931
+ safety: "safe",
1932
+ web: !0,
1933
+ kind: "number",
1934
+ fields: [{ offset: 114175, size: 1 }],
1935
+ signed: !0,
1936
+ min: 0,
1937
+ max: 127,
1938
+ stock: 116
1939
+ },
1940
+ {
1941
+ id: "layout.hiscore.anyKey.y",
1942
+ group: "positions",
1943
+ screen: "hiscores",
1944
+ label: "Foot y",
1945
+ safety: "safe",
1946
+ web: !0,
1947
+ kind: "number",
1948
+ fields: [{ offset: 114172, size: 2 }],
1949
+ signed: !1,
1950
+ min: 0,
1951
+ max: 199,
1952
+ stock: 192
1953
+ },
1954
+ {
1955
+ id: "layout.hiscore.firstRowY",
1956
+ group: "positions",
1957
+ screen: "hiscores",
1958
+ label: "First row y",
1959
+ safety: "safe",
1960
+ web: !0,
1961
+ kind: "number",
1962
+ fields: [{ offset: 113986, size: 2 }],
1963
+ signed: !1,
1964
+ min: 0,
1965
+ max: 199,
1966
+ stock: 27
1967
+ },
1968
+ {
1969
+ id: "layout.hiscore.rowSpacing",
1970
+ group: "positions",
1971
+ screen: "hiscores",
1972
+ label: "Row spacing (start)",
1973
+ note: "Shrinks by 2, 1, 2, 1... per row",
1974
+ safety: "caution",
1975
+ web: !0,
1976
+ kind: "number",
1977
+ fields: [{ offset: 113981, size: 2 }],
1978
+ signed: !1,
1979
+ min: 10,
1980
+ max: 24,
1981
+ stock: 22
1982
+ },
1983
+ {
1984
+ id: "layout.hiscore.rows",
1985
+ group: "positions",
1986
+ screen: "hiscores",
1987
+ label: "Rows shown",
1988
+ safety: "caution",
1989
+ web: !0,
1990
+ kind: "number",
1991
+ fields: [{ offset: 114104, size: 1 }],
1992
+ signed: !0,
1993
+ min: 1,
1994
+ max: 10,
1995
+ stock: 10
1996
+ },
1997
+ {
1998
+ id: "layout.hiscore.congrats.x",
1999
+ group: "positions",
2000
+ screen: "newHiscore",
2001
+ label: "Congratulations x",
2002
+ safety: "safe",
2003
+ web: !0,
2004
+ kind: "number",
2005
+ fields: [{ offset: 114620, size: 1 }],
2006
+ signed: !0,
2007
+ min: 0,
2008
+ max: 127,
2009
+ stock: 96
2010
+ },
2011
+ {
2012
+ id: "layout.hiscore.congrats.y",
2013
+ group: "positions",
2014
+ screen: "newHiscore",
2015
+ label: "Congratulations y",
2016
+ safety: "safe",
2017
+ web: !0,
2018
+ kind: "number",
2019
+ fields: [{ offset: 114618, size: 1 }],
2020
+ signed: !0,
2021
+ min: 0,
2022
+ max: 127,
2023
+ stock: 40
2024
+ },
2025
+ {
2026
+ id: "layout.hiscore.enterName.x",
2027
+ group: "positions",
2028
+ screen: "newHiscore",
2029
+ label: "Name prompt x",
2030
+ safety: "caution",
2031
+ web: !0,
2032
+ kind: "number",
2033
+ fields: [{ offset: 114699, size: 1 }],
2034
+ signed: !0,
2035
+ min: 0,
2036
+ max: 127,
2037
+ stock: 0
2038
+ },
2039
+ {
2040
+ id: "layout.hiscore.enterName.y",
2041
+ group: "positions",
2042
+ screen: "newHiscore",
2043
+ label: "Name prompt y",
2044
+ safety: "caution",
2045
+ web: !0,
2046
+ kind: "number",
2047
+ fields: [{ offset: 114697, size: 1 }],
2048
+ signed: !0,
2049
+ min: 0,
2050
+ max: 127,
2051
+ stock: 120
2052
+ },
2053
+ {
2054
+ id: "layout.load.title.x",
2055
+ group: "positions",
2056
+ screen: "load",
2057
+ label: "Heading x",
2058
+ safety: "safe",
2059
+ web: !0,
2060
+ kind: "number",
2061
+ fields: [{ offset: 53433, size: 1 }],
2062
+ signed: !0,
2063
+ min: 0,
2064
+ max: 127,
2065
+ stock: 124
2066
+ },
2067
+ {
2068
+ id: "layout.load.title.y",
2069
+ group: "positions",
2070
+ screen: "load",
2071
+ label: "Heading y",
2072
+ safety: "safe",
2073
+ web: !0,
2074
+ kind: "number",
2075
+ fields: [{ offset: 53431, size: 1 }],
2076
+ signed: !0,
2077
+ min: 0,
2078
+ max: 127,
2079
+ stock: 10
2080
+ },
2081
+ {
2082
+ id: "layout.save.title.x",
2083
+ group: "positions",
2084
+ screen: "save",
2085
+ label: "Heading x",
2086
+ safety: "safe",
2087
+ web: !0,
2088
+ kind: "number",
2089
+ fields: [{ offset: 55961, size: 1 }],
2090
+ signed: !0,
2091
+ min: 0,
2092
+ max: 127,
2093
+ stock: 124
2094
+ },
2095
+ {
2096
+ id: "layout.save.title.y",
2097
+ group: "positions",
2098
+ screen: "save",
2099
+ label: "Heading y",
2100
+ safety: "safe",
2101
+ web: !0,
2102
+ kind: "number",
2103
+ fields: [{ offset: 55959, size: 1 }],
2104
+ signed: !0,
2105
+ min: 0,
2106
+ max: 127,
2107
+ stock: 10
2108
+ },
2109
+ {
2110
+ id: "timing.menu.idleSeconds",
2111
+ group: "times",
2112
+ screen: "menu",
2113
+ label: "Menu idle before the demo",
2114
+ note: "Seconds",
2115
+ safety: "safe",
2116
+ web: !0,
2117
+ kind: "number",
2118
+ fields: [{ offset: 44982, size: 1 }],
2119
+ signed: !0,
2120
+ min: 1,
2121
+ max: 127,
2122
+ stock: 30
2123
+ },
2124
+ {
2125
+ id: "timing.menuNoFile",
2126
+ group: "times",
2127
+ screen: "menu",
2128
+ label: '"No game-specific" lines',
2129
+ note: "Seconds; -1 waits for a key",
2130
+ safety: "safe",
2131
+ web: !0,
2132
+ kind: "number",
2133
+ fields: [{ offset: 45929, size: 1 }],
2134
+ signed: !0,
2135
+ min: -1,
2136
+ max: 127,
2137
+ stock: 10
2138
+ },
2139
+ {
2140
+ id: "timing.highScores",
2141
+ group: "times",
2142
+ screen: "hiscores",
2143
+ label: "High-score table",
2144
+ note: "Seconds; -1 waits for a key",
2145
+ safety: "safe",
2146
+ web: !0,
2147
+ kind: "number",
2148
+ fields: [{ offset: 114182, size: 1 }],
2149
+ signed: !0,
2150
+ min: -1,
2151
+ max: 127,
2152
+ stock: 30
2153
+ },
2154
+ {
2155
+ id: "timing.helpNone",
2156
+ group: "times",
2157
+ screen: "help",
2158
+ label: "F1 no-help line",
2159
+ note: "Seconds; -1 waits for a key",
2160
+ safety: "safe",
2161
+ web: !0,
2162
+ kind: "number",
2163
+ fields: [{ offset: 57371, size: 1 }],
2164
+ signed: !0,
2165
+ min: -1,
2166
+ max: 127,
2167
+ stock: 5
2168
+ },
2169
+ {
2170
+ id: "timing.loadMessage",
2171
+ group: "times",
2172
+ screen: "load",
2173
+ label: "Load message",
2174
+ note: "Seconds; -1 waits for a key",
2175
+ safety: "safe",
2176
+ web: !0,
2177
+ kind: "number",
2178
+ fields: [{ offset: 55559, size: 1 }],
2179
+ signed: !0,
2180
+ min: -1,
2181
+ max: 127,
2182
+ stock: 2
2183
+ },
2184
+ {
2185
+ id: "timing.saveMessage",
2186
+ group: "times",
2187
+ screen: "save",
2188
+ label: "Save message",
2189
+ note: "Seconds; -1 waits for a key",
2190
+ safety: "safe",
2191
+ web: !0,
2192
+ kind: "number",
2193
+ fields: [{ offset: 56566, size: 1 }],
2194
+ signed: !0,
2195
+ min: -1,
2196
+ max: 127,
2197
+ stock: 2
2198
+ },
2199
+ {
2200
+ id: "timing.missingFiles",
2201
+ group: "times",
2202
+ screen: "missing",
2203
+ label: "Missing files",
2204
+ note: "Seconds; -1 waits for a key",
2205
+ safety: "safe",
2206
+ web: !0,
2207
+ kind: "number",
2208
+ fields: [{ offset: 80874, size: 1 }],
2209
+ signed: !0,
2210
+ min: -1,
2211
+ max: 127,
2212
+ stock: 20
2213
+ },
2214
+ {
2215
+ id: "timing.aboutPage1",
2216
+ group: "times",
2217
+ screen: "about",
2218
+ label: "About page 1",
2219
+ note: "Seconds; -1 waits for a key",
2220
+ safety: "safe",
2221
+ web: !0,
2222
+ kind: "number",
2223
+ fields: [{ offset: 56984, size: 1 }],
2224
+ signed: !0,
2225
+ min: -1,
2226
+ max: 127,
2227
+ stock: 60
2228
+ },
2229
+ {
2230
+ id: "timing.showGraphic.gif",
2231
+ group: "times",
2232
+ screen: "text",
2233
+ label: "Default .gif time",
2234
+ note: "Seconds; 65535 waits for a key",
2235
+ safety: "caution",
2236
+ web: !0,
2237
+ kind: "number",
2238
+ fields: [{ offset: 48656, size: 2 }],
2239
+ signed: !1,
2240
+ min: 0,
2241
+ max: 65535,
2242
+ stock: 15
2243
+ },
2244
+ {
2245
+ id: "timing.showGraphic.bkd",
2246
+ group: "times",
2247
+ screen: "text",
2248
+ label: "Default .bkd time",
2249
+ note: "Seconds; 65535 waits for a key",
2250
+ safety: "caution",
2251
+ web: !0,
2252
+ kind: "number",
2253
+ fields: [{ offset: 48842, size: 2 }],
2254
+ signed: !1,
2255
+ min: 0,
2256
+ max: 65535,
2257
+ stock: 20
2258
+ },
2259
+ {
2260
+ id: "timing.showGraphic.fli",
2261
+ group: "times",
2262
+ screen: "text",
2263
+ label: "Default .fli time",
2264
+ note: "Seconds; 65535 waits for a key",
2265
+ safety: "caution",
2266
+ web: !0,
2267
+ kind: "number",
2268
+ fields: [{ offset: 49140, size: 2 }],
2269
+ signed: !1,
2270
+ min: 0,
2271
+ max: 65535,
2272
+ stock: 0
2273
+ },
2274
+ {
2275
+ id: "timing.showGraphic.txt",
2276
+ group: "times",
2277
+ screen: "text",
2278
+ label: "Default .txt page time",
2279
+ note: "Seconds; 65535 waits for a key",
2280
+ safety: "caution",
2281
+ web: !0,
2282
+ kind: "number",
2283
+ fields: [{ offset: 49554, size: 2 }],
2284
+ signed: !1,
2285
+ min: 0,
2286
+ max: 65535,
2287
+ stock: 90
2288
+ },
2289
+ { id: "table.fkeys.F5", group: "keys", screen: "play", label: "F5 saves", safety: "caution", web: !0, kind: "fkey", key: 5, offset: 52456, stock: 10424 },
2290
+ { id: "table.fkeys.F6", group: "keys", screen: "play", label: "F6 loads", safety: "caution", web: !0, kind: "fkey", key: 6, offset: 52458, stock: 10442 },
2291
+ {
2292
+ id: "table.fkeys.F9",
2293
+ group: "keys",
2294
+ screen: "play",
2295
+ label: "F9 joystick setup",
2296
+ safety: "caution",
2297
+ web: !0,
2298
+ kind: "fkey",
2299
+ key: 9,
2300
+ offset: 52464,
2301
+ stock: 10468
2302
+ }
2303
+ ], ms = [
2304
+ { ext: "gam", label: "Game file", note: "The .EXE opens the game file named after itself with this extension.", offsets: [153270] },
2305
+ { ext: "gif", label: "Pictures", note: "Shown as a GIF picture.", offsets: [153522] },
2306
+ { ext: "bkd", label: "Backdrops", note: "Shown as a backdrop (a window of a picture).", offsets: [153527] },
2307
+ { ext: "fli", label: "Animations", note: "Played as an animation.", offsets: [153532] },
2308
+ { ext: "txt", label: "Text pages", note: "Shown as a text page. Text files the game doesn’t name keep .txt.", offsets: [153537] },
2309
+ { ext: "lst", label: "Slide lists", note: "Shown as a slide show.", offsets: [153542] },
2310
+ {
2311
+ ext: "rec",
2312
+ label: "Recordings",
2313
+ note: "The demo, the high-score replays and the recording of each game the player makes.",
2314
+ offsets: [153339, 153203, 153333, 153517]
2315
+ },
2316
+ { ext: "voc", label: "Voices", note: "The sound set names its voices without one; the player adds this.", offsets: [155720] },
2317
+ { ext: "his", label: "High scores", note: "The high-score file, which the player makes.", offsets: [157891, 157959] },
2318
+ { ext: "sav", label: "Saved games", note: "GAME0 to GAME9, which the player makes.", offsets: [153595, 153628] },
2319
+ { ext: "dat", label: "Save names", note: "SAVNAMES, which the player makes. CONFIG.DAT keeps its name.", offsets: [153579, 153609] },
2320
+ { ext: "pal", label: "Palettes", note: "", offsets: [] },
2321
+ { ext: "map", label: "Maps", note: "", offsets: [] },
2322
+ { ext: "bbl", label: "Background blocks", note: "", offsets: [] },
2323
+ { ext: "mon", label: "Monsters", note: "", offsets: [] },
2324
+ { ext: "mbl", label: "Monster blocks", note: "", offsets: [] },
2325
+ { ext: "chr", label: "Characters", note: "", offsets: [] },
2326
+ { ext: "cbl", label: "Character blocks", note: "", offsets: [] },
2327
+ { ext: "snd", label: "Sound sets", note: "", offsets: [] },
2328
+ { ext: "cmf", label: "Songs", note: "", offsets: [] }
2329
+ ], be = new Map(ms.map((e) => [e.ext, e])), Ge = "file.ext.";
2330
+ function ys(e) {
2331
+ return e.startsWith(Ge) ? be.get(e.slice(Ge.length)) : void 0;
2332
+ }
2333
+ const hs = /* @__PURE__ */ new Set(["exe", "com", "bat", "sys", "drv", "hlp", "cfg", "gmx", "zip"]), ks = /^[a-z0-9_\-~!@#$^&()]{3}$/;
2334
+ function xs(e, t) {
2335
+ if (typeof t != "string") return "not text";
2336
+ const s = t.toLowerCase();
2337
+ if (s.length !== 3) return "exactly 3 characters, as the extension it replaces";
2338
+ if (!ks.test(s)) return "letters, digits or _ - ~ ! @ # $ ^ & ( ) only";
2339
+ if (s !== e && be.has(s)) return `.${s} is Game-Maker’s own extension for ${be.get(s).label.toLowerCase()}`;
2340
+ if (hs.has(s)) return `.${s} is a DOS or player file’s own`;
2341
+ }
2342
+ const gs = new Map(lt.map((e) => [e.id, e])), at = /%[-+ #0]*\d*(?:\.\d+)?[lh]?[diouxXcs]/g;
2343
+ function Xe(e) {
2344
+ return e.match(at) ?? [];
2345
+ }
2346
+ const de = (e, t, s) => typeof e == "number" && Number.isInteger(e) && e >= t && e <= s;
2347
+ function ps(e, t) {
2348
+ switch (e.kind) {
2349
+ case "text":
2350
+ case "format": {
2351
+ if (typeof t != "string") return "not text";
2352
+ if (t.length > e.length) return `longer than ${e.length} characters`;
2353
+ if (/[^\x20-\x7e]/.test(t)) return "only plain letters, digits and punctuation (no accents or symbols past ~)";
2354
+ const s = Xe(t), o = Xe(e.stock);
2355
+ return s.join(`
2356
+ `) !== o.join(`
2357
+ `) ? `keep ${o.length ? o.join(" ") : "no % codes"} as they are` : t.replace(at, "").includes("%") ? "a % sign here would be read as a code" : void 0;
2358
+ }
2359
+ case "number":
2360
+ return de(t, e.min, e.max) ? void 0 : `a whole number from ${e.min} to ${e.max}`;
2361
+ case "rgb":
2362
+ return Array.isArray(t) && t.length === 3 && t.every((s) => de(s, 0, 63)) ? void 0 : "three levels from 0 to 63";
2363
+ case "select":
2364
+ return typeof t == "string" && t in ds ? void 0 : "one of the player’s colors";
2365
+ case "frame": {
2366
+ if (!Array.isArray(t) || t.length !== 4) return "four numbers";
2367
+ const s = t.findIndex((o, i) => !de(o, 0, Ye(e, i)));
2368
+ return s < 0 ? void 0 : `${["left", "top", "right", "bottom"][s]} from 0 to ${Ye(e, s)}`;
2369
+ }
2370
+ case "fkey":
2371
+ return t === "off" || t === "on" ? void 0 : "on or off";
2372
+ }
2373
+ }
2374
+ function Ye(e, t) {
2375
+ return e.fields[t].size === 1 ? 127 : t % 2 === 0 ? 319 : 199;
2376
+ }
2377
+ function bs(e, t) {
2378
+ return e.kind === "text" || e.kind === "format" ? typeof t == "string" && t.trimEnd() === e.stock.trimEnd() : e.kind === "fkey" ? t === "on" : JSON.stringify(t) === JSON.stringify(e.stock);
2379
+ }
2380
+ function Ss(e) {
2381
+ const t = {};
2382
+ for (const [s, o] of Object.entries({})) {
2383
+ const i = gs.get(s);
2384
+ i && !ps(i, o) && !bs(i, o) && (t[s] = o);
2385
+ const r = ys(s);
2386
+ r && !xs(r.ext, o) && o.toLowerCase() !== r.ext && (t[s] = o.toLowerCase());
2387
+ }
2388
+ return t;
2389
+ }
2390
+ const Ue = new Map(lt.map((e) => [e.id, e]));
2391
+ function Ms(e, t) {
2392
+ let s = 0;
2393
+ return e.replace(/%([-0]*)(\d*)l?([ds])/g, (o, i, r, n) => {
2394
+ const a = t[s++], l = String(n === "d" ? Math.trunc(Number(a)) : a), d = Number(r || 0);
2395
+ return i.includes("-") ? l.padEnd(d) : i.includes("0") && n === "d" ? l.padStart(d, "0") : l.padStart(d);
2396
+ });
2397
+ }
2398
+ function vs(e) {
2399
+ const t = Ss(), s = (i) => {
2400
+ const r = Ue.get(i);
2401
+ if (!r) throw new Error(`No player patch ${i}`);
2402
+ return t[i] ?? (r.kind === "fkey" ? "on" : r.stock);
2403
+ }, o = (i) => s(i);
2404
+ return {
2405
+ text: (i) => s(i),
2406
+ format: (i, ...r) => Ms(s(i), r),
2407
+ color: (i, r) => {
2408
+ const [n, a, l] = o(`color.rgb.${s(r)}`);
2409
+ return Mt(i, n, a, l);
2410
+ },
2411
+ rgb: o,
2412
+ frame: (i) => s(i),
2413
+ num: (i) => s(i),
2414
+ seconds: (i) => {
2415
+ const r = s(i);
2416
+ return r < 0 ? r & 65535 : r;
2417
+ },
2418
+ fkeyOn: (i) => !Ue.has(`table.fkeys.F${i}`) || s(`table.fkeys.F${i}`) !== "off"
2419
+ };
2420
+ }
2421
+ vs();
2422
+ function ft(e, t) {
2423
+ const s = e.scroll;
2424
+ Object.assign(s, {
2425
+ nx: 0,
2426
+ ny: 0,
2427
+ totalx: 0,
2428
+ totaly: 0,
2429
+ distx: 0,
2430
+ disty: 0,
2431
+ inMotion: 0,
2432
+ movx: 0,
2433
+ movy: 0,
2434
+ littleShiftx: 0,
2435
+ littleShifty: 0,
2436
+ bx: { dscroll: 0, ctr: 0, iters: 0 },
2437
+ by: { dscroll: 0, ctr: 0, iters: 0 }
2438
+ }), s.up = t.down, s.down = t.up, s.left = t.right, s.right = t.left, s.maxX = $ / 3, s.minX = -$ / 3, s.maxY = 60, s.minY = -60, s.upStop = Math.trunc(-he / 6), s.downStop = Math.trunc(he / 6), s.leftStop = -$ / 4, s.rightStop = $ / 4;
2439
+ }
2440
+ function ut(e) {
2441
+ const t = e.scroll;
2442
+ t.totalx = t.totaly = 0;
2443
+ const s = e.ci.nextx + c / 2 - $ / 2, o = e.ci.nexty + c / 2 - he / 2;
2444
+ return t.distx = s, t.disty = o, t.left === 255 && s > t.maxX && (t.inMotion |= g), t.right === 255 && s < t.minX && (t.inMotion |= x), t.up === 255 && o > t.maxY && (t.inMotion |= p), t.down === 255 && o < t.minY && (t.inMotion |= S), t.inMotion & g && (s < t.leftStop ? t.inMotion &= ~g : t.totalx = Math.trunc((s - t.leftStop) * Ce / (t.maxX - t.leftStop))), t.inMotion & x && (s > t.rightStop ? t.inMotion &= ~x : t.totalx = -Math.trunc((-s + t.rightStop) * Ce / (t.rightStop - t.minX))), t.inMotion & p && (o < t.upStop ? t.inMotion &= ~p : t.totaly = Math.trunc((o - t.upStop) * Oe / (t.maxY - t.upStop))), t.inMotion & S && (o > t.downStop ? t.inMotion &= ~S : t.totaly = -Math.trunc((-o + t.downStop) * Oe / (t.downStop - t.minY))), t.totalx = Math.max(-28, Math.min(28, t.totalx)), t.totaly = Math.max(-28, Math.min(28, t.totaly)), t.bx = { dscroll: t.totalx, ctr: 0, iters: Re }, t.by = { dscroll: t.totaly, ctr: 0, iters: Re }, t.inMotion;
2445
+ }
2446
+ function $e(e) {
2447
+ let t = 0;
2448
+ const s = Math.abs(e.dscroll);
2449
+ if (s > e.iters) {
2450
+ for (; e.ctr < s; )
2451
+ t += q(e.dscroll), e.ctr += e.iters;
2452
+ e.ctr -= s;
2453
+ } else
2454
+ e.ctr += s, e.ctr >= e.iters && (e.ctr -= e.iters, t += q(e.dscroll));
2455
+ return t;
2456
+ }
2457
+ function As(e, t) {
2458
+ for (let i = 0; i < v; i++) {
2459
+ if (e.mm[i].monnum >= F) continue;
2460
+ const r = e.mi[i];
2461
+ r.scrPos.x !== b && (r.scrPos.x += t.x, r.scrPos.y += t.y), r.oldPos.x !== b && (r.oldPos.x += t.x, r.oldPos.y += t.y, we(r.oldPos) || (r.oldPos = { x: b, y: b }));
2462
+ }
2463
+ const s = e.ci;
2464
+ let o = !1;
2465
+ return s.nexty - s.oldy === 0 || q(t.y) === q(s.nexty - s.oldy) ? s.scry !== b && (s.scry += t.y) : (o = !0, Math.abs(s.nexty - s.oldy) < 4 && (s.scry += s.nexty - s.oldy + t.y)), s.nextx - s.oldx === 0 || q(t.x) === q(s.nextx - s.oldx) ? s.scrx !== b && (s.scrx += t.x) : (o = !0, Math.abs(s.nextx - s.oldx) < 4 && (s.scrx += s.nextx - s.oldx + t.x)), s.nextx !== b && (s.nextx += t.x, s.nexty += t.y), s.oldx !== b && (s.oldx += t.x, s.oldy += t.y), o;
2466
+ }
2467
+ function dt(e) {
2468
+ const t = e.scroll;
2469
+ t.movx += $e(t.bx), t.movy += $e(t.by);
2470
+ const s = { x: 0, y: 0 };
2471
+ if (t.movx < 0)
2472
+ for (; t.movx < 0; )
2473
+ s.x += 4, t.movx += 4, t.nx -= 4;
2474
+ else if (t.movx > 0)
2475
+ for (; t.movx > 3; )
2476
+ s.x -= 4, t.movx -= 4, t.nx += 4;
2477
+ if (t.movy < 0)
2478
+ for (; t.movy < 0; )
2479
+ s.y += 4, t.movy += 4, t.ny -= 4;
2480
+ else if (t.movy > 0)
2481
+ for (; t.movy > 3; )
2482
+ s.y -= 4, t.movy -= 4, t.ny += 4;
2483
+ return t.littleShiftx = t.movx & 3, t.littleShifty = t.movy & 3, t.nx >= c && (t.nx -= c, e.mx = (e.mx + 1) % m), t.ny >= c && (t.ny -= c, e.my = (e.my + 1) % k), t.nx < 0 && (t.nx += c, e.mx = (e.mx - 1 + m) % m), t.ny < 0 && (t.ny += c, e.my = (e.my - 1 + k) % k), ((s.x || s.y) && As(e, s) || t.littleShiftx || t.littleShifty) && ze(e), (Math.abs(s.x) + Math.abs(s.y)) / 4;
2484
+ }
2485
+ function mt(e, t) {
2486
+ const { ci: s, chr: o } = e;
2487
+ if (s.inv[0] === h + 1) for (let i = 0; i < D; i++) s.inv[i] = o.inv[i];
2488
+ for (let i = 0; i < C; i++)
2489
+ s.seqon[i] = o.sequences[i].bloc === h, s.meter[i] === -2e4 && (s.meter[i] = o.meter[i]);
2490
+ for (let i = 0; i < D; i++) for (let r = 0; r < C; r++) o.sequences[r].bloc === s.inv[i] && (s.seqon[r] = !0);
2491
+ if (s.meter[0] === -1) {
2492
+ for (let i = 0; i < 5; i++) s.meter[i] = o.meter[i];
2493
+ for (let i = 5; i < C; i++) s.meter[i] = o.sequences[i].key > 0 ? o.meter[i] : -2e4;
2494
+ for (let i = C; i < C + 10; i++) s.meter[i] = o.meter[i];
2495
+ }
2496
+ o.x[0] = t.x, o.y[0] = t.y, o.x[1] = 0, o.y[1] = 0, o.cseq = 0, o.cframe = -1, s.hitpts === -1 && (s.hitpts = s.meter[0]), s.lives === -1 && (s.lives = s.meter[1]), s.netx = 5, s.nety = 0, s.gravx = 0, s.gravy = 0, s.scrx = s.oldx = s.nextx = b, s.scry = s.oldy = s.nexty = b, s.topthere = !1, s.bottomthere = !1, s.curtop = T, s.curbottom = T, s.nextAni = e.clock, e.mx = t.x - oe / 2, e.my = t.y - ie / 2, e.mx < 0 && (e.mx += m), e.my < 0 && (e.my += k);
2497
+ for (let i = 0; i < v; i++)
2498
+ Te(e.mi[i]), le(e, i, e.mm[i].monnum, e.mm[i].curx, e.mm[i].cury), e.mi[i].fromchar = 0;
2499
+ for (let i = 0; i < h; i++)
2500
+ e.blkmap[i] = i, e.nxtchg[i] = e.bg[i].ntime > 0 ? e.clock + e.bg[i].ntime : Ht;
2501
+ if (e.blkMon = [], !e.noMons)
2502
+ for (let i = 0; i < h; i++) e.bg[i].birthTime > 0 && e.blkMon.push({ blnum: i, nexttime: e.clock + e.bg[i].birthTime });
2503
+ Lt(e), Ts(e.keydn, o.sequences[o.cseq].key);
2504
+ }
2505
+ function Ts(e, t) {
2506
+ t >= 0 && t < 128 && (e[t] = 1);
2507
+ }
2508
+ function yt(e) {
2509
+ for (let t = 0; t < h; t++) {
2510
+ const s = e.blkmap[t], o = J(e, s);
2511
+ e.nxtchg[t] <= e.clock && o.nextBl !== s && (e.blkmap[t] = o.nextBl, e.nxtchg[t] = o.ntime <= 0 ? 0 : e.nxtchg[t] + J(e, e.blkmap[t]).ntime);
2512
+ }
2513
+ }
2514
+ function re(e) {
2515
+ if (e === null || typeof e != "object") return e;
2516
+ if (ArrayBuffer.isView(e)) return e.slice();
2517
+ if (Array.isArray(e)) return e.map(re);
2518
+ const t = {};
2519
+ for (const s in e) t[s] = re(e[s]);
2520
+ return t;
2521
+ }
2522
+ class Gs {
2523
+ constructor(t, s, o = ve(), i = 1, r = !0) {
2524
+ this.scene = t, this.held = /* @__PURE__ */ new Set(), this.doScroll = !1, this.sounds = [], this.ticks = 0, this.link = -1, this.dead = !1, this.pending = [], this.randA = i >>> 0;
2525
+ const n = Qe(t.map, { play: (l) => (this.sounds.push(l), !0) }, () => this.rand());
2526
+ n.bg = O(t.bbl, h), n.mblk = O(t.mbl, z), n.cblk = O(t.cbl, T), n.mon = t.mon ?? [], n.noMons = !t.mon, n.chr = structuredClone(t.chr), n.ci = o, n.clock = 1, this.w = n, mt(n, s);
2527
+ const a = r ? 255 : 0;
2528
+ ft(n, { up: a, down: a, left: a, right: a }), n.gclk = n.clock, n.joyOldTime = n.clock;
2529
+ }
2530
+ rand() {
2531
+ this.randA = this.randA + 1831565813 >>> 0;
2532
+ let t = this.randA;
2533
+ return t = Math.imul(t ^ t >>> 15, t | 1), t ^= t + Math.imul(t ^ t >>> 7, t | 61), ((t ^ t >>> 14) >>> 0) / 4294967296;
2534
+ }
2535
+ /** Everything that changes as the scene plays, to try a move and take it back with restore(). */
2536
+ snapshot() {
2537
+ const { sound: t, rand: s, joystick: o, bg: i, mblk: r, cblk: n, mon: a, palette: l, chr: d, ...u } = this.w;
2538
+ return {
2539
+ w: re(u),
2540
+ chr: { ...d, x: [...d.x], y: [...d.y] },
2541
+ randA: this.randA,
2542
+ held: [...this.held],
2543
+ pending: [...this.pending],
2544
+ doScroll: this.doScroll,
2545
+ sounds: this.sounds.length,
2546
+ ticks: this.ticks,
2547
+ link: this.link,
2548
+ dead: this.dead
2549
+ };
2550
+ }
2551
+ restore(t) {
2552
+ const { ci: s, ...o } = re(t.w);
2553
+ Object.assign(this.w, o, { chr: { ...t.chr, x: [...t.chr.x], y: [...t.chr.y] } }), Object.assign(this.w.ci, s), this.randA = t.randA, this.held = new Set(t.held), this.pending = [...t.pending], this.doScroll = t.doScroll, this.sounds.length = t.sounds, this.ticks = t.ticks, this.link = t.link, this.dead = t.dead;
2554
+ }
2555
+ press(t) {
2556
+ this.held.has(t) || (this.held.add(t), this.event(t));
2557
+ }
2558
+ release(t) {
2559
+ this.held.has(t) && (this.held.delete(t), this.event(t | 128));
2560
+ }
2561
+ event(t) {
2562
+ this.pending.push(t), this.onKey?.(t);
2563
+ }
2564
+ /** One 18.2 Hz game tick (8 scroll steps + tick()). */
2565
+ async tick() {
2566
+ const t = this.w;
2567
+ this.ticks++;
2568
+ for (let i = 0; i < 8; i++) this.doScroll && dt(t);
2569
+ t.clock++, t.noMons || (it(t), nt(t));
2570
+ const s = t.chr;
2571
+ if (this.pending.length && (!s.sequences[s.cseq].ground || s.cframe === 0))
2572
+ for (const i of this.pending.splice(0)) We(t, i);
2573
+ let o = 0;
2574
+ do
2575
+ await ct(t, async () => -1) && (this.dead = !0);
2576
+ while (t.chr.cframe === -1 && !this.dead && o++ < 50);
2577
+ if (yt(t), ze(t), this.doScroll = ut(t) !== 0, t.monsolid = 0, t.mmSolid = v, this.scene.links) {
2578
+ const i = X(t);
2579
+ this.scene.links.forEach((r, n) => {
2580
+ this.link < 0 && i.blks.some(([a, l]) => a === r.from.x && l === r.from.y) && (this.link = n);
2581
+ });
2582
+ }
2583
+ }
2584
+ async run(t, s) {
2585
+ for (let o = 0; o < t && (await this.tick(), !(s?.(o) === !0 || this.dead || this.link >= 0)); o++)
2586
+ ;
2587
+ }
2588
+ /** Live monsters called `name`, with their block positions. */
2589
+ monsters(t) {
2590
+ const s = this.scene.names?.indexOf(t) ?? -1;
2591
+ return this.w.mm.flatMap((o, i) => o.monnum === s ? [{ x: this.w.mi[i].curx[0], y: this.w.mi[i].cury[0] }] : []);
2592
+ }
2593
+ /** Character position in pixels (x of its column, y of its bottom block). */
2594
+ get pos() {
2595
+ const t = this.w.chr;
2596
+ return { x: t.x[0] * 20 + t.x[1], y: t.y[0] * 20 + t.y[1], bx: t.x[0], by: t.y[0] };
2597
+ }
2598
+ }
2599
+ function Es(e) {
2600
+ const t = qt(e);
2601
+ return t.sampleRate ? t.samples.length / t.sampleRate * 1e3 : 0;
2602
+ }
2603
+ const zs = 18.2;
2604
+ function Ps(e) {
2605
+ const t = /* @__PURE__ */ new Map();
2606
+ for (const s of vt(e)) t.set(s.toLowerCase(), new Uint8Array(At(Tt(e, s))));
2607
+ return t;
2608
+ }
2609
+ class me {
2610
+ constructor(t) {
2611
+ this.a = t, this.next = () => {
2612
+ this.a = this.a + 1831565813 >>> 0;
2613
+ let s = this.a;
2614
+ return s = Math.imul(s ^ s >>> 15, s | 1), s ^= s + Math.imul(s ^ s >>> 7, s | 61), ((s ^ s >>> 14) >>> 0) / 4294967296;
2615
+ };
2616
+ }
2617
+ }
2618
+ class qs {
2619
+ constructor(t, s = 1) {
2620
+ this.files = t, this.seed = s, this.ci = ve(), this.scene = 0, this.prev = 0, this.link = 0, this.trail = [], this.ticks = 0, this.segments = [], this.segmentTicks = [], this.lastKeyTick = 0, this.held = /* @__PURE__ */ new Set(), this.pending = [], this.doScroll = !1, this.clock = 1, this.rand = new me(0), this.deaths = 0, this.game = zt(t.get([...t.keys()].find((o) => o.endsWith(".gam")))), this.ci.hitpts = -1, this.ci.lives = -1, this.ci.score = 0, this.ci.inv.fill(h + 1), this.ci.meter.fill(-1), this.enter(this.game.scenes[0].links[0].toScene, 0, 0);
2621
+ }
2622
+ file(t, s) {
2623
+ const o = this.game.scenes[t].files[s];
2624
+ return o ? this.files.get(o) : void 0;
2625
+ }
2626
+ /** loadscene + StartSceneInits, as playScene does them. */
2627
+ enter(t, s, o, i = !1) {
2628
+ this.scene = t, this.prev = s, this.link = o, this.trail.push(t), i || (this.segments.length && this.segmentTicks.push(this.ticks), this.segments.push({ scene: t, keys: [] }), this.ticks = 0, this.lastKeyTick = 0);
2629
+ const r = (d) => this.file(t, d);
2630
+ this.rand = new me(this.seed), (this.game.scenes[s]?.files[10] || this.game.scenes[t].files[9]) && (this.clip = void 0);
2631
+ const n = r(7) && St(r(7)), a = (d) => {
2632
+ if (!n || d < 0 || d >= Z) return !1;
2633
+ const u = n.digital[d], y = u && u[0] !== " " ? this.files.get(`${u.toLowerCase()}.voc`) : void 0;
2634
+ return y && (this.clip = { name: u, until: this.clock + Math.ceil(Es(y) / 1e3 * zs) }), !0;
2635
+ }, l = Qe(pt(r(1)), { play: a }, this.rand.next);
2636
+ l.bg = O(ae(r(2), h), h), l.mblk = O(r(4) ? ae(r(4), z) : void 0, z), l.cblk = O(ae(r(6), T), T), l.mon = r(3) ? bt(r(3)) : [], l.noMons = !r(3) || !r(4), l.chr = gt(r(5)), l.ci = this.ci, l.clock = this.clock, this.w = l, mt(l, this.game.scenes[s].links[o].to), l.gclk = l.clock, l.joyOldTime = l.clock, ft(l, this.game.scenes[t].scroll), this.doScroll = !1, this.held.clear(), this.pending = [];
2637
+ }
2638
+ press(t) {
2639
+ this.held.has(t) || (this.held.add(t), this.event(t));
2640
+ }
2641
+ release(t) {
2642
+ this.held.has(t) && (this.held.delete(t), this.event(t | 128));
2643
+ }
2644
+ releaseAll() {
2645
+ for (const t of [...this.held]) this.release(t);
2646
+ }
2647
+ isHeld(t) {
2648
+ return this.held.has(t);
2649
+ }
2650
+ event(t) {
2651
+ if (this.ended) return;
2652
+ this.pending.push(t);
2653
+ const s = this.ticks + 1;
2654
+ this.segments[this.segments.length - 1].keys.push({ delta: s - this.lastKeyTick, key: t }), this.lastKeyTick = s;
2655
+ }
2656
+ /** One game tick; returns 'link' (into another scene), 'dead' or 'end'. */
2657
+ async tick() {
2658
+ if (this.ended) return "end";
2659
+ const t = this.w;
2660
+ this.ticks++, this.clock++;
2661
+ for (let l = 0; l < 8; l++) this.doScroll && dt(t);
2662
+ t.clock = this.clock, t.noMons || (it(t), nt(t));
2663
+ const s = t.chr;
2664
+ if (this.pending.length && (!s.sequences[s.cseq].ground || s.cframe === 0)) for (const l of this.pending.splice(0)) We(t, l);
2665
+ let o = !1, i = 0;
2666
+ do
2667
+ await ct(t, async () => -1) && (o = !0);
2668
+ while (t.chr.cframe === -1 && !o && i++ < 50);
2669
+ yt(t), ze(t), this.doScroll = ut(t) !== 0, t.monsolid = 0, t.mmSolid = v;
2670
+ const r = X(t), n = this.game.scenes[this.scene].links;
2671
+ let a = w;
2672
+ for (let l = 0; l < w && a === w; l++) {
2673
+ const d = n[l];
2674
+ if (!(!d || d.toScene === Pt))
2675
+ for (let u = 0; u < 6; u++) d.from.x === r.blks[u][0] && d.from.y === r.blks[u][1] && (a = l);
2676
+ }
2677
+ if (o)
2678
+ return this.deaths++, this.ci.lives > 0 ? (this.ci.lives--, this.ci.hitpts = -1, this.enter(this.scene, this.prev, this.link, !0)) : this.ended = "lost", "dead";
2679
+ if (a !== w) {
2680
+ const l = n[a].toScene;
2681
+ return l === 1 ? (this.ended = "won", "end") : (this.enter(l, this.scene, a), "link");
2682
+ }
2683
+ }
2684
+ /** Game ticks until the clip playing now ends (0 when none is). */
2685
+ get clipTicksLeft() {
2686
+ return this.clip ? Math.max(0, this.clip.until - this.clock) : 0;
2687
+ }
2688
+ /**
2689
+ * Stands still until the clip playing now has played to the end, so the bot's next sound
2690
+ * (a jump, a pickup) doesn't cut it off: a level's start clip, say. Returns what a tick
2691
+ * returned if play left the scene meanwhile.
2692
+ */
2693
+ async waitForClip() {
2694
+ for (this.releaseAll(); this.clipTicksLeft > 0; ) {
2695
+ const t = await this.tick();
2696
+ if (t) return t;
2697
+ }
2698
+ }
2699
+ /** The character's block and the pixels past it. */
2700
+ get pos() {
2701
+ const t = this.w.chr;
2702
+ return { x: t.x[0], y: t.y[0], sx: t.x[1], sy: t.y[1] };
2703
+ }
2704
+ meter(t) {
2705
+ return this.ci.meter[t];
2706
+ }
2707
+ /** Money: Game-Maker's counter 3, which shows meter - 1. */
2708
+ get money() {
2709
+ return this.ci.meter[3] - 1;
2710
+ }
2711
+ /** The block number at (x, y) as it is now (a block taken or pushed is a new block number). */
2712
+ blockAt(t, s) {
2713
+ return this.w.map[s * m + t];
2714
+ }
2715
+ /** The block's attributes as shown now (timed blocks change by themselves). */
2716
+ shown(t, s) {
2717
+ return J(this.w, this.w.blkmap[this.blockAt(t, s)] ?? 0);
2718
+ }
2719
+ solidAt(t, s) {
2720
+ return this.shown(t, s).solid !== 0;
2721
+ }
2722
+ snapshot() {
2723
+ return {
2724
+ w: Ve(this.w),
2725
+ rand: this.rand.a,
2726
+ scene: this.scene,
2727
+ prev: this.prev,
2728
+ link: this.link,
2729
+ ticks: this.ticks,
2730
+ clock: this.clock,
2731
+ lastKeyTick: this.lastKeyTick,
2732
+ held: [...this.held],
2733
+ pending: [...this.pending],
2734
+ doScroll: this.doScroll,
2735
+ ended: this.ended,
2736
+ deaths: this.deaths,
2737
+ trail: [...this.trail],
2738
+ segments: this.segments.map((t) => ({ scene: t.scene, keys: t.keys.slice() })),
2739
+ segmentTicks: [...this.segmentTicks],
2740
+ clip: this.clip && { ...this.clip }
2741
+ };
2742
+ }
2743
+ restore(t) {
2744
+ this.rand = new me(t.rand);
2745
+ const s = Ve(t.w);
2746
+ s.rand = this.rand.next, this.w = s, this.ci = s.ci, this.scene = t.scene, this.prev = t.prev, this.link = t.link, this.ticks = t.ticks, this.clock = t.clock, this.lastKeyTick = t.lastKeyTick, this.held = new Set(t.held), this.pending = [...t.pending], this.doScroll = t.doScroll, this.ended = t.ended, this.deaths = t.deaths, this.trail = [...t.trail], this.segments = t.segments.map((o) => ({ scene: o.scene, keys: o.keys.slice() })), this.segmentTicks = [...t.segmentTicks], this.clip = t.clip && { ...t.clip };
2747
+ }
2748
+ }
2749
+ function Ve(e) {
2750
+ const { sound: t, rand: s, joystick: o, bg: i, mblk: r, cblk: n, mon: a, palette: l, chr: d, ...u } = e;
2751
+ return { ...Se(u), sound: t, rand: s, joystick: o, bg: i, mblk: r, cblk: n, mon: a, palette: l, chr: { ...d, x: [...d.x], y: [...d.y] } };
2752
+ }
2753
+ function Se(e) {
2754
+ if (e === null || typeof e != "object") return e;
2755
+ if (ArrayBuffer.isView(e)) return e.slice();
2756
+ if (Array.isArray(e)) return e.map(Se);
2757
+ const t = {};
2758
+ for (const s in e) t[s] = Se(e[s]);
2759
+ return t;
2760
+ }
2761
+ function Xs(e) {
2762
+ const t = Et(e);
2763
+ return class extends qs {
2764
+ constructor(s = Ps(t), o = 1) {
2765
+ super(s, o);
2766
+ }
2767
+ };
2768
+ }
2769
+ export {
2770
+ qs as GameSim,
2771
+ Gs as Sim,
2772
+ zs as TICKS_PER_SECOND,
2773
+ Xs as diskSim,
2774
+ ve as newCharInfo,
2775
+ Ps as readDisk
2776
+ };