Fix some issues with cutscenes.

This commit is contained in:
EliteMasterEric 2024-02-22 20:56:41 -05:00
parent 539b688055
commit 01ed1730f4
4 changed files with 31 additions and 5 deletions

View file

@ -108,7 +108,7 @@
<haxelib name="flixel-text-input" /> <!-- Improved text field rendering for HaxeUI --> <haxelib name="flixel-text-input" /> <!-- Improved text field rendering for HaxeUI -->
<haxelib name="polymod" /> <!-- Modding framework --> <haxelib name="polymod" /> <!-- Modding framework -->
<haxelib name="flxanimate" /> <!-- Texture atlas rendering --> <haxelib name="flxanimate" /> <!-- Texture atlas rendering -->
<haxelib name="hxCodec" if="desktop release" /> <!-- Video playback --> <haxelib name="hxCodec" if="desktop" /> <!-- Video playback -->
<haxelib name="json2object" /> <!-- JSON parsing --> <haxelib name="json2object" /> <!-- JSON parsing -->
<haxelib name="thx.semver" /> <!-- Version string handling --> <haxelib name="thx.semver" /> <!-- Version string handling -->

View file

@ -16,6 +16,20 @@ class Paths
currentLevel = name.toLowerCase(); 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<String>) static function getPath(file:String, type:AssetType, library:Null<String>)
{ {
if (library != null) return getLibraryPath(file, library); if (library != null) return getLibraryPath(file, library);

View file

@ -36,6 +36,8 @@ class VideoCutscene
return; return;
} }
var rawFilePath = Paths.stripLibrary(filePath);
// Trigger the cutscene. Don't play the song in the background. // Trigger the cutscene. Don't play the song in the background.
PlayState.instance.isInCutscene = true; PlayState.instance.isInCutscene = true;
PlayState.instance.camHUD.visible = false; PlayState.instance.camHUD.visible = false;
@ -49,10 +51,10 @@ class VideoCutscene
#if html5 #if html5
playVideoHTML5(filePath); playVideoHTML5(filePath);
#end #elseif hxCodec
playVideoNative(rawFilePath);
#if hxCodec #else
playVideoNative(filePath); throw "No video support for this platform!";
#end #end
} }
@ -110,6 +112,15 @@ class VideoCutscene
PlayState.instance.refresh(); PlayState.instance.refresh();
vid.play(filePath, false); 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 else
{ {

View file

@ -7,6 +7,7 @@ import flixel.addons.ui.FlxInputText;
import flixel.FlxCamera; import flixel.FlxCamera;
import flixel.FlxGame; import flixel.FlxGame;
import flixel.FlxSprite; import flixel.FlxSprite;
import funkin.graphics.FunkinSprite;
import flixel.FlxState; import flixel.FlxState;
import flixel.group.FlxGroup; import flixel.group.FlxGroup;
import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup.FlxTypedGroup;