skip voice tracks when skipping dialogue

This commit is contained in:
2021-12-30 12:03:54 -07:00
parent 4515baa598
commit b6f03c8f2b
2 changed files with 7 additions and 4 deletions

View File

@@ -17,6 +17,7 @@ interface Director<Set, StagePosition, StageFacing, ScreenPosition, Actor, Sound
function playSound(sound:Sound, volumeMod:Float, waitForEnd:Bool, cc:Continuation):Void; function playSound(sound:Sound, volumeMod:Float, waitForEnd:Bool, cc:Continuation):Void;
function playSong(song:Song, volumeMod:Float, loop:Bool, waitForEnd:Bool, cc:Continuation):Void; function playSong(song:Song, volumeMod:Float, loop:Bool, waitForEnd:Bool, cc:Continuation):Void;
function playVoiceTrack(track:VoiceTrack, volumeMod:Float, start:Float, end:Float, cc:Continuation):Void; function playVoiceTrack(track:VoiceTrack, volumeMod:Float, start:Float, end:Float, cc:Continuation):Void;
function stopVoiceTrack(track:VoiceTrack):Void;
function stopSong():Void; function stopSong():Void;
function startWaitForInput(cc:Continuation):Void; function startWaitForInput(cc:Continuation):Void;
function stopWaitForInput():Void; function stopWaitForInput():Void;

View File

@@ -41,15 +41,17 @@
(whenLet [sceneForActor (dictGet intercutMap actorName)] (whenLet [sceneForActor (dictGet intercutMap actorName)]
(setScene sceneForActor ->{}))) (setScene sceneForActor ->{})))
(let [cc ->:Void {(director.hideDialog) (cc)}] (let [cc ->:Void {(director.hideDialog) (cc)}
(director.showDialog actorName dialogType wryly text cc) &mut skipCC cc]
// When an actorName is given, check for a voiced line to play. // When an actorName is given, check for a voiced line to play.
// Otherwise, assume it is un-voiced super text // Otherwise, assume it is un-voiced super text
(when (and actorName (< 0 (count voiceTracks))) (when (and actorName (< 0 (count voiceTracks)))
(case (try (dictGet voiceLines "$actorName $text") (catch [e] (print e) null)) (case (try (dictGet voiceLines "$actorName $text") (catch [e] (print e) null))
((objectWith trackKey start end) ((objectWith trackKey start end)
(director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc)) (director.playVoiceTrack (dictGet voiceTracks trackKey) 1 start end cc)
(otherwise))))) (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)