Only add the option if its defined.

This commit is contained in:
MAJigsaw77
2025-10-06 01:31:30 +08:00
committed by Hundrec
parent 8733afe512
commit a3a75b89b9
2 changed files with 21 additions and 18 deletions
+19 -18
View File
@@ -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
@@ -145,9 +145,11 @@ class PreferencesMenu extends Page<OptionsState.OptionsMenuPageName>
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.', [