From a86d6608ceb871012861d40eb4dee399ef489dfd Mon Sep 17 00:00:00 2001 From: Vortex2Oblivion <73261680+Vortex2Oblivion@users.noreply.github.com> Date: Thu, 30 Nov 2023 15:57:21 -0500 Subject: [PATCH] camera --- source/modding/ModchartUtilities.hx | 30 ++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/source/modding/ModchartUtilities.hx b/source/modding/ModchartUtilities.hx index 347751d847..d4bcb95678 100644 --- a/source/modding/ModchartUtilities.hx +++ b/source/modding/ModchartUtilities.hx @@ -105,6 +105,18 @@ class ModchartUtilities { return null; } + function getCameraByName(id:String):LuaCamera{ + if(lua_Cameras.exists(id)) + return lua_Cameras.get(id); + + switch(id.toLowerCase()){ + case 'camhud' | 'hud': return lua_Cameras.get("hud"); + } + + + return lua_Cameras.get("game"); + } + public function die() { PlayState.songMultiplier = oldMultiplier; @@ -112,6 +124,7 @@ class ModchartUtilities { lua_Characters.clear(); lua_Shaders.clear(); lua_Custom_Shaders.clear(); + lua_Cameras.clear(); lua_Sounds.clear(); Lua.close(lua); @@ -178,6 +191,9 @@ class ModchartUtilities { lua_Characters.set("girlfriend", PlayState.gf); lua_Characters.set("dad", PlayState.dad); + lua_Cameras.set("game", {cam: PlayState.instance.camGame, shaders: [], shaderNames: []}); + lua_Cameras.set("hud", {cam: PlayState.instance.camHUD, shaders: [], shaderNames: []}); + lua_Sounds.set("Inst", FlxG.sound.music); @:privateAccess lua_Sounds.set("Voices", PlayState.instance.vocals); @@ -2699,7 +2715,7 @@ class ModchartUtilities { //dumb vc functions setLuaFunction("initShader", function(id:String, file:String, ?glslVersion:Int = 120){ - var funnyCustomShader:CustomShader = new CustomShader(Assets.getText(Paths.frag(file))); + var funnyCustomShader:CustomShader = new CustomShader(Assets.getText(Paths.frag(file)), null, glslVersion); lua_Custom_Shaders.set(id, funnyCustomShader); }); @@ -2924,18 +2940,6 @@ class ModchartUtilities { return PlayState.instance.camGame; } - function getCameraByName(id:String):LuaCamera{ - if(lua_Cameras.exists(id)) - return lua_Cameras.get(id); - - switch(id.toLowerCase()){ - case 'camhud' | 'hud': return lua_Cameras.get("hud"); - } - - - return lua_Cameras.get("game"); - } - @:access(openfl.display.BlendMode) function blendModeFromString(blend:String):BlendMode {