sci2-ts 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/lib/992.sc +17 -1
- package/lib/996.sc +19 -7
- package/lib/999.sc +2 -1
- package/lib/system.sh +11 -0
- package/package.json +1 -1
- package/tools/site/build.js +8 -6
- package/tools/site/build.ts +7 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,18 @@ All notable changes to this project. Versions follow [Semantic Versioning](https
|
|
|
4
4
|
and the entries are generated from commit messages
|
|
5
5
|
([Conventional Commits](https://www.conventionalcommits.org/)) when a release is made.
|
|
6
6
|
|
|
7
|
+
## [0.7.0](https://github.com/rlueder/sci-ts/compare/v0.6.1...v0.7.0) (2026-10-01)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* **lib:** text speed, and dismissing a line from the keyboard ([#6](https://github.com/rlueder/sci-ts/issues/6)) ([3ab244b](https://github.com/rlueder/sci-ts/commit/3ab244b0d96a34dd0c3e7d13b1f52404fdceccfe))
|
|
12
|
+
|
|
13
|
+
## [0.6.1](https://github.com/rlueder/sci-ts/compare/v0.6.0...v0.6.1) (2026-10-01)
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
* **tools:** the site uses the game's own SoundFont ([#5](https://github.com/rlueder/sci-ts/issues/5)) ([b275b0d](https://github.com/rlueder/sci-ts/commit/b275b0d89479c233153e3efb31fafabdbc5fdcdb))
|
|
18
|
+
|
|
7
19
|
## [0.6.0](https://github.com/rlueder/sci-ts/compare/v0.5.0...v0.6.0) (2026-10-01)
|
|
8
20
|
|
|
9
21
|
### Added
|
package/lib/992.sc
CHANGED
|
@@ -58,9 +58,17 @@
|
|
|
58
58
|
add: SR_SAVE "Save the game"
|
|
59
59
|
add: SR_RESTORE "Restore a game"
|
|
60
60
|
add: SR_RESTART "Start again"
|
|
61
|
+
add: SR_TEXT (String STRING_FORMAT "Text speed: %s" (self textSpeedName:))
|
|
61
62
|
add: 0 "Carry on"
|
|
62
63
|
show: self))
|
|
63
64
|
|
|
65
|
+
(method (textSpeedName)
|
|
66
|
+
(switch textSpeed
|
|
67
|
+
(TEXT_SLOW (return "slow"))
|
|
68
|
+
(TEXT_FAST (return "fast"))
|
|
69
|
+
(TEXT_CLICK (return "until I click"))
|
|
70
|
+
(else (return "normal"))))
|
|
71
|
+
|
|
64
72
|
;; The saves there are now.
|
|
65
73
|
(method (load)
|
|
66
74
|
(self release:)
|
|
@@ -117,7 +125,15 @@
|
|
|
117
125
|
(switch v
|
|
118
126
|
(SR_SAVE (self save:))
|
|
119
127
|
(SR_RESTORE (self restore:))
|
|
120
|
-
(SR_RESTART (RestartGame))
|
|
128
|
+
(SR_RESTART (RestartGame))
|
|
129
|
+
;; The next speed, slowest first; the menu again, showing it.
|
|
130
|
+
(SR_TEXT
|
|
131
|
+
(switch textSpeed
|
|
132
|
+
(TEXT_SLOW (= textSpeed TEXT_NORMAL))
|
|
133
|
+
(TEXT_NORMAL (= textSpeed TEXT_FAST))
|
|
134
|
+
(TEXT_FAST (= textSpeed TEXT_CLICK))
|
|
135
|
+
(else (= textSpeed TEXT_SLOW)))
|
|
136
|
+
(self showMenu:))))
|
|
121
137
|
(SR_SAVE (if v (self askDescription: (- v 1))))
|
|
122
138
|
(SR_RESTORE
|
|
123
139
|
(if v
|
package/lib/996.sc
CHANGED
|
@@ -93,8 +93,9 @@
|
|
|
93
93
|
(if bitmap (Bitmap BITMAP_DISPOSE bitmap) (= bitmap 0))
|
|
94
94
|
(super dispose:)))
|
|
95
95
|
|
|
96
|
-
;; Shows a line until it's been there long enough to read
|
|
97
|
-
;;
|
|
96
|
+
;; Shows a line until it's been there long enough to read (as long as `textSpeed` says), or
|
|
97
|
+
;; the player clicks or presses Enter, Space or "."; then cues whoever asked. The narrator
|
|
98
|
+
;; speaks for no one in particular.
|
|
98
99
|
(class Narrator of Obj
|
|
99
100
|
(properties
|
|
100
101
|
caller 0
|
|
@@ -119,15 +120,26 @@
|
|
|
119
120
|
yourself:))
|
|
120
121
|
(box init:)
|
|
121
122
|
(= talking self)
|
|
122
|
-
|
|
123
|
-
|
|
123
|
+
(= until (self readingTime: (String STRING_LENGTH txt))))
|
|
124
|
+
|
|
125
|
+
;; Game time to read a line of n characters: normally two seconds, and more for longer
|
|
126
|
+
;; lines; -1 is until the player dismisses it.
|
|
127
|
+
(method (readingTime n)
|
|
128
|
+
(switch textSpeed
|
|
129
|
+
(TEXT_SLOW (return (+ gameTime 180 (* 5 n))))
|
|
130
|
+
(TEXT_FAST (return (+ gameTime 70 (* 2 n))))
|
|
131
|
+
(TEXT_CLICK (return -1))
|
|
132
|
+
(else (return (+ gameTime 120 (* 3 n))))))
|
|
124
133
|
|
|
125
134
|
(method (doit)
|
|
126
|
-
(if (and box (>= gameTime until)) (self done:)))
|
|
135
|
+
(if (and box (!= until -1) (>= gameTime until)) (self done:)))
|
|
127
136
|
|
|
128
|
-
;; A click while a line is up dismisses it (and nothing else).
|
|
137
|
+
;; A click, Enter, Space or "." while a line is up dismisses it (and nothing else).
|
|
129
138
|
(method (handleEvent event)
|
|
130
|
-
(if (and box
|
|
139
|
+
(if (and box
|
|
140
|
+
(or (== (event type?) EV_MOUSE_DOWN)
|
|
141
|
+
(and (== (event type?) EV_KEY_DOWN)
|
|
142
|
+
(or (== (event message?) KEY_ENTER) (== (event message?) KEY_SPACE) (== (event message?) KEY_PERIOD)))))
|
|
131
143
|
(event claimed: TRUE)
|
|
132
144
|
(self done:)
|
|
133
145
|
(return TRUE))
|
package/lib/999.sc
CHANGED
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
textStyle ; how text boxes and menus look (a TextStyle)
|
|
32
32
|
inventory ; what the hero carries (an Inventory)
|
|
33
33
|
theItem ; the item picked to use, or 0
|
|
34
|
-
iconBar
|
|
34
|
+
iconBar ; the icon bar (an IconBar)
|
|
35
|
+
textSpeed) ; how long a line stays up: TEXT_NORMAL, TEXT_SLOW, TEXT_FAST, TEXT_CLICK
|
|
35
36
|
|
|
36
37
|
(procedure (SetFlag n)
|
|
37
38
|
(|= [gameFlags (/ n 16)] (<< 1 (mod n 16))))
|
package/lib/system.sh
CHANGED
|
@@ -44,6 +44,14 @@
|
|
|
44
44
|
(define SR_RESTORE 3)
|
|
45
45
|
(define SR_RESTART 4)
|
|
46
46
|
(define SR_NAME 5)
|
|
47
|
+
(define SR_TEXT 6)
|
|
48
|
+
|
|
49
|
+
;; How long a line stays up (the textSpeed global): normal (the default), slow, fast, or
|
|
50
|
+
;; until the player clicks.
|
|
51
|
+
(define TEXT_NORMAL 0)
|
|
52
|
+
(define TEXT_SLOW 1)
|
|
53
|
+
(define TEXT_FAST 2)
|
|
54
|
+
(define TEXT_CLICK 3)
|
|
47
55
|
|
|
48
56
|
;; Event types, as GetEvent reports them.
|
|
49
57
|
(define EV_NULL 0)
|
|
@@ -54,6 +62,8 @@
|
|
|
54
62
|
;; Keys (an event's message).
|
|
55
63
|
(define KEY_TAB 9)
|
|
56
64
|
(define KEY_ENTER 13)
|
|
65
|
+
(define KEY_SPACE 32)
|
|
66
|
+
(define KEY_PERIOD 46)
|
|
57
67
|
(define KEY_ESCAPE 27)
|
|
58
68
|
(define KEY_F5 $3f00)
|
|
59
69
|
(define KEY_F7 $4100)
|
|
@@ -78,6 +88,7 @@
|
|
|
78
88
|
(define ARRAY_AT_PUT 3)
|
|
79
89
|
(define ARRAY_FREE 4)
|
|
80
90
|
(define STRING_LENGTH 10)
|
|
91
|
+
(define STRING_FORMAT 11)
|
|
81
92
|
(define STRING_FORMAT_INTO 12)
|
|
82
93
|
(define ARRAY_COPY 6)
|
|
83
94
|
|
package/package.json
CHANGED
package/tools/site/build.js
CHANGED
|
@@ -10,12 +10,13 @@ import { markdown } from "./markdown.js";
|
|
|
10
10
|
* docs/... docs/**.md as pages, and their screenshots
|
|
11
11
|
* play/play.html the player, with the game in play/game/
|
|
12
12
|
*
|
|
13
|
-
* The SoundFont for music is copied from
|
|
14
|
-
*
|
|
13
|
+
* The SoundFont for music (GeneralUser-GS.sf2) is copied from the game's assets/soundfonts/,
|
|
14
|
+
* or else this repository's, if it's there (it isn't part of either repository: a game's
|
|
15
|
+
* publishing workflow fetches it); without it, games play silently.
|
|
15
16
|
*/
|
|
16
17
|
const ROOT = resolve(import.meta.dirname, "../..");
|
|
17
18
|
const VIEWER = join(ROOT, "apps/viewer");
|
|
18
|
-
const SOUNDFONT =
|
|
19
|
+
const SOUNDFONT = "assets/soundfonts/GeneralUser-GS.sf2";
|
|
19
20
|
export async function buildSite(gameDir, outDir, options = {}) {
|
|
20
21
|
const out = resolve(outDir);
|
|
21
22
|
// Whose Markdown becomes the pages: this repository's, or the game's own.
|
|
@@ -40,9 +41,10 @@ export async function buildSite(gameDir, outDir, options = {}) {
|
|
|
40
41
|
writeFileSync(join(play, "game", name), data);
|
|
41
42
|
// What the player lists in place of the dev server's directory listings.
|
|
42
43
|
writeFileSync(join(play, "game/files.json"), JSON.stringify({ "": Object.keys(files) }));
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const sf2 = [join(resolve(gameDir), SOUNDFONT), join(ROOT, SOUNDFONT)].find((f) => existsSync(f));
|
|
45
|
+
const soundFont = sf2 !== undefined;
|
|
46
|
+
if (sf2)
|
|
47
|
+
cpSync(sf2, join(play, "soundfonts", basename(sf2)));
|
|
46
48
|
// The pages.
|
|
47
49
|
const sources = [
|
|
48
50
|
...["README.md", "CONTRIBUTING.md", "CHANGELOG.md"].filter((f) => existsSync(join(docs, f))),
|
package/tools/site/build.ts
CHANGED
|
@@ -11,12 +11,13 @@ import { markdown } from "./markdown.ts";
|
|
|
11
11
|
* docs/... docs/**.md as pages, and their screenshots
|
|
12
12
|
* play/play.html the player, with the game in play/game/
|
|
13
13
|
*
|
|
14
|
-
* The SoundFont for music is copied from
|
|
15
|
-
*
|
|
14
|
+
* The SoundFont for music (GeneralUser-GS.sf2) is copied from the game's assets/soundfonts/,
|
|
15
|
+
* or else this repository's, if it's there (it isn't part of either repository: a game's
|
|
16
|
+
* publishing workflow fetches it); without it, games play silently.
|
|
16
17
|
*/
|
|
17
18
|
const ROOT = resolve(import.meta.dirname, "../..");
|
|
18
19
|
const VIEWER = join(ROOT, "apps/viewer");
|
|
19
|
-
const SOUNDFONT =
|
|
20
|
+
const SOUNDFONT = "assets/soundfonts/GeneralUser-GS.sf2";
|
|
20
21
|
|
|
21
22
|
export async function buildSite(
|
|
22
23
|
gameDir: string,
|
|
@@ -46,8 +47,9 @@ export async function buildSite(
|
|
|
46
47
|
for (const [name, data] of Object.entries(files)) writeFileSync(join(play, "game", name), data);
|
|
47
48
|
// What the player lists in place of the dev server's directory listings.
|
|
48
49
|
writeFileSync(join(play, "game/files.json"), JSON.stringify({ "": Object.keys(files) }));
|
|
49
|
-
const
|
|
50
|
-
|
|
50
|
+
const sf2 = [join(resolve(gameDir), SOUNDFONT), join(ROOT, SOUNDFONT)].find((f) => existsSync(f));
|
|
51
|
+
const soundFont = sf2 !== undefined;
|
|
52
|
+
if (sf2) cpSync(sf2, join(play, "soundfonts", basename(sf2)));
|
|
51
53
|
|
|
52
54
|
// The pages.
|
|
53
55
|
const sources = [
|