Skip to content

Commit

Permalink
yes
Browse files Browse the repository at this point in the history
Chart Editor: Added a note limit of 50000 before undos stop saving, and added more undo savings
Pause Substate: Exit to Main Menu actually exits to the main menu now
  • Loading branch information
JordanSantiagoYT committed Oct 30, 2023
1 parent daac5c8 commit 14133d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 0 additions & 2 deletions source/PauseSubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,7 @@ class PauseSubState extends MusicBeatSubstate
PlayState.seenCutscene = false;

WeekData.loadTheFirstEnabledMod();
if(PlayState.isStoryMode) {
MusicBeatState.switchState(new MainMenuState());
}
PlayState.cancelMusicFadeTween();
FlxG.sound.playMusic(Paths.music('freakyMenu-' + ClientPrefs.daMenuMusic));
PlayState.changedDifficulty = false;
Expand Down
8 changes: 8 additions & 0 deletions source/editors/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,7 @@ class ChartingState extends MusicBeatState
var stepperCopy:FlxUINumericStepper = null;
var copyLastButton:FlxButton = new FlxButton(10, swapSection.y + 30, "Copy last section", function()
{
saveUndo(_song); //in case you copy from the wrong section and want to easily undo it
var value:Int = Std.int(stepperCopy.value);
if(value == 0) return;

Expand Down Expand Up @@ -1048,6 +1049,7 @@ class ChartingState extends MusicBeatState
});
var clearLeftSectionButton:FlxButton = new FlxButton(duetButton.x, duetButton.y + 30, "Clear Left Side", function()
{
saveUndo(_song); //this is really weird so im saving it as an undoable action just in case it does the wrong section
var removeThese = [];
for (noteIndex in 0..._song.notes[curSection].sectionNotes.length) {
if (_song.notes[curSection].sectionNotes[noteIndex][1] < 4) {
Expand All @@ -1065,6 +1067,7 @@ class ChartingState extends MusicBeatState
});
var clearRightSectionButton:FlxButton = new FlxButton(clearLeftSectionButton.x + 100, clearLeftSectionButton.y, "Clear Right Side", function()
{
saveUndo(_song); //this is really weird so im saving it as an undoable action just in case it does the wrong section
var removeThese = [];
for (noteIndex in 0..._song.notes[curSection].sectionNotes.length) {
if (_song.notes[curSection].sectionNotes[noteIndex][1] >= 4) {
Expand Down Expand Up @@ -1107,6 +1110,7 @@ class ChartingState extends MusicBeatState
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...value) {
for (note in _song.notes[curSec].sectionNotes)
Expand Down Expand Up @@ -3483,6 +3487,7 @@ class ChartingState extends MusicBeatState

public function saveUndo(_song:SwagSong)
{
if (CoolUtil.getNoteAmount(_song) <= 50000) {
var shit = Json.stringify({ //doin this so it doesnt act as a reference
"song": _song
});
Expand All @@ -3492,6 +3497,9 @@ class ChartingState extends MusicBeatState
redos = []; //Reset redos
if (undos.length >= 100) //if you save more than 100 times, remove the oldest undo
undos.remove(undos[100]);
} else {
trace("there's too many notes! to prevent lag and excessive memory usage, you can't save undos if a song has over 50K notes.");
}
}

public function undo()
Expand Down

0 comments on commit 14133d6

Please sign in to comment.