Merge branch 'master' into fix-fixin-fixes

This commit is contained in:
Spel0 2021-08-13 12:33:44 +03:00
commit 435343bbe5
9 changed files with 182 additions and 114 deletions

View File

@ -4,6 +4,7 @@ import flixel.FlxSprite;
class ChartingBox extends FlxSprite class ChartingBox extends FlxSprite
{ {
public var connectedNote:Note; public var connectedNote:Note;
public var connectedNoteData:Array<Dynamic>;
public function new(x,y, originalNote:Note) public function new(x,y, originalNote:Note)
{ {

View File

@ -1326,6 +1326,8 @@ class ChartingState extends MusicBeatState
FlxG.sound.music.time = FlxG.sound.music.length; FlxG.sound.music.time = FlxG.sound.music.length;
} }
public var check_naltAnim:FlxUICheckBox;
function addNoteUI():Void function addNoteUI():Void
{ {
tab_group_note = new FlxUI(null, UI_box); tab_group_note = new FlxUI(null, UI_box);
@ -1338,6 +1340,25 @@ class ChartingState extends MusicBeatState
stepperSusLength.value = 0; stepperSusLength.value = 0;
stepperSusLength.name = 'note_susLength'; stepperSusLength.name = 'note_susLength';
check_naltAnim = new FlxUICheckBox(10, 150, null, null, "Toggle Alternative Animation", 100);
check_naltAnim.callback = function()
{
if (curSelectedNote != null)
{
for(i in selectedBoxes)
{
i.connectedNoteData[3] = check_naltAnim.checked;
for(ii in _song.notes)
{
for(n in ii.sectionNotes)
if (n[0] == i.connectedNoteData[0] && n[1] == i.connectedNoteData[1])
n[3] = i.connectedNoteData[3];
}
}
}
}
var stepperSusLengthLabel = new FlxText(74,10,'Note Sustain Length'); var stepperSusLengthLabel = new FlxText(74,10,'Note Sustain Length');
var applyLength:FlxButton = new FlxButton(10, 100, 'Apply Data'); var applyLength:FlxButton = new FlxButton(10, 100, 'Apply Data');
@ -1345,6 +1366,7 @@ class ChartingState extends MusicBeatState
tab_group_note.add(stepperSusLength); tab_group_note.add(stepperSusLength);
tab_group_note.add(stepperSusLengthLabel); tab_group_note.add(stepperSusLengthLabel);
tab_group_note.add(applyLength); tab_group_note.add(applyLength);
tab_group_note.add(check_naltAnim);
UI_box.addGroup(tab_group_note); UI_box.addGroup(tab_group_note);
@ -1379,6 +1401,8 @@ class ChartingState extends MusicBeatState
var newData = [strum,i[1],i[2]]; var newData = [strum,i[1],i[2]];
ii.sectionNotes.push(newData); ii.sectionNotes.push(newData);
var thing = ii.sectionNotes[ii.sectionNotes.length - 1];
var note:Note = new Note(strum, Math.floor(i[1] % 4),null,false,true); var note:Note = new Note(strum, Math.floor(i[1] % 4),null,false,true);
note.rawNoteData = i[1]; note.rawNoteData = i[1];
note.sustainLength = i[2]; note.sustainLength = i[2];
@ -1392,6 +1416,7 @@ class ChartingState extends MusicBeatState
note.y = Math.floor(getYfromStrum(strum) * zoomFactor); note.y = Math.floor(getYfromStrum(strum) * zoomFactor);
var box = new ChartingBox(note.x,note.y,note); var box = new ChartingBox(note.x,note.y,note);
box.connectedNoteData = thing;
selectedBoxes.add(box); selectedBoxes.add(box);
curRenderedNotes.add(note); curRenderedNotes.add(note);
@ -1667,27 +1692,10 @@ class ChartingState extends MusicBeatState
} }
} }
for(i in shownNotes)
{
if (i.charterSelected)
{
var movedBox = false;
for(ii in selectedBoxes.members) for(ii in selectedBoxes.members)
{ {
if (ii.connectedNote.strumTime == i.strumTime && ii.connectedNote.noteData == i.noteData) ii.x = ii.connectedNote.x;
{ ii.y = ii.connectedNote.y;
movedBox = true;
ii.x = i.x;
ii.y = i.y;
}
}
if (!movedBox)
{
var box = new ChartingBox(i.x,i.y,i);
selectedBoxes.add(box);
}
}
} }
var doInput = true; var doInput = true;
@ -1815,13 +1823,19 @@ class ChartingState extends MusicBeatState
{ {
trace("released!"); trace("released!");
waitingForRelease = false; waitingForRelease = false;
for(i in shownNotes)
while(selectedBoxes.members.length != 0 && selectBox.width > 10 && selectBox.height > 10)
{
selectedBoxes.members[0].connectedNote.charterSelected = false;
selectedBoxes.members[0].destroy();
selectedBoxes.members.remove(selectedBoxes.members[0]);
}
for(i in curRenderedNotes)
{ {
if (i.overlaps(selectBox) && !i.charterSelected) if (i.overlaps(selectBox) && !i.charterSelected)
{ {
i.charterSelected = true; selectNote(i, false);
var box = new ChartingBox(i.x,i.y,i);
selectedBoxes.add(box);
} }
} }
selectBox.destroy(); selectBox.destroy();
@ -1832,6 +1846,7 @@ class ChartingState extends MusicBeatState
{ {
lastAction = "delete"; lastAction = "delete";
var notesToBeDeleted = []; var notesToBeDeleted = [];
deletedNotes = [];
for(i in 0...selectedBoxes.members.length) for(i in 0...selectedBoxes.members.length)
{ {
deletedNotes.push([selectedBoxes.members[i].connectedNote.strumTime,selectedBoxes.members[i].connectedNote.rawNoteData,selectedBoxes.members[i].connectedNote.sustainLength]); deletedNotes.push([selectedBoxes.members[i].connectedNote.strumTime,selectedBoxes.members[i].connectedNote.rawNoteData,selectedBoxes.members[i].connectedNote.sustainLength]);
@ -1848,6 +1863,7 @@ class ChartingState extends MusicBeatState
{ {
lastAction = "delete"; lastAction = "delete";
var notesToBeDeleted = []; var notesToBeDeleted = [];
deletedNotes = [];
for(i in 0...selectedBoxes.members.length) for(i in 0...selectedBoxes.members.length)
{ {
deletedNotes.push([selectedBoxes.members[i].connectedNote.strumTime,selectedBoxes.members[i].connectedNote.rawNoteData,selectedBoxes.members[i].connectedNote.sustainLength]); deletedNotes.push([selectedBoxes.members[i].connectedNote.strumTime,selectedBoxes.members[i].connectedNote.rawNoteData,selectedBoxes.members[i].connectedNote.sustainLength]);
@ -1868,7 +1884,7 @@ class ChartingState extends MusicBeatState
{ {
copiedNotes = []; copiedNotes = [];
for(i in selectedBoxes.members) for(i in selectedBoxes.members)
copiedNotes.push([i.connectedNote.strumTime,i.connectedNote.rawNoteData,i.connectedNote.sustainLength]); copiedNotes.push([i.connectedNote.strumTime,i.connectedNote.rawNoteData,i.connectedNote.sustainLength,i.connectedNote.isAlt]);
var firstNote = copiedNotes[0][0]; var firstNote = copiedNotes[0][0];
@ -2524,7 +2540,7 @@ class ChartingState extends MusicBeatState
{ {
var strum = note[0] + Conductor.stepCrochet * (_song.notes[daSec].lengthInSteps * sectionNum); var strum = note[0] + Conductor.stepCrochet * (_song.notes[daSec].lengthInSteps * sectionNum);
var copiedNote:Array<Dynamic> = [strum, note[1], note[2]]; var copiedNote:Array<Dynamic> = [strum, note[1], note[2],note[3]];
sect.sectionNotes.push(copiedNote); sect.sectionNotes.push(copiedNote);
} }
@ -2567,6 +2583,13 @@ class ChartingState extends MusicBeatState
if (curSelectedNote != null) if (curSelectedNote != null)
{ {
stepperSusLength.value = curSelectedNote[2]; stepperSusLength.value = curSelectedNote[2];
if (curSelectedNote[3] != null)
check_naltAnim.checked = curSelectedNote[3];
else
{
curSelectedNote[3] = false;
check_naltAnim.checked = false;
}
updateGrid(); updateGrid();
} }
} }
@ -2608,7 +2631,7 @@ class ChartingState extends MusicBeatState
var daStrumTime = i[0]; var daStrumTime = i[0];
var daSus = i[2]; var daSus = i[2];
var note:Note = new Note(daStrumTime, daNoteInfo % 4,null,false,true); var note:Note = new Note(daStrumTime, daNoteInfo % 4,null,false,true,i[3]);
note.rawNoteData = daNoteInfo; note.rawNoteData = daNoteInfo;
note.sustainLength = daSus; note.sustainLength = daSus;
note.setGraphicSize(Math.floor(GRID_SIZE), Math.floor(GRID_SIZE)); note.setGraphicSize(Math.floor(GRID_SIZE), Math.floor(GRID_SIZE));
@ -2672,10 +2695,19 @@ class ChartingState extends MusicBeatState
_song.notes.push(sec); _song.notes.push(sec);
} }
function selectNote(note:Note):Void function selectNote(note:Note, ?deleteAllBoxes:Bool = true):Void
{ {
var swagNum:Int = 0; var swagNum:Int = 0;
if (deleteAllBoxes)
while(selectedBoxes.members.length != 0)
{
selectedBoxes.members[0].connectedNote.charterSelected = false;
selectedBoxes.members[0].destroy();
selectedBoxes.members.remove(selectedBoxes.members[0]);
}
for (i in getSectionByTime(note.strumTime).sectionNotes) for (i in getSectionByTime(note.strumTime).sectionNotes)
{ {
if (i[0] == note.strumTime && i[1] == note.rawNoteData) if (i[0] == note.strumTime && i[1] == note.rawNoteData)
@ -2683,25 +2715,21 @@ class ChartingState extends MusicBeatState
curSelectedNote = getSectionByTime(note.strumTime).sectionNotes[swagNum]; curSelectedNote = getSectionByTime(note.strumTime).sectionNotes[swagNum];
if (curSelectedNoteObject != null) if (curSelectedNoteObject != null)
curSelectedNoteObject.charterSelected = false; curSelectedNoteObject.charterSelected = false;
curSelectedNoteObject = note;
while(selectedBoxes.members.length != 0) curSelectedNoteObject = note;
if (!note.charterSelected)
{ {
selectedBoxes.members[0].connectedNote.charterSelected = false; var box = new ChartingBox(note.x,note.y,note);
selectedBoxes.members[0].destroy(); box.connectedNoteData = i;
selectedBoxes.members.remove(selectedBoxes.members[0]); selectedBoxes.add(box);
curSelectedNoteObject.charterSelected = true;
} }
var box = new ChartingBox(note.x,note.y,note);
selectedBoxes.add(box);
curSelectedNoteObject.charterSelected = true;
} }
swagNum += 1; swagNum += 1;
} }
updateGrid();
updateNoteUI(); updateNoteUI();
} }
@ -2958,9 +2986,9 @@ class ChartingState extends MusicBeatState
var noteSus = 0; var noteSus = 0;
if (n != null) if (n != null)
section.sectionNotes.push([n.strumTime, n.noteData, n.sustainLength]); section.sectionNotes.push([n.strumTime, n.noteData, n.sustainLength, false]);
else else
section.sectionNotes.push([noteStrum, noteData, noteSus]); section.sectionNotes.push([noteStrum, noteData, noteSus, false]);
var thingy = section.sectionNotes[section.sectionNotes.length - 1]; var thingy = section.sectionNotes[section.sectionNotes.length - 1];
@ -2993,6 +3021,7 @@ class ChartingState extends MusicBeatState
note.y = Math.floor(getYfromStrum(noteStrum) * zoomFactor); note.y = Math.floor(getYfromStrum(noteStrum) * zoomFactor);
var box = new ChartingBox(note.x,note.y,note); var box = new ChartingBox(note.x,note.y,note);
box.connectedNoteData = thingy;
selectedBoxes.add(box); selectedBoxes.add(box);
curRenderedNotes.add(note); curRenderedNotes.add(note);
@ -3018,6 +3047,7 @@ class ChartingState extends MusicBeatState
} }
var box = new ChartingBox(note.x,note.y,note); var box = new ChartingBox(note.x,note.y,note);
box.connectedNoteData = thingy;
selectedBoxes.add(box); selectedBoxes.add(box);
curSelectedNoteObject.charterSelected = true; curSelectedNoteObject.charterSelected = true;

View File

@ -379,7 +379,8 @@ class FreeplayState extends MusicBeatState
} }
PlayState.SONG = hmm;
PlayState.SONG = Song.conversionChecks(hmm);
PlayState.isStoryMode = false; PlayState.isStoryMode = false;
PlayState.storyDifficulty = curDifficulty; PlayState.storyDifficulty = curDifficulty;
PlayState.storyWeek = songs[curSelected].week; PlayState.storyWeek = songs[curSelected].week;

View File

@ -101,6 +101,7 @@ class MusicBeatState extends FlxUIState
} }
else if (ste < curStep) else if (ste < curStep)
{ {
trace("reset steps for some reason?? at " + Conductor.songPosition);
//Song reset? //Song reset?
curStep = ste; curStep = ste;
updateBeat(); updateBeat();
@ -126,6 +127,7 @@ class MusicBeatState extends FlxUIState
else if (nextStep < curStep) else if (nextStep < curStep)
{ {
//Song reset? //Song reset?
trace("(no bpm change) reset steps for some reason?? at " + Conductor.songPosition);
curStep = nextStep; curStep = nextStep;
updateBeat(); updateBeat();
stepHit(); stepHit();

View File

@ -35,6 +35,8 @@ class Note extends FlxSprite
public var originColor:Int = 0; // The sustain note's original note's color public var originColor:Int = 0; // The sustain note's original note's color
public var noteSection:Int = 0; public var noteSection:Int = 0;
public var isAlt:Bool = false;
public var noteCharterObject:FlxSprite; public var noteCharterObject:FlxSprite;
public var noteScore:Float = 1; public var noteScore:Float = 1;
@ -63,13 +65,15 @@ class Note extends FlxSprite
public var children:Array<Note> = []; public var children:Array<Note> = [];
public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false, ?inCharter:Bool = false) public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false, ?inCharter:Bool = false, ?isAlt:Bool = false)
{ {
super(); super();
if (prevNote == null) if (prevNote == null)
prevNote = this; prevNote = this;
this.isAlt = isAlt;
this.prevNote = prevNote; this.prevNote = prevNote;
isSustainNote = sustainNote; isSustainNote = sustainNote;

View File

@ -423,23 +423,16 @@ class PlayState extends MusicBeatState
TimingStruct.clearTimings(); TimingStruct.clearTimings();
var convertedStuff:Array<Song.Event> = [];
var currentIndex = 0; var currentIndex = 0;
for (i in SONG.eventObjects) for (i in SONG.eventObjects)
{ {
var name = Reflect.field(i,"name"); if (i.type == "BPM Change")
var type = Reflect.field(i,"type");
var pos = Reflect.field(i,"position");
var value = Reflect.field(i,"value");
if (type == "BPM Change")
{ {
var beat:Float = pos; var beat:Float = i.position;
var endBeat:Float = Math.POSITIVE_INFINITY; var endBeat:Float = Math.POSITIVE_INFINITY;
TimingStruct.addTiming(beat,value,endBeat, 0); // offset in this case = start time since we don't have a offset TimingStruct.addTiming(beat,i.value,endBeat, 0); // offset in this case = start time since we don't have a offset
if (currentIndex != 0) if (currentIndex != 0)
{ {
@ -451,39 +444,8 @@ class PlayState extends MusicBeatState
currentIndex++; currentIndex++;
} }
convertedStuff.push(new Song.Event(name,pos,value,type));
} }
SONG.eventObjects = convertedStuff;
var ba = SONG.bpm;
var index = 0;
trace("conversion stuff " + SONG.song + " " + SONG.notes.length);
for(i in SONG.notes)
{
var currentBeat = 4 * index;
var currentSeg = TimingStruct.getTimingAtBeat(currentBeat);
if (currentSeg == null)
continue;
var beat:Float = currentSeg.startBeat + (currentBeat - currentSeg.startBeat);
if (i.changeBPM && i.bpm != ba)
{
trace("converting changebpm for section " + index);
ba = i.bpm;
SONG.eventObjects.push(new Song.Event("FNF BPM Change " + index,beat,i.bpm,"BPM Change"));
}
index++;
}
trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + PlayStateChangeables.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: ' trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + PlayStateChangeables.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: '
+ Conductor.timeScale + '\nBotPlay : ' + PlayStateChangeables.botPlay); + Conductor.timeScale + '\nBotPlay : ' + PlayStateChangeables.botPlay);
@ -1939,6 +1901,8 @@ class PlayState extends MusicBeatState
susLength = susLength / Conductor.stepCrochet; susLength = susLength / Conductor.stepCrochet;
unspawnNotes.push(swagNote); unspawnNotes.push(swagNote);
swagNote.isAlt = songNotes[3];
if (susLength > 0) if (susLength > 0)
swagNote.isParent = true; swagNote.isParent = true;
@ -1951,6 +1915,7 @@ class PlayState extends MusicBeatState
var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + Conductor.stepCrochet, daNoteData, oldNote, true); var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + Conductor.stepCrochet, daNoteData, oldNote, true);
sustainNote.scrollFactor.set(); sustainNote.scrollFactor.set();
unspawnNotes.push(sustainNote); unspawnNotes.push(sustainNote);
sustainNote.isAlt = songNotes[3];
sustainNote.mustPress = gottaHitNote; sustainNote.mustPress = gottaHitNote;
@ -2281,12 +2246,15 @@ class PlayState extends MusicBeatState
var data = TimingStruct.AllTimings[currentIndex - 1]; var data = TimingStruct.AllTimings[currentIndex - 1];
data.endBeat = beat; data.endBeat = beat;
data.length = (data.endBeat - data.startBeat) / (data.bpm / 60); data.length = (data.endBeat - data.startBeat) / (data.bpm / 60);
var step = ((60 / data.bpm) * 1000) / 4;
TimingStruct.AllTimings[currentIndex].startStep = Math.floor(((data.endBeat / (data.bpm / 60)) * 1000) / step);
TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length; TimingStruct.AllTimings[currentIndex].startTime = data.startTime + data.length;
} }
currentIndex++; currentIndex++;
} }
} }
updateFrame++; updateFrame++;
} }
else if (updateFrame != 5) else if (updateFrame != 5)
@ -3080,6 +3048,12 @@ class PlayState extends MusicBeatState
altAnim = '-alt'; altAnim = '-alt';
} }
if (daNote.isAlt)
{
altAnim = '-alt';
trace("YOO WTF THIS IS AN ALT NOTE????");
}
// Accessing the animation name directly to play it // Accessing the animation name directly to play it
if (!daNote.isParent && daNote.parent != null) if (!daNote.isParent && daNote.parent != null)
{ {

View File

@ -282,9 +282,9 @@ class ResultsScreen extends FlxSubState
music.fadeOut(0.3); music.fadeOut(0.3);
if (PlayState.isSM) if (PlayState.isSM)
PlayState.SONG = Song.loadFromJsonRAW(poop); PlayState.SONG = Song.conversionChecks(Song.loadFromJsonRAW(poop));
else else
PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName); PlayState.SONG = Song.conversionChecks(Song.loadFromJson(poop, PlayState.rep.replay.songName));
PlayState.isStoryMode = false; PlayState.isStoryMode = false;
PlayState.storyDifficulty = PlayState.rep.replay.songDiff; PlayState.storyDifficulty = PlayState.rep.replay.songDiff;
LoadingState.loadAndSwitchState(new PlayState()); LoadingState.loadAndSwitchState(new PlayState());

View File

@ -113,6 +113,62 @@ class Song
return parseJSONshit(rawJson); return parseJSONshit(rawJson);
} }
public static function conversionChecks(song:SwagSong):SwagSong
{
var ba = song.bpm;
var index = 0;
trace("conversion stuff " + song.song + " " + song.notes.length);
var convertedStuff:Array<Song.Event> = [];
if (song.eventObjects == null)
song.eventObjects = [];
for(i in song.eventObjects)
{
var name = Reflect.field(i,"name");
var type = Reflect.field(i,"type");
var pos = Reflect.field(i,"position");
var value = Reflect.field(i,"value");
convertedStuff.push(new Song.Event(name,pos,value,type));
}
song.eventObjects = convertedStuff;
for(i in song.notes)
{
var currentBeat = 4 * index;
var currentSeg = TimingStruct.getTimingAtBeat(currentBeat);
if (currentSeg == null)
continue;
var beat:Float = currentSeg.startBeat + (currentBeat - currentSeg.startBeat);
if (i.changeBPM && i.bpm != ba)
{
trace("converting changebpm for section " + index);
ba = i.bpm;
song.eventObjects.push(new Song.Event("FNF BPM Change " + index,beat,i.bpm,"BPM Change"));
}
for(ii in i.sectionNotes)
{
if (ii[3] == null)
ii[3] = false;
}
index++;
}
return song;
}
public static function parseJSONshit(rawJson:String):SwagSong public static function parseJSONshit(rawJson:String):SwagSong
{ {
var swagShit:SwagSong = cast Json.parse(rawJson).song; var swagShit:SwagSong = cast Json.parse(rawJson).song;

View File

@ -369,7 +369,7 @@ class StoryMenuState extends MusicBeatState
PlayState.shits = 0; PlayState.shits = 0;
PlayState.goods = 0; PlayState.goods = 0;
PlayState.campaignMisses = 0; PlayState.campaignMisses = 0;
PlayState.SONG = Song.loadFromJson(poop, PlayState.storyPlaylist[0]); PlayState.SONG = Song.conversionChecks(Song.loadFromJson(poop, PlayState.storyPlaylist[0]));
PlayState.storyWeek = curWeek; PlayState.storyWeek = curWeek;
PlayState.campaignScore = 0; PlayState.campaignScore = 0;
new FlxTimer().start(1, function(tmr:FlxTimer) new FlxTimer().start(1, function(tmr:FlxTimer)