diff --git a/kiss/src/kiss/AsyncEmbeddedScript.hx b/kiss/src/kiss/AsyncEmbeddedScript.hx index e4f1ee0a..eb6999ff 100644 --- a/kiss/src/kiss/AsyncEmbeddedScript.hx +++ b/kiss/src/kiss/AsyncEmbeddedScript.hx @@ -120,7 +120,17 @@ class AsyncEmbeddedScript { } } - // TODO skip to label by name + public function skipToLabel(name:String) { + var ip = labels[name]; + if (lastInstructionPointer > ip) { + throw "Rewinding AsyncEmbeddedScript is not implemented"; + } + skipToInstruction(ip); + } + + public function labelRunners():MapVoid> { + return [for (label => ip in labels) label => () -> skipToInstruction(ip)]; + } #if macro public static function build(dslHaxelib:String, dslFile:String, scriptFile:String):Array { diff --git a/projects/hollywoo-flixel/src/hollywoo_flixel/FlxMovie.hx b/projects/hollywoo-flixel/src/hollywoo_flixel/FlxMovie.hx index a09ac7aa..1ad6841d 100644 --- a/projects/hollywoo-flixel/src/hollywoo_flixel/FlxMovie.hx +++ b/projects/hollywoo-flixel/src/hollywoo_flixel/FlxMovie.hx @@ -33,6 +33,8 @@ enum FlxScreenPosition { * Model/controller of a Hollywoo-Flixel film, and main execution script */ class FlxMovie extends Movie { + // Think of HollywooFlixelDSL.kiss as the corresponding Kiss file for this class! + public function new(director:FlxDirector, ?voiceLinesAssetPath:String) { var voiceLinesJson = null; if (voiceLinesAssetPath != null) { diff --git a/projects/hollywoo-flixel/src/hollywoo_flixel/HollywooFlixelDSL.kiss b/projects/hollywoo-flixel/src/hollywoo_flixel/HollywooFlixelDSL.kiss index 5a09caa9..e77c5e25 100644 --- a/projects/hollywoo-flixel/src/hollywoo_flixel/HollywooFlixelDSL.kiss +++ b/projects/hollywoo-flixel/src/hollywoo_flixel/HollywooFlixelDSL.kiss @@ -33,4 +33,16 @@ (method :Void update [:Float elapsed] (#when debug (when FlxG.keys.justPressed.N - (skipToNextLabel)))) \ No newline at end of file + (skipToNextLabel)) + (when FlxG.keys.justPressed.L + (showLabelSkipButtons)))) + +(method :Void showLabelSkipButtons [] + (let [runners (labelRunners) + buttons (new flixel.group.FlxGroup.FlxTypedGroup)] + (localVar &mut buttonY 0) + (doFor =>label runner runners + (let [b (new flixel.ui.FlxButton 0 buttonY label ->{(FlxG.state.remove buttons)(runner)})] + (buttons.add b)) + (+= buttonY 20)) + (FlxG.state.add buttons))) \ No newline at end of file