From a3a75b89b91c3ad0c448258edf7dda93a987f4dd Mon Sep 17 00:00:00 2001 From: MAJigsaw77 <77043862+MAJigsaw77@users.noreply.github.com> Date: Wed, 30 Jul 2025 11:24:58 +0300 Subject: [PATCH] Only add the option if its defined. --- source/funkin/play/cutscene/VideoCutscene.hx | 37 ++++++++++---------- source/funkin/ui/options/PreferencesMenu.hx | 2 ++ 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 78ff99e63..bfef31df3 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -160,11 +160,11 @@ class VideoCutscene vid.active = false; + #if FEATURE_VIDEO_SUBTITLES vid.bitmap.onPlaying.add(function():Void { - if (vid.bitmap != null) + if (Preferences.videoSubtitles) { - #if FEATURE_VIDEO_SUBTITLES - if (Preferences.videoSubtitles) + if (vid.bitmap != null) { for (spuTrack in vid.bitmap.getSpuDescription()) { @@ -175,20 +175,24 @@ class VideoCutscene break; } } - } - #end - for (audioTrack in vid.bitmap.getAudioDescription()) - { - if (audioTrack.psz_name.toLowerCase().contains(DEFAULT_LANGUAGE)) - { - if (vid.bitmap.audioTrack != audioTrack.i_id) vid.bitmap.audioTrack = audioTrack.i_id; - - break; - } + // Just as a note, the audio tracks by default are labeled as `Track 1` etc. + // + // For multiple langauges, we would need `ffmpeg` to rename these tracks a little so its easier to mess with. + // + // for (audioTrack in vid.bitmap.getAudioDescription()) + // { + // if (audioTrack.psz_name.toLowerCase().contains(DEFAULT_LANGUAGE)) + // { + // if (vid.bitmap.audioTrack != audioTrack.i_id) vid.bitmap.audioTrack = audioTrack.i_id; + // + // break; + // } + // } } } }); + #end vid.bitmap.onEncounteredError.add(function(msg:String):Void { finishVideo(0.5); @@ -213,12 +217,9 @@ class VideoCutscene PlayState.instance.refresh(); - if (vid.load(filePath)) + if (vid.load(filePath) && vid.play()) { - if (vid.play()) - { - onVideoStarted.dispatch(); - } + onVideoStarted.dispatch(); } } else diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index f77dc696a..9c7b043a9 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -145,9 +145,11 @@ class PreferencesMenu extends Page createPrefItemCheckbox('Camera Zooms', 'If disabled, camera stops bouncing to the song.', function(value:Bool):Void { Preferences.zoomCamera = value; }, Preferences.zoomCamera); + #if FEATURE_VIDEO_SUBTITLES createPrefItemCheckbox('Video Subtitles', 'If enabled, subtitles will be shown on video cutscenes.', function(value:Bool):Void { Preferences.videoSubtitles = value; }, Preferences.videoSubtitles); + #end #if !mobile // note: technically we can do DebugDisplayMode.Advanced => DebugDisplayMode.Advanced, etc. here, but that's a bit headache inducing. createPrefItemEnum('Debug Display', 'If enabled, FPS and other debug stats will be displayed.', [