Skip to content

Commit

Permalink
epic changes 3
Browse files Browse the repository at this point in the history
Added the ability to change the final Y that the logo tweens to on the titleState

Chart Editor
Fixed deleting notes falsely deleting all other event texts
Added an even better multi-section copy tool. This one lets you chart at a much faster pace!

Fixed another crash with Freeplay
Character-based Note Colors now works with Change Character events
  • Loading branch information
JordanSantiagoYT committed Nov 15, 2023
1 parent 2b839cc commit 4a95aac
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 11 deletions.
3 changes: 2 additions & 1 deletion assets/preload/images/gfDanceTitle.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
"gfx":512,
"gfy":40,
"backgroundSprite":"",
"bpm":102
"bpm":102,
"endY":-100
}
2 changes: 1 addition & 1 deletion source/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,9 @@ class FreeplayState extends MusicBeatState
trace('Couldnt find file');
}*/
trace(poop);
PlayState.SONG = Song.loadFromJson(poop, songLowercase);

if(sys.FileSystem.exists(Paths.modsJson(songLowercase + '/' + poop)) || sys.FileSystem.exists(Paths.json(songLowercase + '/' + poop)) || OpenFlAssets.exists(Paths.modsJson(songLowercase + '/' + poop)) || OpenFlAssets.exists(Paths.json(songLowercase + '/' + poop))) {
PlayState.SONG = Song.loadFromJson(poop, songLowercase);
if (CoolUtil.defaultSongs.contains(PlayState.SONG.song.toLowerCase()) && curDifficulty == 2 && ClientPrefs.JSEngineRecharts) {
PlayState.SONG = Song.loadFromJson(songs[curSelected].songName.toLowerCase() + '-jshard', songs[curSelected].songName.toLowerCase());
PlayState.storyDifficulty == 2;
Expand Down
8 changes: 8 additions & 0 deletions source/Note.hx
Original file line number Diff line number Diff line change
Expand Up @@ -660,4 +660,12 @@ class Note extends FlxSprite
clipRect = swagRect;
}
}
public function updateRGBColors() {
if (Std.isOfType(this.shader, ColoredNoteShader))
{
if (mustPress)
cast(this.shader, ColoredNoteShader).setColors(PlayState.instance.boyfriend.healthColorArray[0], PlayState.instance.boyfriend.healthColorArray[1], PlayState.instance.boyfriend.healthColorArray[2]);
else cast(this.shader, ColoredNoteShader).setColors(PlayState.instance.dad.healthColorArray[0], PlayState.instance.dad.healthColorArray[1], PlayState.instance.dad.healthColorArray[2]);
}
}
}
30 changes: 29 additions & 1 deletion source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6685,6 +6685,34 @@ if (unspawnNotes[0] != null && (Conductor.songPosition + 1800 / songSpeed) >= fi
}
}
reloadHealthBarColors();
if (ClientPrefs.noteColorStyle == 'Char-Based')
{
for (note in notes){
if (note == null)
continue;
note.updateRGBColors();
}
for (note in sustainNotes){
if (note == null)
continue;
note.updateRGBColors();
}
for (note in unspawnNotes){
if (note == null)
continue;
note.updateRGBColors();
}
for (note in playerStrums.members){
if (note == null)
continue;
note.updateRGBColors(true);
}
for (note in opponentStrums.members){
if (note == null)
continue;
note.updateRGBColors(false);
}
}

