diff --git a/Project.xml b/Project.xml index 6df879583..0a8d31b86 100644 --- a/Project.xml +++ b/Project.xml @@ -108,7 +108,7 @@ - + diff --git a/hmm.json b/hmm.json index 30d1743a8..e1acf6c87 100644 --- a/hmm.json +++ b/hmm.json @@ -109,7 +109,7 @@ "name": "lime", "type": "git", "dir": null, - "ref": "fff39ba6fc64969cd51987ef7491d9345043dc5d", + "ref": "1359fe6ad52e91175dc636a516d460bd54ea22ed", "url": "https://github.com/FunkinCrew/lime" }, { @@ -163,8 +163,10 @@ }, { "name": "thx.semver", - "type": "haxelib", - "version": "0.2.2" + "type": "git", + "dir": null, + "ref": "cf8d213589a2c7ce4a59b0fdba9e8ff36bc029fa", + "url": "https://github.com/FunkinCrew/thx.semver" } ] } diff --git a/source/funkin/audio/SoundGroup.hx b/source/funkin/audio/SoundGroup.hx index df3a67ae1..0e81a0901 100644 --- a/source/funkin/audio/SoundGroup.hx +++ b/source/funkin/audio/SoundGroup.hx @@ -192,7 +192,7 @@ class SoundGroup extends FlxTypedGroup function get_playing():Bool { - if (getFirstAlive != null) return getFirstAlive().playing; + if (getFirstAlive() != null) return getFirstAlive().playing; else return false; } diff --git a/source/funkin/graphics/FunkinCamera.hx b/source/funkin/graphics/FunkinCamera.hx index f80e799ea..90861c263 100644 --- a/source/funkin/graphics/FunkinCamera.hx +++ b/source/funkin/graphics/FunkinCamera.hx @@ -192,8 +192,8 @@ class FunkinCamera extends FlxCamera // get the isolated bitmap final isolated = grabScreen(false, true); // apply fullscreen blend - customBlendShader.blend = blend; - customBlendShader.source = isolated; + customBlendShader.blendSwag = blend; + customBlendShader.sourceSwag = isolated; customBlendShader.updateViewInfo(FlxG.width, FlxG.height, this); applyFilter(customBlendFilter); } diff --git a/source/funkin/graphics/shaders/BlendModesShader.hx b/source/funkin/graphics/shaders/BlendModesShader.hx index acd2c1586..b7a405dd1 100644 --- a/source/funkin/graphics/shaders/BlendModesShader.hx +++ b/source/funkin/graphics/shaders/BlendModesShader.hx @@ -4,20 +4,22 @@ import flixel.addons.display.FlxRuntimeShader; import funkin.Paths; import openfl.utils.Assets; import openfl.display.BitmapData; +import openfl.display.ShaderInput; class BlendModesShader extends FlxRuntimeShader { - public var camera:BitmapData; + public var camera:ShaderInput; + public var cameraData:BitmapData; public function new() { super(Assets.getText(Paths.frag('blendModes'))); } - public function setCamera(camera:BitmapData):Void + public function setCamera(cameraData:BitmapData):Void { - this.camera = camera; + this.cameraData = cameraData; - this.setBitmapData('camera', camera); + this.setBitmapData('camera', this.cameraData); } } diff --git a/source/funkin/graphics/shaders/RuntimeCustomBlendShader.hx b/source/funkin/graphics/shaders/RuntimeCustomBlendShader.hx index a07124d23..3e8dfedd3 100644 --- a/source/funkin/graphics/shaders/RuntimeCustomBlendShader.hx +++ b/source/funkin/graphics/shaders/RuntimeCustomBlendShader.hx @@ -6,20 +6,22 @@ import openfl.utils.Assets; class RuntimeCustomBlendShader extends RuntimePostEffectShader { - public var source(default, set):BitmapData; + // only different name purely for hashlink fix + public var sourceSwag(default, set):BitmapData; - function set_source(value:BitmapData):BitmapData + function set_sourceSwag(value:BitmapData):BitmapData { - this.setBitmapData("source", value); - return source = value; + this.setBitmapData("sourceSwag", value); + return sourceSwag = value; } - public var blend(default, set):BlendMode; + // name change make sure it's not the same variable name as whatever is in the shader file + public var blendSwag(default, set):BlendMode; - function set_blend(value:BlendMode):BlendMode + function set_blendSwag(value:BlendMode):BlendMode { this.setInt("blendMode", cast value); - return blend = value; + return blendSwag = value; } public function new() diff --git a/source/funkin/graphics/shaders/RuntimeRainShader.hx b/source/funkin/graphics/shaders/RuntimeRainShader.hx index 05bc68f72..239276bbe 100644 --- a/source/funkin/graphics/shaders/RuntimeRainShader.hx +++ b/source/funkin/graphics/shaders/RuntimeRainShader.hx @@ -94,12 +94,12 @@ class RuntimeRainShader extends RuntimePostEffectShader return lightMap = value; } - public var numLights(default, set):Int = 0; + public var numLightsSwag(default, set):Int = 0; // swag heads, we have never been more back (needs different name purely for hashlink casting fix) - function set_numLights(value:Int):Int + function set_numLightsSwag(value:Int):Int { this.setInt('numLights', value); - return numLights = value; + return numLightsSwag = value; } public function new() 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 f082828f7..6c64f952b 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -6050,7 +6050,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Stop the music. if (welcomeMusic != null) welcomeMusic.destroy(); if (audioInstTrack != null) audioInstTrack.destroy(); - audioVocalTrackGroup.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 2d4841e9c..363dc1567 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx @@ -309,8 +309,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/story/StoryMenuState.hx b/source/funkin/ui/story/StoryMenuState.hx index 2f0111841..1905a7c57 100644 --- a/source/funkin/ui/story/StoryMenuState.hx +++ b/source/funkin/ui/story/StoryMenuState.hx @@ -509,10 +509,10 @@ class StoryMenuState extends MusicBeatState // super.dispatchEvent(event) dispatches event to module scripts. super.dispatchEvent(event); - if (levelProps != null && levelProps.length > 0) + if (levelProps?.members != null && levelProps.members.length > 0) { // Dispatch event to props. - for (prop in levelProps) + for (prop in levelProps.members) { ScriptEventDispatcher.callEvent(prop, event); } diff --git a/source/funkin/ui/title/AttractState.hx b/source/funkin/ui/title/AttractState.hx index ade24bffa..63a9e63ad 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()); }