Skip to content

Commit 660e228

Browse files
committed
almost finished
1 parent 537ac53 commit 660e228

File tree

180 files changed

+19779
-11780
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

180 files changed

+19779
-11780
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
# Weird thing happened with .cdc file / cdev chart file
12
*.cdc linguist-language=Text

Project.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@
186186
<haxedef name="NAPE_RELEASE_BUILD" unless="debug" />
187187
<haxedef name="FLX_NO_POINT_POOL"/>
188188

189+
<!--I don't know anymore at this point-->
190+
<error value="Newer version of haxe would likely makes CDEV Engine failed to compile, please use Haxe 4.2.5" if="haxe > 4.2.5"/>
191+
189192
<!-- _________________________________ Custom _______________________________ -->
190193
<haxeflag name="-dce" value="no" /> <!--I wonder what this does-->
191194
<!--Place custom nodes like icons here (higher priority to override the HaxeFlixel icon)-->

art/ChartConverter.hx

Lines changed: 23 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class ChartConverter
8888
/**
8989
* Main function of this class, used by haxe.
9090
*/
91-
public static function main() {
91+
public static function main():Void {
9292
cls();
9393
Sys.println("Base FNF Chart to CDEV Chart");
9494
var path:String = askInput("Folder path of base game charts [cdev engine assets folder required]");
@@ -107,19 +107,21 @@ class ChartConverter
107107
FileSystem.createDirectory(chartFolderTemp);
108108
}
109109

110-
111110
var wawa:Float = haxe.Timer.stamp();
111+
var songCount:Int = 0;
112112
for (song in FileSystem.readDirectory(chartFolder)){
113+
cls();
113114
Sys.println("Converting: " + song);
114115
var newPath:String = chartFolderTemp+"/"+song+"/";
115116
if (!FileSystem.exists(newPath)){
116117
FileSystem.createDirectory(newPath);
117118
}
118119

119120
convertChart(song, chartFolder);
121+
songCount++;
120122
}
121123
cls();
122-
Sys.println("Finished after like "+Math.fround(haxe.Timer.stamp()-wawa)+"s..");
124+
Sys.println("Finished after "+Math.fround(haxe.Timer.stamp()-wawa)+"s, converted " + songCount + " songs.");
123125
}
124126

125127
/**
@@ -156,91 +158,35 @@ class ChartConverter
156158

157159
var lastHitSection:Bool = false;
158160

159-
var bpm:Float = safeJSON.bpm;
160-
var crochet:Float = ((60 / bpm) * 1000); // beats in milliseconds
161-
var stepCrochet:Float = crochet / 4; // steps in milliseconds
162-
163-
var curTime:Float = 0;
164-
var bpmChangeMap:Array<BPMChangeEvent> = [];
161+
var curBPM:Float = safeJSON.bpm;
162+
var totalPos:Float = 0;
165163

166-
inline function changeBPM(newBpm:Float) {
167-
bpm = newBpm;
168-
crochet = ((60 / bpm) * 1000);
169-
stepCrochet = crochet / 4;
170-
}
171-
inline function getLastBPMChangeEvent():BPMChangeEvent {
172-
var lastChange:BPMChangeEvent = { stepTime: 0, songTime: 0, bpm: 0 };
173-
for (change in bpmChangeMap) {
174-
if (curTime >= change.songTime) {
175-
lastChange = change;
176-
} else {
177-
break;
178-
}
164+
for (index => i in safeJSON.notes){
165+
Sys.println("Working: " + ((index/safeJSON.notes.length)*100) + "%");
166+
if (i.changeBPM && i.bpm != curBPM) {
167+
events.push(["Change BPM", 0, totalPos, Std.string(i.bpm), ""]);
168+
curBPM = i.bpm;
179169
}
180-
return lastChange;
181-
}
182-
inline function mapBPMChanges(song:SwagSong)//, addToSongBPMTiming:Bool)
183-
{
184-
bpmChangeMap = [];
185-
186-
var curBPM:Float = song.bpm;
187-
var totalSteps:Int = 0;
188-
var totalPos:Float = 0;
189-
for (i in 0...song.notes.length)
190-
{
191-
if(song.notes[i].changeBPM && song.notes[i].bpm != curBPM)
192-
{
193-
194-
curBPM = song.notes[i].bpm;
195-
var event:BPMChangeEvent = {
196-
stepTime: totalSteps,
197-
songTime: totalPos,
198-
bpm: curBPM
199-
};
200-
bpmChangeMap.push(event);
201-
202-
//SongBPMTiming.addTiming(songTime/(((60 / curBPM) * 1000)*(totalSteps%4)),curBPM,);
203-
}
204-
205-
var deltaSteps:Int = song.notes[i].lengthInSteps;
206-
totalSteps += deltaSteps;
207-
totalPos += ((60 / curBPM) * 1000 / 4) * deltaSteps;
170+
if (lastHitSection != i.mustHitSection) {
171+
events.push(["Change Camera Focus", 0, totalPos, i.mustHitSection ? "bf" : "dad", ""]);
172+
lastHitSection = i.mustHitSection;
208173
}
209-
if (bpmChangeMap.length > 0) trace("new BPM map BUDDY " + bpmChangeMap);
210-
}
211174

212-
mapBPMChanges(safeJSON);
213-
for (index => i in safeJSON.notes){
214-
curTime = getLastBPMChangeEvent().stepTime + (curTime - getLastBPMChangeEvent().songTime);
215-
curTime += index != 0 ? (crochet*4) : 0;
216-
217-
if (i.changeBPM) {
218-
changeBPM(i.bpm);
219-
events.push(["Change BPM", 0, curTime, Std.string(i.bpm), ""]);
220-
}
221175
for (j in i.sectionNotes){
222-
if (i.mustHitSection){//swap the section if it's a player section.
176+
if (i.mustHitSection){ //swap the section if it's a player section.
223177
var note = j;
224178
note[1] = (note[1] + 4) % 8;
225179
j = note;
226-
if (i.p1AltAnim) j[3] = "Alt Anim";
227-
} else {
228-
if (i.altAnim) j[3] = "Alt Anim";
229-
}
230-
180+
}
181+
if (i.p1AltAnim || i.altAnim) j[3] = "Alt Anim";
231182
notes.push([j[0],j[1],j[2],(j[3]==null?"Default Note":j[3]),(j[4]==null?['','']:j[4])]);
232183
}
233-
// eventName, data, strumtime, val1, val2
234-
if (lastHitSection != i.mustHitSection) {
235-
events.push(["Change Camera Focus", 0, curTime, i.mustHitSection ? "bf" : "dad", ""]);
236-
lastHitSection = i.mustHitSection;
237-
}
238-
184+
239185
if (Reflect.hasField(i,"sectionEvents")){ // bruh
240-
for (k in i.sectionEvents){
241-
events.push([k[0],k[1],k[2],k[3],k[4]]);
242-
}
186+
for (k in i.sectionEvents) events.push([k[0],k[1],k[2],k[3],k[4]]);
243187
}
188+
189+
totalPos += ((60 / curBPM) * 1000)*4;
244190
}
245191

246192
events.sort((a:Dynamic, b:Dynamic)->{
@@ -291,11 +237,7 @@ class ChartConverter
291237
* ignore anything below this comment..
292238
*/
293239

294-
static function cls() {
295-
for (i in 0...20){
296-
Sys.println("\r");
297-
}
298-
}
240+
static function cls() Sys.command("cls");
299241

300242
static function askInput(ask:String):String{
301243
Sys.print("[?] "+ask+ " >> ");

0 commit comments

Comments
 (0)