From 64949f47e8404f925a6c251c138515daa5d08933 Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Mon, 14 Aug 2023 18:23:14 -0600 Subject: [PATCH] Add play mode setting with function to let user choose --- src/hollywoo/HollywooDSL.kiss | 12 +++++++++++- src/hollywoo/Movie.hx | 6 ++++++ src/hollywoo/Movie.kiss | 17 +++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/hollywoo/HollywooDSL.kiss b/src/hollywoo/HollywooDSL.kiss index 108467e..c92c851 100644 --- a/src/hollywoo/HollywooDSL.kiss +++ b/src/hollywoo/HollywooDSL.kiss @@ -55,7 +55,16 @@ })] `{ @:keep + (method checkPlayMode [:Void->Void cc] + (case hollywoo.Movie.playMode + (NotSet + (hollywoo.Movie.choosePlayMode director cc)) + (otherwise + (cc)))) + @:keep (method doPreload [:Void->Void cc] + // TODO set director input setting according to watch mode/play mode + (director.showTitleCard ["LOADING"] (makeCC (set isLoading true) @@ -68,6 +77,7 @@ (#if debug (promptToRecord cc) (cc))))))) + @:keep (method doCleanup [] (director.cleanup) (set lastInstructionPointer -2) @@ -81,7 +91,7 @@ (defReaderMacro &bof "" [stream] `(#when (StringTools.contains kissFile className) - (doPreload cc))) + (checkPlayMode ->:Void (doPreload cc)))) (defReaderMacro &eof "" [stream] `(#when (StringTools.contains kissFile className) diff --git a/src/hollywoo/Movie.hx b/src/hollywoo/Movie.hx index 08e7b12..3858ba4 100644 --- a/src/hollywoo/Movie.hx +++ b/src/hollywoo/Movie.hx @@ -55,6 +55,12 @@ enum CreditsLine { Break; } +enum PlayMode { + NotSet; + Read; + Watch; +} + /** * Model/controller of a Hollywoo film, and main execution script */ diff --git a/src/hollywoo/Movie.kiss b/src/hollywoo/Movie.kiss index 9909b82..7963777 100644 --- a/src/hollywoo/Movie.kiss +++ b/src/hollywoo/Movie.kiss @@ -8,6 +8,8 @@ (#unless subclass // Settings (savedVar :Bool showCaptions false) + (savedVar :PlayMode playMode NotSet) + (var MAX_CAPTION_DURATION 3) (prop &mut :Int captionId 0) @@ -298,6 +300,21 @@ (print "Warning: no credit tsv file for ${directory}/${filename}")) (dictGet dirMap basename)))) + (function choosePlayMode [:Director director :Void->Void cc] + (director.chooseString + "Choose a Play Mode\n\nThe Play Mode setting determines how the story will flow forward.\n\nRead mode lets you go at your own pace, stopping after most dialogue until you choose to continue.\n\nWatch mode proceeds automatically like a cutscene or a movie.\n\nYou can still skip dialogue or speed up animations in either mode.\n\nYou can change your decision any time in the Options menu.\n\n" + ["Read Mode" "Watch Mode"] + ->:Void mode { + (case mode + ("Read Mode" + (set Movie.playMode Read)) + ("Watch Mode" + (set Movie.playMode Watch)) + (never otherwise)) + ~Movie.playMode + (cc) + })) + (defNew [ // "View" in the Model-View-Controller architecture: