Fix nameOnRight for intercut scenes

This commit is contained in:
2023-03-08 10:21:12 -07:00
parent 766caad67f
commit 447e2e4839
2 changed files with 49 additions and 37 deletions

View File

@@ -51,17 +51,21 @@ ADDCHARACTER "black" Right FacingLeft
// Speaker name not being bumped to right side for stage-right actors while intercutting: // Speaker name not being bumped to right side for stage-right actors while intercutting:
(preload (preload
(newFlxSet "intercutSet" AssetPaths.whiteBackground1280x720__png) (newFlxSet "intercutSet" AssetPaths.whiteBackground1280x720__png)
(newSceneFromSet "intercutScene" "intercutSet")) (newSceneFromSet "intercutScene" "intercutSet" Day Exterior))
SETSCENE "intercutScene" SETSCENE "intercutScene"
ADDCHARACTER "black" right FacingLeft ADDCHARACTER "black" Right FacingLeft
INTERCUT [=>"white" basicSceneKey "black" "intercutScene"] INTERCUT [=>"white" basicSceneKey =>"black" "intercutScene"]
(prop &mut speakerNameTextLeftX 0.0) (prop &mut speakerNameTextLeftX 0.0)
{(delay 0.01 ->:Void (set speakerNameTextLeftX flxDirector.speakerNameText.x))(cc)} {(delay 0.01 ->:Void (set speakerNameTextLeftX flxDirector.speakerNameText.x))(cc)}
NORMALSPEECH "white" "" "Testing line one" NORMALSPEECH "white" "" "Testing line one"
{(delay 0.01 ->:Void {(assert (> flxDirector.speakerNameText.x speakerNameTextLeftX))})(cc)} {(delay 0.01 ->:Void {(assert (> flxDirector.speakerNameText.x speakerNameTextLeftX))})(cc)}
NORMALSPEECH "black" "" "Testing line two" NORMALSPEECH "black" "" "Testing line two"
{(delay 0.01 ->:Void (set speakerNameTextLeftX flxDirector.speakerNameText.x))(cc)}
ONPHONESPEECH "white" "" "Testing line one"
{(delay 0.01 ->:Void {(assert (> flxDirector.speakerNameText.x speakerNameTextLeftX))})(cc)}
ONPHONESPEECH "black" "" "Testing line two"
ENDINTERCUT ENDINTERCUT

View File

@@ -39,39 +39,43 @@
(prop &mut :FuzzyMap<String> intercutMap) (prop &mut :FuzzyMap<String> intercutMap)
(prop &mut :Map<String,Int> altIdx (new Map)) (prop &mut :Map<String,Int> altIdx (new Map))
(method :Void showDialog [actorName dialogType wryly text cc] (method :Void processIntercut [actorName :Continuation cc]
(when intercutMap (when intercutMap
(whenLet [sceneForActor (try (dictGet intercutMap actorName) (catch [e] null))] (whenLet [sceneForActor (try (dictGet intercutMap actorName) (catch [e] null))]
(unless (= sceneForActor sceneKey) (unless (= sceneForActor sceneKey)
(setScene sceneForActor ->{})))) (setScene sceneForActor cc)
(return))))
(let [cc ->:Void {(director.hideDialog) (cc)} (cc))
&mut skipCC cc] (method :Void showDialog [actorName dialogType wryly text cc]
// When an actorName is given, check for a voiced line to play. (processIntercut actorName
// Otherwise, assume it is un-voiced super text (makeCC
(when (and actorName (< 0 (count voiceTracks))) (let [cc ->:Void {(director.hideDialog) (cc)}
(case (try (dictGet voiceLines "$actorName $text") (catch [e] (print e) null)) &mut skipCC cc]
((objectWith trackKey start end alts) // When an actorName is given, check for a voiced line to play.
(case (dictGet altIdx "$actorName $text") // Otherwise, assume it is un-voiced super text
(null (when (and actorName (< 0 (count voiceTracks)))
(dictSet altIdx "$actorName $text" 0) (case (try (dictGet voiceLines "$actorName $text") (catch [e] (print e) null))
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc)) ((objectWith trackKey start end alts)
((when (>= idx alts.length) idx) (case (dictGet altIdx "$actorName $text")
(dictSet altIdx "$actorName $text" 0) (null
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc)) (dictSet altIdx "$actorName $text" 0)
(idx (director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc))
(let [alt (nth alts idx) ((when (>= idx alts.length) idx)
start alt.start (dictSet altIdx "$actorName $text" 0)
end alt.end] (director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc))
(+= (dictGet altIdx "$actorName $text") 1) (idx
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc)))) (let [alt (nth alts idx)
start alt.start
(set skipCC ->:Void {(director.stopVoiceTrack (dictGet voiceTracks trackKey)) (cc)})) end alt.end]
((objectWith trackKey start end) (+= (dictGet altIdx "$actorName $text") 1)
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc) (director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc))))
(set skipCC ->:Void {(director.stopVoiceTrack (dictGet voiceTracks trackKey)) (cc)}))
(otherwise))) (set skipCC ->:Void {(director.stopVoiceTrack (dictGet voiceTracks trackKey)) (cc)}))
(director.showDialog actorName dialogType wryly text skipCC))) ((objectWith trackKey start end)
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc)
(set skipCC ->:Void {(director.stopVoiceTrack (dictGet voiceTracks trackKey)) (cc)}))
(otherwise)))
(director.showDialog actorName dialogType wryly text skipCC)))))
(method newVoiceTrack [actorName :VoiceTrack track :String lineJson] (method newVoiceTrack [actorName :VoiceTrack track :String lineJson]
(let [actorNumVoiceTracks (or (dictGet voiceTracksPerActor actorName) 0) (let [actorNumVoiceTracks (or (dictGet voiceTracksPerActor actorName) 0)
@@ -384,7 +388,9 @@
// TODO themed superText // TODO themed superText
(hollywooMethod normalSpeech true [actorName wryly text :Continuation cc] (hollywooMethod normalSpeech true [actorName wryly text :Continuation cc]
(showDialog actorName (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc)) (processIntercut actorName
(makeCC
(showDialog actorName (OnScreen (dictGet .characters (_currentScene) actorName)) wryly text cc))))
(hollywooMethod offScreenSpeech true [actorName wryly text :Continuation cc] (hollywooMethod offScreenSpeech true [actorName wryly text :Continuation cc]
(showDialog actorName (OffScreen (dictGet actors actorName)) wryly text cc)) (showDialog actorName (OffScreen (dictGet actors actorName)) wryly text cc))
@@ -393,9 +399,11 @@
(showDialog actorName (VoiceOver (dictGet actors actorName)) wryly text cc)) (showDialog actorName (VoiceOver (dictGet actors actorName)) wryly text cc))
(hollywooMethod onPhoneSpeech true [actorName wryly text :Continuation cc] (hollywooMethod onPhoneSpeech true [actorName wryly text :Continuation cc]
(showDialog actorName (ifLet [charOnScreen (try (dictGet .characters (_currentScene) actorName) (catch [e] null))] (processIntercut actorName
(OnScreen charOnScreen) (makeCC
(FromPhone (dictGet actors actorName))) wryly text cc)) (showDialog actorName (ifLet [charOnScreen (try (dictGet .characters (_currentScene) actorName) (catch [e] null))]
(OnScreen charOnScreen)
(FromPhone (dictGet actors actorName))) wryly text cc))))
(hollywooMethod cutToBlack true [seconds :Continuation cc] (hollywooMethod cutToBlack true [seconds :Continuation cc]
(director.showBlackScreen) (director.showBlackScreen)