From b7e58bf98d1092cdc309b6f94138e705601382a9 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 4 Jul 2023 13:06:05 -0600 Subject: [PATCH] Allow voiceover for silent dialog setting --- src/hollywoo/Movie.kiss | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/hollywoo/Movie.kiss b/src/hollywoo/Movie.kiss index 44cd350..0893546 100644 --- a/src/hollywoo/Movie.kiss +++ b/src/hollywoo/Movie.kiss @@ -21,7 +21,7 @@ (prop :FuzzyMap songs (new FuzzyMap)) (prop :FuzzyMap props (new FuzzyMap)) (prop :Map voiceTracks (new Map)) - (prop :Map> customDialogTypeHandlers (new Map)) + (prop :Map> _customDialogTypeHandlers (new Map)) (prop :FuzzyMap> voiceLines (new FuzzyMap>)) // Used to give unique, persistent IDs to voice tracks @@ -64,6 +64,12 @@ (return)))) (cc)) + (prop :Map _silentCustomDialogTypes (new Map)) + (savedVar :Bool playVoiceTracksForSilentDialog false) + (method registerCustomDialogTypeHandler [:String key :CustomDialogTypeHandler handler &opt :Bool isSilent] + (_customDialogTypeHandlers.set key handler) + (when ?isSilent (dictSet _silentCustomDialogTypes key true))) + (prop &mut :Void->Void _hideCustomDialog null) (method :Void showDialog [actorName dialogType wryly text cc] // Hide custom dialog when the next dialog appears unless HIDECUSTOMDIALOG is called manually: @@ -73,12 +79,15 @@ (dialogHistory.push (Dialog actorName dialogType wryly text)) (processIntercut actorName (makeCC - (let [cc ->:Void {(director.hideDialog) (cc)} + (let [isSilentType + ?(whenLet [(Custom type _ _) dialogType] + (_silentCustomDialogTypes.exists type)) + cc ->:Void {(director.hideDialog) (cc)} &mut customCC 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))) + (when (and (or !isSilentType playVoiceTracksForSilentDialog) actorName (< 0 (count voiceTracks))) (case (let [voiceLineKey (if (voiceLineMatches.exists text) @@ -116,7 +125,7 @@ (otherwise))) (case dialogType ((Custom type character args) - (ifLet [handler (dictGet customDialogTypeHandlers type)] + (ifLet [handler (dictGet _customDialogTypeHandlers type)] (let [cleanupFunc (handler actorName character wryly args text skipCC customCC)] (set _hideCustomDialog cleanupFunc)) (throw "No handler for custom dialog type $type")))