Skip to content

Commit

Permalink
Fixed compiling without BASE_GAME_FILES
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowMario committed Sep 15, 2024
1 parent 07281fa commit 0c727a8
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
3 changes: 2 additions & 1 deletion Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
<!--Psych stuff needed-->
<haxelib name="linc_luajit" if="LUA_ALLOWED"/>
<haxelib name="hscript-iris" if="HSCRIPT_ALLOWED" version="1.0.2"/>
<haxelib name="hxvlc" if="VIDEOS_ALLOWED"/>
<haxelib name="hxvlc" if="VIDEOS_ALLOWED" version="1.8.2"/>
<haxelib name="hxdiscord_rpc" if="DISCORD_ALLOWED"/>
<haxelib name="flxanimate"/>

Expand All @@ -122,6 +122,7 @@
<!-- Enables a terminal log prompt on debug builds -->
<haxelib name="hxcpp-debug-server" if="debug"/>
<haxedef name="HXC_LIBVLC_LOGGING" if="VIDEOS_ALLOWED debug" />
<haxedef name="HXVLC_NO_SHARE_DIRECTORY" />

<!-- ______________________________ Haxedefines _____________________________ -->

Expand Down
30 changes: 15 additions & 15 deletions source/psychlua/ShaderFunctions.hx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class ShaderFunctions
funk.addLocalCallback("initLuaShader", function(name:String, ?glslVersion:Int = 120) {
if(!ClientPrefs.data.shaders) return false;

#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
return funk.initLuaShader(name, glslVersion);
#else
FunkinLua.luaTrace("initLuaShader: Platform unsupported for Runtime Shaders!", false, false, FlxColor.RED);
Expand All @@ -24,7 +24,7 @@ class ShaderFunctions
funk.addLocalCallback("setSpriteShader", function(obj:String, shader:String) {
if(!ClientPrefs.data.shaders) return false;

#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
if(!funk.runtimeShaders.exists(shader) && !funk.initLuaShader(shader))
{
FunkinLua.luaTrace('setSpriteShader: Shader $shader is missing!', false, false, FlxColor.RED);
Expand Down Expand Up @@ -63,7 +63,7 @@ class ShaderFunctions


Lua_helper.add_callback(lua, "getShaderBool", function(obj:String, prop:String) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if (shader == null)
{
Expand All @@ -77,7 +77,7 @@ class ShaderFunctions
#end
});
Lua_helper.add_callback(lua, "getShaderBoolArray", function(obj:String, prop:String) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if (shader == null)
{
Expand All @@ -91,7 +91,7 @@ class ShaderFunctions
#end
});
Lua_helper.add_callback(lua, "getShaderInt", function(obj:String, prop:String) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if (shader == null)
{
Expand All @@ -105,7 +105,7 @@ class ShaderFunctions
#end
});
Lua_helper.add_callback(lua, "getShaderIntArray", function(obj:String, prop:String) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if (shader == null)
{
Expand All @@ -119,7 +119,7 @@ class ShaderFunctions
#end
});
Lua_helper.add_callback(lua, "getShaderFloat", function(obj:String, prop:String) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if (shader == null)
{
Expand All @@ -133,7 +133,7 @@ class ShaderFunctions
#end
});
Lua_helper.add_callback(lua, "getShaderFloatArray", function(obj:String, prop:String) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if (shader == null)
{
Expand All @@ -149,7 +149,7 @@ class ShaderFunctions


Lua_helper.add_callback(lua, "setShaderBool", function(obj:String, prop:String, value:Bool) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if(shader == null)
{
Expand All @@ -164,7 +164,7 @@ class ShaderFunctions
#end
});
Lua_helper.add_callback(lua, "setShaderBoolArray", function(obj:String, prop:String, values:Dynamic) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if(shader == null)
{
Expand All @@ -179,7 +179,7 @@ class ShaderFunctions
#end
});
Lua_helper.add_callback(lua, "setShaderInt", function(obj:String, prop:String, value:Int) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if(shader == null)
{
Expand All @@ -194,7 +194,7 @@ class ShaderFunctions
#end
});
Lua_helper.add_callback(lua, "setShaderIntArray", function(obj:String, prop:String, values:Dynamic) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if(shader == null)
{
Expand All @@ -209,7 +209,7 @@ class ShaderFunctions
#end
});
Lua_helper.add_callback(lua, "setShaderFloat", function(obj:String, prop:String, value:Float) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if(shader == null)
{
Expand All @@ -224,7 +224,7 @@ class ShaderFunctions
#end
});
Lua_helper.add_callback(lua, "setShaderFloatArray", function(obj:String, prop:String, values:Dynamic) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if(shader == null)
{
Expand All @@ -241,7 +241,7 @@ class ShaderFunctions
});

Lua_helper.add_callback(lua, "setShaderSampler2D", function(obj:String, prop:String, bitmapdataPath:String) {
#if (!flash && MODS_ALLOWED && sys)
#if (!flash && sys)
var shader:FlxRuntimeShader = getShader(obj);
if(shader == null)
{
Expand Down
11 changes: 10 additions & 1 deletion source/states/stages/objects/ABotSpeaker.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package states.stages.objects;

#if funkin.vis
import funkin.vis.dsp.SpectralAnalyzer;
#end

class ABotSpeaker extends FlxSpriteGroup
{
Expand All @@ -14,14 +16,18 @@ class ABotSpeaker extends FlxSpriteGroup
public var eyes:FlxAnimate;
public var speaker:FlxAnimate;

#if funkin.vis
var analyzer:SpectralAnalyzer;
#end
var volumes:Array<Float> = [];

public var snd(default, set):FlxSound;
function set_snd(changed:FlxSound)
{
snd = changed;
#if funkin.vis
initAnalyzer();
#end
return snd;
}

Expand Down Expand Up @@ -77,14 +83,14 @@ class ABotSpeaker extends FlxSpriteGroup
add(speaker);
}

#if funkin.vis
var levels:Array<Bar>;
var levelMax:Int = 0;
override function update(elapsed:Float):Void
{
super.update(elapsed);
if(analyzer == null) return;

//var levels = analyzer.getLevels(); //this has a memory leak, so i made my own function for it
levels = analyzer.getLevels(levels);
var oldLevelMax = levelMax;
levelMax = 0;
Expand All @@ -104,12 +110,14 @@ class ABotSpeaker extends FlxSpriteGroup
beatHit();
}
}
#end

public function beatHit()
{
speaker.anim.play('anim', true);
}

#if funkin.vis
public function initAnalyzer()
{
@:privateAccess
Expand All @@ -121,6 +129,7 @@ class ABotSpeaker extends FlxSpriteGroup
analyzer.fftN = 256;
#end
}
#end

var lookingAtRight:Bool = true;
public function lookLeft()
Expand Down

0 comments on commit 0c727a8

Please sign in to comment.