fixes for Hollywoo

This commit is contained in:
2021-12-04 00:12:13 -07:00
parent 2348de8978
commit 28c9c9fa78
5 changed files with 31 additions and 33 deletions

View File

@@ -653,4 +653,5 @@ class Prelude {
public static var newLine = "\n"; public static var newLine = "\n";
public static var backSlash = "\\"; public static var backSlash = "\\";
public static var doubleQuote = "\"";
} }

View File

@@ -36,7 +36,8 @@
(Left (Left
STAGE_LEFT_X) STAGE_LEFT_X)
(Right (Right
STAGE_RIGHT_X)) STAGE_RIGHT_X)
(otherwise (throw "unsupported stage position")))
(/ character.actor.width 2))) (/ character.actor.width 2)))
(set character.actor.y ACTOR_Y) (set character.actor.y ACTOR_Y)
(currentState.add character.actor) (currentState.add character.actor)

View File

@@ -30,6 +30,13 @@
(prop &mut :String sceneKey "") (prop &mut :String sceneKey "")
(method _currentScene [] (dictGet scenes sceneKey)) (method _currentScene [] (dictGet scenes sceneKey))
(prop &mut :Map<String,String> intercutMap)
(method showDialog [actorName dialogType wryly text cc]
(when intercutMap
(whenLet [sceneForActor (dictGet intercutMap actorName)]
(setScene sceneForActor ->{})))
(director.showDialog actorName dialogType wryly text cc))
(defNew (defNew
[ [
// "View" in the Model-View-Controller architecture: // "View" in the Model-View-Controller architecture:
@@ -90,7 +97,8 @@
->{ ->{
(director.stopWaitForInput) (director.stopWaitForInput)
(cc) (cc)
})))) }))
(otherwise (throw "Unsupported delay type $delayHandling"))))
(hollywooMethod newSet [name :Set set] (hollywooMethod newSet [name :Set set]
(assert isLoading) (assert isLoading)
@@ -148,8 +156,9 @@
(hollywooMethod loopSong [name :Continuation cc &opt :Float volumeMod] (hollywooMethod loopSong [name :Continuation cc &opt :Float volumeMod]
(playSong name cc volumeMod true false)) (playSong name cc volumeMod true false))
(hollywooMethod stopSong [] (hollywooMethod stopSong [cc]
(director.stopSong)) (director.stopSong)
(cc))
(hollywooMethod newActor [name :Actor actor] (hollywooMethod newActor [name :Actor actor]
(assert isLoading) (assert isLoading)
@@ -161,8 +170,7 @@
(director.showCharacter (director.showCharacter
character character
(appearanceFlag shownCharacters actorName) (appearanceFlag shownCharacters actorName)
cc) cc)))
))
(hollywooMethod removeCharacter [actorName :Continuation cc] (hollywooMethod removeCharacter [actorName :Continuation cc]
(let [c (dictGet .characters (_currentScene) actorName)] (let [c (dictGet .characters (_currentScene) actorName)]
@@ -183,30 +191,23 @@
(hollywooMethod removeProp [name :Continuation cc] (hollywooMethod removeProp [name :Continuation cc]
(director.hideProp (dictGet props name) cc)) (director.hideProp (dictGet props name) cc))
// TODO removeProp
// Dialogue: // Dialogue:
(prop &mut :Map<String,String> intercutMap) (hollywooMethod intercut [:Map<String,String> actorNamesToSceneNames :Continuation cc]
(hollywooMethod intercut [:Map<String,String> actorNamesToSceneNames cc] (set intercutMap actorNamesToSceneNames)
(set intercutMap actorNamesToSceneNames)) (cc))
(hollywooMethod endIntercut [cc] (hollywooMethod endIntercut [:Continuation cc]
(set intercutMap null)) (set intercutMap null)
(cc))
(method showDialog [actorName dialogType wryly text cc] (hollywooMethod superText [text :Continuation cc]
(when intercutMap
(whenLet [sceneForActor (dictGet intercutMap actorName)]
(setScene sceneForActor ->{})))
(director.showDialog actorName dialogType text cc))
(hollywooMethod superText [text cc]
(showDialog "" Super "" text cc)) (showDialog "" Super "" text cc))
(hollywooMethod normalSpeech [actorName wryly text cc] (hollywooMethod normalSpeech [actorName wryly text :Continuation cc]
(showDialog actorName (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc)) (showDialog actorName (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc))
(hollywooMethod onPhoneSpeech [actorName wryly text cc] (hollywooMethod onPhoneSpeech [actorName wryly text :Continuation cc]
(showDialog actorName (ifLet [charOnScreen (dictGet .characters (_currentScene) actorName)] (showDialog actorName (ifLet [charOnScreen (dictGet .characters (_currentScene) actorName)]
(OnScreen charOnScreen) (OnScreen charOnScreen)
(FromPhone (dictGet actors actorName))) wryly text cc)) (FromPhone (dictGet actors actorName))) wryly text cc))

View File

@@ -82,8 +82,9 @@
(doFor ktxtElement (splitFileElements fileStream) (doFor ktxtElement (splitFileElements fileStream)
(case ktxtElement (case ktxtElement
((Block (objectWith source output)) ((Block (objectWith source output))
(set source (applySpecialChars source))
(+= sourceText source) (+= sourceText source)
(dictSet interp.variables "source" (removeSpecialChars source)) (dictSet interp.variables "source" source)
(dictSet interp.variables "sourceLine" ->line (nth (source.split "\n") line)) (dictSet interp.variables "sourceLine" ->line (nth (source.split "\n") line))
(dictSet interp.variables "R" re_flex.R) (dictSet interp.variables "R" re_flex.R)
(+= outputText (+= outputText
@@ -102,7 +103,7 @@
((when (and ((when (and
(= sourceType (sourceFile.extension)) (= sourceType (sourceFile.extension))
(= outputType (outputFile.extension)) (= outputType (outputFile.extension))
(canConvert (removeSpecialChars source))) (canConvert (applySpecialChars source)))
(objectWith sourceType outputType canConvert name)) (objectWith sourceType outputType canConvert name))
(dictSet validMap name c)) (dictSet validMap name c))
(otherwise {}))) (otherwise {})))
@@ -118,7 +119,7 @@
(let [conversions (validConversions conversions "${base}.${sourceExt}" "${base}.${outputExt}" element.source)] (let [conversions (validConversions conversions "${base}.${sourceExt}" "${base}.${outputExt}" element.source)]
(when (= 1 (count conversions)) (when (= 1 (count conversions))
(let [onlyConversion (first (collect (conversions.iterator)))] (let [onlyConversion (first (collect (conversions.iterator)))]
(set element.output (onlyConversion.convert (removeSpecialChars element.source))))))))) (set element.output (onlyConversion.convert (applySpecialChars element.source)))))))))
(toString elements)))) (toString elements))))
(function :String insertSpecialChars [:String text] (function :String insertSpecialChars [:String text]
@@ -130,9 +131,3 @@
(+ (substr text 0 -1) "↵")) (+ (substr text 0 -1) "↵"))
(true (true
text)))) text))))
(function :String removeSpecialChars [:String text]
(let [text (text.replace "\r" "")]
(.replace
(.replace text "¶" "\n\n")
"↵" "\n")))

View File

@@ -67,7 +67,7 @@
(when (= "Overwrite" overwrite) (when (= "Overwrite" overwrite)
(withValueOrQuickPickMap chosenConversion conversions (withValueOrQuickPickMap chosenConversion conversions
(whenLet [converted (whenLet [converted
(try (chosenConversion.convert (KTxt2.removeSpecialChars source)) (try (chosenConversion.convert (KTxt2.applySpecialChars source))
(catch [e] (errorMessage "Conversion error: $e") null))] (catch [e] (errorMessage "Conversion error: $e") null))]
(makeEdit (makeEdit
->edit (edit.replace document.uri (rangeFromStartEnd outputStart outputEnd) converted))))))) ->edit (edit.replace document.uri (rangeFromStartEnd outputStart outputEnd) converted)))))))