fixes
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
2387
|
||||
2392
|
||||
@@ -0,0 +1,95 @@
|
||||
package funkin.chart;
|
||||
|
||||
import funkin.system.Song.SwagSong;
|
||||
|
||||
class BaseGameParser {
|
||||
public static function parse(data:Dynamic, result:ChartData) {
|
||||
// base fnf chart parsing
|
||||
var data:SwagSong = data;
|
||||
if (Reflect.hasField(data, "song")) {
|
||||
var field:Dynamic = Reflect.field(data, "song");
|
||||
if (!(field is String))
|
||||
data = field;
|
||||
}
|
||||
|
||||
result.scrollSpeed = data.speed;
|
||||
result.stage = data.stage;
|
||||
|
||||
result.strumLines.push({
|
||||
characters: [data.player2],
|
||||
opponent: true,
|
||||
position: "dad",
|
||||
notes: []
|
||||
});
|
||||
result.strumLines.push({
|
||||
characters: [data.player1],
|
||||
opponent: false,
|
||||
position: "boyfriend",
|
||||
notes: []
|
||||
});
|
||||
if (data.gf != "none") {
|
||||
result.strumLines.push({
|
||||
characters: [data.gf != null ? data.gf : "gf"],
|
||||
opponent: true,
|
||||
position: "girlfriend",
|
||||
notes: [],
|
||||
visible: false,
|
||||
strumLinePos: 0.5
|
||||
});
|
||||
}
|
||||
|
||||
var camFocusedBF:Bool = false;
|
||||
var beatsPerMesure:Float = data.beatsPerMesure.getDefault(4);
|
||||
var curBPM:Float = data.bpm;
|
||||
var curTime:Float = 0;
|
||||
var curCrochet:Float = ((60 / curBPM) * 1000);
|
||||
|
||||
if (data.notes != null) for(section in data.notes) {
|
||||
if (section == null) {
|
||||
curTime += curCrochet * beatsPerMesure;
|
||||
continue; // Yoshi Engine charts crash fix
|
||||
}
|
||||
|
||||
if (camFocusedBF != (camFocusedBF = section.mustHitSection)) {
|
||||
result.events.push({
|
||||
time: curTime,
|
||||
type: CAM_MOVEMENT,
|
||||
params: [camFocusedBF ? 1 : 0]
|
||||
});
|
||||
}
|
||||
|
||||
if (section.sectionNotes != null) for(note in section.sectionNotes) {
|
||||
if (note[1] < 0) continue;
|
||||
|
||||
var daStrumTime:Float = note[0];
|
||||
var daNoteData:Int = Std.int(note[1] % 8);
|
||||
var daNoteType:Int = Std.int(note[1] / 8);
|
||||
var gottaHitNote:Bool = daNoteData >= 4 ? !section.mustHitSection : section.mustHitSection;
|
||||
|
||||
if (note.length > 2) {
|
||||
if (note[3] is Int)
|
||||
daNoteType = Chart.addNoteType(result, data.noteTypes[Std.int(note[3])-1]);
|
||||
else if (note[3] is String)
|
||||
daNoteType = Chart.addNoteType(result, note[3]);
|
||||
} else {
|
||||
daNoteType = Chart.addNoteType(result, data.noteTypes[daNoteType-1]);
|
||||
}
|
||||
|
||||
|
||||
result.strumLines[gottaHitNote ? 1 : 0].notes.push({
|
||||
time: daStrumTime,
|
||||
id: daNoteData % 4,
|
||||
type: daNoteType,
|
||||
sLen: note[2]
|
||||
});
|
||||
}
|
||||
|
||||
if (section.changeBPM && section.bpm != curBPM) {
|
||||
// TODO: BPM CHANGE EVENT
|
||||
curCrochet = ((60 / (curBPM = section.bpm)) * 1000);
|
||||
}
|
||||
|
||||
curTime += curCrochet * beatsPerMesure;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,12 +14,12 @@ import sys.FileSystem;
|
||||
using StringTools;
|
||||
|
||||
class Chart {
|
||||
public static function loadChartMeta(songName:String, difficulty:String = "normal") {
|
||||
public static function loadChartMeta(songName:String, difficulty:String = "normal", fromMods:Bool = true) {
|
||||
var metaPath = Paths.file('songs/${songName.toLowerCase()}/meta.json');
|
||||
var metaDiffPath = Paths.file('songs/${songName.toLowerCase()}/meta-${difficulty.toLowerCase()}.json');
|
||||
|
||||
var data:ChartMetaData = null;
|
||||
var fromMods:Bool = false;
|
||||
var fromMods:Bool = fromMods;
|
||||
for(path in [metaDiffPath, metaPath]) {
|
||||
if (Assets.exists(path)) {
|
||||
fromMods = Paths.assetsTree.existsSpecific(path, "TEXT", MODS);
|
||||
@@ -97,103 +97,19 @@ class Chart {
|
||||
}
|
||||
|
||||
if (Reflect.hasField(data, "codenameChart") && Reflect.field(data, "codenameChart") == true) {
|
||||
// codename chart
|
||||
base = data;
|
||||
} else {
|
||||
// base fnf chart parsing
|
||||
var data:SwagSong = data;
|
||||
if (Reflect.hasField(data, "song")) {
|
||||
var field:Dynamic = Reflect.field(data, "song");
|
||||
if (!(field is String))
|
||||
data = field;
|
||||
}
|
||||
|
||||
base.scrollSpeed = data.speed;
|
||||
base.stage = data.stage;
|
||||
|
||||
base.strumLines.push({
|
||||
characters: [data.player2],
|
||||
opponent: true,
|
||||
position: "dad",
|
||||
notes: []
|
||||
});
|
||||
base.strumLines.push({
|
||||
characters: [data.player1],
|
||||
opponent: false,
|
||||
position: "boyfriend",
|
||||
notes: []
|
||||
});
|
||||
if (data.gf != "none") {
|
||||
base.strumLines.push({
|
||||
characters: [data.gf != null ? data.gf : "gf"],
|
||||
opponent: true,
|
||||
position: "girlfriend",
|
||||
notes: [],
|
||||
visible: false,
|
||||
strumLinePos: 0.5
|
||||
});
|
||||
}
|
||||
|
||||
var camFocusedBF:Bool = false;
|
||||
var beatsPerMesure:Float = data.beatsPerMesure.getDefault(4);
|
||||
var curBPM:Float = data.bpm;
|
||||
var curTime:Float = 0;
|
||||
var curCrochet:Float = ((60 / curBPM) * 1000);
|
||||
|
||||
if (data.notes != null) for(section in data.notes) {
|
||||
if (section == null) {
|
||||
curTime += curCrochet * beatsPerMesure;
|
||||
continue; // Yoshi Engine charts crash fix
|
||||
}
|
||||
|
||||
if (camFocusedBF != (camFocusedBF = section.mustHitSection)) {
|
||||
base.events.push({
|
||||
time: curTime,
|
||||
type: CAM_MOVEMENT,
|
||||
params: [camFocusedBF ? 1 : 0]
|
||||
});
|
||||
}
|
||||
|
||||
if (section.sectionNotes != null) for(note in section.sectionNotes) {
|
||||
if (note[1] < 0) continue;
|
||||
|
||||
var daStrumTime:Float = note[0];
|
||||
var daNoteData:Int = Std.int(note[1] % 8);
|
||||
var daNoteType:Int = Std.int(note[1] / 8);
|
||||
var gottaHitNote:Bool = daNoteData >= 4 ? !section.mustHitSection : section.mustHitSection;
|
||||
|
||||
if (note.length > 2) {
|
||||
if (note[3] is Int)
|
||||
daNoteType = addNoteType(base, data.noteTypes[Std.int(note[3])-1]);
|
||||
else if (note[3] is String)
|
||||
daNoteType = addNoteType(base, note[3]);
|
||||
} else {
|
||||
daNoteType = addNoteType(base, data.noteTypes[daNoteType-1]);
|
||||
}
|
||||
|
||||
|
||||
base.strumLines[gottaHitNote ? 1 : 0].notes.push({
|
||||
time: daStrumTime,
|
||||
id: daNoteData % 4,
|
||||
type: daNoteType,
|
||||
sLen: note[2]
|
||||
});
|
||||
}
|
||||
|
||||
if (section.changeBPM && section.bpm != curBPM) {
|
||||
// TODO: BPM CHANGE EVENT
|
||||
curCrochet = ((60 / (curBPM = section.bpm)) * 1000);
|
||||
}
|
||||
|
||||
curTime += curCrochet * beatsPerMesure;
|
||||
}
|
||||
// base game chart
|
||||
BaseGameParser.parse(data, base);
|
||||
}
|
||||
|
||||
if (base.meta == null)
|
||||
base.meta = loadChartMeta(songName, difficulty);
|
||||
base.meta = loadChartMeta(songName, difficulty, base.fromMods);
|
||||
return base;
|
||||
}
|
||||
|
||||
private static function addNoteType(chart:ChartData, noteTypeName:String):Int {
|
||||
public static function addNoteType(chart:ChartData, noteTypeName:String):Int {
|
||||
switch(noteTypeName.trim()) {
|
||||
case "Default Note" | null | "":
|
||||
return 0;
|
||||
|
||||
@@ -1086,10 +1086,9 @@ class PlayState extends MusicBeatState
|
||||
|
||||
if (generatedMusic && players[curCameraTarget] != null)
|
||||
{
|
||||
var strumLine = players[curCameraTarget];
|
||||
var pos = FlxPoint.get();
|
||||
var r = 0;
|
||||
for(c in strumLine.characters) {
|
||||
for(c in players[curCameraTarget].characters) {
|
||||
if (c == null) continue;
|
||||
var cpos = c.getCameraPosition();
|
||||
pos.x += cpos.x;
|
||||
@@ -1101,7 +1100,7 @@ class PlayState extends MusicBeatState
|
||||
pos.x /= r;
|
||||
pos.y /= r;
|
||||
|
||||
var event = scripts.event("onCameraMove", EventManager.get(CamMoveEvent).recycle(pos, strumLine, r));
|
||||
var event = scripts.event("onCameraMove", EventManager.get(CamMoveEvent).recycle(pos, players[curCameraTarget], r));
|
||||
if (!event.cancelled)
|
||||
camFollow.setPosition(pos.x, pos.y);
|
||||
}
|
||||
|
||||
@@ -52,8 +52,8 @@ class Strum extends FlxSprite {
|
||||
daNote.__strumCameras = lastDrawCameras;
|
||||
daNote.__strum = this;
|
||||
daNote.scrollFactor.set(scrollFactor.x, scrollFactor.y);
|
||||
var noteAngle = daNote.__noteAngle = getNotesAngle(daNote);
|
||||
daNote.angle = daNote.isSustainNote ? noteAngle : angle;
|
||||
daNote.__noteAngle = getNotesAngle(daNote);
|
||||
daNote.angle = daNote.isSustainNote ? daNote.__noteAngle : angle;
|
||||
|
||||
if (daNote.strumRelativePos) {
|
||||
daNote.setPosition(daNote.isSustainNote ? ((Note.swagWidth - daNote.width) / 2) : 0, (daNote.strumTime - Conductor.songPosition) * (0.45 * FlxMath.roundDecimal(getScrollSpeed(daNote), 2)));
|
||||
@@ -64,9 +64,9 @@ class Strum extends FlxSprite {
|
||||
|
||||
if (daNote.isSustainNote) offset.y -= N_WIDTHDIV2;
|
||||
|
||||
if (Std.int(noteAngle % 360) != 0) {
|
||||
var noteAngleCos = FlxMath.fastCos(noteAngle / PIX180);
|
||||
var noteAngleSin = FlxMath.fastSin(noteAngle / PIX180);
|
||||
if (Std.int(daNote.__noteAngle % 360) != 0) {
|
||||
var noteAngleCos = FlxMath.fastCos(daNote.__noteAngle / PIX180);
|
||||
var noteAngleSin = FlxMath.fastSin(daNote.__noteAngle / PIX180);
|
||||
|
||||
var aOffset:FlxPoint = FlxPoint.get(
|
||||
(daNote.origin.x / daNote.scale.x) - daNote.offset.x,
|
||||
|
||||
@@ -406,7 +406,7 @@ class FreeplaySonglist {
|
||||
|
||||
if (songsFound.length > 0) {
|
||||
for(s in songsFound)
|
||||
songs.push(Chart.loadChartMeta(s));
|
||||
songs.push(Chart.loadChartMeta(s, "normal", source == MODS));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user