diff --git a/Project.xml b/Project.xml index f5d506688..1c9190899 100644 --- a/Project.xml +++ b/Project.xml @@ -105,7 +105,7 @@ - + diff --git a/source/funkin/input/Controls.hx b/source/funkin/input/Controls.hx index 3fa4e0f75..201c222a3 100644 --- a/source/funkin/input/Controls.hx +++ b/source/funkin/input/Controls.hx @@ -333,8 +333,12 @@ class Controls extends FlxActionSet throw 'Invalid name: $name'; #end - return byName[name].inputs.map(function(input) return (input.device == KEYBOARD) ? input.inputID : null) - .filter(function(key) return key != null); + // TODO: Revert to `.map().filter()` once HashLink doesn't complain anymore. + var result:Array = []; + for (input in byName[name].inputs) { + if (input.device == KEYBOARD) result.push(input.inputID); + } + return result; } public function getButtonsForAction(name:Action):Array { @@ -343,8 +347,11 @@ class Controls extends FlxActionSet throw 'Invalid name: $name'; #end - return byName[name].inputs.map(function(input) return (input.device == GAMEPAD) ? input.inputID : null) - .filter(function(key) return key != null); + var result:Array = []; + for (input in byName[name].inputs) { + if (input.device == GAMEPAD) result.push(input.inputID); + } + return result; } public function getDialogueName(action:FlxActionDigital):String diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 24cf78c2a..934919b65 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -8,7 +8,8 @@ import flixel.util.FlxColor; import flixel.util.FlxTimer; #if html5 import funkin.graphics.video.FlxVideo; -#else +#end +#if hxCodec import hxcodec.flixel.FlxVideoSprite; #end @@ -48,14 +49,20 @@ class VideoCutscene #if html5 playVideoHTML5(filePath); - #else + #end + + #if hxCodec playVideoNative(filePath); #end } public static function isPlaying():Bool { + #if (html5 || hxCodec) return vid != null; + #else + return false; + #end } #if html5 @@ -82,7 +89,9 @@ class VideoCutscene trace('ALERT: Video is null! Could not play cutscene!'); } } - #else + #end + + #if hxCodec static var vid:FlxVideoSprite; static function playVideoNative(filePath:String):Void @@ -118,15 +127,20 @@ class VideoCutscene { PlayState.instance.remove(vid); } - #else + #end + + #if hxCodec if (vid != null) { vid.stop(); PlayState.instance.remove(vid); } #end + + #if (html5 || hxCodec) vid.destroy(); vid = null; + #end PlayState.instance.camCutscene.visible = true; PlayState.instance.camHUD.visible = true; @@ -148,9 +162,3 @@ class VideoCutscene }); } } - -/* - trace('Video playback failed (${e})'); - vid = null; - finishCutscene(0.5); - */ diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 0853bf390..e98809ce8 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -5951,9 +5951,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState ChartEditorNoteSprite.noteFrameCollection = null; // Stop the music. - welcomeMusic.destroy(); - audioInstTrack.destroy(); - audioVocalTrackGroup.destroy(); + if (welcomeMusic != null) welcomeMusic.destroy(); + if (audioInstTrack != null) audioInstTrack.destroy(); + if (audioVocalTrackGroup != null) audioVocalTrackGroup.destroy(); } function applyCanQuickSave():Void diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx index d7fbd42c2..aad2db7fa 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx @@ -242,8 +242,8 @@ class ChartEditorAudioHandler snd.loadEmbedded(asset); snd.autoDestroy = true; FlxG.sound.list.add(snd); + snd.play(true); snd.volume = volume; - snd.play(); } public static function wipeInstrumentalData(state:ChartEditorState):Void diff --git a/source/funkin/ui/title/AttractState.hx b/source/funkin/ui/title/AttractState.hx index 38cff7cc8..3294a4551 100644 --- a/source/funkin/ui/title/AttractState.hx +++ b/source/funkin/ui/title/AttractState.hx @@ -2,7 +2,8 @@ package funkin.ui.title; #if html5 import funkin.graphics.video.FlxVideo; -#else +#end +#if hxCodec import hxcodec.flixel.FlxVideoSprite; #end import funkin.ui.MusicBeatState; @@ -25,7 +26,9 @@ class AttractState extends MusicBeatState #if html5 playVideoHTML5(ATTRACT_VIDEO_PATH); - #else + #end + + #if hxCodec playVideoNative(ATTRACT_VIDEO_PATH); #end } @@ -50,7 +53,9 @@ class AttractState extends MusicBeatState trace('ALERT: Video is null! Could not play cutscene!'); } } - #else + #end + + #if hxCodec var vid:FlxVideoSprite; function playVideoNative(filePath:String):Void @@ -95,15 +100,20 @@ class AttractState extends MusicBeatState { remove(vid); } - #else + #end + + #if hxCodec if (vid != null) { vid.stop(); remove(vid); } #end + + #if (html5 || hxCodec) vid.destroy(); vid = null; + #end FlxG.switchState(new TitleState()); }