From cb8aa3d17557e8d470da150bd2db1c01a943a680 Mon Sep 17 00:00:00 2001 From: Jakkzero <50273567+Jakkzero@users.noreply.github.com> Date: Fri, 26 Feb 2021 12:27:32 +0000 Subject: [PATCH 01/44] Adding updated source files --- source/Discord.hx | 71 +++++++++++++++++++++++++++++++++ source/FreeplayState.hx | 14 +++++-- source/PlayState.hx | 85 +++++++++++++++++++++++----------------- source/StoryMenuState.hx | 7 ++++ source/TitleState.hx | 12 +++++- 5 files changed, 149 insertions(+), 40 deletions(-) create mode 100644 source/Discord.hx diff --git a/source/Discord.hx b/source/Discord.hx new file mode 100644 index 000000000..eb0c1f8d4 --- /dev/null +++ b/source/Discord.hx @@ -0,0 +1,71 @@ +package; + +import discord_rpc.DiscordRpc; +import haxe.Timer; + +using StringTools; + +class DiscordClient +{ + public function new() + { + trace("Discord Client starting..."); + DiscordRpc.start({ + clientID: "814588678700924999", + onReady: onReady, + onError: onError, + onDisconnected: onDisconnected + }); + trace("Discord Client started."); + + while (true) + { + trace("process called"); + DiscordRpc.process(); + trace("pre-delay"); + Timer.delay(continue, 2000); + trace("post-delay"); + } + + DiscordRpc.shutdown(); + } + + static function onReady() + { + DiscordRpc.presence({ + details: "In the Menus", + state: null, + largeImageKey: 'icon', + largeImageText: "Friday Night Funkin'" + }); + } + + static function onError(_code:Int, _message:String) + { + trace('Error! $_code : $_message'); + } + + static function onDisconnected(_code:Int, _message:String) + { + trace('Disconnected! $_code : $_message'); + } + + public static function initialize() + { + var DiscordDaemon = sys.thread.Thread.create(() -> + { + new DiscordClient(); + }); + trace("Discord Client initialized"); + } + + public static function changePresence(details:String, state:Null<String>) + { + DiscordRpc.presence({ + details: details, + state: state, + largeImageKey: 'icon', + largeImageText: "Friday Night Funkin'" + }); + } +} diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index f8bb333e9..789897b20 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -1,5 +1,8 @@ package; +#if !html +import Discord.DiscordClient; +#end import flash.text.TextField; import flixel.FlxG; import flixel.FlxSprite; @@ -45,6 +48,11 @@ class FreeplayState extends MusicBeatState } */ + #if !html + // Updating Discord Rich Presence + DiscordClient.changePresence("In the menus.", null); + #end + var isDebug:Bool = false; #if debug @@ -229,9 +237,9 @@ class FreeplayState extends MusicBeatState function changeSelection(change:Int = 0) { - #if !switch - NGio.logEvent('Fresh'); - #end + // #if !switch + // NGio.logEvent('Fresh'); + // #end // NGio.logEvent('Fresh'); FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); diff --git a/source/PlayState.hx b/source/PlayState.hx index aabb992f5..0356dd58a 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1,5 +1,8 @@ package; +#if !html +import Discord.DiscordClient; +#end import Section.SwagSection; import Song.SwagSong; import WiggleEffect.WiggleEffectType; @@ -124,7 +127,6 @@ class PlayState extends MusicBeatState override public function create() { - if (FlxG.sound.music != null) FlxG.sound.music.stop(); @@ -174,6 +176,29 @@ class PlayState extends MusicBeatState dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue')); } + #if !html + // Making difficulty text for Discord Rich Presence. + var storyDifficultyText = ""; + switch (storyDifficulty) + { + case 0: + storyDifficultyText = "Easy"; + case 1: + storyDifficultyText = "Normal"; + case 2: + storyDifficultyText = "Hard"; + } + // Updating Discord Rich Presence. + if (isStoryMode) + { + DiscordClient.changePresence("Story Mode: Week " + storyWeek, SONG.song + " (" + storyDifficultyText + ")"); + } + else + { + DiscordClient.changePresence("Freeplay", SONG.song + " (" + storyDifficultyText + ")"); + } + #end + if (SONG.song.toLowerCase() == 'spookeez' || SONG.song.toLowerCase() == 'monster' || SONG.song.toLowerCase() == 'south') { curStage = "spooky"; @@ -870,16 +895,8 @@ class PlayState extends MusicBeatState var introAssets:Map<String, Array<String>> = new Map<String, Array<String>>(); introAssets.set('default', ['ready', "set", "go"]); - introAssets.set('school', [ - 'weeb/pixelUI/ready-pixel', - 'weeb/pixelUI/set-pixel', - 'weeb/pixelUI/date-pixel' - ]); - introAssets.set('schoolEvil', [ - 'weeb/pixelUI/ready-pixel', - 'weeb/pixelUI/set-pixel', - 'weeb/pixelUI/date-pixel' - ]); + introAssets.set('school', ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel']); + introAssets.set('schoolEvil', ['weeb/pixelUI/ready-pixel', 'weeb/pixelUI/set-pixel', 'weeb/pixelUI/date-pixel']); var introAlts:Array<String> = introAssets.get('default'); var altSuffix:String = ""; @@ -1059,9 +1076,7 @@ class PlayState extends MusicBeatState { swagNote.x += FlxG.width / 2; // general offset } - else - { - } + else {} } daBeats += 1; } @@ -1920,29 +1935,29 @@ class PlayState extends MusicBeatState */ // trace(daNote.noteData); /* - switch (daNote.noteData) + switch (daNote.noteData) + { + case 2: // NOTES YOU JUST PRESSED + if (upP || rightP || downP || leftP) + noteCheck(upP, daNote); + case 3: + if (upP || rightP || downP || leftP) + noteCheck(rightP, daNote); + case 1: + if (upP || rightP || downP || leftP) + noteCheck(downP, daNote); + case 0: + if (upP || rightP || downP || leftP) + noteCheck(leftP, daNote); + } + + //this is already done in noteCheck / goodNoteHit + if (daNote.wasGoodHit) { - case 2: // NOTES YOU JUST PRESSED - if (upP || rightP || downP || leftP) - noteCheck(upP, daNote); - case 3: - if (upP || rightP || downP || leftP) - noteCheck(rightP, daNote); - case 1: - if (upP || rightP || downP || leftP) - noteCheck(downP, daNote); - case 0: - if (upP || rightP || downP || leftP) - noteCheck(leftP, daNote); + daNote.kill(); + notes.remove(daNote, true); + daNote.destroy(); } - - //this is already done in noteCheck / goodNoteHit - if (daNote.wasGoodHit) - { - daNote.kill(); - notes.remove(daNote, true); - daNote.destroy(); - } */ } else diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 1156ccade..0e4b06558 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -1,5 +1,8 @@ package; +#if !html +import Discord.DiscordClient; +#end import flixel.FlxG; import flixel.FlxSprite; import flixel.addons.transition.FlxTransitionableState; @@ -109,6 +112,10 @@ class StoryMenuState extends MusicBeatState add(grpLocks); trace("Line 70"); + #if !html + // Updating Discord Rich Presence + DiscordClient.changePresence("In the menus.", null); + #end for (i in 0...weekData.length) { diff --git a/source/TitleState.hx b/source/TitleState.hx index 3a3041678..842e37fbf 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -1,5 +1,8 @@ package; +#if !html5 +import Discord.DiscordClient; +#end import flixel.FlxG; import flixel.FlxSprite; import flixel.FlxState; @@ -23,6 +26,7 @@ import flixel.util.FlxTimer; import io.newgrounds.NG; import lime.app.Application; import openfl.Assets; +import sys.thread.Thread; using StringTools; @@ -45,7 +49,7 @@ class TitleState extends MusicBeatState #if polymod polymod.Polymod.init({modRoot: "mods", dirs: ['introMod']}); #end - + PlayerSettings.init(); curWacky = FlxG.random.getObject(getIntroTextShit()); @@ -89,6 +93,10 @@ class TitleState extends MusicBeatState startIntro(); }); #end + + #if !html + DiscordClient.initialize(); + #end } var logoBl:FlxSprite; @@ -282,12 +290,12 @@ class TitleState extends MusicBeatState if (version.trim() != NGio.GAME_VER_NUMS.trim() && !OutdatedSubState.leftState) { + FlxG.switchState(new OutdatedSubState()); trace('OLD VERSION!'); trace('old ver'); trace(version.trim()); trace('cur ver'); trace(NGio.GAME_VER_NUMS.trim()); - FlxG.switchState(new OutdatedSubState()); } else { From 17a18f080ef6dfe4d13c96f46d3bbd4bcd4882b0 Mon Sep 17 00:00:00 2001 From: Jakkzero <50273567+Jakkzero@users.noreply.github.com> Date: Fri, 26 Feb 2021 12:34:31 +0000 Subject: [PATCH 02/44] Adding discord_rpc as a library --- Project.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/Project.xml b/Project.xml index 7edddb77c..23de20a24 100644 --- a/Project.xml +++ b/Project.xml @@ -116,6 +116,7 @@ <haxelib name="newgrounds"/> <haxelib name="faxe" if='switch'/> <haxelib name="polymod"/> + <haxelib name="discord_rpc" unless="web"/> <!-- <haxelib name="hxcpp-debug-server" if="desktop"/> --> <!-- <haxelib name="markdown" /> --> From 580f41f09d23388fce6f8d228f860f3313f4ac2e Mon Sep 17 00:00:00 2001 From: Jakkzero <50273567+Jakkzero@users.noreply.github.com> Date: Fri, 26 Feb 2021 12:52:40 +0000 Subject: [PATCH 03/44] fixed endless discord updates I'm an idiot and had no idea what I was doing with haxe.Timer.delay() so I'm using Sys.sleep() and it seems to work fine. --- source/Discord.hx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/Discord.hx b/source/Discord.hx index eb0c1f8d4..3a20ebabe 100644 --- a/source/Discord.hx +++ b/source/Discord.hx @@ -1,7 +1,7 @@ package; +import Sys.sleep; import discord_rpc.DiscordRpc; -import haxe.Timer; using StringTools; @@ -20,11 +20,9 @@ class DiscordClient while (true) { - trace("process called"); DiscordRpc.process(); - trace("pre-delay"); - Timer.delay(continue, 2000); - trace("post-delay"); + sleep(2); + trace("Discord Client Update"); } DiscordRpc.shutdown(); From 4ccf1ad21b4e7f72d884605c2784da4ba3eaac64 Mon Sep 17 00:00:00 2001 From: Jakkzero <50273567+Jakkzero@users.noreply.github.com> Date: Fri, 26 Feb 2021 13:18:35 +0000 Subject: [PATCH 04/44] Update README.md --- README.md | 100 ++++++------------------------------------------------ 1 file changed, 10 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index 2c40ffc1c..5a4364f9c 100644 --- a/README.md +++ b/README.md @@ -1,94 +1,14 @@ -# Friday Night Funkin +# Friday Night Funkin Discord RPC -This is the repository for Friday Night Funkin, a game originally made for Ludum Dare 47 "Stuck In a Loop". +This is a fork that adds Discord RPC (custom status) to Funkin'. -Play the Ludum Dare prototype here: https://ninja-muffin24.itch.io/friday-night-funkin -Play the Newgrounds one here: https://www.newgrounds.com/portal/view/770371 -Support the project on the itch.io page: https://ninja-muffin24.itch.io/funkin +## Before you use +Please note that due to the way Discord's system works, apps that have not been approved are on a whitelist. +If you want to try this out, please dm me on Discord at Jak_#0768 and I will add you to the whitelist when I can. -## Credits / shoutouts +## Building +This won't build on html5, because I put pre-compiler tags to stop it from doing so. This should mean it only builds on desktop, but it will work on Android and stuff, so if that's what you're going for you should probably change the tags. -- [ninjamuffin99 (me!)](https://twitter.com/ninja_muffin99) - Programmer -- [PhantomArcade3K](https://twitter.com/phantomarcade3k) and [Evilsk8r](https://twitter.com/evilsk8r) - Art -- [Kawaisprite](https://twitter.com/kawaisprite) - Musician - -This game was made with love to Newgrounds and it's community. Extra love to Tom Fulp. - -## Build instructions - -THESE INSTRUCTIONS ARE FOR COMPILING THE GAME'S SOURCE CODE!!! - -IF YOU WANT TO JUST DOWNLOAD AND INSTALL AND PLAY THE GAME NORMALLY, GO TO ITCH.IO TO DOWNLOAD THE GAME FOR PC, MAC, AND LINUX!! - -https://ninja-muffin24.itch.io/friday-night-funkin - -IF YOU WANT TO COMPILE THE GAME YOURSELF, CONTINUE READING!!! - -### Installing the Required Programs - -First you need to install Haxe and HaxeFlixel. I'm too lazy to write and keep updated with that setup (which is pretty simple). -1. [Install Haxe 4.1.5](https://haxe.org/download/version/4.1.5/) (Download 4.1.5 instead of 4.2.0 because 4.2.0 is broken and is not working with gits properly...) -2. [Install HaxeFlixel](https://haxeflixel.com/documentation/install-haxeflixel/) after downloading Haxe - -Other installations you'd need is the additional libraries, a fully updated list will be in `Project.xml` in the project root. Currently, these are all of the things you need to install: -``` -flixel -flixel-addons -flixel-ui -hscript -newgrounds -``` -So for each of those type `haxelib install [library]` so shit like `haxelib install newgrounds` - -You'll also need to install polymod. To do this, you need to do a few things first. -1. Download [git-scm](https://git-scm.com/downloads). Works for Windows, Mac, and Linux, just select your build. -2. Follow instructions to install the application properly. -3. Run `haxelib git polymod https://github.com/larsiusprime/polymod.git` in terminal/command-prompt after your git program is installed. - -You should have everything ready for compiling the game! Follow the guide below to continue! - -### Ignored files - -I gitignore the API keys for the game, so that no one can nab them and post fake highscores on the leaderboards. But because of that the game -doesn't compile without it. - -Just make a file in `/source` and call it `APIStuff.hx`, and copy paste this into it - -```haxe -package; - -class APIStuff -{ - public static var API:String = ""; - public static var EncKey:String = ""; -} - -``` - -and you should be good to go there. - -### Compiling game - -Once you have all those installed, it's pretty easy to compile the game. You just need to run 'lime test html5 -debug' in the root of the project to build and run the HTML5 version. (command prompt navigation guide can be found here: [https://ninjamuffin99.newgrounds.com/news/post/1090480](https://ninjamuffin99.newgrounds.com/news/post/1090480)) - -To run it from your desktop (Windows, Mac, Linux) it can be a bit more involved. For Linux, you only need to open a terminal in the project directory and run 'lime test linux -debug' and then run the executible file in export/release/linux/bin. For Windows, you need to install Visual Studio Community 2019. While installing VSC, don't click on any of the options to install workloads. Instead, go to the individual components tab and choose the following: -* MSVC v142 - VS 2019 C++ x64/x86 build tools -* Windows SDK (10.0.17763.0) -* C++ Profiling tools -* C++ CMake tools for windows -* C++ ATL for v142 build tools (x86 & x64) -* C++ MFC for v142 build tools (x86 & x64) -* C++/CLI support for v142 build tools (14.21) -* C++ Modules for v142 build tools (x64/x86) -* Clang Compiler for Windows -* Windows 10 SDK (10.0.17134.0) -* Windows 10 SDK (10.0.16299.0) -* MSVC v141 - VS 2017 C++ x64/x86 build tools -* MSVC v140 - VS 2015 C++ build tools (v14.00) - -This will install about 22GB of crap, but once that is done you can open up a command line in the project's directory and run `lime test windows -debug`. Once that command finishes (it takes forever even on a higher end PC), you can run FNF from the .exe file under export\release\windows\bin -As for Mac, 'lime test mac -debug' should work, if not the internet surely has a guide on how to compile Haxe stuff for Mac. - -### Additional guides - -- [Command line basics](https://ninjamuffin99.newgrounds.com/news/post/1090480) +This uses a haxelib library called linc_discord-rpc which you should be able to download with: +```haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc``` +This library has a dependency for hxcpp, which should be downloaded automatically. From ad0e707c57df5ec70a1d99972527600e509aa870 Mon Sep 17 00:00:00 2001 From: Jakkzero <50273567+Jakkzero@users.noreply.github.com> Date: Fri, 26 Feb 2021 13:23:03 +0000 Subject: [PATCH 05/44] forgot to comment out debug trace --- source/Discord.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Discord.hx b/source/Discord.hx index 3a20ebabe..b7f5e711b 100644 --- a/source/Discord.hx +++ b/source/Discord.hx @@ -22,7 +22,7 @@ class DiscordClient { DiscordRpc.process(); sleep(2); - trace("Discord Client Update"); + //trace("Discord Client Update"); } DiscordRpc.shutdown(); From bd2228f3f52189544d2cccd653a35bdbf0db866c Mon Sep 17 00:00:00 2001 From: Jakkzero <50273567+Jakkzero@users.noreply.github.com> Date: Fri, 26 Feb 2021 13:25:55 +0000 Subject: [PATCH 06/44] put the thread import in the right place --- source/TitleState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/TitleState.hx b/source/TitleState.hx index 842e37fbf..4bc6ef63f 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -2,6 +2,7 @@ package; #if !html5 import Discord.DiscordClient; +import sys.thread.Thread; #end import flixel.FlxG; import flixel.FlxSprite; @@ -26,7 +27,6 @@ import flixel.util.FlxTimer; import io.newgrounds.NG; import lime.app.Application; import openfl.Assets; -import sys.thread.Thread; using StringTools; From 8c2ebcd5e87096fd55f280c011c155bfe975c17e Mon Sep 17 00:00:00 2001 From: Jakkzero <50273567+Jakkzero@users.noreply.github.com> Date: Sat, 27 Feb 2021 02:23:15 +0000 Subject: [PATCH 07/44] Update README.md --- README.md | 100 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 90 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5a4364f9c..2c40ffc1c 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,94 @@ -# Friday Night Funkin Discord RPC +# Friday Night Funkin -This is a fork that adds Discord RPC (custom status) to Funkin'. +This is the repository for Friday Night Funkin, a game originally made for Ludum Dare 47 "Stuck In a Loop". -## Before you use -Please note that due to the way Discord's system works, apps that have not been approved are on a whitelist. -If you want to try this out, please dm me on Discord at Jak_#0768 and I will add you to the whitelist when I can. +Play the Ludum Dare prototype here: https://ninja-muffin24.itch.io/friday-night-funkin +Play the Newgrounds one here: https://www.newgrounds.com/portal/view/770371 +Support the project on the itch.io page: https://ninja-muffin24.itch.io/funkin -## Building -This won't build on html5, because I put pre-compiler tags to stop it from doing so. This should mean it only builds on desktop, but it will work on Android and stuff, so if that's what you're going for you should probably change the tags. +## Credits / shoutouts -This uses a haxelib library called linc_discord-rpc which you should be able to download with: -```haxelib git discord_rpc https://github.com/Aidan63/linc_discord-rpc``` -This library has a dependency for hxcpp, which should be downloaded automatically. +- [ninjamuffin99 (me!)](https://twitter.com/ninja_muffin99) - Programmer +- [PhantomArcade3K](https://twitter.com/phantomarcade3k) and [Evilsk8r](https://twitter.com/evilsk8r) - Art +- [Kawaisprite](https://twitter.com/kawaisprite) - Musician + +This game was made with love to Newgrounds and it's community. Extra love to Tom Fulp. + +## Build instructions + +THESE INSTRUCTIONS ARE FOR COMPILING THE GAME'S SOURCE CODE!!! + +IF YOU WANT TO JUST DOWNLOAD AND INSTALL AND PLAY THE GAME NORMALLY, GO TO ITCH.IO TO DOWNLOAD THE GAME FOR PC, MAC, AND LINUX!! + +https://ninja-muffin24.itch.io/friday-night-funkin + +IF YOU WANT TO COMPILE THE GAME YOURSELF, CONTINUE READING!!! + +### Installing the Required Programs + +First you need to install Haxe and HaxeFlixel. I'm too lazy to write and keep updated with that setup (which is pretty simple). +1. [Install Haxe 4.1.5](https://haxe.org/download/version/4.1.5/) (Download 4.1.5 instead of 4.2.0 because 4.2.0 is broken and is not working with gits properly...) +2. [Install HaxeFlixel](https://haxeflixel.com/documentation/install-haxeflixel/) after downloading Haxe + +Other installations you'd need is the additional libraries, a fully updated list will be in `Project.xml` in the project root. Currently, these are all of the things you need to install: +``` +flixel +flixel-addons +flixel-ui +hscript +newgrounds +``` +So for each of those type `haxelib install [library]` so shit like `haxelib install newgrounds` + +You'll also need to install polymod. To do this, you need to do a few things first. +1. Download [git-scm](https://git-scm.com/downloads). Works for Windows, Mac, and Linux, just select your build. +2. Follow instructions to install the application properly. +3. Run `haxelib git polymod https://github.com/larsiusprime/polymod.git` in terminal/command-prompt after your git program is installed. + +You should have everything ready for compiling the game! Follow the guide below to continue! + +### Ignored files + +I gitignore the API keys for the game, so that no one can nab them and post fake highscores on the leaderboards. But because of that the game +doesn't compile without it. + +Just make a file in `/source` and call it `APIStuff.hx`, and copy paste this into it + +```haxe +package; + +class APIStuff +{ + public static var API:String = ""; + public static var EncKey:String = ""; +} + +``` + +and you should be good to go there. + +### Compiling game + +Once you have all those installed, it's pretty easy to compile the game. You just need to run 'lime test html5 -debug' in the root of the project to build and run the HTML5 version. (command prompt navigation guide can be found here: [https://ninjamuffin99.newgrounds.com/news/post/1090480](https://ninjamuffin99.newgrounds.com/news/post/1090480)) + +To run it from your desktop (Windows, Mac, Linux) it can be a bit more involved. For Linux, you only need to open a terminal in the project directory and run 'lime test linux -debug' and then run the executible file in export/release/linux/bin. For Windows, you need to install Visual Studio Community 2019. While installing VSC, don't click on any of the options to install workloads. Instead, go to the individual components tab and choose the following: +* MSVC v142 - VS 2019 C++ x64/x86 build tools +* Windows SDK (10.0.17763.0) +* C++ Profiling tools +* C++ CMake tools for windows +* C++ ATL for v142 build tools (x86 & x64) +* C++ MFC for v142 build tools (x86 & x64) +* C++/CLI support for v142 build tools (14.21) +* C++ Modules for v142 build tools (x64/x86) +* Clang Compiler for Windows +* Windows 10 SDK (10.0.17134.0) +* Windows 10 SDK (10.0.16299.0) +* MSVC v141 - VS 2017 C++ x64/x86 build tools +* MSVC v140 - VS 2015 C++ build tools (v14.00) + +This will install about 22GB of crap, but once that is done you can open up a command line in the project's directory and run `lime test windows -debug`. Once that command finishes (it takes forever even on a higher end PC), you can run FNF from the .exe file under export\release\windows\bin +As for Mac, 'lime test mac -debug' should work, if not the internet surely has a guide on how to compile Haxe stuff for Mac. + +### Additional guides + +- [Command line basics](https://ninjamuffin99.newgrounds.com/news/post/1090480) From 1eb5ae69de688018850b981c555a3e6b37d2b5f0 Mon Sep 17 00:00:00 2001 From: Jakkzero <50273567+Jakkzero@users.noreply.github.com> Date: Sat, 27 Feb 2021 02:28:01 +0000 Subject: [PATCH 08/44] Update FreeplayState.hx --- source/FreeplayState.hx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 789897b20..edc68b1a8 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -237,9 +237,9 @@ class FreeplayState extends MusicBeatState function changeSelection(change:Int = 0) { - // #if !switch - // NGio.logEvent('Fresh'); - // #end + #if !switch + NGio.logEvent('Fresh'); + #end // NGio.logEvent('Fresh'); FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); From 3d74f869d30f14e2da48b55651a20f599423e8cb Mon Sep 17 00:00:00 2001 From: WorstAquaPlayer <tf2worth@hotmail.com> Date: Sat, 27 Feb 2021 16:58:07 -0300 Subject: [PATCH 09/44] Added changePresence arguments --- source/Discord.hx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/Discord.hx b/source/Discord.hx index b7f5e711b..668ea85e6 100644 --- a/source/Discord.hx +++ b/source/Discord.hx @@ -57,13 +57,16 @@ class DiscordClient trace("Discord Client initialized"); } - public static function changePresence(details:String, state:Null<String>) + public static function changePresence(details:String, state:Null<String>, ?smallImageKey : String, ?startTimestamp: Int, ?endTimestamp: Int) { DiscordRpc.presence({ details: details, state: state, largeImageKey: 'icon', - largeImageText: "Friday Night Funkin'" + largeImageText: "Friday Night Funkin'", + smallImageKey : smallImageKey, + startTimestamp : startTimestamp, + endTimestamp : endTimestamp }); } } From 700acb86a1095877229bb2c1876a9e40fcccba67 Mon Sep 17 00:00:00 2001 From: WorstAquaPlayer <tf2worth@hotmail.com> Date: Sat, 27 Feb 2021 18:59:18 -0300 Subject: [PATCH 10/44] Now shows P2 icon and time left when song starts --- source/Discord.hx | 16 +++++++++++++--- source/PlayState.hx | 41 ++++++++++++++++++++++++++++++++++++++--- 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/source/Discord.hx b/source/Discord.hx index 668ea85e6..39875a37d 100644 --- a/source/Discord.hx +++ b/source/Discord.hx @@ -57,16 +57,26 @@ class DiscordClient trace("Discord Client initialized"); } - public static function changePresence(details:String, state:Null<String>, ?smallImageKey : String, ?startTimestamp: Int, ?endTimestamp: Int) + public static function changePresence(details:String, state:Null<String>, ?smallImageKey : String, ?hasStartTimestamp : Bool, ?endTimestamp: Float) { + var startTimestamp:Float = if(hasStartTimestamp) Date.now().getTime() else 0; + + if (endTimestamp > 0) + { + endTimestamp = startTimestamp + endTimestamp; + } + DiscordRpc.presence({ details: details, state: state, largeImageKey: 'icon', largeImageText: "Friday Night Funkin'", smallImageKey : smallImageKey, - startTimestamp : startTimestamp, - endTimestamp : endTimestamp + // Obtained times are in milliseconds so they are divided so Discord can use it + startTimestamp : Std.int(startTimestamp / 1000), + endTimestamp : Std.int(endTimestamp / 1000) }); + + trace('Discord RPC Updated. Argument: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp'); } } diff --git a/source/PlayState.hx b/source/PlayState.hx index 0356dd58a..f191a1798 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -125,6 +125,13 @@ class PlayState extends MusicBeatState var inCutscene:Bool = false; + #if !html + // Discord RPC variables + var storyDifficultyText:String = ""; + var iconRPC:String = ""; + var songLength:Float = 0; + #end + override public function create() { if (FlxG.sound.music != null) @@ -178,7 +185,6 @@ class PlayState extends MusicBeatState #if !html // Making difficulty text for Discord Rich Presence. - var storyDifficultyText = ""; switch (storyDifficulty) { case 0: @@ -188,14 +194,28 @@ class PlayState extends MusicBeatState case 2: storyDifficultyText = "Hard"; } + + iconRPC = SONG.player2; + + // To avoid having duplicate images in Discord assets + switch (iconRPC) + { + case 'senpai-angry': + iconRPC = 'senpai'; + case 'monster-christmas': + iconRPC = 'monster'; + case 'mom-car': + iconRPC = 'mom'; + } + // Updating Discord Rich Presence. if (isStoryMode) { - DiscordClient.changePresence("Story Mode: Week " + storyWeek, SONG.song + " (" + storyDifficultyText + ")"); + DiscordClient.changePresence("Story Mode: Week " + storyWeek, SONG.song + " (" + storyDifficultyText + ")", iconRPC); } else { - DiscordClient.changePresence("Freeplay", SONG.song + " (" + storyDifficultyText + ")"); + DiscordClient.changePresence("Freeplay", SONG.song + " (" + storyDifficultyText + ")", iconRPC); } #end @@ -992,6 +1012,21 @@ class PlayState extends MusicBeatState FlxG.sound.playMusic(Paths.inst(PlayState.SONG.song), 1, false); FlxG.sound.music.onComplete = endSong; vocals.play(); + + #if !html + // Song duration in a float, useful for the time left feature + songLength = FlxG.sound.music.length; + + // Updating Discord Rich Presence (with Time Left) + if (isStoryMode) + { + DiscordClient.changePresence("Story Mode: Week " + storyWeek, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength); + } + else + { + DiscordClient.changePresence("Freeplay", SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength); + } + #end } var debugNum:Int = 0; From dee03abd3f994db090cf1ea1643275535a2e287f Mon Sep 17 00:00:00 2001 From: WorstAquaPlayer <tf2worth@hotmail.com> Date: Sat, 27 Feb 2021 20:23:50 -0300 Subject: [PATCH 11/44] Pausing and unpausing updates RPC --- source/PlayState.hx | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index f191a1798..13e95d896 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -130,6 +130,8 @@ class PlayState extends MusicBeatState var storyDifficultyText:String = ""; var iconRPC:String = ""; var songLength:Float = 0; + var detailsText:String = ""; + var detailsPausedText:String = ""; #end override public function create() @@ -207,16 +209,22 @@ class PlayState extends MusicBeatState case 'mom-car': iconRPC = 'mom'; } - - // Updating Discord Rich Presence. + + // String that contains the mode defined here so it isn't necessary to call changePresence for each mode if (isStoryMode) { - DiscordClient.changePresence("Story Mode: Week " + storyWeek, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + detailsText = "Story Mode: Week " + storyWeek; } else { - DiscordClient.changePresence("Freeplay", SONG.song + " (" + storyDifficultyText + ")", iconRPC); + detailsText = "Freeplay"; } + + // String for when the game is paused + detailsPausedText = "Paused - " + detailsText; + + // Updating Discord Rich Presence. + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); #end if (SONG.song.toLowerCase() == 'spookeez' || SONG.song.toLowerCase() == 'monster' || SONG.song.toLowerCase() == 'south') @@ -1018,14 +1026,7 @@ class PlayState extends MusicBeatState songLength = FlxG.sound.music.length; // Updating Discord Rich Presence (with Time Left) - if (isStoryMode) - { - DiscordClient.changePresence("Story Mode: Week " + storyWeek, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength); - } - else - { - DiscordClient.changePresence("Freeplay", SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength); - } + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength); #end } @@ -1267,6 +1268,17 @@ class PlayState extends MusicBeatState if (!startTimer.finished) startTimer.active = true; paused = false; + + #if !html + if (startTimer.finished) + { + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition); + } + else + { + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + } + #end } super.closeSubState(); @@ -1334,6 +1346,10 @@ class PlayState extends MusicBeatState } else openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); + + #if !html + DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + #end } if (FlxG.keys.justPressed.SEVEN) From 34a5175ce55909812264bb41af59c3d7fd82aa30 Mon Sep 17 00:00:00 2001 From: WorstAquaPlayer <tf2worth@hotmail.com> Date: Sat, 27 Feb 2021 20:49:53 -0300 Subject: [PATCH 12/44] Alt+Tab and Game Over updates RPC --- source/PlayState.hx | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/source/PlayState.hx b/source/PlayState.hx index 13e95d896..3f80deb92 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1284,6 +1284,37 @@ class PlayState extends MusicBeatState super.closeSubState(); } + override public function onFocus():Void + { + #if !html + if (health > 0 && !paused) + { + if (Conductor.songPosition > 0.0) + { + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition); + } + else + { + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + } + } + #end + + super.onFocus(); + } + + override public function onFocusLost():Void + { + #if !html + if (health > 0 && !paused) + { + DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + } + #end + + super.onFocusLost(); + } + function resyncVocals():Void { vocals.pause(); @@ -1550,6 +1581,9 @@ class PlayState extends MusicBeatState openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); // FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); + + // Game Over doesn't get his own variable because it's only used here + DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); } if (unspawnNotes[0] != null) From b1993259bf8765cfb20d9d6e42167c87032eb133 Mon Sep 17 00:00:00 2001 From: WorstAquaPlayer <tf2worth@hotmail.com> Date: Sat, 27 Feb 2021 21:06:30 -0300 Subject: [PATCH 13/44] Changed RPC !html and added Debug Status --- source/Discord.hx | 2 +- source/FreeplayState.hx | 6 +++--- source/PlayState.hx | 20 ++++++++++++-------- source/StoryMenuState.hx | 7 ++++--- source/TitleState.hx | 4 ++-- 5 files changed, 22 insertions(+), 17 deletions(-) diff --git a/source/Discord.hx b/source/Discord.hx index 39875a37d..253a4f59a 100644 --- a/source/Discord.hx +++ b/source/Discord.hx @@ -77,6 +77,6 @@ class DiscordClient endTimestamp : Std.int(endTimestamp / 1000) }); - trace('Discord RPC Updated. Argument: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp'); + //trace('Discord RPC Updated. Arguments: $details, $state, $smallImageKey, $hasStartTimestamp, $endTimestamp'); } } diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index edc68b1a8..7dbc84f3a 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -1,6 +1,6 @@ package; -#if !html +#if desktop import Discord.DiscordClient; #end import flash.text.TextField; @@ -48,9 +48,9 @@ class FreeplayState extends MusicBeatState } */ - #if !html + #if desktop // Updating Discord Rich Presence - DiscordClient.changePresence("In the menus.", null); + DiscordClient.changePresence("In the Menus", null); #end var isDebug:Bool = false; diff --git a/source/PlayState.hx b/source/PlayState.hx index 3f80deb92..4ac546024 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1,6 +1,6 @@ package; -#if !html +#if desktop import Discord.DiscordClient; #end import Section.SwagSection; @@ -125,7 +125,7 @@ class PlayState extends MusicBeatState var inCutscene:Bool = false; - #if !html + #if desktop // Discord RPC variables var storyDifficultyText:String = ""; var iconRPC:String = ""; @@ -185,7 +185,7 @@ class PlayState extends MusicBeatState dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue')); } - #if !html + #if desktop // Making difficulty text for Discord Rich Presence. switch (storyDifficulty) { @@ -1021,7 +1021,7 @@ class PlayState extends MusicBeatState FlxG.sound.music.onComplete = endSong; vocals.play(); - #if !html + #if desktop // Song duration in a float, useful for the time left feature songLength = FlxG.sound.music.length; @@ -1269,7 +1269,7 @@ class PlayState extends MusicBeatState startTimer.active = true; paused = false; - #if !html + #if desktop if (startTimer.finished) { DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC, true, songLength - Conductor.songPosition); @@ -1286,7 +1286,7 @@ class PlayState extends MusicBeatState override public function onFocus():Void { - #if !html + #if desktop if (health > 0 && !paused) { if (Conductor.songPosition > 0.0) @@ -1305,7 +1305,7 @@ class PlayState extends MusicBeatState override public function onFocusLost():Void { - #if !html + #if desktop if (health > 0 && !paused) { DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); @@ -1378,7 +1378,7 @@ class PlayState extends MusicBeatState else openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); - #if !html + #if desktop DiscordClient.changePresence(detailsPausedText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); #end } @@ -1386,6 +1386,10 @@ class PlayState extends MusicBeatState if (FlxG.keys.justPressed.SEVEN) { FlxG.switchState(new ChartingState()); + + #if desktop + DiscordClient.changePresence("Chart Editor", null, null, true); + #end } // FlxG.watch.addQuick('VOL', vocals.amplitudeLeft); diff --git a/source/StoryMenuState.hx b/source/StoryMenuState.hx index 0e4b06558..6d1f8f20c 100644 --- a/source/StoryMenuState.hx +++ b/source/StoryMenuState.hx @@ -1,6 +1,6 @@ package; -#if !html +#if desktop import Discord.DiscordClient; #end import flixel.FlxG; @@ -112,9 +112,10 @@ class StoryMenuState extends MusicBeatState add(grpLocks); trace("Line 70"); - #if !html + + #if desktop // Updating Discord Rich Presence - DiscordClient.changePresence("In the menus.", null); + DiscordClient.changePresence("In the Menus", null); #end for (i in 0...weekData.length) diff --git a/source/TitleState.hx b/source/TitleState.hx index 4bc6ef63f..c91dc54eb 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -1,6 +1,6 @@ package; -#if !html5 +#if desktop import Discord.DiscordClient; import sys.thread.Thread; #end @@ -94,7 +94,7 @@ class TitleState extends MusicBeatState }); #end - #if !html + #if desktop DiscordClient.initialize(); #end } From 5e7bbc3b66b7710b7f7faa5a2c139d1dd075b10b Mon Sep 17 00:00:00 2001 From: WorstAquaPlayer <tf2worth@hotmail.com> Date: Sat, 27 Feb 2021 21:34:49 -0300 Subject: [PATCH 14/44] Exiting through the pause menu updates RPC --- source/MainMenuState.hx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 4b3a8f110..35fb50e8a 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -1,5 +1,8 @@ package; +#if desktop +import Discord.DiscordClient; +#end import flixel.FlxG; import flixel.FlxObject; import flixel.FlxSprite; @@ -33,6 +36,11 @@ class MainMenuState extends MusicBeatState override function create() { + #if desktop + // Updating Discord Rich Presence + DiscordClient.changePresence("In the Menus", null); + #end + transIn = FlxTransitionableState.defaultTransIn; transOut = FlxTransitionableState.defaultTransOut; From 3dd24abf078421b09d2984d4fe5b29e70924cc07 Mon Sep 17 00:00:00 2001 From: WorstAquaPlayer <tf2worth@hotmail.com> Date: Sun, 28 Feb 2021 18:50:06 -0300 Subject: [PATCH 15/44] Added missing #if to RPC call --- Project.xml | 2 +- source/PlayState.hx | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Project.xml b/Project.xml index 23de20a24..08b9a5a47 100644 --- a/Project.xml +++ b/Project.xml @@ -116,7 +116,7 @@ <haxelib name="newgrounds"/> <haxelib name="faxe" if='switch'/> <haxelib name="polymod"/> - <haxelib name="discord_rpc" unless="web"/> + <haxelib name="discord_rpc" if="desktop"/> <!-- <haxelib name="hxcpp-debug-server" if="desktop"/> --> <!-- <haxelib name="markdown" /> --> diff --git a/source/PlayState.hx b/source/PlayState.hx index 4ac546024..aa41737ea 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1586,8 +1586,10 @@ class PlayState extends MusicBeatState // FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); + #if desktop // Game Over doesn't get his own variable because it's only used here DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + #end } if (unspawnNotes[0] != null) From caa95c8c0003d5b1fd3019574131d6da87ae72c8 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Wed, 10 Mar 2021 17:01:57 -0500 Subject: [PATCH 16/44] conditionals for HTML5 --- source/ModdingSubstate.hx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/ModdingSubstate.hx b/source/ModdingSubstate.hx index 81f5a358f..a46cba1c5 100644 --- a/source/ModdingSubstate.hx +++ b/source/ModdingSubstate.hx @@ -1,7 +1,9 @@ package; import flixel.text.FlxText; +#if desktop import sys.FileSystem; +#end class ModdingSubstate extends MusicBeatSubstate { @@ -11,6 +13,7 @@ class ModdingSubstate extends MusicBeatSubstate // var pathShit + #if desktop var modList = []; for (file in FileSystem.readDirectory('./mods')) @@ -29,5 +32,6 @@ class ModdingSubstate extends MusicBeatSubstate loopNum++; } + #end } } From c653c697202cdeb51a1301b2b9369ca3992544d2 Mon Sep 17 00:00:00 2001 From: MtH <mth@mth.moe> Date: Sat, 13 Mar 2021 19:40:54 +0100 Subject: [PATCH 17/44] week6 dialogue finger --- source/DialogueBox.hx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/DialogueBox.hx b/source/DialogueBox.hx index 929eb242e..1e56367af 100644 --- a/source/DialogueBox.hx +++ b/source/DialogueBox.hx @@ -120,7 +120,10 @@ class DialogueBox extends FlxSpriteGroup box.screenCenter(X); portraitLeft.screenCenter(X); - handSelect = new FlxSprite(FlxG.width * 0.9, FlxG.height * 0.9).loadGraphic(Paths.image('weeb/pixelUI/hand_textbox')); + handSelect = new FlxSprite(1042, 590).loadGraphic(Paths.image('weeb/pixelUI/hand_textbox')); + handSelect.setGraphicSize(Std.int(handSelect.width * PlayState.daPixelZoom * 0.9)); + handSelect.updateHitbox(); + handSelect.visible = false; add(handSelect); @@ -230,7 +233,13 @@ class DialogueBox extends FlxSpriteGroup // swagDialogue.text = ; swagDialogue.resetText(dialogueList[0]); - swagDialogue.start(0.04, true); + swagDialogue.start(0.04); + swagDialogue.completeCallback = function() + { + trace("dialogue finish"); + handSelect.visible = true; + }; + handSelect.visible = false; switch (curCharacter) { From 30ef3e495565174c2693288ff399b10ddbee3a2b Mon Sep 17 00:00:00 2001 From: MtH <mth@mth.moe> Date: Sat, 13 Mar 2021 19:43:11 +0100 Subject: [PATCH 18/44] freeplay monster icon --- source/FreeplayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 2e3d98c50..bfd67d31c 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -59,7 +59,7 @@ class FreeplayState extends MusicBeatState addWeek(['Bopeebo', 'Fresh', 'Dadbattle'], 1, ['dad']); if (StoryMenuState.weekUnlocked[2] || isDebug) - addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky']); + addWeek(['Spookeez', 'South', 'Monster'], 2, ['spooky', 'spooky', 'monster']); if (StoryMenuState.weekUnlocked[3] || isDebug) addWeek(['Pico', 'Philly', 'Blammed'], 3, ['pico']); From 53b5153c2245b827ada2e2bf8e1bd32fd12c9177 Mon Sep 17 00:00:00 2001 From: MtH <mth@mth.moe> Date: Sat, 13 Mar 2021 19:48:49 +0100 Subject: [PATCH 19/44] finger fadeout oops --- source/DialogueBox.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/DialogueBox.hx b/source/DialogueBox.hx index 1e56367af..104b10a8b 100644 --- a/source/DialogueBox.hx +++ b/source/DialogueBox.hx @@ -202,6 +202,7 @@ class DialogueBox extends FlxSpriteGroup portraitLeft.visible = false; portraitRight.visible = false; swagDialogue.alpha -= 1 / 5; + handSelect.alpha -= 1 / 5; dropText.alpha = swagDialogue.alpha; }, 5); From 9885b03b7d1d0b2d27969345dc4f56496dbf0426 Mon Sep 17 00:00:00 2001 From: MtH <mth@mth.moe> Date: Sat, 13 Mar 2021 20:06:03 +0100 Subject: [PATCH 20/44] portraits before box to fix thorns intro layering issue --- source/DialogueBox.hx | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/source/DialogueBox.hx b/source/DialogueBox.hx index 104b10a8b..ade30a8e3 100644 --- a/source/DialogueBox.hx +++ b/source/DialogueBox.hx @@ -60,6 +60,24 @@ class DialogueBox extends FlxSpriteGroup bgFade.alpha = 0.7; }, 5); + portraitLeft = new FlxSprite(-20, 40); + portraitLeft.frames = Paths.getSparrowAtlas('weeb/senpaiPortrait'); + portraitLeft.animation.addByPrefix('enter', 'Senpai Portrait Enter', 24, false); + portraitLeft.setGraphicSize(Std.int(portraitLeft.width * PlayState.daPixelZoom * 0.9)); + portraitLeft.updateHitbox(); + portraitLeft.scrollFactor.set(); + add(portraitLeft); + portraitLeft.visible = false; + + portraitRight = new FlxSprite(0, 40); + portraitRight.frames = Paths.getSparrowAtlas('weeb/bfPortrait'); + portraitRight.animation.addByPrefix('enter', 'Boyfriend portrait enter', 24, false); + portraitRight.setGraphicSize(Std.int(portraitRight.width * PlayState.daPixelZoom * 0.9)); + portraitRight.updateHitbox(); + portraitRight.scrollFactor.set(); + add(portraitRight); + portraitRight.visible = false; + box = new FlxSprite(-20, 45); var hasDialog = false; @@ -94,24 +112,6 @@ class DialogueBox extends FlxSpriteGroup if (!hasDialog) return; - portraitLeft = new FlxSprite(-20, 40); - portraitLeft.frames = Paths.getSparrowAtlas('weeb/senpaiPortrait'); - portraitLeft.animation.addByPrefix('enter', 'Senpai Portrait Enter', 24, false); - portraitLeft.setGraphicSize(Std.int(portraitLeft.width * PlayState.daPixelZoom * 0.9)); - portraitLeft.updateHitbox(); - portraitLeft.scrollFactor.set(); - add(portraitLeft); - portraitLeft.visible = false; - - portraitRight = new FlxSprite(0, 40); - portraitRight.frames = Paths.getSparrowAtlas('weeb/bfPortrait'); - portraitRight.animation.addByPrefix('enter', 'Boyfriend portrait enter', 24, false); - portraitRight.setGraphicSize(Std.int(portraitRight.width * PlayState.daPixelZoom * 0.9)); - portraitRight.updateHitbox(); - portraitRight.scrollFactor.set(); - add(portraitRight); - portraitRight.visible = false; - box.animation.play('normalOpen'); box.setGraphicSize(Std.int(box.width * PlayState.daPixelZoom * 0.9)); box.updateHitbox(); From 367cb8b1cce1281e75d72356cc97931f8c377e1a Mon Sep 17 00:00:00 2001 From: MtH <mth@mth.moe> Date: Sat, 13 Mar 2021 22:31:34 +0100 Subject: [PATCH 21/44] make main menu bg not go offscreen when selecting options, add offsets for menu items --- source/MainMenuState.hx | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/source/MainMenuState.hx b/source/MainMenuState.hx index 4b3a8f110..369af2e87 100644 --- a/source/MainMenuState.hx +++ b/source/MainMenuState.hx @@ -45,7 +45,7 @@ class MainMenuState extends MusicBeatState var bg:FlxSprite = new FlxSprite(-80).loadGraphic(Paths.image('menuBG')); bg.scrollFactor.x = 0; - bg.scrollFactor.y = 0.18; + bg.scrollFactor.y = 0.17; bg.setGraphicSize(Std.int(bg.width * 1.1)); bg.updateHitbox(); bg.screenCenter(); @@ -57,7 +57,7 @@ class MainMenuState extends MusicBeatState magenta = new FlxSprite(-80).loadGraphic(Paths.image('menuDesat')); magenta.scrollFactor.x = 0; - magenta.scrollFactor.y = 0.18; + magenta.scrollFactor.y = 0.17; magenta.setGraphicSize(Std.int(magenta.width * 1.1)); magenta.updateHitbox(); magenta.screenCenter(); @@ -208,11 +208,25 @@ class MainMenuState extends MusicBeatState if (spr.ID == curSelected) { - spr.animation.play('selected'); camFollow.setPosition(spr.getGraphicMidpoint().x, spr.getGraphicMidpoint().y); + spr.animation.play('selected'); } spr.updateHitbox(); + if(spr.animation.curAnim.name == 'selected') + { + switch(optionShit[curSelected]) + { + case 'story mode': + spr.offset.y += 26; + case 'freeplay': + spr.offset.y += 28; + case 'donate': + spr.offset.y += 21; + case 'options': + spr.offset.y += 26; + } + } }); } } From a55dcdc69c55fb9274b8e872d31b81e0c9c287ca Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Sat, 13 Mar 2021 23:02:14 -0500 Subject: [PATCH 22/44] offsets for bf and gf --- source/Character.hx | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) diff --git a/source/Character.hx b/source/Character.hx index 965b89ab6..5c0c86639 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -33,7 +33,7 @@ class Character extends FlxSprite { case 'gf': // GIRLFRIEND CODE - tex = Paths.getSparrowAtlas('GF_assets'); + tex = Paths.getSparrowAtlas('characters/GF_assets'); frames = tex; animation.addByPrefix('cheer', 'GF Cheer', 24, false); animation.addByPrefix('singLEFT', 'GF left note', 24, false); @@ -47,19 +47,7 @@ class Character extends FlxSprite animation.addByIndices('hairFall', "GF Dancing Beat Hair Landing", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], "", 24, false); animation.addByPrefix('scared', 'GF FEAR', 24); - addOffset('cheer'); - addOffset('sad', -2, -21); - addOffset('danceLeft', 0, -9); - addOffset('danceRight', 0, -9); - - addOffset("singUP", 0, 4); - addOffset("singRIGHT", 0, -20); - addOffset("singLEFT", 0, -19); - addOffset("singDOWN", 0, -20); - addOffset('hairBlow', 45, -8); - addOffset('hairFall', 0, -9); - - addOffset('scared', -2, -17); + loadOffsetFile(curCharacter); playAnim('danceRight'); @@ -280,7 +268,7 @@ class Character extends FlxSprite playAnim('shoot1'); case 'bf': - var tex = Paths.getSparrowAtlas('BOYFRIEND'); + var tex = Paths.getSparrowAtlas('characters/BOYFRIEND'); frames = tex; animation.addByPrefix('idle', 'BF idle dance', 24, false); animation.addByPrefix('singUP', 'BF NOTE UP0', 24, false); @@ -299,25 +287,14 @@ class Character extends FlxSprite animation.addByPrefix('scared', 'BF idle shaking', 24); - addOffset('idle', -5); - addOffset("singUP", -29, 27); - addOffset("singRIGHT", -38, -7); - addOffset("singLEFT", 12, -6); - addOffset("singDOWN", -10, -50); - addOffset("singUPmiss", -29, 27); - addOffset("singRIGHTmiss", -30, 21); - addOffset("singLEFTmiss", 12, 24); - addOffset("singDOWNmiss", -11, -19); - addOffset("hey", 7, 4); - addOffset('firstDeath', 37, 11); - addOffset('deathLoop', 37, 5); - addOffset('deathConfirm', 37, 69); - addOffset('scared', -4); + loadOffsetFile(curCharacter); playAnim('idle'); flipX = true; + loadOffsetFile(curCharacter); + case 'bf-christmas': var tex = Paths.getSparrowAtlas('christmas/bfChristmas'); frames = tex; From c3710025e1cc6632900291f550c6b1f6eab07026 Mon Sep 17 00:00:00 2001 From: MtH <mth@mth.moe> Date: Sun, 14 Mar 2021 20:46:44 +0100 Subject: [PATCH 23/44] fix oppenent freezing when !mustHitSection and no notes, dance only on downbeat --- source/PlayState.hx | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index c864df782..f0ecd23b4 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2289,10 +2289,6 @@ class PlayState extends MusicBeatState } // else // Conductor.changeBPM(SONG.bpm); - - // Dad doesnt interupt his own notes - if (SONG.notes[Math.floor(curStep / 16)].mustHitSection) - dad.dance(); } // FlxG.log.add('change bpm' + SONG.notes[Std.int(curStep / 16)].changeBPM); wiggleShit.update(Conductor.crochet); @@ -2321,9 +2317,17 @@ class PlayState extends MusicBeatState gf.dance(); } - if (!boyfriend.animation.curAnim.name.startsWith("sing")) + if (curBeat % 2 == 0) { - boyfriend.playAnim('idle'); + if (!boyfriend.animation.curAnim.name.startsWith("sing")) + boyfriend.playAnim('idle'); + if (!dad.animation.curAnim.name.startsWith("sing")) + dad.dance(); + } + else if (dad.curCharacter == 'spooky') + { + if (!dad.animation.curAnim.name.startsWith("sing")) + dad.dance(); } if (curBeat % 8 == 7 && curSong == 'Bopeebo') From 1467335ac74d628b9c505b9e60de01e613c87b4e Mon Sep 17 00:00:00 2001 From: MtH <mth@mth.moe> Date: Sun, 14 Mar 2021 20:48:02 +0100 Subject: [PATCH 24/44] remove check if philly train sound playing --- source/PlayState.hx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index f0ecd23b4..fc0103c61 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -2198,8 +2198,7 @@ class PlayState extends MusicBeatState function trainStart():Void { trainMoving = true; - if (!trainSound.playing) - trainSound.play(true); + trainSound.play(true); } var startedMoving:Bool = false; From eba2639638294f5a73c092a63a617b771ee39d18 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <mofin@Camerons-MacBook-Pro.local> Date: Tue, 16 Mar 2021 01:51:23 -0400 Subject: [PATCH 25/44] tnakmen in progres lol --- .DS_Store | Bin 0 -> 6148 bytes source/PlayState.hx | 9 +++++++++ source/TankmenBG.hx | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 .DS_Store create mode 100644 source/TankmenBG.hx diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..13b8461f1ea6d3567f1587911c9b05007868d1ff GIT binary patch literal 6148 zcmeHK%Wl&^6upy#)Japw0*P*rykQqrNsCasKuXd?5Q#^H5i9_uPHY+@#}ma4DTJWx z`2tw*3w#G(z_+l1Gvg7mot7o7(A;R|%;TP!xo2!ohKN{u<}`?^L}VZdER>O*VWMB8 zHOr}%Yd|K(;KPB>2dIhRv}pyj0+(F@@$TlyrYS`|KlT2$(6jSPnhc@{uMj_%A__CU z-~Q%1n1>VfUHCqj_+A**>pxg7U$|1-FpRQM-YUPcMtp8Xb~Fpy_Vk6Q9of-npvq4< z_y3gb!86aD_p8?rc@WuN;7%pkb6mK*eC`DfpSSrea6&nb6?Yg$$td-!+l$5S{z1*$ zYwRy;=Hg(tUNdj+-B~V6#*JHzyS?M_yZ4I^%a5OB$i(njlO|+J+80z(g1oh+fzN{z zv<ps!4(UF%=n>tcE<K>fz#STslNOHMgl|&h0y)HKm=&0P%J@~V4X4<UF-^!vxsMVD zH?uM9XNFglya{~QHasWRo?OcojWEY+={v?;5h8el2Y^$MjskHKeN8+n8;H0E1-gje zqHe}pJS<7?GCh=QcgUlFPR`XS$*Is0B5)Bq$I2X(rr=?{>A9qCN#3U9am3+5Wf9RS zl=Cwzp<0qvq9=%@MIEfPd)E4-c1cE2>NLZuhUBJ47izJq3AHfU#h7}yjm?XhUeBr( z&<b2)1;qEkL=xCkxQbDJI*`dL0I+~&X(-D-|3FhT0GkR|F`@;=Vk$7EGIhmZ>h8c| zI{KT+e-&d)CnjgcIBI65ZYWG$J(wxoi8W)?xmG|ckX9fcSF7Uu@1B4EPm^>_E1(tl zuM}W~j@4-+Bz3l~1t-p06X_U9nDAT0C@IL)aV!hsDBebrhCWjifK7#~7|{aLe*~lq LI@1dLQw4ql?KS=I literal 0 HcmV?d00001 diff --git a/source/PlayState.hx b/source/PlayState.hx index 0e72585e5..a9566981c 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -113,6 +113,8 @@ class PlayState extends MusicBeatState var bgGirls:BackgroundGirls; var wiggleShit:WiggleEffect = new WiggleEffect(); + var tankmanRun:FlxTypedGroup<TankmenBG>; + var talking:Bool = true; var songScore:Int = 0; var scoreTxt:FlxText; @@ -499,6 +501,9 @@ class PlayState extends MusicBeatState var tankGround:BGSprite = new BGSprite('tankGround', -200, -20); add(tankGround); + tankmanRun = new FlxTypedGroup<TankmenBG>(); + add(tankmanRun); + var fgTank0:BGSprite = new BGSprite('tank0', -290, 400, 1.7, 1.5, ['fg']); foregroundSprites.add(fgTank0); @@ -1538,6 +1543,10 @@ class PlayState extends MusicBeatState if (generatedMusic) { + + + + notes.forEachAlive(function(daNote:Note) { if (daNote.y > FlxG.height) diff --git a/source/TankmenBG.hx b/source/TankmenBG.hx new file mode 100644 index 000000000..defb81a08 --- /dev/null +++ b/source/TankmenBG.hx @@ -0,0 +1,40 @@ +package; + +import flixel.FlxG; +import haxe.display.Display.Package; +import flixel.FlxSprite; + +class TankmenBG extends FlxSprite +{ + + public var strumTime:Float = 0; + public var goingRight:Bool = false; + + public function new(x:Float, y:Float) + { + super(x, y); + + frames = Paths.getSparrowAtlas('tankmanKilled1'); + antialiasing = true; + animation.addByPrefix('run', 'tankman running', 24, true); + animation.addByPrefix('shot', 'John', 24, false); + + animation.play('run'); + } + + override function update(elapsed:Float) { + super.update(elapsed); + + var endDirection:Float = FlxG.width * 0.3; + + if (goingRight) + endDirection = FlxG.width * 0.6; + + x = (endDirection - (Conductor.songPosition - strumTime) * 0.45); + + if (animation.curAnim.name == 'run' && animation.curAnim.finished) + { + kill(); + } + } +} \ No newline at end of file From 40318587a12cda895922cc1e1e58505be968127c Mon Sep 17 00:00:00 2001 From: Cameron Taylor <mofin@Camerons-MacBook-Pro.local> Date: Tue, 16 Mar 2021 01:59:54 -0400 Subject: [PATCH 26/44] swag --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 13b8461f1ea6d3567f1587911c9b05007868d1ff..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%Wl&^6upy#)Japw0*P*rykQqrNsCasKuXd?5Q#^H5i9_uPHY+@#}ma4DTJWx z`2tw*3w#G(z_+l1Gvg7mot7o7(A;R|%;TP!xo2!ohKN{u<}`?^L}VZdER>O*VWMB8 zHOr}%Yd|K(;KPB>2dIhRv}pyj0+(F@@$TlyrYS`|KlT2$(6jSPnhc@{uMj_%A__CU z-~Q%1n1>VfUHCqj_+A**>pxg7U$|1-FpRQM-YUPcMtp8Xb~Fpy_Vk6Q9of-npvq4< z_y3gb!86aD_p8?rc@WuN;7%pkb6mK*eC`DfpSSrea6&nb6?Yg$$td-!+l$5S{z1*$ zYwRy;=Hg(tUNdj+-B~V6#*JHzyS?M_yZ4I^%a5OB$i(njlO|+J+80z(g1oh+fzN{z zv<ps!4(UF%=n>tcE<K>fz#STslNOHMgl|&h0y)HKm=&0P%J@~V4X4<UF-^!vxsMVD zH?uM9XNFglya{~QHasWRo?OcojWEY+={v?;5h8el2Y^$MjskHKeN8+n8;H0E1-gje zqHe}pJS<7?GCh=QcgUlFPR`XS$*Is0B5)Bq$I2X(rr=?{>A9qCN#3U9am3+5Wf9RS zl=Cwzp<0qvq9=%@MIEfPd)E4-c1cE2>NLZuhUBJ47izJq3AHfU#h7}yjm?XhUeBr( z&<b2)1;qEkL=xCkxQbDJI*`dL0I+~&X(-D-|3FhT0GkR|F`@;=Vk$7EGIhmZ>h8c| zI{KT+e-&d)CnjgcIBI65ZYWG$J(wxoi8W)?xmG|ckX9fcSF7Uu@1B4EPm^>_E1(tl zuM}W~j@4-+Bz3l~1t-p06X_U9nDAT0C@IL)aV!hsDBebrhCWjifK7#~7|{aLe*~lq LI@1dLQw4ql?KS=I From d8f02976757a2a448646d326f53ec39cbcd08e7b Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Wed, 17 Mar 2021 05:20:25 -0400 Subject: [PATCH 27/44] bf holding gf --- source/Character.hx | 18 ++++++++++ source/HealthIcon.hx | 1 + source/PlayState.hx | 15 +++++--- source/TankmenBG.hx | 84 +++++++++++++++++++++++++++++++------------- 4 files changed, 90 insertions(+), 28 deletions(-) diff --git a/source/Character.hx b/source/Character.hx index 5c0c86639..86a630d49 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -82,6 +82,24 @@ class Character extends FlxSprite playAnim('danceRight'); + case 'bf-holding-gf': + frames = Paths.getSparrowAtlas('characters/bfAndGF'); + quickAnimAdd('idle', 'BF idle dance'); + quickAnimAdd('singDOWN', 'BF NOTE DOWN0'); + quickAnimAdd('singLEFT', 'BF NOTE LEFT0'); + quickAnimAdd('singRIGHT', 'BF NOTE RIGHT0'); + quickAnimAdd('singUP', 'BF NOTE UP0'); + + quickAnimAdd('singDOWNmiss', 'BF NOTE DOWN MISS'); + quickAnimAdd('singLEFTmiss', 'BF NOTE LEFT MISS'); + quickAnimAdd('singRIGHTmiss', 'BF NOTE RIGHT MISS'); + quickAnimAdd('singUPmiss', 'BF NOTE UP MISS'); + quickAnimAdd('bfCatch', 'BF catches GF'); + + loadOffsetFile(curCharacter); + + playAnim('idle'); + case 'gf-car': tex = Paths.getSparrowAtlas('gfCar'); frames = tex; diff --git a/source/HealthIcon.hx b/source/HealthIcon.hx index c821a84b3..9224904f1 100644 --- a/source/HealthIcon.hx +++ b/source/HealthIcon.hx @@ -16,6 +16,7 @@ class HealthIcon extends FlxSprite antialiasing = true; animation.add('bf', [0, 1], 0, false, isPlayer); + animation.add('bf-holding-gf', [0, 1], 0, false, isPlayer); animation.add('bf-car', [0, 1], 0, false, isPlayer); animation.add('bf-christmas', [0, 1], 0, false, isPlayer); animation.add('bf-pixel', [21, 21], 0, false, isPlayer); diff --git a/source/PlayState.hx b/source/PlayState.hx index a9566981c..c3e16d19e 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1543,10 +1543,6 @@ class PlayState extends MusicBeatState if (generatedMusic) { - - - - notes.forEachAlive(function(daNote:Note) { if (daNote.y > FlxG.height) @@ -2402,6 +2398,17 @@ class PlayState extends MusicBeatState } } + switch (curSong.toLowerCase()) + { + case 'stress': + if (FlxG.random.bool()) + { + var tank:TankmenBG = new TankmenBG(500, 200); + tank.strumTime = Conductor.songPosition + (Conductor.crochet * 4); + tankmanRun.add(tank); + } + } + if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset) { lightningStrikeShit(); diff --git a/source/TankmenBG.hx b/source/TankmenBG.hx index defb81a08..bdd56e8a3 100644 --- a/source/TankmenBG.hx +++ b/source/TankmenBG.hx @@ -1,40 +1,76 @@ package; import flixel.FlxG; -import haxe.display.Display.Package; import flixel.FlxSprite; +import haxe.display.Display.Package; class TankmenBG extends FlxSprite { + public var strumTime:Float = 0; + public var goingRight:Bool = false; + public var tankSpeed:Float = 0.7; - public var strumTime:Float = 0; - public var goingRight:Bool = false; + public var endingOffset:Float; - public function new(x:Float, y:Float) - { - super(x, y); + public function new(x:Float, y:Float) + { + super(x, y); - frames = Paths.getSparrowAtlas('tankmanKilled1'); - antialiasing = true; - animation.addByPrefix('run', 'tankman running', 24, true); - animation.addByPrefix('shot', 'John', 24, false); + // makeGraphic(200, 200); - animation.play('run'); - } + frames = Paths.getSparrowAtlas('tankmanKilled1'); + antialiasing = true; + animation.addByPrefix('run', 'tankman running', 24, true); + animation.addByPrefix('shot', 'John', 24, false); - override function update(elapsed:Float) { - super.update(elapsed); + animation.play('run'); - var endDirection:Float = FlxG.width * 0.3; + y += FlxG.random.int(-40, 100); - if (goingRight) - endDirection = FlxG.width * 0.6; + goingRight = FlxG.random.bool(); + endingOffset = FlxG.random.float(0, 120); - x = (endDirection - (Conductor.songPosition - strumTime) * 0.45); + tankSpeed = FlxG.random.float(0.65, 0.8); - if (animation.curAnim.name == 'run' && animation.curAnim.finished) - { - kill(); - } - } -} \ No newline at end of file + if (goingRight) + flipX = true; + } + + override function update(elapsed:Float) + { + super.update(elapsed); + + if (animation.curAnim.name == 'run') + { + var endDirection:Float = (FlxG.width * 0.74) + endingOffset; + + if (goingRight) + { + endDirection = (FlxG.width * 0.02) - endingOffset; + + x = (endDirection + (Conductor.songPosition - strumTime) * tankSpeed); + } + else + { + x = (endDirection - (Conductor.songPosition - strumTime) * tankSpeed); + } + } + + if (Conductor.songPosition > strumTime) + { + // kill(); + animation.play('shot'); + + if (goingRight) + { + offset.y = 200; + offset.x = 300; + } + } + + if (animation.curAnim.name == 'shot' && animation.curAnim.curFrame >= animation.curAnim.frames.length - 1) + { + kill(); + } + } +} From 48411894e2b8ab50a453e4f6edd0d046b81faa28 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Wed, 17 Mar 2021 05:29:04 -0400 Subject: [PATCH 28/44] offsets and adjustemnts --- source/Character.hx | 2 ++ source/PlayState.hx | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/source/Character.hx b/source/Character.hx index 86a630d49..3136db55b 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -100,6 +100,8 @@ class Character extends FlxSprite playAnim('idle'); + flipX = true; + case 'gf-car': tex = Paths.getSparrowAtlas('gfCar'); frames = tex; diff --git a/source/PlayState.hx b/source/PlayState.hx index c3e16d19e..e51e711df 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -624,6 +624,12 @@ class PlayState extends MusicBeatState boyfriend = new Boyfriend(770, 450, SONG.player1); + switch (SONG.player1) + { + case "bf-holding-gf": + boyfriend.y -= 140; + } + // REPOSITIONING PER STAGE switch (curStage) { From 91409b67c9a73c4b387bc13ab3433289b874dbe6 Mon Sep 17 00:00:00 2001 From: MtH <mth@mth.moe> Date: Wed, 17 Mar 2021 18:33:26 +0100 Subject: [PATCH 29/44] mitigate countdown dancing issues (might still fuck up on higher bpm) --- source/MusicBeatState.hx | 2 +- source/MusicBeatSubstate.hx | 2 +- source/PlayState.hx | 80 +++++++++++++++++++++---------------- 3 files changed, 47 insertions(+), 37 deletions(-) diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx index 88c58a624..1c7359798 100644 --- a/source/MusicBeatState.hx +++ b/source/MusicBeatState.hx @@ -35,7 +35,7 @@ class MusicBeatState extends FlxUIState updateCurStep(); updateBeat(); - if (oldStep != curStep && curStep > 0) + if (oldStep != curStep && curStep >= 0) stepHit(); super.update(elapsed); diff --git a/source/MusicBeatSubstate.hx b/source/MusicBeatSubstate.hx index c6da0fb59..480d6ed16 100644 --- a/source/MusicBeatSubstate.hx +++ b/source/MusicBeatSubstate.hx @@ -29,7 +29,7 @@ class MusicBeatSubstate extends FlxSubState updateCurStep(); curBeat = Math.floor(curStep / 4); - if (oldStep != curStep && curStep > 0) + if (oldStep != curStep && curStep >= 0) stepHit(); diff --git a/source/PlayState.hx b/source/PlayState.hx index baea8bf77..ce428753f 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -908,9 +908,18 @@ class PlayState extends MusicBeatState startTimer = new FlxTimer().start(Conductor.crochet / 1000, function(tmr:FlxTimer) { - dad.dance(); - gf.dance(); - boyfriend.playAnim('idle'); + // this just based on beatHit stuff but compact + if (swagCounter % gfSpeed == 0) + gf.dance(); + if (swagCounter % 2 == 0) + { + if (!boyfriend.animation.curAnim.name.startsWith("sing")) + boyfriend.playAnim('idle'); + if (!dad.animation.curAnim.name.startsWith("sing")) + dad.dance(); + } + else if (dad.curCharacter == 'spooky' && !dad.animation.curAnim.name.startsWith("sing")) + dad.dance(); var introAssets:Map<String, Array<String>> = new Map<String, Array<String>>(); introAssets.set('default', ['ready', "set", "go"]); @@ -1286,6 +1295,39 @@ class PlayState extends MusicBeatState iconP1.animation.play('bf-old'); } + // do this BEFORE super.update() so songPosition is accurate + if (startingSong) + { + if (startedCountdown) + { + Conductor.songPosition += FlxG.elapsed * 1000; + if (Conductor.songPosition >= 0) + startSong(); + } + } + else + { + // Conductor.songPosition = FlxG.sound.music.time; + Conductor.songPosition += FlxG.elapsed * 1000; + + if (!paused) + { + songTime += FlxG.game.ticks - previousFrameTime; + previousFrameTime = FlxG.game.ticks; + + // Interpolation type beat + if (Conductor.lastSongPos != Conductor.songPosition) + { + songTime = (songTime + Conductor.songPosition) / 2; + Conductor.lastSongPos = Conductor.songPosition; + // Conductor.songPosition += FlxG.elapsed * 1000; + // trace('MISSED FRAME'); + } + } + + // Conductor.lastSongPos = FlxG.sound.music.time; + } + switch (curStage) { case 'philly': @@ -1362,38 +1404,6 @@ class PlayState extends MusicBeatState FlxG.switchState(new AnimationDebug(SONG.player2)); #end - if (startingSong) - { - if (startedCountdown) - { - Conductor.songPosition += FlxG.elapsed * 1000; - if (Conductor.songPosition >= 0) - startSong(); - } - } - else - { - // Conductor.songPosition = FlxG.sound.music.time; - Conductor.songPosition += FlxG.elapsed * 1000; - - if (!paused) - { - songTime += FlxG.game.ticks - previousFrameTime; - previousFrameTime = FlxG.game.ticks; - - // Interpolation type beat - if (Conductor.lastSongPos != Conductor.songPosition) - { - songTime = (songTime + Conductor.songPosition) / 2; - Conductor.lastSongPos = Conductor.songPosition; - // Conductor.songPosition += FlxG.elapsed * 1000; - // trace('MISSED FRAME'); - } - } - - // Conductor.lastSongPos = FlxG.sound.music.time; - } - if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null) { if (curBeat % 4 == 0) From 3107d62053246bb8dc263fd178f6dc8140f1663d Mon Sep 17 00:00:00 2001 From: MtH <mth@mth.moe> Date: Wed, 17 Mar 2021 19:15:00 +0100 Subject: [PATCH 30/44] make pause actually use the pause control --- source/PlayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index ce428753f..2a678c8de 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1348,7 +1348,7 @@ class PlayState extends MusicBeatState scoreTxt.text = "Score:" + songScore; - if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause) + if (controls.PAUSE && startedCountdown && canPause) { persistentUpdate = false; persistentDraw = true; From 6e23041d8c45e3f595e940b61034eb01615d11e7 Mon Sep 17 00:00:00 2001 From: MtH <mth@mth.moe> Date: Thu, 18 Mar 2021 12:49:37 +0100 Subject: [PATCH 31/44] title tweaks: fix crash when spamming enter, force logo bump, compensate for missed beats with intro text (ex. when window being dragged) --- source/MusicBeatState.hx | 3 - source/MusicBeatSubstate.hx | 3 - source/TitleState.hx | 108 ++++++++++++++++++++---------------- 3 files changed, 59 insertions(+), 55 deletions(-) diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx index 1c7359798..28660b160 100644 --- a/source/MusicBeatState.hx +++ b/source/MusicBeatState.hx @@ -9,9 +9,6 @@ import flixel.util.FlxTimer; class MusicBeatState extends FlxUIState { - private var lastBeat:Float = 0; - private var lastStep:Float = 0; - private var curStep:Int = 0; private var curBeat:Int = 0; private var controls(get, never):Controls; diff --git a/source/MusicBeatSubstate.hx b/source/MusicBeatSubstate.hx index 480d6ed16..89c4458b2 100644 --- a/source/MusicBeatSubstate.hx +++ b/source/MusicBeatSubstate.hx @@ -11,9 +11,6 @@ class MusicBeatSubstate extends FlxSubState super(); } - private var lastBeat:Float = 0; - private var lastStep:Float = 0; - private var curStep:Int = 0; private var curBeat:Int = 0; private var controls(get, never):Controls; diff --git a/source/TitleState.hx b/source/TitleState.hx index eb46ace47..8685b9560 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -34,6 +34,8 @@ class TitleState extends MusicBeatState var wackyImage:FlxSprite; + var lastBeat:Int = 0; + override public function create():Void { #if polymod @@ -304,7 +306,7 @@ class TitleState extends MusicBeatState // FlxG.sound.play(Paths.music('titleShoot'), 0.7); } - if (pressedEnter && !skippedIntro) + if (pressedEnter && !skippedIntro && initialized) { skipIntro(); } @@ -346,7 +348,7 @@ class TitleState extends MusicBeatState { super.beatHit(); - logoBl.animation.play('bump'); + logoBl.animation.play('bump', true); danceLeft = !danceLeft; if (danceLeft) @@ -355,57 +357,65 @@ class TitleState extends MusicBeatState gfDance.animation.play('danceLeft'); FlxG.log.add(curBeat); - - switch (curBeat) + // if the user is draggin the window some beats will + // be missed so this is just to compensate + if (curBeat > lastBeat) { - case 1: - createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']); - // credTextShit.visible = true; - case 3: - addMoreText('present'); - // credTextShit.text += '\npresent...'; - // credTextShit.addText(); - case 4: - deleteCoolText(); - // credTextShit.visible = false; - // credTextShit.text = 'In association \nwith'; - // credTextShit.screenCenter(); - case 5: - createCoolText(['In association', 'with']); - case 7: - addMoreText('newgrounds'); - ngSpr.visible = true; - // credTextShit.text += '\nNewgrounds'; - case 8: - deleteCoolText(); - ngSpr.visible = false; - // credTextShit.visible = false; + for (i in lastBeat...curBeat) + { + switch (i + 1) + { + case 1: + createCoolText(['ninjamuffin99', 'phantomArcade', 'kawaisprite', 'evilsk8er']); + // credTextShit.visible = true; + case 3: + addMoreText('present'); + // credTextShit.text += '\npresent...'; + // credTextShit.addText(); + case 4: + deleteCoolText(); + // credTextShit.visible = false; + // credTextShit.text = 'In association \nwith'; + // credTextShit.screenCenter(); + case 5: + createCoolText(['In association', 'with']); + case 7: + addMoreText('newgrounds'); + ngSpr.visible = true; + // credTextShit.text += '\nNewgrounds'; + case 8: + deleteCoolText(); + ngSpr.visible = false; + // credTextShit.visible = false; - // credTextShit.text = 'Shoutouts Tom Fulp'; - // credTextShit.screenCenter(); - case 9: - createCoolText([curWacky[0]]); - // credTextShit.visible = true; - case 11: - addMoreText(curWacky[1]); - // credTextShit.text += '\nlmao'; - case 12: - deleteCoolText(); - // credTextShit.visible = false; - // credTextShit.text = "Friday"; - // credTextShit.screenCenter(); - case 13: - addMoreText('Friday'); - // credTextShit.visible = true; - case 14: - addMoreText('Night'); - // credTextShit.text += '\nNight'; - case 15: - addMoreText('Funkin'); // credTextShit.text += '\nFunkin'; + // credTextShit.text = 'Shoutouts Tom Fulp'; + // credTextShit.screenCenter(); + case 9: + createCoolText([curWacky[0]]); + // credTextShit.visible = true; + case 11: + addMoreText(curWacky[1]); + // credTextShit.text += '\nlmao'; + case 12: + deleteCoolText(); + // credTextShit.visible = false; + // credTextShit.text = "Friday"; + // credTextShit.screenCenter(); + case 13: + addMoreText('Friday'); + // credTextShit.visible = true; + case 14: + addMoreText('Night'); + // credTextShit.text += '\nNight'; + case 15: + addMoreText('Funkin'); // credTextShit.text += '\nFunkin'; - case 16: - skipIntro(); + case 16: + skipIntro(); + } + } } + lastBeat = curBeat; } var skippedIntro:Bool = false; From ab1a89783ce06c3a9eb1a72b12c3523a60af8985 Mon Sep 17 00:00:00 2001 From: MtH <mth@mth.moe> Date: Thu, 18 Mar 2021 14:04:28 +0100 Subject: [PATCH 32/44] bf pixel die offset fix & manual sparrow fix --- source/Character.hx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/Character.hx b/source/Character.hx index 86a630d49..44d35e2bb 100644 --- a/source/Character.hx +++ b/source/Character.hx @@ -408,8 +408,8 @@ class Character extends FlxSprite animation.play('firstDeath'); addOffset('firstDeath'); - addOffset('deathLoop', -37); - addOffset('deathConfirm', -37); + addOffset('deathLoop', -30, -12); + addOffset('deathConfirm', -30, -12); playAnim('firstDeath'); // pixel bullshit setGraphicSize(Std.int(width * 6)); From eefae64c0caa6e345613bc844ce17eeadaa9b2ff Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Thu, 18 Mar 2021 14:15:54 -0400 Subject: [PATCH 33/44] TANKMAN GAMEOVER SHIT --- source/Boyfriend.hx | 4 +++- source/GameOverSubstate.hx | 29 +++++++++++++++++++++++++++-- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/source/Boyfriend.hx b/source/Boyfriend.hx index c9f87f9bf..3421367cb 100644 --- a/source/Boyfriend.hx +++ b/source/Boyfriend.hx @@ -16,6 +16,8 @@ class Boyfriend extends Character super(x, y, char, true); } + public var startedDeath:Bool = false; + override function update(elapsed:Float) { if (!debugMode) @@ -32,7 +34,7 @@ class Boyfriend extends Character playAnim('idle', true, false, 10); } - if (animation.curAnim.name == 'firstDeath' && animation.curAnim.finished) + if (animation.curAnim.name == 'firstDeath' && animation.curAnim.finished && startedDeath) { playAnim('deathLoop'); } diff --git a/source/GameOverSubstate.hx b/source/GameOverSubstate.hx index 1d672dbf4..79e86c748 100644 --- a/source/GameOverSubstate.hx +++ b/source/GameOverSubstate.hx @@ -13,6 +13,7 @@ class GameOverSubstate extends MusicBeatSubstate var camFollow:FlxObject; var stageSuffix:String = ""; + var randomGameover:Int = 1; public function new(x:Float, y:Float) { @@ -49,8 +50,12 @@ class GameOverSubstate extends MusicBeatSubstate FlxG.camera.target = null; bf.playAnim('firstDeath'); + + randomGameover = FlxG.random.int(1, 25); } + var playingDeathSound:Bool = false; + override function update(elapsed:Float) { super.update(elapsed); @@ -75,9 +80,24 @@ class GameOverSubstate extends MusicBeatSubstate FlxG.camera.follow(camFollow, LOCKON, 0.01); } - if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished) + switch (PlayState.storyWeek) { - FlxG.sound.playMusic(Paths.music('gameOver' + stageSuffix)); + case 7: + if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished && !playingDeathSound) + { + playingDeathSound = true; + FlxG.sound.play(Paths.sound('jeffGameover/jeffGameover-' + randomGameover), 1, false, null, true, function() + { + bf.startedDeath = true; + coolStartDeath(); + }); + } + default: + if (bf.animation.curAnim.name == 'firstDeath' && bf.animation.curAnim.finished) + { + bf.startedDeath = true; + coolStartDeath(); + } } if (FlxG.sound.music.playing) @@ -86,6 +106,11 @@ class GameOverSubstate extends MusicBeatSubstate } } + private function coolStartDeath():Void + { + FlxG.sound.playMusic(Paths.music('gameOver' + stageSuffix)); + } + override function beatHit() { super.beatHit(); From ea6b7de62d7554ae70ce283f3c61951e00ff3318 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Thu, 18 Mar 2021 16:26:39 -0400 Subject: [PATCH 34/44] fixed compiler conditional thingie --- source/ModdingSubstate.hx | 47 ++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/source/ModdingSubstate.hx b/source/ModdingSubstate.hx index 8afffac82..8dfc46016 100644 --- a/source/ModdingSubstate.hx +++ b/source/ModdingSubstate.hx @@ -95,7 +95,6 @@ class ModdingSubstate extends MusicBeatSubstate var modList = []; modFolders = []; - #if desktop for (file in FileSystem.readDirectory('./mods')) { if (FileSystem.isDirectory('./mods/' + file)) @@ -118,32 +117,34 @@ class ModdingSubstate extends MusicBeatSubstate loopNum++; } #end - } private function organizeByY():Void + } + private function organizeByY():Void + { + for (i in 0...grpMods.length) { - for (i in 0...grpMods.length) - { - grpMods.members[i].y = 10 + (40 * i); - } + grpMods.members[i].y = 10 + (40 * i); } - } class ModMenuItem extends FlxText + } +} - { - public var modEnabled:Bool = false; - public var daMod:String; +class ModMenuItem extends FlxText +{ + public var modEnabled:Bool = false; + public var daMod:String; - public function new(x:Float, y:Float, w:Float, str:String, size:Int) - { - super(x, y, w, str, size); - } + public function new(x:Float, y:Float, w:Float, str:String, size:Int) + { + super(x, y, w, str, size); + } - override function update(elapsed:Float) - { - if (modEnabled) - alpha = 1; - else - alpha = 0.5; + override function update(elapsed:Float) + { + if (modEnabled) + alpha = 1; + else + alpha = 0.5; - super.update(elapsed); - } - } + super.update(elapsed); + } +} From 99407f07abcf8d8f8d48475004ab23506c538d1d Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Thu, 18 Mar 2021 20:26:17 -0400 Subject: [PATCH 35/44] small organization/cleanup of Discord things --- source/PlayState.hx | 68 ++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 41 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 8d489bcfe..fa7a6244e 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -193,47 +193,7 @@ class PlayState extends MusicBeatState dialogue = CoolUtil.coolTextFile(Paths.txt('thorns/thornsDialogue')); } - #if desktop - // Making difficulty text for Discord Rich Presence. - switch (storyDifficulty) - { - case 0: - storyDifficultyText = "Easy"; - case 1: - storyDifficultyText = "Normal"; - case 2: - storyDifficultyText = "Hard"; - } - - iconRPC = SONG.player2; - - // To avoid having duplicate images in Discord assets - switch (iconRPC) - { - case 'senpai-angry': - iconRPC = 'senpai'; - case 'monster-christmas': - iconRPC = 'monster'; - case 'mom-car': - iconRPC = 'mom'; - } - - // String that contains the mode defined here so it isn't necessary to call changePresence for each mode - if (isStoryMode) - { - detailsText = "Story Mode: Week " + storyWeek; - } - else - { - detailsText = "Freeplay"; - } - - // String for when the game is paused - detailsPausedText = "Paused - " + detailsText; - - // Updating Discord Rich Presence. - DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); - #end + initDiscord(); switch (SONG.song.toLowerCase()) { @@ -870,6 +830,32 @@ class PlayState extends MusicBeatState super.create(); } + function initDiscord():Void + { + #if desktop + storyDifficultyText = CoolUtil.difficultyString(); + iconRPC = SONG.player2; + + // To avoid having duplicate images in Discord assets + switch (iconRPC) + { + case 'senpai-angry': + iconRPC = 'senpai'; + case 'monster-christmas': + iconRPC = 'monster'; + case 'mom-car': + iconRPC = 'mom'; + } + + // String that contains the mode defined here so it isn't necessary to call changePresence for each mode + detailsText = isStoryMode ? "Story Mode: Week " + storyWeek : "Freeplay"; + detailsPausedText = "Paused - " + detailsText; + + // Updating Discord Rich Presence. + DiscordClient.changePresence(detailsText, SONG.song + " (" + storyDifficultyText + ")", iconRPC); + #end + } + function schoolIntro(?dialogueBox:DialogueBox):Void { var black:FlxSprite = new FlxSprite(-100, -100).makeGraphic(FlxG.width * 2, FlxG.height * 2, FlxColor.BLACK); From fdd8e0445e5c6ac836a67b224c47a89b88ef0959 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Thu, 18 Mar 2021 21:08:44 -0400 Subject: [PATCH 36/44] icon code redo for more modularity --- source/HealthIcon.hx | 56 ++++++++++++++++++++++++++------------------ source/PlayState.hx | 7 +----- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/source/HealthIcon.hx b/source/HealthIcon.hx index 9224904f1..53f404f98 100644 --- a/source/HealthIcon.hx +++ b/source/HealthIcon.hx @@ -2,6 +2,8 @@ package; import flixel.FlxSprite; +using StringTools; + class HealthIcon extends FlxSprite { /** @@ -9,37 +11,45 @@ class HealthIcon extends FlxSprite */ public var sprTracker:FlxSprite; + var char:String = 'bf'; + var isPlayer:Bool = false; + public function new(char:String = 'bf', isPlayer:Bool = false) { super(); - loadGraphic(Paths.image('iconGrid'), true, 150, 150); + this.isPlayer = isPlayer; + this.char = char; + + loadIcon(char); antialiasing = true; - animation.add('bf', [0, 1], 0, false, isPlayer); - animation.add('bf-holding-gf', [0, 1], 0, false, isPlayer); - animation.add('bf-car', [0, 1], 0, false, isPlayer); - animation.add('bf-christmas', [0, 1], 0, false, isPlayer); - animation.add('bf-pixel', [21, 21], 0, false, isPlayer); - animation.add('spooky', [2, 3], 0, false, isPlayer); - animation.add('pico', [4, 5], 0, false, isPlayer); - animation.add('pico-speaker', [4, 5], 0, false, isPlayer); - animation.add('mom', [6, 7], 0, false, isPlayer); - animation.add('mom-car', [6, 7], 0, false, isPlayer); - animation.add('tankman', [8, 9], 0, false, isPlayer); - animation.add('face', [10, 11], 0, false, isPlayer); - animation.add('dad', [12, 13], 0, false, isPlayer); - animation.add('senpai', [22, 22], 0, false, isPlayer); - animation.add('senpai-angry', [22, 22], 0, false, isPlayer); - animation.add('spirit', [23, 23], 0, false, isPlayer); - animation.add('bf-old', [14, 15], 0, false, isPlayer); - animation.add('gf', [16], 0, false, isPlayer); - animation.add('parents-christmas', [17], 0, false, isPlayer); - animation.add('monster', [19, 20], 0, false, isPlayer); - animation.add('monster-christmas', [19, 20], 0, false, isPlayer); - animation.play(char); scrollFactor.set(); } + public var isOldIcon:Bool = false; + + public function swapOldIcon():Void + { + isOldIcon = !isOldIcon; + + if (isOldIcon) + { + loadGraphic(Paths.image('icons/icon-bf-old'), true, 150, 150); + animation.add('bf-old', [0, 1], 0, false, isPlayer); + animation.play('bf-old'); + } + else + loadIcon(char); + } + + function loadIcon(char:String):Void + { + var realChar:String = char.split('-')[0].trim(); + loadGraphic(Paths.image('icons/icon-' + realChar), true, 150, 150); + animation.add(realChar, [0, 1], 0, false, isPlayer); + animation.play(realChar); + } + override function update(elapsed:Float) { super.update(elapsed); diff --git a/source/PlayState.hx b/source/PlayState.hx index fa7a6244e..971b1f651 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1389,12 +1389,7 @@ class PlayState extends MusicBeatState #end if (FlxG.keys.justPressed.NINE) - { - if (iconP1.animation.curAnim.name == 'bf-old') - iconP1.animation.play(SONG.player1); - else - iconP1.animation.play('bf-old'); - } + iconP1.swapOldIcon(); // do this BEFORE super.update() so songPosition is accurate if (startingSong) From be5907ba124679b041460b3202b4238fcf7ee352 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Fri, 19 Mar 2021 00:03:29 -0400 Subject: [PATCH 37/44] pixel icon bullshits --- source/HealthIcon.hx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/HealthIcon.hx b/source/HealthIcon.hx index 53f404f98..46adbcec3 100644 --- a/source/HealthIcon.hx +++ b/source/HealthIcon.hx @@ -44,7 +44,15 @@ class HealthIcon extends FlxSprite function loadIcon(char:String):Void { - var realChar:String = char.split('-')[0].trim(); + var realChar:String = ""; + switch (char) + { + case 'bf-pixel': + realChar = char; + default: + realChar = char.split('-')[0].trim(); + } + loadGraphic(Paths.image('icons/icon-' + realChar), true, 150, 150); animation.add(realChar, [0, 1], 0, false, isPlayer); animation.play(realChar); From 01065e54d530b60f9f1cb6f0ac7b7345e31cdbaa Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Sat, 20 Mar 2021 00:48:17 -0400 Subject: [PATCH 38/44] new note spritesheets --- source/TitleState.hx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/TitleState.hx b/source/TitleState.hx index e8a1990e8..fef57d275 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -138,6 +138,7 @@ class TitleState extends MusicBeatState // bg.antialiasing = true; // bg.setGraphicSize(Std.int(bg.width * 0.6)); // bg.updateHitbox(); + add(bg); logoBl = new FlxSprite(-150, -100); @@ -146,6 +147,8 @@ class TitleState extends MusicBeatState logoBl.animation.addByPrefix('bump', 'logo bumpin', 24); logoBl.animation.play('bump'); logoBl.updateHitbox(); + + // trace(); // logoBl.screenCenter(); // logoBl.color = FlxColor.BLACK; @@ -357,6 +360,7 @@ class TitleState extends MusicBeatState super.beatHit(); logoBl.animation.play('bump', true); + danceLeft = !danceLeft; if (danceLeft) From 2b61c81ff5b8e45f82a3a354b09eebdf729ce576 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Sat, 20 Mar 2021 01:03:42 -0400 Subject: [PATCH 39/44] arrows stuff --- source/Note.hx | 13 +++++++------ source/PlayState.hx | 8 ++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/source/Note.hx b/source/Note.hx index 114a7ffbf..d979f75a6 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -4,12 +4,13 @@ import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; import flixel.math.FlxMath; import flixel.util.FlxColor; + +using StringTools; + #if polymod import polymod.format.ParseRules.TargetSignatureElement; #end -using StringTools; - class Note extends FlxSprite { public var strumTime:Float = 0; @@ -82,10 +83,10 @@ class Note extends FlxSprite default: frames = Paths.getSparrowAtlas('NOTE_assets'); - animation.addByPrefix('greenScroll', 'green0'); - animation.addByPrefix('redScroll', 'red0'); - animation.addByPrefix('blueScroll', 'blue0'); - animation.addByPrefix('purpleScroll', 'purple0'); + animation.addByPrefix('greenScroll', 'green instance'); + animation.addByPrefix('redScroll', 'red instance'); + animation.addByPrefix('blueScroll', 'blue instance'); + animation.addByPrefix('purpleScroll', 'purple instance'); animation.addByPrefix('purpleholdend', 'pruple end hold'); animation.addByPrefix('greenholdend', 'green hold end'); diff --git a/source/PlayState.hx b/source/PlayState.hx index 971b1f651..afbdc4d82 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1241,22 +1241,22 @@ class PlayState extends MusicBeatState { case 0: babyArrow.x += Note.swagWidth * 0; - babyArrow.animation.addByPrefix('static', 'arrowLEFT'); + babyArrow.animation.addByPrefix('static', 'arrow static instance 1'); babyArrow.animation.addByPrefix('pressed', 'left press', 24, false); babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false); case 1: babyArrow.x += Note.swagWidth * 1; - babyArrow.animation.addByPrefix('static', 'arrowDOWN'); + babyArrow.animation.addByPrefix('static', 'arrow static instance 2'); babyArrow.animation.addByPrefix('pressed', 'down press', 24, false); babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false); case 2: babyArrow.x += Note.swagWidth * 2; - babyArrow.animation.addByPrefix('static', 'arrowUP'); + babyArrow.animation.addByPrefix('static', 'arrow static instance 4'); babyArrow.animation.addByPrefix('pressed', 'up press', 24, false); babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false); case 3: babyArrow.x += Note.swagWidth * 3; - babyArrow.animation.addByPrefix('static', 'arrowRIGHT'); + babyArrow.animation.addByPrefix('static', 'arrow static instance 3'); babyArrow.animation.addByPrefix('pressed', 'right press', 24, false); babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false); } From 42991c5fdfbefed468784249bdcd0af1a454b7f1 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Sat, 20 Mar 2021 04:33:44 -0400 Subject: [PATCH 40/44] shader dumbshit in progress IGNORE FOR NOW! --- source/Note.hx | 14 +++++ source/shaderslmfao/ColorSwap.hx | 90 ++++++++++++++++++++++++++++++++ 2 files changed, 104 insertions(+) create mode 100644 source/shaderslmfao/ColorSwap.hx diff --git a/source/Note.hx b/source/Note.hx index d979f75a6..9659ad3c0 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -1,9 +1,12 @@ package; +import flixel.FlxG; import flixel.FlxSprite; import flixel.graphics.frames.FlxAtlasFrames; import flixel.math.FlxMath; import flixel.util.FlxColor; +import flixel.util.FlxTimer; +import shaderslmfao.ColorSwap; using StringTools; @@ -101,6 +104,17 @@ class Note extends FlxSprite setGraphicSize(Std.int(width * 0.7)); updateHitbox(); antialiasing = true; + + var colorSwap = new ColorSwap(); + + // shader = colorSwap.shader; + + // colorSwap.colorToReplace = 0xFFF9393F; + // colorSwap.newColor = 0xFF00FF00; + + // color = FlxG.random.color(); + // color.saturation *= 4; + // replaceColor(0xFFC1C1C1, FlxColor.RED); } switch (noteData) diff --git a/source/shaderslmfao/ColorSwap.hx b/source/shaderslmfao/ColorSwap.hx new file mode 100644 index 000000000..4d2eac78e --- /dev/null +++ b/source/shaderslmfao/ColorSwap.hx @@ -0,0 +1,90 @@ +package shaderslmfao; + +import flixel.system.FlxAssets.FlxShader; +import flixel.util.FlxColor; + +class ColorSwap +{ + public var shader(default, null):ColorSwapShader; + public var colorToReplace(default, set):FlxColor; + public var newColor(default, set):FlxColor; + + public function new():Void + { + shader = new ColorSwapShader(); + shader.colorOld.value = []; + shader.colorNew.value = []; + } + + function set_colorToReplace(color:FlxColor):FlxColor + { + colorToReplace = color; + + shader.colorOld.value[0] = color.red; + shader.colorOld.value[1] = color.green; + shader.colorOld.value[2] = color.blue; + + return color; + } + + function set_newColor(color:FlxColor):FlxColor + { + newColor = color; + + shader.colorNew.value[0] = color.red; + shader.colorNew.value[1] = color.green; + shader.colorNew.value[2] = color.blue; + + return color; + } +} + +class ColorSwapShader extends FlxShader +{ + @:glFragmentSource(' + #pragma header + + uniform vec3 colorOld; + uniform vec3 colorNew; + uniform float u_time; + + vec3 normalizeColor(vec3 color) + { + return vec3( + color[0] / 255.0, + color[1] / 255.0, + color[2] / 255.0 + ); + } + + vec3 hueShift(vec3 color, float hue) { + const vec3 k = vec3(0.57735, 0.57735, 0.57735); + float cosAngle = cos(hue); + return vec3(color * cosAngle + cross(k, color) * sin(hue) + k * dot(k, color) * (1.0 - cosAngle)); + } + + + void main() + { + vec4 pixel = texture2D(bitmap, openfl_TextureCoordv); + + vec3 eps = vec3(0.02, 0.02, 0.02); + + vec3 colorOldNormalized = normalizeColor(colorOld); + vec3 colorNewNormalized = normalizeColor(colorNew); + + if (all(greaterThanEqual(pixel, vec4(colorOldNormalized - eps, 1.0)) ) && all(lessThanEqual(pixel, vec4(colorOldNormalized + eps, 1.0)) ) + ) + { + pixel = vec4(hueShift(colorOldNormalized, 0.7), 1.0); + } + + gl_FragColor = pixel; + } + + ') + public function new() + { + super(); + } +} From 671046a6d5e75b3af9a68d72ff52ab9dc83def14 Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Sat, 20 Mar 2021 14:55:29 -0400 Subject: [PATCH 41/44] SHADERRRR --- source/TitleState.hx | 13 +++++--- source/shaderslmfao/ColorSwap.hx | 52 ++++++++++++++------------------ 2 files changed, 32 insertions(+), 33 deletions(-) diff --git a/source/TitleState.hx b/source/TitleState.hx index fef57d275..23b5eac82 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -1,9 +1,5 @@ package; -#if desktop -import Discord.DiscordClient; -import sys.thread.Thread; -#end import flixel.FlxG; import flixel.FlxSprite; import flixel.addons.transition.FlxTransitionSprite.GraphicTransTileDiamond; @@ -21,9 +17,15 @@ import flixel.util.FlxTimer; import io.newgrounds.NG; import lime.app.Application; import openfl.Assets; +import shaderslmfao.ColorSwap; using StringTools; +#if desktop +import Discord.DiscordClient; +import sys.thread.Thread; +#end + class TitleState extends MusicBeatState { static var initialized:Bool = false; @@ -158,6 +160,9 @@ class TitleState extends MusicBeatState gfDance.animation.addByIndices('danceRight', 'gfDance', [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], "", 24, false); gfDance.antialiasing = true; add(gfDance); + + gfDance.shader = new ColorSwap().shader; + add(logoBl); titleText = new FlxSprite(100, FlxG.height * 0.8); diff --git a/source/shaderslmfao/ColorSwap.hx b/source/shaderslmfao/ColorSwap.hx index 4d2eac78e..cb2e2bcde 100644 --- a/source/shaderslmfao/ColorSwap.hx +++ b/source/shaderslmfao/ColorSwap.hx @@ -12,18 +12,12 @@ class ColorSwap public function new():Void { shader = new ColorSwapShader(); - shader.colorOld.value = []; - shader.colorNew.value = []; } function set_colorToReplace(color:FlxColor):FlxColor { colorToReplace = color; - shader.colorOld.value[0] = color.red; - shader.colorOld.value[1] = color.green; - shader.colorOld.value[2] = color.blue; - return color; } @@ -31,10 +25,6 @@ class ColorSwap { newColor = color; - shader.colorNew.value[0] = color.red; - shader.colorNew.value[1] = color.green; - shader.colorNew.value[2] = color.blue; - return color; } } @@ -44,10 +34,6 @@ class ColorSwapShader extends FlxShader @:glFragmentSource(' #pragma header - uniform vec3 colorOld; - uniform vec3 colorNew; - uniform float u_time; - vec3 normalizeColor(vec3 color) { return vec3( @@ -57,29 +43,37 @@ class ColorSwapShader extends FlxShader ); } - vec3 hueShift(vec3 color, float hue) { - const vec3 k = vec3(0.57735, 0.57735, 0.57735); - float cosAngle = cos(hue); - return vec3(color * cosAngle + cross(k, color) * sin(hue) + k * dot(k, color) * (1.0 - cosAngle)); + vec3 rgb2hsv(vec3 c) + { + vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0); + vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g)); + vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r)); + + float d = q.x - min(q.w, q.y); + float e = 1.0e-10; + return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x); } + vec3 hsv2rgb(vec3 c) + { + vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0); + vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www); + return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y); + } void main() { - vec4 pixel = texture2D(bitmap, openfl_TextureCoordv); + vec4 color = flixel_texture2D(bitmap, openfl_TextureCoordv); - vec3 eps = vec3(0.02, 0.02, 0.02); + vec4 swagColor = vec4(rgb2hsv(vec3(color[0], color[1], color[2])), color[3]); + + // [0] is the hue??? + swagColor[0] += 2; + // swagColor[1] += 0.5; - vec3 colorOldNormalized = normalizeColor(colorOld); - vec3 colorNewNormalized = normalizeColor(colorNew); + color = vec4(hsv2rgb(vec3(swagColor[0], swagColor[1], swagColor[2])), swagColor[3]); - if (all(greaterThanEqual(pixel, vec4(colorOldNormalized - eps, 1.0)) ) && all(lessThanEqual(pixel, vec4(colorOldNormalized + eps, 1.0)) ) - ) - { - pixel = vec4(hueShift(colorOldNormalized, 0.7), 1.0); - } - - gl_FragColor = pixel; + gl_FragColor = color; } ') From c80d8cc09ef88e97aaf2bf288964eefa05def28f Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Sat, 20 Mar 2021 15:20:00 -0400 Subject: [PATCH 42/44] shader bullshit --- source/TitleState.hx | 10 +++++++++- source/shaderslmfao/ColorSwap.hx | 19 +++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/source/TitleState.hx b/source/TitleState.hx index 23b5eac82..b825af96e 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -42,12 +42,16 @@ class TitleState extends MusicBeatState var lastBeat:Int = 0; + // var swagShader:ColorSwap; + override public function create():Void { #if polymod polymod.Polymod.init({modRoot: "mods", dirs: ['introMod'], framework: OPENFL}); #end + // swagShader = new ColorSwap(); + FlxG.sound.muteKeys = [ZERO]; PlayerSettings.init(); @@ -150,6 +154,8 @@ class TitleState extends MusicBeatState logoBl.animation.play('bump'); logoBl.updateHitbox(); + // logoBl.shader = swagShader.shader; + // trace(); // logoBl.screenCenter(); // logoBl.color = FlxColor.BLACK; @@ -161,7 +167,7 @@ class TitleState extends MusicBeatState gfDance.antialiasing = true; add(gfDance); - gfDance.shader = new ColorSwap().shader; + // gfDance.shader = swagShader.shader; add(logoBl); @@ -364,6 +370,8 @@ class TitleState extends MusicBeatState { super.beatHit(); + // swagShader.update(FlxG.random.float(0.1, 0.7)); + logoBl.animation.play('bump', true); danceLeft = !danceLeft; diff --git a/source/shaderslmfao/ColorSwap.hx b/source/shaderslmfao/ColorSwap.hx index cb2e2bcde..ff13871b3 100644 --- a/source/shaderslmfao/ColorSwap.hx +++ b/source/shaderslmfao/ColorSwap.hx @@ -8,10 +8,17 @@ class ColorSwap public var shader(default, null):ColorSwapShader; public var colorToReplace(default, set):FlxColor; public var newColor(default, set):FlxColor; + public var daTime(default, set):Float; public function new():Void { shader = new ColorSwapShader(); + shader.uTime.value = [0]; + } + + public function update(elapsed:Float):Void + { + shader.uTime.value[0] += elapsed; } function set_colorToReplace(color:FlxColor):FlxColor @@ -21,6 +28,11 @@ class ColorSwap return color; } + function set_daTime(daTime:Float):Float + { + return daTime; + } + function set_newColor(color:FlxColor):FlxColor { newColor = color; @@ -34,6 +46,9 @@ class ColorSwapShader extends FlxShader @:glFragmentSource(' #pragma header + + uniform float uTime; + vec3 normalizeColor(vec3 color) { return vec3( @@ -68,8 +83,8 @@ class ColorSwapShader extends FlxShader vec4 swagColor = vec4(rgb2hsv(vec3(color[0], color[1], color[2])), color[3]); // [0] is the hue??? - swagColor[0] += 2; - // swagColor[1] += 0.5; + swagColor[0] += uTime; + // swagColor[1] += uTime; color = vec4(hsv2rgb(vec3(swagColor[0], swagColor[1], swagColor[2])), swagColor[3]); From 75ed1d52313b741c8692191353ad1af2d2451eec Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Sun, 21 Mar 2021 14:45:46 -0400 Subject: [PATCH 43/44] color swap shit in progress --- source/ColorpickSubstate.hx | 56 ++++++++++++++++++++++++++++++++ source/Note.hx | 17 +++++++--- source/OptionsSubState.hx | 5 ++- source/TitleState.hx | 22 +++++++++---- source/shaderslmfao/ColorSwap.hx | 8 ++++- 5 files changed, 96 insertions(+), 12 deletions(-) create mode 100644 source/ColorpickSubstate.hx diff --git a/source/ColorpickSubstate.hx b/source/ColorpickSubstate.hx new file mode 100644 index 000000000..b39957de5 --- /dev/null +++ b/source/ColorpickSubstate.hx @@ -0,0 +1,56 @@ +package; + +import flixel.group.FlxGroup.FlxTypedGroup; +import shaderslmfao.ColorSwap; + +class ColorpickSubstate extends MusicBeatSubstate +{ + var curSelected:Int = 0; + + var grpNotes:FlxTypedGroup<Note>; + + public function new() + { + super(); + + grpNotes = new FlxTypedGroup<Note>(); + add(grpNotes); + + for (i in 0...4) + { + var note:Note = new Note(0, i); + + note.x = (100 * i) + i; + note.screenCenter(Y); + + grpNotes.add(note); + } + } + + override function update(elapsed:Float) + { + if (controls.RIGHT_P) + curSelected += 1; + if (controls.LEFT_P) + curSelected -= 1; + + if (curSelected < 0) + curSelected = grpNotes.members.length - 1; + if (curSelected >= grpNotes.members.length) + curSelected = 0; + + if (controls.UP) + { + grpNotes.members[curSelected].colorSwap.update(elapsed * 0.3); + Note.arrowColors[curSelected] += elapsed * 0.3; + } + + if (controls.DOWN) + { + grpNotes.members[curSelected].colorSwap.update(-elapsed * 0.3); + Note.arrowColors[curSelected] += -elapsed * 0.3; + } + + super.update(elapsed); + } +} diff --git a/source/Note.hx b/source/Note.hx index 9659ad3c0..c39bf8bc1 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -28,6 +28,7 @@ class Note extends FlxSprite public var sustainLength:Float = 0; public var isSustainNote:Bool = false; + public var colorSwap:ColorSwap; public var noteScore:Float = 1; public static var swagWidth:Float = 160 * 0.7; @@ -36,6 +37,8 @@ class Note extends FlxSprite public static var BLUE_NOTE:Int = 1; public static var RED_NOTE:Int = 3; + public static var arrowColors:Array<Float> = [1, 1, 1, 1]; + public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false) { super(); @@ -105,10 +108,6 @@ class Note extends FlxSprite updateHitbox(); antialiasing = true; - var colorSwap = new ColorSwap(); - - // shader = colorSwap.shader; - // colorSwap.colorToReplace = 0xFFF9393F; // colorSwap.newColor = 0xFF00FF00; @@ -117,11 +116,15 @@ class Note extends FlxSprite // replaceColor(0xFFC1C1C1, FlxColor.RED); } + colorSwap = new ColorSwap(); + shader = colorSwap.shader; + switch (noteData) { case 0: x += swagWidth * 0; animation.play('purpleScroll'); + case 1: x += swagWidth * 1; animation.play('blueScroll'); @@ -155,6 +158,7 @@ class Note extends FlxSprite } updateHitbox(); + updateColors(); x -= width / 2; @@ -182,6 +186,11 @@ class Note extends FlxSprite } } + public function updateColors():Void + { + colorSwap.update(arrowColors[noteData]); + } + override function update(elapsed:Float) { super.update(elapsed); diff --git a/source/OptionsSubState.hx b/source/OptionsSubState.hx index 00ca548f1..323094b7e 100644 --- a/source/OptionsSubState.hx +++ b/source/OptionsSubState.hx @@ -8,7 +8,7 @@ import flixel.util.FlxColor; class OptionsSubState extends MusicBeatSubstate { - var textMenuItems:Array<String> = ['Master Volume', 'Sound Volume', 'Controls']; + var textMenuItems:Array<String> = ['Master Volume', 'Sound Volume', 'Controls', 'Colors']; var selector:FlxSprite; var curSelected:Int = 0; @@ -67,6 +67,9 @@ class OptionsSubState extends MusicBeatSubstate { switch (textMenuItems[curSelected]) { + case "Colors": + FlxG.state.closeSubState(); + FlxG.state.openSubState(new ColorpickSubstate()); case "Controls": FlxG.state.closeSubState(); FlxG.state.openSubState(new ControlsSubState()); diff --git a/source/TitleState.hx b/source/TitleState.hx index b825af96e..ca5340b93 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -42,7 +42,7 @@ class TitleState extends MusicBeatState var lastBeat:Int = 0; - // var swagShader:ColorSwap; + var swagShader:ColorSwap; override public function create():Void { @@ -50,7 +50,7 @@ class TitleState extends MusicBeatState polymod.Polymod.init({modRoot: "mods", dirs: ['introMod'], framework: OPENFL}); #end - // swagShader = new ColorSwap(); + swagShader = new ColorSwap(); FlxG.sound.muteKeys = [ZERO]; @@ -154,7 +154,7 @@ class TitleState extends MusicBeatState logoBl.animation.play('bump'); logoBl.updateHitbox(); - // logoBl.shader = swagShader.shader; + logoBl.shader = swagShader.shader; // trace(); // logoBl.screenCenter(); @@ -167,7 +167,7 @@ class TitleState extends MusicBeatState gfDance.antialiasing = true; add(gfDance); - // gfDance.shader = swagShader.shader; + gfDance.shader = swagShader.shader; add(logoBl); @@ -333,6 +333,16 @@ class TitleState extends MusicBeatState skipIntro(); } + if (controls.LEFT) + { + swagShader.update(-elapsed * 0.1); + } + + if (controls.RIGHT) + { + swagShader.update(elapsed * 0.1); + } + super.update(elapsed); } @@ -366,12 +376,12 @@ class TitleState extends MusicBeatState } } + var isRainbow:Bool = false; + override function beatHit() { super.beatHit(); - // swagShader.update(FlxG.random.float(0.1, 0.7)); - logoBl.animation.play('bump', true); danceLeft = !danceLeft; diff --git a/source/shaderslmfao/ColorSwap.hx b/source/shaderslmfao/ColorSwap.hx index ff13871b3..1f57dc7a0 100644 --- a/source/shaderslmfao/ColorSwap.hx +++ b/source/shaderslmfao/ColorSwap.hx @@ -9,16 +9,20 @@ class ColorSwap public var colorToReplace(default, set):FlxColor; public var newColor(default, set):FlxColor; public var daTime(default, set):Float; + public var hueShit:Float = 0; public function new():Void { shader = new ColorSwapShader(); shader.uTime.value = [0]; + shader.money.value = [0]; } public function update(elapsed:Float):Void { shader.uTime.value[0] += elapsed; + hueShit += elapsed; + // trace(shader.money.value[0]); } function set_colorToReplace(color:FlxColor):FlxColor @@ -46,8 +50,8 @@ class ColorSwapShader extends FlxShader @:glFragmentSource(' #pragma header - uniform float uTime; + uniform float money; vec3 normalizeColor(vec3 color) { @@ -86,6 +90,8 @@ class ColorSwapShader extends FlxShader swagColor[0] += uTime; // swagColor[1] += uTime; + // money += swagColor[0]; + color = vec4(hsv2rgb(vec3(swagColor[0], swagColor[1], swagColor[2])), swagColor[3]); gl_FragColor = color; From dd49ae79902ca28ced625c4b2a98602e3fb9554b Mon Sep 17 00:00:00 2001 From: Cameron Taylor <cameron.taylor.ninja@gmail.com> Date: Sun, 21 Mar 2021 16:29:47 -0400 Subject: [PATCH 44/44] note color bullshit and also disabled 'stuns'?? --- source/ColorpickSubstate.hx | 7 +++++++ source/Note.hx | 2 +- source/OptionsSubState.hx | 7 ++++++- source/PlayState.hx | 16 ++++++++++++---- 4 files changed, 26 insertions(+), 6 deletions(-) diff --git a/source/ColorpickSubstate.hx b/source/ColorpickSubstate.hx index b39957de5..6123acc9b 100644 --- a/source/ColorpickSubstate.hx +++ b/source/ColorpickSubstate.hx @@ -1,5 +1,6 @@ package; +import flixel.FlxG; import flixel.group.FlxGroup.FlxTypedGroup; import shaderslmfao.ColorSwap; @@ -29,6 +30,12 @@ class ColorpickSubstate extends MusicBeatSubstate override function update(elapsed:Float) { + if (controls.BACK) + { + FlxG.state.closeSubState(); + FlxG.state.openSubState(new OptionsSubState()); + } + if (controls.RIGHT_P) curSelected += 1; if (controls.LEFT_P) diff --git a/source/Note.hx b/source/Note.hx index c39bf8bc1..786a23e53 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -118,6 +118,7 @@ class Note extends FlxSprite colorSwap = new ColorSwap(); shader = colorSwap.shader; + updateColors(); switch (noteData) { @@ -158,7 +159,6 @@ class Note extends FlxSprite } updateHitbox(); - updateColors(); x -= width / 2; diff --git a/source/OptionsSubState.hx b/source/OptionsSubState.hx index 323094b7e..ee27bdfc1 100644 --- a/source/OptionsSubState.hx +++ b/source/OptionsSubState.hx @@ -8,7 +8,7 @@ import flixel.util.FlxColor; class OptionsSubState extends MusicBeatSubstate { - var textMenuItems:Array<String> = ['Master Volume', 'Sound Volume', 'Controls', 'Colors']; + var textMenuItems:Array<String> = ['Master Volume', 'Sound Volume', 'Controls', 'Colors', 'Back']; var selector:FlxSprite; var curSelected:Int = 0; @@ -63,6 +63,9 @@ class OptionsSubState extends MusicBeatSubstate txt.color = FlxColor.YELLOW; }); + if (controls.BACK) + FlxG.switchState(new MainMenuState()); + if (controls.ACCEPT) { switch (textMenuItems[curSelected]) @@ -76,6 +79,8 @@ class OptionsSubState extends MusicBeatSubstate case "Mods": FlxG.state.closeSubState(); FlxG.state.openSubState(new ModdingSubstate()); + case "Back": + FlxG.switchState(new MainMenuState()); } } } diff --git a/source/PlayState.hx b/source/PlayState.hx index afbdc4d82..013a8c2de 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1,8 +1,5 @@ package; -#if desktop -import Discord.DiscordClient; -#end import Section.SwagSection; import Song.SwagSong; import WiggleEffect.WiggleEffectType; @@ -41,9 +38,14 @@ import lime.utils.Assets; import openfl.display.BlendMode; import openfl.display.StageQuality; import openfl.filters.ShaderFilter; +import shaderslmfao.ColorSwap; using StringTools; +#if desktop +import Discord.DiscordClient; +#end + class PlayState extends MusicBeatState { public static var curStage:String = ''; @@ -1189,6 +1191,9 @@ class PlayState extends MusicBeatState { // FlxG.log.add(i); var babyArrow:FlxSprite = new FlxSprite(0, strumLine.y); + var colorswap:ColorSwap = new ColorSwap(); + babyArrow.shader = colorswap.shader; + colorswap.update(Note.arrowColors[i]); switch (curStage) { @@ -2007,8 +2012,11 @@ class PlayState extends MusicBeatState var controlArray:Array<Bool> = [leftP, downP, upP, rightP]; // FlxG.watch.addQuick('asdfa', upP); - if ((upP || rightP || downP || leftP) && !boyfriend.stunned && generatedMusic) + if ((upP || rightP || downP || leftP) && generatedMusic) { + // note to self, used to have stunned + // && !boyfriend.stunned + boyfriend.holdTimer = 0; var possibleNotes:Array<Note> = [];