sci2-ts 0.6.1 → 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 CHANGED
@@ -4,6 +4,12 @@ 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
+
7
13
  ## [0.6.1](https://github.com/rlueder/sci-ts/compare/v0.6.0...v0.6.1) (2026-10-01)
8
14
 
9
15
  ### Fixed
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, or the player clicks; then
97
- ;; cues whoever asked. The narrator speaks for no one in particular.
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
- ;; Two seconds, and more for longer lines.
123
- (= until (+ gameTime 120 (* 3 (String STRING_LENGTH txt)))))
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 (== (event type?) EV_MOUSE_DOWN))
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) ; the icon bar (an 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sci2-ts",
3
- "version": "0.6.1",
3
+ "version": "0.7.0",
4
4
  "description": "An SCI2 adventure game engine in TypeScript, and the tools to make games with it",
5
5
  "license": "MIT",
6
6
  "type": "module",