Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
wip implement moonchart
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Sep 28, 2024
1 parent d3553b2 commit 03b0a39
Show file tree
Hide file tree
Showing 16 changed files with 110 additions and 864 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ haxelib install flixel
haxelib install flixel-addons
haxelib install flixel-ui
haxelib install hxvlc
haxelib git moonchart https://github.com/MaybeMaru/moonchart
haxelib git haxeui-openfl https://github.com/haxeui/haxeui-openfl
haxelib git haxeui-core https://github.com/haxeui/haxeui-core
haxelib git maru-hscript https://github.com/MaybeMaru/hscript-improved
Expand Down
7 changes: 7 additions & 0 deletions actions/libraries.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@
"type": "install",
"version": null
},
{
"name": "moonchart",
"type": "git",
"dir": null,
"ref": "master",
"url": "https://github.com/MaybeMaru/moonchart"
},
{
"name": "maru-hscript",
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
<haxelib name="haxeui-core" unless="mac"/>
<haxelib name="haxeui-openfl" unless="mac"/>
<haxelib name="maru-hscript"/>
<haxelib name="moonchart"/>

<section if="cpp">
<haxelib name="hxvlc" if="VIDEOS_ALLOWED"/>
Expand Down
3 changes: 2 additions & 1 deletion source/funkin/objects/NotesGroup.hx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ class NotesGroup extends Group
instance = this;
game = isPlayState ? PlayState.instance : null;
this.isPlayState = isPlayState;
SONG = Song.checkSong(song, null, false); //Double check null values
//SONG = Song.checkSong(song, null, false); //Double check null values
SONG = song;
curSong = SONG.song;

if (isPlayState) {
Expand Down
7 changes: 4 additions & 3 deletions source/funkin/states/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class PlayState extends MusicBeatState
private var targetCamPos:FlxPoint;
private static var prevCamFollow:FlxObject;

private var curSectionData:SectionJson;
private var curSectionData:Dynamic;

public var notesGroup:NotesGroup;
private var ratingGroup:RatingGroup;
Expand Down Expand Up @@ -140,7 +140,7 @@ class PlayState extends MusicBeatState
FlxG.cameras.setDefaultDrawTarget(camGame, true);
persistentUpdate = persistentDraw = true;

SONG = Song.checkSong(SONG, null, false);
//SONG = Song.checkSong(SONG, null, false);

#if discord_rpc
detailsText = isStoryMode ? 'Story Mode: ${storyWeek.toUpperCase()}' : 'Freeplay';
Expand Down Expand Up @@ -363,7 +363,8 @@ class PlayState extends MusicBeatState

Conductor.songPosition = -Conductor.crochet * 5;
Conductor.setPitch(Conductor.songPitch);
curSectionData = Song.checkSection(SONG.notes[0]);

curSectionData = SONG.notes[0];
cameraMovement();

if (skipCountdown) {
Expand Down
31 changes: 17 additions & 14 deletions source/funkin/states/editors/ChartingState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class ChartingState extends MusicBeatState
camTop = new FlxCamera(); camTop.bgColor.alpha = 0;
FlxG.cameras.add(camTop, false);

SONG = Song.checkSong(PlayState.SONG);
SONG = PlayState.SONG;
notes = SONG.notes;

Conductor.offset = Vector.fromArrayCopy(SONG.offsets);
Expand Down Expand Up @@ -737,17 +737,19 @@ class ChartingState extends MusicBeatState

public function loadJson(song:String):Void {
stop();
PlayState.SONG = Song.checkSong(Song.loadFromFile(PlayState.curDifficulty, song));
//PlayState.SONG = Song.checkSong(Song.loadFromFile(PlayState.curDifficulty, song));
PlayState.SONG = Song.loadFromFile(PlayState.curDifficulty, song);
FlxG.resetState();
}

public function loadAutosave():Void {
PlayState.SONG = Song.checkSong(Song.parseJson('', autoSaveChart));
//PlayState.SONG = Song.checkSong(Song.parseJson('', autoSaveChart));
PlayState.SONG = Json.parse(autoSaveChart);//Song.parseJson('', autoSaveChart);
FlxG.resetState();
}

public function autosaveSong():Void {
SONG = Song.checkSong(SONG);
//SONG = Song.checkSong(SONG);
autoSaveChart = getSongString();
SaveData.setSave('autoSaveChart', autoSaveChart);
SaveData.flushData();
Expand All @@ -767,18 +769,21 @@ class ChartingState extends MusicBeatState
}
}

public function saveChart() {
SONG = Song.checkSong(SONG);
public inline function saveChart()
{
saveJson(getSongString("\t"), PlayState.curDifficulty);
}

public function saveMeta()
{
var metaEvents:Array<SectionJson> = [];
notes.fastForEach((section, i) -> {
metaEvents.push(section.sectionEvents.length <= 0 ? {} : {
sectionEvents: section.sectionEvents.copy()
});
if (section.sectionEvents.length > 0)
{
metaEvents.push(cast {
sectionEvents: section.sectionEvents.copy()
});
}
});

if (metaEvents.length > 1) {
Expand All @@ -789,14 +794,12 @@ class ChartingState extends MusicBeatState
else break;
}
}
final meta:SongMeta = {

saveJson({
diffs: [PlayState.curDifficulty],
offsets: SONG.offsets.copy(),
events: metaEvents
}

saveJson(meta, "songMeta");
}, "songMeta");
}

override function getEvent(id:String, sender:Dynamic, data:Dynamic, ?params:Array<Dynamic>):Void
Expand Down
3 changes: 2 additions & 1 deletion source/funkin/substates/NotesSubstate.hx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class NotesSubstate extends MusicBeatSubstate
super(true, 0x98000000);
this.position = position;

SONG = Song.checkSong(song);
//SONG = Song.checkSong(song);
SONG = song;
notesGroup = new NotesGroup(SONG, false);
notesGroup.skipStrumIntro = true;
notesGroup.init(position - 50);
Expand Down
6 changes: 2 additions & 4 deletions source/funkin/util/backend/SongZip.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package funkin.util.backend;

import haxe.io.Path;
import flixel.util.FlxArrayUtil;
import funkin.util.song.formats.QuaFormat;
import funkin.util.song.formats.OsuFormat;
import funkin.states.editors.ModSetupState;

enum ZipFormat {
Expand Down Expand Up @@ -78,7 +76,7 @@ class SongZip {
}

static final UNZIP_FORMAT:Map<String, UnZipType> = [
"osu" => {
/*"osu" => {
getMap: function(chart) return cast new OsuFormat(chart),
convert: function(map) return OsuFormat.convertSong("", map),
title: "Title",
Expand All @@ -91,7 +89,7 @@ class SongZip {
title: "Title",
diff: "DifficultyName",
audio: "AudioFile"
}
}*/
];

static function unzipFormat(format:String, modPath:String, zipFiles:Array<String>) {
Expand Down
Loading

0 comments on commit 03b0a39

Please sign in to comment.