From 561e01cd0de0cd0894c057eb2777d36c21b09a85 Mon Sep 17 00:00:00 2001 From: Vortex2Oblivion <73261680+Vortex2Oblivion@users.noreply.github.com> Date: Sat, 13 Jan 2024 14:41:51 -0500 Subject: [PATCH] fix shader bullshit --- .github/workflows/workflow.yml | 14 +++---- source/modding/ModchartUtilities.hx | 37 +++++++++++++++-- source/states/PlayState.hx | 62 +++++++++++++++++++---------- 3 files changed, 80 insertions(+), 33 deletions(-) diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 08881f8503..28fb790cb5 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -30,7 +30,7 @@ jobs: - name: Install Haxelib run: | haxelib setup ~/haxelib - haxelib install hxcpp > /dev/null + haxelib git hxcpp https://github.com/HaxeFoundation/hxcpp haxelib install lime haxelib install openfl haxelib --never install flixel @@ -56,7 +56,7 @@ jobs: - name: Create Version Tag run: echo "${{github.run_id}}" > VERSION - name: Compile Linux - run: haxelib run lime build Project.xml linux --app-version="4.0.0-${{ github.run_id}}" + run: haxelib always run lime build Project.xml linux --app-version="4.0.0-${{ github.run_id}}" - name: Publish Linux Artifact uses: actions/upload-artifact@main with: @@ -79,7 +79,7 @@ jobs: - name: Install Haxelib run: | haxelib setup ~/haxelib - haxelib install hxcpp > /dev/null + haxelib git hxcpp https://github.com/HaxeFoundation/hxcpp haxelib install lime haxelib install openfl haxelib --never install flixel @@ -101,7 +101,7 @@ jobs: - name: Create Version Tag run: echo "${{github.run_id}}" > VERSION - name: Compile HTML5 - run: haxelib run lime build Project.xml html5 --app-version="4.0.0-${{ github.run_id}}" + run: haxelib always run lime build Project.xml html5 --app-version="4.0.0-${{ github.run_id}}" - name: Publish HTMl5 Artifact uses: actions/upload-artifact@main with: @@ -150,7 +150,7 @@ jobs: - name: Create Version Tag run: echo "${{github.run_id}}" > VERSION - name: Compile - run: haxelib run lime build windows --app-version="4.0.0-${{ github.run_id}}" + run: haxelib always run lime build windows --app-version="4.0.0-${{ github.run_id}}" - name: Publish Artifact uses: actions/upload-artifact@main with: @@ -170,7 +170,7 @@ jobs: - name: Install Haxelib run: | haxelib setup ~/haxelib - haxelib install hxcpp > /dev/null + haxelib git hxcpp https://github.com/HaxeFoundation/hxcpp haxelib install lime haxelib install openfl haxelib --never install flixel @@ -197,7 +197,7 @@ jobs: - name: Create Version Tag run: echo "${{github.run_id}}" > VERSION - name: Compile - run: haxelib run lime build mac --app-version="4.0.0-${{ github.run_id}}" + run: haxelib always run lime build mac --app-version="4.0.0-${{ github.run_id}}" - name: Publish Artifact uses: actions/upload-artifact@main with: diff --git a/source/modding/ModchartUtilities.hx b/source/modding/ModchartUtilities.hx index 4943171267..da980ddfde 100644 --- a/source/modding/ModchartUtilities.hx +++ b/source/modding/ModchartUtilities.hx @@ -295,10 +295,10 @@ class ModchartUtilities { setVar("curStage", PlayState.SONG.stage); - #if mobile - setVar("mobile", true); - #else - setVar("mobile", false); + #if mobile + setVar("mobile", true); + #else + setVar("mobile", false); #end // other globals @@ -2753,6 +2753,35 @@ class ModchartUtilities { lua_Custom_Shaders.set(id, funnyCustomShader); }); + setLuaFunction("setActorShader", function(actorStr:String, shaderName:String) { + if (!Options.getData("shaders")) + return; + + var funnyCustomShader:CustomShader = lua_Custom_Shaders.get(shaderName); + if(getCharacterByName(actorStr) != null) + { + var character = getCharacterByName(actorStr); + if (character.otherCharacters != null && character.otherCharacters.length > 0) + { + for (c in 0...character.otherCharacters.length) + { + character.otherCharacters[c].shader = funnyCustomShader; + } + return; + } + } + var actor = getActorByName(actorStr); + + + if(actor != null && funnyCustomShader != null) + { + actor.shader = funnyCustomShader; //use reflect to workaround compiler errors + + //trace('added shader '+shaderName+" to " + actorStr); + + } + }); + setLuaFunction("setCameraShader", function(camera:String, id:String){ if (!Options.getData("shaders")) return; diff --git a/source/states/PlayState.hx b/source/states/PlayState.hx index c63af4ac7a..b203fcdcfb 100644 --- a/source/states/PlayState.hx +++ b/source/states/PlayState.hx @@ -2827,7 +2827,7 @@ class PlayState extends MusicBeatState { var coolStrum = enemyStrums.members[Math.floor(Math.abs(daNote.noteData))]; var arrayVal = Std.string([daNote.noteData, daNote.arrow_Type, daNote.isSustainNote]); - daNote.visible = coolStrum.visible; + if(coolStrum != null) daNote.visible = coolStrum.visible; if(!prevEnemyXVals.exists(arrayVal)) { @@ -2843,23 +2843,24 @@ class PlayState extends MusicBeatState { prevEnemyXVals.set(arrayVal, tempShit); } - else - daNote.x = coolStrum.x + prevEnemyXVals.get(arrayVal) - daNote.xOffset; + else{ + if(coolStrum != null) daNote.x = coolStrum.x + prevEnemyXVals.get(arrayVal) - daNote.xOffset; + } - if (!daNote.isSustainNote) + if (!daNote.isSustainNote && coolStrum != null) daNote.modAngle = coolStrum.angle; - if(coolStrum.alpha != 1) + if(coolStrum.alpha != 1 && coolStrum != null) daNote.alpha = coolStrum.alpha; - if (!daNote.isSustainNote) + if (!daNote.isSustainNote && coolStrum != null) daNote.modAngle = coolStrum.angle; daNote.flipX = coolStrum.flipX; - if (!daNote.isSustainNote) + if (!daNote.isSustainNote && coolStrum != null) daNote.flipY = coolStrum.flipY; - daNote.color = coolStrum.color; + if(coolStrum != null) daNote.color = coolStrum.color; } } @@ -2868,7 +2869,7 @@ class PlayState extends MusicBeatState { if (daNote.mustPress && daNote.playMissOnMiss && !(daNote.isSustainNote && daNote.animation.curAnim.name == "holdend") - && !daNote.wasGoodHit) { + && !daNote.wasGoodHit && daNote != null) { vocals.volume = 0; noteMiss(daNote.noteData, daNote); } @@ -4982,12 +4983,12 @@ class PlayState extends MusicBeatState { case "change keycount": var toChange:Int = Std.parseInt(event[2]); var toChangeAlt:Int = Std.parseInt(event[3]); - if (toChange < 1 || Math.isNaN(toChange)){ + if (toChange < 1 || Math.isNaN(toChange)) toChange = 1; - } - if (toChangeAlt < 1 || Math.isNaN(toChangeAlt)){ + + if (toChangeAlt < 1 || Math.isNaN(toChangeAlt)) toChangeAlt = 1; - } + SONG.keyCount = toChangeAlt; SONG.playerKeyCount = toChange; SONG.mania = toChange; @@ -5007,13 +5008,11 @@ class PlayState extends MusicBeatState { { generateStaticArrows(0, false); generateStaticArrows(1, true); - playerStrums.add(babyArrow); } else { generateStaticArrows(1, false); generateStaticArrows(0, true); - enemyStrums.add(babyArrow); } } for (note in unspawnNotes) { @@ -5022,7 +5021,6 @@ class PlayState extends MusicBeatState { for (note in notes.members) { note.reloadNotes(note.strumTime, note.noteData, null, note.isSustainNote, note.character, note.arrow_Type, PlayState.SONG, note.characters, note.mustPress, note.inEditor); } - #if linc_luajit for (i in 0...strumLineNotes.length) { var member = strumLineNotes.members[i]; @@ -5030,6 +5028,26 @@ class PlayState extends MusicBeatState { setLuaVar("defaultStrum" + i + "X", member.x); setLuaVar("defaultStrum" + i + "Y", member.y); setLuaVar("defaultStrum" + i + "Angle", member.angle); + + setLuaVar("defaultStrum" + i, { + x: member.x, + y: member.y, + angle: member.angle, + }); + + if (enemyStrums.members.contains(member)) { + setLuaVar("enemyStrum" + i % SONG.keyCount, { + x: member.x, + y: member.y, + angle: member.angle, + }); + } else { + setLuaVar("playerStrum" + i % SONG.playerKeyCount, { + x: member.x, + y: member.y, + angle: member.angle, + }); + } } #end case "change ui skin": @@ -5076,20 +5094,20 @@ class PlayState extends MusicBeatState { splash_group.clear(); if(Options.getData("middlescroll")) { - generateStaticArrows(50, false); - generateStaticArrows(0.5, true); + generateStaticArrows(50, false, false); + generateStaticArrows(0.5, true, false); } else { if(characterPlayingAs == 0) { - generateStaticArrows(0, false); - generateStaticArrows(1, true); + generateStaticArrows(0, false, false); + generateStaticArrows(1, true, false); } else { - generateStaticArrows(1, false); - generateStaticArrows(0, true); + generateStaticArrows(1, false, false); + generateStaticArrows(0, true, false); } } for (note in unspawnNotes) {