From b0726f1495d156f778190b491e1a2906a6d709f5 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Wed, 24 Sep 2025 18:03:37 -0500 Subject: [PATCH] update kiss & fix some things --- src/hollywoo/HollywooDSL.kiss | 11 +++++++++++ src/hollywoo/Movie.hx | 4 ++-- src/hollywoo/Movie.kiss | 9 ++++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/hollywoo/HollywooDSL.kiss b/src/hollywoo/HollywooDSL.kiss index 631a279..92ae2a9 100644 --- a/src/hollywoo/HollywooDSL.kiss +++ b/src/hollywoo/HollywooDSL.kiss @@ -50,6 +50,17 @@ `(let [,name .set (dictGet scenes ,sceneKey)] ,@body)) +// Do something with the current scene's camera +(defMacro withSceneCamera [name &body body] + `(let [,name .camera (_currentScene)] + ,@body + (cc))) + +// like withSceneCamera, but you promise to call CC yourself in the body: +(defMacro withSceneCameraCC [name &body body] + `(let [,name .camera (_currentScene)] + ,@body)) + // When this file is loaded, all expressions in (preload <...>) will be collected. When (end) is called, they will // be injected into a method called (doPreload). // This allows assets to be declared in Hollywoo files where they first appear, but still loaded before execution starts. diff --git a/src/hollywoo/Movie.hx b/src/hollywoo/Movie.hx index 58059bf..3b9fc1b 100644 --- a/src/hollywoo/Movie.hx +++ b/src/hollywoo/Movie.hx @@ -1967,7 +1967,7 @@ class MovieVoid):Int return { + @:keep public function miscInt(key:String, ?defaultVal:Int, ?onChange:(Int)->Void):Int return { if (Prelude.truthy(onChange)) { miscIntChangeEvents[key] = onChange; } else null; @@ -1978,7 +1978,7 @@ class MovieVoid):Float return { + @:keep public function miscFloat(key:String, ?defaultVal:Float, ?onChange:(Float)->Void):Float return { if (Prelude.truthy(onChange)) { miscFloatChangeEvents[key] = onChange; } else null; diff --git a/src/hollywoo/Movie.kiss b/src/hollywoo/Movie.kiss index 5c5ae9c..e5f0cce 100644 --- a/src/hollywoo/Movie.kiss +++ b/src/hollywoo/Movie.kiss @@ -497,7 +497,8 @@ (unless (positionsInThisScene.contains positionKey) (positionsInThisScene.push positionKey))) // Store a record in the scene of which actors/props are using which position keys: - (dictSet .actorAndPropPositionKeys (_currentScene) holder positionKey) + (when holder + (dictSet .actorAndPropPositionKeys (_currentScene) holder positionKey)) (let [pos (stagePositions.get positionKey)] (ifLet [relativeKey .value (positionRelativity.get positionKey) @@ -969,6 +970,7 @@ (when cc (TimerWithPause.delay cc (* strobeSec 2 (+ 1 times)))))) + @:keep (method :Void handleCaption [:Bool skipping :String name] (when showCaptions (whenLet [desc (dictGet soundDescriptions name) @@ -979,6 +981,7 @@ (makeCC null (director.hideCaption id))) true))) + @:keep (method :Int miscInt [:String key &opt :Int defaultVal :Int->Void onChange] (when onChange (dictSet miscIntChangeEvents key onChange)) @@ -989,7 +992,8 @@ (miscInts.put key (new JsonInt defaultVal))) defaultVal })) - + + @:keep (method :Float miscFloat [:String key &opt :Float defaultVal :Float->Void onChange] (when onChange (dictSet miscFloatChangeEvents key onChange)) @@ -1569,7 +1573,6 @@ (director.hideTitleCard) (cc)) -// TODO interp reader macro (hard to do for this one) (hollywooMacro timedTitleCardV2 [time lines &opt label] `(commands SHOWTITLECARD ,lines