diff --git a/assets/preload/data/freeplaySonglist.txt b/assets/preload/data/freeplaySonglist.txt index a5939ad..7af8115 100644 --- a/assets/preload/data/freeplaySonglist.txt +++ b/assets/preload/data/freeplaySonglist.txt @@ -1,4 +1,4 @@ -Tutorial:gf:1 +Tutorial:gf:0 Bopeebo:dad:1 Fresh:dad:1 Dad Battle:dad:1 diff --git a/assets/preload/data/test/test.json b/assets/preload/data/test/test.json new file mode 100644 index 0000000..6ccba5e --- /dev/null +++ b/assets/preload/data/test/test.json @@ -0,0 +1 @@ +{"song": {"song": "Test", "notes": [{"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[668.578947368421, 3, 947.3684210526317], [1615.9473684210527, 1, 631.578947368421], [2247.5263157894738, 0, 315.7894736842104]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[2563.315789473684, 3, 631.5789473684213], [3194.8947368421054, 2, 631.5789473684208], [3826.4736842105262, 1, 631.5789473684213], [4773.8421052631575, 1, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[5089.631578947368, 2, 0], [5563.315789473684, 1, 0], [5879.105263157895, 3, 0], [6037.0, 1, 0], [6194.894736842105, 0, 0], [6352.789473684211, 2, 315.78947368420995], [6668.578947368421, 1, 315.78947368421086], [6984.368421052632, 0, 0], [7142.263157894737, 1, 0], [7300.1578947368425, 2, 0], [7458.0526315789475, 0, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[7615.9473684210525, 1, 1578.9473684210525], [7615.9473684210525, 3, 947.3684210526326], [8721.21052631579, 3, 0], [8879.105263157895, 0, 0], [9194.894736842105, 2, 0], [9352.78947368421, 1, 0], [9352.78947368421, 3, 0], [9510.684210526315, 0, 0], [9510.684210526315, 2, 0], [9668.578947368422, 0, 0], [9668.578947368422, 2, 0], [9826.473684210527, 1, 0], [9826.473684210527, 3, 0], [9984.368421052632, 0, 0], [9984.368421052632, 2, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[10142.263157894737, 3, 0], [10458.052631578947, 3, 0], [10773.842105263158, 3, 0], [11089.631578947368, 1, 0], [11247.526315789473, 2, 0], [11405.421052631578, 0, 0], [11721.21052631579, 0, 0], [12037.0, 0, 0], [12194.894736842105, 2, 0], [12352.78947368421, 1, 0], [12510.684210526315, 2, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[12668.578947368422, 3, 0], [12984.368421052632, 1, 0], [13300.157894736842, 2, 315.78947368421177], [13615.947368421053, 0, 0], [13773.842105263158, 1, 0], [13931.736842105263, 3, 1263.1578947368416], [14563.315789473685, 0, 0], [14721.21052631579, 1, 0], [14879.105263157895, 2, 0], [15037.0, 1, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[15194.894736842105, 0, 0], [15352.78947368421, 2, 0], [15510.684210526315, 0, 631.5789473684217], [16142.263157894737, 2, 0], [16300.157894736842, 1, 0], [16458.052631578947, 0, 0], [16773.842105263157, 0, 0], [17089.63157894737, 0, 0], [17405.42105263158, 1, 315.78947368420995]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[17721.21052631579, 0, 1263.1578947368398], [17721.21052631579, 3, 1263.1578947368398], [18984.36842105263, 1, 0], [18984.36842105263, 2, 0], [19300.157894736843, 1, 0], [19300.157894736843, 2, 0], [19615.947368421053, 1, 0], [19615.947368421053, 2, 0], [19826.473684210527, 1, 0], [19826.473684210527, 2, 0], [20037.0, 1, 0], [20037.0, 2, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[20247.526315789473, 3, 631.5789473684199], [20879.105263157893, 1, 0], [21194.894736842107, 1, 0], [21510.684210526317, 1, 0], [21826.473684210527, 1, 0], [22142.263157894737, 1, 0], [22300.157894736843, 2, 0], [22458.052631578947, 0, 0], [22615.947368421053, 2, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[22773.842105263157, 3, 0], [22931.736842105263, 1, 0], [23089.63157894737, 2, 0], [23405.42105263158, 1, 0], [23721.21052631579, 1, 0], [24037.0, 1, 0], [24352.78947368421, 2, 0], [24510.684210526317, 3, 0], [24668.57894736842, 1, 0], [24826.473684210527, 2, 0], [24984.36842105263, 1, 0], [25142.263157894737, 0, 473.68421052631675]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[25773.842105263157, 2, 0], [25931.736842105263, 3, 0], [26089.63157894737, 1, 0], [26247.526315789473, 2, 0], [26563.315789473683, 1, 0], [26879.105263157893, 0, 0], [27194.894736842107, 0, 0], [27352.78947368421, 1, 0], [27510.684210526317, 2, 0], [27668.57894736842, 3, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[27826.473684210527, 2, 0], [28142.263157894737, 2, 0], [28458.052631578947, 3, 1894.7368421052633], [28615.947368421053, 2, 0], [28773.842105263157, 1, 0], [28931.736842105263, 0, 0], [29089.63157894737, 2, 0], [29247.526315789473, 1, 0], [29405.42105263158, 0, 0], [29563.315789473683, 1, 0], [29879.105263157893, 2, 0], [30037.0, 1, 0], [30194.894736842107, 0, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[30352.78947368421, 2, 0], [30431.736842105263, 1, 0], [30510.684210526317, 0, 0], [30668.57894736842, 0, 0], [30826.473684210527, 0, 0], [30905.42105263158, 1, 0], [30984.36842105263, 2, 0], [31142.263157894737, 3, 0], [31300.157894736843, 1, 0], [31458.052631578947, 2, 0], [31615.947368421053, 0, 0], [31773.842105263157, 2, 0], [31931.736842105263, 1, 0], [32089.63157894737, 2, 0], [32405.42105263158, 2, 0], [32721.21052631579, 2, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[32879.10526315789, 2, 0], [32958.05263157895, 3, 0], [33037.0, 1, 0], [33194.89473684211, 0, 0], [33352.78947368421, 2, 0], [33510.68421052631, 1, 0], [33668.57894736842, 2, 0], [33826.47368421053, 3, 0], [33984.36842105263, 1, 0], [34063.31578947369, 2, 0], [34142.26315789474, 0, 0], [34300.15789473684, 0, 0], [34458.05263157895, 1, 0], [34615.94736842105, 2, 0], [34694.89473684211, 1, 0], [34773.84210526316, 2, 0], [34931.73684210526, 3, 0], [35089.63157894737, 1, 0], [35247.52631578947, 2, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[35405.42105263158, 0, 0], [35563.31578947369, 1, 0], [35721.21052631579, 2, 0], [35879.10526315789, 3, 0], [36194.89473684211, 2, 0], [36352.78947368421, 1, 0], [36510.68421052631, 0, 0], [36826.47368421053, 2, 0], [36984.36842105263, 1, 0], [37142.26315789474, 0, 236.84210526315292], [37458.05263157895, 0, 236.8421052631602], [37773.84210526316, 0, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[37931.73684210526, 2, 0], [38089.63157894737, 1, 0], [38247.52631578947, 0, 0], [38405.42105263158, 1, 0], [38563.31578947369, 3, 0], [38721.21052631579, 3, 0], [38879.10526315789, 2, 552.6315789473665], [39510.68421052631, 1, 315.7894736842136], [39826.47368421053, 3, 1263.1578947368398]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[41721.21052631579, 1, 631.5789473684272], [42431.73684210526, 0, 0], [42510.68421052631, 1, 0], [42589.63157894737, 2, 0], [42668.57894736842, 3, 0], [42747.52631578947, 2, 0], [42826.47368421053, 1, 0], [42905.42105263158, 0, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[42984.36842105263, 3, 631.5789473684199], [43615.94736842105, 1, 552.6315789473665], [44247.52631578947, 1, 631.5789473684199], [44958.05263157895, 0, 0], [45037.0, 1, 0], [45115.94736842105, 2, 0], [45194.89473684211, 3, 0], [45273.84210526316, 1, 0], [45352.78947368421, 2, 0], [45431.73684210526, 1, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[45510.68421052631, 3, 631.5789473684272], [46142.26315789474, 1, 0], [46142.26315789474, 2, 631.5789473684199], [46300.15789473684, 0, 0], [46458.05263157895, 1, 0], [46615.94736842105, 0, 0], [46773.84210526316, 1, 0], [46773.84210526316, 3, 631.5789473684199], [46931.73684210526, 0, 0], [47089.63157894737, 1, 0], [47247.52631578947, 0, 0], [47405.42105263158, 1, 0], [47405.42105263158, 2, 631.5789473684199], [47484.36842105263, 0, 0], [47563.31578947369, 1, 0], [47642.26315789474, 0, 0], [47721.21052631579, 1, 0], [47800.15789473684, 0, 0], [47879.10526315789, 1, 0], [47958.05263157895, 0, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[48037.0, 1, 0], [48194.89473684211, 2, 0], [48352.78947368421, 1, 315.7894736842063], [48668.57894736842, 2, 236.8421052631602], [48984.36842105263, 1, 0], [49063.31578947369, 2, 0], [49142.26315789474, 3, 0], [49221.21052631579, 2, 0], [49300.15789473684, 0, 631.5789473684199], [49458.05263157895, 1, 0], [49615.94736842105, 2, 0], [49773.84210526316, 1, 0], [49931.73684210526, 2, 0], [50010.68421052631, 0, 0], [50089.63157894737, 1, 0], [50168.57894736842, 2, 0], [50247.52631578947, 1, 0], [50326.47368421053, 2, 0], [50405.42105263158, 3, 0], [50484.36842105263, 2, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[50563.31578947369, 1, 631.5789473684199], [50563.31578947369, 3, 631.5789473684199], [51194.89473684211, 0, 631.5789473684199], [51194.89473684211, 2, 631.5789473684199], [51826.47368421053, 3, 0], [51984.36842105263, 2, 0], [52142.26315789474, 1, 0], [52300.15789473684, 3, 0], [52458.05263157895, 2, 0], [52615.94736842105, 1, 0], [52773.84210526316, 3, 0], [52931.73684210526, 2, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[53089.63157894737, 1, 0], [53247.52631578947, 3, 0], [53405.42105263158, 2, 0], [53563.31578947369, 1, 0], [53721.21052631579, 3, 0], [53879.10526315789, 2, 0], [54037.0, 1, 0], [54194.89473684211, 0, 0], [54352.78947368421, 1, 0], [54510.68421052631, 2, 0], [54668.57894736842, 3, 0], [54826.47368421053, 2, 0], [54984.36842105263, 1, 0], [55142.26315789474, 3, 0], [55300.15789473684, 2, 0], [55458.05263157895, 1, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[55615.94736842105, 3, 0], [55773.84210526316, 2, 0], [55931.73684210526, 1, 0], [56089.63157894737, 3, 0], [56247.52631578947, 2, 0], [56405.42105263158, 1, 0], [56563.31578947369, 3, 0], [56721.21052631579, 2, 0], [56879.10526315789, 1, 0], [57037.0, 0, 0], [57194.89473684211, 1, 0], [57352.78947368421, 0, 0], [57510.68421052631, 1, 0], [57668.57894736842, 2, 0], [57826.47368421053, 0, 0], [57984.36842105263, 1, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[58142.26315789474, 2, 0], [58300.15789473684, 3, 0], [58458.05263157895, 2, 0], [58615.94736842105, 1, 0], [58773.84210526316, 0, 0], [58931.73684210526, 1, 0], [59089.63157894737, 2, 0], [59247.52631578947, 3, 0], [59405.42105263158, 2, 0], [59563.31578947369, 3, 0], [59721.21052631579, 0, 0], [59879.10526315789, 1, 0], [60037.0, 2, 0], [60194.89473684211, 0, 0], [60352.78947368421, 1, 0], [60510.68421052631, 2, 0]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": [[60668.57894736842, 3, 0], [60826.47368421053, 2, 0], [60984.36842105263, 0, 0], [61142.26315789474, 1, 0], [61300.15789473684, 2, 0], [61458.05263157895, 0, 0], [61615.94736842105, 1, 0], [61773.84210526316, 2, 0], [61931.73684210526, 3, 0], [62089.63157894737, 2, 0], [62247.52631578947, 1, 2210.5263157894733]]}, {"lengthInSteps": 16, "bpm": 95.0, "changeBPM": false, "mustHitSection": true, "typeOfSection": 0, "sectionNotes": []}], "bpm": 95.0, "sections": 0, "needsVoices": false, "player1": "bf", "player2": "gf", "sectionLengths": [], "speed": 3}} \ No newline at end of file diff --git a/assets/shared/images/NOTE_assets.png b/assets/shared/images/NOTE_assets.png index 8e9f3a0..b439400 100644 Binary files a/assets/shared/images/NOTE_assets.png and b/assets/shared/images/NOTE_assets.png differ diff --git a/assets/shared/images/NOTE_assets.xml b/assets/shared/images/NOTE_assets.xml index 6e80b13..744f378 100644 --- a/assets/shared/images/NOTE_assets.xml +++ b/assets/shared/images/NOTE_assets.xml @@ -1,92 +1,49 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/songs/test/Inst.mp3 b/assets/songs/test/Inst.mp3 deleted file mode 100644 index 87d9932..0000000 Binary files a/assets/songs/test/Inst.mp3 and /dev/null differ diff --git a/assets/songs/test/Inst.ogg b/assets/songs/test/Inst.ogg index f39e2b1..7a16671 100644 Binary files a/assets/songs/test/Inst.ogg and b/assets/songs/test/Inst.ogg differ diff --git a/assets/songs/test/Voices.mp3 b/assets/songs/test/Voices.mp3 deleted file mode 100644 index 9625266..0000000 Binary files a/assets/songs/test/Voices.mp3 and /dev/null differ diff --git a/assets/songs/test/Voices.ogg b/assets/songs/test/Voices.ogg deleted file mode 100644 index 49f0f5d..0000000 Binary files a/assets/songs/test/Voices.ogg and /dev/null differ diff --git a/docs/guides/weeks.md b/docs/guides/weeks.md index 90b89ca..f2097cb 100644 --- a/docs/guides/weeks.md +++ b/docs/guides/weeks.md @@ -15,8 +15,10 @@ Scroll down to Line 26, or Search (Windows/Linux: `Ctrl+F`, Mac: `Cmd+F`) for "w --- ```haxe -var weekData:Array = [ - +static function weekData():Array +{ + return [ + ['Tutorial'], ['Bopeebo', 'Fresh', 'Dadbattle'], @@ -30,8 +32,9 @@ var weekData:Array = [ ['Cocoa', 'Eggnog', 'Winter-Horrorland'], ['Senpai', 'Roses', 'Thorns'] - -]; + + ]; +} ``` --- @@ -45,8 +48,10 @@ Example --- ```haxe -var weekData:Array = [ - +static function weekData():Array +{ + return [ + ['Tutorial'], ['Bopeebo', 'Fresh', 'Dadbattle'], @@ -58,12 +63,13 @@ var weekData:Array = [ ['Satin-Panties', "High", "Milf"], ['Cocoa', 'Eggnog', 'Winter-Horrorland'], - + ['Senpai', 'Roses', 'Thorns'], ['Ugh', 'Guns', 'Stress'] - -]; + + ]; +} ``` --- diff --git a/source/DialogueBox.hx b/source/DialogueBox.hx index d52358c..07363c6 100644 --- a/source/DialogueBox.hx +++ b/source/DialogueBox.hx @@ -155,7 +155,7 @@ class DialogueBox extends FlxSpriteGroup portraitLeft.visible = false; if (PlayState.SONG.song.toLowerCase() == 'thorns') { - portraitLeft.color = FlxColor.BLACK; + portraitLeft.visible = false; swagDialogue.color = FlxColor.WHITE; dropText.color = FlxColor.BLACK; } diff --git a/source/DiffCalc.hx b/source/DiffCalc.hx index cd7bcf8..a1c7a7a 100644 --- a/source/DiffCalc.hx +++ b/source/DiffCalc.hx @@ -32,51 +32,99 @@ class DiffCalc gottaHitNote = !i.mustHitSection; if (gottaHitNote) - cleanedNotes.push(new SmallNote(ii[0],ii[1])); + cleanedNotes.push(new SmallNote(ii[0],Math.floor(Math.abs(ii[1])))); } } + var handOne:Array = []; + var handTwo:Array = []; + cleanedNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime)); var firstNoteTime = cleanedNotes[0].strumTime; // normalize the notes + for(i in cleanedNotes) { i.strumTime = (i.strumTime - firstNoteTime) * 2; } + for (i in cleanedNotes) + { + switch(i.noteData) + { + case 0: + handOne.push(i); + case 1: + handTwo.push(i); + case 2: + handTwo.push(i); + case 3: + handOne.push(i); + } + } + + // length in segments of the song var length = ((cleanedNotes[cleanedNotes.length - 1].strumTime / 1000) / 0.5); // hackey way of creating a array with a length - var segments:Array = new_Array(1,Std.int(length)); - + var segmentsOne:Array = new_Array(1,Std.int(length)); + var segmentsTwo:Array = new_Array(1,Std.int(length)); + // algo loop - for(i in cleanedNotes) + for(i in handOne) { var index = Std.int(((i.strumTime / 1000))); - if (index + 1 > segments.length) + if (index + 1 > segmentsOne.length) continue; - segments[index] = segments[index] + 1; + segmentsOne[index] = segmentsOne[index] + 1; + } + + for(i in handTwo) + { + var index = Std.int(((i.strumTime / 1000))); + if (index + 1 > segmentsTwo.length) + continue; + segmentsTwo[index] = segmentsTwo[index] + 1; } // get the average of all of the segments - var sum:Float = 0; + var sumOne:Float = 0; + var sumTwo:Float = 0; - var newLength = segments.length; - for (i in segments) + var lone = segmentsOne.length; + var ltwo = segmentsOne.length; + + for (i in segmentsOne) { if (i == 0) // remove empty/breaks { - newLength--; + lone--; continue; } //trace(i); - sum += i / .5; // half it because otherwise instead of nps its just fucking notes per half second which is dumb and stupid + sumOne += i / .5; // half it because otherwise instead of nps its just fucking notes per half second which is dumb and stupid } - return HelperFunctions.truncateFloat(sum / newLength,2); + + for (i in segmentsTwo) + { + if (i == 0) // remove empty/breaks + { + ltwo--; + continue; + } + //trace(i); + sumTwo += i / .5; // half it because otherwise instead of nps its just fucking notes per half second which is dumb and stupid + } + + + var handOneAvg = sumOne / lone; + var handTwoAvg = sumTwo / ltwo; + + return HelperFunctions.truncateFloat(handOneAvg > handTwoAvg ? handOneAvg : handTwoAvg,2); } static public function new_Array( ArrayType:T, Length:Int ):Array { diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index b939a1f..2ff4465 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -64,20 +64,22 @@ class FreeplayState extends MusicBeatState { var data:Array = initSonglist[i].split(':'); var meta = new SongMetadata(data[0], Std.parseInt(data[2]), data[1]); - songs.push(meta); - var format = StringTools.replace(meta.songName, " ", "-"); - switch (format) { - case 'Dad-Battle': format = 'Dadbattle'; - case 'Philly-Nice': format = 'Philly'; - } + if(Std.parseInt(data[2]) <= FlxG.save.data.weekUnlocked - 1) + { + songs.push(meta); + var format = StringTools.replace(meta.songName, " ", "-"); + switch (format) { + case 'Dad-Battle': format = 'Dadbattle'; + case 'Philly-Nice': format = 'Philly'; + } - var diffs = []; - FreeplayState.loadDiff(0,format,meta.songName,diffs); - FreeplayState.loadDiff(1,format,meta.songName,diffs); - FreeplayState.loadDiff(2,format,meta.songName,diffs); - FreeplayState.songData.set(meta.songName,diffs); - trace('loaded diffs for ' + meta.songName); - //diffList += meta.songName + "\nEasy: " + DiffCalc.CalculateDiff(songData.get(meta.songName)[0]) + "\nNormal: " + DiffCalc.CalculateDiff(songData.get(meta.songName)[1]) + "\nHard: " + DiffCalc.CalculateDiff(songData.get(meta.songName)[2]) + "\n\n"; + var diffs = []; + FreeplayState.loadDiff(0,format,meta.songName,diffs); + FreeplayState.loadDiff(1,format,meta.songName,diffs); + FreeplayState.loadDiff(2,format,meta.songName,diffs); + FreeplayState.songData.set(meta.songName,diffs); + trace('loaded diffs for ' + meta.songName); + } } //trace("\n" + diffList); @@ -300,6 +302,10 @@ class FreeplayState extends MusicBeatState function changeDiff(change:Int = 0) { + + if (songs[curSelected += change] == null) + return; + curDifficulty += change; if (curDifficulty < 0) @@ -331,6 +337,9 @@ class FreeplayState extends MusicBeatState // NGio.logEvent('Fresh'); FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); + if (songs[curSelected += change] == null) + return; + curSelected += change; if (curSelected < 0) diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index 0a26829..2e5b424 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -6,7 +6,10 @@ class KadeEngineData { public static function initSave() { - if (FlxG.save.data.newInput == null) + if (FlxG.save.data.weekUnlocked == null) + FlxG.save.data.weekUnlocked = 7; + + if (FlxG.save.data.newInput == null) FlxG.save.data.newInput = true; if (FlxG.save.data.downscroll == null) diff --git a/source/Main.hx b/source/Main.hx index a065da2..6c06d39 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -23,7 +23,7 @@ class Main extends Sprite var skipSplash:Bool = true; // Whether to skip the flixel splash screen that appears in release mode. var startFullscreen:Bool = false; // Whether to start the game in fullscreen on desktop targets - public static var watermarks = true; // Whether to put Kade Engine liteartly anywhere + public static var watermarks = true; // Whether to put Kade Engine literally anywhere // You can pretty much ignore everything from here on - your code should go in your states. diff --git a/source/ModchartState.hx b/source/ModchartState.hx index 6e194d1..571edbf 100644 --- a/source/ModchartState.hx +++ b/source/ModchartState.hx @@ -250,7 +250,7 @@ class ModchartState PlayState.instance.removeObject(PlayState.boyfriend); PlayState.boyfriend = new Boyfriend(oldboyfriendx, oldboyfriendy, id); PlayState.instance.addObject(PlayState.boyfriend); - PlayState.instance.iconP2.animation.play(id); + PlayState.instance.iconP1.animation.play(id); } function makeAnimatedLuaSprite(spritePath:String,names:Array,prefixes:Array,startAnim:String, id:String) diff --git a/source/Note.hx b/source/Note.hx index ec67490..72264a4 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -166,7 +166,7 @@ class Note extends FlxSprite x -= width / 2; - if (PlayState.curStage.startsWith('school')) + if (noteTypeCheck == 'pixel') x += 30; if (prevNote.isSustainNote) diff --git a/source/Options.hx b/source/Options.hx index 7c8f411..8be193e 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -698,3 +698,127 @@ class CamZoomOption extends Option return "Camera Zoom " + (!FlxG.save.data.camzoom ? "off" : "on"); } } + +class LockWeeksOption extends Option +{ + var confirm:Bool = false; + + public function new(desc:String) + { + super(); + description = desc; + } + public override function press():Bool + { + if(!confirm) + { + confirm = true; + display = updateDisplay(); + return true; + } + FlxG.save.data.weekUnlocked = 1; + StoryMenuState.weekUnlocked = [true, true]; + trace('Weeks Locked'); + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return confirm ? "Confirm Story Reset" : "Reset Story Progress"; + } +} + +class ResetScoreOption extends Option +{ + var confirm:Bool = false; + + public function new(desc:String) + { + super(); + description = desc; + } + public override function press():Bool + { + if(!confirm) + { + confirm = true; + display = updateDisplay(); + return true; + } + FlxG.save.data.songScores = null; + for(key in Highscore.songScores.keys()) + { + Highscore.songScores[key] = 0; + } + FlxG.save.data.songCombos = null; + for(key in Highscore.songCombos.keys()) + { + Highscore.songCombos[key] = ''; + } + confirm = false; + trace('Highscores Wiped'); + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return confirm ? "Confirm Score Reset" : "Reset Score"; + } +} + +class ResetSettings extends Option +{ + var confirm:Bool = false; + + public function new(desc:String) + { + super(); + description = desc; + } + public override function press():Bool + { + if(!confirm) + { + confirm = true; + display = updateDisplay(); + return true; + } + FlxG.save.data.weekUnlocked = null; + FlxG.save.data.newInput = null; + FlxG.save.data.downscroll = null; + FlxG.save.data.dfjk = null; + FlxG.save.data.accuracyDisplay = null; + FlxG.save.data.offset = null; + FlxG.save.data.songPosition = null; + FlxG.save.data.fps = null; + FlxG.save.data.changedHit = null; + FlxG.save.data.fpsRain = null; + FlxG.save.data.fpsCap = null; + FlxG.save.data.scrollSpeed = null; + FlxG.save.data.npsDisplay = null; + FlxG.save.data.frames = null; + FlxG.save.data.accuracyMod = null; + FlxG.save.data.watermark = null; + FlxG.save.data.ghost = null; + FlxG.save.data.distractions = null; + FlxG.save.data.flashing = null; + FlxG.save.data.resetButton = null; + FlxG.save.data.botplay = null; + FlxG.save.data.cpuStrums = null; + FlxG.save.data.strumline = null; + FlxG.save.data.customStrumLine = null; + FlxG.save.data.camzoom = null; + KadeEngineData.initSave(); + confirm = false; + trace('All settings have been reset'); + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return confirm ? "Confirm Settings Reset" : "Reset Settings"; + } +} diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 6581771..e67cd0f 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -61,7 +61,13 @@ class OptionsMenu extends MusicBeatState new ScoreScreen("Show the score screen after the end of a song"), new ShowInput("Display every single input in the score screen."), new Optimization("No backgrounds, no characters, centered notes, no player 2."), - new BotPlay("Showcase your charts and mods with autoplay."), + new BotPlay("Showcase your charts and mods with autoplay.") + ]), + + new OptionCategory("Manage Save Data", [ + new ResetScoreOption("Reset your score on all songs and weeks."), + new LockWeeksOption("Reset your storymode progress. (only Tutorial + Week 1 will be unlocked)"), + new ResetSettings("Reset ALL your settings.") ]) ]; diff --git a/source/PlayState.hx b/source/PlayState.hx index daca7ed..c95cae2 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2318,18 +2318,12 @@ class PlayState extends MusicBeatState switch (dad.curCharacter) { - case 'mom': + case 'mom' | 'mom-car': camFollow.y = dad.getMidpoint().y; - case 'senpai': - camFollow.y = dad.getMidpoint().y - 430; - camFollow.x = dad.getMidpoint().x - 100; - case 'senpai-angry': + case 'senpai' | 'senpai-angry': camFollow.y = dad.getMidpoint().y - 430; camFollow.x = dad.getMidpoint().x - 100; } - - if (dad.curCharacter == 'mom') - vocals.volume = 1; } if (PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection && camFollow.x != boyfriend.getMidpoint().x - 100) @@ -2794,17 +2788,13 @@ class PlayState extends MusicBeatState } #end - // if () - StoryMenuState.weekUnlocked[Std.int(Math.min(storyWeek + 1, StoryMenuState.weekUnlocked.length - 1))] = true; - if (SONG.validScore) { NGio.unlockMedal(60961); Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty); } - FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked; - FlxG.save.flush(); + StoryMenuState.unlockNextWeek(storyWeek); } else { diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 5957720..120d4fa 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -24,18 +24,21 @@ class StoryMenuState extends MusicBeatState { var scoreText:FlxText; - var weekData:Array = [ - ['Tutorial'], - ['Bopeebo', 'Fresh', 'Dad Battle'], - ['Spookeez', 'South', "Monster"], - ['Pico', 'Philly Nice', "Blammed"], - ['Satin Panties', "High", "Milf"], - ['Cocoa', 'Eggnog', 'Winter Horrorland'], - ['Senpai', 'Roses', 'Thorns'] - ]; + static function weekData():Array + { + return [ + ['Tutorial'], + ['Bopeebo', 'Fresh', 'Dad Battle'], + ['Spookeez', 'South', "Monster"], + ['Pico', 'Philly Nice', "Blammed"], + ['Satin Panties', "High", "Milf"], + ['Cocoa', 'Eggnog', 'Winter Horrorland'], + ['Senpai', 'Roses', 'Thorns'] + ]; + } var curDifficulty:Int = 1; - public static var weekUnlocked:Array = [true, true, true, true, true, true, true]; + public static var weekUnlocked:Array = []; var weekCharacters:Array = [ ['', 'bf', 'gf'], @@ -73,8 +76,21 @@ class StoryMenuState extends MusicBeatState var leftArrow:FlxSprite; var rightArrow:FlxSprite; + function unlockWeeks():Array + { + var weeks:Array = [true]; + + for(i in 0...FlxG.save.data.weekUnlocked) + { + weeks.push(true); + } + return weeks; + } + override function create() { + weekUnlocked = unlockWeeks(); + #if windows // Updating Discord Rich Presence DiscordClient.changePresence("In the Story Mode Menu", null); @@ -120,7 +136,7 @@ class StoryMenuState extends MusicBeatState trace("Line 70"); - for (i in 0...weekData.length) + for (i in 0...weekData().length) { var weekThing:MenuItem = new MenuItem(0, yellowBG.y + yellowBG.height + 10, i); weekThing.y += ((weekThing.height + 20) * i); @@ -134,6 +150,7 @@ class StoryMenuState extends MusicBeatState // Needs an offset thingie if (!weekUnlocked[i]) { + trace('locking week ' + i); var lock:FlxSprite = new FlxSprite(weekThing.width + 10 + weekThing.x); lock.frames = ui_tex; lock.animation.addByPrefix('lock', 'lock'); @@ -314,7 +331,7 @@ class StoryMenuState extends MusicBeatState stopspamming = true; } - PlayState.storyPlaylist = weekData[curWeek]; + PlayState.storyPlaylist = weekData()[curWeek]; PlayState.isStoryMode = true; selectedWeek = true; @@ -388,10 +405,10 @@ class StoryMenuState extends MusicBeatState { curWeek += change; - if (curWeek >= weekData.length) + if (curWeek >= weekData().length) curWeek = 0; if (curWeek < 0) - curWeek = weekData.length - 1; + curWeek = weekData().length - 1; var bullShit:Int = 0; @@ -417,7 +434,7 @@ class StoryMenuState extends MusicBeatState grpWeekCharacters.members[2].setCharacter(weekCharacters[curWeek][2]); txtTracklist.text = "Tracks\n"; - var stringThing:Array = weekData[curWeek]; + var stringThing:Array = weekData()[curWeek]; for (i in stringThing) txtTracklist.text += "\n" + i; @@ -433,4 +450,16 @@ class StoryMenuState extends MusicBeatState intendedScore = Highscore.getWeekScore(curWeek, curDifficulty); #end } + + public static function unlockNextWeek(week:Int):Void + { + if(week <= weekData().length - 1 && FlxG.save.data.weekUnlocked == week) + { + weekUnlocked.push(true); + trace('Week ' + week + ' beat (Week ' + (week + 1) + ' unlocked)'); + } + + FlxG.save.data.weekUnlocked = weekUnlocked.length - 1; + FlxG.save.flush(); + } } diff --git a/source/TitleState.hx b/source/TitleState.hx index 4a30c1a..cbf4da5 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -102,20 +102,6 @@ class TitleState extends MusicBeatState Highscore.load(); - if (FlxG.save.data.weekUnlocked != null) - { - // FIX LATER!!! - // WEEK UNLOCK PROGRESSION!! - // StoryMenuState.weekUnlocked = FlxG.save.data.weekUnlocked; - - if (StoryMenuState.weekUnlocked.length < 4) - StoryMenuState.weekUnlocked.insert(0, true); - - // QUICK PATCH OOPS! - if (!StoryMenuState.weekUnlocked[0]) - StoryMenuState.weekUnlocked[0] = true; - } - #if FREEPLAY FlxG.switchState(new FreeplayState()); #elseif CHARTING