diff --git a/src/hollywoo/FountainConversions.kiss b/src/hollywoo/FountainConversions.kiss index 3b4fc52..7c54f6a 100644 --- a/src/hollywoo/FountainConversions.kiss +++ b/src/hollywoo/FountainConversions.kiss @@ -3,27 +3,35 @@ (function isUpperCase [s] (= s (s.toUpperCase))) -(registerConversion - (new ktxt2.StreamConversion "On Phone Speech" "fountain" "hollywoo" - ->stream - ?(whenLet [(Some name) (stream.takeUntilAndDrop " (O.P.")] - (and (isUpperCase name) {(stream.dropWhitespace) !(stream.isEmpty)})) - ->stream - (let [name (whenLet [(Some name) (stream.takeUntilAndDrop " (O.P.")] name) - &mut output ""] - (stream.takeLine) - (loop - (let [wryly (ifLet [(Some w) (stream.takeBetween "(" ")\n")] w "") - line (ifLet [(Some l) (stream.takeLine)] (l.trim) (break))] - (when line - (+= output "ONPHONESPEECH \"${name}\" \"${wryly}\" ##\"${line}\"##\n")))) - output))) +(var :Array specialSpeechTags []) + +(function specialSpeech [name parenTag hmethod] + (specialSpeechTags.push parenTag) + (registerConversion + (new ktxt2.StreamConversion name "fountain" "hollywoo" + ->stream + ?(whenLet [(Some name) (stream.takeUntilAndDrop " (${parenTag}")] + (and (isUpperCase name) {(stream.dropWhitespace) !(stream.isEmpty)})) + ->stream + (let [name (whenLet [(Some name) (stream.takeUntilAndDrop " (${parenTag}")] name) + &mut output ""] + (stream.takeLine) + (loop + (let [wryly (ifLet [(Some w) (stream.takeBetween "(" ")\n")] w "") + line (ifLet [(Some l) (stream.takeLine)] (l.trim) (break))] + (when line + (+= output "$hmethod \"${name}\" \"${wryly}\" ##\"${line}\"##\n")))) + output)))) + +(specialSpeech "On Phone Speech" "O.P." "ONPHONESPEECH") +(specialSpeech "VoiceOver Speech" "V.O." "VOICEOVER") (registerConversion (new ktxt2.StreamConversion "Normal Speech" "fountain" "hollywoo" - ->stream ?(whenLet [(Some name) (stream.takeLine) - None (indexOf name "(O.P.") - None (indexOf name "(V.O.")] (and (isUpperCase name) {(stream.dropWhitespace) !(stream.isEmpty)})) + ->stream ?(whenLet [(Some name) (stream.takeLine)] + (doFor tag specialSpeechTags + (whenLet [(Some _) (indexOf name "(${tag}")] (return false))) + (and (isUpperCase name) {(stream.dropWhitespace) !(stream.isEmpty)})) ->stream (let [name (whenLet [(Some name) (stream.takeLine)] name) &mut output ""] diff --git a/src/hollywoo/Movie.kiss b/src/hollywoo/Movie.kiss index 0d1a76f..5af12cc 100644 --- a/src/hollywoo/Movie.kiss +++ b/src/hollywoo/Movie.kiss @@ -207,6 +207,9 @@ (hollywooMethod normalSpeech [actorName wryly text :Continuation cc] (showDialog actorName (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc)) +(hollywooMethod voiceOver [actorName wryly text :Continuation cc] + (showDialog actorName (VoiceOver (dictGet actors actorName)) wryly text cc)) + (hollywooMethod onPhoneSpeech [actorName wryly text :Continuation cc] (showDialog actorName (ifLet [charOnScreen (dictGet .characters (_currentScene) actorName)] (OnScreen charOnScreen) diff --git a/src/hollywoo/Scene.hx b/src/hollywoo/Scene.hx index 7ab8f89..d52f31f 100644 --- a/src/hollywoo/Scene.hx +++ b/src/hollywoo/Scene.hx @@ -22,6 +22,7 @@ typedef Character = { enum SpeechType { Super; OffScreen(actor:Actor); + VoiceOver(actor:Actor); TextMessage(actor:Actor); FromPhone(actor:Actor); OnScreen(character:Character);