Skip to content

Commit

Permalink
fix shader bullshit
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortex2Oblivion committed Jan 13, 2024
1 parent 8e5a526 commit 561e01c
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 33 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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:
Expand Down
37 changes: 33 additions & 4 deletions source/modding/ModchartUtilities.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand Down
62 changes: 40 additions & 22 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand All @@ -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;

}
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand All @@ -5022,14 +5021,33 @@ 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];

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":
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 561e01c

Please sign in to comment.