Skip to content

Commit

Permalink
Merge branch 'experimental' into discord-rpc-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowMario committed Sep 15, 2024
2 parents 0d622c5 + a22342b commit 4336c66
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 18 deletions.
5 changes: 3 additions & 2 deletions Project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@
<!--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="hxdiscord_rpc" version="1.2.1" if="DISCORD_ALLOWED"/>
<haxelib name="hxvlc" if="VIDEOS_ALLOWED" version="1.8.2"/>
<haxelib name="hxdiscord_rpc" version="1.2.4" if="DISCORD_ALLOWED"/>
<haxelib name="flxanimate"/>

<!-- Disable Discord IO Thread -->
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
2 changes: 2 additions & 0 deletions setup/unix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# REMINDER THAT YOU NEED HAXE INSTALLED PRIOR TO USING THIS
# https://haxe.org/download
cd ..
echo Makking the main haxelib and setuping folder in same time..
mkdir ~/haxelib && haxelib setup ~/haxelib
echo Installing dependencies...
echo This might take a few moments depending on your internet speed.
haxelib install lime 8.1.2
Expand Down
2 changes: 2 additions & 0 deletions source/backend/Language.hx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,10 @@ class Language
// More optimized for file loading
inline public static function getFileTranslation(key:String)
{
#if TRANSLATIONS_ALLOWED
var str:String = phrases.get(key.trim().toLowerCase());
if(str != null) key = str;
#end
return key;
}

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 4336c66

Please sign in to comment.