Skip to content

Commit

Permalink
fixes for different keycounts per side
Browse files Browse the repository at this point in the history
  • Loading branch information
Vortex2Oblivion committed Nov 30, 2023
1 parent 27aaa47 commit ce768ad
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 31 deletions.
64 changes: 43 additions & 21 deletions source/modding/ModchartUtilities.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1186,10 +1186,6 @@ class ModchartUtilities {
PlayState.instance.unspawnNotes[id].angle = offset;
});

setLuaFunction("setUnspawnedNoteAngle", function(id:Int, offset:Float) {
PlayState.instance.unspawnNotes[id].angle = offset;
});

setLuaFunction("getRenderedNotes", function() {
return PlayState.instance.notes.length;
});
Expand Down Expand Up @@ -1590,22 +1586,30 @@ class ModchartUtilities {
});

setLuaFunction("getPlayingActorAnimation", function(id:String) {
if (getActorByName(id) != null) {
if (Reflect.getProperty(Reflect.getProperty(getActorByName(id), "animation"), "curAnim") != null)
return Reflect.getProperty(Reflect.getProperty(Reflect.getProperty(getActorByName(id), "animation"), "curAnim"), "name");
}
if(getCharacterByName(id) != null)
{
var character = getCharacterByName(id);
if (character.otherCharacters != null && character.otherCharacters.length > 0)
return Reflect.getProperty(Reflect.getProperty(Reflect.getProperty(character.otherCharacters[0], "animation"), "curAnim"), "name");
}
if(getActorByName(id) != null)
{
if(Reflect.getProperty(Reflect.getProperty(getActorByName(id), "animation"), "curAnim") != null)
return Reflect.getProperty(Reflect.getProperty(Reflect.getProperty(getActorByName(id), "animation"), "curAnim"), "name");
}

return "unknown";
});
return "unknown";
});

setLuaFunction("getPlayingActorAnimationFrame", function(id:String) {
if (getActorByName(id) != null) {
if (Reflect.getProperty(Reflect.getProperty(getActorByName(id), "animation"), "curAnim") != null)
return Reflect.getProperty(Reflect.getProperty(Reflect.getProperty(getActorByName(id), "animation"), "curAnim"), "curFrame");
}
setLuaFunction("getPlayingActorAnimationFrame", function(id:String) {
if(getActorByName(id) != null)
{
if(Reflect.getProperty(Reflect.getProperty(getActorByName(id), "animation"), "curAnim") != null)
return Reflect.getProperty(Reflect.getProperty(Reflect.getProperty(getActorByName(id), "animation"), "curAnim"), "curFrame");
}

return 0;
});
return 0;
});

setLuaFunction("setActorAlpha", function(alpha:Float,id:String) {
if(getCharacterByName(id) != null)
Expand All @@ -1622,10 +1626,20 @@ class ModchartUtilities {
Reflect.setProperty(getActorByName(id), "alpha", alpha);
});

setLuaFunction("setActorVisible", function(visible:Bool, id:String) {
if (getActorByName(id) != null)
getActorByName(id).visible = visible;
});
setLuaFunction("setActorVisible", function(visible:Bool,id:String) {
if(getCharacterByName(id) != null)
{
var character = getCharacterByName(id);
if (character.otherCharacters != null && character.otherCharacters.length > 0)
{
character.otherCharacters[0].visible = visible;
return;
}

}
if(getActorByName(id) != null)
getActorByName(id).visible = visible;
});

setLuaFunction("setActorColor", function(id:String, r:Int, g:Int, b:Int, alpha:Int = 255) {
if (getActorByName(id) != null) {
Expand Down Expand Up @@ -2788,6 +2802,8 @@ class ModchartUtilities {
}

if (PlayState.dad.otherCharacters != null) {
lua_Sprites.set('dad', PlayState.dad.otherCharacters[0]);
lua_Characters.set('dad', PlayState.dad.otherCharacters[0]);
for (char in 0...PlayState.dad.otherCharacters.length) {
lua_Sprites.set("dadCharacter" + char, PlayState.dad.otherCharacters[char]);
lua_Characters.set("dadCharacter" + char, PlayState.dad.otherCharacters[char]);
Expand Down Expand Up @@ -2820,6 +2836,12 @@ class ModchartUtilities {
}
}

lua_Sprites.set("iconP1", PlayState.instance.iconP1);
lua_Sprites.set("iconP2", PlayState.instance.iconP2);

setVar("player1", PlayState.boyfriend.curCharacter);
setVar("player2", PlayState.dad.curCharacter);

for (script in extra_scripts) {
script.setupTheShitCuzPullRequestsSuck();
}
Expand Down
24 changes: 17 additions & 7 deletions source/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1879,7 +1879,17 @@ class PlayState extends MusicBeatState {
gottaHitNote = true;
}

var daNoteData:Int = Std.int(songNotes[1] % (!gottaHitNote ? SONG.keyCount : SONG.playerKeyCount));
var daNoteData:Int = Std.int(songNotes[1] % (SONG.keyCount + SONG.playerKeyCount));
if (section.mustHitSection && daNoteData >= SONG.playerKeyCount)
{
daNoteData -= SONG.playerKeyCount;
daNoteData %= SONG.keyCount;
}
else if (!section.mustHitSection && daNoteData >= SONG.keyCount)
{
daNoteData -= SONG.keyCount;
daNoteData %= SONG.playerKeyCount;
}
var oldNote:Note;

if (unspawnNotes.length > 0)
Expand Down Expand Up @@ -4935,20 +4945,20 @@ class PlayState extends MusicBeatState {
splash_group.clear();
if(Options.getData("middlescroll"))
{
generateStaticArrows(50, false, false);
generateStaticArrows(0.5, true, false);
generateStaticArrows(50, false);
generateStaticArrows(0.5, true);
}
else
{
if(characterPlayingAs == 0)
{
generateStaticArrows(0, false, false);
generateStaticArrows(1, true, false);
generateStaticArrows(0, false);
generateStaticArrows(1, true);
}
else
{
generateStaticArrows(1, false, false);
generateStaticArrows(0, true, false);
generateStaticArrows(1, false);
generateStaticArrows(0, true);
}
}
for (note in unspawnNotes) {
Expand Down
6 changes: 3 additions & 3 deletions source/tools/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ class ChartingState extends MusicBeatState {
var menuBG:FlxSprite;

if(Options.getData("menuBGs"))
if (!Assets.exists(Paths.image('ui skins/' + ui_Skin + '/backgrounds' + '/menuBG')))
menuBG = new FlxSprite().loadGraphic(Paths.image('ui skins/default/backgrounds/menuBG'));
if (!Assets.exists(Paths.image('ui skins/' + ui_Skin + '/backgrounds' + '/menuDesat')))
menuBG = new FlxSprite().loadGraphic(Paths.image('ui skins/default/backgrounds/menuDesat'));
else
menuBG = new FlxSprite().loadGraphic(Paths.image('ui skins/' + ui_Skin + '/backgrounds' + '/menuBG'));
menuBG = new FlxSprite().loadGraphic(Paths.image('ui skins/' + ui_Skin + '/backgrounds' + '/menuDesat'));
else
menuBG = new FlxSprite().makeGraphic(1286, 730, FlxColor.BLACK, false, "optimizedMenuDesat");

Expand Down

0 comments on commit ce768ad

Please sign in to comment.