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 backSlash = "\\";
public static var doubleQuote = "\"";
}

View File

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

View File

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

View File

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

View File

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