diff --git a/source/CoolUtil.hx b/source/CoolUtil.hx index 0deb1893..a240148e 100644 --- a/source/CoolUtil.hx +++ b/source/CoolUtil.hx @@ -214,20 +214,23 @@ class CoolUtil public static function precacheVideo(name:String):Void { #if VIDEOS - if (OpenFlAssets.exists(Paths.video(name))) + if (FileSystem.exists(Paths.video(name))) { - if (!loadedVideos.contains(name)) + Handle.initAsync([], function(success:Bool):Void { - var cache:VideoHandler = new VideoHandler(); - cache.mute = true; - cache.load(Paths.video(name)); - loadedVideos.push(name); - FlxG.log.add('Video file has been cached: ' + name); - } - else - { - FlxG.log.add('Video file has already been cached: ' + name); - } + if (!loadedVideos.contains(name)) + { + var cache:VideoHandler = new VideoHandler(); + cache.mute = true; + cache.load(Paths.video(name)); + loadedVideos.push(name); + FlxG.log.add('Video file has been cached: ' + name); + } + else + { + FlxG.log.add('Video file has already been cached: ' + name); + } + }); } else { @@ -238,29 +241,6 @@ class CoolUtil #end } - #if FEATURE_FILESYSTEM - /* - * this function is not working. It was solely used for hscript shit. Don't need it anymore. - */ - public static function findFilesInPath(path:String, extns:Array<String>, ?filePath:Bool = false, ?deepSearch:Bool = true):Array<String> - { - var files:Array<String> = []; - - if (LimeAssets.exists(path)) - { - for (file in readAssetsDirectoryFromLibrary(path, 'TEXT')) - { - var path = haxe.io.Path.join([path, file]); - var pathsFiles:Array<String> = findFilesInPath(path, extns); - - for (_ in pathsFiles) - files.push(_); - } - } - return files; - } - #end - public static inline function getFileStringFromPath(file:String):String { return Path.withoutDirectory(Path.withoutExtension(file)); diff --git a/source/PlayState.hx b/source/PlayState.hx index 2a724006..4a167e3d 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -79,6 +79,7 @@ import debug.ChartingState; #if VIDEOS import hxvlc.flixel.FlxVideo as VideoHandler; import hxvlc.flixel.FlxVideoSprite as VideoSprite; +import hxvlc.libvlc.Handle; #end import stages.Stage; import stages.TankmenBG; @@ -6527,36 +6528,46 @@ class PlayState extends MusicBeatState function playCutscene(name:String, ?atend:Bool) { #if VIDEOS - inCutscene = true; - inCinematic = true; - var diff:String = CoolUtil.getSuffixFromDiff(CoolUtil.difficultyArray[storyDifficulty]); - cutscene = new VideoHandler(); - cutscene.load(Paths.video(name)); - inst.stop(); - cutscene.onEndReached.add(function() + Handle.initAsync([], function(success:Bool):Void { - inCutscene = false; - if (atend == true) + if (!success) + return; + + inCutscene = true; + inCinematic = true; + var diff:String = CoolUtil.getSuffixFromDiff(CoolUtil.difficultyArray[storyDifficulty]); + cutscene = new VideoHandler(); + cutscene.load(Paths.video(name)); + inst.stop(); + cutscene.onEndReached.add(function() { - if (storyPlaylist.length <= 0) - LoadingState.loadAndSwitchState(new StoryMenuState()); - else + inCutscene = false; + if (atend == true) { - SONG = Song.loadFromJson(storyPlaylist[0].toLowerCase(), diff); - LoadingState.loadAndSwitchState(new PlayState()); + if (storyPlaylist.length <= 0) + LoadingState.loadAndSwitchState(new StoryMenuState()); + else + { + SONG = Song.loadFromJson(storyPlaylist[0].toLowerCase(), diff); + LoadingState.loadAndSwitchState(new PlayState()); + } } - } - else - { - createTimer(0.5, function(timer) + else { - startCountdown(); - }); - } + createTimer(0.5, function(timer) + { + startCountdown(); + }); + } - cutscene.dispose(); + cutscene.dispose(); + }); + + new FlxTimer().start(0.001, function(tmr:FlxTimer):Void + { + cutscene.play(); + }); }); - cutscene.play(); #else FlxG.log.warn("Platform Not Supported."); #end