Hollywoo allow defining positions at runtime

This commit is contained in:
2023-04-12 17:23:49 -06:00
parent b8668b074c
commit 754da631c2
2 changed files with 16 additions and 0 deletions

View File

@@ -45,6 +45,7 @@ interface Director<Set:Cloneable<Set>, Actor, Sound, Song, Prop, VoiceTrack, Cam
function chooseString(prompt:String, choices:Array<String>, submit:String->Void):Void;
function defineStagePosition(submit:StagePosition->Void):Void;
function defineLightSource(submit:LightSource->Void):Void;
function showSet(set:Set, time:SceneTime, perspective:ScenePerspective, appearance:Appearance, camera:Camera, cc:Continuation):Void;

View File

@@ -155,9 +155,13 @@
(director.resume)
(TimerWithPause.resume)))
(prop :Map<String,Array<String>> positionsInScene (new Map))
(method resolvePosition [:Dynamic position]
(typeCase [position]
([:String positionKey]
(let [positionsInThisScene (dictGet positionsInScene sceneKey)]
(unless (positionsInThisScene.contains positionKey)
(positionsInThisScene.push positionKey)))
(stagePositions.get positionKey))
([:StagePosition position]
position)
@@ -203,6 +207,15 @@
->cc (director.showPauseMenu cc))
(#when debug
(shortcutHandler.registerItem "[d]efine [p]osition"
->cc
(director.chooseString "Which position?" (dictGet positionsInScene sceneKey)
->positionKey
(director.defineStagePosition
->[:StagePosition position] {
(stagePositions.put positionKey position)
(cc)
})))
(shortcutHandler.registerItem "[d]efine [l]ight source"
->cc
(director.defineLightSource
@@ -319,6 +332,8 @@
(_hideCurrentScene
(makeCC
(set sceneKey name)
(unless (positionsInScene.exists sceneKey)
(dictSet positionsInScene sceneKey []))
(_showScene
(dictGet scenes name)
(appearanceFlag shownScenes name)