From 31c303fa69aff237f2b460c10ef4ec522eccace3 Mon Sep 17 00:00:00 2001 From: Rafi Date: Thu, 6 Aug 2026 15:58:23 +0100 Subject: [PATCH] VideoCutscene: Change the `video` type from `var` to `final` Also small formatting fix --- source/funkin/game/cutscenes/VideoCutscene.hx | 23 +++++++++++-------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/source/funkin/game/cutscenes/VideoCutscene.hx b/source/funkin/game/cutscenes/VideoCutscene.hx index f979376f77..ea75b3b078 100644 --- a/source/funkin/game/cutscenes/VideoCutscene.hx +++ b/source/funkin/game/cutscenes/VideoCutscene.hx @@ -25,7 +25,7 @@ class VideoCutscene extends Cutscene { var localPath:String; #if VIDEO_CUTSCENES - var video:FlxVideoSprite; + final video:FlxVideoSprite = new FlxVideoSprite(); final mutex = new sys.thread.Mutex(); var cutsceneCamera:FlxCamera; @@ -58,17 +58,20 @@ class VideoCutscene extends Cutscene { parseSubtitles(); - add(video = new FlxVideoSprite()); video.antialiasing = true; - video.bitmap.onEndReached.add(close); - video.bitmap.onFormatSetup.add(function() if (video.bitmap != null && video.bitmap.bitmapData != null) { - final width = video.bitmap.bitmapData.width; - final height = video.bitmap.bitmapData.height; - final scale:Float = Math.min(FlxG.width / width, FlxG.height / height); - video.setGraphicSize(width * scale, height * scale); - video.updateHitbox(); - video.screenCenter(); + video.bitmap.onFormatSetup.add(function() { + if (video.bitmap != null && video.bitmap.bitmapData != null) { + final width = video.bitmap.bitmapData.width; + final height = video.bitmap.bitmapData.height; + final scale:Float = Math.min(FlxG.width / width, FlxG.height / height); + + video.setGraphicSize(width * scale, height * scale); + video.updateHitbox(); + video.screenCenter(); + } }); + video.bitmap.onEndReached.add(close); + add(video); //cover = new FlxSprite(0, FlxG.height * 0.85).makeSolid(FlxG.width + 50, FlxG.height + 50, 0xFF000000); //cover.scrollFactor.set(0, 0);