sci2-ts 0.16.0 → 0.17.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 +6 -0
- package/lib/991.sc +48 -3
- package/lib/995.sc +1 -0
- package/lib/996.sc +23 -13
- 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.17.0](https://github.com/rlueder/sci-ts/compare/v0.16.0...v0.17.0) (2026-10-02)
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
* **lib:** a sliding icon bar, and portraits at the bottom of the screen ([#20](https://github.com/rlueder/sci-ts/issues/20)) ([31e82ca](https://github.com/rlueder/sci-ts/commit/31e82ca33478c163b80b4f4fb16c5718b3c36bae))
|
|
12
|
+
|
|
7
13
|
## [0.16.0](https://github.com/rlueder/sci-ts/compare/v0.15.1...v0.16.0) (2026-10-02)
|
|
8
14
|
|
|
9
15
|
### Added
|
package/lib/991.sc
CHANGED
|
@@ -31,10 +31,16 @@
|
|
|
31
31
|
top -1
|
|
32
32
|
box 0
|
|
33
33
|
icons 0
|
|
34
|
-
height 0
|
|
34
|
+
height 0
|
|
35
|
+
slides TRUE ; slides down from above the screen, and back up when it closes
|
|
36
|
+
shown 0 ; how far down it is: 0 all the way, -height out of sight
|
|
37
|
+
leaving 0) ; sliding back up
|
|
35
38
|
|
|
36
39
|
(method (show &tmp x y step)
|
|
37
|
-
|
|
40
|
+
;; Opened again while it slides away: it comes back down.
|
|
41
|
+
(if box
|
|
42
|
+
(if leaving (= leaving 0) (= dialog self))
|
|
43
|
+
(return))
|
|
38
44
|
(if (!= skin -1)
|
|
39
45
|
(= box ((View new:) view: skin loop: 0 cel: 0 x: 0 y: 0 yourself:))
|
|
40
46
|
(box init:)
|
|
@@ -66,7 +72,37 @@
|
|
|
66
72
|
(self addIcon: (+ x (* 4 step)) y -1 V_ITEM)
|
|
67
73
|
(self addIcon: (+ x (* 5 step)) y 4 ICON_INVENTORY)
|
|
68
74
|
(self addIcon: (+ x (* 6 step)) y 5 ICON_MENU)
|
|
69
|
-
(= dialog self)
|
|
75
|
+
(= dialog self)
|
|
76
|
+
(if slides
|
|
77
|
+
(= shown 0)
|
|
78
|
+
(self moveBy: (- height))
|
|
79
|
+
(= shown (- height))))
|
|
80
|
+
|
|
81
|
+
;; Everything in the bar up or down by dy.
|
|
82
|
+
(method (moveBy dy &tmp node icon)
|
|
83
|
+
(box y: (+ (box y?) dy))
|
|
84
|
+
(UpdateScreenItem box)
|
|
85
|
+
(for ((= node (FirstNode (icons elements?)))) node ((= node (NextNode node)))
|
|
86
|
+
(= icon (NodeValue node))
|
|
87
|
+
(icon y: (+ (icon y?) dy))
|
|
88
|
+
(UpdateScreenItem icon)))
|
|
89
|
+
|
|
90
|
+
;; A cycle of sliding (the User calls it while the bar is up): down while it opens, up
|
|
91
|
+
;; while it closes, quickly at first and easing to a stop.
|
|
92
|
+
(method (step &tmp d)
|
|
93
|
+
(cond
|
|
94
|
+
((not box) 0)
|
|
95
|
+
(leaving
|
|
96
|
+
(= d (+ 4 (/ (+ height shown) 3)))
|
|
97
|
+
(if (> d (+ height shown)) (= d (+ height shown)))
|
|
98
|
+
(self moveBy: (- d))
|
|
99
|
+
(-= shown d)
|
|
100
|
+
(if (<= shown (- height)) (self remove:)))
|
|
101
|
+
((< shown 0)
|
|
102
|
+
(= d (+ 2 (/ (- shown) 3)))
|
|
103
|
+
(if (> d (- shown)) (= d (- shown)))
|
|
104
|
+
(self moveBy: d)
|
|
105
|
+
(+= shown d))))
|
|
70
106
|
|
|
71
107
|
;; An icon at (x, y): cel c of the bar's view (-1: the item in use), standing for `what`.
|
|
72
108
|
(method (addIcon theX theY c what &tmp icon)
|
|
@@ -85,8 +121,17 @@
|
|
|
85
121
|
(icon plane: uiPlane setPri: (+ (box priority?) 1))
|
|
86
122
|
(icons add: icon))
|
|
87
123
|
|
|
124
|
+
;; Closes it: it slides away (or goes at once, without slides), and stops taking clicks.
|
|
88
125
|
(method (hide)
|
|
89
126
|
(if (== dialog self) (= dialog 0))
|
|
127
|
+
(if (and slides box)
|
|
128
|
+
(= leaving 1)
|
|
129
|
+
else
|
|
130
|
+
(self remove:)))
|
|
131
|
+
|
|
132
|
+
(method (remove)
|
|
133
|
+
(= leaving 0)
|
|
134
|
+
(= shown 0)
|
|
90
135
|
(if icons
|
|
91
136
|
(icons eachElementDo: #dispose)
|
|
92
137
|
(icons dispose:)
|
package/lib/995.sc
CHANGED
package/lib/996.sc
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
margin 4 ; between the text and the border or frame
|
|
21
21
|
portraitFrame -1 ; a view around portraits: loop 0 behind the face, loop 1 over its edges
|
|
22
22
|
portraitX 8 ; where a portrait's face goes on the left (mirrored on the right)
|
|
23
|
-
portraitY 8
|
|
23
|
+
portraitY 8 ; its top; below 0, its bottom that far above the screen's, its text with it
|
|
24
24
|
nameFont -1)) ; the font for a speaker's name before their line (-1: the text's)
|
|
25
25
|
|
|
26
26
|
;; A box of text over the room: drawn by the interpreter into a bitmap, shown as a screen
|
|
@@ -245,21 +245,29 @@
|
|
|
245
245
|
(if (and (!= self heroTalker) heroTalker (heroTalker respondsTo: #otherSide)) (heroTalker otherSide: s))
|
|
246
246
|
(return s))
|
|
247
247
|
|
|
248
|
-
;;
|
|
249
|
-
(method (
|
|
248
|
+
;; Where the face's top goes: textStyle's portraitY, or below 0, counted up from the bottom.
|
|
249
|
+
(method (faceTop face &tmp py)
|
|
250
|
+
(= py (textStyle portraitY?))
|
|
251
|
+
(return (if (< py 0) (- (+ SCREEN_HEIGHT py) (CelHigh (face view?) 0 0)) else py)))
|
|
252
|
+
|
|
253
|
+
;; Whether the portrait on side s (frame and all) would be over the speaker's or the hero's
|
|
254
|
+
;; head.
|
|
255
|
+
(method (covers face s &tmp pw ph over left right top bottom f)
|
|
250
256
|
(= pw (CelWide (face view?) 0 0))
|
|
251
257
|
(= ph (CelHigh (face view?) 0 0))
|
|
252
|
-
(=
|
|
258
|
+
(= f (textStyle portraitFrame?))
|
|
259
|
+
(= over (if (!= f -1) (/ (- (CelWide f 0 0) pw) 2) else 0))
|
|
253
260
|
(= left (if s (- SCREEN_WIDTH (+ (textStyle portraitX?) pw over)) else (- (textStyle portraitX?) over)))
|
|
254
261
|
(= right (+ left pw over over))
|
|
255
|
-
(=
|
|
262
|
+
(= top (- (self faceTop: face) (if (!= f -1) (- (- (CelHigh f 0 0) ph) over) else 0)))
|
|
263
|
+
(= bottom (+ (self faceTop: face) ph over))
|
|
256
264
|
(return
|
|
257
265
|
(or
|
|
258
|
-
(self over: (if (== self heroTalker) ego else who) left right bottom)
|
|
259
|
-
(and (!= self heroTalker) (self over: ego left right bottom)))))
|
|
266
|
+
(self over: (if (== self heroTalker) ego else who) left right top bottom)
|
|
267
|
+
(and (!= self heroTalker) (self over: ego left right top bottom)))))
|
|
260
268
|
|
|
261
|
-
;; Whether someone's
|
|
262
|
-
(method (over body left right bottom &tmp w h)
|
|
269
|
+
;; Whether someone's head (the top quarter of their figure) is in the box.
|
|
270
|
+
(method (over body left right top bottom &tmp w h)
|
|
263
271
|
(if (or (not body) (not (body respondsTo: #view)) (& (body signal?) SIG_HIDDEN)) (return FALSE))
|
|
264
272
|
(= w (CelWide (body view?) (body loop?) (body cel?)))
|
|
265
273
|
(= h (CelHigh (body view?) (body loop?) (body cel?)))
|
|
@@ -267,7 +275,8 @@
|
|
|
267
275
|
(= w (/ (* w (body scaleX?)) 128))
|
|
268
276
|
(= h (/ (* h (body scaleY?)) 128)))
|
|
269
277
|
(return
|
|
270
|
-
(and (< (- (body x?) (/ w 2)) right) (> (+ (body x?) (/ w 2)) left)
|
|
278
|
+
(and (< (- (body x?) (/ w 2)) right) (> (+ (body x?) (/ w 2)) left)
|
|
279
|
+
(< (- (body y?) h) bottom) (> (+ (- (body y?) h) (/ h 4)) top))))
|
|
271
280
|
|
|
272
281
|
(method (say txt whoCares &tmp face l pw f fx fy over)
|
|
273
282
|
(self init: makeParts:)
|
|
@@ -279,7 +288,7 @@
|
|
|
279
288
|
(= f (textStyle portraitFrame?))
|
|
280
289
|
(= over (if (!= f -1) (/ (- (CelWide f 0 0) pw) 2) else 0))
|
|
281
290
|
(= fx (if side (- SCREEN_WIDTH (+ (textStyle portraitX?) pw)) else (textStyle portraitX?)))
|
|
282
|
-
(= fy (
|
|
291
|
+
(= fy (self faceTop: face))
|
|
283
292
|
(face x: fx y: fy loop: l cel: 0)
|
|
284
293
|
(if mouth (mouth x: fx y: fy loop: (+ l 1) cel: 0))
|
|
285
294
|
(if eyes (eyes x: fx y: fy loop: (+ l 2) cel: 0))
|
|
@@ -288,8 +297,9 @@
|
|
|
288
297
|
(back x: fx y: fy)
|
|
289
298
|
(if (and (not front) (>= (NumLoops back) 2)) (= front ((View new:) view: f loop: 1 cel: 0 yourself:)))
|
|
290
299
|
(if front (front x: fx y: fy)))
|
|
291
|
-
;; The text beside it, towards the middle
|
|
292
|
-
|
|
300
|
+
;; The text beside it, towards the middle: level with its top, or at the bottom of the
|
|
301
|
+
;; screen, ending level with its frame's bottom and growing upwards.
|
|
302
|
+
(= y (if (< (textStyle portraitY?) 0) (- (+ fy (CelHigh (face view?) l 0) over) SCREEN_HEIGHT) else fy))
|
|
293
303
|
(if side
|
|
294
304
|
(= x 6)
|
|
295
305
|
(= width (- fx (+ over 12)))
|