case 'BG Freaks Expression':
if(bgGirls != null) bgGirls.swapDanceType();
Expand Down Expand Up @@ -8914,7 +8942,7 @@ if (!allSicks && ClientPrefs.colorRatingFC && songMisses > 0 && ClientPrefs.hudT
var spr = playerStrums.members[note.noteData];
if(spr != null)
{
if ((ClientPrefs.colorQuants || ClientPrefs.rainbowNotes) && ClientPrefs.showNotes) {
if ((ClientPrefs.noteColorStyle == 'Quant-Based' || ClientPrefs.rainbowNotes) && ClientPrefs.showNotes) {
spr.playAnim('confirm', true, note.colorSwap.hue, note.colorSwap.saturation, note.colorSwap.brightness);
} else {
spr.playAnim('confirm', true, 0, 0, 0, ClientPrefs.noteColorStyle == 'Char-Based', note.mustPress);
Expand Down
11 changes: 10 additions & 1 deletion source/StrumNote.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ class StrumNote extends FlxSprite

public function new(x:Float, y:Float, leData:Int, player:Int) {
colorSwap = new ColorSwap();
shader = ClientPrefs.noteColorStyle == 'Char-Based' ? new ColoredNoteShader(PlayState.instance.dad.healthColorArray[0], PlayState.instance.dad.healthColorArray[1], PlayState.instance.dad.healthColorArray[2], false, 10) : colorSwap.shader;
shader = colorSwap.shader;
if (ClientPrefs.noteColorStyle == 'Char-Based' && PlayState.instance != null) shader = new ColoredNoteShader(PlayState.instance.dad.healthColorArray[0], PlayState.instance.dad.healthColorArray[1], PlayState.instance.dad.healthColorArray[2], false, 10);
noteData = leData;
this.player = player;
this.noteData = leData;
Expand Down Expand Up @@ -237,4 +238,12 @@ class StrumNote extends FlxSprite
cast(this.shader, ColoredNoteShader).setColors(PlayState.instance.boyfriend.healthColorArray[0], PlayState.instance.boyfriend.healthColorArray[1], PlayState.instance.boyfriend.healthColorArray[2]);
cast(this.shader, ColoredNoteShader).enabled.value = [true];
}
public function updateRGBColors(?updateBF:Bool = false) {
if (Std.isOfType(this.shader, ColoredNoteShader))
{
if (updateBF)
cast(this.shader, ColoredNoteShader).setColors(PlayState.instance.boyfriend.healthColorArray[0], PlayState.instance.boyfriend.healthColorArray[1], PlayState.instance.boyfriend.healthColorArray[2]);
else cast(this.shader, ColoredNoteShader).setColors(PlayState.instance.dad.healthColorArray[0], PlayState.instance.dad.healthColorArray[1], PlayState.instance.dad.healthColorArray[2]);
}
}
}
5 changes: 3 additions & 2 deletions source/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ typedef TitleData =
gfx:Float,
gfy:Float,
backgroundSprite:String,
bpm:Int
bpm:Int,
endY:Float,
}
class TitleState extends MusicBeatState
{
Expand Down Expand Up @@ -725,7 +726,7 @@ class TitleState extends MusicBeatState
{
if (!skippedIntro)
{
FlxTween.tween(logoBl, {y: -100}, 1.4, {ease: FlxEase.expoInOut});
FlxTween.tween(logoBl, {y: titleJSON.endY}, 1.4, {ease: FlxEase.expoInOut});

logoBl.angle = -4;

Expand Down
90 changes: 85 additions & 5 deletions source/editors/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ class ChartingState extends MusicBeatState

var curRenderedSustains:FlxTypedGroup<FlxSprite>;
var curRenderedNotes:FlxTypedGroup<Note>;
var curRenderedNoteType:FlxTypedGroup<FlxText>;
var curRenderedNoteType:FlxTypedGroup<AttachedFlxText>;
var curRenderedEventText:FlxTypedGroup<AttachedFlxText>;

var nextRenderedSustains:FlxTypedGroup<FlxSprite>;
var nextRenderedNotes:FlxTypedGroup<Note>;
Expand Down Expand Up @@ -345,7 +346,8 @@ class ChartingState extends MusicBeatState

curRenderedSustains = new FlxTypedGroup<FlxSprite>();
curRenderedNotes = new FlxTypedGroup<Note>();
curRenderedNoteType = new FlxTypedGroup<FlxText>();
curRenderedNoteType = new FlxTypedGroup<AttachedFlxText>();
curRenderedEventText = new FlxTypedGroup<AttachedFlxText>();

nextRenderedSustains = new FlxTypedGroup<FlxSprite>();
nextRenderedNotes = new FlxTypedGroup<Note>();
Expand Down Expand Up @@ -470,6 +472,7 @@ class ChartingState extends MusicBeatState
add(curRenderedSustains);
add(curRenderedNotes);
add(curRenderedNoteType);
add(curRenderedEventText);
add(nextRenderedSustains);
add(nextRenderedNotes);

Expand Down Expand Up @@ -814,6 +817,10 @@ class ChartingState extends MusicBeatState

var sectionToCopy:Int = 0;
var notesCopied:Array<Dynamic>;
var CopyLastSectionCount:FlxUINumericStepper;
var CopyFutureSectionCount:FlxUINumericStepper;
var CopyLoopCount:FlxUINumericStepper;
var copyMultiSectButton:FlxButton;

function addSectionUI():Void
{
Expand Down Expand Up @@ -1107,6 +1114,58 @@ class ChartingState extends MusicBeatState
var CopyNextSectionCount:FlxUINumericStepper = new FlxUINumericStepper(jumpSection.x, jumpSection.y + 60, 1, 1, -16384, 16384, 0);
blockPressWhileTypingOnStepper.push(CopyNextSectionCount);

CopyLastSectionCount = new FlxUINumericStepper(CopyNextSectionCount.x + 100, CopyNextSectionCount.y, 1, 1, -16384, 16384, 0);
blockPressWhileTypingOnStepper.push(CopyLastSectionCount);

CopyFutureSectionCount = new FlxUINumericStepper(CopyLastSectionCount.x + 70, CopyLastSectionCount.y, 1, 1, -16384, 16384, 0);
blockPressWhileTypingOnStepper.push(CopyFutureSectionCount);

CopyLoopCount = new FlxUINumericStepper(CopyFutureSectionCount.x - 60, CopyLastSectionCount.y + 40, 1, 1, -16384, 16384, 0);
blockPressWhileTypingOnStepper.push(CopyFutureSectionCount);

copyMultiSectButton = new FlxButton(CopyFutureSectionCount.x, CopyLastSectionCount.y + 40, "Copy from the last " + Std.int(CopyFutureSectionCount.value) + " to the next " + Std.int(CopyFutureSectionCount.value) + " sections, " + Std.int(CopyLoopCount.value) + " times", function()
{
var daSec = FlxMath.maxInt(curSec, Std.int(CopyLastSectionCount.value));
var value1:Int = Std.int(CopyLastSectionCount.value);
var value2:Int = Std.int(CopyFutureSectionCount.value) * Std.int(CopyLoopCount.value);
if(value1 == 0) {
return;
}
if(Math.isNaN(_song.notes[curSection].sectionNotes.length)) {
trace ("HEY! your section doesn't have any notes! please place at least 1 note then try using this.");
return; //prevent a crash if the section doesn't have any notes
}
saveUndo(_song); //I don't even know why.

for(i in 0...value2) {
for (note in _song.notes[daSec - value1].sectionNotes)
{
var strum = note[0] + Conductor.stepCrochet * (getSectionBeats(daSec - value1) * 4 * value1);


var copiedNote:Array<Dynamic> = [strum, note[1], note[2], note[3]];
_song.notes[daSec].sectionNotes.push(copiedNote);
}
if (_song.notes[curSec+1] == null)
{
trace ("UH OH! looks like we've hit a null section! we're gonna have to stop this to prevent it from crashing the engine!");
break;
}
if (curSection - value1 < 0)
{
trace ("value1's section is less than 0 LMAO");
break;
}
if (_song.notes[curSec+1].sectionNotes != null) changeSection(curSec+1);
daSec = FlxMath.maxInt(curSec, Std.int(CopyLastSectionCount.value)-1);
}
updateGrid(false);
});
copyMultiSectButton.color = FlxColor.BLUE;
copyMultiSectButton.label.color = FlxColor.WHITE;
copyMultiSectButton.setGraphicSize(Std.int(copyMultiSectButton.width), Std.int(copyMultiSectButton.height));
copyMultiSectButton.updateHitbox();

var copyNextButton:FlxButton = new FlxButton(CopyNextSectionCount.x, CopyNextSectionCount.y + 20, "Copy to the next..", function()
{
var value:Int = Std.int(CopyNextSectionCount.value);
Expand Down Expand Up @@ -1155,6 +1214,9 @@ class ChartingState extends MusicBeatState
tab_group_section.add(clearLeftSectionButton);
tab_group_section.add(copyNextButton);
tab_group_section.add(CopyNextSectionCount);
tab_group_section.add(CopyLastSectionCount);
tab_group_section.add(CopyFutureSectionCount);
tab_group_section.add(CopyLoopCount);
tab_group_section.add(clearSectionButton);
tab_group_section.add(check_notesSec);
tab_group_section.add(check_eventsSec);
Expand All @@ -1163,6 +1225,7 @@ class ChartingState extends MusicBeatState
tab_group_section.add(copyLastButton);
tab_group_section.add(duetButton);
tab_group_section.add(mirrorButton);
tab_group_section.add(copyMultiSectButton);

UI_box.addGroup(tab_group_section);
}
Expand Down Expand Up @@ -1929,6 +1992,8 @@ class ChartingState extends MusicBeatState
_song.event7Value = event7InputText.text;
}

copyMultiSectButton.text = "Copy from the last " + Std.int(CopyLastSectionCount.value) + " to the next " + Std.int(CopyFutureSectionCount.value) + " sections, " + Std.int(CopyLoopCount.value) + " times";

strumLineUpdateY();
for (i in 0...8){
strumLineNotes.members[i].y = strumLine.y;
Expand Down Expand Up @@ -3115,6 +3180,11 @@ class ChartingState extends MusicBeatState
txt.destroy();
});
curRenderedNoteType.clear();
curRenderedEventText.forEach(txt -> {
curRenderedEventText.remove(txt, true);
txt.destroy();
});
curRenderedEventText.clear();
if (andNext)
{
nextRenderedNotes.forEach(TheNoteThatShouldBeKilledBecauseWeDontNeedIt -> {
Expand Down Expand Up @@ -3188,7 +3258,7 @@ class ChartingState extends MusicBeatState
daText.xAdd = -410;
daText.borderSize = 1;
if(note.eventLength > 1) daText.yAdd += 8;
curRenderedNoteType.add(daText);
curRenderedEventText.add(daText);
daText.sprTracker = note;
//trace('test: ' + i[0], 'startThing: ' + startThing, 'endThing: ' + endThing);
}
Expand Down Expand Up @@ -3409,8 +3479,18 @@ class ChartingState extends MusicBeatState
}
}
curRenderedNoteType.forEach(txt -> {
curRenderedNoteType.remove(txt, true);
txt.destroy();
if (txt.sprTracker == note)
{
curRenderedNoteType.remove(txt, true);
txt.destroy();
}
});
curRenderedEventText.forEach(txt -> {
if (txt.sprTracker == note)
{
curRenderedEventText.remove(txt, true);
txt.destroy();
}
});
if (note.sustainLength > 0) {
curRenderedSustains.remove(note, true);
Expand Down

6 comments on commit 4a95aac

@StinkTheStinker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do i need to compile with this stuff?

@JordanSantiagoYT
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah, just click the checkmark

@StinkTheStinker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like you are saying "dick"
image

@StinkTheStinker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nah, just click the checkmark

ok, did that, clicked on windowsBuild, and there stuff coming up the history of what you did to the engine

@StinkTheStinker
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do i even do now

@JordanSantiagoYT
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.