From b3c418098b2bbdc85833e9903d6185071124e917 Mon Sep 17 00:00:00 2001 From: Detoria <44783518+theDetourist@users.noreply.github.com> Date: Sat, 3 Apr 2021 18:15:28 -0300 Subject: [PATCH 1/3] Friday Night Funkin' EYY's, but GF cheers too --- source/PlayState.hx | 164 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 131 insertions(+), 33 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 762695d..97d930c 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -157,7 +157,6 @@ class PlayState extends MusicBeatState var scoreTxt:FlxText; var replayTxt:FlxText; - public static var campaignScore:Int = 0; var defaultCamZoom:Float = 1.05; @@ -172,6 +171,12 @@ class PlayState extends MusicBeatState public static var timeCurrently:Float = 0; public static var timeCurrentlyR:Float = 0; + + // Will fire once every prevent debug spam messages and broken animations + private var triggeredAlready:Bool = false; + + // Will decide if she's even allowed to headbang at all depending on the song + private var allowToHeadbang:Bool = false; override public function create() { @@ -1150,42 +1155,47 @@ class PlayState extends MusicBeatState songLength = FlxG.sound.music.length; if (FlxG.save.data.songPosition) - { - remove(songPosBG); - remove(songPosBar); - remove(songName); + { + remove(songPosBG); + remove(songPosBar); + remove(songName); - songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar')); - if (FlxG.save.data.downscroll) - songPosBG.y = FlxG.height * 0.9 + 45; - songPosBG.screenCenter(X); - songPosBG.scrollFactor.set(); - add(songPosBG); + songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar')); + if (FlxG.save.data.downscroll) + songPosBG.y = FlxG.height * 0.9 + 45; + songPosBG.screenCenter(X); + songPosBG.scrollFactor.set(); + add(songPosBG); - songPosBar = new FlxBar(songPosBG.x + 4, songPosBG.y + 4, LEFT_TO_RIGHT, Std.int(songPosBG.width - 8), Std.int(songPosBG.height - 8), this, - 'songPositionBar', 0, songLength - 1000); - songPosBar.numDivisions = 1000; - songPosBar.scrollFactor.set(); - songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME); - add(songPosBar); - - var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - 20,songPosBG.y,0,SONG.song, 16); - if (FlxG.save.data.downscroll) - songName.y -= 3; - songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); - songName.scrollFactor.set(); - add(songName); + songPosBar = new FlxBar(songPosBG.x + 4, songPosBG.y + 4, LEFT_TO_RIGHT, Std.int(songPosBG.width - 8), Std.int(songPosBG.height - 8), this, + 'songPositionBar', 0, songLength - 1000); + songPosBar.numDivisions = 1000; + songPosBar.scrollFactor.set(); + songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME); + add(songPosBar); - songPosBG.cameras = [camHUD]; - songPosBar.cameras = [camHUD]; - songName.cameras = [camHUD]; - } + var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - 20,songPosBG.y,0,SONG.song, 16); + if (FlxG.save.data.downscroll) + songName.y -= 3; + songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); + songName.scrollFactor.set(); + add(songName); + songPosBG.cameras = [camHUD]; + songPosBar.cameras = [camHUD]; + songName.cameras = [camHUD]; + } + + // Song check real quick + if(curSong == 'Bopeebo' || + curSong == 'Philly' || + curSong == 'Blammed' || + curSong == 'Cocoa' || + curSong == 'Eggnog') allowToHeadbang = true; + else allowToHeadbang = false; + #if desktop // Updating Discord Rich Presence (with Time Left) - - - DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + generateRanking(), "\nAcc: " + truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); #end } @@ -1725,9 +1735,97 @@ class PlayState extends MusicBeatState if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null) { - if (curBeat % 4 == 0) + // Make sure Girlfriend cheers only for certain songs + if(allowToHeadbang) { - // trace(PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection); + // Don't animate GF if something else is already animating her (eg. train passing) + if(gf.animation.curAnim.name == 'danceLeft' || gf.animation.curAnim.name == 'danceRight' || gf.animation.curAnim.name == 'idle') + { + // Per song treatment since some songs will only have the 'Hey' at certain times + if(curSong == 'Philly') + { + // Prevent GF from starting too early or doing this endlessly + if(curBeat < 250) + { + // Stoppage times + if(curBeat != 184 && curBeat != 216) + { + if (curBeat % 16 == 8) + { + // Just a garantee that it'll trigger just once + if(!triggeredAlready) + { + gf.playAnim('cheer'); + trace('Eyy ' + curBeat); + triggeredAlready = true; + } + }else triggeredAlready = false; + } + } + }else if(curSong == 'Bopeebo') + { + if(curBeat > 5 && curBeat < 130) + { + if (curBeat % 8 == 7) + { + if(!triggeredAlready) + { + gf.playAnim('cheer'); + trace('Eyy ' + curBeat); + triggeredAlready = true; + } + }else triggeredAlready = false; + } + }else if(curSong == 'Blammed') + { + if(curBeat > 30 && curBeat < 190) + { + if(curBeat < 90 || curBeat > 128) + { + if (curBeat % 4 == 2) + { + if(!triggeredAlready) + { + gf.playAnim('cheer'); + trace('Eyy ' + curBeat); + triggeredAlready = true; + } + }else triggeredAlready = false; + } + } + }else if(curSong == 'Cocoa') + { + if(curBeat < 170) + { + if(curBeat < 65 || curBeat > 130 && curBeat < 145) + { + if (curBeat % 16 == 15) + { + if(!triggeredAlready) + { + gf.playAnim('cheer'); + trace('Eyy ' + curBeat); + triggeredAlready = true; + } + }else triggeredAlready = false; + } + } + }else if(curSong == 'Eggnog') + { + if(curBeat > 10 && curBeat != 111 && curBeat < 220) + { + if (curBeat % 8 == 7) + { + if(!triggeredAlready) + { + gf.playAnim('cheer'); + trace('Eyy ' + curBeat); + triggeredAlready = true; + } + }else triggeredAlready = false; + } + } + } } if (camFollow.x != dad.getMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection) From ab6963f6c74802f1f55897debae2a295d7f2b052 Mon Sep 17 00:00:00 2001 From: Detoria <44783518+theDetourist@users.noreply.github.com> Date: Sat, 3 Apr 2021 19:01:41 -0300 Subject: [PATCH 2/3] typo fix --- source/PlayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 97d930c..0a3b4d6 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -172,7 +172,7 @@ class PlayState extends MusicBeatState public static var timeCurrently:Float = 0; public static var timeCurrentlyR:Float = 0; - // Will fire once every prevent debug spam messages and broken animations + // Will fire once to prevent debug spam messages and broken animations private var triggeredAlready:Bool = false; // Will decide if she's even allowed to headbang at all depending on the song From 580ad210cafdd21d1d6610e2b7a4f70d61b18005 Mon Sep 17 00:00:00 2001 From: Detoria <44783518+theDetourist@users.noreply.github.com> Date: Sat, 3 Apr 2021 22:17:02 -0300 Subject: [PATCH 3/3] switch over elseif stuff + few changes --- source/PlayState.hx | 136 ++++++++++++++++++++++---------------------- 1 file changed, 69 insertions(+), 67 deletions(-) diff --git a/source/PlayState.hx b/source/PlayState.hx index 0a3b4d6..f982855 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -176,7 +176,7 @@ class PlayState extends MusicBeatState private var triggeredAlready:Bool = false; // Will decide if she's even allowed to headbang at all depending on the song - private var allowToHeadbang:Bool = false; + private var allowedToHeadbang:Bool = false; override public function create() { @@ -1187,12 +1187,11 @@ class PlayState extends MusicBeatState } // Song check real quick - if(curSong == 'Bopeebo' || - curSong == 'Philly' || - curSong == 'Blammed' || - curSong == 'Cocoa' || - curSong == 'Eggnog') allowToHeadbang = true; - else allowToHeadbang = false; + switch(curSong) + { + case 'Bopeebo' | 'Philly' | 'Blammed' | 'Cocoa' | 'Eggnog': allowedToHeadbang = true; + default: allowedToHeadbang = false; + } #if desktop // Updating Discord Rich Presence (with Time Left) @@ -1736,98 +1735,101 @@ class PlayState extends MusicBeatState if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null) { // Make sure Girlfriend cheers only for certain songs - if(allowToHeadbang) + if(allowedToHeadbang) { // Don't animate GF if something else is already animating her (eg. train passing) if(gf.animation.curAnim.name == 'danceLeft' || gf.animation.curAnim.name == 'danceRight' || gf.animation.curAnim.name == 'idle') { // Per song treatment since some songs will only have the 'Hey' at certain times - if(curSong == 'Philly') + switch(curSong) { - // Prevent GF from starting too early or doing this endlessly - if(curBeat < 250) + case 'Philly': { - // Stoppage times - if(curBeat != 184 && curBeat != 216) + // General duration of the song + if(curBeat < 250) { - if (curBeat % 16 == 8) + // Beats to skip or to stop GF from cheering + if(curBeat != 184 && curBeat != 216) { - // Just a garantee that it'll trigger just once - if(!triggeredAlready) + if(curBeat % 16 == 8) { - gf.playAnim('cheer'); - trace('Eyy ' + curBeat); - triggeredAlready = true; - } - }else triggeredAlready = false; - } - } - }else if(curSong == 'Bopeebo') - { - if(curBeat > 5 && curBeat < 130) - { - if (curBeat % 8 == 7) - { - if(!triggeredAlready) - { - gf.playAnim('cheer'); - trace('Eyy ' + curBeat); - triggeredAlready = true; + // Just a garantee that it'll trigger just once + if(!triggeredAlready) + { + gf.playAnim('cheer'); + triggeredAlready = true; + } + }else triggeredAlready = false; } - }else triggeredAlready = false; + } } - }else if(curSong == 'Blammed') - { - if(curBeat > 30 && curBeat < 190) + case 'Bopeebo': { - if(curBeat < 90 || curBeat > 128) + // Where it starts || where it ends + if(curBeat > 5 && curBeat < 130) { - if (curBeat % 4 == 2) + if(curBeat % 8 == 7) { if(!triggeredAlready) { gf.playAnim('cheer'); - trace('Eyy ' + curBeat); triggeredAlready = true; } }else triggeredAlready = false; } } - }else if(curSong == 'Cocoa') - { - if(curBeat < 170) + case 'Blammed': { - if(curBeat < 65 || curBeat > 130 && curBeat < 145) + if(curBeat > 30 && curBeat < 190) { - if (curBeat % 16 == 15) + if(curBeat < 90 || curBeat > 128) { - if(!triggeredAlready) + if(curBeat % 4 == 2) { - gf.playAnim('cheer'); - trace('Eyy ' + curBeat); - triggeredAlready = true; - } - }else triggeredAlready = false; - } - } - }else if(curSong == 'Eggnog') - { - if(curBeat > 10 && curBeat != 111 && curBeat < 220) - { - if (curBeat % 8 == 7) - { - if(!triggeredAlready) - { - gf.playAnim('cheer'); - trace('Eyy ' + curBeat); - triggeredAlready = true; + if(!triggeredAlready) + { + gf.playAnim('cheer'); + triggeredAlready = true; + } + }else triggeredAlready = false; } - }else triggeredAlready = false; + } + } + case 'Cocoa': + { + if(curBeat < 170) + { + if(curBeat < 65 || curBeat > 130 && curBeat < 145) + { + if(curBeat % 16 == 15) + { + if(!triggeredAlready) + { + gf.playAnim('cheer'); + triggeredAlready = true; + } + }else triggeredAlready = false; + } + } + } + case 'Eggnog': + { + if(curBeat > 10 && curBeat != 111 && curBeat < 220) + { + if(curBeat % 8 == 7) + { + if(!triggeredAlready) + { + gf.playAnim('cheer'); + triggeredAlready = true; + } + }else triggeredAlready = false; + } } } } } - + if (camFollow.x != dad.getMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection) { camFollow.setPosition(dad.getMidpoint().x + 150, dad.getMidpoint().y - 100);