diff --git a/README.md b/README.md index 832467c..eaf8060 100644 --- a/README.md +++ b/README.md @@ -65,4 +65,5 @@ This game was made with love to Newgrounds and its community. Extra love to Tom ### Shoutouts - [GWebDev](https://github.com/GrowtopiaFli) - Video Code - [Rozebud](https://github.com/ThatRozebudDude) - Ideas (that I stole) -- [Puyo](https://github.com/daniel11420) - Setting up appveyor and a lot of other help \ No newline at end of file +- [Puyo](https://github.com/daniel11420) - Setting up appveyor and a lot of other help +- [Smokey](https://twitter.com/Smokey_5_) - telling me that I should do the tricky asset loading \ No newline at end of file diff --git a/appveyor-linux.yml b/appveyor-linux.yml index dc06bb0..6dfee0f 100644 --- a/appveyor-linux.yml +++ b/appveyor-linux.yml @@ -9,7 +9,7 @@ install: - cd /home/appveyor - sudo add-apt-repository ppa:haxe/releases -y - sudo apt update - - sudo apt install neko tar gcc-multilib g++-multilib -y + - sudo apt install neko tar gcc-7 g++-7 gcc-7-multilib g++-7-multilib -y - wget https://github.com/HaxeFoundation/haxe/releases/download/4.1.5/haxe-4.1.5-linux64.tar.gz - mkdir $HAXE_INSTALLDIR - tar -xf haxe-4.1.5-linux64.tar.gz -C $HAXE_INSTALLDIR diff --git a/appveyor-windows.yml b/appveyor-windows.yml index f1d47f5..58d5d98 100644 --- a/appveyor-windows.yml +++ b/appveyor-windows.yml @@ -36,7 +36,10 @@ install: - haxelib git extension-webm https://github.com/KadeDev/extension-webm - haxelib run lime rebuild extension-webm windows - haxelib install linc_luajit - - haxelib install actuate + - haxelib install actuate + #- haxelib git extension-webm https://github.com/KadeDev/extension-webm + #- haxelib run lime rebuild extension-webm windows + #why here's dublicate lmao - haxelib list # No tests idk lol diff --git a/art/flashFiles/NOTE_assets.fla b/art/flashFiles/NOTE_assets.fla index 523cc95..d3e4f32 100644 Binary files a/art/flashFiles/NOTE_assets.fla and b/art/flashFiles/NOTE_assets.fla differ 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/preload/data/weekNames.txt b/assets/preload/data/weekNames.txt new file mode 100644 index 0000000..09b7036 --- /dev/null +++ b/assets/preload/data/weekNames.txt @@ -0,0 +1,7 @@ +Tutorial +Daddy Dearest +Spooky Month +PICO +MOMMY MUST MURDER +RED SNOW +Hating Simulator ft. Moawling \ No newline at end of file diff --git a/assets/preload/music/freakyMenu.mp3 b/assets/preload/music/freakyMenu.mp3 index 8132bfe..c8b0a56 100644 Binary files a/assets/preload/music/freakyMenu.mp3 and b/assets/preload/music/freakyMenu.mp3 differ diff --git a/assets/preload/music/freakyMenu.ogg b/assets/preload/music/freakyMenu.ogg index 372111d..a3ac889 100644 Binary files a/assets/preload/music/freakyMenu.ogg and b/assets/preload/music/freakyMenu.ogg differ diff --git a/assets/shared/images/NOTE_assets.png b/assets/shared/images/NOTE_assets.png index 8e9f3a0..2b348a2 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..d3e1257 100644 --- a/assets/shared/images/NOTE_assets.xml +++ b/assets/shared/images/NOTE_assets.xml @@ -1,92 +1,92 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/shared/images/characters/bf-carOffsets.txt b/assets/shared/images/characters/bf-carOffsets.txt new file mode 100644 index 0000000..5bbfae1 --- /dev/null +++ b/assets/shared/images/characters/bf-carOffsets.txt @@ -0,0 +1,9 @@ +idle -5 0 +singUP -29 27 +singRIGHT -38 -7 +singLEFT 12 -6 +singDOWN -10 -50 +singUPmiss -29 27 +singRIGHTmiss -30 21 +singLEFTmiss 12 24 +singDOWNmiss -11 -19 diff --git a/assets/shared/images/characters/bf-christmasOffsets.txt b/assets/shared/images/characters/bf-christmasOffsets.txt new file mode 100644 index 0000000..0142844 --- /dev/null +++ b/assets/shared/images/characters/bf-christmasOffsets.txt @@ -0,0 +1,10 @@ +idle -5 0 +singUP -29 27 +singRIGHT -38 -7 +singLEFT 12 -6 +singDOWN -10 -50 +singUPmiss -29 27 +singRIGHTmiss -30 21 +singLEFTmiss 12 24 +singDOWNmiss -11 -19 +hey 7 4 diff --git a/assets/shared/images/characters/bf-pixel-deadOffsets.txt b/assets/shared/images/characters/bf-pixel-deadOffsets.txt new file mode 100644 index 0000000..3544a2c --- /dev/null +++ b/assets/shared/images/characters/bf-pixel-deadOffsets.txt @@ -0,0 +1,3 @@ +firstDeath 0 0 +deathLoop -30 -12 +deathConfirm -30 -12 diff --git a/assets/shared/images/characters/bf-pixelOffsets.txt b/assets/shared/images/characters/bf-pixelOffsets.txt new file mode 100644 index 0000000..b8a8292 --- /dev/null +++ b/assets/shared/images/characters/bf-pixelOffsets.txt @@ -0,0 +1,9 @@ +idle 0 0 +singUP 0 0 +singRIGHT 0 0 +singLEFT 0 0 +singDOWN 0 0 +singUPmiss 0 0 +singRIGHTmiss 0 0 +singLEFTmiss 0 0 +singDOWNmiss 0 0 diff --git a/assets/shared/images/characters/bfOffsets.txt b/assets/shared/images/characters/bfOffsets.txt new file mode 100644 index 0000000..6ec2321 --- /dev/null +++ b/assets/shared/images/characters/bfOffsets.txt @@ -0,0 +1,14 @@ +idle -5 0 +singUP -29 27 +singRIGHT -38 -7 +singLEFT 12 -6 +singDOWN -10 -50 +singUPmiss -29 27 +singRIGHTmiss -30 21 +singLEFTmiss 12 24 +singDOWNmiss -11 -19 +hey 7 4 +firstDeath 37 11 +deathLoop 37 5 +deathConfirm 37 69 +scared -4 0 diff --git a/assets/shared/images/characters/bfPixelsDEAD.xml b/assets/shared/images/characters/bfPixelsDEAD.xml index 2d741ca..be3478c 100644 --- a/assets/shared/images/characters/bfPixelsDEAD.xml +++ b/assets/shared/images/characters/bfPixelsDEAD.xml @@ -1,7 +1,7 @@  - - + + @@ -58,8 +58,8 @@ - - + + diff --git a/assets/shared/images/characters/dadOffsets.txt b/assets/shared/images/characters/dadOffsets.txt new file mode 100644 index 0000000..69ba153 --- /dev/null +++ b/assets/shared/images/characters/dadOffsets.txt @@ -0,0 +1,5 @@ +idle 0 0 +singUP -6 50 +singRIGHT 0 27 +singLEFT -10 10 +singDOWN 0 -30 diff --git a/assets/shared/images/characters/gf-carOffsets.txt b/assets/shared/images/characters/gf-carOffsets.txt new file mode 100644 index 0000000..9862aae --- /dev/null +++ b/assets/shared/images/characters/gf-carOffsets.txt @@ -0,0 +1,2 @@ +danceLeft 0 0 +danceRight 0 0 diff --git a/assets/shared/images/characters/gf-christmasOffsets.txt b/assets/shared/images/characters/gf-christmasOffsets.txt new file mode 100644 index 0000000..05abb7a --- /dev/null +++ b/assets/shared/images/characters/gf-christmasOffsets.txt @@ -0,0 +1,11 @@ +cheer 0 0 +sad -2 -21 +danceLeft 0 -9 +danceRight 0 -9 +singUP 0 4 +singRIGHT 0 -20 +singLEFT 0 -19 +singDOWN 0 -20 +hairBlow 45 -8 +hairFall 0 -9 +scared -2 -17 diff --git a/assets/shared/images/characters/gf-pixelOffsets.txt b/assets/shared/images/characters/gf-pixelOffsets.txt new file mode 100644 index 0000000..9862aae --- /dev/null +++ b/assets/shared/images/characters/gf-pixelOffsets.txt @@ -0,0 +1,2 @@ +danceLeft 0 0 +danceRight 0 0 diff --git a/assets/shared/images/characters/gfOffsets.txt b/assets/shared/images/characters/gfOffsets.txt new file mode 100644 index 0000000..05abb7a --- /dev/null +++ b/assets/shared/images/characters/gfOffsets.txt @@ -0,0 +1,11 @@ +cheer 0 0 +sad -2 -21 +danceLeft 0 -9 +danceRight 0 -9 +singUP 0 4 +singRIGHT 0 -20 +singLEFT 0 -19 +singDOWN 0 -20 +hairBlow 45 -8 +hairFall 0 -9 +scared -2 -17 diff --git a/assets/shared/images/characters/mom-carOffsets.txt b/assets/shared/images/characters/mom-carOffsets.txt new file mode 100644 index 0000000..65cbecd --- /dev/null +++ b/assets/shared/images/characters/mom-carOffsets.txt @@ -0,0 +1,5 @@ +idle 0 0 +singUP 14 71 +singRIGHT 10 -60 +singLEFT 250 -23 +singDOWN 20 -160 diff --git a/assets/shared/images/characters/momOffsets.txt b/assets/shared/images/characters/momOffsets.txt new file mode 100644 index 0000000..65cbecd --- /dev/null +++ b/assets/shared/images/characters/momOffsets.txt @@ -0,0 +1,5 @@ +idle 0 0 +singUP 14 71 +singRIGHT 10 -60 +singLEFT 250 -23 +singDOWN 20 -160 diff --git a/assets/shared/images/characters/monster-christmasOffsets.txt b/assets/shared/images/characters/monster-christmasOffsets.txt new file mode 100644 index 0000000..a357046 --- /dev/null +++ b/assets/shared/images/characters/monster-christmasOffsets.txt @@ -0,0 +1,5 @@ +idle 0 0 +singUP -20 50 +singRIGHT -51 0 +singLEFT -30 0 +singDOWN -40 -94 diff --git a/assets/shared/images/characters/monsterOffsets.txt b/assets/shared/images/characters/monsterOffsets.txt new file mode 100644 index 0000000..e211a5f --- /dev/null +++ b/assets/shared/images/characters/monsterOffsets.txt @@ -0,0 +1,5 @@ +idle 0 0 +singUP -20 94 +singRIGHT -51 30 +singLEFT -30 20 +singDOWN -50 -80 diff --git a/assets/shared/images/characters/parents-christmasOffsets.txt b/assets/shared/images/characters/parents-christmasOffsets.txt new file mode 100644 index 0000000..bdee13c --- /dev/null +++ b/assets/shared/images/characters/parents-christmasOffsets.txt @@ -0,0 +1,9 @@ +idle 0 0 +singUP -47 24 +singRIGHT -1 -23 +singLEFT -30 16 +singDOWN -31 -29 +singUP-alt -47 24 +singRIGHT-alt -1 -24 +singLEFT-alt -30 15 +singDOWN-alt -30 -27 diff --git a/assets/shared/images/characters/picoOffsets.txt b/assets/shared/images/characters/picoOffsets.txt new file mode 100644 index 0000000..e209da7 --- /dev/null +++ b/assets/shared/images/characters/picoOffsets.txt @@ -0,0 +1,9 @@ +idle 0 0 +singUP -29 27 +singRIGHT -68 -7 +singLEFT 65 9 +singDOWN 200 -70 +singUPmiss -19 67 +singRIGHTmiss -60 41 +singLEFTmiss 62 64 +singDOWNmiss 210 -28 diff --git a/assets/shared/images/characters/senpai-angryOffsets.txt b/assets/shared/images/characters/senpai-angryOffsets.txt new file mode 100644 index 0000000..c118259 --- /dev/null +++ b/assets/shared/images/characters/senpai-angryOffsets.txt @@ -0,0 +1,5 @@ +idle 0 0 +singUP 5 37 +singRIGHT 0 0 +singLEFT 40 0 +singDOWN 14 0 diff --git a/assets/shared/images/characters/senpaiOffsets.txt b/assets/shared/images/characters/senpaiOffsets.txt new file mode 100644 index 0000000..c118259 --- /dev/null +++ b/assets/shared/images/characters/senpaiOffsets.txt @@ -0,0 +1,5 @@ +idle 0 0 +singUP 5 37 +singRIGHT 0 0 +singLEFT 40 0 +singDOWN 14 0 diff --git a/assets/shared/images/characters/spiritOffsets.txt b/assets/shared/images/characters/spiritOffsets.txt new file mode 100644 index 0000000..ed2442d --- /dev/null +++ b/assets/shared/images/characters/spiritOffsets.txt @@ -0,0 +1,5 @@ +idle -220 -280 +singUP -220 -240 +singRIGHT -220 -280 +singLEFT -200 -280 +singDOWN 170 110 diff --git a/assets/shared/images/characters/spookyOffsets.txt b/assets/shared/images/characters/spookyOffsets.txt new file mode 100644 index 0000000..c14c5e7 --- /dev/null +++ b/assets/shared/images/characters/spookyOffsets.txt @@ -0,0 +1,6 @@ +danceLeft 0 0 +danceRight 0 0 +singUP -20 26 +singRIGHT -130 -14 +singLEFT 130 -10 +singDOWN -50 -130 diff --git a/assets/shared/sounds/CLAP.mp3 b/assets/shared/sounds/CLAP.mp3 new file mode 100644 index 0000000..21b3f27 Binary files /dev/null and b/assets/shared/sounds/CLAP.mp3 differ diff --git a/assets/shared/sounds/SNAP.mp3 b/assets/shared/sounds/SNAP.mp3 new file mode 100644 index 0000000..67971fe Binary files /dev/null and b/assets/shared/sounds/SNAP.mp3 differ 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/building.md b/docs/building.md index fa8d5a9..e824a0f 100644 --- a/docs/building.md +++ b/docs/building.md @@ -30,26 +30,19 @@ - `haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc` - `haxelib install actuate` - `haxelib git extension-webm https://github.com/KadeDev/extension-webm` - - `lime rebuild extension-webm windows` + - `lime rebuild extension-webm ` ### Windows-only dependencies (only for building *to* Windows. Building html5 on Windows does not require this) If you are planning to build for Windows, you also need to install **Visual Studio 2019**. While installing it, *don't click on any of the options to install workloads*. Instead, go to the **individual components** tab and choose the following: - MSVC v142 - VS 2019 C++ x64/x86 build tools +- MSVC v141 - VS 2017 C++ x64/x86 build tools - Windows SDK (10.0.17763.0) - C++ Profiling tools - C++ CMake tools for windows - C++ ATL for v142 build tools (x86 & x64) -- C++ MFC for v142 build tools (x86 & x64) -- C++/CLI support for v142 build tools (14.21) -- C++ Modules for v142 build tools (x64/x86) -- Clang Compiler for Windows -- Windows 10 SDK (10.0.17134.0) -- Windows 10 SDK (10.0.16299.0) -- MSVC v141 - VS 2017 C++ x64/x86 build tools -- MSVC v140 - VS 2015 C++ build tools (v14.00) -This will install about 22 GB of crap, but is necessary to build for Windows. +This will install about 7 GB of crap, but is necessary to build for Windows. ### macOS-only dependencies (these are required for building on macOS at all, including html5.) If you are running macOS, you'll need to install Xcode. You can download it from the macOS App Store or from the [Xcode website](https://developer.apple.com/xcode/). diff --git a/docs/guides/weeks.md b/docs/guides/weeks.md index 020fc5d..7fcdfc0 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'] - -]; + + ]; +} ``` --- @@ -103,32 +109,21 @@ var weekCharacters:Array = [ ### Step 4. Week Names -Underneath the song list, there should be another array called `weekNames`. Creating a new line in that array, just enter a string that represents what you want the week to be called. +In `assets/preload/data`, there should be a .txt file called `weekNames`. Creating a new line in that file, just enter a string that represents what you want the week to be called. Example --- --- -```haxe -var weekNames:Array = [ - - "How to Funk", - - "Daddy dearest", - - "Spooky Month", - - "PICO", - - "Mommy Must Murder", - - "Red Snow", - - "Hating Simulator ft. Moawlings", - - "Tankman" - -]; +``` +Tutorial +Daddy Dearest +Spooky Month +PICO +MOMMY MUST MURDER +RED SNOW +Hating Simulator ft. Moawling +TANKMAN ``` --- @@ -137,23 +132,29 @@ var weekNames:Array = [ ### Step 5. Graphics -Displaying a week icon for your custom week is as simple as dropping a .png into `assets/images/storymenu`. Rename the file to `week7.png`, `week8.png`, etc. +Displaying a week icon for your custom week is as simple as dropping a .png into `assets/preload/images/storymenu`. Rename the file to `week7.png`, `week8.png`, etc. Example --- --- + ![frrf](https://user-images.githubusercontent.com/68293280/118160164-cdab6d00-b3d2-11eb-9b29-a940eaf45025.png) ![frrf 2](https://user-images.githubusercontent.com/68293280/118160865-b8830e00-b3d3-11eb-8a23-818a1b4cfdb2.png) +![frrf 3](https://user-images.githubusercontent.com/68293280/118161461-7908f180-b3d4-11eb-89fa-e531ae5804d8.png) +======= +![weeks1](https://user-images.githubusercontent.com/55949451/122635123-69bb4900-d0e2-11eb-8bcc-1071cfda4e35.png) + NOTE: You will have to add a new item to `weekUnlocked`, so that the week is playable. Locate to line 39 and add in a new boolean called True so that the week can be playable. -![frrf 3](https://user-images.githubusercontent.com/68293280/118161461-7908f180-b3d4-11eb-89fa-e531ae5804d8.png) +--- +![weeks2](https://user-images.githubusercontent.com/55949451/122635129-763fa180-d0e2-11eb-841e-3456e74a50ba.png) \* *for this screenshot I removed tankman from weekCharacters as it would crash because I don't have a tankman character added* ### Conclusion If you followed all of the steps correctly, you have successfully created a new week in the Story Mode. diff --git a/source/Caching.hx b/source/Caching.hx index 2c6fb50..1bbdf50 100644 --- a/source/Caching.hx +++ b/source/Caching.hx @@ -1,5 +1,12 @@ package; +import lime.app.Application; +#if windows +import Discord.DiscordClient; +#end +import openfl.display.BitmapData; +import openfl.utils.Assets; +import flixel.ui.FlxBar; import haxe.Exception; import flixel.tweens.FlxEase; import flixel.tweens.FlxTween; @@ -25,15 +32,26 @@ class Caching extends MusicBeatState var toBeDone = 0; var done = 0; + var loaded = false; + var text:FlxText; var kadeLogo:FlxSprite; + public static var bitmapData:Map; + + var images = []; + var music = []; + var charts = []; + + override function create() { FlxG.mouse.visible = false; FlxG.worldBounds.set(0,0); + bitmapData = new Map(); + text = new FlxText(FlxG.width / 2, FlxG.height / 2 + 300,0,"Loading..."); text.size = 34; text.alignment = FlxTextAlign.CENTER; @@ -48,49 +66,35 @@ class Caching extends MusicBeatState kadeLogo.alpha = 0; - add(kadeLogo); - add(text); + PlayerSettings.init(); - trace('starting caching..'); - - sys.thread.Thread.create(() -> { - cache(); - }); + #if windows + DiscordClient.initialize(); + + Application.current.onExit.add (function (exitCode) { + DiscordClient.shutdown(); + }); + + #end + + + Highscore.load(); + + FlxG.save.bind('funkin', 'ninjamuffin99'); + + KadeEngineData.initSave(); - super.create(); - } - - var calledDone = false; - - override function update(elapsed) - { - - if (toBeDone != 0 && done != toBeDone) + if (FlxG.save.data.cacheImages) { - var alpha = HelperFunctions.truncateFloat(done / toBeDone * 100,2) / 100; - kadeLogo.alpha = alpha; - text.alpha = alpha; - text.text = "Loading... (" + done + "/" + toBeDone + ")"; - } + trace("caching images..."); - super.update(elapsed); - } - - - function cache() - { - - var images = []; - var music = []; - - trace("caching images..."); - - for (i in FileSystem.readDirectory(FileSystem.absolutePath("assets/shared/images/characters"))) - { - if (!i.endsWith(".png")) - continue; - images.push(i); + for (i in FileSystem.readDirectory(FileSystem.absolutePath("assets/shared/images/characters"))) + { + if (!i.endsWith(".png")) + continue; + images.push(i); + } } trace("caching music..."); @@ -99,16 +103,67 @@ class Caching extends MusicBeatState { music.push(i); } + toBeDone = Lambda.count(images) + Lambda.count(music); + var bar = new FlxBar(10,FlxG.height - 50,FlxBarFillDirection.LEFT_TO_RIGHT,FlxG.width,40,null,"done",0,toBeDone); + bar.color = FlxColor.PURPLE; + + add(bar); + + add(kadeLogo); + add(text); + + trace('starting caching..'); + + // update thread + + sys.thread.Thread.create(() -> { + while(!loaded) + { + if (toBeDone != 0 && done != toBeDone) + { + var alpha = HelperFunctions.truncateFloat(done / toBeDone * 100,2) / 100; + kadeLogo.alpha = alpha; + text.alpha = alpha; + text.text = "Loading... (" + done + "/" + toBeDone + ")"; + } + } + + }); + + // cache thread + + sys.thread.Thread.create(() -> { + cache(); + }); + + super.create(); + } + + var calledDone = false; + + override function update(elapsed) + { + super.update(elapsed); + } + + + function cache() + { + trace("LOADING: " + toBeDone + " OBJECTS."); for (i in images) { var replaced = i.replace(".png",""); - FlxG.bitmap.add(Paths.image("characters/" + replaced,"shared")); - trace("cached " + replaced); + var data:BitmapData = BitmapData.fromFile("assets/shared/images/characters/" + i); + trace('id ' + replaced + ' file - assets/shared/images/characters/' + i + ' ${data.width}'); + var graph = FlxGraphic.fromBitmapData(data); + graph.persist = true; + graph.destroyOnNoUse = false; + bitmapData.set(replaced,graph); done++; } @@ -120,8 +175,13 @@ class Caching extends MusicBeatState done++; } + trace("Finished caching..."); + loaded = true; + + trace(Assets.cache.hasBitmapData('GF_assets')); + FlxG.switchState(new TitleState()); } diff --git a/source/Character.hx b/source/Character.hx index f9df179..aa47684 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -32,7 +32,7 @@ class Character extends FlxSprite { case 'gf': // GIRLFRIEND CODE - tex = Paths.getSparrowAtlas('characters/GF_assets'); + tex = Paths.getSparrowAtlas('GF_assets','shared',true); frames = tex; animation.addByPrefix('cheer', 'GF Cheer', 24, false); animation.addByPrefix('singLEFT', 'GF left note', 24, false); @@ -46,24 +46,12 @@ class Character extends FlxSprite animation.addByIndices('hairFall', "GF Dancing Beat Hair Landing", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "", 24, false); animation.addByPrefix('scared', 'GF FEAR', 24); - addOffset('cheer'); - addOffset('sad', -2, -2); - addOffset('danceLeft', 0, -9); - addOffset('danceRight', 0, -9); - - addOffset("singUP", 0, 4); - addOffset("singRIGHT", 0, -20); - addOffset("singLEFT", 0, -19); - addOffset("singDOWN", 0, -20); - addOffset('hairBlow', 45, -8); - addOffset('hairFall', 0, -9); - - addOffset('scared', -2, -17); + loadOffsetFile(curCharacter); playAnim('danceRight'); case 'gf-christmas': - tex = Paths.getSparrowAtlas('characters/gfChristmas'); + tex = Paths.getSparrowAtlas('gfChristmas','shared',true); frames = tex; animation.addByPrefix('cheer', 'GF Cheer', 24, false); animation.addByPrefix('singLEFT', 'GF left note', 24, false); @@ -77,44 +65,30 @@ class Character extends FlxSprite animation.addByIndices('hairFall', "GF Dancing Beat Hair Landing", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "", 24, false); animation.addByPrefix('scared', 'GF FEAR', 24); - addOffset('cheer'); - addOffset('sad', -2, -2); - addOffset('danceLeft', 0, -9); - addOffset('danceRight', 0, -9); - - addOffset("singUP", 0, 4); - addOffset("singRIGHT", 0, -20); - addOffset("singLEFT", 0, -19); - addOffset("singDOWN", 0, -20); - addOffset('hairBlow', 45, -8); - addOffset('hairFall', 0, -9); - - addOffset('scared', -2, -17); + loadOffsetFile(curCharacter); playAnim('danceRight'); case 'gf-car': - tex = Paths.getSparrowAtlas('characters/gfCar'); + tex = Paths.getSparrowAtlas('gfCar','shared',true); frames = tex; animation.addByIndices('singUP', 'GF Dancing Beat Hair blowing CAR', [0], "", 24, false); animation.addByIndices('danceLeft', 'GF Dancing Beat Hair blowing CAR', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); animation.addByIndices('danceRight', 'GF Dancing Beat Hair blowing CAR', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); - addOffset('danceLeft', 0); - addOffset('danceRight', 0); + loadOffsetFile(curCharacter); playAnim('danceRight'); case 'gf-pixel': - tex = Paths.getSparrowAtlas('characters/gfPixel'); + tex = Paths.getSparrowAtlas('gfPixel','shared',true); frames = tex; animation.addByIndices('singUP', 'GF IDLE', [2], "", 24, false); animation.addByIndices('danceLeft', 'GF IDLE', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); animation.addByIndices('danceRight', 'GF IDLE', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); - addOffset('danceLeft', 0); - addOffset('danceRight', 0); + loadOffsetFile(curCharacter); playAnim('danceRight'); @@ -124,7 +98,7 @@ class Character extends FlxSprite case 'dad': // DAD ANIMATION LOADING CODE - tex = Paths.getSparrowAtlas('characters/DADDY_DEAREST', 'shared'); + tex = Paths.getSparrowAtlas('DADDY_DEAREST','shared',true); frames = tex; animation.addByPrefix('idle', 'Dad idle dance', 24); animation.addByPrefix('singUP', 'Dad Sing Note UP', 24); @@ -132,15 +106,11 @@ class Character extends FlxSprite animation.addByPrefix('singDOWN', 'Dad Sing Note DOWN', 24); animation.addByPrefix('singLEFT', 'Dad Sing Note LEFT', 24); - addOffset('idle'); - addOffset("singUP", -6, 50); - addOffset("singRIGHT", 0, 27); - addOffset("singLEFT", -10, 10); - addOffset("singDOWN", 0, -30); + loadOffsetFile(curCharacter); playAnim('idle'); case 'spooky': - tex = Paths.getSparrowAtlas('characters/spooky_kids_assets'); + tex = Paths.getSparrowAtlas('spooky_kids_assets','shared',true); frames = tex; animation.addByPrefix('singUP', 'spooky UP NOTE', 24, false); animation.addByPrefix('singDOWN', 'spooky DOWN note', 24, false); @@ -149,17 +119,11 @@ class Character extends FlxSprite animation.addByIndices('danceLeft', 'spooky dance idle', [0, 2, 6], "", 12, false); animation.addByIndices('danceRight', 'spooky dance idle', [8, 10, 12, 14], "", 12, false); - addOffset('danceLeft'); - addOffset('danceRight'); - - addOffset("singUP", -20, 26); - addOffset("singRIGHT", -130, -14); - addOffset("singLEFT", 130, -10); - addOffset("singDOWN", -50, -130); + loadOffsetFile(curCharacter); playAnim('danceRight'); case 'mom': - tex = Paths.getSparrowAtlas('characters/Mom_Assets'); + tex = Paths.getSparrowAtlas('Mom_Assets','shared',true); frames = tex; animation.addByPrefix('idle', "Mom Idle", 24, false); @@ -170,16 +134,12 @@ class Character extends FlxSprite // CUZ DAVE IS DUMB! animation.addByPrefix('singRIGHT', 'Mom Pose Left', 24, false); - addOffset('idle'); - addOffset("singUP", 14, 71); - addOffset("singRIGHT", 10, -60); - addOffset("singLEFT", 250, -23); - addOffset("singDOWN", 20, -160); + loadOffsetFile(curCharacter); playAnim('idle'); case 'mom-car': - tex = Paths.getSparrowAtlas('characters/momCar'); + tex = Paths.getSparrowAtlas('momCar','shared',true); frames = tex; animation.addByPrefix('idle', "Mom Idle", 24, false); @@ -190,15 +150,11 @@ class Character extends FlxSprite // CUZ DAVE IS DUMB! animation.addByPrefix('singRIGHT', 'Mom Pose Left', 24, false); - addOffset('idle'); - addOffset("singUP", 14, 71); - addOffset("singRIGHT", 10, -60); - addOffset("singLEFT", 250, -23); - addOffset("singDOWN", 20, -160); + loadOffsetFile(curCharacter); playAnim('idle'); case 'monster': - tex = Paths.getSparrowAtlas('characters/Monster_Assets'); + tex = Paths.getSparrowAtlas('Monster_Assets','shared',true); frames = tex; animation.addByPrefix('idle', 'monster idle', 24, false); animation.addByPrefix('singUP', 'monster up note', 24, false); @@ -206,14 +162,10 @@ class Character extends FlxSprite animation.addByPrefix('singLEFT', 'Monster left note', 24, false); animation.addByPrefix('singRIGHT', 'Monster Right note', 24, false); - addOffset('idle'); - addOffset("singUP", -20, 50); - addOffset("singRIGHT", -51); - addOffset("singLEFT", -30); - addOffset("singDOWN", -30, -40); + loadOffsetFile(curCharacter); playAnim('idle'); case 'monster-christmas': - tex = Paths.getSparrowAtlas('characters/monsterChristmas'); + tex = Paths.getSparrowAtlas('monsterChristmas','shared',true); frames = tex; animation.addByPrefix('idle', 'monster idle', 24, false); animation.addByPrefix('singUP', 'monster up note', 24, false); @@ -221,14 +173,10 @@ class Character extends FlxSprite animation.addByPrefix('singLEFT', 'Monster left note', 24, false); animation.addByPrefix('singRIGHT', 'Monster Right note', 24, false); - addOffset('idle'); - addOffset("singUP", -20, 50); - addOffset("singRIGHT", -51); - addOffset("singLEFT", -30); - addOffset("singDOWN", -40, -94); + loadOffsetFile(curCharacter); playAnim('idle'); case 'pico': - tex = Paths.getSparrowAtlas('characters/Pico_FNF_assetss'); + tex = Paths.getSparrowAtlas('Pico_FNF_assetss','shared',true); frames = tex; animation.addByPrefix('idle', "Pico Idle Dance", 24); animation.addByPrefix('singUP', 'pico Up note0', 24, false); @@ -252,22 +200,14 @@ class Character extends FlxSprite animation.addByPrefix('singUPmiss', 'pico Up note miss', 24); animation.addByPrefix('singDOWNmiss', 'Pico Down Note MISS', 24); - addOffset('idle'); - addOffset("singUP", -29, 27); - addOffset("singRIGHT", -68, -7); - addOffset("singLEFT", 65, 9); - addOffset("singDOWN", 200, -70); - addOffset("singUPmiss", -19, 67); - addOffset("singRIGHTmiss", -60, 41); - addOffset("singLEFTmiss", 62, 64); - addOffset("singDOWNmiss", 210, -28); + loadOffsetFile(curCharacter); playAnim('idle'); flipX = true; case 'bf': - var tex = Paths.getSparrowAtlas('characters/BOYFRIEND', 'shared'); + var tex = Paths.getSparrowAtlas('BOYFRIEND','shared',true); frames = tex; trace(tex.frames.length); @@ -289,27 +229,14 @@ class Character extends FlxSprite animation.addByPrefix('scared', 'BF idle shaking', 24); - addOffset('idle', -5); - addOffset("singUP", -29, 27); - addOffset("singRIGHT", -38, -7); - addOffset("singLEFT", 12, -6); - addOffset("singDOWN", -10, -50); - addOffset("singUPmiss", -29, 27); - addOffset("singRIGHTmiss", -30, 21); - addOffset("singLEFTmiss", 12, 24); - addOffset("singDOWNmiss", -11, -19); - addOffset("hey", 7, 4); - addOffset('firstDeath', 37, 11); - addOffset('deathLoop', 37, 5); - addOffset('deathConfirm', 37, 69); - addOffset('scared', -4); + loadOffsetFile(curCharacter); playAnim('idle'); flipX = true; case 'bf-christmas': - var tex = Paths.getSparrowAtlas('characters/bfChristmas'); + var tex = Paths.getSparrowAtlas('bfChristmas','shared',true); frames = tex; animation.addByPrefix('idle', 'BF idle dance', 24, false); animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false); @@ -322,22 +249,13 @@ class Character extends FlxSprite animation.addByPrefix('singDOWNmiss', 'BF NOTE DOWN MISS', 24, false); animation.addByPrefix('hey', 'BF HEY', 24, false); - addOffset('idle', -5); - addOffset("singUP", -29, 27); - addOffset("singRIGHT", -38, -7); - addOffset("singLEFT", 12, -6); - addOffset("singDOWN", -10, -50); - addOffset("singUPmiss", -29, 27); - addOffset("singRIGHTmiss", -30, 21); - addOffset("singLEFTmiss", 12, 24); - addOffset("singDOWNmiss", -11, -19); - addOffset("hey", 7, 4); + loadOffsetFile(curCharacter); playAnim('idle'); flipX = true; case 'bf-car': - var tex = Paths.getSparrowAtlas('characters/bfCar'); + var tex = Paths.getSparrowAtlas('bfCar','shared',true); frames = tex; animation.addByPrefix('idle', 'BF idle dance', 24, false); animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false); @@ -349,20 +267,12 @@ class Character extends FlxSprite animation.addByPrefix('singRIGHTmiss', 'BF NOTE RIGHT MISS', 24, false); animation.addByPrefix('singDOWNmiss', 'BF NOTE DOWN MISS', 24, false); - addOffset('idle', -5); - addOffset("singUP", -29, 27); - addOffset("singRIGHT", -38, -7); - addOffset("singLEFT", 12, -6); - addOffset("singDOWN", -10, -50); - addOffset("singUPmiss", -29, 27); - addOffset("singRIGHTmiss", -30, 21); - addOffset("singLEFTmiss", 12, 24); - addOffset("singDOWNmiss", -11, -19); + loadOffsetFile(curCharacter); playAnim('idle'); flipX = true; case 'bf-pixel': - frames = Paths.getSparrowAtlas('characters/bfPixel'); + frames = Paths.getSparrowAtlas('bfPixel','shared',true); animation.addByPrefix('idle', 'BF IDLE', 24, false); animation.addByPrefix('singUP', 'BF UP NOTE', 24, false); animation.addByPrefix('singLEFT', 'BF LEFT NOTE', 24, false); @@ -373,15 +283,7 @@ class Character extends FlxSprite animation.addByPrefix('singRIGHTmiss', 'BF RIGHT MISS', 24, false); animation.addByPrefix('singDOWNmiss', 'BF DOWN MISS', 24, false); - addOffset('idle'); - addOffset("singUP"); - addOffset("singRIGHT"); - addOffset("singLEFT"); - addOffset("singDOWN"); - addOffset("singUPmiss"); - addOffset("singRIGHTmiss"); - addOffset("singLEFTmiss"); - addOffset("singDOWNmiss"); + loadOffsetFile(curCharacter); setGraphicSize(Std.int(width * 6)); updateHitbox(); @@ -395,16 +297,14 @@ class Character extends FlxSprite flipX = true; case 'bf-pixel-dead': - frames = Paths.getSparrowAtlas('characters/bfPixelsDEAD'); + frames = Paths.getSparrowAtlas('bfPixelsDEAD','shared',true); animation.addByPrefix('singUP', "BF Dies pixel", 24, false); animation.addByPrefix('firstDeath', "BF Dies pixel", 24, false); animation.addByPrefix('deathLoop', "Retry Loop", 24, true); animation.addByPrefix('deathConfirm', "RETRY CONFIRM", 24, false); animation.play('firstDeath'); - addOffset('firstDeath'); - addOffset('deathLoop', -37); - addOffset('deathConfirm', -37); + loadOffsetFile(curCharacter); playAnim('firstDeath'); // pixel bullshit setGraphicSize(Std.int(width * 6)); @@ -413,18 +313,14 @@ class Character extends FlxSprite flipX = true; case 'senpai': - frames = Paths.getSparrowAtlas('characters/senpai'); + frames = Paths.getSparrowAtlas('senpai','shared',true); animation.addByPrefix('idle', 'Senpai Idle', 24, false); animation.addByPrefix('singUP', 'SENPAI UP NOTE', 24, false); animation.addByPrefix('singLEFT', 'SENPAI LEFT NOTE', 24, false); animation.addByPrefix('singRIGHT', 'SENPAI RIGHT NOTE', 24, false); animation.addByPrefix('singDOWN', 'SENPAI DOWN NOTE', 24, false); - addOffset('idle'); - addOffset("singUP", 5, 37); - addOffset("singRIGHT"); - addOffset("singLEFT", 40); - addOffset("singDOWN", 14); + loadOffsetFile(curCharacter); playAnim('idle'); @@ -433,18 +329,14 @@ class Character extends FlxSprite antialiasing = false; case 'senpai-angry': - frames = Paths.getSparrowAtlas('characters/senpai'); + frames = Paths.getSparrowAtlas('senpai','shared',true); animation.addByPrefix('idle', 'Angry Senpai Idle', 24, false); animation.addByPrefix('singUP', 'Angry Senpai UP NOTE', 24, false); animation.addByPrefix('singLEFT', 'Angry Senpai LEFT NOTE', 24, false); animation.addByPrefix('singRIGHT', 'Angry Senpai RIGHT NOTE', 24, false); animation.addByPrefix('singDOWN', 'Angry Senpai DOWN NOTE', 24, false); - addOffset('idle'); - addOffset("singUP", 5, 37); - addOffset("singRIGHT"); - addOffset("singLEFT", 40); - addOffset("singDOWN", 14); + loadOffsetFile(curCharacter); playAnim('idle'); setGraphicSize(Std.int(width * 6)); @@ -453,18 +345,14 @@ class Character extends FlxSprite antialiasing = false; case 'spirit': - frames = Paths.getPackerAtlas('characters/spirit'); + frames = Paths.getPackerAtlas('spirit','shared',true); animation.addByPrefix('idle', "idle spirit_", 24, false); animation.addByPrefix('singUP', "up_", 24, false); animation.addByPrefix('singRIGHT', "right_", 24, false); animation.addByPrefix('singLEFT', "left_", 24, false); animation.addByPrefix('singDOWN', "spirit down_", 24, false); - addOffset('idle', -220, -280); - addOffset('singUP', -220, -240); - addOffset("singRIGHT", -220, -280); - addOffset("singLEFT", -200, -280); - addOffset("singDOWN", 170, 110); + loadOffsetFile(curCharacter); setGraphicSize(Std.int(width * 6)); updateHitbox(); @@ -474,7 +362,7 @@ class Character extends FlxSprite antialiasing = false; case 'parents-christmas': - frames = Paths.getSparrowAtlas('characters/mom_dad_christmas_assets'); + frames = Paths.getSparrowAtlas('mom_dad_christmas_assets','shared',true); animation.addByPrefix('idle', 'Parent Christmas Idle', 24, false); animation.addByPrefix('singUP', 'Parent Up Note Dad', 24, false); animation.addByPrefix('singDOWN', 'Parent Down Note Dad', 24, false); @@ -487,15 +375,7 @@ class Character extends FlxSprite animation.addByPrefix('singLEFT-alt', 'Parent Left Note Mom', 24, false); animation.addByPrefix('singRIGHT-alt', 'Parent Right Note Mom', 24, false); - addOffset('idle'); - addOffset("singUP", -47, 24); - addOffset("singRIGHT", -1, -23); - addOffset("singLEFT", -30, 16); - addOffset("singDOWN", -31, -29); - addOffset("singUP-alt", -47, 24); - addOffset("singRIGHT-alt", -1, -24); - addOffset("singLEFT-alt", -30, 15); - addOffset("singDOWN-alt", -30, -27); + loadOffsetFile(curCharacter); playAnim('idle'); } @@ -525,6 +405,17 @@ class Character extends FlxSprite } } + public function loadOffsetFile(character:String) + { + var offset:Array = CoolUtil.coolTextFile(Paths.txt('images/characters/' + character + "Offsets")); + + for (i in 0...offset.length) + { + var data:Array = offset[i].split(' '); + addOffset(data[0], Std.parseInt(data[1]), Std.parseInt(data[2])); + } + } + override function update(elapsed:Float) { if (!curCharacter.startsWith('bf')) diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 4371fad..5de9335 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -75,7 +75,7 @@ class ChartingState extends MusicBeatState var gridBG:FlxSprite; - var _song:SwagSong; + public static var _song:SwagSong; var typingShit:FlxInputText; /* @@ -129,7 +129,7 @@ class ChartingState extends MusicBeatState blackBorder.alpha = 0.3; - snapText = new FlxText(60,10,0,"Snap: 1/" + snap + " (Press Control to unsnap the cursor)\nAdd Notes: 1-8 (or click)\n", 14); + snapText = new FlxText(60,10,0,"Snap: 1/" + snap + " (Press SHIFT to unsnap the cursor)\nAdd Notes: 1-8 (or click)\nDiff: 0", 14); snapText.scrollFactor.set(); gridBlackLine = new FlxSprite(gridBG.x + gridBG.width / 2).makeGraphic(2, Std.int(gridBG.height), FlxColor.BLACK); @@ -309,10 +309,10 @@ class ChartingState extends MusicBeatState shiftNotes(Std.int(stepperShiftNoteDial.value),Std.int(stepperShiftNoteDialstep.value),Std.int(stepperShiftNoteDialms.value)); }); - var characters:Array = CoolUtil.coolTextFile(Paths.txt('characterList')); - var gfVersions:Array = CoolUtil.coolTextFile(Paths.txt('gfVersionList')); - var stages:Array = CoolUtil.coolTextFile(Paths.txt('stageList')); - var noteStyles:Array = CoolUtil.coolTextFile(Paths.txt('noteStyleList')); + var characters:Array = CoolUtil.coolTextFile(Paths.txt('data/characterList')); + var gfVersions:Array = CoolUtil.coolTextFile(Paths.txt('data/gfVersionList')); + var stages:Array = CoolUtil.coolTextFile(Paths.txt('data/stageList')); + var noteStyles:Array = CoolUtil.coolTextFile(Paths.txt('data/noteStyleList')); var player1DropDown = new FlxUIDropDownMenu(10, 100, FlxUIDropDownMenu.makeStrIdLabelArray(characters, true), function(character:String) { @@ -660,13 +660,15 @@ class ChartingState extends MusicBeatState } var writingNotes:Bool = false; - var doSnapShit:Bool = true; + var doSnapShit:Bool = false; + + public var diff:Float = 0; override function update(elapsed:Float) { updateHeads(); - snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Control to disable" : "Snap Disabled, Control to renable") + ")\nAdd Notes: 1-8 (or click)\n"; + snapText.text = "Snap: 1/" + snap + " (" + (doSnapShit ? "Shift to disable" : "Snap Disabled, Shift to renable. It's a bit buggy") + ")\nAdd Notes: 1-8 (or click)"; curStep = recalculateSteps(); @@ -679,7 +681,7 @@ class ChartingState extends MusicBeatState if (snap <= 1) snap = 1;*/ - if (FlxG.keys.justPressed.CONTROL) + if (FlxG.keys.justPressed.SHIFT) doSnapShit = !doSnapShit; Conductor.songPosition = FlxG.sound.music.time; @@ -959,17 +961,30 @@ class ChartingState extends MusicBeatState vocals.pause(); claps.splice(0, claps.length); - var stepMs = curStep * Conductor.stepCrochet; + var amount = FlxG.mouse.wheel; - - trace(Conductor.stepCrochet / snap); + if(amount > 0 && strumLine.y < gridBG.y) + amount = 0; if (doSnapShit) - FlxG.sound.music.time = stepMs - (FlxG.mouse.wheel * Conductor.stepCrochet / snap); - else - FlxG.sound.music.time -= (FlxG.mouse.wheel * Conductor.stepCrochet * 0.4); - trace(stepMs + " + " + Conductor.stepCrochet / snap + " -> " + FlxG.sound.music.time); + { + var increase:Int = 0; + if (amount < 0) + increase = 1; + else + increase = -1; + + trace(increase + " - " + curStep + " - " + (curStep + increase)); + + curStep += increase; + + var stepMs = curStep * Conductor.stepCrochet; + + FlxG.sound.music.time = stepMs; + } + else + FlxG.sound.music.time -= (amount * Conductor.stepCrochet * 0.4); vocals.time = FlxG.sound.music.time; } @@ -1185,7 +1200,7 @@ class ChartingState extends MusicBeatState function updateGrid():Void { remove(gridBG); - gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * _song.notes[curSection].lengthInSteps); + gridBG = FlxGridOverlay.create(GRID_SIZE, GRID_SIZE, GRID_SIZE * 8, GRID_SIZE * 16); add(gridBG); remove(gridBlackLine); @@ -1240,6 +1255,7 @@ class ChartingState extends MusicBeatState var daSus = i[2]; var note:Note = new Note(daStrumTime, daNoteInfo % 4,null,false,true); + note.rawNoteData = daNoteInfo; note.sustainLength = daSus; note.setGraphicSize(GRID_SIZE, GRID_SIZE); note.updateHitbox(); @@ -1259,6 +1275,7 @@ class ChartingState extends MusicBeatState curRenderedSustains.add(sustainVis); } } + } private function addSection(lengthInSteps:Int = 16):Void @@ -1282,7 +1299,7 @@ class ChartingState extends MusicBeatState for (i in _song.notes[curSection].sectionNotes) { - if (i.strumTime == note.strumTime && i.noteData % 4 == note.noteData) + if (i[0] == note.strumTime && i[1] == note.rawNoteData) { curSelectedNote = _song.notes[curSection].sectionNotes[swagNum]; } @@ -1300,7 +1317,7 @@ class ChartingState extends MusicBeatState lastNote = note; for (i in _song.notes[curSection].sectionNotes) { - if (i[0] == note.strumTime && i[1] % 4 == note.noteData) + if (i[0] == note.strumTime && i[1] == note.rawNoteData) { _song.notes[curSection].sectionNotes.remove(i); } @@ -1487,7 +1504,7 @@ class ChartingState extends MusicBeatState "song": _song }; - var data:String = Json.stringify(json); + var data:String = Json.stringify(json,null," "); if ((data != null) && (data.length > 0)) { diff --git a/source/Conductor.hx b/source/Conductor.hx index 03847d1..4560078 100644 --- a/source/Conductor.hx +++ b/source/Conductor.hx @@ -28,6 +28,8 @@ class Conductor public static var safeZoneOffset:Float = Math.floor((safeFrames / 60) * 1000); // is calculated in create(), is safeFrames in milliseconds public static var timeScale:Float = Conductor.safeZoneOffset / 166; + public static var lengthInSteps:Float = 0; + public static var bpmChangeMap:Array = []; public function new() @@ -74,5 +76,9 @@ class Conductor crochet = ((60 / bpm) * 1000); stepCrochet = crochet / 4; + + lengthInSteps = (FlxG.sound.music.length / stepCrochet); + + trace("\nLength in in steps: " + lengthInSteps); } } \ No newline at end of file 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 new file mode 100644 index 0000000..8d075e0 --- /dev/null +++ b/source/DiffCalc.hx @@ -0,0 +1,366 @@ +import openfl.system.System; +import flixel.math.FlxMath; +import Song.SwagSong; + +class SmallNote // basically Note.hx but small as fuck +{ + public var strumTime:Float; + public var noteData:Int; + + public function new(strum,data) + { + strumTime = strum; + noteData = data; + } +} + +class DiffCalc +{ + public static var scale = 3 * 1.8; + + public static function CalculateDiff(song:SwagSong, ?accuracy:Float = .93) + { + trace('calcuilafjwaf'); + // cleaned notes + var cleanedNotes:Array = []; + + if (song.notes == null) + return 0.0; + + if (song.notes.length == 0) + return 0.0; + + // find all of the notes + for(i in song.notes) // sections + { + for (ii in i.sectionNotes) // notes + { + var gottaHitNote:Bool = i.mustHitSection; + + if (ii[1] > 3) + gottaHitNote = !i.mustHitSection; + + if (gottaHitNote) + 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: + handOne.push(i); + case 2: + handTwo.push(i); + case 3: + handTwo.push(i); + } + } + + // collect all of the notes in each col + + var leftHandCol:Array = []; // d 0 + var leftMHandCol:Array = []; // f 1 + var rightMHandCol:Array = []; // j 2 + var rightHandCol:Array = []; // k 3 + + for(i in 0...handOne.length - 1) + { + if (handOne[i].noteData == 0) + leftHandCol.push(handOne[i].strumTime); + else + leftMHandCol.push(handOne[i].strumTime); + } + for(i in 0...handTwo.length - 1) + { + if (handTwo[i].noteData == 3) + rightHandCol.push(handTwo[i].strumTime); + else + rightMHandCol.push(handTwo[i].strumTime); + } + + + // 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 segmentsOne = new haxe.ds.Vector(Math.floor(length)); + + var segmentsTwo = new haxe.ds.Vector(Math.floor(length)); + + // set em all to array's (so no null's) + + for(i in 0...segmentsOne.length) + segmentsOne[i] = new Array(); + for(i in 0...segmentsTwo.length) + segmentsTwo[i] = new Array(); + + // algo loop + for(i in handOne) + { + var index = Std.int((((i.strumTime * 2) / 1000))); + if (index + 1 > length) + continue; + segmentsOne[index].push(i); + } + + for(i in handTwo) + { + var index = Std.int((((i.strumTime * 2) / 1000))); + if (index + 1 > length) + continue; + segmentsTwo[index].push(i); + } + + // Remove 0 intervals + /*for(i in 0...segmentsOne.length) + { + if (segmentsOne[i].length == 0) + segmentsOne[i] = null; + } + + for(i in 0...segmentsTwo.length) + { + if (segmentsTwo[i].length == 0) + segmentsTwo[i] = null; + }*/ + + // get nps for both hands + + var hand_npsOne:Array = new Array(); + var hand_npsTwo:Array = new Array(); + + for(i in segmentsOne) + { + if (i == null) + continue; + hand_npsOne.push(i.length * scale * 1.6); + } + for(i in segmentsTwo) + { + if (i == null) + continue; + hand_npsTwo.push(i.length * scale * 1.6); + } + + // get the diff vector's for all of the hands + + var hand_diffOne:Array = new Array(); + var hand_diffTwo:Array = new Array(); + + for(i in 0...segmentsOne.length) + { + var ve = segmentsOne[i]; + if (ve == null) + continue; + var fuckYouOne:Array = []; + var fuckYouTwo:Array = []; + for(note in ve) + { + switch(note.noteData) + { + case 0: // fingie 1 + fuckYouOne.push(note); + case 1: // fingie 2 + fuckYouTwo.push(note); + } + } + + var one = fingieCalc(fuckYouOne,leftHandCol); + var two = fingieCalc(fuckYouTwo,leftMHandCol); + + + var bigFuck = ((((one > two ? one : two) * 8) + (hand_npsOne[i] / scale) * 5) / 13) * scale; + + //trace(bigFuck + " - hand one [" + i + "]"); + + + hand_diffOne.push(bigFuck); + } + + for(i in 0...segmentsTwo.length) + { + var ve = segmentsTwo[i]; + if (ve == null) + continue; + var fuckYouOne:Array = []; + var fuckYouTwo:Array = []; + for(note in ve) + { + switch(note.noteData) + { + case 2: // fingie 1 + fuckYouOne.push(note); + case 3: // fingie 2 + fuckYouTwo.push(note); + } + } + + var one = fingieCalc(fuckYouOne,rightMHandCol); + var two = fingieCalc(fuckYouTwo,rightHandCol); + + var bigFuck = ((((one > two ? one : two) * 8) + (hand_npsTwo[i] / scale) * 5) / 13) * scale; + + hand_diffTwo.push(bigFuck); + + // trace(bigFuck + " - hand two [" + i + "]"); + } + + for (i in 0...4) + { + smoothBrain(hand_npsOne,0); + smoothBrain(hand_npsTwo,0); + + smoothBrainTwo(hand_diffOne); + smoothBrainTwo(hand_diffTwo); + } + + //trace(hand_diffOne); + //trace(hand_diffTwo); + + //trace(hand_npsOne); + //trace(hand_npsTwo); + + var point_npsOne:Array = new Array(); + var point_npsTwo:Array = new Array(); + + for(i in segmentsOne) + { + if (i == null) + continue; + point_npsOne.push(i.length); + } + for(i in segmentsTwo) + { + if (i == null) + continue; + point_npsTwo.push(i.length); + } + + var maxPoints:Float = 0; + + for(i in point_npsOne) + maxPoints += i; + for(i in point_npsTwo) + maxPoints += i; + + if (accuracy > .965) + accuracy = .965; + + return HelperFunctions.truncateFloat(chisel(accuracy,hand_diffOne,hand_diffTwo,point_npsOne,point_npsTwo,maxPoints),2); + } + + public static function chisel(scoreGoal:Float,diffOne:Array,diffTwo:Array,pointsOne:Array,pointsTwo:Array,maxPoints:Float) + { + var lowerBound:Float = 0; + var upperBound:Float = 100; + + while(upperBound - lowerBound > 0.01) + { + var average:Float = (upperBound + lowerBound) / 2; + var amtOfPoints:Float = calcuate(average,diffOne,pointsOne) + calcuate(average,diffTwo,pointsTwo); + if (amtOfPoints / maxPoints < scoreGoal) + lowerBound = average; + else + upperBound = average; + + } + return upperBound; + } + + public static function calcuate(midPoint:Float,diff:Array,points:Array) + { + var output:Float = 0; + + for (i in 0...diff.length) + { + var res = diff[i]; + if (midPoint > res) + output += points[i]; + else + output += points[i] * Math.pow(midPoint / res,1.2); + } + return output; + } + + public static function findStupid(strumTime:Float, array:Array) + { + for(i in 0...array.length) + if (array[i] == strumTime) + return i; + return -1; + } + + public static function fingieCalc(floats:Array, columArray:Array):Float + { + var sum:Float = 0; + if (floats.length == 0) + return 0; + var startIndex = findStupid(floats[0].strumTime,columArray); + if (startIndex == -1) + return 0; + for(i in floats) + { + sum += columArray[startIndex + 1] - columArray[startIndex]; + startIndex++; + } + + if (sum == 0) + return 0; + + return (1375 * (floats.length)) / sum; + } + + // based arrayer + // basicily smmoth the shit + public static function smoothBrain(npsVector:Array, weirdchamp:Float) + { + var floatOne = weirdchamp; + var floatTwo = weirdchamp; + + for (i in 0...npsVector.length) + { + var result = npsVector[i]; + + var chunker = floatOne; + floatOne = floatTwo; + floatTwo = result; + + npsVector[i] = (chunker + floatOne + floatTwo) / 3; + } + } + + // Smooth the shit but less + public static function smoothBrainTwo(diffVector:Array) + { + var floatZero:Float = 0; + + for(i in 0...diffVector.length) + { + var result = diffVector[i]; + + var fuck = floatZero; + floatZero = result; + diffVector[i] = (fuck + floatZero) / 2; + } + } +} \ No newline at end of file diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 243d970..36ac10b 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -1,5 +1,6 @@ package; +import Song.SwagSong; import flixel.input.gamepad.FlxGamepad; import flash.text.TextField; import flixel.FlxG; @@ -29,6 +30,7 @@ class FreeplayState extends MusicBeatState var scoreText:FlxText; var comboText:FlxText; var diffText:FlxText; + var diffCalcText:FlxText; var lerpScore:Int = 0; var intendedScore:Int = 0; var combo:String = ''; @@ -38,16 +40,48 @@ class FreeplayState extends MusicBeatState private var iconArray:Array = []; + public static var songData:Map> = []; + + public static function loadDiff(diff:Int, format:String, name:String, array:Array) + { + try + { + array.push(Song.loadFromJson(Highscore.formatSong(format, diff), name)); + } + catch(ex) + { + // do nada + } + } + override function create() { - var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); + var initSonglist = CoolUtil.coolTextFile(Paths.txt('data/freeplaySonglist')); + + //var diffList = ""; for (i in 0...initSonglist.length) { var data:Array = initSonglist[i].split(':'); - songs.push(new SongMetadata(data[0], Std.parseInt(data[2]), data[1])); + 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'; + } + + 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); + /* if (FlxG.sound.music != null) { @@ -101,7 +135,7 @@ class FreeplayState extends MusicBeatState scoreText.setFormat(Paths.font("vcr.ttf"), 32, FlxColor.WHITE, RIGHT); // scoreText.alignment = RIGHT; - var scoreBG:FlxSprite = new FlxSprite(scoreText.x - 6, 0).makeGraphic(Std.int(FlxG.width * 0.35), 66, 0xFF000000); + var scoreBG:FlxSprite = new FlxSprite(scoreText.x - 6, 0).makeGraphic(Std.int(FlxG.width * 0.35), 105, 0xFF000000); scoreBG.alpha = 0.6; add(scoreBG); @@ -109,6 +143,10 @@ class FreeplayState extends MusicBeatState diffText.font = scoreText.font; add(diffText); + diffCalcText = new FlxText(scoreText.x, scoreText.y + 66, 0, "", 24); + diffCalcText.font = scoreText.font; + add(diffCalcText); + comboText = new FlxText(diffText.x + 100, diffText.y, 0, "", 24); comboText.font = diffText.font; add(comboText); @@ -238,14 +276,20 @@ class FreeplayState extends MusicBeatState case 'Dad-Battle': songFormat = 'Dadbattle'; case 'Philly-Nice': songFormat = 'Philly'; } - - trace(songs[curSelected].songName); + var hmm; + try + { + hmm = songData.get(songs[curSelected].songName)[curDifficulty]; + if (hmm == null) + return; + } + catch(ex) + { + return; + } - var poop:String = Highscore.formatSong(songFormat, curDifficulty); - trace(poop); - - PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName); + PlayState.SONG = hmm; PlayState.isStoryMode = false; PlayState.storyDifficulty = curDifficulty; PlayState.storyWeek = songs[curSelected].week; @@ -274,7 +318,7 @@ class FreeplayState extends MusicBeatState intendedScore = Highscore.getScore(songHighscore, curDifficulty); combo = Highscore.getCombo(songHighscore, curDifficulty); #end - + diffCalcText.text = 'RATING: ${DiffCalc.CalculateDiff(songData.get(songs[curSelected].songName)[curDifficulty])}'; diffText.text = CoolUtil.difficultyFromInt(curDifficulty).toUpperCase(); } @@ -310,10 +354,22 @@ class FreeplayState extends MusicBeatState // lerpScore = 0; #end + diffCalcText.text = 'RATING: ${DiffCalc.CalculateDiff(songData.get(songs[curSelected].songName)[curDifficulty])}'; + #if PRELOAD_ALL FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0); #end + var hmm; + try + { + hmm = songData.get(songs[curSelected].songName)[curDifficulty]; + if (hmm != null) + Conductor.changeBPM(hmm.bpm); + } + catch(ex) + {} + var bullShit:Int = 0; for (i in 0...iconArray.length) diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index 0a26829..6d0514d 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) @@ -94,6 +97,9 @@ class KadeEngineData if (FlxG.save.data.optimize == null) FlxG.save.data.optimize = false; + if (FlxG.save.data.cacheImages == null) + FlxG.save.data.cacheImages = false; + var gamepad:FlxGamepad = FlxG.gamepads.lastActive; KeyBinds.gamepad = gamepad != null; diff --git a/source/KeyBindMenu.hx b/source/KeyBindMenu.hx index d5a3d41..ff826bb 100644 --- a/source/KeyBindMenu.hx +++ b/source/KeyBindMenu.hx @@ -320,7 +320,7 @@ class KeyBindMenu extends FlxSubState var shouldReturn:Bool = true; - var notAllowed:Array = ["START", "RIGHT_TRIGGER", "LEFT_TRIGGER"]; + var notAllowed:Array = ["START"]; for(x in 0...gpKeys.length) { 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..ae26fb3 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -19,6 +19,7 @@ class Note extends FlxSprite public var mustPress:Bool = false; public var noteData:Int = 0; + public var rawNoteData:Int = 0; public var canBeHit:Bool = false; public var tooLate:Bool = false; public var wasGoodHit:Bool = false; @@ -37,6 +38,8 @@ class Note extends FlxSprite public var rating:String = "shit"; + public var dataColor:Array = ['purple', 'blue', 'green', 'red']; + public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false, ?inCharter:Bool = false) { super(); @@ -72,26 +75,15 @@ class Note extends FlxSprite switch (noteTypeCheck) { case 'pixel': - loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels','week6'), true, 17, 17); - - animation.add('greenScroll', [6]); - animation.add('redScroll', [7]); - animation.add('blueScroll', [5]); - animation.add('purpleScroll', [4]); - + loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels', 'week6'), true, 17, 17); if (isSustainNote) + loadGraphic(Paths.image('weeb/pixelUI/arrowEnds', 'week6'), true, 7, 6); + + for (i in 0...4) { - loadGraphic(Paths.image('weeb/pixelUI/arrowEnds','week6'), true, 7, 6); - - animation.add('purpleholdend', [4]); - animation.add('greenholdend', [6]); - animation.add('redholdend', [7]); - animation.add('blueholdend', [5]); - - animation.add('purplehold', [0]); - animation.add('greenhold', [2]); - animation.add('redhold', [3]); - animation.add('bluehold', [1]); + animation.add(dataColor[i] + 'Scroll', [i + 4]); // Normal notes + animation.add(dataColor[i] + 'hold', [i]); // Holds + animation.add(dataColor[i] + 'holdend', [i + 4]); // Tails } setGraphicSize(Std.int(width * PlayState.daPixelZoom)); @@ -99,47 +91,27 @@ class Note extends FlxSprite default: frames = Paths.getSparrowAtlas('NOTE_assets'); - animation.addByPrefix('greenScroll', 'green instance 1'); - animation.addByPrefix('redScroll', 'red instance 1'); - animation.addByPrefix('blueScroll', 'blue instance 1'); - animation.addByPrefix('purpleScroll', 'purple instance 1'); - - animation.addByPrefix('purpleholdend', 'pruple end hold instance 1'); - animation.addByPrefix('greenholdend', 'green hold end instance 1'); - animation.addByPrefix('redholdend', 'red hold end instance 1'); - animation.addByPrefix('blueholdend', 'blue hold end instance 1'); - - animation.addByPrefix('purplehold', 'purple hold piece instance 1'); - animation.addByPrefix('greenhold', 'green hold piece instance 1'); - animation.addByPrefix('redhold', 'red hold piece instance 1'); - animation.addByPrefix('bluehold', 'blue hold piece instance 1'); + for (i in 0...4) + { + animation.addByPrefix(dataColor[i] + 'Scroll', dataColor[i] + ' alone'); // Normal notes + animation.addByPrefix(dataColor[i] + 'hold', dataColor[i] + ' hold'); // Hold + animation.addByPrefix(dataColor[i] + 'holdend', dataColor[i] + ' tail'); // Tails + } setGraphicSize(Std.int(width * 0.7)); updateHitbox(); antialiasing = true; } - switch (noteData) - { - case 0: - x += swagWidth * 0; - animation.play('purpleScroll'); - case 1: - x += swagWidth * 1; - animation.play('blueScroll'); - case 2: - x += swagWidth * 2; - animation.play('greenScroll'); - case 3: - x += swagWidth * 3; - animation.play('redScroll'); - } + x += swagWidth * noteData; + animation.play(dataColor[noteData] + 'Scroll'); // trace(prevNote); // we make sure its downscroll and its a SUSTAIN NOTE (aka a trail, not a note) // and flip it so it doesn't look weird. // THIS DOESN'T FUCKING FLIP THE NOTE, CONTRIBUTERS DON'T JUST COMMENT THIS OUT JESUS + // then what is this lol if (FlxG.save.data.downscroll && sustainNote) flipY = true; @@ -150,39 +122,18 @@ class Note extends FlxSprite x += width / 2; - switch (noteData) - { - case 2: - animation.play('greenholdend'); - case 3: - animation.play('redholdend'); - case 1: - animation.play('blueholdend'); - case 0: - animation.play('purpleholdend'); - } + animation.play(dataColor[noteData] + 'holdend'); updateHitbox(); x -= width / 2; - if (PlayState.curStage.startsWith('school')) + if (noteTypeCheck == 'pixel') x += 30; if (prevNote.isSustainNote) { - switch (prevNote.noteData) - { - case 0: - prevNote.animation.play('purplehold'); - case 1: - prevNote.animation.play('bluehold'); - case 2: - prevNote.animation.play('greenhold'); - case 3: - prevNote.animation.play('redhold'); - } - + prevNote.animation.play(dataColor[prevNote.noteData] + 'hold'); if(FlxG.save.data.scrollSpeed != 1) prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * FlxG.save.data.scrollSpeed; diff --git a/source/Options.hx b/source/Options.hx index 7c8f411..574092f 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -119,6 +119,29 @@ class CpuStrums extends Option } +class GraphicLoading extends Option +{ + public function new(desc:String) + { + super(); + description = desc; + } + + public override function press():Bool + { + FlxG.save.data.cacheImages = !FlxG.save.data.cacheImages; + + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return FlxG.save.data.cacheImages ? "Preload Characters" : "Do not Preload Characters"; + } + +} + class DownscrollOption extends Option { public function new(desc:String) @@ -698,3 +721,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..62d3091 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -42,18 +42,16 @@ class OptionsMenu extends MusicBeatState new OptionCategory("Appearance", [ new DistractionsAndEffectsOption("Toggle stage distractions that can hinder your gameplay."), new CamZoomOption("Toggle the camera zoom in-game."), - #if desktop new RainbowFPSOption("Make the FPS Counter Rainbow"), new AccuracyOption("Display accuracy information."), new NPSDisplayOption("Shows your current Notes Per Second."), new SongPositionOption("Show the songs current position (as a bar)"), new CpuStrums("CPU's strumline lights up when a note hits it."), - #end ]), new OptionCategory("Misc", [ - #if desktop new FPSOption("Toggle the FPS Counter"), + #if desktop new ReplayOption("View replays"), #end new FlashingLightsOption("Toggle flashing lights that can cause epileptic seizures and strain."), @@ -61,7 +59,14 @@ 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 GraphicLoading("On startup, cache every character. Significantly decrease load times. (HIGH MEMORY)"), + 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/Paths.hx b/source/Paths.hx index 075adbd..2c74380 100644 --- a/source/Paths.hx +++ b/source/Paths.hx @@ -1,5 +1,8 @@ package; +import openfl.utils.Assets; +import flixel.graphics.FlxGraphic; +import flixel.system.FlxAssets.FlxGraphicAsset; import flixel.FlxG; import flixel.graphics.frames.FlxAtlasFrames; import openfl.utils.AssetType; @@ -67,7 +70,7 @@ class Paths inline static public function txt(key:String, ?library:String) { - return getPath('data/$key.txt', TEXT, library); + return getPath('$key.txt', TEXT, library); } inline static public function xml(key:String, ?library:String) @@ -125,13 +128,30 @@ class Paths return 'assets/fonts/$key'; } - inline static public function getSparrowAtlas(key:String, ?library:String) + inline static public function getSparrowAtlas(key:String, ?library:String, ?isCharacter:Bool = false) { + if (isCharacter) + if (FlxG.save.data.cacheImages) + return FlxAtlasFrames.fromSparrow(imageCached(key), file('images/characters/$key.xml', library)); + else + return FlxAtlasFrames.fromSparrow(image('characters/$key'), file('images/characters/$key.xml')); return FlxAtlasFrames.fromSparrow(image(key, library), file('images/$key.xml', library)); } - inline static public function getPackerAtlas(key:String, ?library:String) + inline static public function imageCached(key:String):FlxGraphic { + var data = Caching.bitmapData.get(key); + trace('finding ${key} - ${data.bitmap}'); + return data; + } + + inline static public function getPackerAtlas(key:String, ?library:String, ?isCharacter:Bool = false) + { + if (isCharacter) + if (FlxG.save.data.cacheImages) + return FlxAtlasFrames.fromSpriteSheetPacker(imageCached(key), file('images/$key.txt', library)); + else + return FlxAtlasFrames.fromSpriteSheetPacker(image('characters/$key'), file('images/characters/$key.txt')); return FlxAtlasFrames.fromSpriteSheetPacker(image(key, library), file('images/$key.txt', library)); } } diff --git a/source/PauseSubState.hx b/source/PauseSubState.hx index f2e3a0b..0d78ca9 100644 --- a/source/PauseSubState.hx +++ b/source/PauseSubState.hx @@ -240,7 +240,10 @@ class PauseSubState extends MusicBeatSubstate if (FlxG.save.data.fpsCap > 290) (cast (Lib.current.getChildAt(0), Main)).setFPSCap(290); - FlxG.switchState(new MainMenuState()); + if (PlayState.isStoryMode) + FlxG.switchState(new StoryMenuState()); + else + FlxG.switchState(new FreeplayState()); } } diff --git a/source/PlayState.hx b/source/PlayState.hx index af3babe..3a04625 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -228,6 +228,9 @@ class PlayState extends MusicBeatState private var executeModchart = false; + // Animation common suffixes + private var dataSuffix:Array = ['LEFT', 'DOWN', 'UP', 'RIGHT']; + // API stuff public function addObject(object:FlxBasic) { add(object); } @@ -253,6 +256,8 @@ class PlayState extends MusicBeatState } misses = 0; + + highestCombo = 0; repPresses = 0; repReleases = 0; @@ -360,11 +365,11 @@ class PlayState extends MusicBeatState "Only then I will even CONSIDER letting you\ndate my daughter!" ]; case 'senpai': - dialogue = CoolUtil.coolTextFile(Paths.txt('senpai/senpaiDialogue')); + dialogue = CoolUtil.coolTextFile(Paths.txt('data/senpai/senpaiDialogue')); case 'roses': - dialogue = CoolUtil.coolTextFile(Paths.txt('roses/rosesDialogue')); + dialogue = CoolUtil.coolTextFile(Paths.txt('data/roses/rosesDialogue')); case 'thorns': - dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue')); + dialogue = CoolUtil.coolTextFile(Paths.txt('data/thorns/thornsDialogue')); } //defaults if no stage was found in chart @@ -830,6 +835,15 @@ class PlayState extends MusicBeatState dad.y += 360; camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y); case 'spirit': + if(FlxG.save.data.distractions){ + // trailArea.scrollFactor.set(); + var evilTrail = new FlxTrail(dad, null, 4, 24, 0.3, 0.069); + // evilTrail.changeValuesEnabled(false, false, false, false); + // evilTrail.changeGraphic() + add(evilTrail); + // evilTrail.scrollFactor.set(1.1, 1.1); + } + dad.x -= 150; dad.y += 100; camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y); @@ -862,16 +876,6 @@ class PlayState extends MusicBeatState gf.x += 180; gf.y += 300; case 'schoolEvil': - if(FlxG.save.data.distractions){ - // trailArea.scrollFactor.set(); - var evilTrail = new FlxTrail(dad, null, 4, 24, 0.3, 0.069); - // evilTrail.changeValuesEnabled(false, false, false, false); - // evilTrail.changeGraphic() - add(evilTrail); - // evilTrail.scrollFactor.set(1.1, 1.1); - } - - boyfriend.x += 200; boyfriend.y += 220; gf.x += 180; @@ -1127,6 +1131,7 @@ class PlayState extends MusicBeatState rep = new Replay("na"); FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN,handleInput); + FlxG.stage.addEventListener(KeyboardEvent.KEY_UP,releaseInput); super.create(); } @@ -1366,6 +1371,41 @@ class PlayState extends MusicBeatState return null; } + var keys = [false,false,false,false]; + + private function releaseInput(evt:KeyboardEvent):Void // handles releases + { + @:privateAccess + var key = FlxKey.toStringMap.get(Keyboard.__convertKeyCode(evt.keyCode)); + + var binds:Array = [FlxG.save.data.leftBind,FlxG.save.data.downBind, FlxG.save.data.upBind, FlxG.save.data.rightBind]; + + var data = -1; + + switch(evt.keyCode) // arrow keys + { + case 37: + data = 0; + case 40: + data = 1; + case 38: + data = 2; + case 39: + data = 3; + } + + for (i in 0...binds.length) // binds + { + if (binds[i].toLowerCase() == key.toLowerCase()) + data = i; + } + + if (data == -1) + return; + + keys[data] = false; + } + private function handleInput(evt:KeyboardEvent):Void { // this actually handles press inputs if (PlayStateChangeables.botPlay || loadRep || paused) @@ -1399,15 +1439,16 @@ class PlayState extends MusicBeatState if (binds[i].toLowerCase() == key.toLowerCase()) data = i; } - - if (evt.keyLocation == KeyLocation.NUM_PAD) - { - trace(String.fromCharCode(evt.charCode) + " " + key); - } - if (data == -1) return; + if (keys[data]) + { + return; + } + + keys[data] = true; + var ana = new Ana(Conductor.songPosition, null, false, "miss", data); var dataNotes = []; @@ -1419,17 +1460,46 @@ class PlayState extends MusicBeatState dataNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime)); // sort by the earliest note - + if (dataNotes.length != 0) { + var coolNote = dataNotes[0]; + if (dataNotes.length > 1) // stacked notes or really close ones + { + for(i in 0...dataNotes.length) + { + if (i == 0) // skip the first note + continue; + + var note = dataNotes[i]; + + if (!note.isSustainNote && (note.strumTime - coolNote.strumTime) < 2) + { + trace('found a stacked/really close note ' + (note.strumTime - coolNote.strumTime)); + // just fuckin remove it since it's a stacked note and shouldn't be there + note.kill(); + notes.remove(note, true); + note.destroy(); + } + } + } + goodNoteHit(coolNote); var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition); ana.hit = true; ana.hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000)); ana.nearestNote = [coolNote.strumTime,coolNote.noteData,coolNote.sustainLength]; } + else if (!FlxG.save.data.ghost) + { + noteMiss(data,null); + ana.hit = false; + ana.hitJudge = "shit"; + ana.nearestNote = []; + } + } @@ -1592,6 +1662,7 @@ class PlayState extends MusicBeatState swagNote.sustainLength = songNotes[2]; swagNote.scrollFactor.set(0, 0); + var susLength:Float = swagNote.sustainLength; susLength = susLength / Conductor.stepCrochet; @@ -1695,70 +1766,70 @@ class PlayState extends MusicBeatState case 'normal': babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets'); - babyArrow.animation.addByPrefix('green', 'arrow static instance 1'); - babyArrow.animation.addByPrefix('blue', 'arrow static instance 2'); - babyArrow.animation.addByPrefix('purple', 'arrow static instance 3'); - babyArrow.animation.addByPrefix('red', 'arrow static instance 4'); - + babyArrow.animation.addByPrefix('green', 'arrowUP'); + babyArrow.animation.addByPrefix('blue', 'arrowDOWN'); + babyArrow.animation.addByPrefix('purple', 'arrowLEFT'); + babyArrow.animation.addByPrefix('red', 'arrowRIGHT'); + babyArrow.antialiasing = true; babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7)); - + switch (Math.abs(i)) { - case 0: - babyArrow.x += Note.swagWidth * 0; - babyArrow.animation.addByPrefix('static', 'arrow static instance 1'); - babyArrow.animation.addByPrefix('pressed', 'left press instance 1', 24, false); - babyArrow.animation.addByPrefix('confirm', 'left confirm instance 1', 24, false); - case 1: - babyArrow.x += Note.swagWidth * 1; - babyArrow.animation.addByPrefix('static', 'arrow static instance 2'); - babyArrow.animation.addByPrefix('pressed', 'down press instance 1', 24, false); - babyArrow.animation.addByPrefix('confirm', 'down confirm instance 1', 24, false); case 2: babyArrow.x += Note.swagWidth * 2; - babyArrow.animation.addByPrefix('static', 'arrow static instance 4'); - babyArrow.animation.addByPrefix('pressed', 'up press instance 1', 24, false); - babyArrow.animation.addByPrefix('confirm', 'up confirm instance 1', 24, false); + babyArrow.animation.addByPrefix('static', 'arrowUP'); + babyArrow.animation.addByPrefix('pressed', 'up press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false); case 3: babyArrow.x += Note.swagWidth * 3; - babyArrow.animation.addByPrefix('static', 'arrow static instance 3'); - babyArrow.animation.addByPrefix('pressed', 'right press instance 1', 24, false); - babyArrow.animation.addByPrefix('confirm', 'right confirm instance 1', 24, false); - } + babyArrow.animation.addByPrefix('static', 'arrowRIGHT'); + babyArrow.animation.addByPrefix('pressed', 'right press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false); + case 1: + babyArrow.x += Note.swagWidth * 1; + babyArrow.animation.addByPrefix('static', 'arrowDOWN'); + babyArrow.animation.addByPrefix('pressed', 'down press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false); + case 0: + babyArrow.x += Note.swagWidth * 0; + babyArrow.animation.addByPrefix('static', 'arrowLEFT'); + babyArrow.animation.addByPrefix('pressed', 'left press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false); + } default: babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets'); - babyArrow.animation.addByPrefix('green', 'arrow static instance 1'); - babyArrow.animation.addByPrefix('blue', 'arrow static instance 2'); - babyArrow.animation.addByPrefix('purple', 'arrow static instance 3'); - babyArrow.animation.addByPrefix('red', 'arrow static instance 4'); + babyArrow.animation.addByPrefix('green', 'arrowUP'); + babyArrow.animation.addByPrefix('blue', 'arrowDOWN'); + babyArrow.animation.addByPrefix('purple', 'arrowLEFT'); + babyArrow.animation.addByPrefix('red', 'arrowRIGHT'); babyArrow.antialiasing = true; babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7)); switch (Math.abs(i)) { - case 0: - babyArrow.x += Note.swagWidth * 0; - babyArrow.animation.addByPrefix('static', 'arrow static instance 1'); - babyArrow.animation.addByPrefix('pressed', 'left press instance 1', 24, false); - babyArrow.animation.addByPrefix('confirm', 'left confirm instance 1', 24, false); - case 1: - babyArrow.x += Note.swagWidth * 1; - babyArrow.animation.addByPrefix('static', 'arrow static instance 2'); - babyArrow.animation.addByPrefix('pressed', 'down press instance 1', 24, false); - babyArrow.animation.addByPrefix('confirm', 'down confirm instance 1', 24, false); case 2: babyArrow.x += Note.swagWidth * 2; - babyArrow.animation.addByPrefix('static', 'arrow static instance 4'); - babyArrow.animation.addByPrefix('pressed', 'up press instance 1', 24, false); - babyArrow.animation.addByPrefix('confirm', 'up confirm instance 1', 24, false); + babyArrow.animation.addByPrefix('static', 'arrowUP'); + babyArrow.animation.addByPrefix('pressed', 'up press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false); case 3: babyArrow.x += Note.swagWidth * 3; - babyArrow.animation.addByPrefix('static', 'arrow static instance 3'); - babyArrow.animation.addByPrefix('pressed', 'right press instance 1', 24, false); - babyArrow.animation.addByPrefix('confirm', 'right confirm instance 1', 24, false); + babyArrow.animation.addByPrefix('static', 'arrowRIGHT'); + babyArrow.animation.addByPrefix('pressed', 'right press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false); + case 1: + babyArrow.x += Note.swagWidth * 1; + babyArrow.animation.addByPrefix('static', 'arrowDOWN'); + babyArrow.animation.addByPrefix('pressed', 'down press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false); + case 0: + babyArrow.x += Note.swagWidth * 0; + babyArrow.animation.addByPrefix('static', 'arrowLEFT'); + babyArrow.animation.addByPrefix('pressed', 'left press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false); } } @@ -2039,6 +2110,7 @@ class PlayState extends MusicBeatState #end FlxG.switchState(new ChartingState()); FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput); #if windows if (luaModchart != null) { @@ -2091,6 +2163,7 @@ class PlayState extends MusicBeatState FlxG.switchState(new AnimationDebug(SONG.player2)); FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput); #if windows if (luaModchart != null) { @@ -2104,6 +2177,7 @@ class PlayState extends MusicBeatState { FlxG.switchState(new AnimationDebug(SONG.player1)); FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput); #if windows if (luaModchart != null) { @@ -2275,18 +2349,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) @@ -2517,18 +2585,10 @@ class PlayState extends MusicBeatState if (SONG.notes[Math.floor(curStep / 16)].altAnim) altAnim = '-alt'; } - - switch (Math.abs(daNote.noteData)) - { - case 2: - dad.playAnim('singUP' + altAnim, true); - case 3: - dad.playAnim('singRIGHT' + altAnim, true); - case 1: - dad.playAnim('singDOWN' + altAnim, true); - case 0: - dad.playAnim('singLEFT' + altAnim, true); - } + + // Accessing the animation name directly to play it + var singData:Int = Std.int(Math.abs(daNote.noteData)); + dad.playAnim('sing' + dataSuffix[singData] + altAnim, true); if (FlxG.save.data.cpuStrums) { @@ -2645,7 +2705,7 @@ class PlayState extends MusicBeatState }); } - if (!inCutscene) + if (!inCutscene && songStarted) keyShit(); @@ -2658,6 +2718,7 @@ class PlayState extends MusicBeatState function endSong():Void { FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput); if (useVideo) { GlobalVideo.get().stop(); @@ -2739,7 +2800,7 @@ class PlayState extends MusicBeatState else { FlxG.sound.playMusic(Paths.music('freakyMenu')); - FlxG.switchState(new MainMenuState()); + FlxG.switchState(new StoryMenuState()); } #if windows @@ -2750,17 +2811,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 { @@ -3147,6 +3204,8 @@ class PlayState extends MusicBeatState }; #end + var nonCpp = false; + // Prevent player input if botplay is on if(PlayStateChangeables.botPlay) @@ -3156,6 +3215,10 @@ class PlayState extends MusicBeatState releaseArray = [false, false, false, false]; } + #if !cpp + nonCpp = true; + #end + var anas:Array = [null,null,null,null]; for (i in 0...pressArray.length) @@ -3172,7 +3235,7 @@ class PlayState extends MusicBeatState }); } - if (KeyBinds.gamepad && !FlxG.keys.justPressed.ANY) + if ((KeyBinds.gamepad && !FlxG.keys.justPressed.ANY) || nonCpp) { // PRESSES, check for note hits if (pressArray.contains(true) && generatedMusic) @@ -3293,7 +3356,7 @@ class PlayState extends MusicBeatState if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && (!holdArray.contains(true) || PlayStateChangeables.botPlay)) { - if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss')) + if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss') && boyfriend.animation.curAnim.curFrame >= 10) boyfriend.playAnim('idle'); } @@ -3462,17 +3525,8 @@ class PlayState extends MusicBeatState // FlxG.sound.play(Paths.sound('missnote1'), 1, false); // FlxG.log.add('played imss note'); - switch (direction) - { - case 0: - boyfriend.playAnim('singLEFTmiss', true); - case 1: - boyfriend.playAnim('singDOWNmiss', true); - case 2: - boyfriend.playAnim('singUPmiss', true); - case 3: - boyfriend.playAnim('singRIGHTmiss', true); - } + // Hole switch statement replaced with a single line :) + boyfriend.playAnim('sing' + dataSuffix[direction] + 'miss', true); #if windows if (luaModchart != null) @@ -3620,19 +3674,9 @@ class PlayState extends MusicBeatState } else totalNotesHit += 1; - - - switch (note.noteData) - { - case 2: - boyfriend.playAnim('singUP', true); - case 3: - boyfriend.playAnim('singRIGHT', true); - case 1: - boyfriend.playAnim('singDOWN', true); - case 0: - boyfriend.playAnim('singLEFT', true); - } + + var singData:Int = Std.int(note.noteData); + boyfriend.playAnim('sing' + dataSuffix[singData], true); #if windows if (luaModchart != null) @@ -3876,6 +3920,10 @@ class PlayState extends MusicBeatState boyfriend.playAnim('idle'); } + if (!dad.animation.curAnim.name.startsWith("sing")) + { + dad.dance(); + } if (curBeat % 8 == 7 && curSong == 'Bopeebo') { diff --git a/source/ResultsScreen.hx b/source/ResultsScreen.hx index 255ab8c..77d62f2 100644 --- a/source/ResultsScreen.hx +++ b/source/ResultsScreen.hx @@ -57,6 +57,7 @@ class ResultsScreen extends FlxSubState music = new FlxSound().loadEmbedded(Paths.music('breakfast'), true, true); music.volume = 0; music.play(false, FlxG.random.int(0, Std.int(music.length / 2))); + FlxG.sound.list.add(music); background.alpha = 0; @@ -74,7 +75,7 @@ class ResultsScreen extends FlxSubState text.text = "Week Cleared!"; } - comboText = new FlxText(20,-75,0,'Judgements:\nSicks - ${PlayState.sicks}\nGoods - ${PlayState.goods}\nBads - ${PlayState.bads}\n\nCombo Breaks: ${(PlayState.isStoryMode ? PlayState.campaignMisses : PlayState.misses)}\nHighest Combo: ${PlayState.highestCombo + 1}\n\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\nF1 - View replay\nF2 - Replay song + comboText = new FlxText(20,-75,0,'Judgements:\nSicks - ${PlayState.sicks}\nGoods - ${PlayState.goods}\nBads - ${PlayState.bads}\n\nCombo Breaks: ${(PlayState.isStoryMode ? PlayState.campaignMisses : PlayState.misses)}\nHighest Combo: ${PlayState.highestCombo + 1}\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\nF1 - View replay\nF2 - Replay song '); comboText.size = 28; comboText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1); diff --git a/source/Section.hx b/source/Section.hx index f153da5..c1af6ac 100644 --- a/source/Section.hx +++ b/source/Section.hx @@ -2,7 +2,7 @@ package; typedef SwagSection = { - var sectionNotes:Array; + var sectionNotes:Array>; var lengthInSteps:Int; var typeOfSection:Int; var mustHitSection:Bool; @@ -13,7 +13,7 @@ typedef SwagSection = class Section { - public var sectionNotes:Array = []; + public var sectionNotes:Array> = []; public var lengthInSteps:Int = 16; public var typeOfSection:Int = 0; diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 5957720..d2362ee 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'], @@ -47,15 +50,7 @@ class StoryMenuState extends MusicBeatState ['senpai', 'bf', 'gf'] ]; - var weekNames:Array = [ - "", - "Daddy Dearest", - "Spooky Month", - "PICO", - "MOMMY MUST MURDER", - "RED SNOW", - "Hating Simulator ft. Moawling" - ]; + var weekNames:Array = CoolUtil.coolTextFile(Paths.txt('data/weekNames')); var txtWeekTitle:FlxText; @@ -73,8 +68,28 @@ class StoryMenuState extends MusicBeatState var leftArrow:FlxSprite; var rightArrow:FlxSprite; + function unlockWeeks():Array + { + var weeks:Array = []; + #if debug + for(i in 0...weekNames.length) + weeks.push(true); + return weeks; + #end + + weeks.push(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); @@ -110,17 +125,17 @@ class StoryMenuState extends MusicBeatState grpWeekText = new FlxTypedGroup(); add(grpWeekText); + grpLocks = new FlxTypedGroup(); + add(grpLocks); + var blackBarThingie:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 56, FlxColor.BLACK); add(blackBarThingie); grpWeekCharacters = new FlxTypedGroup(); - grpLocks = new FlxTypedGroup(); - add(grpLocks); - 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 +149,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'); @@ -195,6 +211,19 @@ class StoryMenuState extends MusicBeatState updateText(); + + var bullShit:Int = 0; + + for (item in grpWeekText.members) + { + item.targetY = bullShit - curWeek; + if (item.targetY == Std.int(0) && weekUnlocked[curWeek]) + item.alpha = 1; + else + item.alpha = 0.6; + bullShit++; + } + trace("Line 165"); super.create(); @@ -314,7 +343,7 @@ class StoryMenuState extends MusicBeatState stopspamming = true; } - PlayState.storyPlaylist = weekData[curWeek]; + PlayState.storyPlaylist = weekData()[curWeek]; PlayState.isStoryMode = true; selectedWeek = true; @@ -388,10 +417,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 +446,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 +462,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..dadc361 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -67,16 +67,7 @@ class TitleState extends MusicBeatState trace("Loaded " + openfl.Assets.getLibrary("default").assetsLoaded + " assets (DEFAULT)"); } - PlayerSettings.init(); - #if windows - DiscordClient.initialize(); - - Application.current.onExit.add (function (exitCode) { - DiscordClient.shutdown(); - }); - - #end curWacky = FlxG.random.getObject(getIntroTextShit()); @@ -93,38 +84,22 @@ class TitleState extends MusicBeatState trace('NEWGROUNDS LOL'); #end - FlxG.save.bind('funkin', 'ninjamuffin99'); - - KadeEngineData.initSave(); - // var file:SMFile = SMFile.loadFile("file.sm"); // this was testing things - - 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 FlxG.switchState(new ChartingState()); #else + #if !cpp new FlxTimer().start(1, function(tmr:FlxTimer) { startIntro(); }); + #else + startIntro(); + #end #end } @@ -135,34 +110,6 @@ class TitleState extends MusicBeatState function startIntro() { - if (!initialized) - { - var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond); - diamond.persist = true; - diamond.destroyOnNoUse = false; - - FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 1, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32}, - new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4)); - FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 0.7, new FlxPoint(0, 1), - {asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4)); - - transIn = FlxTransitionableState.defaultTransIn; - transOut = FlxTransitionableState.defaultTransOut; - - // HAD TO MODIFY SOME BACKEND SHIT - // IF THIS PR IS HERE IF ITS ACCEPTED UR GOOD TO GO - // https://github.com/HaxeFlixel/flixel-addons/pull/348 - - // var music:FlxSound = new FlxSound(); - // music.loadStream(Paths.music('freakyMenu')); - // FlxG.sound.list.add(music); - // music.play(); - FlxG.sound.playMusic(Paths.music('freakyMenu'), 0); - - FlxG.sound.music.fadeIn(4, 0, 0.7); - } - - Conductor.changeBPM(102); persistentUpdate = true; var bg:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); @@ -171,25 +118,17 @@ class TitleState extends MusicBeatState // bg.updateHitbox(); add(bg); + logoBl = new FlxSprite(-150, 1500); if(Main.watermarks) { - logoBl = new FlxSprite(-150, -100); logoBl.frames = Paths.getSparrowAtlas('KadeEngineLogoBumpin'); - logoBl.antialiasing = true; - logoBl.animation.addByPrefix('bump', 'logo bumpin', 24); - logoBl.animation.play('bump'); - logoBl.updateHitbox(); - // logoBl.screenCenter(); - // logoBl.color = FlxColor.BLACK; } else { - logoBl = new FlxSprite(-150, -100); logoBl.frames = Paths.getSparrowAtlas('logoBumpin'); - logoBl.antialiasing = true; - logoBl.animation.addByPrefix('bump', 'logo bumpin', 24); - logoBl.animation.play('bump'); - logoBl.updateHitbox(); - // logoBl.screenCenter(); - // logoBl.color = FlxColor.BLACK; } + logoBl.antialiasing = true; + logoBl.animation.addByPrefix('bump', 'logo bumpin', 24, false); + logoBl.updateHitbox(); + // logoBl.screenCenter(); + // logoBl.color = FlxColor.BLACK; gfDance = new FlxSprite(FlxG.width * 0.4, FlxG.height * 0.07); gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle'); @@ -245,15 +184,40 @@ class TitleState extends MusicBeatState if (initialized) skipIntro(); - else + else { + var diamond:FlxGraphic = FlxGraphic.fromClass(GraphicTransTileDiamond); + diamond.persist = true; + diamond.destroyOnNoUse = false; + + FlxTransitionableState.defaultTransIn = new TransitionData(FADE, FlxColor.BLACK, 1, new FlxPoint(0, -1), {asset: diamond, width: 32, height: 32}, + new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4)); + FlxTransitionableState.defaultTransOut = new TransitionData(FADE, FlxColor.BLACK, 0.7, new FlxPoint(0, 1), + {asset: diamond, width: 32, height: 32}, new FlxRect(-200, -200, FlxG.width * 1.4, FlxG.height * 1.4)); + + transIn = FlxTransitionableState.defaultTransIn; + transOut = FlxTransitionableState.defaultTransOut; + + // HAD TO MODIFY SOME BACKEND SHIT + // IF THIS PR IS HERE IF ITS ACCEPTED UR GOOD TO GO + // https://github.com/HaxeFlixel/flixel-addons/pull/348 + + // var music:FlxSound = new FlxSound(); + // music.loadStream(Paths.music('freakyMenu')); + // FlxG.sound.list.add(music); + // music.play(); + FlxG.sound.playMusic(Paths.music('freakyMenu'), 0); + + FlxG.sound.music.fadeIn(4, 0, 0.7); + Conductor.changeBPM(102); initialized = true; + } // credGroup.add(credTextShit); } function getIntroTextShit():Array> { - var fullText:String = Assets.getText(Paths.txt('introText')); + var fullText:String = Assets.getText(Paths.txt('data/introText')); var firstArray:Array = fullText.split('\n'); var swagGoodArray:Array> = []; @@ -388,7 +352,7 @@ class TitleState extends MusicBeatState { super.beatHit(); - logoBl.animation.play('bump'); + logoBl.animation.play('bump', true); danceLeft = !danceLeft; if (danceLeft) @@ -468,6 +432,19 @@ class TitleState extends MusicBeatState FlxG.camera.flash(FlxColor.WHITE, 4); remove(credGroup); + + FlxTween.tween(logoBl,{y: -100}, 1.4, {ease: FlxEase.expoInOut}); + + logoBl.angle = -4; + + new FlxTimer().start(0.01, function(tmr:FlxTimer) + { + if(logoBl.angle == -4) + FlxTween.angle(logoBl, logoBl.angle, 4, 4, {ease: FlxEase.quartInOut}); + if (logoBl.angle == 4) + FlxTween.angle(logoBl, logoBl.angle, -4, 4, {ease: FlxEase.quartInOut}); + }, 0); + skippedIntro = true; } }