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:
(preload
(newFlxSet "intercutSet" AssetPaths.whiteBackground1280x720__png)
(newSceneFromSet "intercutScene" "intercutSet"))
(newSceneFromSet "intercutScene" "intercutSet" Day Exterior))
SETSCENE "intercutScene"
ADDCHARACTER "black" right FacingLeft
INTERCUT [=>"white" basicSceneKey "black" "intercutScene"]
ADDCHARACTER "black" Right FacingLeft
INTERCUT [=>"white" basicSceneKey =>"black" "intercutScene"]
(prop &mut speakerNameTextLeftX 0.0)
{(delay 0.01 ->:Void (set speakerNameTextLeftX flxDirector.speakerNameText.x))(cc)}
NORMALSPEECH "white" "" "Testing line one"
{(delay 0.01 ->:Void {(assert (> flxDirector.speakerNameText.x speakerNameTextLeftX))})(cc)}
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

View File

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