Import Redirects + fix videos not able to be longer than 25 days
This commit is contained in:
@@ -96,6 +96,18 @@ class Script extends FlxBasic implements IFlxDestroyable {
|
||||
"BitmapUtil" => funkin.backend.utils.BitmapUtil,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Used internally to keep backwards compatability with old scripts.
|
||||
* This gets set on `hscript.Interp.importRedirects`,
|
||||
* if you wanna modify it, please edit `hscript.Interp.importRedirects` directly.
|
||||
**/
|
||||
public static function getDefaultImportRedirects():Map<String, String> {
|
||||
return [
|
||||
"Meow" => "funkin.backend.utils.CoolUtil",
|
||||
];
|
||||
}
|
||||
|
||||
public static function getDefaultPreprocessors():Map<String, Dynamic> {
|
||||
var defines = funkin.backend.system.macros.DefinesMacro.defines;
|
||||
defines.set("CODENAME_ENGINE", true);
|
||||
|
||||
@@ -117,6 +117,9 @@ class Main extends Sprite
|
||||
ShaderResizeFix.init();
|
||||
Logs.init();
|
||||
Paths.init();
|
||||
|
||||
hscript.Interp.importRedirects = funkin.backend.scripting.Script.getDefaultImportRedirects();
|
||||
|
||||
#if GLOBAL_SCRIPT
|
||||
funkin.backend.scripting.GlobalScript.init();
|
||||
#end
|
||||
|
||||
@@ -159,7 +159,7 @@ class VideoCutscene extends Cutscene {
|
||||
|
||||
public static function splitTime(str:String):Float {
|
||||
if (str == null || str.trim() == "") return -1;
|
||||
var multipliers:Array<Float> = [1, 60, 3600, 86400]; // no way a cutscene will last longer than days
|
||||
var multipliers:Array<Float> = [1, 60, 3600, 86400, 31536000]; // no way a cutscene will last longer than years
|
||||
var timeSplit:Array<Null<Float>> = [for(e in str.split(":")) Std.parseFloat(e.replace(",", "."))];
|
||||
var time:Float = 0;
|
||||
|
||||
@@ -185,7 +185,13 @@ class VideoCutscene extends Cutscene {
|
||||
public override function update(elapsed:Float) {
|
||||
super.update(elapsed);
|
||||
|
||||
if(loadingBackdrop == null && curSubtitle < subtitles.length && haxe.Int64.toInt(video.bitmap.time) >= subtitles[curSubtitle].time) {
|
||||
if(loadingBackdrop != null) return;
|
||||
|
||||
@:privateAccess
|
||||
var time:Int64 = video.bitmap.time;
|
||||
var time:Float = FPHelper.i64ToDouble(time.low, time.high);
|
||||
|
||||
if(curSubtitle < subtitles.length && subtitles[curSubtitle].time < time) {
|
||||
setSubtitle(subtitles[curSubtitle]);
|
||||
curSubtitle++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user