From aa89c2fc3e2e783ddffc45a0b3bdec6e6962b4ee Mon Sep 17 00:00:00 2001 From: ShadowMario <44785097+ShadowMario@users.noreply.github.com> Date: Mon, 17 Oct 2022 23:47:34 -0300 Subject: [PATCH] html5 compiling --- assets/preload/data/introText.txt | 1 - source/FunkinLua.hx | 15 +++++++++++---- source/GameplayChangersSubstate.hx | 2 ++ source/editors/ChartingState.hx | 2 ++ 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/assets/preload/data/introText.txt b/assets/preload/data/introText.txt index 395bfa03561..82f29aa3474 100644 --- a/assets/preload/data/introText.txt +++ b/assets/preload/data/introText.txt @@ -39,7 +39,6 @@ pico funny--pico funny updates each friday--on time every time shoutouts to mason--for da homies bonk--get in the discord call -kbhgames--steal mods this isn't a copy of ke--*vine boom* we do a little trolling--h sexiest engine--in da block diff --git a/source/FunkinLua.hx b/source/FunkinLua.hx index 78c45bac195..6cfcd3dd6b9 100644 --- a/source/FunkinLua.hx +++ b/source/FunkinLua.hx @@ -34,7 +34,7 @@ import flixel.util.FlxSave; import flixel.addons.transition.FlxTransitionableState; import flixel.system.FlxAssets.FlxShader; -#if !flash +#if (!flash && sys) import flixel.addons.display.FlxRuntimeShader; #end @@ -2869,6 +2869,7 @@ class FunkinLua { return PlayState.instance.modchartTexts.exists(name) ? PlayState.instance.modchartTexts.get(name) : Reflect.getProperty(PlayState.instance, name); } + #if (!flash && sys) public function getShader(obj:String):FlxRuntimeShader { var killMe:Array = obj.split('.'); @@ -2884,11 +2885,13 @@ class FunkinLua { } return null; } + #end function initLuaShader(name:String, ?glslVersion:Int = 120) { if(!ClientPrefs.shaders) return false; + #if (!flash && sys) if(PlayState.instance.runtimeShaders.exists(name)) { luaTrace('Shader $name was already initialized!'); @@ -2916,7 +2919,7 @@ class FunkinLua { } else frag = null; - if (FileSystem.exists(vert)) + if(FileSystem.exists(vert)) { vert = File.getContent(vert); found = true; @@ -2932,6 +2935,9 @@ class FunkinLua { } } luaTrace('Missing shader $name .frag AND .vert files!', false, false, FlxColor.RED); + #else + luaTrace('This platform doesn\'t support Runtime Shaders!', false, false, FlxColor.RED); + #end return false; } @@ -3143,6 +3149,7 @@ class FunkinLua { return v; #end + return null; } var lastCalledFunction:String = ''; @@ -3405,10 +3412,10 @@ class HScript interp.variables.set('Character', Character); interp.variables.set('Alphabet', Alphabet); interp.variables.set('CustomSubstate', CustomSubstate); - #if !flash + #if (!flash && sys) interp.variables.set('FlxRuntimeShader', FlxRuntimeShader); - interp.variables.set('ShaderFilter', openfl.filters.ShaderFilter); #end + interp.variables.set('ShaderFilter', openfl.filters.ShaderFilter); interp.variables.set('StringTools', StringTools); interp.variables.set('setVar', function(name:String, value:Dynamic) diff --git a/source/GameplayChangersSubstate.hx b/source/GameplayChangersSubstate.hx index 62a59859d22..ac43f4ee367 100644 --- a/source/GameplayChangersSubstate.hx +++ b/source/GameplayChangersSubstate.hx @@ -59,6 +59,7 @@ class GameplayChangersSubstate extends MusicBeatSubstate } optionsArray.push(option); + #if !html5 var option:GameplayOption = new GameplayOption('Playback Rate', 'songspeed', 'float', 1); option.scrollSpeed = 1; option.minValue = 0.5; @@ -67,6 +68,7 @@ class GameplayChangersSubstate extends MusicBeatSubstate option.displayFormat = '%vX'; option.decimals = 2; optionsArray.push(option); + #end var option:GameplayOption = new GameplayOption('Health Gain Multiplier', 'healthgain', 'float', 1); option.scrollSpeed = 2.5; diff --git a/source/editors/ChartingState.hx b/source/editors/ChartingState.hx index e3eaadb02bd..2fd96a15309 100644 --- a/source/editors/ChartingState.hx +++ b/source/editors/ChartingState.hx @@ -1314,9 +1314,11 @@ class ChartingState extends MusicBeatState voicesVolume.name = 'voices_volume'; blockPressWhileTypingOnStepper.push(voicesVolume); + #if !html5 sliderRate = new FlxUISlider(this, 'playbackSpeed', 120, 120, 0.5, 3, 150, null, 5, FlxColor.WHITE, FlxColor.BLACK); sliderRate.name = 'Playback Rate'; tab_group_chart.add(sliderRate); + #end tab_group_chart.add(new FlxText(metronomeStepper.x, metronomeStepper.y - 15, 0, 'BPM:')); tab_group_chart.add(new FlxText(metronomeOffsetStepper.x, metronomeOffsetStepper.y - 15, 0, 'Offset (ms):'));