sci2-ts 0.13.0 → 0.14.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 (3) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/997.sc +48 -14
  3. package/package.json +1 -1
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.14.0](https://github.com/rlueder/sci-ts/compare/v0.13.0...v0.14.0) (2026-10-02)
8
+
9
+ ### Added
10
+
11
+ * **lib:** figures drawn smaller walk and step slower, and change size in steps ([#16](https://github.com/rlueder/sci-ts/issues/16)) ([06f2b1d](https://github.com/rlueder/sci-ts/commit/06f2b1d91fd95d5b648104b435eb58e3355ba808))
12
+
7
13
  ## [0.13.0](https://github.com/rlueder/sci-ts/compare/v0.12.0...v0.13.0) (2026-10-02)
8
14
 
9
15
  ### Added
package/lib/997.sc CHANGED
@@ -6,6 +6,8 @@
6
6
  ;; Walks its client in a straight line to (x, y), a step (xStep, yStep) every
7
7
  ;; moveSpeed cycles. The interpreter does the stepping (InitBresen, DoBresen) and sends
8
8
  ;; moveDone on arrival; the client then calls motionCue:, which cues the caller.
9
+ ;; A client drawn smaller than full size (farther off) steps less often, in proportion,
10
+ ;; so it doesn't slide across the floor.
9
11
  (class Motion of Obj
10
12
  (properties
11
13
  client 0
@@ -13,6 +15,7 @@
13
15
  x 0 y 0
14
16
  dx 0 dy 0
15
17
  b-moveCnt 0 b-i1 0 b-i2 0 b-di 0 b-xAxis 0 b-incr 0
18
+ progress 0 ; towards the next step, in 128ths of a cycle at full size
16
19
  completed 0)
17
20
 
18
21
  (method (init who toX toY whoCares)
@@ -25,12 +28,21 @@
25
28
  (= x toX)
26
29
  (= y toY)
27
30
  (= b-moveCnt gameTime)
31
+ (= progress 0)
28
32
  (client setHeading: (GetAngle (client x?) (client y?) x y))
29
33
  (InitBresen self))
30
34
 
31
- (method (doit)
32
- (if (>= (- gameTime b-moveCnt) (client moveSpeed?))
33
- (= b-moveCnt gameTime)
35
+ ;; Each cycle counts for the client's size (128 at full size); a step takes moveSpeed
36
+ ;; cycles' worth.
37
+ (method (doit &tmp t e)
38
+ (= t (* (client moveSpeed?) 128))
39
+ ;; (After a long pause, at most 16 cycles count, so the sum stays in 16 bits.)
40
+ (if (> (= e (- gameTime b-moveCnt)) 16) (= e 16))
41
+ (+= progress (* e (if (& (client scaleSignal?) SCALE_ON) (client scaleX?) else 128)))
42
+ (= b-moveCnt gameTime)
43
+ (if (> progress t) (= progress t))
44
+ (if (>= progress t)
45
+ (-= progress t)
34
46
  (DoBresen self)))
35
47
 
36
48
  (method (moveDone)
@@ -139,8 +151,22 @@
139
151
  (if (> c (self lastCel:)) (= c 0))
140
152
  (client cel: c)))
141
153
 
142
- ;; Round and round while the client moves; cel 0 when it stands.
154
+ ;; Round and round while the client moves; cel 0 when it stands. Its legs keep pace with
155
+ ;; its steps: drawn smaller, it turns its cels less often, in proportion.
143
156
  (class Walk of Forward
157
+ (properties
158
+ progress 0)
159
+
160
+ (method (nextCel &tmp t e)
161
+ (= t (* (client cycleSpeed?) 128))
162
+ (if (> (= e (- gameTime cycleCnt)) 16) (= e 16))
163
+ (+= progress (* e (if (& (client scaleSignal?) SCALE_ON) (client scaleX?) else 128)))
164
+ (= cycleCnt gameTime)
165
+ (if (> progress t) (= progress t))
166
+ (if (< progress t) (return (client cel?)))
167
+ (-= progress t)
168
+ (return (+ (client cel?) cycleDir)))
169
+
144
170
  (method (doit)
145
171
  (if (client mover?)
146
172
  (super doit:)
@@ -198,12 +224,15 @@
198
224
  (client cel: c)))))
199
225
 
200
226
  ;; Sizes its client by how far up the screen it stands: frontSize percent at frontY,
201
- ;; backSize at backY, in between in proportion.
227
+ ;; backSize at backY, in between in proportion. The size changes in steps of at least `step`
228
+ ;; percent: a figure redrawn at a new size for every line it moves shimmers.
202
229
  (class Scaler of Obj
203
230
  (properties
204
231
  client 0
205
232
  frontSize 100 backSize 100
206
- frontY 190 backY 0)
233
+ frontY 190 backY 0
234
+ step 2
235
+ shown -1) ; the size the client is drawn at
207
236
 
208
237
  (method (init who fs bs fy by)
209
238
  (= client who)
@@ -220,10 +249,18 @@
220
249
  ((>= y frontY) frontSize)
221
250
  ((<= y backY) backSize)
222
251
  (else (+ backSize (/ (* (- frontSize backSize) (- y backY)) (- frontY backY))))))
223
- (client
224
- scaleX: (/ (* pct 128) 100)
225
- scaleY: (/ (* pct 128) 100)
226
- scaleSignal: (| (client scaleSignal?) SCALE_ON))))
252
+ (self show: pct))
253
+
254
+ ;; Draws the client at pct percent, if that's a step away from its size now.
255
+ (method (show pct &tmp d)
256
+ (= d (- pct shown))
257
+ (if (< d 0) (= d (- d)))
258
+ (if (or (== shown -1) (>= d step))
259
+ (= shown pct)
260
+ (client
261
+ scaleX: (/ (* pct 128) 100)
262
+ scaleY: (/ (* pct 128) 100)
263
+ scaleSignal: (| (client scaleSignal?) SCALE_ON)))))
227
264
 
228
265
  ;; Sizes its client on a floor seen at an angle, where one line across the screen isn't the
229
266
  ;; same depth all the way along. Sizes are measured at the back and front of the floor at
@@ -260,7 +297,4 @@
260
297
  ((< x x3) (+ b (/ (* (- c b) (- x x2)) (- x3 x2))))
261
298
  (else c)))
262
299
  (if (< pct 1) (= pct 1))
263
- (client
264
- scaleX: (/ (* pct 128) 100)
265
- scaleY: (/ (* pct 128) 100)
266
- scaleSignal: (| (client scaleSignal?) SCALE_ON))))
300
+ (self show: pct)))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sci2-ts",
3
- "version": "0.13.0",
3
+ "version": "0.14.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",