Add play mode setting with function to let user choose

This commit is contained in:
2023-08-14 18:23:14 -06:00
parent db816b54a7
commit 64949f47e8
3 changed files with 34 additions and 1 deletions

View File

@@ -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)

View File

@@ -55,6 +55,12 @@ enum CreditsLine {
Break;
}
enum PlayMode {
NotSet;
Read;
Watch;
}
/**
* Model/controller of a Hollywoo film, and main execution script
*/

View File

@@ -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<Dynamic,Dynamic,Dynamic,Dynamic,Dynamic,Dynamic,Dynamic,Dynamic> 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: