From 01ed1730f4338ea99ad6c472689780867a91cff1 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Thu, 22 Feb 2024 20:56:41 -0500 Subject: [PATCH] Fix some issues with cutscenes. --- Project.xml | 2 +- source/funkin/Paths.hx | 14 ++++++++++++++ source/funkin/play/cutscene/VideoCutscene.hx | 19 +++++++++++++++---- source/funkin/ui/freeplay/FreeplayState.hx | 1 + 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Project.xml b/Project.xml index c58153575..c368dacef 100644 --- a/Project.xml +++ b/Project.xml @@ -108,7 +108,7 @@ - + diff --git a/source/funkin/Paths.hx b/source/funkin/Paths.hx index e0212e573..6006939be 100644 --- a/source/funkin/Paths.hx +++ b/source/funkin/Paths.hx @@ -16,6 +16,20 @@ class Paths currentLevel = name.toLowerCase(); } + public static function stripLibrary(path:String):String + { + var parts = path.split(':'); + if (parts.length < 2) return path; + return parts[1]; + } + + public static function getLibrary(path:String):String + { + var parts = path.split(':'); + if (parts.length < 2) return "preload"; + return parts[0]; + } + static function getPath(file:String, type:AssetType, library:Null) { if (library != null) return getLibraryPath(file, library); diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 934919b65..df31accb2 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -36,6 +36,8 @@ class VideoCutscene return; } + var rawFilePath = Paths.stripLibrary(filePath); + // Trigger the cutscene. Don't play the song in the background. PlayState.instance.isInCutscene = true; PlayState.instance.camHUD.visible = false; @@ -49,10 +51,10 @@ class VideoCutscene #if html5 playVideoHTML5(filePath); - #end - - #if hxCodec - playVideoNative(filePath); + #elseif hxCodec + playVideoNative(rawFilePath); + #else + throw "No video support for this platform!"; #end } @@ -110,6 +112,15 @@ class VideoCutscene PlayState.instance.refresh(); vid.play(filePath, false); + + // Resize videos bigger or smaller than the screen. + vid.bitmap.onTextureSetup.add(() -> { + vid.setGraphicSize(FlxG.width, FlxG.height); + vid.updateHitbox(); + vid.x = 0; + vid.y = 0; + // vid.scale.set(0.5, 0.5); + }); } else { diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 669354345..e4a6b96d8 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -7,6 +7,7 @@ import flixel.addons.ui.FlxInputText; import flixel.FlxCamera; import flixel.FlxGame; import flixel.FlxSprite; +import funkin.graphics.FunkinSprite; import flixel.FlxState; import flixel.group.FlxGroup; import flixel.group.FlxGroup.FlxTypedGroup;