From 3e1e5d330cadefb125d0ea53eeafe7f147b662de Mon Sep 17 00:00:00 2001 From: Hazel Date: Mon, 9 Oct 2023 19:39:11 +0100 Subject: [PATCH 01/53] ci: hxcpp + export caching --- .github/actions/setup-haxeshit/action.yml | 1 - .github/workflows/build-shit.yml | 19 ++++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-haxeshit/action.yml b/.github/actions/setup-haxeshit/action.yml index 756530178..0cc544cf7 100644 --- a/.github/actions/setup-haxeshit/action.yml +++ b/.github/actions/setup-haxeshit/action.yml @@ -25,7 +25,6 @@ runs: key: ${{ runner.os }}-hmm-${{ hashFiles('**/hmm.json') }} restore-keys: | ${{ runner.os }}-hmm- - ${{ runner.os }}- - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: hmm install run: | diff --git a/.github/workflows/build-shit.yml b/.github/workflows/build-shit.yml index 3ce0d538b..92d915a8e 100644 --- a/.github/workflows/build-shit.yml +++ b/.github/workflows/build-shit.yml @@ -52,13 +52,30 @@ jobs: submodules: 'recursive' token: ${{ secrets.GH_RO_PAT }} - uses: ./.github/actions/setup-haxeshit + - name: Make HXCPP cache dir + shell: bash + run: | + mkdir -p ${{ runner.temp }}/hxcpp_cache + - name: Restore build cache + id: cache-build-win + uses: actions/cache@v3 + with: + path: | + .haxelib + export + ${{ runner.temp }}/hxcpp_cache + key: ${{ runner.os }}-build-win-${{ github.ref_name }} + restore-keys: | + ${{ runner.os }}-build-win- - name: Build game run: | haxelib run lime build windows -release -DNO_REDIRECT_ASSETS_FOLDER dir + env: + HXCPP_COMPILE_CACHE: "${{ runner.temp }}/hxcpp_cache" - uses: ./.github/actions/upload-itch with: - butler-key: ${{ secrets.BUTLER_API_KEY}} + butler-key: ${{ secrets.BUTLER_API_KEY }} build-dir: export/release/windows/bin target: win # test-unit-win: From db563a4967ffdf618836496966d90d7a08b0964e Mon Sep 17 00:00:00 2001 From: Hazel Date: Mon, 9 Oct 2023 21:03:49 +0100 Subject: [PATCH 03/53] hotfix: windows style paths --- .github/workflows/build-shit.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-shit.yml b/.github/workflows/build-shit.yml index 92d915a8e..809a8b94b 100644 --- a/.github/workflows/build-shit.yml +++ b/.github/workflows/build-shit.yml @@ -55,7 +55,7 @@ jobs: - name: Make HXCPP cache dir shell: bash run: | - mkdir -p ${{ runner.temp }}/hxcpp_cache + mkdir -p ${{ runner.temp }}\\hxcpp_cache - name: Restore build cache id: cache-build-win uses: actions/cache@v3 @@ -63,7 +63,7 @@ jobs: path: | .haxelib export - ${{ runner.temp }}/hxcpp_cache + ${{ runner.temp }}\\hxcpp_cache key: ${{ runner.os }}-build-win-${{ github.ref_name }} restore-keys: | ${{ runner.os }}-build-win- @@ -72,7 +72,7 @@ jobs: haxelib run lime build windows -release -DNO_REDIRECT_ASSETS_FOLDER dir env: - HXCPP_COMPILE_CACHE: "${{ runner.temp }}/hxcpp_cache" + HXCPP_COMPILE_CACHE: "${{ runner.temp }}\\hxcpp_cache" - uses: ./.github/actions/upload-itch with: butler-key: ${{ secrets.BUTLER_API_KEY }} From 7ac2e91c8d765c6ae486b3fbfc963aae96c71c26 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 4 Aug 2023 15:59:17 -0400 Subject: [PATCH 04/53] selected in middle-ish --- source/funkin/FreeplayState.hx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 6cd353233..c7ae49893 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -970,6 +970,8 @@ class FreeplayState extends MusicBeatSubState for (index => capsule in grpCapsules.members) { + index += 1; + capsule.selected = false; capsule.targetPos.y = ((index - curSelected) * 150) + 160; From 9571eb70e0edec7700e00f32ebf4e7c9c06ffa06 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 4 Aug 2023 16:19:48 -0400 Subject: [PATCH 05/53] scaling of capsules --- source/funkin/FreeplayState.hx | 2 +- source/funkin/freeplayStuff/SongMenuItem.hx | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index c7ae49893..012b6290a 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -974,7 +974,7 @@ class FreeplayState extends MusicBeatSubState capsule.selected = false; - capsule.targetPos.y = ((index - curSelected) * 150) + 160; + capsule.targetPos.y = ((index - curSelected) * ((capsule.height * capsule.realScaled) + 10)) + 160; capsule.targetPos.x = 270 + (60 * (Math.sin(index - curSelected))); // capsule.targetPos.x = 320 + (40 * (index - curSelected)); diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 37198f6d7..cccd84c98 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -38,7 +38,7 @@ class SongMenuItem extends FlxSpriteGroup // capsule.animation add(capsule); - songText = new FlxText(120, 40, 0, songTitle, 40); + songText = new FlxText(capsule.width * 0.1, 40, 0, songTitle, Std.int(40 * realScaled)); songText.font = "5by7"; songText.color = 0xFF43C1EA; add(songText); @@ -63,6 +63,8 @@ class SongMenuItem extends FlxSpriteGroup var xPosLerpLol:Array = [0.9, 0.4, 0.16, 0.16, 0.22, 0.22, 0.245]; // NUMBERS ARE JANK CUZ THE SCALING OR WHATEVER var xPosOutLerpLol:Array = [0.245, 0.75, 0.98, 0.98, 1.2]; // NUMBERS ARE JANK CUZ THE SCALING OR WHATEVER + public final realScaled:Float = 0.8; + override function update(elapsed:Float) { if (doJumpIn) @@ -77,6 +79,9 @@ class SongMenuItem extends FlxSpriteGroup scale.y = 1 / xFrames[frameInTypeBeat]; x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameInTypeBeat, xPosLerpLol.length - 1))]; + scale.x *= realScaled; + scale.y *= realScaled; + frameInTypeBeat += 1; } } @@ -93,6 +98,9 @@ class SongMenuItem extends FlxSpriteGroup scale.y = 1 / xFrames[frameOutTypeBeat]; x = FlxG.width * xPosOutLerpLol[Std.int(Math.min(frameOutTypeBeat, xPosOutLerpLol.length - 1))]; + scale.x *= realScaled; + scale.y *= realScaled; + frameOutTypeBeat += 1; } } From 84f908fbde8d8f6afb3286d1abc25290edc70c99 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 4 Aug 2023 17:10:27 -0400 Subject: [PATCH 06/53] tween in fixed --- source/funkin/FreeplayState.hx | 5 +++-- source/funkin/freeplayStuff/SongMenuItem.hx | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 012b6290a..42d29bfc9 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -494,7 +494,8 @@ class FreeplayState extends MusicBeatSubState for (i in 0...tempSongs.length) { - var funnyMenu:SongMenuItem = new SongMenuItem(FlxG.width, (i * 150) + 160, tempSongs[i].songName); + var funnyMenu:SongMenuItem = new SongMenuItem(FlxG.width, 0, tempSongs[i].songName); + funnyMenu.y = funnyMenu.intendedY(i + 1) + 10; funnyMenu.targetPos.x = funnyMenu.x; funnyMenu.ID = i; funnyMenu.alpha = 0.5; @@ -974,7 +975,7 @@ class FreeplayState extends MusicBeatSubState capsule.selected = false; - capsule.targetPos.y = ((index - curSelected) * ((capsule.height * capsule.realScaled) + 10)) + 160; + capsule.targetPos.y = capsule.intendedY(index - curSelected); capsule.targetPos.x = 270 + (60 * (Math.sin(index - curSelected))); // capsule.targetPos.x = 320 + (40 * (index - curSelected)); diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index cccd84c98..6476a1258 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -38,7 +38,7 @@ class SongMenuItem extends FlxSpriteGroup // capsule.animation add(capsule); - songText = new FlxText(capsule.width * 0.1, 40, 0, songTitle, Std.int(40 * realScaled)); + songText = new FlxText(capsule.width * 0.23, 40, 0, songTitle, Std.int(40 * realScaled)); songText.font = "5by7"; songText.color = 0xFF43C1EA; add(songText); @@ -114,6 +114,11 @@ class SongMenuItem extends FlxSpriteGroup super.update(elapsed); } + public function intendedY(index:Int):Float + { + return (index * ((height * realScaled) + 10)) + 160; + } + function set_selected(value:Bool):Bool { // trace(value); From 65422393cfaddf85c7fe4144dde5959205a764c7 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 4 Aug 2023 18:09:40 -0400 Subject: [PATCH 07/53] letter sort --- source/funkin/FreeplayState.hx | 2 +- source/funkin/freeplayStuff/LetterSort.hx | 18 +++++++++++++----- source/funkin/freeplayStuff/SongMenuItem.hx | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 42d29bfc9..0c51dae59 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -376,7 +376,7 @@ class FreeplayState extends MusicBeatSubState speed: 0.26 }); - var letterSort:LetterSort = new LetterSort(300, 100); + var letterSort:LetterSort = new LetterSort(400, 75); add(letterSort); exitMovers.set([letterSort], diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index c3b22f973..f0425dfc9 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -17,24 +17,32 @@ class LetterSort extends FlxTypedSpriteGroup { super(x, y); - var leftArrow:FreeplayLetter = new FreeplayLetter(-20, 0); + var leftArrow:FreeplayLetter = new FreeplayLetter(-20, 20); leftArrow.animation.play("arrow"); + leftArrow.flipX = true; add(leftArrow); - for (i in 0...6) + for (i in 0...5) { var letter:FreeplayLetter = new FreeplayLetter(i * 80, 0, i); add(letter); letters.push(letter); - if (i == 3) letter.alpha = 0.6; + if (i == 2) letter.alpha = 0.6; - var sep:FreeplayLetter = new FreeplayLetter((i * 80) + 50, 0); + // don't put the last seperator + if (i == 4) continue; + + var sep:FreeplayLetter = new FreeplayLetter((i * 80) + 60, 20); sep.animation.play("seperator"); add(sep); } + var rightArrow:FreeplayLetter = new FreeplayLetter(380, 20); + rightArrow.animation.play("arrow"); + add(rightArrow); + // changeSelection(-3); } @@ -51,7 +59,7 @@ class LetterSort extends FlxTypedSpriteGroup for (letter in letters) letter.changeLetter(diff); - if (changeSelectionCallback != null) changeSelectionCallback(letters[3].arr[letters[3].curLetter]); // bullshit and long lol! + if (changeSelectionCallback != null) changeSelectionCallback(letters[2].arr[letters[2].curLetter]); // bullshit and long lol! } } diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 6476a1258..5649d1187 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -43,7 +43,7 @@ class SongMenuItem extends FlxSpriteGroup songText.color = 0xFF43C1EA; add(songText); - favIcon = new FlxSprite(440, 40); + favIcon = new FlxSprite(400, 40); favIcon.frames = Paths.getSparrowAtlas('freeplay/favHeart'); favIcon.animation.addByPrefix('fav', "favorite heart", 24, false); favIcon.animation.play('fav'); @@ -116,7 +116,7 @@ class SongMenuItem extends FlxSpriteGroup public function intendedY(index:Int):Float { - return (index * ((height * realScaled) + 10)) + 160; + return (index * ((height * realScaled) + 10)) + 120; } function set_selected(value:Bool):Bool From eb87d40d5871b060f77f1211ba6f74a0bda0c233 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 6 Aug 2023 16:24:34 -0400 Subject: [PATCH 08/53] random capsule in progres --- source/funkin/FreeplayState.hx | 172 ++++++++++---------- source/funkin/freeplayStuff/LetterSort.hx | 18 +- source/funkin/freeplayStuff/SongMenuItem.hx | 27 +++ 3 files changed, 128 insertions(+), 89 deletions(-) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 0c51dae59..5ddd47432 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -466,7 +466,7 @@ class FreeplayState extends MusicBeatSubState public function generateSongList(?filterStuff:SongFilter, force:Bool = false) { - curSelected = 0; + curSelected = 1; grpCapsules.clear(); @@ -492,9 +492,38 @@ class FreeplayState extends MusicBeatSubState } } + // if (regexp != null) + // tempSongs = songs.filter(item -> regexp.match(item.songName)); + + // tempSongs.sort(function(a, b):Int + // { + // var tempA = a.songName.toUpperCase(); + // var tempB = b.songName.toUpperCase(); + + // if (tempA < tempB) + // return -1; + // else if (tempA > tempB) + // return 1; + // else + // return 0; + // }); + + var randomCapsule:SongMenuItem = new SongMenuItem(FlxG.width, 0, "Random"); + randomCapsule.onConfirm = function() { + trace("RANDOM SELECTED"); + }; + randomCapsule.y = randomCapsule.intendedY(0) + 10; + randomCapsule.targetPos.x = randomCapsule.x; + randomCapsule.alpha = 0.5; + randomCapsule.songText.visible = false; + randomCapsule.favIcon.visible = false; + randomCapsule.initJumpIn(0, force); + grpCapsules.add(randomCapsule); + for (i in 0...tempSongs.length) { var funnyMenu:SongMenuItem = new SongMenuItem(FlxG.width, 0, tempSongs[i].songName); + funnyMenu.onConfirm = capsuleOnConfirmDefault; funnyMenu.y = funnyMenu.intendedY(i + 1) + 10; funnyMenu.targetPos.x = funnyMenu.x; funnyMenu.ID = i; @@ -503,29 +532,7 @@ class FreeplayState extends MusicBeatSubState funnyMenu.favIcon.visible = tempSongs[i].isFav; // fp.updateScore(0); - - var maxTimer:Float = Math.min(i, 4); - - new FlxTimer().start((1 / 24) * maxTimer, function(doShit) { - funnyMenu.doJumpIn = true; - }); - - new FlxTimer().start((0.09 * maxTimer) + 0.85, function(lerpTmr) { - funnyMenu.doLerp = true; - }); - - if (!force) - { - new FlxTimer().start(((0.20 * maxTimer) / (1 + maxTimer)) + 0.75, function(swagShi) { - funnyMenu.songText.visible = true; - funnyMenu.alpha = 1; - }); - } - else - { - funnyMenu.songText.visible = true; - funnyMenu.alpha = 1; - } + funnyMenu.initJumpIn(Math.min(i, 4), force); grpCapsules.add(funnyMenu); @@ -831,66 +838,7 @@ class FreeplayState extends MusicBeatSubState { // if (Assets.exists()) - var poop:String = songs[curSelected].songName.toLowerCase(); - - // does not work properly, always just accidentally sets it to normal anyways! - /* if (!Assets.exists(Paths.json(songs[curSelected].songName + '/' + poop))) - { - // defaults to normal if HARD / EASY doesn't exist - // does not account if NORMAL doesn't exist! - FlxG.log.warn("CURRENT DIFFICULTY IS NOT CHARTED, DEFAULTING TO NORMAL!"); - poop = Highscore.formatSong(songs[curSelected].songName.toLowerCase(), 1); - curDifficulty = 1; - }*/ - - PlayStatePlaylist.isStoryMode = false; - var songId:String = songs[curSelected].songName.toLowerCase(); - var targetSong:Song = SongRegistry.instance.fetchEntry(songId); - var targetDifficulty:String = switch (curDifficulty) - { - case 0: - 'easy'; - case 1: - 'normal'; - case 2: - 'hard'; - default: 'normal'; - }; - - // TODO: Implement additional difficulties into the interface properly. - if (FlxG.keys.pressed.E) - { - targetDifficulty = 'erect'; - } - - // TODO: Implement Pico into the interface properly. - var targetCharacter:String = 'bf'; - if (FlxG.keys.pressed.P) - { - targetCharacter = 'pico'; - } - - PlayStatePlaylist.campaignId = songs[curSelected].levelId; - - // Visual and audio effects. - FlxG.sound.play(Paths.sound('confirmMenu')); - dj.confirm(); - - if (targetSong != null) - { - // Load and cache the song's charts. - // TODO: Do this in the loading state. - targetSong.cacheCharts(true); - } - - new FlxTimer().start(1, function(tmr:FlxTimer) { - LoadingState.loadAndSwitchState(new PlayState( - { - targetSong: targetSong, - targetDifficulty: targetDifficulty, - targetCharacter: targetCharacter, - }), true); - }); + grpCapsules.members[curSelected].onConfirm(); } } @@ -942,6 +890,62 @@ class FreeplayState extends MusicBeatSubState } } + function capsuleOnConfirmDefault():Void + { + var poop:String = songs[curSelected].songName.toLowerCase(); + + // does not work properly, always just accidentally sets it to normal anyways! + /* if (!Assets.exists(Paths.json(songs[curSelected].songName + '/' + poop))) + { + // defaults to normal if HARD / EASY doesn't exist + // does not account if NORMAL doesn't exist! + FlxG.log.warn("CURRENT DIFFICULTY IS NOT CHARTED, DEFAULTING TO NORMAL!"); + poop = Highscore.formatSong(songs[curSelected].songName.toLowerCase(), 1); + curDifficulty = 1; + }*/ + + PlayStatePlaylist.isStoryMode = false; + var targetSong:Song = SongDataParser.fetchSong(songs[curSelected].songName.toLowerCase()); + var targetDifficulty:String = switch (curDifficulty) + { + case 0: + 'easy'; + case 1: + 'normal'; + case 2: + 'hard'; + default: 'normal'; + }; + + // TODO: Implement additional difficulties into the interface properly. + if (FlxG.keys.pressed.E) + { + targetDifficulty = 'erect'; + } + + // TODO: Implement Pico into the interface properly. + var targetCharacter:String = 'bf'; + if (FlxG.keys.pressed.P) + { + targetCharacter = 'pico'; + } + + PlayStatePlaylist.campaignId = songs[curSelected].levelId; + + // Visual and audio effects. + FlxG.sound.play(Paths.sound('confirmMenu')); + dj.confirm(); + + new FlxTimer().start(1, function(tmr:FlxTimer) { + LoadingState.loadAndSwitchState(new PlayState( + { + targetSong: targetSong, + targetDifficulty: targetDifficulty, + targetCharacter: targetCharacter, + }), true); + }); + } + function changeSelection(change:Int = 0) { // fp.updateScore(12345); diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index f0425dfc9..bb467e67b 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -4,6 +4,8 @@ import flixel.FlxSprite; import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; +import flixel.tweens.FlxTween; +import flixel.tweens.FlxEase; class LetterSort extends FlxTypedSpriteGroup { @@ -25,6 +27,7 @@ class LetterSort extends FlxTypedSpriteGroup for (i in 0...5) { var letter:FreeplayLetter = new FreeplayLetter(i * 80, 0, i); + letter.ogY = y; add(letter); letters.push(letter); @@ -43,7 +46,7 @@ class LetterSort extends FlxTypedSpriteGroup rightArrow.animation.play("arrow"); add(rightArrow); - // changeSelection(-3); + changeSelection(0); } override function update(elapsed:Float) @@ -56,8 +59,12 @@ class LetterSort extends FlxTypedSpriteGroup public function changeSelection(diff:Int = 0) { + curSelection += diff; + if (curSelection < 0) curSelection = letters.length - 1; + if (curSelection >= letters.length) curSelection = 0; + for (letter in letters) - letter.changeLetter(diff); + letter.changeLetter(diff, curSelection); if (changeSelectionCallback != null) changeSelectionCallback(letters[2].arr[letters[2].curLetter]); // bullshit and long lol! } @@ -69,16 +76,17 @@ class FreeplayLetter extends FlxSprite public var curLetter:Int = 0; + public var ogY:Float = 0; + public function new(x:Float, y:Float, ?letterInd:Int) { super(x, y); - frames = Paths.getSparrowAtlas("freeplay/letterStuff"); var alphabet:String = "abcdefghijklmnopqrstuvwxyz"; arr = alphabet.split(""); - arr.insert(0, "#"); arr.insert(0, "ALL"); + arr.insert(0, "#"); arr.insert(0, "fav"); for (str in arr) @@ -96,7 +104,7 @@ class FreeplayLetter extends FlxSprite } } - public function changeLetter(diff:Int = 0) + public function changeLetter(diff:Int = 0, ?curSelection:Int) { curLetter += diff; diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 5649d1187..91a7c188c 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -7,6 +7,7 @@ import flixel.group.FlxSpriteGroup; import flixel.math.FlxMath; import flixel.math.FlxPoint; import flixel.text.FlxText; +import flixel.util.FlxTimer; class SongMenuItem extends FlxSpriteGroup { @@ -25,6 +26,8 @@ class SongMenuItem extends FlxSpriteGroup public var doJumpOut:Bool = false; + public var onConfirm:Void->Void; + public function new(x:Float, y:Float, song:String) { super(x, y); @@ -65,6 +68,30 @@ class SongMenuItem extends FlxSpriteGroup public final realScaled:Float = 0.8; + public function initJumpIn(maxTimer:Float, ?force:Bool):Void + { + new FlxTimer().start((1 / 24) * maxTimer, function(doShit) { + doJumpIn = true; + }); + + new FlxTimer().start((0.09 * maxTimer) + 0.85, function(lerpTmr) { + doLerp = true; + }); + + if (!force) + { + new FlxTimer().start(((0.20 * maxTimer) / (1 + maxTimer)) + 0.75, function(swagShi) { + songText.visible = true; + alpha = 1; + }); + } + else + { + songText.visible = true; + alpha = 1; + } + } + override function update(elapsed:Float) { if (doJumpIn) From dc452bbe9ae0b3f11879d10918a5fc2c73d61c63 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 6 Aug 2023 17:02:37 -0400 Subject: [PATCH 09/53] different colors / sizes --- source/funkin/freeplayStuff/LetterSort.hx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index bb467e67b..bfc8c4a70 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -6,6 +6,7 @@ import flixel.group.FlxGroup; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import flixel.tweens.FlxTween; import flixel.tweens.FlxEase; +import flixel.util.FlxColor; class LetterSort extends FlxTypedSpriteGroup { @@ -32,13 +33,18 @@ class LetterSort extends FlxTypedSpriteGroup letters.push(letter); - if (i == 2) letter.alpha = 0.6; + if (i == 2) letter.scale.x = letter.scale.y = 1.2; + + var darkness:Float = Math.abs(i - 2) / 6; + + letter.color = letter.color.getDarkened(darkness); // don't put the last seperator if (i == 4) continue; - var sep:FreeplayLetter = new FreeplayLetter((i * 80) + 60, 20); + var sep:FreeplayLetter = new FreeplayLetter((i * 80) + 55, 20); sep.animation.play("seperator"); + sep.color = letter.color.getDarkened(darkness); add(sep); } From f460af1ba034042df9fe81f841213ec27d766856 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 6 Aug 2023 17:06:07 -0400 Subject: [PATCH 10/53] positioning stuff --- source/funkin/freeplayStuff/LetterSort.hx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index bfc8c4a70..44261bee1 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -33,7 +33,9 @@ class LetterSort extends FlxTypedSpriteGroup letters.push(letter); - if (i == 2) letter.scale.x = letter.scale.y = 1.2; + if (i != 2) letter.scale.x = letter.scale.y = 0.8; + else + letter.scale.x = letter.scale.y = 1.1; var darkness:Float = Math.abs(i - 2) / 6; From 11ffc6223893ef676fd17f0401c6c812a83ab77e Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 6 Aug 2023 22:20:18 -0400 Subject: [PATCH 11/53] new letters --- assets | 2 +- source/funkin/FreeplayState.hx | 3 ++ source/funkin/Paths.hx | 4 +- source/funkin/freeplayStuff/LetterSort.hx | 56 ++++++++++++++++------- 4 files changed, 46 insertions(+), 19 deletions(-) diff --git a/assets b/assets index 7bc9407e0..f6d6e839a 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 7bc9407e0e8141a643605ff4514ba63169cc41e2 +Subproject commit f6d6e839a86208279bf92e0b07b8c02b25913947 diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 5ddd47432..277db9873 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -1026,7 +1026,10 @@ class DifficultySelector extends FlxSprite whiteShader.colorSet = true; + scale.x = scale.y = 0.5; + new FlxTimer().start(2 / 24, function(tmr) { + scale.x = scale.y = 1; whiteShader.colorSet = false; updateHitbox(); }); diff --git a/source/funkin/Paths.hx b/source/funkin/Paths.hx index c8c9c79b7..07a15dae1 100644 --- a/source/funkin/Paths.hx +++ b/source/funkin/Paths.hx @@ -49,9 +49,9 @@ class Paths return getPath(file, type, library); } - public static inline function animateAtlas(path:String, library:String) + public static inline function animateAtlas(path:String, ?library:String) { - return getLibraryPathForce('images/$path', library); + return getLibraryPath('images/$path', library); } inline static public function txt(key:String, ?library:String) diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index 44261bee1..b02eb0a92 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -7,6 +7,8 @@ import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import flixel.tweens.FlxTween; import flixel.tweens.FlxEase; import flixel.util.FlxColor; +import flixel.util.FlxTimer; +import funkin.graphics.adobeanimate.FlxAtlasSprite; class LetterSort extends FlxTypedSpriteGroup { @@ -16,11 +18,14 @@ class LetterSort extends FlxTypedSpriteGroup public var changeSelectionCallback:String->Void; + var leftArrow:FreeplayLetter; + var rightArrow:FreeplayLetter; + public function new(x, y) { super(x, y); - var leftArrow:FreeplayLetter = new FreeplayLetter(-20, 20); + leftArrow = new FreeplayLetter(-20, 15); leftArrow.animation.play("arrow"); leftArrow.flipX = true; add(leftArrow); @@ -50,7 +55,7 @@ class LetterSort extends FlxTypedSpriteGroup add(sep); } - var rightArrow:FreeplayLetter = new FreeplayLetter(380, 20); + rightArrow = new FreeplayLetter(380, leftArrow.y); rightArrow.animation.play("arrow"); add(rightArrow); @@ -67,6 +72,21 @@ class LetterSort extends FlxTypedSpriteGroup public function changeSelection(diff:Int = 0) { + if (diff < 0) + { + leftArrow.offset.x = 3; + new FlxTimer().start(2 / 24, function(_) { + leftArrow.offset.x = 0; + }); + } + else if (diff > 0) + { + rightArrow.offset.x = -3; + new FlxTimer().start(2 / 24, function(_) { + rightArrow.offset.x = 0; + }); + } + curSelection += diff; if (curSelection < 0) curSelection = letters.length - 1; if (curSelection >= letters.length) curSelection = 0; @@ -78,7 +98,7 @@ class LetterSort extends FlxTypedSpriteGroup } } -class FreeplayLetter extends FlxSprite +class FreeplayLetter extends FlxAtlasSprite { public var arr:Array = []; @@ -88,26 +108,30 @@ class FreeplayLetter extends FlxSprite public function new(x:Float, y:Float, ?letterInd:Int) { - super(x, y); - frames = Paths.getSparrowAtlas("freeplay/letterStuff"); + super(x, y, Paths.animateAtlas("freeplay/sortedLetters")); + // frames = Paths.getSparrowAtlas("freeplay/letterStuff"); + // this.anim.play("AB"); + // trace(this.anim.symbolDictionary); - var alphabet:String = "abcdefghijklmnopqrstuvwxyz"; - arr = alphabet.split(""); + var alphabet:String = "AB-CD-EH-I L-MN-OR-s-t-UZ"; + arr = alphabet.split("-"); arr.insert(0, "ALL"); - arr.insert(0, "#"); arr.insert(0, "fav"); + arr.insert(0, "#"); - for (str in arr) - { - animation.addByPrefix(str, str + " "); // string followed by a space! intentional! - } + // trace(arr); - animation.addByPrefix("arrow", "mini arrow"); - animation.addByPrefix("seperator", "seperator"); + // for (str in arr) + // { + // animation.addByPrefix(str, str + " "); // string followed by a space! intentional! + // } + + // animation.addByPrefix("arrow", "mini arrow"); + // animation.addByPrefix("seperator", "seperator"); if (letterInd != null) { - animation.play(arr[letterInd]); + this.anim.play(arr[letterInd]); curLetter = letterInd; } } @@ -119,6 +143,6 @@ class FreeplayLetter extends FlxSprite if (curLetter < 0) curLetter = arr.length - 1; if (curLetter >= arr.length) curLetter = 0; - animation.play(arr[curLetter]); + this.anim.play(arr[curLetter]); } } From c2f46309ab05f9fb025f688583018565730133fe Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 6 Aug 2023 22:54:55 -0400 Subject: [PATCH 12/53] arrow and seperator back in --- assets | 2 +- source/funkin/freeplayStuff/LetterSort.hx | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/assets b/assets index f6d6e839a..b3fec7399 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit f6d6e839a86208279bf92e0b07b8c02b25913947 +Subproject commit b3fec73999ce576d009f70b345f19da6b5f0f82a diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index b02eb0a92..278500da8 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -10,7 +10,7 @@ import flixel.util.FlxColor; import flixel.util.FlxTimer; import funkin.graphics.adobeanimate.FlxAtlasSprite; -class LetterSort extends FlxTypedSpriteGroup +class LetterSort extends FlxTypedSpriteGroup { public var letters:Array = []; @@ -18,15 +18,15 @@ class LetterSort extends FlxTypedSpriteGroup public var changeSelectionCallback:String->Void; - var leftArrow:FreeplayLetter; - var rightArrow:FreeplayLetter; + var leftArrow:FlxSprite; + var rightArrow:FlxSprite; public function new(x, y) { super(x, y); - leftArrow = new FreeplayLetter(-20, 15); - leftArrow.animation.play("arrow"); + leftArrow = new FlxSprite(-20, 15).loadGraphic(Paths.image("freeplay/miniArrow")); + // leftArrow.animation.play("arrow"); leftArrow.flipX = true; add(leftArrow); @@ -49,14 +49,15 @@ class LetterSort extends FlxTypedSpriteGroup // don't put the last seperator if (i == 4) continue; - var sep:FreeplayLetter = new FreeplayLetter((i * 80) + 55, 20); - sep.animation.play("seperator"); + var sep:FlxSprite = new FlxSprite((i * 80) + 55, 20).loadGraphic(Paths.image("freeplay/seperator")); + // sep.animation.play("seperator"); sep.color = letter.color.getDarkened(darkness); add(sep); } - rightArrow = new FreeplayLetter(380, leftArrow.y); - rightArrow.animation.play("arrow"); + rightArrow = new FlxSprite(380, 15).loadGraphic(Paths.image("freeplay/miniArrow")); + + // rightArrow.animation.play("arrow"); add(rightArrow); changeSelection(0); From e618fbc64f99b9d306a9fb2a07886892180a07ab Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 7 Aug 2023 12:33:12 -0400 Subject: [PATCH 13/53] bouncing thingie --- source/funkin/freeplayStuff/LetterSort.hx | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index 278500da8..68eeeab33 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -33,6 +33,8 @@ class LetterSort extends FlxTypedSpriteGroup for (i in 0...5) { var letter:FreeplayLetter = new FreeplayLetter(i * 80, 0, i); + letter.x += 50; + letter.y += 50; letter.ogY = y; add(letter); @@ -40,7 +42,10 @@ class LetterSort extends FlxTypedSpriteGroup if (i != 2) letter.scale.x = letter.scale.y = 0.8; else - letter.scale.x = letter.scale.y = 1.1; + { + // letter.x += 10; + // letter.scale.x = letter.scale.y = 1.1; + } var darkness:Float = Math.abs(i - 2) / 6; @@ -89,11 +94,11 @@ class LetterSort extends FlxTypedSpriteGroup } curSelection += diff; - if (curSelection < 0) curSelection = letters.length - 1; - if (curSelection >= letters.length) curSelection = 0; + if (curSelection < 0) curSelection = letters[0].arr.length - 1; + if (curSelection >= letters[0].arr.length) curSelection = 0; for (letter in letters) - letter.changeLetter(diff, curSelection); + letter.changeLetter(diff, curSelection + 2); if (changeSelectionCallback != null) changeSelectionCallback(letters[2].arr[letters[2].curLetter]); // bullshit and long lol! } @@ -132,7 +137,8 @@ class FreeplayLetter extends FlxAtlasSprite if (letterInd != null) { - this.anim.play(arr[letterInd]); + this.anim.play(arr[letterInd] + " move"); + this.anim.pause(); curLetter = letterInd; } } @@ -144,6 +150,8 @@ class FreeplayLetter extends FlxAtlasSprite if (curLetter < 0) curLetter = arr.length - 1; if (curLetter >= arr.length) curLetter = 0; - this.anim.play(arr[curLetter]); + this.anim.play(arr[curLetter] + " move"); + if (curSelection != curLetter) this.anim.pause(); + updateHitbox(); } } From ce2e6a399315ac21790c8acb9e5d7252fc931340 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 7 Aug 2023 15:42:38 -0400 Subject: [PATCH 14/53] proper letter stuff --- source/funkin/freeplayStuff/LetterSort.hx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index 68eeeab33..ed3ca7312 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -150,7 +150,18 @@ class FreeplayLetter extends FlxAtlasSprite if (curLetter < 0) curLetter = arr.length - 1; if (curLetter >= arr.length) curLetter = 0; - this.anim.play(arr[curLetter] + " move"); + var animName:String = arr[curLetter] + " move"; + switch (arr[curLetter]) + { + case "I L": + animName = "IL move"; + case "s": + animName = "S move"; + case "t": + animName = "T move"; + } + + this.anim.play(animName); if (curSelection != curLetter) this.anim.pause(); updateHitbox(); } From c469d4b7c07e224f685202ddf3308a2aff1093d1 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 7 Aug 2023 16:01:22 -0400 Subject: [PATCH 15/53] regexp filter --- source/funkin/FreeplayState.hx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 277db9873..bc3d9bbce 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -393,7 +393,7 @@ class FreeplayState extends MusicBeatSubState case "ALL": generateSongList(null, true); default: - generateSongList({filterType: STARTSWITH, filterData: str}, true); + generateSongList({filterType: REGEXP, filterData: str}, true); } }; @@ -477,6 +477,13 @@ class FreeplayState extends MusicBeatSubState { switch (filterStuff.filterType) { + case REGEXP: + // filterStuff.filterData has a string with the first letter of the sorting range, and the second one + // this creates a filter to return all the songs that start with a letter between those two + var filterRegexp = new EReg("^[" + filterStuff.filterData + "].*", "i"); + tempSongs = tempSongs.filter(str -> { + return filterRegexp.match(str.songName); + }); case STARTSWITH: tempSongs = tempSongs.filter(str -> { return str.songName.toLowerCase().startsWith(filterStuff.filterData); @@ -1045,6 +1052,7 @@ typedef SongFilter = enum abstract FilterType(String) { var STARTSWITH; + var REGEXP; var FAVORITE; var ALL; } From 9c641f9e90fb1b4ba09eaf6d012bbe7b02487913 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 7 Aug 2023 17:26:51 -0400 Subject: [PATCH 16/53] tabbing movement --- source/funkin/freeplayStuff/LetterSort.hx | 59 +++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index ed3ca7312..eb12ecbbe 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -78,8 +78,41 @@ class LetterSort extends FlxTypedSpriteGroup public function changeSelection(diff:Int = 0) { + var ezTimer:Int->FreeplayLetter->Float->Void = function(frameNum:Int, daLetter:FreeplayLetter, offsetNum:Float) { + new FlxTimer().start(frameNum / 24, function(_) { + daLetter.offset.x = offsetNum; + }); + }; + + var positions:Array = [-10, -22, -67, 2, 0]; + if (diff < 0) { + for (index => letter in letters) + { + letter.offset.x = positions[0]; + + new FlxTimer().start(1 / 24, function(_) { + letter.offset.x = positions[1]; + if (index == 0) letter.visible = false; + }); + + new FlxTimer().start(2 / 24, function(_) { + letter.offset.x = positions[2]; + if (index == 0) letter.visible = true; + }); + + if (index == 2) + { + ezTimer(3, letter, 0); + // letter.offset.x = 0; + continue; + } + + ezTimer(3, letter, positions[3]); + ezTimer(4, letter, positions[4]); + } + leftArrow.offset.x = 3; new FlxTimer().start(2 / 24, function(_) { leftArrow.offset.x = 0; @@ -87,6 +120,32 @@ class LetterSort extends FlxTypedSpriteGroup } else if (diff > 0) { + // same timing and functions and shit as the left one... except to the right!! + for (index => letter in letters) + { + letter.offset.x = -positions[0]; + + new FlxTimer().start(1 / 24, function(_) { + letter.offset.x = -positions[1]; + if (index == 4) letter.visible = false; + }); + + new FlxTimer().start(2 / 24, function(_) { + letter.offset.x = -positions[2]; + if (index == 4) letter.visible = true; + }); + + if (index == 2) + { + ezTimer(3, letter, 0); + // letter.offset.x = 0; + continue; + } + + ezTimer(3, letter, -positions[3]); + ezTimer(4, letter, -positions[4]); + } + rightArrow.offset.x = -3; new FlxTimer().start(2 / 24, function(_) { rightArrow.offset.x = 0; From ee7108757b609164379408632e7bd2fdf9cad320 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 7 Aug 2023 17:58:06 -0400 Subject: [PATCH 17/53] proper fav and # symbol move --- source/funkin/freeplayStuff/LetterSort.hx | 48 +++++++++++++++++------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index eb12ecbbe..fc4bf9344 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -14,12 +14,13 @@ class LetterSort extends FlxTypedSpriteGroup { public var letters:Array = []; - var curSelection:Int = 0; + var curSelection:Int = 2; public var changeSelectionCallback:String->Void; var leftArrow:FlxSprite; var rightArrow:FlxSprite; + var grpSeperators:Array = []; public function new(x, y) { @@ -58,6 +59,8 @@ class LetterSort extends FlxTypedSpriteGroup // sep.animation.play("seperator"); sep.color = letter.color.getDarkened(darkness); add(sep); + + grpSeperators.push(sep); } rightArrow = new FlxSprite(380, 15).loadGraphic(Paths.image("freeplay/miniArrow")); @@ -78,16 +81,24 @@ class LetterSort extends FlxTypedSpriteGroup public function changeSelection(diff:Int = 0) { - var ezTimer:Int->FreeplayLetter->Float->Void = function(frameNum:Int, daLetter:FreeplayLetter, offsetNum:Float) { + var ezTimer:Int->FlxSprite->Float->Void = function(frameNum:Int, spr:FlxSprite, offsetNum:Float) { new FlxTimer().start(frameNum / 24, function(_) { - daLetter.offset.x = offsetNum; + spr.offset.x = offsetNum; }); }; - var positions:Array = [-10, -22, -67, 2, 0]; + var positions:Array = [-10, -22, 2, 0]; if (diff < 0) { + for (sep in grpSeperators) + { + ezTimer(0, sep, positions[0]); + ezTimer(1, sep, positions[1]); + ezTimer(2, sep, positions[2]); + ezTimer(3, sep, positions[3]); + } + for (index => letter in letters) { letter.offset.x = positions[0]; @@ -99,7 +110,7 @@ class LetterSort extends FlxTypedSpriteGroup new FlxTimer().start(2 / 24, function(_) { letter.offset.x = positions[2]; - if (index == 0) letter.visible = true; + if (index == 0.) letter.visible = true; }); if (index == 2) @@ -110,7 +121,6 @@ class LetterSort extends FlxTypedSpriteGroup } ezTimer(3, letter, positions[3]); - ezTimer(4, letter, positions[4]); } leftArrow.offset.x = 3; @@ -120,19 +130,27 @@ class LetterSort extends FlxTypedSpriteGroup } else if (diff > 0) { + for (sep in grpSeperators) + { + ezTimer(0, sep, -positions[0]); + ezTimer(1, sep, -positions[1]); + ezTimer(2, sep, -positions[2]); + ezTimer(3, sep, -positions[3]); + } // same timing and functions and shit as the left one... except to the right!! + for (index => letter in letters) { letter.offset.x = -positions[0]; new FlxTimer().start(1 / 24, function(_) { letter.offset.x = -positions[1]; - if (index == 4) letter.visible = false; + if (index == 0) letter.visible = false; }); new FlxTimer().start(2 / 24, function(_) { letter.offset.x = -positions[2]; - if (index == 4) letter.visible = true; + if (index == 0) letter.visible = true; }); if (index == 2) @@ -143,7 +161,6 @@ class LetterSort extends FlxTypedSpriteGroup } ezTimer(3, letter, -positions[3]); - ezTimer(4, letter, -positions[4]); } rightArrow.offset.x = -3; @@ -157,7 +174,7 @@ class LetterSort extends FlxTypedSpriteGroup if (curSelection >= letters[0].arr.length) curSelection = 0; for (letter in letters) - letter.changeLetter(diff, curSelection + 2); + letter.changeLetter(diff, curSelection); if (changeSelectionCallback != null) changeSelectionCallback(letters[2].arr[letters[2].curLetter]); // bullshit and long lol! } @@ -210,6 +227,7 @@ class FreeplayLetter extends FlxAtlasSprite if (curLetter >= arr.length) curLetter = 0; var animName:String = arr[curLetter] + " move"; + switch (arr[curLetter]) { case "I L": @@ -221,7 +239,13 @@ class FreeplayLetter extends FlxAtlasSprite } this.anim.play(animName); - if (curSelection != curLetter) this.anim.pause(); - updateHitbox(); + if (curSelection != curLetter) + { + trace(animName); + trace(curLetter); + trace(curSelection); + this.anim.pause(); + } + // updateHitbox(); } } From 8052773f922e28e7443581f4a57829fd898374cf Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 7 Aug 2023 17:58:55 -0400 Subject: [PATCH 18/53] comment --- source/funkin/freeplayStuff/LetterSort.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index fc4bf9344..3fbbc12c4 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -14,6 +14,7 @@ class LetterSort extends FlxTypedSpriteGroup { public var letters:Array = []; + // starts at 2, cuz that's the middle letter on start (accounting for fav and #, it should begin at ALL filter) var curSelection:Int = 2; public var changeSelectionCallback:String->Void; From 92f45d93aa6aa23a61d3ed20b26b0b389e9775cb Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 8 Aug 2023 14:35:07 -0400 Subject: [PATCH 19/53] pixel icons --- assets | 2 +- source/funkin/FreeplayState.hx | 1 + source/funkin/freeplayStuff/SongMenuItem.hx | 51 +++++++++++++++++---- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/assets b/assets index b3fec7399..b0bd61a2f 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit b3fec73999ce576d009f70b345f19da6b5f0f82a +Subproject commit b0bd61a2f0fa9be900a236f20662601bd4d81a1d diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index bc3d9bbce..82629dba5 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -530,6 +530,7 @@ class FreeplayState extends MusicBeatSubState for (i in 0...tempSongs.length) { var funnyMenu:SongMenuItem = new SongMenuItem(FlxG.width, 0, tempSongs[i].songName); + if (tempSongs[i].songCharacter != null) funnyMenu.setCharacter(tempSongs[i].songCharacter); funnyMenu.onConfirm = capsuleOnConfirmDefault; funnyMenu.y = funnyMenu.intendedY(i + 1) + 10; funnyMenu.targetPos.x = funnyMenu.x; diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 91a7c188c..a11538791 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -12,6 +12,7 @@ import flixel.util.FlxTimer; class SongMenuItem extends FlxSpriteGroup { var capsule:FlxSprite; + var pixelIcon:FlxSprite; public var selected(default, set):Bool = false; @@ -28,7 +29,7 @@ class SongMenuItem extends FlxSpriteGroup public var onConfirm:Void->Void; - public function new(x:Float, y:Float, song:String) + public function new(x:Float, y:Float, song:String, ?character:String) { super(x, y); @@ -46,6 +47,13 @@ class SongMenuItem extends FlxSpriteGroup songText.color = 0xFF43C1EA; add(songText); + pixelIcon = new FlxSprite(80, 35); + pixelIcon.makeGraphic(32, 32, 0x00000000); + pixelIcon.antialiasing = false; + add(pixelIcon); + + if (character != null) setCharacter(character); + favIcon = new FlxSprite(400, 40); favIcon.frames = Paths.getSparrowAtlas('freeplay/favHeart'); favIcon.animation.addByPrefix('fav', "favorite heart", 24, false); @@ -56,6 +64,31 @@ class SongMenuItem extends FlxSpriteGroup selected = selected; // just to kickstart the set_selected } + /** + * [Description] + * @param char Should be songCharacter, and will get translated to the correct path via switch + */ + public function setCharacter(char:String) + { + var charPath:String = "freeplay/icons/"; + + switch (char) + { + case "monster-christmas": + charPath += "monsterpixel"; + case "mom": + charPath += "mommypixel"; + case "dad": + charPath += "daddypixel"; + default: + charPath += char + "pixel"; + } + + pixelIcon.loadGraphic(Paths.image(charPath)); + pixelIcon.setGraphicSize(Std.int(pixelIcon.width * 2)); + // pixelIcon.updateHitbox(); + } + var frameInTicker:Float = 0; var frameInTypeBeat:Int = 0; @@ -102,12 +135,12 @@ class SongMenuItem extends FlxSpriteGroup { frameInTicker = 0; - scale.x = xFrames[frameInTypeBeat]; - scale.y = 1 / xFrames[frameInTypeBeat]; + capsule.scale.x = xFrames[frameInTypeBeat]; + capsule.scale.y = 1 / xFrames[frameInTypeBeat]; x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameInTypeBeat, xPosLerpLol.length - 1))]; - scale.x *= realScaled; - scale.y *= realScaled; + capsule.scale.x *= realScaled; + capsule.scale.y *= realScaled; frameInTypeBeat += 1; } @@ -121,12 +154,12 @@ class SongMenuItem extends FlxSpriteGroup { frameOutTicker = 0; - scale.x = xFrames[frameOutTypeBeat]; - scale.y = 1 / xFrames[frameOutTypeBeat]; + capsule.scale.x = xFrames[frameOutTypeBeat]; + capsule.scale.y = 1 / xFrames[frameOutTypeBeat]; x = FlxG.width * xPosOutLerpLol[Std.int(Math.min(frameOutTypeBeat, xPosOutLerpLol.length - 1))]; - scale.x *= realScaled; - scale.y *= realScaled; + capsule.scale.x *= realScaled; + capsule.scale.y *= realScaled; frameOutTypeBeat += 1; } From c3d30f6711c849c1221fd443e73920e4e74928d0 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 9 Aug 2023 02:47:22 -0400 Subject: [PATCH 20/53] polish / optimize in progress --- source/funkin/FreeplayState.hx | 49 ++++++-------------- source/funkin/freeplayStuff/LetterSort.hx | 9 +--- source/funkin/freeplayStuff/SongMenuItem.hx | 51 ++++++++++++++++++--- 3 files changed, 58 insertions(+), 51 deletions(-) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 82629dba5..16c4d5233 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -420,7 +420,7 @@ class FreeplayState extends MusicBeatSubState grpTxtScrolls.visible = true; }); - generateSongList(); + generateSongList(null, false); // FlxG.sound.playMusic(Paths.music('title'), 0); // FlxG.sound.music.fadeIn(2, 0, 0.8); @@ -468,7 +468,10 @@ class FreeplayState extends MusicBeatSubState { curSelected = 1; - grpCapsules.clear(); + for (cap in grpCapsules.members) + cap.kill(); + + // grpCapsules.clear(); // var regexp:EReg = regexp; var tempSongs:Array = songs; @@ -499,23 +502,8 @@ class FreeplayState extends MusicBeatSubState } } - // if (regexp != null) - // tempSongs = songs.filter(item -> regexp.match(item.songName)); - - // tempSongs.sort(function(a, b):Int - // { - // var tempA = a.songName.toUpperCase(); - // var tempB = b.songName.toUpperCase(); - - // if (tempA < tempB) - // return -1; - // else if (tempA > tempB) - // return 1; - // else - // return 0; - // }); - - var randomCapsule:SongMenuItem = new SongMenuItem(FlxG.width, 0, "Random"); + var randomCapsule:SongMenuItem = grpCapsules.recycle(SongMenuItem); + randomCapsule.init(FlxG.width, 0, "Random"); randomCapsule.onConfirm = function() { trace("RANDOM SELECTED"); }; @@ -529,7 +517,8 @@ class FreeplayState extends MusicBeatSubState for (i in 0...tempSongs.length) { - var funnyMenu:SongMenuItem = new SongMenuItem(FlxG.width, 0, tempSongs[i].songName); + var funnyMenu:SongMenuItem = grpCapsules.recycle(SongMenuItem); + funnyMenu.init(FlxG.width, 0, tempSongs[i].songName); if (tempSongs[i].songCharacter != null) funnyMenu.setCharacter(tempSongs[i].songCharacter); funnyMenu.onConfirm = capsuleOnConfirmDefault; funnyMenu.y = funnyMenu.intendedY(i + 1) + 10; @@ -540,20 +529,12 @@ class FreeplayState extends MusicBeatSubState funnyMenu.favIcon.visible = tempSongs[i].isFav; // fp.updateScore(0); - funnyMenu.initJumpIn(Math.min(i, 4), force); + + if (i < 8) funnyMenu.initJumpIn(Math.min(i, 4), force); + else + funnyMenu.forcePosition(); grpCapsules.add(funnyMenu); - - var songText:Alphabet = new Alphabet(0, (70 * i) + 30, tempSongs[i].songName, true, false); - songText.x += 100; - songText.isMenuItem = true; - songText.targetY = i; - - // grpSongs.add(songText); - - // songText.x += 40; - // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! - // songText.screenCenter(X); } changeSelection(); @@ -958,8 +939,6 @@ class FreeplayState extends MusicBeatSubState { // fp.updateScore(12345); - NGio.logEvent('Fresh'); - // NGio.logEvent('Fresh'); FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); @@ -979,8 +958,6 @@ class FreeplayState extends MusicBeatSubState // FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0); #end - var bullShit:Int = 0; - for (index => capsule in grpCapsules.members) { index += 1; diff --git a/source/funkin/freeplayStuff/LetterSort.hx b/source/funkin/freeplayStuff/LetterSort.hx index 3fbbc12c4..e6d923c90 100644 --- a/source/funkin/freeplayStuff/LetterSort.hx +++ b/source/funkin/freeplayStuff/LetterSort.hx @@ -38,16 +38,12 @@ class LetterSort extends FlxTypedSpriteGroup letter.x += 50; letter.y += 50; letter.ogY = y; + // letter.visible = false; add(letter); letters.push(letter); if (i != 2) letter.scale.x = letter.scale.y = 0.8; - else - { - // letter.x += 10; - // letter.scale.x = letter.scale.y = 1.1; - } var darkness:Float = Math.abs(i - 2) / 6; @@ -242,9 +238,6 @@ class FreeplayLetter extends FlxAtlasSprite this.anim.play(animName); if (curSelection != curLetter) { - trace(animName); - trace(curLetter); - trace(curSelection); this.anim.pause(); } // updateHitbox(); diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index a11538791..3a1dfacbf 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -50,6 +50,7 @@ class SongMenuItem extends FlxSpriteGroup pixelIcon = new FlxSprite(80, 35); pixelIcon.makeGraphic(32, 32, 0x00000000); pixelIcon.antialiasing = false; + pixelIcon.active = false; add(pixelIcon); if (character != null) setCharacter(character); @@ -64,6 +65,17 @@ class SongMenuItem extends FlxSpriteGroup selected = selected; // just to kickstart the set_selected } + public function init(x:Float, y:Float, song:String, ?character:String) + { + this.x = x; + this.y = y; + this.songTitle = song; + songText.text = this.songTitle; + if (character != null) setCharacter(character); + + selected = selected; + } + /** * [Description] * @param char Should be songCharacter, and will get translated to the correct path via switch @@ -103,6 +115,8 @@ class SongMenuItem extends FlxSpriteGroup public function initJumpIn(maxTimer:Float, ?force:Bool):Void { + frameInTypeBeat = 0; + new FlxTimer().start((1 / 24) * maxTimer, function(doShit) { doJumpIn = true; }); @@ -111,18 +125,41 @@ class SongMenuItem extends FlxSpriteGroup doLerp = true; }); - if (!force) + if (force) { - new FlxTimer().start(((0.20 * maxTimer) / (1 + maxTimer)) + 0.75, function(swagShi) { + alpha = 1; + songText.visible = true; + } + else + { + new FlxTimer().start((xFrames.length / 24) * 2.5, function(_) { songText.visible = true; alpha = 1; }); } - else - { - songText.visible = true; - alpha = 1; - } + } + + public function forcePosition() + { + alpha = 1; + doLerp = true; + doJumpIn = false; + doJumpOut = false; + + frameInTypeBeat = xFrames.length; + frameOutTypeBeat = 0; + + capsule.scale.x = xFrames[frameInTypeBeat - 1]; + capsule.scale.y = 1 / xFrames[frameInTypeBeat - 1]; + // x = FlxG.width * xPosLerpLol[Std.int(Math.min(frameInTypeBeat - 1, xPosLerpLol.length - 1))]; + + x = targetPos.x; + y = targetPos.y; + + capsule.scale.x *= realScaled; + capsule.scale.y *= realScaled; + + songText.visible = true; } override function update(elapsed:Float) From 97267d18b9ccd56eeeea1d646d03d43ee43e45b9 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 9 Aug 2023 03:03:58 -0400 Subject: [PATCH 21/53] freeplay wrapping fix --- source/funkin/FreeplayState.hx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 16c4d5233..9d0b346b3 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -944,14 +944,24 @@ class FreeplayState extends MusicBeatSubState curSelected += change; - if (curSelected < 0) curSelected = grpCapsules.members.length - 1; - if (curSelected >= grpCapsules.members.length) curSelected = 0; + if (curSelected < 0) curSelected = grpCapsules.countLiving() - 1; + if (curSelected >= grpCapsules.countLiving()) curSelected = 0; // selector.y = (70 * curSelected) + 30; // intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); - intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); - intendedCompletion = Highscore.getCompletion(songs[curSelected].songName, curDifficulty); + + if (songs[curSelected] != null) + { + intendedScore = Highscore.getScore(songs[curSelected].songName, curDifficulty); + intendedCompletion = Highscore.getCompletion(songs[curSelected].songName, curDifficulty); + } + else + { + intendedScore = 0; + intendedCompletion = 0; + } + // lerpScore = 0; #if PRELOAD_ALL @@ -971,7 +981,7 @@ class FreeplayState extends MusicBeatSubState if (index < curSelected) capsule.targetPos.y -= 100; // another 100 for good measure } - if (grpCapsules.members.length > 0) grpCapsules.members[curSelected].selected = true; + if (grpCapsules.countLiving() > 0) grpCapsules.members[curSelected].selected = true; } } From 097b5dab46c2f679ee38e2c9a9dce012f3648e45 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 9 Aug 2023 16:15:34 -0400 Subject: [PATCH 22/53] freeplay optimize fix --- art | 2 +- source/funkin/FreeplayState.hx | 46 ++++++++++++++++++---------------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/art b/art index 1656bea53..bfb99631f 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit 1656bea5370c65879aaeb323e329f403c78071c5 +Subproject commit bfb99631f899493b599e1dee49a029b8ec18f16a diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 9d0b346b3..7aedb5ae2 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -355,6 +355,28 @@ class FreeplayState extends MusicBeatSubState txtCompletion.visible = false; add(txtCompletion); + var letterSort:LetterSort = new LetterSort(400, 75); + add(letterSort); + letterSort.visible = false; + + exitMovers.set([letterSort], + { + y: -100, + speed: 0.3 + }); + + letterSort.changeSelectionCallback = (str) -> { + switch (str) + { + case "fav": + generateSongList({filterType: FAVORITE}, true); + case "ALL": + // generateSongList(null, true); + default: + generateSongList({filterType: REGEXP, filterData: str}, true); + } + }; + exitMovers.set([fp, txtCompletion, fnfHighscoreSpr], { x: FlxG.width, @@ -370,33 +392,14 @@ class FreeplayState extends MusicBeatSubState add(diffSelLeft); add(diffSelRight); + letterSort.visible = true; + exitMovers.set([diffSelLeft, diffSelRight], { x: -diffSelLeft.width * 2, speed: 0.26 }); - var letterSort:LetterSort = new LetterSort(400, 75); - add(letterSort); - - exitMovers.set([letterSort], - { - y: -100, - speed: 0.3 - }); - - letterSort.changeSelectionCallback = (str) -> { - switch (str) - { - case "fav": - generateSongList({filterType: FAVORITE}, true); - case "ALL": - generateSongList(null, true); - default: - generateSongList({filterType: REGEXP, filterData: str}, true); - } - }; - new FlxTimer().start(1 / 24, function(handShit) { fnfHighscoreSpr.visible = true; fnfFreeplay.visible = true; @@ -413,7 +416,6 @@ class FreeplayState extends MusicBeatSubState }); pinkBack.color = 0xFFffd863; - // fnfFreeplay.visible = true; bgDad.visible = true; orangeBackShit.visible = true; alsoOrangeLOL.visible = true; From b96c0e625697d6880b8fbac1f28913495696451f Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 9 Aug 2023 19:34:19 -0400 Subject: [PATCH 23/53] album artist stuff --- art | 2 +- assets | 2 +- source/funkin/FreeplayState.hx | 53 +++++++++++++++++++++++++++++++++- 3 files changed, 54 insertions(+), 3 deletions(-) diff --git a/art b/art index bfb99631f..f4acf8d6e 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit bfb99631f899493b599e1dee49a029b8ec18f16a +Subproject commit f4acf8d6e1981ea4d1a28e7e512e335b2a4f261f diff --git a/assets b/assets index b0bd61a2f..37fa62d8e 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit b0bd61a2f0fa9be900a236f20662601bd4d81a1d +Subproject commit 37fa62d8e88b7a7023e689ef52d8a5c527cd4618 diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 7aedb5ae2..5e3e896e2 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -38,6 +38,7 @@ import funkin.play.PlayStatePlaylist; import funkin.play.song.Song; import lime.app.Future; import lime.utils.Assets; +import funkin.graphics.adobeanimate.FlxAtlasSprite; class FreeplayState extends MusicBeatSubState { @@ -312,6 +313,40 @@ class FreeplayState extends MusicBeatSubState grpDifficulties.group.members[curDifficulty].visible = true; + var albumArt:FlxAtlasSprite = new FlxAtlasSprite(640, 360, Paths.animateAtlas("freeplay/albumRoll")); + albumArt.visible = false; + add(albumArt); + + exitMovers.set([albumArt], + { + x: FlxG.width, + speed: 0.4, + wait: 0 + }); + + var albumTitle:FlxSprite = new FlxSprite(947, 491).loadGraphic(Paths.image('freeplay/albumTitle-fnfvol1')); + var albumArtist:FlxSprite = new FlxSprite(1010, 607).loadGraphic(Paths.image('freeplay/albumArtist-kawaisprite')); + + albumTitle.visible = false; + albumArtist.visible = false; + + exitMovers.set([albumTitle], + { + x: FlxG.width, + speed: 0.2, + wait: 0.1 + }); + + exitMovers.set([albumArtist], + { + x: FlxG.width * 1.1, + speed: 0.2, + wait: 0.2 + }); + + add(albumTitle); + add(albumArtist); + var overhangStuff:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 64, FlxColor.BLACK); overhangStuff.y -= overhangStuff.height; add(overhangStuff); @@ -371,7 +406,7 @@ class FreeplayState extends MusicBeatSubState case "fav": generateSongList({filterType: FAVORITE}, true); case "ALL": - // generateSongList(null, true); + generateSongList(null, true); default: generateSongList({filterType: REGEXP, filterData: str}, true); } @@ -384,6 +419,22 @@ class FreeplayState extends MusicBeatSubState }); dj.onIntroDone.add(function() { + // when boyfriend hits dat shiii + // + albumArt.visible = true; + albumArt.anim.play(""); + albumArt.anim.onComplete = function() { + albumArt.anim.pause(); + }; + + new FlxTimer().start(1, function(_) { + albumTitle.visible = true; + }); + + new FlxTimer().start(35 / 24, function(_) { + albumArtist.visible = true; + }); + FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut}); var diffSelLeft = new DifficultySelector(20, grpDifficulties.y - 10, false, controls); From 4468e2a5a587e7b0f5b867aa3f2e165d276a224f Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 2 Aug 2023 18:08:49 -0400 Subject: [PATCH 24/53] Fixed several bugs with Play State (mostly restarting the song) --- source/funkin/play/PlayState.hx | 10 ++++++++++ source/funkin/play/character/BaseCharacter.hx | 1 + 2 files changed, 11 insertions(+) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index ce72fa56c..3722d3797 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -820,6 +820,16 @@ class PlayState extends MusicBeatSubState FlxG.watch.addQuick('bfAnim', currentStage.getBoyfriend().getCurrentAnimation()); } + if (currentStage.getBoyfriend() != null) + { + FlxG.watch.addQuick('bfCameraFocus', currentStage.getBoyfriend().cameraFocusPoint); + } + + if (currentStage.getDad() != null) + { + FlxG.watch.addQuick('dadCameraFocus', currentStage.getDad().cameraFocusPoint); + } + // TODO: Add a song event for Handle GF dance speed. // Handle player death. diff --git a/source/funkin/play/character/BaseCharacter.hx b/source/funkin/play/character/BaseCharacter.hx index 30b549fd3..a9be44e7f 100644 --- a/source/funkin/play/character/BaseCharacter.hx +++ b/source/funkin/play/character/BaseCharacter.hx @@ -235,6 +235,7 @@ class BaseCharacter extends Bopper // Then reapply animOffsets... // applyAnimationOffsets(getCurrentAnimation()); + // Make sure we are playing the idle animation this.dance(true); // Force to avoid the old animation playing with the wrong offset at the start of the song. // Make sure we are playing the idle animation // ...then update the hitbox so that this.width and this.height are correct. From 2f56c74060e4f906e482329d2bbc27f834f9358d Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Thu, 3 Aug 2023 12:41:54 -0400 Subject: [PATCH 25/53] Fix HTML typing issue --- source/funkin/input/PreciseInputManager.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/funkin/input/PreciseInputManager.hx b/source/funkin/input/PreciseInputManager.hx index 6217b2fe7..4cce0964d 100644 --- a/source/funkin/input/PreciseInputManager.hx +++ b/source/funkin/input/PreciseInputManager.hx @@ -181,7 +181,7 @@ class PreciseInputManager extends FlxKeyManager updateKeyStates(key, true); - if (getInputByKey(key) ?.justPressed ?? false) + if (getInputByKey(key)?.justPressed ?? false) { onInputPressed.dispatch( { @@ -203,7 +203,7 @@ class PreciseInputManager extends FlxKeyManager updateKeyStates(key, false); - if (getInputByKey(key) ?.justReleased ?? false) + if (getInputByKey(key)?.justReleased ?? false) { onInputReleased.dispatch( { @@ -264,7 +264,7 @@ class PreciseInputList extends FlxKeyList { for (key in getKeysForDir(noteDir)) { - if (check(_preciseInputManager.getInputByKey(key) ?.ID)) return true; + if (check(_preciseInputManager.getInputByKey(key)?.ID)) return true; } return false; } From 4f0e9614e0a881025a48bb13f40941b9cd2b6d59 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Thu, 3 Aug 2023 22:22:29 -0400 Subject: [PATCH 26/53] Fix build issues caused by int64 handling --- source/funkin/play/PlayState.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 3722d3797..2c085513d 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2229,7 +2229,8 @@ class PlayState extends MusicBeatSubState vocals.playerVolume = 1; // Calculate the input latency (do this as late as possible). - var inputLatencyMs:Float = haxe.Int64.toInt(PreciseInputManager.getCurrentTimestamp() - input.timestamp) / 1000.0 / 1000.0; + var currentTimestampNs:Int64 = PreciseInputManager.getCurrentTimestamp(); + var inputLatencyMs:Float = haxe.Int64.toInt(currentTimestampNs - input.timestamp) / Constants.NS_PER_MS; trace('Input: ${daNote.noteData.getDirectionName()} pressed ${inputLatencyMs}ms ago!'); // Get the offset and compensate for input latency. From 5b4a00e893f59949469f1d7e1aed1cb981cab15f Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 4 Aug 2023 11:13:41 -0400 Subject: [PATCH 27/53] Make sure timestamps are consistent with use of Int64. --- source/funkin/play/PlayState.hx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 2c085513d..3722d3797 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2229,8 +2229,7 @@ class PlayState extends MusicBeatSubState vocals.playerVolume = 1; // Calculate the input latency (do this as late as possible). - var currentTimestampNs:Int64 = PreciseInputManager.getCurrentTimestamp(); - var inputLatencyMs:Float = haxe.Int64.toInt(currentTimestampNs - input.timestamp) / Constants.NS_PER_MS; + var inputLatencyMs:Float = haxe.Int64.toInt(PreciseInputManager.getCurrentTimestamp() - input.timestamp) / 1000.0 / 1000.0; trace('Input: ${daNote.noteData.getDirectionName()} pressed ${inputLatencyMs}ms ago!'); // Get the offset and compensate for input latency. From 11b1ca510075dc92c82d2a369d96a0c777f6237f Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 4 Aug 2023 11:18:00 -0400 Subject: [PATCH 28/53] Fix bug where pressing ENTER in UI would cause song to try to preview. Fix bug where trying to preview a newly created song would crash. --- source/funkin/play/song/Song.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/play/song/Song.hx b/source/funkin/play/song/Song.hx index d11c7744b..f3fc89a86 100644 --- a/source/funkin/play/song/Song.hx +++ b/source/funkin/play/song/Song.hx @@ -117,7 +117,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry, variations:Array, charts:Map, validScore:Bool = false):Song { - var result:Song = new Song(songId); + var result:Song = new Song(songId, true); result._metadata.clear(); for (meta in metadata) From 5fa9c5246fae5e33801e3ab648f248668ebe3f2e Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 4 Aug 2023 12:35:01 -0400 Subject: [PATCH 29/53] Fixed a bug where beat hit events were called multiple times during the conductor --- source/funkin/play/PlayState.hx | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 3722d3797..ce72fa56c 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -820,16 +820,6 @@ class PlayState extends MusicBeatSubState FlxG.watch.addQuick('bfAnim', currentStage.getBoyfriend().getCurrentAnimation()); } - if (currentStage.getBoyfriend() != null) - { - FlxG.watch.addQuick('bfCameraFocus', currentStage.getBoyfriend().cameraFocusPoint); - } - - if (currentStage.getDad() != null) - { - FlxG.watch.addQuick('dadCameraFocus', currentStage.getDad().cameraFocusPoint); - } - // TODO: Add a song event for Handle GF dance speed. // Handle player death. From f7bac02ee32a7029395b91a64aed6006805d87fd Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 4 Aug 2023 17:25:13 -0400 Subject: [PATCH 30/53] Fix crashing, broken countdown, broken miss muting in song preview --- source/funkin/play/character/BaseCharacter.hx | 1 - 1 file changed, 1 deletion(-) diff --git a/source/funkin/play/character/BaseCharacter.hx b/source/funkin/play/character/BaseCharacter.hx index a9be44e7f..30b549fd3 100644 --- a/source/funkin/play/character/BaseCharacter.hx +++ b/source/funkin/play/character/BaseCharacter.hx @@ -235,7 +235,6 @@ class BaseCharacter extends Bopper // Then reapply animOffsets... // applyAnimationOffsets(getCurrentAnimation()); - // Make sure we are playing the idle animation this.dance(true); // Force to avoid the old animation playing with the wrong offset at the start of the song. // Make sure we are playing the idle animation // ...then update the hitbox so that this.width and this.height are correct. From a8e39d90e8df855d90b9b384b51ab4d746b71e5f Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 11 Aug 2023 05:20:25 -0400 Subject: [PATCH 31/53] temp rank stuff in progress --- assets | 2 +- hmm.json | 8 ++++---- source/funkin/freeplayStuff/SongMenuItem.hx | 21 +++++++++++++++++++-- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/assets b/assets index 37fa62d8e..abbbc89a8 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 37fa62d8e88b7a7023e689ef52d8a5c527cd4618 +Subproject commit abbbc89a83f48317568b5b25eaf831ae16f88a8c diff --git a/hmm.json b/hmm.json index aa032fb75..85c83ea6d 100644 --- a/hmm.json +++ b/hmm.json @@ -4,14 +4,14 @@ "name": "discord_rpc", "type": "git", "dir": null, - "ref": "2d83fa863ef0c1eace5f1cf67c3ac315d1a3a8a5", + "ref": "2d83fa8", "url": "https://github.com/Aidan63/linc_discord-rpc" }, { "name": "flixel", "type": "git", "dir": null, - "ref": "32cee07a0e5f21e590a4b21234603b2cd5898b10", + "ref": "32cee07a", "url": "https://github.com/EliteMasterEric/flixel" }, { @@ -32,7 +32,7 @@ "name": "flxanimate", "type": "git", "dir": null, - "ref": "a9136359271cae6ea3016b7fd9023c5c42562933", + "ref": "a913635", "url": "https://github.com/ninjamuffin99/flxanimate" }, { @@ -75,7 +75,7 @@ "name": "hxCodec", "type": "git", "dir": null, - "ref": "c8c47e706ad82a423783006ed901b6d93c89a421", + "ref": "c8c47e7", "url": "https://github.com/polybiusproxy/hxCodec" }, { diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 3a1dfacbf..184846805 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -20,6 +20,9 @@ class SongMenuItem extends FlxSpriteGroup public var songText:FlxText; public var favIcon:FlxSprite; + public var ranking:FlxSprite; + + var ranks:Array = ["fail", "average", "great", "excellent", "perfect"]; public var targetPos:FlxPoint = new FlxPoint(); public var doLerp:Bool = false; @@ -42,6 +45,20 @@ class SongMenuItem extends FlxSpriteGroup // capsule.animation add(capsule); + var rank:String = FlxG.random.getObject(ranks); + + ranking = new FlxSprite(capsule.width * 0.78, 30); + ranking.loadGraphic(Paths.image("freeplay/ranks/" + rank)); + ranking.scale.x = ranking.scale.y = realScaled; + ranking.alpha = 0.75; + add(ranking); + + switch (rank) + { + case "perfect": + ranking.x -= 10; + } + songText = new FlxText(capsule.width * 0.23, 40, 0, songTitle, Std.int(40 * realScaled)); songText.font = "5by7"; songText.color = 0xFF43C1EA; @@ -218,12 +235,12 @@ class SongMenuItem extends FlxSpriteGroup function set_selected(value:Bool):Bool { - // trace(value); - // cute one liners, lol! songText.alpha = value ? 1 : 0.6; capsule.offset.x = value ? 0 : -5; capsule.animation.play(value ? "selected" : "unselected"); + ranking.alpha = value ? 1 : 0.7; + ranking.color = value ? 0xFFFFFFFF : 0xFFAAAAAA; return value; } } From eacd76a0fa1437f118413054a9e8c5c25956423a Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 11 Aug 2023 21:45:34 -0400 Subject: [PATCH 32/53] difficulty rankings and grayscale mockup --- art | 2 +- assets | 2 +- source/funkin/freeplayStuff/SongMenuItem.hx | 14 +++++++++++++ source/funkin/shaderslmfao/Grayscale.hx | 22 +++++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 source/funkin/shaderslmfao/Grayscale.hx diff --git a/art b/art index f4acf8d6e..fbe23f8b5 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit f4acf8d6e1981ea4d1a28e7e512e335b2a4f261f +Subproject commit fbe23f8b59831ca0123727a35e02cdfb49f3ce60 diff --git a/assets b/assets index abbbc89a8..e5aad64d7 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit abbbc89a83f48317568b5b25eaf831ae16f88a8c +Subproject commit e5aad64d7b5201d23cd28cf740cff48fae6ebf74 diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 184846805..780a7b2ad 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -8,6 +8,7 @@ import flixel.math.FlxMath; import flixel.math.FlxPoint; import flixel.text.FlxText; import flixel.util.FlxTimer; +import funkin.shaderslmfao.Grayscale; class SongMenuItem extends FlxSpriteGroup { @@ -24,6 +25,11 @@ class SongMenuItem extends FlxSpriteGroup var ranks:Array = ["fail", "average", "great", "excellent", "perfect"]; + // lol... + var diffRanks:Array = [ + "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "14", "15" + ]; + public var targetPos:FlxPoint = new FlxPoint(); public var doLerp:Bool = false; public var doJumpIn:Bool = false; @@ -31,6 +37,7 @@ class SongMenuItem extends FlxSpriteGroup public var doJumpOut:Bool = false; public var onConfirm:Void->Void; + public var diffGrayscale:Grayscale; public function new(x:Float, y:Float, song:String, ?character:String) { @@ -53,6 +60,12 @@ class SongMenuItem extends FlxSpriteGroup ranking.alpha = 0.75; add(ranking); + diffGrayscale = new Grayscale(1); + + var diffRank = new FlxSprite(145, 90).loadGraphic(Paths.image("freeplay/diffRankings/diff" + FlxG.random.getObject(diffRanks))); + diffRank.shader = diffGrayscale; + add(diffRank); + switch (rank) { case "perfect": @@ -236,6 +249,7 @@ class SongMenuItem extends FlxSpriteGroup function set_selected(value:Bool):Bool { // cute one liners, lol! + diffGrayscale.setAmount(value ? 0 : 0.8); songText.alpha = value ? 1 : 0.6; capsule.offset.x = value ? 0 : -5; capsule.animation.play(value ? "selected" : "unselected"); diff --git a/source/funkin/shaderslmfao/Grayscale.hx b/source/funkin/shaderslmfao/Grayscale.hx new file mode 100644 index 000000000..016d64b46 --- /dev/null +++ b/source/funkin/shaderslmfao/Grayscale.hx @@ -0,0 +1,22 @@ +package funkin.shaderslmfao; + +import flixel.addons.display.FlxRuntimeShader; +import funkin.Paths; +import openfl.utils.Assets; + +class Grayscale extends FlxRuntimeShader +{ + public var amount:Float = 1; + + public function new(amount:Float = 1) + { + super(Assets.getText(Paths.frag("grayscale"))); + setAmount(amount); + } + + public function setAmount(value:Float):Void + { + amount = value; + this.setFloat("amount", amount); + } +} From f474c3aac5da74adbe27f426ad9efe93b9e7ee4f Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 12 Aug 2023 00:31:43 -0400 Subject: [PATCH 33/53] better grouping stuf --- source/funkin/freeplayStuff/SongMenuItem.hx | 30 ++++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 780a7b2ad..a28ea1d9f 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -1,5 +1,6 @@ package funkin.freeplayStuff; +import flixel.group.FlxGroup; import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; @@ -52,6 +53,9 @@ class SongMenuItem extends FlxSpriteGroup // capsule.animation add(capsule); + // doesn't get added, simply is here to help with visibility of things for the pop in! + grpHide = new FlxGroup(); + var rank:String = FlxG.random.getObject(ranks); ranking = new FlxSprite(capsule.width * 0.78, 30); @@ -59,12 +63,15 @@ class SongMenuItem extends FlxSpriteGroup ranking.scale.x = ranking.scale.y = realScaled; ranking.alpha = 0.75; add(ranking); + grpHide.add(ranking); diffGrayscale = new Grayscale(1); var diffRank = new FlxSprite(145, 90).loadGraphic(Paths.image("freeplay/diffRankings/diff" + FlxG.random.getObject(diffRanks))); diffRank.shader = diffGrayscale; + diffRank.visible = false; add(diffRank); + grpHide.add(diffRank); switch (rank) { @@ -72,16 +79,18 @@ class SongMenuItem extends FlxSpriteGroup ranking.x -= 10; } - songText = new FlxText(capsule.width * 0.23, 40, 0, songTitle, Std.int(40 * realScaled)); + songText = new FlxText(capsule.width * 0.26, 45, 0, songTitle, Std.int(40 * realScaled)); songText.font = "5by7"; songText.color = 0xFF43C1EA; add(songText); + grpHide.add(songText); pixelIcon = new FlxSprite(80, 35); pixelIcon.makeGraphic(32, 32, 0x00000000); pixelIcon.antialiasing = false; pixelIcon.active = false; add(pixelIcon); + grpHide.add(pixelIcon); if (character != null) setCharacter(character); @@ -91,10 +100,21 @@ class SongMenuItem extends FlxSpriteGroup favIcon.animation.play('fav'); favIcon.setGraphicSize(60, 60); add(favIcon); + grpHide.add(favIcon); + + setVisibleGrp(false); selected = selected; // just to kickstart the set_selected } + function setVisibleGrp(value:Bool) + { + for (spr in grpHide.members) + { + spr.visible = value; + } + } + public function init(x:Float, y:Float, song:String, ?character:String) { this.x = x; @@ -158,17 +178,19 @@ class SongMenuItem extends FlxSpriteGroup if (force) { alpha = 1; - songText.visible = true; + setVisibleGrp(true); } else { new FlxTimer().start((xFrames.length / 24) * 2.5, function(_) { - songText.visible = true; + setVisibleGrp(true); alpha = 1; }); } } + var grpHide:FlxGroup; + public function forcePosition() { alpha = 1; @@ -189,7 +211,7 @@ class SongMenuItem extends FlxSpriteGroup capsule.scale.x *= realScaled; capsule.scale.y *= realScaled; - songText.visible = true; + setVisibleGrp(true); } override function update(elapsed:Float) From 8525cfaf21109adb111eb6668a290137fd2ded88 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sat, 12 Aug 2023 00:42:17 -0400 Subject: [PATCH 34/53] cute text popin --- source/funkin/freeplayStuff/SongMenuItem.hx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index a28ea1d9f..be663af74 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -107,12 +107,29 @@ class SongMenuItem extends FlxSpriteGroup selected = selected; // just to kickstart the set_selected } + function textAppear() + { + songText.scale.x = 1.7; + songText.scale.y = 0.2; + + new FlxTimer().start(1 / 24, function(_) { + songText.scale.x = 0.4; + songText.scale.y = 1.4; + }); + + new FlxTimer().start(2 / 24, function(_) { + songText.scale.x = songText.scale.y = 1; + }); + } + function setVisibleGrp(value:Bool) { for (spr in grpHide.members) { spr.visible = value; } + + if (value) textAppear(); } public function init(x:Float, y:Float, song:String, ?character:String) From 0dbcc50bccb9b84ed03b2fe6a3be9846816f9585 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 13 Aug 2023 22:12:08 -0400 Subject: [PATCH 35/53] random song music in progress --- assets | 2 +- source/funkin/FreeplayState.hx | 11 ++++++++++- source/funkin/freeplayStuff/SongMenuItem.hx | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/assets b/assets index e5aad64d7..fd8251b13 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e5aad64d7b5201d23cd28cf740cff48fae6ebf74 +Subproject commit fd8251b139d482146ed79495865a48676a4d1d68 diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 5e3e896e2..99f12bcb0 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -994,6 +994,7 @@ class FreeplayState extends MusicBeatSubState // NGio.logEvent('Fresh'); FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); + // FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName)); curSelected += change; @@ -1034,7 +1035,15 @@ class FreeplayState extends MusicBeatSubState if (index < curSelected) capsule.targetPos.y -= 100; // another 100 for good measure } - if (grpCapsules.countLiving() > 0) grpCapsules.members[curSelected].selected = true; + if (grpCapsules.countLiving() > 0) + { + if (curSelected == 0) + { + FlxG.sound.playMusic(Paths.music('freeplay/freeplayRandom'), 0); + FlxG.sound.music.fadeIn(2, 0, 0.8); + } + grpCapsules.members[curSelected].selected = true; + } } } diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index be663af74..c781b8b8d 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -178,7 +178,7 @@ class SongMenuItem extends FlxSpriteGroup var xPosLerpLol:Array = [0.9, 0.4, 0.16, 0.16, 0.22, 0.22, 0.245]; // NUMBERS ARE JANK CUZ THE SCALING OR WHATEVER var xPosOutLerpLol:Array = [0.245, 0.75, 0.98, 0.98, 1.2]; // NUMBERS ARE JANK CUZ THE SCALING OR WHATEVER - public final realScaled:Float = 0.8; + public var realScaled:Float = 0.8; public function initJumpIn(maxTimer:Float, ?force:Bool):Void { From 5d6264e67ead40bdbf25efd90ec3bdfbe24fd2c1 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 13 Aug 2023 23:22:24 -0400 Subject: [PATCH 36/53] sprites follow rotation of capsule --- source/funkin/freeplayStuff/SongMenuItem.hx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index c781b8b8d..33a94cbe0 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -58,10 +58,11 @@ class SongMenuItem extends FlxSpriteGroup var rank:String = FlxG.random.getObject(ranks); - ranking = new FlxSprite(capsule.width * 0.78, 30); + ranking = new FlxSprite(capsule.width * 0.84, 30); ranking.loadGraphic(Paths.image("freeplay/ranks/" + rank)); ranking.scale.x = ranking.scale.y = realScaled; ranking.alpha = 0.75; + ranking.origin.set(capsule.origin.x - ranking.x, capsule.origin.y - ranking.y); add(ranking); grpHide.add(ranking); @@ -71,6 +72,7 @@ class SongMenuItem extends FlxSpriteGroup diffRank.shader = diffGrayscale; diffRank.visible = false; add(diffRank); + diffRank.origin.set(capsule.origin.x - diffRank.x, capsule.origin.y - diffRank.y); grpHide.add(diffRank); switch (rank) @@ -85,10 +87,11 @@ class SongMenuItem extends FlxSpriteGroup add(songText); grpHide.add(songText); - pixelIcon = new FlxSprite(80, 35); + pixelIcon = new FlxSprite(155, 15); pixelIcon.makeGraphic(32, 32, 0x00000000); pixelIcon.antialiasing = false; pixelIcon.active = false; + add(pixelIcon); grpHide.add(pixelIcon); @@ -98,9 +101,10 @@ class SongMenuItem extends FlxSpriteGroup favIcon.frames = Paths.getSparrowAtlas('freeplay/favHeart'); favIcon.animation.addByPrefix('fav', "favorite heart", 24, false); favIcon.animation.play('fav'); - favIcon.setGraphicSize(60, 60); + favIcon.setGraphicSize(50, 50); + favIcon.visible = false; add(favIcon); - grpHide.add(favIcon); + // grpHide.add(favIcon); setVisibleGrp(false); @@ -165,7 +169,10 @@ class SongMenuItem extends FlxSpriteGroup pixelIcon.loadGraphic(Paths.image(charPath)); pixelIcon.setGraphicSize(Std.int(pixelIcon.width * 2)); - // pixelIcon.updateHitbox(); + pixelIcon.updateHitbox(); + pixelIcon.origin.x += 100; + // pixelIcon.origin.x = capsule.origin.x; + // pixelIcon.offset.x -= pixelIcon.origin.x; } var frameInTicker:Float = 0; From 20d13f56accf9f6d0c83f6aa183e23585d1452b2 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 14 Aug 2023 02:49:18 -0400 Subject: [PATCH 37/53] capsule text effect --- assets | 2 +- source/funkin/freeplayStuff/CapsuleText.hx | 49 +++++++++++++++++++ source/funkin/freeplayStuff/SongMenuItem.hx | 9 ++-- .../funkin/shaderslmfao/GaussianBlurShader.hx | 25 ++++++++++ 4 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 source/funkin/freeplayStuff/CapsuleText.hx create mode 100644 source/funkin/shaderslmfao/GaussianBlurShader.hx diff --git a/assets b/assets index fd8251b13..bc7e486ba 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit fd8251b139d482146ed79495865a48676a4d1d68 +Subproject commit bc7e486ba4cf52e55893daa951e58b37059b0adb diff --git a/source/funkin/freeplayStuff/CapsuleText.hx b/source/funkin/freeplayStuff/CapsuleText.hx new file mode 100644 index 000000000..dda687f5e --- /dev/null +++ b/source/funkin/freeplayStuff/CapsuleText.hx @@ -0,0 +1,49 @@ +package funkin.freeplayStuff; + +import openfl.filters.BitmapFilterQuality; +import flixel.text.FlxText; +import flixel.group.FlxSpriteGroup; +import funkin.shaderslmfao.GaussianBlurShader; + +class CapsuleText extends FlxSpriteGroup +{ + public var blurredText:FlxText; + + var whiteText:FlxText; + + public var text(default, set):String; + + public function new(x:Float, y:Float, songTitle:String, size:Float) + { + super(x, y); + + blurredText = initText(songTitle, size); + blurredText.shader = new GaussianBlurShader(1); + whiteText = initText(songTitle, size); + // whiteText.shader = new GaussianBlurShader(0.3); + text = songTitle; + + blurredText.color = 0xFF00ccff; + whiteText.color = 0xFFFFFFFF; + add(blurredText); + add(whiteText); + } + + function initText(songTitle, size:Float):FlxText + { + var text:FlxText = new FlxText(0, 0, 0, songTitle, Std.int(size)); + text.font = "5by7"; + return text; + } + + function set_text(value:String):String + { + blurredText.text = value; + whiteText.text = value; + whiteText.textField.filters = [ + new openfl.filters.GlowFilter(0x00ccff, 1, 5, 5, 210, BitmapFilterQuality.MEDIUM), + // new openfl.filters.BlurFilter(5, 5, BitmapFilterQuality.LOW) + ]; + return value; + } +} diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 33a94cbe0..596dfbed4 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -1,5 +1,6 @@ package funkin.freeplayStuff; +import funkin.shaderslmfao.GaussianBlurShader; import flixel.group.FlxGroup; import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; @@ -20,7 +21,7 @@ class SongMenuItem extends FlxSpriteGroup public var songTitle:String = "Test"; - public var songText:FlxText; + public var songText:CapsuleText; public var favIcon:FlxSprite; public var ranking:FlxSprite; @@ -81,9 +82,7 @@ class SongMenuItem extends FlxSpriteGroup ranking.x -= 10; } - songText = new FlxText(capsule.width * 0.26, 45, 0, songTitle, Std.int(40 * realScaled)); - songText.font = "5by7"; - songText.color = 0xFF43C1EA; + songText = new CapsuleText(capsule.width * 0.26, 45, songTitle, Std.int(40 * realScaled)); add(songText); grpHide.add(songText); @@ -91,7 +90,6 @@ class SongMenuItem extends FlxSpriteGroup pixelIcon.makeGraphic(32, 32, 0x00000000); pixelIcon.antialiasing = false; pixelIcon.active = false; - add(pixelIcon); grpHide.add(pixelIcon); @@ -297,6 +295,7 @@ class SongMenuItem extends FlxSpriteGroup // cute one liners, lol! diffGrayscale.setAmount(value ? 0 : 0.8); songText.alpha = value ? 1 : 0.6; + songText.blurredText.visible = value ? true : false; capsule.offset.x = value ? 0 : -5; capsule.animation.play(value ? "selected" : "unselected"); ranking.alpha = value ? 1 : 0.7; diff --git a/source/funkin/shaderslmfao/GaussianBlurShader.hx b/source/funkin/shaderslmfao/GaussianBlurShader.hx new file mode 100644 index 000000000..ad472ac31 --- /dev/null +++ b/source/funkin/shaderslmfao/GaussianBlurShader.hx @@ -0,0 +1,25 @@ +package funkin.shaderslmfao; + +import flixel.addons.display.FlxRuntimeShader; +import funkin.Paths; +import openfl.utils.Assets; + +/** + * Note... not actually gaussian! + */ +class GaussianBlurShader extends FlxRuntimeShader +{ + public var amount:Float; + + public function new(amount:Float = 1.0) + { + super(Assets.getText(Paths.frag("gaussianBlur"))); + setAmount(amount); + } + + public function setAmount(value:Float):Void + { + this.amount = value; + this.setFloat("amount", amount); + } +} From b20cb27f828a57e7b6676782245ce94fe707220e Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 23 Aug 2023 05:33:52 -0400 Subject: [PATCH 38/53] hue shifting in progress --- assets | 2 +- hmm.json | 2 +- .../funkin/freeplayStuff/DifficultyStars.hx | 112 ++++++++++++++++ source/funkin/freeplayStuff/FreeplayFlames.hx | 120 ++++++++++++++++++ source/funkin/shaderslmfao/HSVShader.hx | 44 +++++++ 5 files changed, 278 insertions(+), 2 deletions(-) create mode 100644 source/funkin/freeplayStuff/DifficultyStars.hx create mode 100644 source/funkin/freeplayStuff/FreeplayFlames.hx create mode 100644 source/funkin/shaderslmfao/HSVShader.hx diff --git a/assets b/assets index bc7e486ba..cb481d798 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit bc7e486ba4cf52e55893daa951e58b37059b0adb +Subproject commit cb481d79891707029a7f10975ce0d392c56f244a diff --git a/hmm.json b/hmm.json index 85c83ea6d..bb2832ba8 100644 --- a/hmm.json +++ b/hmm.json @@ -32,7 +32,7 @@ "name": "flxanimate", "type": "git", "dir": null, - "ref": "a913635", + "ref": "37fd4ed45011063a38fdfe9bb6091671b3ac6c17", "url": "https://github.com/ninjamuffin99/flxanimate" }, { diff --git a/source/funkin/freeplayStuff/DifficultyStars.hx b/source/funkin/freeplayStuff/DifficultyStars.hx new file mode 100644 index 000000000..3078f0e9a --- /dev/null +++ b/source/funkin/freeplayStuff/DifficultyStars.hx @@ -0,0 +1,112 @@ +package funkin.freeplayStuff; + +import flixel.group.FlxSpriteGroup; +import funkin.graphics.adobeanimate.FlxAtlasSprite; +import funkin.shaderslmfao.HSVShader; + +class DifficultyStars extends FlxSpriteGroup +{ + /** + * Internal handler var for difficulty... ranges from 0... to 15 + * 0 is 1 star... 15 is 0 stars! + */ + var curDifficulty(default, set):Int = 0; + + /** + * Range between 0 and 15 + */ + public var difficulty(default, set):Int = 1; + + var stars:FlxAtlasSprite; + + var flames:FreeplayFlames; + + var hsvShader:HSVShader; + + public function new(x:Float, y:Float) + { + super(x, y); + + hsvShader = new HSVShader(); + + flames = new FreeplayFlames(0, 0); + add(flames); + + stars = new FlxAtlasSprite(0, 0, Paths.animateAtlas("freeplay/freeplayStars")); + stars.anim.play("diff stars"); + add(stars); + + stars.shader = hsvShader; + + for (memb in flames.members) + memb.shader = hsvShader; + + FlxG.debugger.addTrackerProfile(new TrackerProfile(HSVShader, ["hue", "saturation", "value"])); + FlxG.debugger.track(hsvShader); + + FlxG.debugger.addTrackerProfile(new TrackerProfile(DifficultyStars, ["difficulty"])); + FlxG.debugger.track(this); + } + + override function update(elapsed:Float):Void + { + super.update(elapsed); + + // "loops" the current animation + // for clarity, the animation file looks like + // frame : stars + // 0-99: 1 star + // 100-199: 2 stars + // ...... + // 1300-1499: 15 stars + // 1500 : 0 stars + if (curDifficulty < 15 && stars.anim.curFrame >= (curDifficulty + 1) * 100) + { + stars.anim.play("diff stars", true, false, curDifficulty * 100); + } + } + + function set_difficulty(value:Int):Int + { + difficulty = value; + + if (difficulty <= 0) + { + difficulty = 0; + curDifficulty = 15; + } + else if (difficulty <= 15) + { + difficulty = value; + curDifficulty = difficulty - 1; + } + else + { + difficulty = 15; + curDifficulty = difficulty - 1; + } + + if (difficulty > 10) flames.flameCount = difficulty - 10; + else + flames.flameCount = 0; + + return difficulty; + } + + function set_curDifficulty(value:Int):Int + { + curDifficulty = value; + if (curDifficulty == 15) + { + stars.anim.play("diff stars", true, false, 1500); + stars.anim.pause(); + } + else + { + stars.anim.curFrame = Std.int(curDifficulty * 100); + stars.anim.play("diff stars", true, false, curDifficulty * 100); + } + + return curDifficulty; + } +} diff --git a/source/funkin/freeplayStuff/FreeplayFlames.hx b/source/funkin/freeplayStuff/FreeplayFlames.hx new file mode 100644 index 000000000..cf606bdb8 --- /dev/null +++ b/source/funkin/freeplayStuff/FreeplayFlames.hx @@ -0,0 +1,120 @@ +package funkin.freeplayStuff; + +import flixel.group.FlxSpriteGroup; +import flixel.FlxSprite; +import flixel.util.FlxTimer; + +class FreeplayFlames extends FlxSpriteGroup +{ + var flameX(default, set):Float = 917; + var flameY(default, set):Float = 103; + var flameSpreadX(default, set):Float = 29; + var flameSpreadY(default, set):Float = 6; + + public var flameCount(default, set):Int = 0; + + var flameTimer:Float = 0.25; + + public function new(x:Float, y:Float) + { + super(x, y); + + for (i in 0...5) + { + var flame:FlxSprite = new FlxSprite(flameX + (flameSpreadX * i), flameY + (flameSpreadY * i)); + flame.frames = Paths.getSparrowAtlas("freeplay/freeplayFlame"); + flame.animation.addByPrefix("flame", "fire loop", FlxG.random.int(23, 25), false); + flame.animation.play("flame"); + flame.visible = false; + flameCount = 0; + + // sets the loop... maybe better way to do this lol! + flame.animation.finishCallback = function(_) { + flame.animation.play("flame", true, false, 2); + }; + add(flame); + } + + FlxG.debugger.addTrackerProfile(new TrackerProfile(FreeplayFlames, ["flameTimer"])); + FlxG.debugger.track(this); + } + + var properPositions:Bool = false; + + override public function update(elapsed:Float):Void + { + super.update(elapsed); + // doesn't work in create()/new() for some reason + // so putting it here bwah! + if (!properPositions) + { + setFlamePositions(); + properPositions = true; + } + } + + function set_flameCount(value:Int):Int + { + this.flameCount = value; + var visibleCount:Int = 0; + for (i in 0...5) + { + if (members[i] == null) continue; + var flame:FlxSprite = members[i]; + if (i < flameCount) + { + if (!flame.visible) + { + new FlxTimer().start(flameTimer * visibleCount, function(_) { + flame.animation.play("flame", true); + flame.visible = true; + }); + visibleCount++; + } + } + else + { + flame.visible = false; + } + } + return this.flameCount; + } + + function setFlamePositions() + { + for (i in 0...5) + { + var flame:FlxSprite = members[i]; + flame.x = flameX + (flameSpreadX * i); + flame.y = flameY + (flameSpreadY * i); + } + } + + function set_flameX(value:Float):Float + { + this.flameX = value; + setFlamePositions(); + return this.flameX; + } + + function set_flameY(value:Float):Float + { + this.flameY = value; + setFlamePositions(); + return this.flameY; + } + + function set_flameSpreadX(value:Float):Float + { + this.flameSpreadX = value; + setFlamePositions(); + return this.flameSpreadX; + } + + function set_flameSpreadY(value:Float):Float + { + this.flameSpreadY = value; + setFlamePositions(); + return this.flameSpreadY; + } +} diff --git a/source/funkin/shaderslmfao/HSVShader.hx b/source/funkin/shaderslmfao/HSVShader.hx new file mode 100644 index 000000000..066a49c96 --- /dev/null +++ b/source/funkin/shaderslmfao/HSVShader.hx @@ -0,0 +1,44 @@ +package funkin.shaderslmfao; + +import flixel.addons.display.FlxRuntimeShader; +import funkin.Paths; +import openfl.utils.Assets; + +class HSVShader extends FlxRuntimeShader +{ + public var hue(default, set):Float; + public var saturation(default, set):Float; + public var value(default, set):Float; + + public function new() + { + super(Assets.getText(Paths.frag('hsv'))); + hue = 1; + saturation = 1; + value = 1; + } + + function set_hue(value:Float):Float + { + this.setFloat('hue', value); + this.hue = value; + + return this.hue; + } + + function set_saturation(value:Float):Float + { + this.setFloat('sat', value); + this.saturation = value; + + return this.saturation; + } + + function set_value(value:Float):Float + { + this.setFloat('val', value); + this.value = value; + + return this.value; + } +} From f000d21689d7619f175c4bd2f589030a00e54c84 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 28 Aug 2023 14:52:03 -0400 Subject: [PATCH 39/53] shaders and blendmode overlay stuff in progres --- art | 2 +- assets | 2 +- source/funkin/FreeplayState.hx | 44 +++++++---- .../funkin/freeplayStuff/BGScrollingText.hx | 32 ++++++-- source/funkin/freeplayStuff/SongMenuItem.hx | 12 +++ .../funkin/shaderslmfao/BlendModesShader.hx | 23 ++++++ source/funkin/ui/title/FlxSpriteOverlay.hx | 74 +++++++++++++++++++ source/funkin/ui/title/TitleState.hx | 11 ++- 8 files changed, 175 insertions(+), 25 deletions(-) create mode 100644 source/funkin/shaderslmfao/BlendModesShader.hx create mode 100644 source/funkin/ui/title/FlxSpriteOverlay.hx diff --git a/art b/art index fbe23f8b5..e8d96feb8 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit fbe23f8b59831ca0123727a35e02cdfb49f3ce60 +Subproject commit e8d96feb8af616f360e68538b7347fae84d8308f diff --git a/assets b/assets index cb481d798..20553cc46 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit cb481d79891707029a7f10975ce0d392c56f244a +Subproject commit 20553cc4687ec975427b37eda80e74e381d9a2ef diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 99f12bcb0..1c263cf5f 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -1,5 +1,6 @@ package funkin; +import funkin.shaderslmfao.HSVShader; import funkin.ui.StickerSubState; import flash.text.TextField; import flixel.FlxCamera; @@ -170,7 +171,7 @@ class FreeplayState extends MusicBeatSubState FlxTween.tween(pinkBack, {x: 0}, 0.6, {ease: FlxEase.quartOut}); add(pinkBack); - var orangeBackShit:FlxSprite = new FlxSprite(84, FlxG.height * 0.68).makeGraphic(Std.int(pinkBack.width), 50, 0xFFffd400); + var orangeBackShit:FlxSprite = new FlxSprite(84, 440).makeGraphic(Std.int(pinkBack.width), 75, 0xFFfeda00); add(orangeBackShit); var alsoOrangeLOL:FlxSprite = new FlxSprite(0, orangeBackShit.y).makeGraphic(100, Std.int(orangeBackShit.height), 0xFFffd400); @@ -192,21 +193,26 @@ class FreeplayState extends MusicBeatSubState add(grpTxtScrolls); grpTxtScrolls.visible = false; - var moreWays:BGScrollingText = new BGScrollingText(0, 200, "HOT BLOODED IN MORE WAYS THAN ONE", FlxG.width); + FlxG.debugger.addTrackerProfile(new TrackerProfile(BGScrollingText, ["x", "y", "speed", "size"])); + + var moreWays:BGScrollingText = new BGScrollingText(0, 160, "HOT BLOODED IN MORE WAYS THAN ONE", FlxG.width, true, 43); moreWays.funnyColor = 0xFFfff383; - moreWays.speed = 4; + moreWays.speed = 6.8; grpTxtScrolls.add(moreWays); + FlxG.debugger.track(moreWays, "HotBlooded 1"); + exitMovers.set([moreWays], { x: FlxG.width * 2, speed: 0.4, }); - var funnyScroll:BGScrollingText = new BGScrollingText(0, 250, "BOYFRIEND", FlxG.width / 2); + var funnyScroll:BGScrollingText = new BGScrollingText(0, 220, "BOYFRIEND", FlxG.width / 2, false, 60); funnyScroll.funnyColor = 0xFFff9963; - funnyScroll.speed = -1; + funnyScroll.speed = -3.8; grpTxtScrolls.add(funnyScroll); + FlxG.debugger.track(funnyScroll, "Boyfriend 1"); exitMovers.set([funnyScroll], { @@ -216,18 +222,21 @@ class FreeplayState extends MusicBeatSubState wait: 0 }); - var txtNuts:BGScrollingText = new BGScrollingText(0, 300, "PROTECT YO NUTS", FlxG.width / 2); + var txtNuts:BGScrollingText = new BGScrollingText(0, 285, "PROTECT YO NUTS", FlxG.width / 2, true, 43); + txtNuts.speed = 3.5; grpTxtScrolls.add(txtNuts); exitMovers.set([txtNuts], { x: FlxG.width * 2, speed: 0.4, }); + FlxG.debugger.track(txtNuts, "Protect yo nuts 1"); - var funnyScroll2:BGScrollingText = new BGScrollingText(0, 340, "BOYFRIEND", FlxG.width / 2); + var funnyScroll2:BGScrollingText = new BGScrollingText(0, 335, "BOYFRIEND", FlxG.width / 2, false, 60); funnyScroll2.funnyColor = 0xFFff9963; - funnyScroll2.speed = -1.2; + funnyScroll2.speed = -3.8; grpTxtScrolls.add(funnyScroll2); + FlxG.debugger.track(funnyScroll2, "Boyfriend 2"); exitMovers.set([funnyScroll2], { @@ -235,10 +244,11 @@ class FreeplayState extends MusicBeatSubState speed: 0.5, }); - var moreWays2:BGScrollingText = new BGScrollingText(0, 400, "HOT BLOODED IN MORE WAYS THAN ONE", FlxG.width); + var moreWays2:BGScrollingText = new BGScrollingText(0, 397, "HOT BLOODED IN MORE WAYS THAN ONE", FlxG.width, true, 43); moreWays2.funnyColor = 0xFFfff383; - moreWays2.speed = 4.4; + moreWays2.speed = 6.8; grpTxtScrolls.add(moreWays2); + FlxG.debugger.track(moreWays2, "HotBlooded 2"); exitMovers.set([moreWays2], { @@ -246,10 +256,11 @@ class FreeplayState extends MusicBeatSubState speed: 0.4 }); - var funnyScroll3:BGScrollingText = new BGScrollingText(0, orangeBackShit.y, "BOYFRIEND", FlxG.width / 2); - funnyScroll3.funnyColor = 0xFFff9963; - funnyScroll3.speed = -0.8; + var funnyScroll3:BGScrollingText = new BGScrollingText(0, orangeBackShit.y + 10, "BOYFRIEND", FlxG.width / 2, 60); + funnyScroll3.funnyColor = 0xFFfea400; + funnyScroll3.speed = -3.8; grpTxtScrolls.add(funnyScroll3); + FlxG.debugger.track(funnyScroll3, "Boyfriend 3"); exitMovers.set([funnyScroll3], { @@ -555,6 +566,11 @@ class FreeplayState extends MusicBeatSubState } } + var hsvShader:HSVShader = new HSVShader(); + + FlxG.debugger.addTrackerProfile(new TrackerProfile(HSVShader, ["hue", "saturation", "value"])); + FlxG.debugger.track(hsvShader, "capsule shader"); + var randomCapsule:SongMenuItem = grpCapsules.recycle(SongMenuItem); randomCapsule.init(FlxG.width, 0, "Random"); randomCapsule.onConfirm = function() { @@ -566,6 +582,7 @@ class FreeplayState extends MusicBeatSubState randomCapsule.songText.visible = false; randomCapsule.favIcon.visible = false; randomCapsule.initJumpIn(0, force); + randomCapsule.hsvShader = hsvShader; grpCapsules.add(randomCapsule); for (i in 0...tempSongs.length) @@ -580,6 +597,7 @@ class FreeplayState extends MusicBeatSubState funnyMenu.alpha = 0.5; funnyMenu.songText.visible = false; funnyMenu.favIcon.visible = tempSongs[i].isFav; + funnyMenu.hsvShader = hsvShader; // fp.updateScore(0); diff --git a/source/funkin/freeplayStuff/BGScrollingText.hx b/source/funkin/freeplayStuff/BGScrollingText.hx index 9fa6dd49b..586f83822 100644 --- a/source/funkin/freeplayStuff/BGScrollingText.hx +++ b/source/funkin/freeplayStuff/BGScrollingText.hx @@ -7,6 +7,7 @@ import flixel.math.FlxMath; import flixel.text.FlxText; import flixel.util.FlxColor; import flixel.util.FlxSort; +import flixel.util.FlxTimer; // its kinda like marqeee html lol! class BGScrollingText extends FlxSpriteGroup @@ -16,36 +17,53 @@ class BGScrollingText extends FlxSpriteGroup public var widthShit:Float = FlxG.width; public var placementOffset:Float = 20; public var speed:Float = 1; + public var size(default, set):Int = 48; public var funnyColor(default, set):Int = 0xFFFFFFFF; - public function new(x:Float, y:Float, text:String, widthShit:Float = 100) + public function new(x:Float, y:Float, text:String, widthShit:Float = 100, ?bold:Bool = false, ?size:Int = 48) { super(x, y); this.widthShit = widthShit; + if (size != null) this.size = size; grpTexts = new FlxTypedSpriteGroup(); add(grpTexts); - var testText:FlxText = new FlxText(0, 0, 0, text, 48); + var testText:FlxText = new FlxText(0, 0, 0, text, this.size); testText.font = "5by7"; + testText.bold = bold; testText.updateHitbox(); grpTexts.add(testText); - var needed:Int = Math.ceil(widthShit / testText.frameWidth); + var needed:Int = Math.ceil(widthShit / testText.frameWidth) + 1; for (i in 0...needed) { var lmfao:Int = i + 1; - var coolText:FlxText = new FlxText((lmfao * testText.frameWidth) + (lmfao * 20), 0, 0, text, 48); + var coolText:FlxText = new FlxText((lmfao * testText.frameWidth) + (lmfao * 20), 0, 0, text, this.size); + coolText.font = "5by7"; + coolText.bold = bold; coolText.updateHitbox(); grpTexts.add(coolText); } } + function set_size(value:Int):Int + { + if (grpTexts != null) + { + grpTexts.forEach(function(txt:FlxText) { + txt.size = value; + }); + } + this.size = value; + return value; + } + function set_funnyColor(col:Int):Int { grpTexts.forEach(function(txt) { @@ -55,7 +73,7 @@ class BGScrollingText extends FlxSpriteGroup return col; } - override function update(elapsed:Float) + override public function update(elapsed:Float) { for (txt in grpTexts.group) { @@ -66,14 +84,16 @@ class BGScrollingText extends FlxSpriteGroup if (txt.x < -txt.frameWidth) { txt.x = grpTexts.group.members[grpTexts.length - 1].x + grpTexts.group.members[grpTexts.length - 1].frameWidth + placementOffset; + sortTextShit(); } } else { - if (txt.x > widthShit) + if (txt.x > txt.frameWidth * 2) { txt.x = grpTexts.group.members[0].x - grpTexts.group.members[0].frameWidth - placementOffset; + sortTextShit(); } } diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 596dfbed4..0f0521004 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -1,5 +1,6 @@ package funkin.freeplayStuff; +import funkin.shaderslmfao.HSVShader; import funkin.shaderslmfao.GaussianBlurShader; import flixel.group.FlxGroup; import flixel.FlxSprite; @@ -41,6 +42,8 @@ class SongMenuItem extends FlxSpriteGroup public var onConfirm:Void->Void; public var diffGrayscale:Grayscale; + public var hsvShader(default, set):HSVShader; + public function new(x:Float, y:Float, song:String, ?character:String) { super(x, y); @@ -109,6 +112,15 @@ class SongMenuItem extends FlxSpriteGroup selected = selected; // just to kickstart the set_selected } + function set_hsvShader(value:HSVShader):HSVShader + { + this.hsvShader = value; + capsule.shader = hsvShader; + songText.shader = hsvShader; + + return value; + } + function textAppear() { songText.scale.x = 1.7; diff --git a/source/funkin/shaderslmfao/BlendModesShader.hx b/source/funkin/shaderslmfao/BlendModesShader.hx new file mode 100644 index 000000000..6807a65c0 --- /dev/null +++ b/source/funkin/shaderslmfao/BlendModesShader.hx @@ -0,0 +1,23 @@ +package funkin.shaderslmfao; + +import flixel.addons.display.FlxRuntimeShader; +import funkin.Paths; +import openfl.utils.Assets; +import openfl.display.BitmapData; + +class BlendModesShader extends FlxRuntimeShader +{ + public var camera:BitmapData; + + public function new() + { + super(Assets.getText(Paths.frag('blendModes'))); + } + + public function setCamera(camera:BitmapData):Void + { + this.camera = camera; + + this.setBitmapData('camera', camera); + } +} diff --git a/source/funkin/ui/title/FlxSpriteOverlay.hx b/source/funkin/ui/title/FlxSpriteOverlay.hx new file mode 100644 index 000000000..2e0ac987e --- /dev/null +++ b/source/funkin/ui/title/FlxSpriteOverlay.hx @@ -0,0 +1,74 @@ +package funkin.ui.title; + +import flixel.FlxSprite; +import funkin.shaderslmfao.BlendModesShader; +import openfl.display.BitmapData; +import flixel.FlxCamera; +import flixel.FlxG; +import flixel.graphics.frames.FlxFrame.FlxFrameAngle; + +class FlxSpriteOverlay extends FlxSprite +{ + var blendShader:BlendModesShader; + var dipshitBitmap:BitmapData; + var temp:FlxSprite; + + public function new(x:Float, y:Float) + { + super(x, y); + temp = new FlxSprite().makeGraphic(FlxG.width, FlxG.height, 0xFF000000); + blendShader = new BlendModesShader(); + dipshitBitmap = new BitmapData(2180, 1720, true, 0xFFCC00CC); + } + + override function drawComplex(camera:FlxCamera):Void + { + _frame.prepareMatrix(_matrix, FlxFrameAngle.ANGLE_0, checkFlipX(), checkFlipY()); + _matrix.translate(-origin.x, -origin.y); + _matrix.scale(scale.x, scale.y); + if (bakedRotationAngle <= 0) + { + updateTrig(); + if (angle != 0) _matrix.rotateWithTrig(_cosAngle, _sinAngle); + } + getScreenPosition(_point, camera).subtractPoint(offset); + _point.add(origin.x, origin.y); + _matrix.translate(_point.x, _point.y); + if (isPixelPerfectRender(camera)) + { + _matrix.tx = Math.floor(_matrix.tx); + _matrix.ty = Math.floor(_matrix.ty); + } + + var sprRect = getScreenBounds(); + + dipshitBitmap.draw(camera.canvas, camera.canvas.transform.matrix); + blendShader.setCamera(dipshitBitmap); + + FlxG.bitmapLog.add(dipshitBitmap); + + camera.drawPixels(_frame, framePixels, _matrix, colorTransform, blend, antialiasing, blendShader); + } + + function copyToFlash(rect):openfl.geom.Rectangle + { + var flashRect = new openfl.geom.Rectangle(); + flashRect.x = rect.x; + flashRect.y = rect.y; + flashRect.width = rect.width; + flashRect.height = rect.height; + return flashRect; + } + + override public function isSimpleRender(?camera:FlxCamera):Bool + { + if (FlxG.renderBlit) + { + return super.isSimpleRender(camera); + } + else + { + return false; + } + } +} diff --git a/source/funkin/ui/title/TitleState.hx b/source/funkin/ui/title/TitleState.hx index 313c578a3..9820e4ecc 100644 --- a/source/funkin/ui/title/TitleState.hx +++ b/source/funkin/ui/title/TitleState.hx @@ -23,6 +23,7 @@ import openfl.events.MouseEvent; import openfl.events.NetStatusEvent; import openfl.media.Video; import openfl.net.NetStream; +import openfl.display.BlendMode; #if desktop #end @@ -101,7 +102,7 @@ class TitleState extends MusicBeatState var logoBl:FlxSprite; var outlineShaderShit:TitleOutline; - var gfDance:FlxSprite; + var gfDance:FlxSpriteOverlay; var danceLeft:Bool = false; var titleText:FlxSprite; var maskShader = new LeftMaskShader(); @@ -124,13 +125,11 @@ class TitleState extends MusicBeatState outlineShaderShit = new TitleOutline(); - gfDance = new FlxSprite(FlxG.width * 0.4, FlxG.height * 0.07); + gfDance = new FlxSpriteOverlay(FlxG.width * 0.4, FlxG.height * 0.07); gfDance.frames = Paths.getSparrowAtlas('gfDanceTitle'); gfDance.animation.addByIndices('danceLeft', 'gfDance', [30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], "", 24, false); gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); - add(gfDance); - // maskShader.swagSprX = gfDance.x; // maskShader.swagMaskX = gfDance.x + 200; // maskShader.frameUV = gfDance.frame.uv; @@ -142,6 +141,8 @@ class TitleState extends MusicBeatState add(logoBl); + add(gfDance); + titleText = new FlxSprite(100, FlxG.height * 0.8); titleText.frames = Paths.getSparrowAtlas('titleEnter'); titleText.animation.addByPrefix('idle', "Press Enter to Begin", 24); @@ -245,6 +246,8 @@ class TitleState extends MusicBeatState override function update(elapsed:Float) { + FlxG.bitmapLog.add(FlxG.camera.buffer); + #if HAS_PITCH if (FlxG.keys.pressed.UP) FlxG.sound.music.pitch += 0.5 * elapsed; From 5ddc4876bcc1f2022b8a8696ac74142e57dcfa7a Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 28 Aug 2023 22:01:25 -0400 Subject: [PATCH 40/53] boyfriend animations swapped to atlas sprites --- art | 2 +- assets | 2 +- source/funkin/FreeplayState.hx | 13 +--- source/funkin/freeplayStuff/DJBoyfriend.hx | 76 ++++++++++++------- .../funkin/freeplayStuff/DifficultyStars.hx | 6 -- source/funkin/freeplayStuff/FreeplayFlames.hx | 3 - source/funkin/ui/title/FlxSpriteOverlay.hx | 8 +- 7 files changed, 56 insertions(+), 54 deletions(-) diff --git a/art b/art index e8d96feb8..769b84ffd 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit e8d96feb8af616f360e68538b7347fae84d8308f +Subproject commit 769b84ffd7550b18fb3719cf4cb6b48296bdd097 diff --git a/assets b/assets index 20553cc46..2d4cd8512 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 20553cc4687ec975427b37eda80e74e381d9a2ef +Subproject commit 2d4cd85129db9aea8cdba62ef43313f99f13c857 diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 1c263cf5f..9447488ff 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -200,8 +200,6 @@ class FreeplayState extends MusicBeatSubState moreWays.speed = 6.8; grpTxtScrolls.add(moreWays); - FlxG.debugger.track(moreWays, "HotBlooded 1"); - exitMovers.set([moreWays], { x: FlxG.width * 2, @@ -212,7 +210,6 @@ class FreeplayState extends MusicBeatSubState funnyScroll.funnyColor = 0xFFff9963; funnyScroll.speed = -3.8; grpTxtScrolls.add(funnyScroll); - FlxG.debugger.track(funnyScroll, "Boyfriend 1"); exitMovers.set([funnyScroll], { @@ -230,13 +227,11 @@ class FreeplayState extends MusicBeatSubState x: FlxG.width * 2, speed: 0.4, }); - FlxG.debugger.track(txtNuts, "Protect yo nuts 1"); var funnyScroll2:BGScrollingText = new BGScrollingText(0, 335, "BOYFRIEND", FlxG.width / 2, false, 60); funnyScroll2.funnyColor = 0xFFff9963; funnyScroll2.speed = -3.8; grpTxtScrolls.add(funnyScroll2); - FlxG.debugger.track(funnyScroll2, "Boyfriend 2"); exitMovers.set([funnyScroll2], { @@ -248,7 +243,6 @@ class FreeplayState extends MusicBeatSubState moreWays2.funnyColor = 0xFFfff383; moreWays2.speed = 6.8; grpTxtScrolls.add(moreWays2); - FlxG.debugger.track(moreWays2, "HotBlooded 2"); exitMovers.set([moreWays2], { @@ -260,7 +254,6 @@ class FreeplayState extends MusicBeatSubState funnyScroll3.funnyColor = 0xFFfea400; funnyScroll3.speed = -3.8; grpTxtScrolls.add(funnyScroll3); - FlxG.debugger.track(funnyScroll3, "Boyfriend 3"); exitMovers.set([funnyScroll3], { @@ -268,7 +261,8 @@ class FreeplayState extends MusicBeatSubState speed: 0.3 }); - dj = new DJBoyfriend(0, -100); + // dj = new DJBoyfriend(0, -100); + dj = new DJBoyfriend(640, 366); exitMovers.set([dj], { x: -dj.width * 1.6, @@ -568,9 +562,6 @@ class FreeplayState extends MusicBeatSubState var hsvShader:HSVShader = new HSVShader(); - FlxG.debugger.addTrackerProfile(new TrackerProfile(HSVShader, ["hue", "saturation", "value"])); - FlxG.debugger.track(hsvShader, "capsule shader"); - var randomCapsule:SongMenuItem = grpCapsules.recycle(SongMenuItem); randomCapsule.init(FlxG.width, 0, "Random"); randomCapsule.onConfirm = function() { diff --git a/source/funkin/freeplayStuff/DJBoyfriend.hx b/source/funkin/freeplayStuff/DJBoyfriend.hx index 5bee4129a..1a7d9b9ed 100644 --- a/source/funkin/freeplayStuff/DJBoyfriend.hx +++ b/source/funkin/freeplayStuff/DJBoyfriend.hx @@ -3,8 +3,9 @@ package funkin.freeplayStuff; import flixel.FlxSprite; import flixel.util.FlxSignal; import funkin.util.assets.FlxAnimationUtil; +import funkin.graphics.adobeanimate.FlxAtlasSprite; -class DJBoyfriend extends FlxSprite +class DJBoyfriend extends FlxAtlasSprite { // Represents the sprite's current status. // Without state machines I would have driven myself crazy years ago. @@ -27,13 +28,31 @@ class DJBoyfriend extends FlxSprite public function new(x:Float, y:Float) { - super(x, y); + super(x, y, Paths.animateAtlas("freeplay/freeplay-boyfriend", "preload")); animOffsets = new Map>(); setupAnimations(); + trace(listAnimations()); - animation.finishCallback = onFinishAnim; + FlxG.debugger.track(this); + + anim.onComplete = onFinishAnim; + } + + /* + [remote hand under,boyfriend top head,brim piece,arm cringe l,red lazer,dj arm in,bf fist pump arm,hand raised right,forearm left,fist shaking,bf smile eyes closed face,arm cringe r,bf clenched face,face shrug,boyfriend falling,blue tint 1,shirt sleeve,bf clenched fist,head BF relaxed,blue tint 2,hand down left,blue tint 3,blue tint 4,head less smooshed,blue tint 5,boyfriend freeplay,BF head slight turn,blue tint 6,arm shrug l,blue tint 7,shoulder raised w sleeve,blue tint 8,fist pump face,blue tint 9,foot rested light,hand turnaround,arm chill right,Boyfriend DJ,arm shrug r,head back bf,hat top piece,dad bod,face surprise snap,Boyfriend DJ fist pump,office chair,foot rested right,chest down,office chair upright,body chill,bf dj afk,head mouth open dad,BF Head defalt HAIR BLOWING,hand shrug l,face piece,foot wag,turn table,shoulder up left,turntable lights,boyfriend dj body shirt blowing,body chunk turned,hand down right,dj arm out,hand shrug r,body chest out,rave hand,palm,chill face default,head back semi bf,boyfriend bottom head,DJ arm,shoulder right dad,bf surprise,boyfriend dj body,hs1,Boyfriend DJ watchin tv OG,spinning disk,hs2,arm chill left,boyfriend dj intro,hs3,hs4,chill face extra,hs5,remote hand upright,hs6,pant over table,face surprise,bf arm peace,arm turnaround,bf eyes 1,arm slammed table,eye squit,leg BF,head mid piece,arm backing,arm swoopin in,shoe right lowering,forearm right,hand out,blue tint 10,body falling back,remote thumb press,shoulder,hair spike single,bf bent + arm,crt,foot raised right,dad hand,chill face 1,chill face 2,clenched fist,head SMOOSHED,shoulder left dad,df1,body chunk upright,df2,df3,df4,hat front piece,df5,foot rested right 2,hand in,arm spun,shoe raised left,bf 1 finger hand,bf mouth 1,Boyfriend DJ confirm,forearm down ,hand raised left,remote thumb up] + */ + override public function listAnimations():Array + { + var anims:Array = []; + @:privateAccess + for (animKey in anim.symbolDictionary) + { + anims.push(animKey.name); + } + return anims; } public override function update(elapsed:Float):Void @@ -44,11 +63,11 @@ class DJBoyfriend extends FlxSprite { case Intro: // Play the intro animation then leave this state immediately. - if (getCurrentAnimation() != 'intro') playAnimation('intro', true); + if (getCurrentAnimation() != 'boyfriend dj intro') playFlashAnimation('boyfriend dj intro', true); timeSinceSpook = 0; case Idle: // We are in this state the majority of the time. - if (getCurrentAnimation() != 'idle' || animation.finished) + if (getCurrentAnimation() != 'Boyfriend DJ' || anim.finished) { if (timeSinceSpook > SPOOK_PERIOD) { @@ -56,18 +75,18 @@ class DJBoyfriend extends FlxSprite } else { - playAnimation('idle', false); + playFlashAnimation('Boyfriend DJ', false); } } timeSinceSpook += elapsed; case Confirm: - if (getCurrentAnimation() != 'confirm') playAnimation('confirm', false); + if (getCurrentAnimation() != 'Boyfriend DJ confirm') playFlashAnimation('Boyfriend DJ confirm', false); timeSinceSpook = 0; case Spook: - if (getCurrentAnimation() != 'spook') + if (getCurrentAnimation() != 'bf dj afk') { onSpook.dispatch(); - playAnimation('spook', false); + playFlashAnimation('bf dj afk', false); } timeSinceSpook = 0; default: @@ -75,20 +94,21 @@ class DJBoyfriend extends FlxSprite } } - function onFinishAnim(name:String):Void + function onFinishAnim():Void { + var name = anim.curSymbol.name; switch (name) { - case "intro": + case "boyfriend dj intro": // trace('Finished intro'); currentState = Idle; onIntroDone.dispatch(); - case "idle": + case "Boyfriend DJ": // trace('Finished idle'); - case "spook": + case "bf dj afk": // trace('Finished spook'); currentState = Idle; - case "confirm": + case "Boyfriend DJ confirm": // trace('Finished confirm'); } } @@ -100,19 +120,19 @@ class DJBoyfriend extends FlxSprite function setupAnimations():Void { - frames = FlxAnimationUtil.combineFramesCollections(Paths.getSparrowAtlas('freeplay/bfFreeplay'), Paths.getSparrowAtlas('freeplay/bf-freeplay-afk')); + // frames = FlxAnimationUtil.combineFramesCollections(Paths.getSparrowAtlas('freeplay/bfFreeplay'), Paths.getSparrowAtlas('freeplay/bf-freeplay-afk')); - animation.addByPrefix('intro', "boyfriend dj intro", 24, false); - addOffset('intro', 0, 0); + // animation.addByPrefix('intro', "boyfriend dj intro", 24, false); + addOffset('boyfriend dj intro', 8, 3); - animation.addByPrefix('idle', "Boyfriend DJ0", 24, false); - addOffset('idle', -4, -426); + // animation.addByPrefix('idle', "Boyfriend DJ0", 24, false); + addOffset('Boyfriend DJ', 0, 0); - animation.addByPrefix('confirm', "Boyfriend DJ confirm", 24, false); - addOffset('confirm', 40, -451); + // animation.addByPrefix('confirm', "Boyfriend DJ confirm", 24, false); + addOffset('Boyfriend DJ confirm', 0, 0); - animation.addByPrefix('spook', "bf dj afk0", 24, false); - addOffset('spook', -3, -272); + // animation.addByPrefix('spook', "bf dj afk0", 24, false); + addOffset('bf dj afk', 0, 0); } public function confirm():Void @@ -125,15 +145,15 @@ class DJBoyfriend extends FlxSprite animOffsets[name] = [x, y]; } - public function getCurrentAnimation():String + override public function getCurrentAnimation():String { - if (this.animation == null || this.animation.curAnim == null) return ""; - return this.animation.curAnim.name; + if (this.anim == null || this.anim.curSymbol == null) return ""; + return this.anim.curSymbol.name; } - public function playAnimation(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void + public function playFlashAnimation(id:String, ?Force:Bool = false, ?Reverse:Bool = false, ?Frame:Int = 0):Void { - animation.play(AnimName, Force, Reversed, Frame); + anim.play(id, Force, Reverse, Frame); applyAnimOffset(); } diff --git a/source/funkin/freeplayStuff/DifficultyStars.hx b/source/funkin/freeplayStuff/DifficultyStars.hx index 3078f0e9a..cc98fb07b 100644 --- a/source/funkin/freeplayStuff/DifficultyStars.hx +++ b/source/funkin/freeplayStuff/DifficultyStars.hx @@ -40,12 +40,6 @@ class DifficultyStars extends FlxSpriteGroup for (memb in flames.members) memb.shader = hsvShader; - - FlxG.debugger.addTrackerProfile(new TrackerProfile(HSVShader, ["hue", "saturation", "value"])); - FlxG.debugger.track(hsvShader); - - FlxG.debugger.addTrackerProfile(new TrackerProfile(DifficultyStars, ["difficulty"])); - FlxG.debugger.track(this); } override function update(elapsed:Float):Void diff --git a/source/funkin/freeplayStuff/FreeplayFlames.hx b/source/funkin/freeplayStuff/FreeplayFlames.hx index cf606bdb8..8f54d210b 100644 --- a/source/funkin/freeplayStuff/FreeplayFlames.hx +++ b/source/funkin/freeplayStuff/FreeplayFlames.hx @@ -34,9 +34,6 @@ class FreeplayFlames extends FlxSpriteGroup }; add(flame); } - - FlxG.debugger.addTrackerProfile(new TrackerProfile(FreeplayFlames, ["flameTimer"])); - FlxG.debugger.track(this); } var properPositions:Bool = false; diff --git a/source/funkin/ui/title/FlxSpriteOverlay.hx b/source/funkin/ui/title/FlxSpriteOverlay.hx index 2e0ac987e..ddf58bbfd 100644 --- a/source/funkin/ui/title/FlxSpriteOverlay.hx +++ b/source/funkin/ui/title/FlxSpriteOverlay.hx @@ -42,12 +42,12 @@ class FlxSpriteOverlay extends FlxSprite var sprRect = getScreenBounds(); - dipshitBitmap.draw(camera.canvas, camera.canvas.transform.matrix); - blendShader.setCamera(dipshitBitmap); + // dipshitBitmap.draw(camera.canvas, camera.canvas.transform.matrix); + // blendShader.setCamera(dipshitBitmap); - FlxG.bitmapLog.add(dipshitBitmap); + // FlxG.bitmapLog.add(dipshitBitmap); - camera.drawPixels(_frame, framePixels, _matrix, colorTransform, blend, antialiasing, blendShader); + camera.drawPixels(_frame, framePixels, _matrix, colorTransform, blend, antialiasing, shader); } function copyToFlash(rect):openfl.geom.Rectangle From 82bb619864246c6e7f9ddeed23786464c0ebdec7 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 28 Aug 2023 22:47:18 -0400 Subject: [PATCH 41/53] boyfriend tv looping --- source/funkin/freeplayStuff/DJBoyfriend.hx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/funkin/freeplayStuff/DJBoyfriend.hx b/source/funkin/freeplayStuff/DJBoyfriend.hx index 1a7d9b9ed..99981c8fa 100644 --- a/source/funkin/freeplayStuff/DJBoyfriend.hx +++ b/source/funkin/freeplayStuff/DJBoyfriend.hx @@ -89,6 +89,8 @@ class DJBoyfriend extends FlxAtlasSprite playFlashAnimation('bf dj afk', false); } timeSinceSpook = 0; + case TV: + if (getCurrentAnimation() != 'Boyfriend DJ watchin tv OG') playFlashAnimation('Boyfriend DJ watchin tv OG', true); default: // I shit myself. } @@ -109,6 +111,9 @@ class DJBoyfriend extends FlxAtlasSprite // trace('Finished spook'); currentState = Idle; case "Boyfriend DJ confirm": + + case "Boyfriend DJ watchin tv OG": + anim.play("Boyfriend DJ watchin tv OG", true, false, 112); // trace('Finished confirm'); } } @@ -176,4 +181,5 @@ enum DJBoyfriendState Idle; Confirm; Spook; + TV; } From 66f77a985fa8a6e5be6d138cff5d79dbc58e17be Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 29 Aug 2023 00:09:48 -0400 Subject: [PATCH 42/53] boyfriend blink code --- source/funkin/freeplayStuff/DJBoyfriend.hx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/source/funkin/freeplayStuff/DJBoyfriend.hx b/source/funkin/freeplayStuff/DJBoyfriend.hx index 99981c8fa..7292f1dcb 100644 --- a/source/funkin/freeplayStuff/DJBoyfriend.hx +++ b/source/funkin/freeplayStuff/DJBoyfriend.hx @@ -21,7 +21,10 @@ class DJBoyfriend extends FlxAtlasSprite // TODO: Switch this class to use SwagSprite instead. public var animOffsets:Map>; - static final SPOOK_PERIOD:Float = 180.0; + var gotSpooked:Bool = false; + + static final SPOOK_PERIOD:Float = 120.0; + static final TV_PERIOD:Float = 180.0; // Time since dad last SPOOKED you. var timeSinceSpook:Float = 0; @@ -36,8 +39,13 @@ class DJBoyfriend extends FlxAtlasSprite trace(listAnimations()); FlxG.debugger.track(this); + FlxG.console.registerObject("dj", this); anim.onComplete = onFinishAnim; + + FlxG.console.registerFunction("tv", function() { + currentState = TV; + }); } /* @@ -69,10 +77,14 @@ class DJBoyfriend extends FlxAtlasSprite // We are in this state the majority of the time. if (getCurrentAnimation() != 'Boyfriend DJ' || anim.finished) { - if (timeSinceSpook > SPOOK_PERIOD) + if (timeSinceSpook > SPOOK_PERIOD && !gotSpooked) { currentState = Spook; } + else if (timeSinceSpook > TV_PERIOD) + { + currentState = TV; + } else { playFlashAnimation('Boyfriend DJ', false); @@ -91,6 +103,7 @@ class DJBoyfriend extends FlxAtlasSprite timeSinceSpook = 0; case TV: if (getCurrentAnimation() != 'Boyfriend DJ watchin tv OG') playFlashAnimation('Boyfriend DJ watchin tv OG', true); + timeSinceSpook = 0; default: // I shit myself. } @@ -113,7 +126,8 @@ class DJBoyfriend extends FlxAtlasSprite case "Boyfriend DJ confirm": case "Boyfriend DJ watchin tv OG": - anim.play("Boyfriend DJ watchin tv OG", true, false, 112); + var frame:Int = FlxG.random.bool(33) ? 112 : 166; + anim.play("Boyfriend DJ watchin tv OG", true, false, frame); // trace('Finished confirm'); } } From ab5d6d2f485898257f16e6ef930348b315fcc901 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 29 Aug 2023 03:11:40 -0400 Subject: [PATCH 43/53] sounds in progress --- art | 2 +- assets | 2 +- hmm.json | 2 +- source/funkin/freeplayStuff/DJBoyfriend.hx | 31 ++++++++++++++++++++++ 4 files changed, 34 insertions(+), 3 deletions(-) diff --git a/art b/art index 769b84ffd..61f8e43cf 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit 769b84ffd7550b18fb3719cf4cb6b48296bdd097 +Subproject commit 61f8e43cf782ad480cd9ed29cd982562becb59a5 diff --git a/assets b/assets index 2d4cd8512..096b42fb7 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 2d4cd85129db9aea8cdba62ef43313f99f13c857 +Subproject commit 096b42fb7d263752cd39ab76ef0cc1bcb391ea51 diff --git a/hmm.json b/hmm.json index bb2832ba8..e830ff435 100644 --- a/hmm.json +++ b/hmm.json @@ -32,7 +32,7 @@ "name": "flxanimate", "type": "git", "dir": null, - "ref": "37fd4ed45011063a38fdfe9bb6091671b3ac6c17", + "ref": "dd2903f", "url": "https://github.com/ninjamuffin99/flxanimate" }, { diff --git a/source/funkin/freeplayStuff/DJBoyfriend.hx b/source/funkin/freeplayStuff/DJBoyfriend.hx index 7292f1dcb..e6e66e876 100644 --- a/source/funkin/freeplayStuff/DJBoyfriend.hx +++ b/source/funkin/freeplayStuff/DJBoyfriend.hx @@ -4,6 +4,7 @@ import flixel.FlxSprite; import flixel.util.FlxSignal; import funkin.util.assets.FlxAnimationUtil; import funkin.graphics.adobeanimate.FlxAtlasSprite; +import flixel.system.FlxSound; class DJBoyfriend extends FlxAtlasSprite { @@ -35,6 +36,15 @@ class DJBoyfriend extends FlxAtlasSprite animOffsets = new Map>(); + anim.callback = function(name, number) { + switch (name) + { + case "Boyfriend DJ watchin tv OG": + if (number == 85) runTvLogic(); + default: + } + }; + setupAnimations(); trace(listAnimations()); @@ -127,6 +137,11 @@ class DJBoyfriend extends FlxAtlasSprite case "Boyfriend DJ watchin tv OG": var frame:Int = FlxG.random.bool(33) ? 112 : 166; + if (FlxG.random.bool(10)) + { + frame = 60; + // boyfriend switches channel code? + } anim.play("Boyfriend DJ watchin tv OG", true, false, frame); // trace('Finished confirm'); } @@ -154,6 +169,22 @@ class DJBoyfriend extends FlxAtlasSprite addOffset('bf dj afk', 0, 0); } + var cartoonSnd:FlxSound; + + public function runTvLogic() + { + if (cartoonSnd == null) + { + // cartoonSnd = new FlxSound(); + // cartoonSnd.loadEmbedded(Paths.sound("cartoons/peck")); + // FlxG.sound.defaultSoundGroup.add(cartoonSnd); + // cartoonSnd.play(); + } + + // play sound of random flash toon + // if tv is already playing, play a new one + } + public function confirm():Void { currentState = Confirm; From 8f9206f6394b2af57501dc1ac8956393d40fb547 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 29 Aug 2023 05:37:24 -0400 Subject: [PATCH 44/53] python file to generate shitty audio --- .gitignore | 3 ++- art | 2 +- source/funkin/freeplayStuff/DJBoyfriend.hx | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index d4aba58ac..b2fe731ea 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ APIStuff.hx dump/ export/ -RECOVER_*.fla \ No newline at end of file +RECOVER_*.fla +shitAudio/ diff --git a/art b/art index 61f8e43cf..d1aa2c6e8 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit 61f8e43cf782ad480cd9ed29cd982562becb59a5 +Subproject commit d1aa2c6e81c0ddff8af3d6aac4700590cc5b0ef4 diff --git a/source/funkin/freeplayStuff/DJBoyfriend.hx b/source/funkin/freeplayStuff/DJBoyfriend.hx index e6e66e876..c4524bcfc 100644 --- a/source/funkin/freeplayStuff/DJBoyfriend.hx +++ b/source/funkin/freeplayStuff/DJBoyfriend.hx @@ -176,10 +176,10 @@ class DJBoyfriend extends FlxAtlasSprite if (cartoonSnd == null) { // cartoonSnd = new FlxSound(); - // cartoonSnd.loadEmbedded(Paths.sound("cartoons/peck")); // FlxG.sound.defaultSoundGroup.add(cartoonSnd); - // cartoonSnd.play(); } + // cartoonSnd.loadEmbedded(Paths.sound("cartoons/peck")); + // cartoonSnd.play(); // play sound of random flash toon // if tv is already playing, play a new one From 8c74fcd73ab474c4f24551f00277afebe12492c3 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 30 Aug 2023 20:46:30 -0400 Subject: [PATCH 45/53] playingCartoon bool woops --- source/funkin/freeplayStuff/DJBoyfriend.hx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/funkin/freeplayStuff/DJBoyfriend.hx b/source/funkin/freeplayStuff/DJBoyfriend.hx index c4524bcfc..19f0ac958 100644 --- a/source/funkin/freeplayStuff/DJBoyfriend.hx +++ b/source/funkin/freeplayStuff/DJBoyfriend.hx @@ -171,6 +171,8 @@ class DJBoyfriend extends FlxAtlasSprite var cartoonSnd:FlxSound; + var playingCartoon:Bool = false; + public function runTvLogic() { if (cartoonSnd == null) From 546e15dcac213c68b86803176d9a5af60eedc3ad Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 30 Aug 2023 20:50:07 -0400 Subject: [PATCH 46/53] click polish --- source/funkin/freeplayStuff/DJBoyfriend.hx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/source/funkin/freeplayStuff/DJBoyfriend.hx b/source/funkin/freeplayStuff/DJBoyfriend.hx index 19f0ac958..3fa1d206e 100644 --- a/source/funkin/freeplayStuff/DJBoyfriend.hx +++ b/source/funkin/freeplayStuff/DJBoyfriend.hx @@ -171,14 +171,24 @@ class DJBoyfriend extends FlxAtlasSprite var cartoonSnd:FlxSound; - var playingCartoon:Bool = false; + public var playingCartoon:Bool = false; public function runTvLogic() { if (cartoonSnd == null) { - // cartoonSnd = new FlxSound(); - // FlxG.sound.defaultSoundGroup.add(cartoonSnd); + // tv is OFF, but getting turned on + FlxG.sound.play(Paths.sound('tv_on')); + + cartoonSnd = new FlxSound(); + FlxG.sound.defaultSoundGroup.add(cartoonSnd); + } + else + { + // plays it smidge after the click + new FlxTimer().start(0.5, 1, function(_) { + FlxG.sound.play(Paths.sound('channel_switch')); + }); } // cartoonSnd.loadEmbedded(Paths.sound("cartoons/peck")); // cartoonSnd.play(); From ba896508cc9f47316ead50c116d6b60c9c8abfac Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 31 Aug 2023 01:56:35 -0400 Subject: [PATCH 47/53] cartoons and stuff --- assets | 2 +- source/funkin/audio/FlxStreamSound.hx | 49 ++++++++++++++++++++++ source/funkin/freeplayStuff/DJBoyfriend.hx | 31 +++++++++++--- 3 files changed, 76 insertions(+), 6 deletions(-) create mode 100644 source/funkin/audio/FlxStreamSound.hx diff --git a/assets b/assets index 096b42fb7..386dcac52 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 096b42fb7d263752cd39ab76ef0cc1bcb391ea51 +Subproject commit 386dcac52e7b8ddc8cc4ad3864bd8d51f01564d1 diff --git a/source/funkin/audio/FlxStreamSound.hx b/source/funkin/audio/FlxStreamSound.hx new file mode 100644 index 000000000..a572ad436 --- /dev/null +++ b/source/funkin/audio/FlxStreamSound.hx @@ -0,0 +1,49 @@ +package funkin.audio; + +import flash.media.Sound; +#if flash11 +import flash.utils.ByteArray; +#end +import flixel.sound.FlxSound; +import flixel.system.FlxAssets.FlxSoundAsset; +import openfl.Assets; +#if (openfl >= "8.0.0") +import openfl.utils.AssetType; +#end + +/** + * a FlxSound that just overrides loadEmbedded to allow for "streamed" sounds to load with better performance! + */ +class FlxStreamSound extends FlxSound +{ + public function new() + { + super(); + } + + override public function loadEmbedded(EmbeddedSound:FlxSoundAsset, Looped:Bool = false, AutoDestroy:Bool = false, ?OnComplete:Void->Void):FlxSound + { + if (EmbeddedSound == null) return this; + + cleanup(true); + + if ((EmbeddedSound is Sound)) + { + _sound = EmbeddedSound; + } + else if ((EmbeddedSound is Class)) + { + _sound = Type.createInstance(EmbeddedSound, []); + } + else if ((EmbeddedSound is String)) + { + if (Assets.exists(EmbeddedSound, AssetType.SOUND) + || Assets.exists(EmbeddedSound, AssetType.MUSIC)) _sound = Assets.getMusic(EmbeddedSound); + else + FlxG.log.error('Could not find a Sound asset with an ID of \'$EmbeddedSound\'.'); + } + + // NOTE: can't pull ID3 info from embedded sound currently + return init(Looped, AutoDestroy, OnComplete); + } +} diff --git a/source/funkin/freeplayStuff/DJBoyfriend.hx b/source/funkin/freeplayStuff/DJBoyfriend.hx index 3fa1d206e..58318df15 100644 --- a/source/funkin/freeplayStuff/DJBoyfriend.hx +++ b/source/funkin/freeplayStuff/DJBoyfriend.hx @@ -5,6 +5,8 @@ import flixel.util.FlxSignal; import funkin.util.assets.FlxAnimationUtil; import funkin.graphics.adobeanimate.FlxAtlasSprite; import flixel.system.FlxSound; +import flixel.util.FlxTimer; +import funkin.audio.FlxStreamSound; class DJBoyfriend extends FlxAtlasSprite { @@ -169,7 +171,7 @@ class DJBoyfriend extends FlxAtlasSprite addOffset('bf dj afk', 0, 0); } - var cartoonSnd:FlxSound; + var cartoonSnd:FlxStreamSound; public var playingCartoon:Bool = false; @@ -180,21 +182,40 @@ class DJBoyfriend extends FlxAtlasSprite // tv is OFF, but getting turned on FlxG.sound.play(Paths.sound('tv_on')); - cartoonSnd = new FlxSound(); + cartoonSnd = new FlxStreamSound(); FlxG.sound.defaultSoundGroup.add(cartoonSnd); } else { // plays it smidge after the click - new FlxTimer().start(0.5, 1, function(_) { + new FlxTimer().start(0.1, function(_) { FlxG.sound.play(Paths.sound('channel_switch')); }); } // cartoonSnd.loadEmbedded(Paths.sound("cartoons/peck")); // cartoonSnd.play(); - // play sound of random flash toon - // if tv is already playing, play a new one + loadCartoon(); + } + + function loadCartoon() + { + cartoonSnd.loadEmbedded(Paths.sound(getRandomFlashToon()), false, false, function() { + anim.play("Boyfriend DJ watchin tv OG", true, false, 60); + }); + cartoonSnd.play(true, FlxG.random.float(0, cartoonSnd.length)); + } + + var cartoonList:Array = Assets.list().filter(function(path) return path.startsWith("assets/sounds/cartoons/")); + + function getRandomFlashToon():String + { + var randomFile = FlxG.random.getObject(cartoonList); + + randomFile = randomFile.replace("assets/sounds/", ""); + randomFile = randomFile.substring(0, randomFile.length - 4); + + return randomFile; } public function confirm():Void From 387acd211e47968c2407b18442800c89d24bd5cf Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 19 Sep 2023 01:31:54 -0400 Subject: [PATCH 48/53] icon scaling fix + removed temp lighting --- source/funkin/freeplayStuff/SongMenuItem.hx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 0f0521004..60af8d0f2 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -178,9 +178,8 @@ class SongMenuItem extends FlxSpriteGroup } pixelIcon.loadGraphic(Paths.image(charPath)); - pixelIcon.setGraphicSize(Std.int(pixelIcon.width * 2)); - pixelIcon.updateHitbox(); - pixelIcon.origin.x += 100; + pixelIcon.scale.x = pixelIcon.scale.y = 2; + pixelIcon.origin.x = 100; // pixelIcon.origin.x = capsule.origin.x; // pixelIcon.offset.x -= pixelIcon.origin.x; } From 4b1af216d4a86e354ec8c33c6a0139bcdc3397f7 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 19 Sep 2023 19:10:30 -0400 Subject: [PATCH 49/53] capsule alpha stuff in progress --- source/funkin/FreeplayState.hx | 7 +++---- source/funkin/freeplayStuff/SongMenuItem.hx | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 9447488ff..6d8c24bbf 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -585,11 +585,10 @@ class FreeplayState extends MusicBeatSubState funnyMenu.y = funnyMenu.intendedY(i + 1) + 10; funnyMenu.targetPos.x = funnyMenu.x; funnyMenu.ID = i; - funnyMenu.alpha = 0.5; + funnyMenu.capsule.alpha = 0.5; funnyMenu.songText.visible = false; funnyMenu.favIcon.visible = tempSongs[i].isFav; funnyMenu.hsvShader = hsvShader; - // fp.updateScore(0); if (i < 8) funnyMenu.initJumpIn(Math.min(i, 4), force); @@ -943,7 +942,7 @@ class FreeplayState extends MusicBeatSubState function capsuleOnConfirmDefault():Void { - var poop:String = songs[curSelected].songName.toLowerCase(); + // var poop:String = songs[curSelected].songName.toLowerCase(); // does not work properly, always just accidentally sets it to normal anyways! /* if (!Assets.exists(Paths.json(songs[curSelected].songName + '/' + poop))) @@ -1035,7 +1034,7 @@ class FreeplayState extends MusicBeatSubState { index += 1; - capsule.selected = false; + capsule.selected = true; capsule.targetPos.y = capsule.intendedY(index - curSelected); capsule.targetPos.x = 270 + (60 * (Math.sin(index - curSelected))); diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 60af8d0f2..6301f14c4 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -15,10 +15,11 @@ import funkin.shaderslmfao.Grayscale; class SongMenuItem extends FlxSpriteGroup { - var capsule:FlxSprite; + public var capsule:FlxSprite; + var pixelIcon:FlxSprite; - public var selected(default, set):Bool = false; + public var selected(default, set):Bool; public var songTitle:String = "Test"; @@ -108,8 +109,6 @@ class SongMenuItem extends FlxSpriteGroup // grpHide.add(favIcon); setVisibleGrp(false); - - selected = selected; // just to kickstart the set_selected } function set_hsvShader(value:HSVShader):HSVShader @@ -144,6 +143,8 @@ class SongMenuItem extends FlxSpriteGroup } if (value) textAppear(); + + selectedAlpha(); } public function init(x:Float, y:Float, song:String, ?character:String) @@ -210,14 +211,16 @@ class SongMenuItem extends FlxSpriteGroup if (force) { - alpha = 1; + visible = true; + capsule.alpha = 1; setVisibleGrp(true); } else { new FlxTimer().start((xFrames.length / 24) * 2.5, function(_) { + visible = true; + capsule.alpha = 1; setVisibleGrp(true); - alpha = 1; }); } } @@ -226,7 +229,9 @@ class SongMenuItem extends FlxSpriteGroup public function forcePosition() { - alpha = 1; + visible = true; + capsule.alpha = 1; + selectedAlpha(); doLerp = true; doJumpIn = false; doJumpOut = false; @@ -303,6 +308,7 @@ class SongMenuItem extends FlxSpriteGroup function set_selected(value:Bool):Bool { + trace("set_selected: " + value); // cute one liners, lol! diffGrayscale.setAmount(value ? 0 : 0.8); songText.alpha = value ? 1 : 0.6; From 9926706e6e9c72ba70008db456bbb6d3376dc1d9 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 19 Sep 2023 23:27:07 -0400 Subject: [PATCH 50/53] litty fix --- source/funkin/FreeplayState.hx | 6 +++++- source/funkin/freeplayStuff/SongMenuItem.hx | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 6d8c24bbf..0f9615927 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -426,6 +426,7 @@ class FreeplayState extends MusicBeatSubState dj.onIntroDone.add(function() { // when boyfriend hits dat shiii // + albumArt.visible = true; albumArt.anim.play(""); albumArt.anim.onComplete = function() { @@ -468,6 +469,7 @@ class FreeplayState extends MusicBeatSubState new FlxTimer().start(1.5 / 24, function(bold) { sillyStroke.width = 0; sillyStroke.height = 0; + changeSelection(); }); }); @@ -598,6 +600,8 @@ class FreeplayState extends MusicBeatSubState grpCapsules.add(funnyMenu); } + FlxG.console.registerFunction("changeSelection", changeSelection); + changeSelection(); changeDiff(); } @@ -1034,7 +1038,7 @@ class FreeplayState extends MusicBeatSubState { index += 1; - capsule.selected = true; + capsule.selected = index == curSelected + 1; capsule.targetPos.y = capsule.intendedY(index - curSelected); capsule.targetPos.x = 270 + (60 * (Math.sin(index - curSelected))); diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 6301f14c4..3518e96ce 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -308,7 +308,6 @@ class SongMenuItem extends FlxSpriteGroup function set_selected(value:Bool):Bool { - trace("set_selected: " + value); // cute one liners, lol! diffGrayscale.setAmount(value ? 0 : 0.8); songText.alpha = value ? 1 : 0.6; From 9446f268e0acf427cc203930586f3e5db99c9e18 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 20 Sep 2023 22:57:41 -0400 Subject: [PATCH 51/53] diff stars pop in nicer --- source/funkin/FreeplayState.hx | 10 ++++++++++ source/funkin/freeplayStuff/DifficultyStars.hx | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 0f9615927..906591656 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -331,7 +331,9 @@ class FreeplayState extends MusicBeatSubState var albumTitle:FlxSprite = new FlxSprite(947, 491).loadGraphic(Paths.image('freeplay/albumTitle-fnfvol1')); var albumArtist:FlxSprite = new FlxSprite(1010, 607).loadGraphic(Paths.image('freeplay/albumArtist-kawaisprite')); + var difficultyStars:DifficultyStars = new DifficultyStars(140, 39); + difficultyStars.stars.visible = false; albumTitle.visible = false; albumArtist.visible = false; @@ -348,9 +350,16 @@ class FreeplayState extends MusicBeatSubState speed: 0.2, wait: 0.2 }); + exitMovers.set([difficultyStars], + { + x: FlxG.width * 1.2, + speed: 0.2, + wait: 0.3 + }); add(albumTitle); add(albumArtist); + add(difficultyStars); var overhangStuff:FlxSprite = new FlxSprite().makeGraphic(FlxG.width, 64, FlxColor.BLACK); overhangStuff.y -= overhangStuff.height; @@ -439,6 +448,7 @@ class FreeplayState extends MusicBeatSubState new FlxTimer().start(35 / 24, function(_) { albumArtist.visible = true; + difficultyStars.stars.visible = true; }); FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut}); diff --git a/source/funkin/freeplayStuff/DifficultyStars.hx b/source/funkin/freeplayStuff/DifficultyStars.hx index cc98fb07b..8611727be 100644 --- a/source/funkin/freeplayStuff/DifficultyStars.hx +++ b/source/funkin/freeplayStuff/DifficultyStars.hx @@ -17,7 +17,7 @@ class DifficultyStars extends FlxSpriteGroup */ public var difficulty(default, set):Int = 1; - var stars:FlxAtlasSprite; + public var stars:FlxAtlasSprite; var flames:FreeplayFlames; From 8009045e76897eb13f0d5916a4603a4d000bfb13 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 28 Sep 2023 20:29:19 -0400 Subject: [PATCH 52/53] fix to song selection --- source/funkin/FreeplayState.hx | 55 ++++++++++----------- source/funkin/freeplayStuff/SongMenuItem.hx | 8 ++- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 906591656..9ad364215 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -22,6 +22,7 @@ import flixel.tweens.FlxEase; import flixel.tweens.FlxTween; import flixel.util.FlxColor; import funkin.data.song.SongRegistry; +import funkin.data.level.LevelRegistry; import flixel.util.FlxSpriteUtil; import flixel.util.FlxTimer; import funkin.Controls.Control; @@ -71,6 +72,7 @@ class FreeplayState extends MusicBeatSubState var grpSongs:FlxTypedGroup; var grpCapsules:FlxTypedGroup; + var curCapsule:SongMenuItem; var curPlaying:Bool = false; var dj:DJBoyfriend; @@ -120,40 +122,29 @@ class FreeplayState extends MusicBeatSubState addSong('Pyro', 'weekend1', 'darnell'); #end - var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); + // var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); - for (i in 0...initSonglist.length) - { - songs.push(new FreeplaySongData(initSonglist[i], 'tutorial', 'gf')); - } + // for (i in 0...initSonglist.length) + // { + // songs.push(new FreeplaySongData(initSonglist[i], 'tutorial', 'gf')); + // } if (FlxG.sound.music != null) { if (!FlxG.sound.music.playing) FlxG.sound.playMusic(Paths.music('freakyMenu/freakyMenu')); } - // if (StoryMenuState.weekUnlocked[2] || isDebug) - addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 'week1', ['dad']); - - // if (StoryMenuState.weekUnlocked[2] || isDebug) - addWeek(['Spookeez', 'South', 'Monster'], 'week2', ['spooky', 'spooky', 'monster']); - - // if (StoryMenuState.weekUnlocked[3] || isDebug) - addWeek(['Pico', 'Philly-Nice', 'Blammed'], 'week3', ['pico']); - - // if (StoryMenuState.weekUnlocked[4] || isDebug) - addWeek(['Satin-Panties', 'High', 'MILF'], 'week4', ['mom']); - - // if (StoryMenuState.weekUnlocked[5] || isDebug) - addWeek(['Cocoa', 'Eggnog', 'Winter-Horrorland'], 'week5', ['parents-christmas', 'parents-christmas', 'monster-christmas']); - - // if (StoryMenuState.weekUnlocked[6] || isDebug) - addWeek(['Senpai', 'Roses', 'Thorns'], 'week6', ['senpai', 'senpai', 'spirit']); - - // if (StoryMenuState.weekUnlocked[7] || isDebug) - addWeek(['Ugh', 'Guns', 'Stress'], 'week7', ['tankman']); - - addWeek(["Darnell", "lit-up", "2hot", "blazin"], 'weekend1', ['darnell']); + // programmatically adds the songs via LevelRegistry and SongRegistry + for (coolWeek in LevelRegistry.instance.listBaseGameLevelIds()) + { + for (coolSong in LevelRegistry.instance.parseEntryData(coolWeek).songs) + { + var metadata = SongRegistry.instance.parseEntryMetadata(coolSong); + var char = metadata.playData.characters.opponent; + var songName = metadata.songName; + addSong(songName, coolWeek, char); + } + } // LOAD MUSIC @@ -593,7 +584,9 @@ class FreeplayState extends MusicBeatSubState var funnyMenu:SongMenuItem = grpCapsules.recycle(SongMenuItem); funnyMenu.init(FlxG.width, 0, tempSongs[i].songName); if (tempSongs[i].songCharacter != null) funnyMenu.setCharacter(tempSongs[i].songCharacter); - funnyMenu.onConfirm = capsuleOnConfirmDefault; + funnyMenu.onConfirm = function() { + capsuleOnConfirmDefault(funnyMenu); + }; funnyMenu.y = funnyMenu.intendedY(i + 1) + 10; funnyMenu.targetPos.x = funnyMenu.x; funnyMenu.ID = i; @@ -954,7 +947,7 @@ class FreeplayState extends MusicBeatSubState } } - function capsuleOnConfirmDefault():Void + function capsuleOnConfirmDefault(cap:SongMenuItem):Void { // var poop:String = songs[curSelected].songName.toLowerCase(); @@ -969,7 +962,9 @@ class FreeplayState extends MusicBeatSubState }*/ PlayStatePlaylist.isStoryMode = false; - var targetSong:Song = SongDataParser.fetchSong(songs[curSelected].songName.toLowerCase()); + + var songId:String = cap.songTitle.toLowerCase(); + var targetSong:Song = SongRegistry.instance.fetchEntry(songId); var targetDifficulty:String = switch (curDifficulty) { case 0: diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 3518e96ce..5c022121a 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -166,14 +166,20 @@ class SongMenuItem extends FlxSpriteGroup { var charPath:String = "freeplay/icons/"; + trace(char); + switch (char) { case "monster-christmas": charPath += "monsterpixel"; - case "mom": + case "mom-car": charPath += "mommypixel"; case "dad": charPath += "daddypixel"; + case "darnell-blazin": + charPath += "darnellpixel"; + case "senpai-angry": + charPath += "senpaipixel"; default: charPath += char + "pixel"; } From f652beb382fb6d9a886657452e312f9196d4bc40 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 9 Oct 2023 20:04:21 -0400 Subject: [PATCH 53/53] Fix several merge errors. --- assets | 2 +- hmm.json | 8 ++++---- source/funkin/FreeplayState.hx | 10 ++++++++-- source/funkin/freeplayStuff/DJBoyfriend.hx | 2 +- source/funkin/freeplayStuff/SongMenuItem.hx | 19 +++++++++++++++++-- source/funkin/play/song/Song.hx | 2 +- 6 files changed, 32 insertions(+), 11 deletions(-) diff --git a/assets b/assets index 386dcac52..4ee0c341f 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 386dcac52e7b8ddc8cc4ad3864bd8d51f01564d1 +Subproject commit 4ee0c341fd213017b98314d47d28f08b8e1d4289 diff --git a/hmm.json b/hmm.json index e830ff435..3f420ac48 100644 --- a/hmm.json +++ b/hmm.json @@ -4,14 +4,14 @@ "name": "discord_rpc", "type": "git", "dir": null, - "ref": "2d83fa8", + "ref": "2d83fa863ef0c1eace5f1cf67c3ac315d1a3a8a5", "url": "https://github.com/Aidan63/linc_discord-rpc" }, { "name": "flixel", "type": "git", "dir": null, - "ref": "32cee07a", + "ref": "32cee07a0e5f21e590a4b21234603b2cd5898b10", "url": "https://github.com/EliteMasterEric/flixel" }, { @@ -32,7 +32,7 @@ "name": "flxanimate", "type": "git", "dir": null, - "ref": "dd2903f", + "ref": "dd2903f7dc7024335b981edf2a770760cec912e1", "url": "https://github.com/ninjamuffin99/flxanimate" }, { @@ -75,7 +75,7 @@ "name": "hxCodec", "type": "git", "dir": null, - "ref": "c8c47e7", + "ref": "c8c47e706ad82a423783006ed901b6d93c89a421", "url": "https://github.com/polybiusproxy/hxCodec" }, { diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index 9ad364215..3ae32c2e4 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -13,6 +13,7 @@ import flixel.addons.ui.FlxInputText; import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxGroup; import flixel.group.FlxSpriteGroup; +import flixel.system.debug.watch.Tracker.TrackerProfile; import flixel.input.touch.FlxTouch; import flixel.math.FlxAngle; import flixel.math.FlxMath; @@ -31,6 +32,7 @@ import funkin.freeplayStuff.DJBoyfriend; import funkin.freeplayStuff.FreeplayScore; import funkin.freeplayStuff.LetterSort; import funkin.freeplayStuff.SongMenuItem; +import funkin.freeplayStuff.DifficultyStars; import funkin.play.HealthIcon; import funkin.play.PlayState; import funkin.shaderslmfao.AngleMask; @@ -118,8 +120,8 @@ class FreeplayState extends MusicBeatSubState #if debug isDebug = true; - addSong('Test', 'tutorial', 'bf-pixel'); - addSong('Pyro', 'weekend1', 'darnell'); + // addSong('Test', 'tutorial', 'bf-pixel'); + // addSong('Pyro', 'weekend1', 'darnell'); #end // var initSonglist = CoolUtil.coolTextFile(Paths.txt('freeplaySonglist')); @@ -995,6 +997,10 @@ class FreeplayState extends MusicBeatSubState FlxG.sound.play(Paths.sound('confirmMenu')); dj.confirm(); + // Load and cache the song's charts. + // TODO: Do this in the loading state. + targetSong.cacheCharts(true); + new FlxTimer().start(1, function(tmr:FlxTimer) { LoadingState.loadAndSwitchState(new PlayState( { diff --git a/source/funkin/freeplayStuff/DJBoyfriend.hx b/source/funkin/freeplayStuff/DJBoyfriend.hx index 58318df15..ba0ce464d 100644 --- a/source/funkin/freeplayStuff/DJBoyfriend.hx +++ b/source/funkin/freeplayStuff/DJBoyfriend.hx @@ -206,7 +206,7 @@ class DJBoyfriend extends FlxAtlasSprite cartoonSnd.play(true, FlxG.random.float(0, cartoonSnd.length)); } - var cartoonList:Array = Assets.list().filter(function(path) return path.startsWith("assets/sounds/cartoons/")); + var cartoonList:Array = openfl.utils.Assets.list().filter(function(path) return path.startsWith("assets/sounds/cartoons/")); function getRandomFlashToon():String { diff --git a/source/funkin/freeplayStuff/SongMenuItem.hx b/source/funkin/freeplayStuff/SongMenuItem.hx index 5c022121a..5fd7eb576 100644 --- a/source/funkin/freeplayStuff/SongMenuItem.hx +++ b/source/funkin/freeplayStuff/SongMenuItem.hx @@ -159,8 +159,9 @@ class SongMenuItem extends FlxSpriteGroup } /** - * [Description] - * @param char Should be songCharacter, and will get translated to the correct path via switch + * Set the character displayed next to this song in the freeplay menu. + * @param char The character ID used by this song. + * If the character has no freeplay icon, a warning will be thrown and nothing will display. */ public function setCharacter(char:String) { @@ -184,6 +185,12 @@ class SongMenuItem extends FlxSpriteGroup charPath += char + "pixel"; } + if (!openfl.utils.Assets.exists(Paths.image(charPath))) + { + trace('[WARN] Character ${char} has no freeplay icon.'); + return; + } + pixelIcon.loadGraphic(Paths.image(charPath)); pixelIcon.scale.x = pixelIcon.scale.y = 2; pixelIcon.origin.x = 100; @@ -312,6 +319,14 @@ class SongMenuItem extends FlxSpriteGroup return (index * ((height * realScaled) + 10)) + 120; } + /** + * Merely a helper function to call set_selected, to make sure that the alpha is correct on the rankings/selections + */ + public function selectedAlpha():Void + { + selected = selected; + } + function set_selected(value:Bool):Bool { // cute one liners, lol! diff --git a/source/funkin/play/song/Song.hx b/source/funkin/play/song/Song.hx index f3fc89a86..d11c7744b 100644 --- a/source/funkin/play/song/Song.hx +++ b/source/funkin/play/song/Song.hx @@ -117,7 +117,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry, variations:Array, charts:Map, validScore:Bool = false):Song { - var result:Song = new Song(songId, true); + var result:Song = new Song(songId); result._metadata.clear(); for (meta in metadata)