fixed bullshit

This commit is contained in:
Cameron Taylor 2020-10-18 19:18:06 -07:00
parent 32c27dfb30
commit e443b1916d
6 changed files with 41 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@ -443,7 +443,10 @@ class ChartingState extends MusicBeatState
for (note in _song.notes[daSec - sectionNum].sectionNotes)
{
_song.notes[daSec].sectionNotes.push(note);
var strum = note.strumTime + Conductor.stepCrochet * (_song.notes[daSec].lengthInSteps * sectionNum);
var copiedNote:NoteMeta = new NoteMeta(strum, note.noteData, note.sustainLength);
_song.notes[daSec].sectionNotes.push(copiedNote);
}
updateGrid();
@ -469,12 +472,15 @@ class ChartingState extends MusicBeatState
for (i in sectionInfo)
{
var daNoteInfo = i[1];
var daStrumTime = i[0];
var daSus = i[2];
var note:Note = new Note(i[0], daNoteInfo % 4);
var note:Note = new Note(daStrumTime, daNoteInfo % 4);
note.sustainLength = daSus;
note.setGraphicSize(GRID_SIZE, GRID_SIZE);
note.updateHitbox();
note.x = Math.floor(i[1] * GRID_SIZE);
note.y = getYfromStrum(note.strumTime) % gridBG.height;
note.x = Math.floor(daNoteInfo * GRID_SIZE);
note.y = getYfromStrum(daStrumTime) % gridBG.height;
curRenderedNotes.add(note);
}
@ -501,8 +507,8 @@ class ChartingState extends MusicBeatState
private function addNote():Void
{
var swagNote:Note = new Note(Math.round(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16))),
Math.floor(FlxG.mouse.x / GRID_SIZE));
var swagNote:NoteMeta = new NoteMeta(Math.round(getStrumTime(dummyArrow.y) + (curSection * (Conductor.stepCrochet * 16))),
Math.floor(FlxG.mouse.x / GRID_SIZE), 0);
_song.notes[curSection].sectionNotes.push(swagNote);
@ -587,7 +593,7 @@ class ChartingState extends MusicBeatState
_file.addEventListener(Event.COMPLETE, onSaveComplete);
_file.addEventListener(Event.CANCEL, onSaveCancel);
_file.addEventListener(IOErrorEvent.IO_ERROR, onSaveError);
_file.save(data.trim(), json.song.song.toLowerCase() + ".json");
_file.save(data.trim(), _song.song.toLowerCase() + ".json");
}
}

15
source/NoteMeta.hx Normal file
View File

@ -0,0 +1,15 @@
package;
class NoteMeta
{
public var strumTime:Float = 0;
public var noteData:Int = 0;
public var sustainLength:Float = 0;
public function new(strumTime:Float, noteData:Int, sustain:Float)
{
this.strumTime = strumTime;
this.noteData = noteData;
sustainLength = sustain;
}
}

View File

@ -274,12 +274,12 @@ class PlayState extends MusicBeatState
sectionScores[0].push(0);
sectionScores[1].push(0);
var daStrumTime:Float = songNotes[0];
var daNoteData:Int = Std.int(songNotes[1] % 4);
var daStrumTime:Float = songNotes.strumTime;
var daNoteData:Int = Std.int(songNotes.noteData % 4);
var gottaHitNote:Bool = section.mustHitSection;
if (songNotes[1] > 3)
if (songNotes.noteData > 3)
{
gottaHitNote = !section.mustHitSection;
}
@ -291,6 +291,7 @@ class PlayState extends MusicBeatState
oldNote = null;
var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote);
swagNote.sustainLength = songNotes.sustainLength;
swagNote.scrollFactor.set(0, 0);
unspawnNotes.push(swagNote);

View File

@ -2,7 +2,7 @@ package;
class Section
{
public var sectionNotes:Array<Note> = [];
public var sectionNotes:Array<Dynamic> = [];
public var lengthInSteps:Int = 16;
public var typeOfSection:Int = 0;

View File

@ -51,7 +51,13 @@ class Song
var songData:Song = Json.parse(rawJson).song;
trace('LOADED FROM JSON: ' + songData.song);
// trace('LOADED FROM JSON: ' + songData.notes);
for (i in 0...songData.notes.length)
{
trace('LOADED FROM JSON: ' + songData.notes[i].sectionNotes);
// songData.notes[i].sectionNotes = songData.notes[i].sectionNotes
}
/*
daNotes = songData.notes;
daSong = songData.song;