From 388c6215c758bc6070965f3afe2b1b1a840d77c4 Mon Sep 17 00:00:00 2001 From: Kade M Date: Sat, 10 Jul 2021 12:21:21 -0700 Subject: [PATCH] fix compile errors + some other shit --- source/DiffCalc.hx | 7 + source/DiffOverview.hx | 503 +++++++ source/FreeplayState.hx | 38 +- source/Note.hx | 76 +- source/PlayState.hx | 2959 +++++++++++++++++++++------------------ 5 files changed, 2196 insertions(+), 1387 deletions(-) create mode 100644 source/DiffOverview.hx diff --git a/source/DiffCalc.hx b/source/DiffCalc.hx index 8d075e0..6723e3d 100644 --- a/source/DiffCalc.hx +++ b/source/DiffCalc.hx @@ -18,6 +18,9 @@ class DiffCalc { public static var scale = 3 * 1.8; + public static var lastDiffHandOne:Array = []; + public static var lastDiffHandTwo:Array = []; + public static function CalculateDiff(song:SwagSong, ?accuracy:Float = .93) { trace('calcuilafjwaf'); @@ -266,6 +269,10 @@ class DiffCalc if (accuracy > .965) accuracy = .965; + lastDiffHandOne = hand_diffOne; + lastDiffHandTwo = hand_diffTwo; + + return HelperFunctions.truncateFloat(chisel(accuracy,hand_diffOne,hand_diffTwo,point_npsOne,point_npsTwo,maxPoints),2); } diff --git a/source/DiffOverview.hx b/source/DiffOverview.hx new file mode 100644 index 0000000..e91b34d --- /dev/null +++ b/source/DiffOverview.hx @@ -0,0 +1,503 @@ +package; + +import Conductor.BPMChangeEvent; +import flixel.FlxCamera; +import flixel.math.FlxRect; +import Song.SwagSong; +import Section.SwagSection; +import flixel.system.FlxSound; +import flixel.input.gamepad.FlxGamepad; +import flixel.util.FlxAxes; +import flixel.FlxSubState; +import Options.Option; +import flixel.input.FlxInput; +import flixel.input.keyboard.FlxKey; +import flixel.FlxG; +import flixel.FlxObject; +import flixel.FlxSprite; +import flixel.effects.FlxFlicker; +import flixel.graphics.frames.FlxAtlasFrames; +import flixel.group.FlxGroup.FlxTypedGroup; +import flixel.text.FlxText; +import flixel.util.FlxSort; +import flixel.tweens.FlxEase; +import flixel.tweens.FlxTween; +import flixel.util.FlxColor; +import io.newgrounds.NG; +import lime.app.Application; +import lime.utils.Assets; +import flixel.math.FlxMath; +import flixel.text.FlxText; +import flixel.input.FlxKeyManager; + +using StringTools; + +class DiffOverview extends FlxSubState +{ + var blackBox:FlxSprite; + + var handOne:Array; + var handTwo:Array; + + var giantText:FlxText; + + var SONG:SwagSong; + var strumLine:FlxSprite; + var camHUD:FlxCamera; + + var offset:FlxText; + + public static var playerStrums:FlxTypedGroup = null; + + override function create() + { + Conductor.songPosition = 0; + Conductor.lastSongPos = 0; + + camHUD = new FlxCamera(); + camHUD.bgColor.alpha = 0; + var camGame = new FlxCamera(); + + FlxG.cameras.add(camGame); + + FlxG.cameras.add(camHUD); + + FlxCamera.defaultCameras = [camGame]; + + playerStrums = new FlxTypedGroup(); + + SONG = FreeplayState.songData.get(FreeplayState.songs[FreeplayState.curSelected].songName)[FreeplayState.curDifficulty]; + + strumLine = new FlxSprite(0, (FlxG.height / 2) - 295).makeGraphic(FlxG.width, 10); + strumLine.scrollFactor.set(); + + blackBox = new FlxSprite(0, 0).makeGraphic(FlxG.width, FlxG.height, FlxColor.BLACK); + blackBox.alpha = 0; + add(blackBox); + + FreeplayState.openedPreview = true; + + handOne = DiffCalc.lastDiffHandOne; + handTwo = DiffCalc.lastDiffHandTwo; + for (i in 0...4) + { + // FlxG.log.add(i); + var babyArrow:FlxSprite = new FlxSprite(0, strumLine.y); + + babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets','shared'); + babyArrow.animation.addByPrefix('green', 'arrowUP'); + babyArrow.animation.addByPrefix('blue', 'arrowDOWN'); + babyArrow.animation.addByPrefix('purple', 'arrowLEFT'); + babyArrow.animation.addByPrefix('red', 'arrowRIGHT'); + babyArrow.antialiasing = true; + babyArrow.setGraphicSize(Std.int(babyArrow.width * 0.7)); + + switch (Math.abs(i)) + { + case 2: + babyArrow.x += Note.swagWidth * 2; + babyArrow.animation.addByPrefix('static', 'arrowUP'); + babyArrow.animation.addByPrefix('pressed', 'up press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'up confirm', 24, false); + case 3: + babyArrow.x += Note.swagWidth * 3; + babyArrow.animation.addByPrefix('static', 'arrowRIGHT'); + babyArrow.animation.addByPrefix('pressed', 'right press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'right confirm', 24, false); + case 1: + babyArrow.x += Note.swagWidth * 1; + babyArrow.animation.addByPrefix('static', 'arrowDOWN'); + babyArrow.animation.addByPrefix('pressed', 'down press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'down confirm', 24, false); + case 0: + babyArrow.x += Note.swagWidth * 0; + babyArrow.animation.addByPrefix('static', 'arrowLEFT'); + babyArrow.animation.addByPrefix('pressed', 'left press', 24, false); + babyArrow.animation.addByPrefix('confirm', 'left confirm', 24, false); + } + + babyArrow.updateHitbox(); + babyArrow.scrollFactor.set(); + + babyArrow.y -= 10; + babyArrow.alpha = 1; + + babyArrow.ID = i; + + playerStrums.add(babyArrow); + + babyArrow.animation.play('static'); + babyArrow.x += 50; + babyArrow.x += ((FlxG.width / 2)); + } + + add(playerStrums); + + generateSong("assItch"); + + playerStrums.cameras = [camHUD]; + notes.cameras = [camHUD]; + blackBox.cameras = [camHUD]; + + blackBox.x = playerStrums.members[0].x; + blackBox.y = strumLine.y; + + camHUD.zoom = 0.6; + camHUD.alpha = 0; + camHUD.height = 5000; + blackBox.height = camHUD.height; + + camHUD.x += 280; + + blackBox.y -= 100; + blackBox.x -= 100; + + offset = new FlxText(10,FlxG.height - 40,0,"Offset: " + HelperFunctions.truncateFloat(FlxG.save.data.offset,0) + " (LEFT/RIGHT to decrease/increase)",16); + offset.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1); + offset.color = FlxColor.WHITE; + offset.scrollFactor.set(); + //add(offset); + + FlxTween.tween(blackBox, {alpha: 0.5}, 1, {ease: FlxEase.expoInOut}); + FlxTween.tween(camHUD, {alpha: 1}, 0.5, {ease: FlxEase.expoInOut}); + FlxTween.tween(offset, {alpha: 1}, 0.5, {ease: FlxEase.expoInOut}); + + trace('pog'); + + super.create(); + } + + function endSong() + { + if (stopDoingShit) + return; + } + + function resyncVocals():Void + { + vocals.pause(); + + FlxG.sound.music.play(); + Conductor.songPosition = FlxG.sound.music.time; + vocals.time = Conductor.songPosition; + vocals.play(); + } + + public var stopDoingShit = false; + + public var currentStep = 0; + public var oldStep = 0; + + private function updateCurStep():Void + { + var lastChange:BPMChangeEvent = { + stepTime: 0, + songTime: 0, + bpm: 0 + } + for (i in 0...Conductor.bpmChangeMap.length) + { + if (Conductor.songPosition >= Conductor.bpmChangeMap[i].songTime) + lastChange = Conductor.bpmChangeMap[i]; + } + + currentStep = lastChange.stepTime + Math.floor((Conductor.songPosition - lastChange.songTime) / Conductor.stepCrochet); + } + + function stepHit() + { + if (FlxG.sound.music.time > Conductor.songPosition + 20 || FlxG.sound.music.time < Conductor.songPosition - 20) + { + trace("resync"); + resyncVocals(); + } + oldStep = currentStep; + } + + function offsetChange() + { + for (i in unspawnNotes) + i.strumTime = i.baseStrum + FlxG.save.data.offset; + for (i in notes) + i.strumTime = i.baseStrum + FlxG.save.data.offset; + } + + var frames = 0; + + override function update(elapsed:Float) + { + super.update(elapsed); + + + // input + + if (frames < 10) + { + frames++; + return; + } + + if (stopDoingShit) + return; + + updateCurStep(); + + if (oldStep != currentStep && currentStep > 0) + stepHit(); + + if (FlxG.keys.pressed.SPACE) + { + stopDoingShit = true; + quit(); + } + + var gamepad:FlxGamepad = FlxG.gamepads.lastActive; + + if (gamepad != null) + if (gamepad.justPressed.X) + { + stopDoingShit = true; + quit(); + } + + /*if (FlxG.keys.pressed.RIGHT) + { + if (FlxG.keys.pressed.SHIFT) + { + FlxG.save.data.offset++; + offsetChange(); + } + } + if (FlxG.keys.pressed.LEFT) + { + if (FlxG.keys.pressed.SHIFT) + { + FlxG.save.data.offset--; + offsetChange(); + } + } + + if (FlxG.keys.justPressed.RIGHT) + { + FlxG.save.data.offset++; + offsetChange(); + } + if (FlxG.keys.justPressed.LEFT) + { + FlxG.save.data.offset--; + offsetChange(); + } + + + offset.text = "Offset: " + HelperFunctions.truncateFloat(FlxG.save.data.offset,0) + " (LEFT/RIGHT to decrease/increase, SHIFT to go faster) - Time: " + HelperFunctions.truncateFloat(Conductor.songPosition / 1000,0) + "s - Step: " + currentStep; + */ + + if (vocals != null) + if (vocals.playing) + Conductor.songPosition += FlxG.elapsed * 1000; + + if (unspawnNotes[0] != null) + { + if (unspawnNotes[0].strumTime - Conductor.songPosition < 3500) + { + var dunceNote:Note = unspawnNotes[0]; + notes.add(dunceNote); + + var index:Int = unspawnNotes.indexOf(dunceNote); + unspawnNotes.splice(index, 1); + } + } + + + + notes.forEachAlive(function(daNote:Note) + { + // instead of doing stupid y > FlxG.height + // we be men and actually calculate the time :) + if (daNote.tooLate) + { + daNote.active = false; + daNote.visible = false; + } + else + { + daNote.visible = true; + daNote.active = true; + } + + daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y + - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(SONG.speed, + 2)); + + if (daNote.isSustainNote) + { + daNote.y -= daNote.height / 2; + + if ((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) + && daNote.y + daNote.offset.y * daNote.scale.y <= (strumLine.y + Note.swagWidth / 2)) + { + // Clip to strumline + var swagRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y); + swagRect.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y; + swagRect.height -= swagRect.y; + + daNote.clipRect = swagRect; + } + } + + daNote.visible = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].visible; + daNote.x = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].x; + if (!daNote.isSustainNote) + daNote.angle = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].angle; + daNote.alpha = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].alpha; + + // auto hit + + if(daNote.y < strumLine.y) + { + // Force good note hit regardless if it's too late to hit it or not as a fail safe + if(daNote.canBeHit && daNote.mustPress || daNote.tooLate && daNote.mustPress) + { + + daNote.wasGoodHit = true; + vocals.volume = 1; + + daNote.kill(); + notes.remove(daNote, true); + daNote.destroy(); + } + } + }); + + } + + function quit() + { + FlxTween.tween(blackBox, {alpha: 0}, 1, {ease: FlxEase.expoInOut}); + FlxTween.tween(camHUD, {alpha: 0}, 1, {ease: FlxEase.expoInOut}); + FlxTween.tween(offset, {alpha: 0}, 1, {ease: FlxEase.expoInOut}); + + vocals.fadeOut(); + + FreeplayState.openedPreview = false; + } + + var vocals:FlxSound; + + var notes:FlxTypedGroup; + var unspawnNotes:Array = []; + + public function generateSong(dataPath:String):Void + { + // FlxG.log.add(ChartParser.parse()); + + var songData = FreeplayState.songData.get(FreeplayState.songs[FreeplayState.curSelected].songName)[FreeplayState.curDifficulty]; + Conductor.changeBPM(songData.bpm); + + if (SONG.needsVoices) + vocals = new FlxSound().loadEmbedded(Paths.voices(SONG.song)); + else + vocals = new FlxSound(); + + trace('loaded vocals'); + + FlxG.sound.list.add(vocals); + + notes = new FlxTypedGroup(); + add(notes); + + var noteData:Array; + + // NEW SHIT + noteData = songData.notes; + + var playerCounter:Int = 0; + + var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped + for (section in noteData) + { + var coolSection:Int = Std.int(section.lengthInSteps / 4); + + for (songNotes in section.sectionNotes) + { + var daStrumTime:Float = songNotes[0] + FlxG.save.data.offset; + if (daStrumTime < 0) + daStrumTime = 0; + var daNoteData:Int = Std.int(songNotes[1] % 4); + + var gottaHitNote:Bool = section.mustHitSection; + + if (songNotes[1] > 3) + { + gottaHitNote = !section.mustHitSection; + } + + var oldNote:Note; + if (unspawnNotes.length > 0) + oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)]; + else + oldNote = null; + + var swagNote:Note = new Note(daStrumTime, daNoteData, oldNote,false, true); + + + if (!gottaHitNote) + continue; + + swagNote.baseStrum = Math.round(songNotes[0]); + + swagNote.sustainLength = songNotes[2]; + swagNote.scrollFactor.set(0, 0); + + var susLength:Float = swagNote.sustainLength; + + susLength = susLength / Conductor.stepCrochet; + unspawnNotes.push(swagNote); + + for (susNote in 0...Math.floor(susLength)) + { + oldNote = unspawnNotes[Std.int(unspawnNotes.length - 1)]; + + var sustainNote:Note = new Note(daStrumTime + (Conductor.stepCrochet * susNote) + Conductor.stepCrochet, daNoteData, oldNote, true, true); + sustainNote.scrollFactor.set(); + unspawnNotes.push(sustainNote); + + sustainNote.mustPress = gottaHitNote; + + if (sustainNote.mustPress) + { + sustainNote.x += FlxG.width / 2; // general offset + } + } + + swagNote.mustPress = gottaHitNote; + + if (swagNote.mustPress) + { + swagNote.x += FlxG.width / 2; // general offset + } + else + { + } + } + daBeats += 1; + } + + // trace(unspawnNotes.length); + // playerCounter += 1; + + unspawnNotes.sort(sortByShit); + + Conductor.mapBPMChanges(SONG); + Conductor.changeBPM(SONG.bpm); + + FlxG.sound.playMusic(Paths.inst(SONG.song), 1, false); + FlxG.sound.music.onComplete = endSong; + vocals.play(); + } + + function sortByShit(Obj1:Note, Obj2:Note):Int + { + return FlxSort.byValues(FlxSort.ASCENDING, Obj1.strumTime, Obj2.strumTime); + } +} diff --git a/source/FreeplayState.hx b/source/FreeplayState.hx index 36ac10b..123e240 100644 --- a/source/FreeplayState.hx +++ b/source/FreeplayState.hx @@ -21,16 +21,17 @@ using StringTools; class FreeplayState extends MusicBeatState { - var songs:Array = []; + public static var songs:Array = []; var selector:FlxText; - var curSelected:Int = 0; - var curDifficulty:Int = 1; + public static var curSelected:Int = 0; + public static var curDifficulty:Int = 1; var scoreText:FlxText; var comboText:FlxText; var diffText:FlxText; var diffCalcText:FlxText; + var previewtext:FlxText; var lerpScore:Int = 0; var intendedScore:Int = 0; var combo:String = ''; @@ -40,6 +41,8 @@ class FreeplayState extends MusicBeatState private var iconArray:Array = []; + public static var openedPreview = false; + public static var songData:Map> = []; public static function loadDiff(diff:Int, format:String, name:String, array:Array) @@ -101,6 +104,8 @@ class FreeplayState extends MusicBeatState isDebug = true; #end + persistentUpdate = true; + // LOAD MUSIC // LOAD CHARACTERS @@ -147,6 +152,10 @@ class FreeplayState extends MusicBeatState diffCalcText.font = scoreText.font; add(diffCalcText); + previewtext = new FlxText(scoreText.x, scoreText.y + 94, 0, "" + (KeyBinds.gamepad ? "X" : "SPACE") + " to preview", 24); + previewtext.font = scoreText.font; + //add(previewtext); + comboText = new FlxText(diffText.x + 100, diffText.y, 0, "", 24); comboText.font = diffText.font; add(comboText); @@ -205,7 +214,7 @@ class FreeplayState extends MusicBeatState num++; } } - + override function update(elapsed:Float) { super.update(elapsed); @@ -223,14 +232,20 @@ class FreeplayState extends MusicBeatState scoreText.text = "PERSONAL BEST:" + lerpScore; comboText.text = combo + '\n'; + if (FlxG.sound.music.volume > 0.8) + { + FlxG.sound.music.volume -= 0.5 * FlxG.elapsed; + } + var upP = FlxG.keys.justPressed.UP; var downP = FlxG.keys.justPressed.DOWN; - var accepted = controls.ACCEPT; + var accepted = FlxG.keys.justPressed.ENTER; var gamepad:FlxGamepad = FlxG.gamepads.lastActive; if (gamepad != null) { + if (gamepad.justPressed.DPAD_UP) { changeSelection(-1); @@ -247,6 +262,9 @@ class FreeplayState extends MusicBeatState { changeDiff(1); } + + //if (gamepad.justPressed.X && !openedPreview) + //openSubState(new DiffOverview()); } if (upP) @@ -258,6 +276,9 @@ class FreeplayState extends MusicBeatState changeSelection(1); } + //if (FlxG.keys.justPressed.SPACE && !openedPreview) + //openSubState(new DiffOverview()); + if (FlxG.keys.justPressed.LEFT) changeDiff(-1); if (FlxG.keys.justPressed.RIGHT) @@ -331,6 +352,7 @@ class FreeplayState extends MusicBeatState // NGio.logEvent('Fresh'); FlxG.sound.play(Paths.sound('scrollMenu'), 0.4); + curSelected += change; if (curSelected < 0) @@ -370,6 +392,12 @@ class FreeplayState extends MusicBeatState catch(ex) {} + if (openedPreview) + { + closeSubState(); + openSubState(new DiffOverview()); + } + var bullShit:Int = 0; for (i in 0...iconArray.length) diff --git a/source/Note.hx b/source/Note.hx index ae26fb3..edb112f 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -16,7 +16,7 @@ using StringTools; class Note extends FlxSprite { public var strumTime:Float = 0; - + public var baseStrum:Float = 0; public var mustPress:Bool = false; public var noteData:Int = 0; public var rawNoteData:Int = 0; @@ -58,6 +58,7 @@ class Note extends FlxSprite else this.strumTime = Math.round(strumTime); + if (this.strumTime < 0 ) this.strumTime = 0; @@ -68,39 +69,53 @@ class Note extends FlxSprite //defaults if no noteStyle was found in chart var noteTypeCheck:String = 'normal'; - if (PlayState.SONG.noteStyle == null) { - switch(PlayState.storyWeek) {case 6: noteTypeCheck = 'pixel';} - } else {noteTypeCheck = PlayState.SONG.noteStyle;} - - switch (noteTypeCheck) + if (!inCharter) { - case 'pixel': - loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels', 'week6'), true, 17, 17); - if (isSustainNote) - loadGraphic(Paths.image('weeb/pixelUI/arrowEnds', 'week6'), true, 7, 6); + frames = Paths.getSparrowAtlas('NOTE_assets'); - for (i in 0...4) - { - animation.add(dataColor[i] + 'Scroll', [i + 4]); // Normal notes - animation.add(dataColor[i] + 'hold', [i]); // Holds - animation.add(dataColor[i] + 'holdend', [i + 4]); // Tails - } + for (i in 0...4) + { + animation.addByPrefix(dataColor[i] + 'Scroll', dataColor[i] + ' alone'); // Normal notes + animation.addByPrefix(dataColor[i] + 'hold', dataColor[i] + ' hold'); // Hold + animation.addByPrefix(dataColor[i] + 'holdend', dataColor[i] + ' tail'); // Tails + } - setGraphicSize(Std.int(width * PlayState.daPixelZoom)); - updateHitbox(); - default: - frames = Paths.getSparrowAtlas('NOTE_assets'); + setGraphicSize(Std.int(width * 0.7)); + updateHitbox(); + antialiasing = true; + } + else + { + switch (noteTypeCheck) + { + case 'pixel': + loadGraphic(Paths.image('weeb/pixelUI/arrows-pixels', 'week6'), true, 17, 17); + if (isSustainNote) + loadGraphic(Paths.image('weeb/pixelUI/arrowEnds', 'week6'), true, 7, 6); - for (i in 0...4) - { - animation.addByPrefix(dataColor[i] + 'Scroll', dataColor[i] + ' alone'); // Normal notes - animation.addByPrefix(dataColor[i] + 'hold', dataColor[i] + ' hold'); // Hold - animation.addByPrefix(dataColor[i] + 'holdend', dataColor[i] + ' tail'); // Tails - } + for (i in 0...4) + { + animation.add(dataColor[i] + 'Scroll', [i + 4]); // Normal notes + animation.add(dataColor[i] + 'hold', [i]); // Holds + animation.add(dataColor[i] + 'holdend', [i + 4]); // Tails + } - setGraphicSize(Std.int(width * 0.7)); - updateHitbox(); - antialiasing = true; + setGraphicSize(Std.int(width * PlayState.daPixelZoom)); + updateHitbox(); + default: + frames = Paths.getSparrowAtlas('NOTE_assets'); + + for (i in 0...4) + { + animation.addByPrefix(dataColor[i] + 'Scroll', dataColor[i] + ' alone'); // Normal notes + animation.addByPrefix(dataColor[i] + 'hold', dataColor[i] + ' hold'); // Hold + animation.addByPrefix(dataColor[i] + 'holdend', dataColor[i] + ' tail'); // Tails + } + + setGraphicSize(Std.int(width * 0.7)); + updateHitbox(); + antialiasing = true; + } } x += swagWidth * noteData; @@ -131,6 +146,9 @@ class Note extends FlxSprite if (noteTypeCheck == 'pixel') x += 30; + if (inCharter) + x += 30; + if (prevNote.isSustainNote) { prevNote.animation.play(dataColor[prevNote.noteData] + 'hold'); diff --git a/source/PlayState.hx b/source/PlayState.hx index 3a04625..27ed8ea 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -20,7 +20,6 @@ import flixel.graphics.FlxGraphic; import openfl.utils.AssetManifest; import openfl.utils.AssetLibrary; import flixel.system.FlxAssets; - import lime.app.Application; import lime.media.AudioContext; import lime.media.AudioManager; @@ -63,7 +62,6 @@ import lime.utils.Assets; import openfl.display.BlendMode; import openfl.display.StageQuality; import openfl.filters.ShaderFilter; - #if windows import Discord.DiscordClient; #end @@ -103,7 +101,7 @@ class PlayState extends MusicBeatState var songLength:Float = 0; var kadeEngineWatermark:FlxText; - + #if windows // Discord RPC variables var storyDifficultyText:String = ""; @@ -121,9 +119,11 @@ class PlayState extends MusicBeatState public static var boyfriend:Boyfriend; public var notes:FlxTypedGroup; + private var unspawnNotes:Array = []; public var strumLine:FlxSprite; + private var curSection:Int = 0; private var camFollow:FlxObject; @@ -138,28 +138,33 @@ class PlayState extends MusicBeatState private var curSong:String = ""; private var gfSpeed:Int = 1; - public var health:Float = 1; //making public because sethealth doesnt work without it + + public var health:Float = 1; // making public because sethealth doesnt work without it + private var combo:Int = 0; + public static var misses:Int = 0; public static var campaignMisses:Int = 0; + public var accuracy:Float = 0.00; + private var accuracyDefault:Float = 0.00; private var totalNotesHit:Float = 0; private var totalNotesHitDefault:Float = 0; private var totalPlayed:Int = 0; private var ss:Bool = false; - private var healthBarBG:FlxSprite; private var healthBar:FlxBar; private var songPositionBar:Float = 0; - + private var generatedMusic:Bool = false; private var startingSong:Bool = false; - public var iconP1:HealthIcon; //making these public again because i may be stupid - public var iconP2:HealthIcon; //what could go wrong? + public var iconP1:HealthIcon; // making these public again because i may be stupid + public var iconP2:HealthIcon; // what could go wrong? public var camHUD:FlxCamera; + private var camGame:FlxCamera; public static var offsetTesting:Bool = false; @@ -190,7 +195,9 @@ class PlayState extends MusicBeatState var wiggleShit:WiggleEffect = new WiggleEffect(); var talking:Bool = true; + public var songScore:Int = 0; + var songScoreDef:Int = 0; var scoreTxt:FlxText; var replayTxt:FlxText; @@ -202,21 +209,25 @@ class PlayState extends MusicBeatState public static var daPixelZoom:Float = 6; public static var theFunne:Bool = true; + var funneEffect:FlxSprite; var inCutscene:Bool = false; + public static var repPresses:Int = 0; public static var repReleases:Int = 0; public static var timeCurrently:Float = 0; public static var timeCurrentlyR:Float = 0; - + // 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 private var allowedToHeadbang:Bool = false; + // Per song additive offset public static var songOffset:Float = 0; + // BotPlay text private var botPlayState:FlxText; // Replay shit @@ -232,18 +243,24 @@ class PlayState extends MusicBeatState private var dataSuffix:Array = ['LEFT', 'DOWN', 'UP', 'RIGHT']; // API stuff - - public function addObject(object:FlxBasic) { add(object); } - public function removeObject(object:FlxBasic) { remove(object); } + public function addObject(object:FlxBasic) + { + add(object); + } + + public function removeObject(object:FlxBasic) + { + remove(object); + } override public function create() { instance = this; - + if (FlxG.save.data.fpsCap > 290) - (cast (Lib.current.getChildAt(0), Main)).setFPSCap(800); - + (cast(Lib.current.getChildAt(0), Main)).setFPSCap(800); + if (FlxG.sound.music != null) FlxG.sound.music.stop(); @@ -256,12 +273,10 @@ class PlayState extends MusicBeatState } misses = 0; - highestCombo = 0; repPresses = 0; repReleases = 0; - PlayStateChangeables.useDownscroll = FlxG.save.data.downscroll; PlayStateChangeables.safeFrames = FlxG.save.data.frames; PlayStateChangeables.scrollSpeed = FlxG.save.data.scrollSpeed; @@ -270,15 +285,18 @@ class PlayState extends MusicBeatState // pre lowercasing the song name (create) var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); - switch (songLowercase) { - case 'dad-battle': songLowercase = 'dadbattle'; - case 'philly-nice': songLowercase = 'philly'; + switch (songLowercase) + { + case 'dad-battle': + songLowercase = 'dadbattle'; + case 'philly-nice': + songLowercase = 'philly'; } - + removedVideo = false; #if windows - executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart")); + executeModchart = FileSystem.exists(Paths.lua(songLowercase + "/modchart")); if (executeModchart) PlayStateChangeables.Optimize = false; #end @@ -319,10 +337,21 @@ class PlayState extends MusicBeatState detailsPausedText = "Paused - " + detailsText; // Updating Discord Rich Presence. - DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + Ratings.GenerateLetterRank(accuracy), "\nAcc: " + HelperFunctions.truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); + DiscordClient.changePresence(detailsText + + " " + + SONG.song + + " (" + + storyDifficultyText + + ") " + + Ratings.GenerateLetterRank(accuracy), + "\nAcc: " + + HelperFunctions.truncateFloat(accuracy, 2) + + "% | Score: " + + songScore + + " | Misses: " + + misses, iconRPC); #end - // var gameCam:FlxCamera = FlxG.camera; camGame = new FlxCamera(); camHUD = new FlxCamera(); @@ -342,9 +371,10 @@ class PlayState extends MusicBeatState Conductor.mapBPMChanges(SONG); Conductor.changeBPM(SONG.bpm); - trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + PlayStateChangeables.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: ' + Conductor.timeScale + '\nBotPlay : ' + PlayStateChangeables.botPlay); - - //dialogue shit + trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + PlayStateChangeables.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset + '\nTS: ' + + Conductor.timeScale + '\nBotPlay : ' + PlayStateChangeables.botPlay); + + // dialogue shit switch (songLowercase) { case 'tutorial': @@ -372,64 +402,88 @@ class PlayState extends MusicBeatState dialogue = CoolUtil.coolTextFile(Paths.txt('data/thorns/thornsDialogue')); } - //defaults if no stage was found in chart + // defaults if no stage was found in chart var stageCheck:String = 'stage'; - - if (SONG.stage == null) { - switch(storyWeek) + + if (SONG.stage == null) + { + switch (storyWeek) { - case 2: stageCheck = 'halloween'; - case 3: stageCheck = 'philly'; - case 4: stageCheck = 'limo'; - case 5: if (songLowercase == 'winter-horrorland') {stageCheck = 'mallEvil';} else {stageCheck = 'mall';} - case 6: if (songLowercase == 'thorns') {stageCheck = 'schoolEvil';} else {stageCheck = 'school';} - //i should check if its stage (but this is when none is found in chart anyway) + case 2: + stageCheck = 'halloween'; + case 3: + stageCheck = 'philly'; + case 4: + stageCheck = 'limo'; + case 5: + if (songLowercase == 'winter-horrorland') + { + stageCheck = 'mallEvil'; + } + else + { + stageCheck = 'mall'; + } + case 6: + if (songLowercase == 'thorns') + { + stageCheck = 'schoolEvil'; + } + else + { + stageCheck = 'school'; + } + // i should check if its stage (but this is when none is found in chart anyway) } - } else {stageCheck = SONG.stage;} + } + else + { + stageCheck = SONG.stage; + } if (!PlayStateChangeables.Optimize) { - - switch(stageCheck) - { - case 'halloween': + switch (stageCheck) { - curStage = 'spooky'; - halloweenLevel = true; - - var hallowTex = Paths.getSparrowAtlas('halloween_bg','week2'); - - halloweenBG = new FlxSprite(-200, -100); - halloweenBG.frames = hallowTex; - halloweenBG.animation.addByPrefix('idle', 'halloweem bg0'); - halloweenBG.animation.addByPrefix('lightning', 'halloweem bg lightning strike', 24, false); - halloweenBG.animation.play('idle'); - halloweenBG.antialiasing = true; - add(halloweenBG); - - isHalloween = true; - } - case 'philly': + case 'halloween': { - curStage = 'philly'; + curStage = 'spooky'; + halloweenLevel = true; - var bg:FlxSprite = new FlxSprite(-100).loadGraphic(Paths.image('philly/sky', 'week3')); - bg.scrollFactor.set(0.1, 0.1); - add(bg); + var hallowTex = Paths.getSparrowAtlas('halloween_bg', 'week2'); - var city:FlxSprite = new FlxSprite(-10).loadGraphic(Paths.image('philly/city', 'week3')); - city.scrollFactor.set(0.3, 0.3); - city.setGraphicSize(Std.int(city.width * 0.85)); - city.updateHitbox(); - add(city); + halloweenBG = new FlxSprite(-200, -100); + halloweenBG.frames = hallowTex; + halloweenBG.animation.addByPrefix('idle', 'halloweem bg0'); + halloweenBG.animation.addByPrefix('lightning', 'halloweem bg lightning strike', 24, false); + halloweenBG.animation.play('idle'); + halloweenBG.antialiasing = true; + add(halloweenBG); - phillyCityLights = new FlxTypedGroup(); - if(FlxG.save.data.distractions){ - add(phillyCityLights); + isHalloween = true; } - - for (i in 0...5) + case 'philly': { + curStage = 'philly'; + + var bg:FlxSprite = new FlxSprite(-100).loadGraphic(Paths.image('philly/sky', 'week3')); + bg.scrollFactor.set(0.1, 0.1); + add(bg); + + var city:FlxSprite = new FlxSprite(-10).loadGraphic(Paths.image('philly/city', 'week3')); + city.scrollFactor.set(0.3, 0.3); + city.setGraphicSize(Std.int(city.width * 0.85)); + city.updateHitbox(); + add(city); + + phillyCityLights = new FlxTypedGroup(); + if (FlxG.save.data.distractions) + { + add(phillyCityLights); + } + + for (i in 0...5) + { var light:FlxSprite = new FlxSprite(city.x).loadGraphic(Paths.image('philly/win' + i, 'week3')); light.scrollFactor.set(0.3, 0.3); light.visible = false; @@ -437,246 +491,251 @@ class PlayState extends MusicBeatState light.updateHitbox(); light.antialiasing = true; phillyCityLights.add(light); - } + } - var streetBehind:FlxSprite = new FlxSprite(-40, 50).loadGraphic(Paths.image('philly/behindTrain','week3')); - add(streetBehind); + var streetBehind:FlxSprite = new FlxSprite(-40, 50).loadGraphic(Paths.image('philly/behindTrain', 'week3')); + add(streetBehind); - phillyTrain = new FlxSprite(2000, 360).loadGraphic(Paths.image('philly/train','week3')); - if(FlxG.save.data.distractions){ - add(phillyTrain); - } - - trainSound = new FlxSound().loadEmbedded(Paths.sound('train_passes','week3')); - FlxG.sound.list.add(trainSound); - - // var cityLights:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.win0.png); - - var street:FlxSprite = new FlxSprite(-40, streetBehind.y).loadGraphic(Paths.image('philly/street','week3')); - add(street); - } - case 'limo': - { - curStage = 'limo'; - defaultCamZoom = 0.90; - - var skyBG:FlxSprite = new FlxSprite(-120, -50).loadGraphic(Paths.image('limo/limoSunset','week4')); - skyBG.scrollFactor.set(0.1, 0.1); - add(skyBG); - - var bgLimo:FlxSprite = new FlxSprite(-200, 480); - bgLimo.frames = Paths.getSparrowAtlas('limo/bgLimo','week4'); - bgLimo.animation.addByPrefix('drive', "background limo pink", 24); - bgLimo.animation.play('drive'); - bgLimo.scrollFactor.set(0.4, 0.4); - add(bgLimo); - if(FlxG.save.data.distractions){ - grpLimoDancers = new FlxTypedGroup(); - add(grpLimoDancers); - - for (i in 0...5) + phillyTrain = new FlxSprite(2000, 360).loadGraphic(Paths.image('philly/train', 'week3')); + if (FlxG.save.data.distractions) { + add(phillyTrain); + } + + trainSound = new FlxSound().loadEmbedded(Paths.sound('train_passes', 'week3')); + FlxG.sound.list.add(trainSound); + + // var cityLights:FlxSprite = new FlxSprite().loadGraphic(AssetPaths.win0.png); + + var street:FlxSprite = new FlxSprite(-40, streetBehind.y).loadGraphic(Paths.image('philly/street', 'week3')); + add(street); + } + case 'limo': + { + curStage = 'limo'; + defaultCamZoom = 0.90; + + var skyBG:FlxSprite = new FlxSprite(-120, -50).loadGraphic(Paths.image('limo/limoSunset', 'week4')); + skyBG.scrollFactor.set(0.1, 0.1); + add(skyBG); + + var bgLimo:FlxSprite = new FlxSprite(-200, 480); + bgLimo.frames = Paths.getSparrowAtlas('limo/bgLimo', 'week4'); + bgLimo.animation.addByPrefix('drive', "background limo pink", 24); + bgLimo.animation.play('drive'); + bgLimo.scrollFactor.set(0.4, 0.4); + add(bgLimo); + if (FlxG.save.data.distractions) + { + grpLimoDancers = new FlxTypedGroup(); + add(grpLimoDancers); + + for (i in 0...5) + { var dancer:BackgroundDancer = new BackgroundDancer((370 * i) + 130, bgLimo.y - 400); dancer.scrollFactor.set(0.4, 0.4); grpLimoDancers.add(dancer); + } + } + + var overlayShit:FlxSprite = new FlxSprite(-500, -600).loadGraphic(Paths.image('limo/limoOverlay', 'week4')); + overlayShit.alpha = 0.5; + // add(overlayShit); + + // var shaderBullshit = new BlendModeEffect(new OverlayShader(), FlxColor.RED); + + // FlxG.camera.setFilters([new ShaderFilter(cast shaderBullshit.shader)]); + + // overlayShit.shader = shaderBullshit; + + var limoTex = Paths.getSparrowAtlas('limo/limoDrive', 'week4'); + + limo = new FlxSprite(-120, 550); + limo.frames = limoTex; + limo.animation.addByPrefix('drive', "Limo stage", 24); + limo.animation.play('drive'); + limo.antialiasing = true; + + fastCar = new FlxSprite(-300, 160).loadGraphic(Paths.image('limo/fastCarLol', 'week4')); + // add(limo); + } + case 'mall': + { + curStage = 'mall'; + + defaultCamZoom = 0.80; + + var bg:FlxSprite = new FlxSprite(-1000, -500).loadGraphic(Paths.image('christmas/bgWalls', 'week5')); + bg.antialiasing = true; + bg.scrollFactor.set(0.2, 0.2); + bg.active = false; + bg.setGraphicSize(Std.int(bg.width * 0.8)); + bg.updateHitbox(); + add(bg); + + upperBoppers = new FlxSprite(-240, -90); + upperBoppers.frames = Paths.getSparrowAtlas('christmas/upperBop', 'week5'); + upperBoppers.animation.addByPrefix('bop', "Upper Crowd Bob", 24, false); + upperBoppers.antialiasing = true; + upperBoppers.scrollFactor.set(0.33, 0.33); + upperBoppers.setGraphicSize(Std.int(upperBoppers.width * 0.85)); + upperBoppers.updateHitbox(); + if (FlxG.save.data.distractions) + { + add(upperBoppers); + } + + var bgEscalator:FlxSprite = new FlxSprite(-1100, -600).loadGraphic(Paths.image('christmas/bgEscalator', 'week5')); + bgEscalator.antialiasing = true; + bgEscalator.scrollFactor.set(0.3, 0.3); + bgEscalator.active = false; + bgEscalator.setGraphicSize(Std.int(bgEscalator.width * 0.9)); + bgEscalator.updateHitbox(); + add(bgEscalator); + + var tree:FlxSprite = new FlxSprite(370, -250).loadGraphic(Paths.image('christmas/christmasTree', 'week5')); + tree.antialiasing = true; + tree.scrollFactor.set(0.40, 0.40); + add(tree); + + bottomBoppers = new FlxSprite(-300, 140); + bottomBoppers.frames = Paths.getSparrowAtlas('christmas/bottomBop', 'week5'); + bottomBoppers.animation.addByPrefix('bop', 'Bottom Level Boppers', 24, false); + bottomBoppers.antialiasing = true; + bottomBoppers.scrollFactor.set(0.9, 0.9); + bottomBoppers.setGraphicSize(Std.int(bottomBoppers.width * 1)); + bottomBoppers.updateHitbox(); + if (FlxG.save.data.distractions) + { + add(bottomBoppers); + } + + var fgSnow:FlxSprite = new FlxSprite(-600, 700).loadGraphic(Paths.image('christmas/fgSnow', 'week5')); + fgSnow.active = false; + fgSnow.antialiasing = true; + add(fgSnow); + + santa = new FlxSprite(-840, 150); + santa.frames = Paths.getSparrowAtlas('christmas/santa', 'week5'); + santa.animation.addByPrefix('idle', 'santa idle in fear', 24, false); + santa.antialiasing = true; + if (FlxG.save.data.distractions) + { + add(santa); } } + case 'mallEvil': + { + curStage = 'mallEvil'; + var bg:FlxSprite = new FlxSprite(-400, -500).loadGraphic(Paths.image('christmas/evilBG', 'week5')); + bg.antialiasing = true; + bg.scrollFactor.set(0.2, 0.2); + bg.active = false; + bg.setGraphicSize(Std.int(bg.width * 0.8)); + bg.updateHitbox(); + add(bg); - var overlayShit:FlxSprite = new FlxSprite(-500, -600).loadGraphic(Paths.image('limo/limoOverlay','week4')); - overlayShit.alpha = 0.5; - // add(overlayShit); + var evilTree:FlxSprite = new FlxSprite(300, -300).loadGraphic(Paths.image('christmas/evilTree', 'week5')); + evilTree.antialiasing = true; + evilTree.scrollFactor.set(0.2, 0.2); + add(evilTree); - // var shaderBullshit = new BlendModeEffect(new OverlayShader(), FlxColor.RED); - - // FlxG.camera.setFilters([new ShaderFilter(cast shaderBullshit.shader)]); - - // overlayShit.shader = shaderBullshit; - - var limoTex = Paths.getSparrowAtlas('limo/limoDrive','week4'); - - limo = new FlxSprite(-120, 550); - limo.frames = limoTex; - limo.animation.addByPrefix('drive', "Limo stage", 24); - limo.animation.play('drive'); - limo.antialiasing = true; - - fastCar = new FlxSprite(-300, 160).loadGraphic(Paths.image('limo/fastCarLol','week4')); - // add(limo); - } - case 'mall': - { - curStage = 'mall'; - - defaultCamZoom = 0.80; - - var bg:FlxSprite = new FlxSprite(-1000, -500).loadGraphic(Paths.image('christmas/bgWalls','week5')); - bg.antialiasing = true; - bg.scrollFactor.set(0.2, 0.2); - bg.active = false; - bg.setGraphicSize(Std.int(bg.width * 0.8)); - bg.updateHitbox(); - add(bg); - - upperBoppers = new FlxSprite(-240, -90); - upperBoppers.frames = Paths.getSparrowAtlas('christmas/upperBop','week5'); - upperBoppers.animation.addByPrefix('bop', "Upper Crowd Bob", 24, false); - upperBoppers.antialiasing = true; - upperBoppers.scrollFactor.set(0.33, 0.33); - upperBoppers.setGraphicSize(Std.int(upperBoppers.width * 0.85)); - upperBoppers.updateHitbox(); - if(FlxG.save.data.distractions){ - add(upperBoppers); - } - - - var bgEscalator:FlxSprite = new FlxSprite(-1100, -600).loadGraphic(Paths.image('christmas/bgEscalator','week5')); - bgEscalator.antialiasing = true; - bgEscalator.scrollFactor.set(0.3, 0.3); - bgEscalator.active = false; - bgEscalator.setGraphicSize(Std.int(bgEscalator.width * 0.9)); - bgEscalator.updateHitbox(); - add(bgEscalator); - - var tree:FlxSprite = new FlxSprite(370, -250).loadGraphic(Paths.image('christmas/christmasTree','week5')); - tree.antialiasing = true; - tree.scrollFactor.set(0.40, 0.40); - add(tree); - - bottomBoppers = new FlxSprite(-300, 140); - bottomBoppers.frames = Paths.getSparrowAtlas('christmas/bottomBop','week5'); - bottomBoppers.animation.addByPrefix('bop', 'Bottom Level Boppers', 24, false); - bottomBoppers.antialiasing = true; - bottomBoppers.scrollFactor.set(0.9, 0.9); - bottomBoppers.setGraphicSize(Std.int(bottomBoppers.width * 1)); - bottomBoppers.updateHitbox(); - if(FlxG.save.data.distractions){ - add(bottomBoppers); - } - - - var fgSnow:FlxSprite = new FlxSprite(-600, 700).loadGraphic(Paths.image('christmas/fgSnow','week5')); - fgSnow.active = false; - fgSnow.antialiasing = true; - add(fgSnow); - - santa = new FlxSprite(-840, 150); - santa.frames = Paths.getSparrowAtlas('christmas/santa','week5'); - santa.animation.addByPrefix('idle', 'santa idle in fear', 24, false); - santa.antialiasing = true; - if(FlxG.save.data.distractions){ - add(santa); - } - } - case 'mallEvil': - { - curStage = 'mallEvil'; - var bg:FlxSprite = new FlxSprite(-400, -500).loadGraphic(Paths.image('christmas/evilBG','week5')); - bg.antialiasing = true; - bg.scrollFactor.set(0.2, 0.2); - bg.active = false; - bg.setGraphicSize(Std.int(bg.width * 0.8)); - bg.updateHitbox(); - add(bg); - - var evilTree:FlxSprite = new FlxSprite(300, -300).loadGraphic(Paths.image('christmas/evilTree','week5')); - evilTree.antialiasing = true; - evilTree.scrollFactor.set(0.2, 0.2); - add(evilTree); - - var evilSnow:FlxSprite = new FlxSprite(-200, 700).loadGraphic(Paths.image("christmas/evilSnow",'week5')); + var evilSnow:FlxSprite = new FlxSprite(-200, 700).loadGraphic(Paths.image("christmas/evilSnow", 'week5')); evilSnow.antialiasing = true; - add(evilSnow); + add(evilSnow); } - case 'school': - { - curStage = 'school'; + case 'school': + { + curStage = 'school'; - // defaultCamZoom = 0.9; + // defaultCamZoom = 0.9; - var bgSky = new FlxSprite().loadGraphic(Paths.image('weeb/weebSky','week6')); - bgSky.scrollFactor.set(0.1, 0.1); - add(bgSky); + var bgSky = new FlxSprite().loadGraphic(Paths.image('weeb/weebSky', 'week6')); + bgSky.scrollFactor.set(0.1, 0.1); + add(bgSky); - var repositionShit = -200; + var repositionShit = -200; - var bgSchool:FlxSprite = new FlxSprite(repositionShit, 0).loadGraphic(Paths.image('weeb/weebSchool','week6')); - bgSchool.scrollFactor.set(0.6, 0.90); - add(bgSchool); + var bgSchool:FlxSprite = new FlxSprite(repositionShit, 0).loadGraphic(Paths.image('weeb/weebSchool', 'week6')); + bgSchool.scrollFactor.set(0.6, 0.90); + add(bgSchool); - var bgStreet:FlxSprite = new FlxSprite(repositionShit).loadGraphic(Paths.image('weeb/weebStreet','week6')); - bgStreet.scrollFactor.set(0.95, 0.95); - add(bgStreet); + var bgStreet:FlxSprite = new FlxSprite(repositionShit).loadGraphic(Paths.image('weeb/weebStreet', 'week6')); + bgStreet.scrollFactor.set(0.95, 0.95); + add(bgStreet); - var fgTrees:FlxSprite = new FlxSprite(repositionShit + 170, 130).loadGraphic(Paths.image('weeb/weebTreesBack','week6')); - fgTrees.scrollFactor.set(0.9, 0.9); - add(fgTrees); + var fgTrees:FlxSprite = new FlxSprite(repositionShit + 170, 130).loadGraphic(Paths.image('weeb/weebTreesBack', 'week6')); + fgTrees.scrollFactor.set(0.9, 0.9); + add(fgTrees); - var bgTrees:FlxSprite = new FlxSprite(repositionShit - 380, -800); - var treetex = Paths.getPackerAtlas('weeb/weebTrees','week6'); - bgTrees.frames = treetex; - bgTrees.animation.add('treeLoop', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], 12); - bgTrees.animation.play('treeLoop'); - bgTrees.scrollFactor.set(0.85, 0.85); - add(bgTrees); + var bgTrees:FlxSprite = new FlxSprite(repositionShit - 380, -800); + var treetex = Paths.getPackerAtlas('weeb/weebTrees', 'week6'); + bgTrees.frames = treetex; + bgTrees.animation.add('treeLoop', [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18], 12); + bgTrees.animation.play('treeLoop'); + bgTrees.scrollFactor.set(0.85, 0.85); + add(bgTrees); - var treeLeaves:FlxSprite = new FlxSprite(repositionShit, -40); - treeLeaves.frames = Paths.getSparrowAtlas('weeb/petals','week6'); - treeLeaves.animation.addByPrefix('leaves', 'PETALS ALL', 24, true); - treeLeaves.animation.play('leaves'); - treeLeaves.scrollFactor.set(0.85, 0.85); - add(treeLeaves); + var treeLeaves:FlxSprite = new FlxSprite(repositionShit, -40); + treeLeaves.frames = Paths.getSparrowAtlas('weeb/petals', 'week6'); + treeLeaves.animation.addByPrefix('leaves', 'PETALS ALL', 24, true); + treeLeaves.animation.play('leaves'); + treeLeaves.scrollFactor.set(0.85, 0.85); + add(treeLeaves); - var widShit = Std.int(bgSky.width * 6); + var widShit = Std.int(bgSky.width * 6); - bgSky.setGraphicSize(widShit); - bgSchool.setGraphicSize(widShit); - bgStreet.setGraphicSize(widShit); - bgTrees.setGraphicSize(Std.int(widShit * 1.4)); - fgTrees.setGraphicSize(Std.int(widShit * 0.8)); - treeLeaves.setGraphicSize(widShit); + bgSky.setGraphicSize(widShit); + bgSchool.setGraphicSize(widShit); + bgStreet.setGraphicSize(widShit); + bgTrees.setGraphicSize(Std.int(widShit * 1.4)); + fgTrees.setGraphicSize(Std.int(widShit * 0.8)); + treeLeaves.setGraphicSize(widShit); - fgTrees.updateHitbox(); - bgSky.updateHitbox(); - bgSchool.updateHitbox(); - bgStreet.updateHitbox(); - bgTrees.updateHitbox(); - treeLeaves.updateHitbox(); + fgTrees.updateHitbox(); + bgSky.updateHitbox(); + bgSchool.updateHitbox(); + bgStreet.updateHitbox(); + bgTrees.updateHitbox(); + treeLeaves.updateHitbox(); - bgGirls = new BackgroundGirls(-100, 190); - bgGirls.scrollFactor.set(0.9, 0.9); + bgGirls = new BackgroundGirls(-100, 190); + bgGirls.scrollFactor.set(0.9, 0.9); - if (songLowercase == 'roses') + if (songLowercase == 'roses') { - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { bgGirls.getScared(); } } - bgGirls.setGraphicSize(Std.int(bgGirls.width * daPixelZoom)); - bgGirls.updateHitbox(); - if(FlxG.save.data.distractions){ - add(bgGirls); + bgGirls.setGraphicSize(Std.int(bgGirls.width * daPixelZoom)); + bgGirls.updateHitbox(); + if (FlxG.save.data.distractions) + { + add(bgGirls); + } } - } - case 'schoolEvil': - { - curStage = 'schoolEvil'; + case 'schoolEvil': + { + curStage = 'schoolEvil'; - var waveEffectBG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 3, 2); - var waveEffectFG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 5, 2); + var waveEffectBG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 3, 2); + var waveEffectFG = new FlxWaveEffect(FlxWaveMode.ALL, 2, -1, 5, 2); - var posX = 400; - var posY = 200; + var posX = 400; + var posY = 200; - var bg:FlxSprite = new FlxSprite(posX, posY); - bg.frames = Paths.getSparrowAtlas('weeb/animatedEvilSchool','week6'); - bg.animation.addByPrefix('idle', 'background 2', 24); - bg.animation.play('idle'); - bg.scrollFactor.set(0.8, 0.9); - bg.scale.set(6, 6); - add(bg); + var bg:FlxSprite = new FlxSprite(posX, posY); + bg.frames = Paths.getSparrowAtlas('weeb/animatedEvilSchool', 'week6'); + bg.animation.addByPrefix('idle', 'background 2', 24); + bg.animation.play('idle'); + bg.scrollFactor.set(0.8, 0.9); + bg.scale.set(6, 6); + add(bg); - /* + /* var bg:FlxSprite = new FlxSprite(posX, posY).loadGraphic(Paths.image('weeb/evilSchoolBG')); bg.scale.set(6, 6); // bg.setGraphicSize(Std.int(bg.width * 6)); @@ -691,31 +750,31 @@ class PlayState extends MusicBeatState wiggleShit.waveAmplitude = 0.01; wiggleShit.waveFrequency = 60; wiggleShit.waveSpeed = 0.8; - */ + */ - // bg.shader = wiggleShit.shader; - // fg.shader = wiggleShit.shader; + // bg.shader = wiggleShit.shader; + // fg.shader = wiggleShit.shader; - /* - var waveSprite = new FlxEffectSprite(bg, [waveEffectBG]); - var waveSpriteFG = new FlxEffectSprite(fg, [waveEffectFG]); - // Using scale since setGraphicSize() doesnt work??? - waveSprite.scale.set(6, 6); - waveSpriteFG.scale.set(6, 6); - waveSprite.setPosition(posX, posY); - waveSpriteFG.setPosition(posX, posY); - waveSprite.scrollFactor.set(0.7, 0.8); - waveSpriteFG.scrollFactor.set(0.9, 0.8); - // waveSprite.setGraphicSize(Std.int(waveSprite.width * 6)); - // waveSprite.updateHitbox(); - // waveSpriteFG.setGraphicSize(Std.int(fg.width * 6)); - // waveSpriteFG.updateHitbox(); - add(waveSprite); - add(waveSpriteFG); - */ - } - case 'stage': - { + /* + var waveSprite = new FlxEffectSprite(bg, [waveEffectBG]); + var waveSpriteFG = new FlxEffectSprite(fg, [waveEffectFG]); + // Using scale since setGraphicSize() doesnt work??? + waveSprite.scale.set(6, 6); + waveSpriteFG.scale.set(6, 6); + waveSprite.setPosition(posX, posY); + waveSpriteFG.setPosition(posX, posY); + waveSprite.scrollFactor.set(0.7, 0.8); + waveSpriteFG.scrollFactor.set(0.9, 0.8); + // waveSprite.setGraphicSize(Std.int(waveSprite.width * 6)); + // waveSprite.updateHitbox(); + // waveSpriteFG.setGraphicSize(Std.int(fg.width * 6)); + // waveSpriteFG.updateHitbox(); + add(waveSprite); + add(waveSpriteFG); + */ + } + case 'stage': + { defaultCamZoom = 0.9; curStage = 'stage'; var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback')); @@ -723,7 +782,7 @@ class PlayState extends MusicBeatState bg.scrollFactor.set(0.9, 0.9); bg.active = false; add(bg); - + var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront')); stageFront.setGraphicSize(Std.int(stageFront.width * 1.1)); stageFront.updateHitbox(); @@ -731,56 +790,64 @@ class PlayState extends MusicBeatState stageFront.scrollFactor.set(0.9, 0.9); stageFront.active = false; add(stageFront); - + var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains')); stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9)); stageCurtains.updateHitbox(); stageCurtains.antialiasing = true; stageCurtains.scrollFactor.set(1.3, 1.3); stageCurtains.active = false; - + add(stageCurtains); - } - default: - { - defaultCamZoom = 0.9; - curStage = 'stage'; - var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback')); - bg.antialiasing = true; - bg.scrollFactor.set(0.9, 0.9); - bg.active = false; - add(bg); + } + default: + { + defaultCamZoom = 0.9; + curStage = 'stage'; + var bg:FlxSprite = new FlxSprite(-600, -200).loadGraphic(Paths.image('stageback')); + bg.antialiasing = true; + bg.scrollFactor.set(0.9, 0.9); + bg.active = false; + add(bg); - var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront')); - stageFront.setGraphicSize(Std.int(stageFront.width * 1.1)); - stageFront.updateHitbox(); - stageFront.antialiasing = true; - stageFront.scrollFactor.set(0.9, 0.9); - stageFront.active = false; - add(stageFront); + var stageFront:FlxSprite = new FlxSprite(-650, 600).loadGraphic(Paths.image('stagefront')); + stageFront.setGraphicSize(Std.int(stageFront.width * 1.1)); + stageFront.updateHitbox(); + stageFront.antialiasing = true; + stageFront.scrollFactor.set(0.9, 0.9); + stageFront.active = false; + add(stageFront); - var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains')); - stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9)); - stageCurtains.updateHitbox(); - stageCurtains.antialiasing = true; - stageCurtains.scrollFactor.set(1.3, 1.3); - stageCurtains.active = false; + var stageCurtains:FlxSprite = new FlxSprite(-500, -300).loadGraphic(Paths.image('stagecurtains')); + stageCurtains.setGraphicSize(Std.int(stageCurtains.width * 0.9)); + stageCurtains.updateHitbox(); + stageCurtains.antialiasing = true; + stageCurtains.scrollFactor.set(1.3, 1.3); + stageCurtains.active = false; - add(stageCurtains); + add(stageCurtains); + } } } - } - //defaults if no gf was found in chart + // defaults if no gf was found in chart var gfCheck:String = 'gf'; - - if (SONG.gfVersion == null) { - switch(storyWeek) + + if (SONG.gfVersion == null) + { + switch (storyWeek) { - case 4: gfCheck = 'gf-car'; - case 5: gfCheck = 'gf-christmas'; - case 6: gfCheck = 'gf-pixel'; + case 4: + gfCheck = 'gf-car'; + case 5: + gfCheck = 'gf-christmas'; + case 6: + gfCheck = 'gf-pixel'; } - } else {gfCheck = SONG.gfVersion;} + } + else + { + gfCheck = SONG.gfVersion; + } var curGf:String = ''; switch (gfCheck) @@ -794,7 +861,7 @@ class PlayState extends MusicBeatState default: curGf = 'gf'; } - + gf = new Character(400, 130, curGf); gf.scrollFactor.set(0.95, 0.95); @@ -835,13 +902,14 @@ class PlayState extends MusicBeatState dad.y += 360; camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y); case 'spirit': - if(FlxG.save.data.distractions){ - // trailArea.scrollFactor.set(); - var evilTrail = new FlxTrail(dad, null, 4, 24, 0.3, 0.069); - // evilTrail.changeValuesEnabled(false, false, false, false); - // evilTrail.changeGraphic() - add(evilTrail); - // evilTrail.scrollFactor.set(1.1, 1.1); + if (FlxG.save.data.distractions) + { + // trailArea.scrollFactor.set(); + var evilTrail = new FlxTrail(dad, null, 4, 24, 0.3, 0.069); + // evilTrail.changeValuesEnabled(false, false, false, false); + // evilTrail.changeGraphic() + add(evilTrail); + // evilTrail.scrollFactor.set(1.1, 1.1); } dad.x -= 150; @@ -849,8 +917,6 @@ class PlayState extends MusicBeatState camPos.set(dad.getGraphicMidpoint().x + 300, dad.getGraphicMidpoint().y); } - - boyfriend = new Boyfriend(770, 450, SONG.player1); // REPOSITIONING PER STAGE @@ -859,7 +925,8 @@ class PlayState extends MusicBeatState case 'limo': boyfriend.y -= 220; boyfriend.x += 260; - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { resetFastCar(); add(fastCar); } @@ -894,11 +961,10 @@ class PlayState extends MusicBeatState add(boyfriend); } - if (loadRep) { - FlxG.watch.addQuick('rep rpesses',repPresses); - FlxG.watch.addQuick('rep releases',repReleases); + FlxG.watch.addQuick('rep rpesses', repPresses); + FlxG.watch.addQuick('rep releases', repReleases); // FlxG.watch.addQuick('Queued',inputsQueued); PlayStateChangeables.useDownscroll = rep.replay.isDownscroll; @@ -917,10 +983,10 @@ class PlayState extends MusicBeatState doof.finishThing = startCountdown; Conductor.songPosition = -5000; - + strumLine = new FlxSprite(0, 50).makeGraphic(FlxG.width, 10); strumLine.scrollFactor.set(); - + if (PlayStateChangeables.useDownscroll) strumLine.y = FlxG.height - 165; @@ -955,7 +1021,7 @@ class PlayState extends MusicBeatState add(camFollow); - FlxG.camera.follow(camFollow, LOCKON, 0.04 * (30 / (cast (Lib.current.getChildAt(0), Main)).getFPS())); + FlxG.camera.follow(camFollow, LOCKON, 0.04 * (30 / (cast(Lib.current.getChildAt(0), Main)).getFPS())); // FlxG.camera.setScrollBounds(0, FlxG.width, 0, FlxG.height); FlxG.camera.zoom = defaultCamZoom; FlxG.camera.focusOn(camFollow.getPosition()); @@ -965,28 +1031,28 @@ class PlayState extends MusicBeatState FlxG.fixedTimestep = false; if (FlxG.save.data.songPosition) // I dont wanna talk about this code :( - { - songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar')); - if (PlayStateChangeables.useDownscroll) - 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, 90000); - songPosBar.scrollFactor.set(); - songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME); - add(songPosBar); - - var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - (SONG.song.length * 5),songPosBG.y,0,SONG.song, 16); - if (PlayStateChangeables.useDownscroll) - songName.y -= 3; - songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); - songName.scrollFactor.set(); - add(songName); - songName.cameras = [camHUD]; - } + { + songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar')); + if (PlayStateChangeables.useDownscroll) + 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, 90000); + songPosBar.scrollFactor.set(); + songPosBar.createFilledBar(FlxColor.GRAY, FlxColor.LIME); + add(songPosBar); + + var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - (SONG.song.length * 5), songPosBG.y, 0, SONG.song, 16); + if (PlayStateChangeables.useDownscroll) + songName.y -= 3; + songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); + songName.scrollFactor.set(); + add(songName); + songName.cameras = [camHUD]; + } healthBarBG = new FlxSprite(0, FlxG.height * 0.9).loadGraphic(Paths.image('healthBar')); if (PlayStateChangeables.useDownscroll) @@ -1003,8 +1069,13 @@ class PlayState extends MusicBeatState add(healthBar); // Add Kade Engine watermark - kadeEngineWatermark = new FlxText(4,healthBarBG.y + 50,0,SONG.song + " - " + CoolUtil.difficultyFromInt(storyDifficulty) + (Main.watermarks ? " | KE " + MainMenuState.kadeEngineVer : ""), 16); - kadeEngineWatermark.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); + kadeEngineWatermark = new FlxText(4, healthBarBG.y + + 50, 0, + SONG.song + + " - " + + CoolUtil.difficultyFromInt(storyDifficulty) + + (Main.watermarks ? " | KE " + MainMenuState.kadeEngineVer : ""), 16); + kadeEngineWatermark.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); kadeEngineWatermark.scrollFactor.set(); add(kadeEngineWatermark); @@ -1017,15 +1088,15 @@ class PlayState extends MusicBeatState originalX = scoreTxt.x; - scoreTxt.scrollFactor.set(); - - scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); + + scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, FlxTextAlign.CENTER, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); add(scoreTxt); - replayTxt = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (PlayStateChangeables.useDownscroll ? 100 : -100), 0, "REPLAY", 20); - replayTxt.setFormat(Paths.font("vcr.ttf"), 42, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); + replayTxt = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (PlayStateChangeables.useDownscroll ? 100 : -100), 0, "REPLAY", + 20); + replayTxt.setFormat(Paths.font("vcr.ttf"), 42, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); replayTxt.borderSize = 4; replayTxt.borderQuality = 2; replayTxt.scrollFactor.set(); @@ -1034,12 +1105,14 @@ class PlayState extends MusicBeatState add(replayTxt); } // Literally copy-paste of the above, fu - botPlayState = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (PlayStateChangeables.useDownscroll ? 100 : -100), 0, "BOTPLAY", 20); - botPlayState.setFormat(Paths.font("vcr.ttf"), 42, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); + botPlayState = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (PlayStateChangeables.useDownscroll ? 100 : -100), 0, + "BOTPLAY", 20); + botPlayState.setFormat(Paths.font("vcr.ttf"), 42, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); botPlayState.scrollFactor.set(); botPlayState.borderSize = 4; botPlayState.borderQuality = 2; - if(PlayStateChangeables.botPlay && !loadRep) add(botPlayState); + if (PlayStateChangeables.botPlay && !loadRep) + add(botPlayState); iconP1 = new HealthIcon(SONG.player1, true); iconP1.y = healthBar.y - (iconP1.height / 2); @@ -1072,12 +1145,12 @@ class PlayState extends MusicBeatState // cameras = [FlxG.cameras.list[1]]; startingSong = true; - + trace('starting'); if (isStoryMode) { - switch (StringTools.replace(curSong," ", "-").toLowerCase()) + switch (StringTools.replace(curSong, " ", "-").toLowerCase()) { case "winter-horrorland": var blackScreen:FlxSprite = new FlxSprite(0, 0).makeGraphic(Std.int(FlxG.width * 2), Std.int(FlxG.height * 2), FlxColor.BLACK); @@ -1130,8 +1203,8 @@ class PlayState extends MusicBeatState if (!loadRep) rep = new Replay("na"); - FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN,handleInput); - FlxG.stage.addEventListener(KeyboardEvent.KEY_UP,releaseInput); + FlxG.stage.addEventListener(KeyboardEvent.KEY_DOWN, handleInput); + FlxG.stage.addEventListener(KeyboardEvent.KEY_UP, releaseInput); super.create(); } @@ -1153,7 +1226,8 @@ class PlayState extends MusicBeatState senpaiEvil.updateHitbox(); senpaiEvil.screenCenter(); - if (StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'roses' || StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'thorns') + if (StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'roses' + || StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase() == 'thorns') { remove(black); @@ -1236,18 +1310,20 @@ class PlayState extends MusicBeatState generateStaticArrows(0); generateStaticArrows(1); - #if windows // pre lowercasing the song name (startCountdown) var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); - switch (songLowercase) { - case 'dad-battle': songLowercase = 'dadbattle'; - case 'philly-nice': songLowercase = 'philly'; + switch (songLowercase) + { + case 'dad-battle': + songLowercase = 'dadbattle'; + case 'philly-nice': + songLowercase = 'philly'; } if (executeModchart) { luaModchart = ModchartState.createModchartState(); - luaModchart.executeState('start',[songLowercase]); + luaModchart.executeState('start', [songLowercase]); } #end @@ -1266,16 +1342,8 @@ class PlayState extends MusicBeatState var introAssets:Map> = new Map>(); 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 = introAssets.get('default'); var altSuffix:String = ""; @@ -1360,7 +1428,6 @@ class PlayState extends MusicBeatState var lastReportedPlayheadPosition:Int = 0; var songTime:Float = 0; - private function getKey(charCode:Int):String { for (key => value in FlxKey.fromStringMap) @@ -1371,18 +1438,23 @@ class PlayState extends MusicBeatState return null; } - var keys = [false,false,false,false]; + var keys = [false, false, false, false]; private function releaseInput(evt:KeyboardEvent):Void // handles releases { @:privateAccess var key = FlxKey.toStringMap.get(Keyboard.__convertKeyCode(evt.keyCode)); - - var binds:Array = [FlxG.save.data.leftBind,FlxG.save.data.downBind, FlxG.save.data.upBind, FlxG.save.data.rightBind]; + + var binds:Array = [ + FlxG.save.data.leftBind, + FlxG.save.data.downBind, + FlxG.save.data.upBind, + FlxG.save.data.rightBind + ]; var data = -1; - - switch(evt.keyCode) // arrow keys + + switch (evt.keyCode) // arrow keys { case 37: data = 0; @@ -1406,7 +1478,8 @@ class PlayState extends MusicBeatState keys[data] = false; } - private function handleInput(evt:KeyboardEvent):Void { // this actually handles press inputs + private function handleInput(evt:KeyboardEvent):Void + { // this actually handles press inputs if (PlayStateChangeables.botPlay || loadRep || paused) return; @@ -1417,12 +1490,17 @@ class PlayState extends MusicBeatState @:privateAccess var key = FlxKey.toStringMap.get(Keyboard.__convertKeyCode(evt.keyCode)); - - var binds:Array = [FlxG.save.data.leftBind,FlxG.save.data.downBind, FlxG.save.data.upBind, FlxG.save.data.rightBind]; + + var binds:Array = [ + FlxG.save.data.leftBind, + FlxG.save.data.downBind, + FlxG.save.data.upBind, + FlxG.save.data.rightBind + ]; var data = -1; - - switch(evt.keyCode) // arrow keys + + switch (evt.keyCode) // arrow keys { case 37: data = 0; @@ -1458,17 +1536,15 @@ class PlayState extends MusicBeatState dataNotes.push(daNote); }); // Collect notes that can be hit - dataNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime)); // sort by the earliest note if (dataNotes.length != 0) { - var coolNote = dataNotes[0]; if (dataNotes.length > 1) // stacked notes or really close ones { - for(i in 0...dataNotes.length) + for (i in 0...dataNotes.length) { if (i == 0) // skip the first note continue; @@ -1490,17 +1566,15 @@ class PlayState extends MusicBeatState var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition); ana.hit = true; ana.hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000)); - ana.nearestNote = [coolNote.strumTime,coolNote.noteData,coolNote.sustainLength]; + ana.nearestNote = [coolNote.strumTime, coolNote.noteData, coolNote.sustainLength]; } else if (!FlxG.save.data.ghost) { - noteMiss(data,null); + noteMiss(data, null); ana.hit = false; ana.hitJudge = "shit"; ana.nearestNote = []; } - - } var songStarted = false; @@ -1531,22 +1605,25 @@ class PlayState extends MusicBeatState songPosBG = new FlxSprite(0, 10).loadGraphic(Paths.image('healthBar')); if (PlayStateChangeables.useDownscroll) - songPosBG.y = FlxG.height * 0.9 + 45; + 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 = 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) - (SONG.song.length * 5),songPosBG.y,0,SONG.song, 16); + var songName = new FlxText(songPosBG.x + (songPosBG.width / 2) - (SONG.song.length * 5), songPosBG.y, 0, SONG.song, 16); if (PlayStateChangeables.useDownscroll) songName.y -= 3; - songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); + songName.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, RIGHT, FlxTextBorderStyle.OUTLINE, FlxColor.BLACK); songName.scrollFactor.set(); add(songName); @@ -1554,26 +1631,40 @@ class PlayState extends MusicBeatState songPosBar.cameras = [camHUD]; songName.cameras = [camHUD]; } - + // Song check real quick - switch(curSong) + switch (curSong) { - case 'Bopeebo' | 'Philly Nice' | 'Blammed' | 'Cocoa' | 'Eggnog': allowedToHeadbang = true; - default: allowedToHeadbang = false; + case 'Bopeebo' | 'Philly Nice' | 'Blammed' | 'Cocoa' | 'Eggnog': + allowedToHeadbang = true; + default: + allowedToHeadbang = false; } if (useVideo) GlobalVideo.get().resume(); - + #if windows // Updating Discord Rich Presence (with Time Left) - DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + Ratings.GenerateLetterRank(accuracy), "\nAcc: " + HelperFunctions.truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); + DiscordClient.changePresence(detailsText + + " " + + SONG.song + + " (" + + storyDifficultyText + + ") " + + Ratings.GenerateLetterRank(accuracy), + "\nAcc: " + + HelperFunctions.truncateFloat(accuracy, 2) + + "% | Score: " + + songScore + + " | Misses: " + + misses, iconRPC); #end } var debugNum:Int = 0; - private function generateSong(dataPath:String):Void + public function generateSong(dataPath:String):Void { // FlxG.log.add(ChartParser.parse()); @@ -1603,31 +1694,36 @@ class PlayState extends MusicBeatState // Per song offset check #if windows - // pre lowercasing the song name (generateSong) - var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); - switch (songLowercase) { - case 'dad-battle': songLowercase = 'dadbattle'; - case 'philly-nice': songLowercase = 'philly'; - } + // pre lowercasing the song name (generateSong) + var songLowercase = StringTools.replace(PlayState.SONG.song, " ", "-").toLowerCase(); + switch (songLowercase) + { + case 'dad-battle': + songLowercase = 'dadbattle'; + case 'philly-nice': + songLowercase = 'philly'; + } - var songPath = 'assets/data/' + songLowercase + '/'; - - for(file in sys.FileSystem.readDirectory(songPath)) + var songPath = 'assets/data/' + songLowercase + '/'; + + for (file in sys.FileSystem.readDirectory(songPath)) + { + var path = haxe.io.Path.join([songPath, file]); + if (!sys.FileSystem.isDirectory(path)) { - var path = haxe.io.Path.join([songPath, file]); - if(!sys.FileSystem.isDirectory(path)) + if (path.endsWith('.offset')) { - if(path.endsWith('.offset')) - { - trace('Found offset file: ' + path); - songOffset = Std.parseFloat(file.substring(0, file.indexOf('.off'))); - break; - }else { - trace('Offset file not found. Creating one @: ' + songPath); - sys.io.File.saveContent(songPath + songOffset + '.offset', ''); - } + trace('Found offset file: ' + path); + songOffset = Std.parseFloat(file.substring(0, file.indexOf('.off'))); + break; + } + else + { + trace('Offset file not found. Creating one @: ' + songPath); + sys.io.File.saveContent(songPath + songOffset + '.offset', ''); } } + } #end var daBeats:Int = 0; // Not exactly representative of 'daBeats' lol, just how much it has looped for (section in noteData) @@ -1662,7 +1758,6 @@ class PlayState extends MusicBeatState swagNote.sustainLength = songNotes[2]; swagNote.scrollFactor.set(0, 0); - var susLength:Float = swagNote.sustainLength; susLength = susLength / Conductor.stepCrochet; @@ -1717,15 +1812,24 @@ class PlayState extends MusicBeatState // FlxG.log.add(i); var babyArrow:FlxSprite = new FlxSprite(0, strumLine.y); - //defaults if no noteStyle was found in chart + // defaults if no noteStyle was found in chart var noteTypeCheck:String = 'normal'; - + if (PlayStateChangeables.Optimize && player == 0) continue; - if (SONG.noteStyle == null) { - switch(storyWeek) {case 6: noteTypeCheck = 'pixel';} - } else {noteTypeCheck = SONG.noteStyle;} + if (SONG.noteStyle == null) + { + switch (storyWeek) + { + case 6: + noteTypeCheck = 'pixel'; + } + } + else + { + noteTypeCheck = SONG.noteStyle; + } switch (noteTypeCheck) { @@ -1763,7 +1867,7 @@ class PlayState extends MusicBeatState babyArrow.animation.add('pressed', [4, 8], 12, false); babyArrow.animation.add('confirm', [12, 16], 24, false); } - + case 'normal': babyArrow.frames = Paths.getSparrowAtlas('NOTE_assets'); babyArrow.animation.addByPrefix('green', 'arrowUP'); @@ -1856,13 +1960,13 @@ class PlayState extends MusicBeatState babyArrow.animation.play('static'); babyArrow.x += 50; babyArrow.x += ((FlxG.width / 2) * player); - + if (PlayStateChangeables.Optimize) babyArrow.x -= 275; - + cpuStrums.forEach(function(spr:FlxSprite) - { - spr.centerOffsets(); //CPU arrows start out slightly off-center + { + spr.centerOffsets(); // CPU arrows start out slightly off-center }); strumLineNotes.add(babyArrow); @@ -1885,7 +1989,18 @@ class PlayState extends MusicBeatState } #if windows - DiscordClient.changePresence("PAUSED on " + SONG.song + " (" + storyDifficultyText + ") " + Ratings.GenerateLetterRank(accuracy), "Acc: " + HelperFunctions.truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); + DiscordClient.changePresence("PAUSED on " + + SONG.song + + " (" + + storyDifficultyText + + ") " + + Ratings.GenerateLetterRank(accuracy), + "Acc: " + + HelperFunctions.truncateFloat(accuracy, 2) + + "% | Score: " + + songScore + + " | Misses: " + + misses, iconRPC); #end if (!startTimer.finished) startTimer.active = false; @@ -1910,7 +2025,21 @@ class PlayState extends MusicBeatState #if windows if (startTimer.finished) { - DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + Ratings.GenerateLetterRank(accuracy), "\nAcc: " + HelperFunctions.truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses, iconRPC, true, songLength - Conductor.songPosition); + DiscordClient.changePresence(detailsText + + " " + + SONG.song + + " (" + + storyDifficultyText + + ") " + + Ratings.GenerateLetterRank(accuracy), + "\nAcc: " + + HelperFunctions.truncateFloat(accuracy, 2) + + "% | Score: " + + songScore + + " | Misses: " + + misses, iconRPC, true, + songLength + - Conductor.songPosition); } else { @@ -1921,7 +2050,6 @@ class PlayState extends MusicBeatState super.closeSubState(); } - function resyncVocals():Void { @@ -1933,7 +2061,19 @@ class PlayState extends MusicBeatState vocals.play(); #if windows - DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + Ratings.GenerateLetterRank(accuracy), "\nAcc: " + HelperFunctions.truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); + DiscordClient.changePresence(detailsText + + " " + + SONG.song + + " (" + + storyDifficultyText + + ") " + + Ratings.GenerateLetterRank(accuracy), + "\nAcc: " + + HelperFunctions.truncateFloat(accuracy, 2) + + "% | Score: " + + songScore + + " | Misses: " + + misses, iconRPC); #end } @@ -1957,26 +2097,23 @@ class PlayState extends MusicBeatState if (PlayStateChangeables.botPlay && FlxG.keys.justPressed.ONE) camHUD.visible = !camHUD.visible; - if (useVideo && GlobalVideo.get() != null && !stopUpdate) - { - if (GlobalVideo.get().ended && !removedVideo) - { - remove(videoSprite); - FlxG.stage.window.onFocusOut.remove(focusOut); - FlxG.stage.window.onFocusIn.remove(focusIn); - removedVideo = true; - } + { + if (GlobalVideo.get().ended && !removedVideo) + { + remove(videoSprite); + FlxG.stage.window.onFocusOut.remove(focusOut); + FlxG.stage.window.onFocusIn.remove(focusIn); + removedVideo = true; } + } - - #if windows if (executeModchart && luaModchart != null && songStarted) { - luaModchart.setVar('songPos',Conductor.songPosition); + luaModchart.setVar('songPos', Conductor.songPosition); luaModchart.setVar('hudZoom', camHUD.zoom); - luaModchart.setVar('cameraZoom',FlxG.camera.zoom); + luaModchart.setVar('cameraZoom', FlxG.camera.zoom); luaModchart.executeState('update', [elapsed]); for (i in luaWiggles) @@ -1993,9 +2130,9 @@ class PlayState extends MusicBeatState }*/ FlxG.camera.angle = luaModchart.getVar('cameraAngle', 'float'); - camHUD.angle = luaModchart.getVar('camHudAngle','float'); + camHUD.angle = luaModchart.getVar('camHudAngle', 'float'); - if (luaModchart.getVar("showOnlyStrums",'bool')) + if (luaModchart.getVar("showOnlyStrums", 'bool')) { healthBarBG.visible = false; kadeEngineWatermark.visible = false; @@ -2014,8 +2151,8 @@ class PlayState extends MusicBeatState scoreTxt.visible = true; } - var p1 = luaModchart.getVar("strumLine1Visible",'bool'); - var p2 = luaModchart.getVar("strumLine2Visible",'bool'); + var p1 = luaModchart.getVar("strumLine1Visible", 'bool'); + var p2 = luaModchart.getVar("strumLine2Visible", 'bool'); for (i in 0...4) { @@ -2024,14 +2161,13 @@ class PlayState extends MusicBeatState playerStrums.members[i].visible = p2; } } - #end // reverse iterate to remove oldest notes first and not invalidate the iteration // stop iteration as soon as a note is not removed // all notes should be kept in the correct order and this is optimal, safe to do every frame/update { - var balls = notesHitArray.length-1; + var balls = notesHitArray.length - 1; while (balls >= 0) { var cock:Date = notesHitArray[balls]; @@ -2072,7 +2208,7 @@ class PlayState extends MusicBeatState super.update(elapsed); - scoreTxt.text = Ratings.CalculateRanking(songScore,songScoreDef,nps,maxNPS,accuracy); + scoreTxt.text = Ratings.CalculateRanking(songScore, songScoreDef, nps, maxNPS, accuracy); var lengthInPx = scoreTxt.textField.length * scoreTxt.frameHeight; // bad way but does more or less a better job @@ -2094,23 +2230,22 @@ class PlayState extends MusicBeatState openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); } - if (FlxG.keys.justPressed.SEVEN) { if (useVideo) - { - GlobalVideo.get().stop(); - remove(videoSprite); - FlxG.stage.window.onFocusOut.remove(focusOut); - FlxG.stage.window.onFocusIn.remove(focusIn); - removedVideo = true; - } + { + GlobalVideo.get().stop(); + remove(videoSprite); + FlxG.stage.window.onFocusOut.remove(focusOut); + FlxG.stage.window.onFocusIn.remove(focusIn); + removedVideo = true; + } #if windows DiscordClient.changePresence("Chart Editor", null, null, true); #end FlxG.switchState(new ChartingState()); - FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput); - FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, handleInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP, releaseInput); #if windows if (luaModchart != null) { @@ -2153,17 +2288,17 @@ class PlayState extends MusicBeatState if (FlxG.keys.justPressed.SIX) { if (useVideo) - { - GlobalVideo.get().stop(); - remove(videoSprite); - FlxG.stage.window.onFocusOut.remove(focusOut); - FlxG.stage.window.onFocusIn.remove(focusIn); - removedVideo = true; - } + { + GlobalVideo.get().stop(); + remove(videoSprite); + FlxG.stage.window.onFocusOut.remove(focusOut); + FlxG.stage.window.onFocusIn.remove(focusIn); + removedVideo = true; + } FlxG.switchState(new AnimationDebug(SONG.player2)); - FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput); - FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, handleInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP, releaseInput); #if windows if (luaModchart != null) { @@ -2176,8 +2311,8 @@ class PlayState extends MusicBeatState if (FlxG.keys.justPressed.ZERO) { FlxG.switchState(new AnimationDebug(SONG.player1)); - FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput); - FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, handleInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP, releaseInput); #if windows if (luaModchart != null) { @@ -2186,7 +2321,6 @@ class PlayState extends MusicBeatState } #end } - #end if (startingSong) @@ -2203,8 +2337,8 @@ class PlayState extends MusicBeatState // Conductor.songPosition = FlxG.sound.music.time; Conductor.songPosition += FlxG.elapsed * 1000; /*@:privateAccess - { - FlxG.sound.music._channel. + { + FlxG.sound.music._channel. }*/ songPositionBar = Conductor.songPosition; @@ -2229,104 +2363,116 @@ class PlayState extends MusicBeatState if (generatedMusic && PlayState.SONG.notes[Std.int(curStep / 16)] != null) { // Make sure Girlfriend cheers only for certain songs - if(allowedToHeadbang) + 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') + 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 - switch(curSong) + switch (curSong) { case 'Philly Nice': - { - // General duration of the song - if(curBeat < 250) { - // Beats to skip or to stop GF from cheering - 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'); - triggeredAlready = true; + // Just a garantee that it'll trigger just once + if (!triggeredAlready) + { + gf.playAnim('cheer'); + triggeredAlready = true; + } } - }else triggeredAlready = false; + else + triggeredAlready = false; + } } } - } case 'Bopeebo': - { - // Where it starts || where it ends - if(curBeat > 5 && curBeat < 130) { - if(curBeat % 8 == 7) + // Where it starts || where it ends + if (curBeat > 5 && curBeat < 130) { - if(!triggeredAlready) + if (curBeat % 8 == 7) { - gf.playAnim('cheer'); - triggeredAlready = true; + if (!triggeredAlready) + { + gf.playAnim('cheer'); + triggeredAlready = true; + } } - }else triggeredAlready = false; + else + triggeredAlready = false; + } } - } case 'Blammed': - { - if(curBeat > 30 && curBeat < 190) { - if(curBeat < 90 || curBeat > 128) + if (curBeat > 30 && curBeat < 190) { - if(curBeat % 4 == 2) + if (curBeat < 90 || curBeat > 128) { - if(!triggeredAlready) + if (curBeat % 4 == 2) { - gf.playAnim('cheer'); - triggeredAlready = true; + if (!triggeredAlready) + { + gf.playAnim('cheer'); + triggeredAlready = true; + } } - }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; } - }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 windows if (luaModchart != null) - luaModchart.setVar("mustHit",PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection); + luaModchart.setVar("mustHit", PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection); #end if (camFollow.x != dad.getMidpoint().x + 150 && !PlayState.SONG.notes[Std.int(curStep / 16)].mustHitSection) @@ -2445,33 +2591,55 @@ class PlayState extends MusicBeatState #if windows // Game Over doesn't get his own variable because it's only used here - DiscordClient.changePresence("GAME OVER -- " + SONG.song + " (" + storyDifficultyText + ") " + Ratings.GenerateLetterRank(accuracy),"\nAcc: " + HelperFunctions.truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); + DiscordClient.changePresence("GAME OVER -- " + + SONG.song + + " (" + + storyDifficultyText + + ") " + + Ratings.GenerateLetterRank(accuracy), + "\nAcc: " + + HelperFunctions.truncateFloat(accuracy, 2) + + "% | Score: " + + songScore + + " | Misses: " + + misses, iconRPC); #end // FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); } - if (FlxG.save.data.resetButton) + if (FlxG.save.data.resetButton) { - if(FlxG.keys.justPressed.R) - { - boyfriend.stunned = true; + if (FlxG.keys.justPressed.R) + { + boyfriend.stunned = true; - persistentUpdate = false; - persistentDraw = false; - paused = true; - - vocals.stop(); - FlxG.sound.music.stop(); - - openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); - - #if windows - // Game Over doesn't get his own variable because it's only used here - DiscordClient.changePresence("GAME OVER -- " + SONG.song + " (" + storyDifficultyText + ") " + Ratings.GenerateLetterRank(accuracy),"\nAcc: " + HelperFunctions.truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC); - #end - - // FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); - } + persistentUpdate = false; + persistentDraw = false; + paused = true; + + vocals.stop(); + FlxG.sound.music.stop(); + + openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); + + #if windows + // Game Over doesn't get his own variable because it's only used here + DiscordClient.changePresence("GAME OVER -- " + + SONG.song + + " (" + + storyDifficultyText + + ") " + + Ratings.GenerateLetterRank(accuracy), + "\nAcc: " + + HelperFunctions.truncateFloat(accuracy, 2) + + "% | Score: " + + songScore + + " | Misses: " + + misses, iconRPC); + #end + + // FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); + } } if (unspawnNotes[0] != null) @@ -2487,211 +2655,243 @@ class PlayState extends MusicBeatState } if (generatedMusic) + { + notes.forEachAlive(function(daNote:Note) { - notes.forEachAlive(function(daNote:Note) - { + // instead of doing stupid y > FlxG.height + // we be men and actually calculate the time :) + if (daNote.tooLate) + { + daNote.active = false; + daNote.visible = false; + } + else + { + daNote.visible = true; + daNote.active = true; + } - // instead of doing stupid y > FlxG.height - // we be men and actually calculate the time :) - if (daNote.tooLate) + if (!daNote.modifiedByLua) + { + if (PlayStateChangeables.useDownscroll) { - daNote.active = false; - daNote.visible = false; - } - else - { - daNote.visible = true; - daNote.active = true; - } - - if (!daNote.modifiedByLua) + if (daNote.mustPress) + daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y + + + 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, + 2)); + else + daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + + + 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, + 2)); + if (daNote.isSustainNote) { - if (PlayStateChangeables.useDownscroll) + // Remember = minus makes notes go up, plus makes them go down + if (daNote.animation.curAnim.name.endsWith('end') && daNote.prevNote != null) + daNote.y += daNote.prevNote.height; + else + daNote.y += daNote.height / 2; + + // If not in botplay, only clip sustain notes when properly hit, botplay gets to clip it everytime + if (!PlayStateChangeables.botPlay) { - if (daNote.mustPress) - daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y + 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, 2)); - else - daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, 2)); - if(daNote.isSustainNote) + if ((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) + && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= (strumLine.y + Note.swagWidth / 2)) { - // Remember = minus makes notes go up, plus makes them go down - if(daNote.animation.curAnim.name.endsWith('end') && daNote.prevNote != null) - daNote.y += daNote.prevNote.height; - else - daNote.y += daNote.height / 2; - - // If not in botplay, only clip sustain notes when properly hit, botplay gets to clip it everytime - if(!PlayStateChangeables.botPlay) - { - if((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) && daNote.y - daNote.offset.y * daNote.scale.y + daNote.height >= (strumLine.y + Note.swagWidth / 2)) - { - // Clip to strumline - var swagRect = new FlxRect(0, 0, daNote.frameWidth * 2, daNote.frameHeight * 2); - swagRect.height = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y; - swagRect.y = daNote.frameHeight - swagRect.height; - - daNote.clipRect = swagRect; - } - }else { - var swagRect = new FlxRect(0, 0, daNote.frameWidth * 2, daNote.frameHeight * 2); - swagRect.height = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y; - swagRect.y = daNote.frameHeight - swagRect.height; - - daNote.clipRect = swagRect; - } + // Clip to strumline + var swagRect = new FlxRect(0, 0, daNote.frameWidth * 2, daNote.frameHeight * 2); + swagRect.height = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + + Note.swagWidth / 2 + - daNote.y) / daNote.scale.y; + swagRect.y = daNote.frameHeight - swagRect.height; + + daNote.clipRect = swagRect; } - }else - { - if (daNote.mustPress) - daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, 2)); - else - daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, 2)); - if(daNote.isSustainNote) - { - daNote.y -= daNote.height / 2; - - if(!PlayStateChangeables.botPlay) - { - if((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) && daNote.y + daNote.offset.y * daNote.scale.y <= (strumLine.y + Note.swagWidth / 2)) - { - // Clip to strumline - var swagRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y); - swagRect.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y; - swagRect.height -= swagRect.y; - - daNote.clipRect = swagRect; - } - }else { - var swagRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y); - swagRect.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + Note.swagWidth / 2 - daNote.y) / daNote.scale.y; - swagRect.height -= swagRect.y; - - daNote.clipRect = swagRect; - } - } - } - } - - - if (!daNote.mustPress && daNote.wasGoodHit) - { - if (SONG.song != 'Tutorial') - camZooming = true; - - var altAnim:String = ""; - - if (SONG.notes[Math.floor(curStep / 16)] != null) - { - if (SONG.notes[Math.floor(curStep / 16)].altAnim) - altAnim = '-alt'; - } - - // Accessing the animation name directly to play it - var singData:Int = Std.int(Math.abs(daNote.noteData)); - dad.playAnim('sing' + dataSuffix[singData] + altAnim, true); - - if (FlxG.save.data.cpuStrums) - { - cpuStrums.forEach(function(spr:FlxSprite) - { - if (Math.abs(daNote.noteData) == spr.ID) - { - spr.animation.play('confirm', true); - } - if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school')) - { - spr.centerOffsets(); - spr.offset.x -= 13; - spr.offset.y -= 13; - } - else - spr.centerOffsets(); - }); - } - - #if windows - if (luaModchart != null) - luaModchart.executeState('playerTwoSing', [Math.abs(daNote.noteData), Conductor.songPosition]); - #end - - dad.holdTimer = 0; - - if (SONG.needsVoices) - vocals.volume = 1; - - daNote.active = false; - - - daNote.kill(); - notes.remove(daNote, true); - daNote.destroy(); - } - - if (daNote.mustPress && !daNote.modifiedByLua) - { - daNote.visible = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].visible; - daNote.x = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].x; - if (!daNote.isSustainNote) - daNote.angle = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].angle; - daNote.alpha = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].alpha; - } - else if (!daNote.wasGoodHit && !daNote.modifiedByLua) - { - daNote.visible = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].visible; - daNote.x = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].x; - if (!daNote.isSustainNote) - daNote.angle = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].angle; - daNote.alpha = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].alpha; - } - - - - if (daNote.isSustainNote) - daNote.x += daNote.width / 2 + 17; - - - //trace(daNote.y); - // WIP interpolation shit? Need to fix the pause issue - // daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * PlayState.SONG.speed)); - - if ((daNote.mustPress && daNote.tooLate && !PlayStateChangeables.useDownscroll || daNote.mustPress && daNote.tooLate && PlayStateChangeables.useDownscroll) && daNote.mustPress) - { - if (daNote.isSustainNote && daNote.wasGoodHit) - { - daNote.kill(); - notes.remove(daNote, true); } else { - if (loadRep && daNote.isSustainNote) + var swagRect = new FlxRect(0, 0, daNote.frameWidth * 2, daNote.frameHeight * 2); + swagRect.height = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + + Note.swagWidth / 2 + - daNote.y) / daNote.scale.y; + swagRect.y = daNote.frameHeight - swagRect.height; + + daNote.clipRect = swagRect; + } + } + } + else + { + if (daNote.mustPress) + daNote.y = (playerStrums.members[Math.floor(Math.abs(daNote.noteData))].y + - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, + 2)); + else + daNote.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + - 0.45 * (Conductor.songPosition - daNote.strumTime) * FlxMath.roundDecimal(PlayStateChangeables.scrollSpeed == 1 ? SONG.speed : PlayStateChangeables.scrollSpeed, + 2)); + if (daNote.isSustainNote) + { + daNote.y -= daNote.height / 2; + + if (!PlayStateChangeables.botPlay) + { + if ((!daNote.mustPress || daNote.wasGoodHit || daNote.prevNote.wasGoodHit && !daNote.canBeHit) + && daNote.y + daNote.offset.y * daNote.scale.y <= (strumLine.y + Note.swagWidth / 2)) { - // im tired and lazy this sucks I know i'm dumb - if (findByTime(daNote.strumTime) != null) - totalNotesHit += 1; - else - { - health -= 0.075; - vocals.volume = 0; - if (theFunne) - noteMiss(daNote.noteData, daNote); - } - } - else - { - health -= 0.075; - vocals.volume = 0; - if (theFunne) - noteMiss(daNote.noteData, daNote); + // Clip to strumline + var swagRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y); + swagRect.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + + Note.swagWidth / 2 + - daNote.y) / daNote.scale.y; + swagRect.height -= swagRect.y; + + daNote.clipRect = swagRect; } } - - daNote.visible = false; - daNote.kill(); - notes.remove(daNote, true); + else + { + var swagRect = new FlxRect(0, 0, daNote.width / daNote.scale.x, daNote.height / daNote.scale.y); + swagRect.y = (strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].y + + Note.swagWidth / 2 + - daNote.y) / daNote.scale.y; + swagRect.height -= swagRect.y; + + daNote.clipRect = swagRect; + } } + } + } + + if (!daNote.mustPress && daNote.wasGoodHit) + { + if (SONG.song != 'Tutorial') + camZooming = true; + + var altAnim:String = ""; + + if (SONG.notes[Math.floor(curStep / 16)] != null) + { + if (SONG.notes[Math.floor(curStep / 16)].altAnim) + altAnim = '-alt'; + } - }); - } + // Accessing the animation name directly to play it + var singData:Int = Std.int(Math.abs(daNote.noteData)); + dad.playAnim('sing' + dataSuffix[singData] + altAnim, true); + + switch (Math.abs(daNote.noteData)) + { + case 2: + dad.playAnim('singUP' + altAnim, true); + case 3: + dad.playAnim('singRIGHT' + altAnim, true); + case 1: + dad.playAnim('singDOWN' + altAnim, true); + case 0: + dad.playAnim('singLEFT' + altAnim, true); + } + + if (FlxG.save.data.cpuStrums) + { + cpuStrums.forEach(function(spr:FlxSprite) + { + if (Math.abs(daNote.noteData) == spr.ID) + { + spr.animation.play('confirm', true); + } + if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school')) + { + spr.centerOffsets(); + spr.offset.x -= 13; + spr.offset.y -= 13; + } + else + spr.centerOffsets(); + }); + } + + #if windows + if (luaModchart != null) + luaModchart.executeState('playerTwoSing', [Math.abs(daNote.noteData), Conductor.songPosition]); + #end + + dad.holdTimer = 0; + + if (SONG.needsVoices) + vocals.volume = 1; + + daNote.active = false; + + daNote.kill(); + notes.remove(daNote, true); + daNote.destroy(); + } + + if (daNote.mustPress && !daNote.modifiedByLua) + { + daNote.visible = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].visible; + daNote.x = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].x; + if (!daNote.isSustainNote) + daNote.angle = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].angle; + daNote.alpha = playerStrums.members[Math.floor(Math.abs(daNote.noteData))].alpha; + } + else if (!daNote.wasGoodHit && !daNote.modifiedByLua) + { + daNote.visible = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].visible; + daNote.x = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].x; + if (!daNote.isSustainNote) + daNote.angle = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].angle; + daNote.alpha = strumLineNotes.members[Math.floor(Math.abs(daNote.noteData))].alpha; + } + + if (daNote.isSustainNote) + daNote.x += daNote.width / 2 + 17; + + // trace(daNote.y); + // WIP interpolation shit? Need to fix the pause issue + // daNote.y = (strumLine.y - (songTime - daNote.strumTime) * (0.45 * PlayState.SONG.speed)); + + if ((daNote.mustPress && daNote.tooLate && !PlayStateChangeables.useDownscroll || daNote.mustPress && daNote.tooLate + && PlayStateChangeables.useDownscroll) + && daNote.mustPress) + { + if (daNote.isSustainNote && daNote.wasGoodHit) + { + daNote.kill(); + notes.remove(daNote, true); + } + else + { + if (loadRep && daNote.isSustainNote) + { + // im tired and lazy this sucks I know i'm dumb + if (findByTime(daNote.strumTime) != null) + totalNotesHit += 1; + else + { + health -= 0.075; + vocals.volume = 0; + if (theFunne) + noteMiss(daNote.noteData, daNote); + } + } + else + { + health -= 0.075; + vocals.volume = 0; + if (theFunne) + noteMiss(daNote.noteData, daNote); + } + } + + daNote.visible = false; + daNote.kill(); + notes.remove(daNote, true); + } + }); + } if (FlxG.save.data.cpuStrums) { @@ -2708,7 +2908,6 @@ class PlayState extends MusicBeatState if (!inCutscene && songStarted) keyShit(); - #if debug if (FlxG.keys.justPressed.ONE) endSong(); @@ -2717,15 +2916,15 @@ class PlayState extends MusicBeatState function endSong():Void { - FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN,handleInput); - FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP,releaseInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_DOWN, handleInput); + FlxG.stage.removeEventListener(KeyboardEvent.KEY_UP, releaseInput); if (useVideo) - { - GlobalVideo.get().stop(); - FlxG.stage.window.onFocusOut.remove(focusOut); - FlxG.stage.window.onFocusIn.remove(focusIn); - PlayState.instance.remove(PlayState.instance.videoSprite); - } + { + GlobalVideo.get().stop(); + FlxG.stage.window.onFocusOut.remove(focusOut); + FlxG.stage.window.onFocusIn.remove(focusIn); + PlayState.instance.remove(PlayState.instance.videoSprite); + } if (isStoryMode) campaignMisses = misses; @@ -2740,7 +2939,7 @@ class PlayState extends MusicBeatState } if (FlxG.save.data.fpsCap > 290) - (cast (Lib.current.getChildAt(0), Main)).setFPSCap(290); + (cast(Lib.current.getChildAt(0), Main)).setFPSCap(290); #if windows if (luaModchart != null) @@ -2760,9 +2959,12 @@ class PlayState extends MusicBeatState // adjusting the highscore song name to be compatible // would read original scores if we didn't change packages var songHighscore = StringTools.replace(PlayState.SONG.song, " ", "-"); - switch (songHighscore) { - case 'Dad-Battle': songHighscore = 'Dadbattle'; - case 'Philly-Nice': songHighscore = 'Philly'; + switch (songHighscore) + { + case 'Dad-Battle': + songHighscore = 'Dadbattle'; + case 'Philly-Nice': + songHighscore = 'Philly'; } #if !switch @@ -2821,12 +3023,14 @@ class PlayState extends MusicBeatState } else { - // adjusting the song name to be compatible var songFormat = StringTools.replace(PlayState.storyPlaylist[0], " ", "-"); - switch (songFormat) { - case 'Dad-Battle': songFormat = 'Dadbattle'; - case 'Philly-Nice': songFormat = 'Philly'; + switch (songFormat) + { + case 'Dad-Battle': + songFormat = 'Dadbattle'; + case 'Philly-Nice': + songFormat = 'Philly'; } var poop:String = Highscore.formatSong(songFormat, storyDifficulty); @@ -2849,7 +3053,6 @@ class PlayState extends MusicBeatState FlxTransitionableState.skipNextTransOut = true; prevCamFollow = camFollow; - PlayState.SONG = Song.loadFromJson(poop, PlayState.storyPlaylist[0]); FlxG.sound.music.stop(); @@ -2862,7 +3065,6 @@ class PlayState extends MusicBeatState paused = true; - FlxG.sound.music.stop(); vocals.stop(); @@ -2874,7 +3076,6 @@ class PlayState extends MusicBeatState } } - var endingSong:Bool = false; var hits:Array = []; @@ -2884,73 +3085,71 @@ class PlayState extends MusicBeatState var currentTimingShown:FlxText = null; private function popUpScore(daNote:Note):Void + { + var noteDiff:Float = -(daNote.strumTime - Conductor.songPosition); + var wife:Float = EtternaFunctions.wife3(-noteDiff, Conductor.timeScale); + // boyfriend.playAnim('hey'); + vocals.volume = 1; + var placement:String = Std.string(combo); + + var coolText:FlxText = new FlxText(0, 0, 0, placement, 32); + coolText.screenCenter(); + coolText.x = FlxG.width * 0.55; + coolText.y -= 350; + coolText.cameras = [camHUD]; + // + + var rating:FlxSprite = new FlxSprite(); + var score:Float = 350; + + if (FlxG.save.data.accuracyMod == 1) + totalNotesHit += wife; + + var daRating = daNote.rating; + + switch (daRating) { - var noteDiff:Float = -(daNote.strumTime - Conductor.songPosition); - var wife:Float = EtternaFunctions.wife3(-noteDiff, Conductor.timeScale); - // boyfriend.playAnim('hey'); - vocals.volume = 1; - var placement:String = Std.string(combo); - - var coolText:FlxText = new FlxText(0, 0, 0, placement, 32); - coolText.screenCenter(); - coolText.x = FlxG.width * 0.55; - coolText.y -= 350; - coolText.cameras = [camHUD]; - // - - var rating:FlxSprite = new FlxSprite(); - var score:Float = 350; + case 'shit': + score = -300; + combo = 0; + misses++; + health -= 0.2; + ss = false; + shits++; + if (FlxG.save.data.accuracyMod == 0) + totalNotesHit -= 1; + case 'bad': + daRating = 'bad'; + score = 0; + health -= 0.06; + ss = false; + bads++; + if (FlxG.save.data.accuracyMod == 0) + totalNotesHit += 0.50; + case 'good': + daRating = 'good'; + score = 200; + ss = false; + goods++; + if (health < 2) + health += 0.04; + if (FlxG.save.data.accuracyMod == 0) + totalNotesHit += 0.75; + case 'sick': + if (health < 2) + health += 0.1; + if (FlxG.save.data.accuracyMod == 0) + totalNotesHit += 1; + sicks++; + } - if (FlxG.save.data.accuracyMod == 1) - totalNotesHit += wife; + // trace('Wife accuracy loss: ' + wife + ' | Rating: ' + daRating + ' | Score: ' + score + ' | Weight: ' + (1 - wife)); - var daRating = daNote.rating; - - switch(daRating) - { - case 'shit': - score = -300; - combo = 0; - misses++; - health -= 0.2; - ss = false; - shits++; - if (FlxG.save.data.accuracyMod == 0) - totalNotesHit -= 1; - case 'bad': - daRating = 'bad'; - score = 0; - health -= 0.06; - ss = false; - bads++; - if (FlxG.save.data.accuracyMod == 0) - totalNotesHit += 0.50; - case 'good': - daRating = 'good'; - score = 200; - ss = false; - goods++; - if (health < 2) - health += 0.04; - if (FlxG.save.data.accuracyMod == 0) - totalNotesHit += 0.75; - case 'sick': - if (health < 2) - health += 0.1; - if (FlxG.save.data.accuracyMod == 0) - totalNotesHit += 1; - sicks++; - } - - // trace('Wife accuracy loss: ' + wife + ' | Rating: ' + daRating + ' | Score: ' + score + ' | Weight: ' + (1 - wife)); - - if (daRating != 'shit' || daRating != 'bad') - { - - + if (daRating != 'shit' || daRating != 'bad') + { songScore += Math.round(score); songScoreDef += Math.round(ConvertScore.convertScore(noteDiff)); - + /* if (combo > 60) daRating = 'sick'; else if (combo > 12) @@ -2958,21 +3157,21 @@ class PlayState extends MusicBeatState else if (combo > 4) daRating = 'bad'; */ - + var pixelShitPart1:String = ""; var pixelShitPart2:String = ''; - + if (curStage.startsWith('school')) { pixelShitPart1 = 'weeb/pixelUI/'; pixelShitPart2 = '-pixel'; } - + rating.loadGraphic(Paths.image(pixelShitPart1 + daRating + pixelShitPart2)); rating.screenCenter(); rating.y -= 50; rating.x = coolText.x - 125; - + if (FlxG.save.data.changedHit) { rating.x = FlxG.save.data.changedHitX; @@ -2981,19 +3180,20 @@ class PlayState extends MusicBeatState rating.acceleration.y = 550; rating.velocity.y -= FlxG.random.int(140, 175); rating.velocity.x -= FlxG.random.int(0, 10); - + var msTiming = HelperFunctions.truncateFloat(noteDiff, 3); - if(PlayStateChangeables.botPlay && !loadRep) msTiming = 0; - + if (PlayStateChangeables.botPlay && !loadRep) + msTiming = 0; + if (loadRep) msTiming = HelperFunctions.truncateFloat(findByTime(daNote.strumTime)[3], 3); if (currentTimingShown != null) remove(currentTimingShown); - currentTimingShown = new FlxText(0,0,0,"0ms"); + currentTimingShown = new FlxText(0, 0, 0, "0ms"); timeShown = 0; - switch(daRating) + switch (daRating) { case 'shit' | 'bad': currentTimingShown.color = FlxColor.RED; @@ -3010,7 +3210,7 @@ class PlayState extends MusicBeatState if (msTiming >= 0.03 && offsetTesting) { - //Remove Outliers + // Remove Outliers hits.shift(); hits.shift(); hits.shift(); @@ -3021,19 +3221,18 @@ class PlayState extends MusicBeatState var total = 0.0; - for(i in hits) + for (i in hits) total += i; - - - offsetTest = HelperFunctions.truncateFloat(total / hits.length,2); + offsetTest = HelperFunctions.truncateFloat(total / hits.length, 2); } if (currentTimingShown.alpha != 1) currentTimingShown.alpha = 1; - if(!PlayStateChangeables.botPlay || loadRep) add(currentTimingShown); - + if (!PlayStateChangeables.botPlay || loadRep) + add(currentTimingShown); + var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2)); comboSpr.screenCenter(); comboSpr.x = rating.x; @@ -3046,11 +3245,12 @@ class PlayState extends MusicBeatState currentTimingShown.y = rating.y + 100; currentTimingShown.acceleration.y = 600; currentTimingShown.velocity.y -= 150; - + comboSpr.velocity.x += FlxG.random.int(1, 10); currentTimingShown.velocity.x += comboSpr.velocity.x; - if(!PlayStateChangeables.botPlay || loadRep) add(rating); - + if (!PlayStateChangeables.botPlay || loadRep) + add(rating); + if (!curStage.startsWith('school')) { rating.setGraphicSize(Std.int(rating.width * 0.7)); @@ -3063,17 +3263,17 @@ class PlayState extends MusicBeatState rating.setGraphicSize(Std.int(rating.width * daPixelZoom * 0.7)); comboSpr.setGraphicSize(Std.int(comboSpr.width * daPixelZoom * 0.7)); } - + currentTimingShown.updateHitbox(); comboSpr.updateHitbox(); rating.updateHitbox(); - + currentTimingShown.cameras = [camHUD]; comboSpr.cameras = [camHUD]; rating.cameras = [camHUD]; var seperatedScore:Array = []; - + var comboSplit:Array = (combo + "").split(''); if (combo > highestCombo) @@ -3088,12 +3288,12 @@ class PlayState extends MusicBeatState else if (comboSplit.length == 2) seperatedScore.push(0); - for(i in 0...comboSplit.length) + for (i in 0...comboSplit.length) { var str:String = comboSplit[i]; seperatedScore.push(Std.parseInt(str)); } - + var daLoop:Int = 0; for (i in seperatedScore) { @@ -3113,13 +3313,13 @@ class PlayState extends MusicBeatState numScore.setGraphicSize(Std.int(numScore.width * daPixelZoom)); } numScore.updateHitbox(); - + numScore.acceleration.y = FlxG.random.int(200, 300); numScore.velocity.y -= FlxG.random.int(140, 160); numScore.velocity.x = FlxG.random.float(-5, 5); - + add(numScore); - + FlxTween.tween(numScore, {alpha: 0}, 0.2, { onComplete: function(tween:FlxTween) { @@ -3127,17 +3327,17 @@ class PlayState extends MusicBeatState }, startDelay: Conductor.crochet * 0.002 }); - + daLoop++; } /* trace(combo); trace(seperatedScore); */ - + coolText.text = Std.string(seperatedScore); // add(coolText); - + FlxTween.tween(rating, {alpha: 0}, 0.2, { startDelay: Conductor.crochet * 0.001, onUpdate: function(tween:FlxTween) @@ -3162,329 +3362,340 @@ class PlayState extends MusicBeatState }, startDelay: Conductor.crochet * 0.001 }); - + curSection += 1; - } } + } public function NearlyEquals(value1:Float, value2:Float, unimportantDifference:Float = 10):Bool + { + return Math.abs(FlxMath.roundDecimal(value1, 1) - FlxMath.roundDecimal(value2, 1)) < unimportantDifference; + } + + var upHold:Bool = false; + var downHold:Bool = false; + var rightHold:Bool = false; + var leftHold:Bool = false; + + // THIS FUNCTION JUST FUCKS WIT HELD NOTES AND BOTPLAY/REPLAY (also gamepad shit) + + private function keyShit():Void // I've invested in emma stocks + { + // control arrays, order L D R U + var holdArray:Array = [controls.LEFT, controls.DOWN, controls.UP, controls.RIGHT]; + var pressArray:Array = [controls.LEFT_P, controls.DOWN_P, controls.UP_P, controls.RIGHT_P]; + var releaseArray:Array = [controls.LEFT_R, controls.DOWN_R, controls.UP_R, controls.RIGHT_R]; + #if windows + if (luaModchart != null) { - return Math.abs(FlxMath.roundDecimal(value1, 1) - FlxMath.roundDecimal(value2, 1)) < unimportantDifference; + if (controls.LEFT_P) + { + luaModchart.executeState('keyPressed', ["left"]); + }; + if (controls.DOWN_P) + { + luaModchart.executeState('keyPressed', ["down"]); + }; + if (controls.UP_P) + { + luaModchart.executeState('keyPressed', ["up"]); + }; + if (controls.RIGHT_P) + { + luaModchart.executeState('keyPressed', ["right"]); + }; + }; + #end + + var nonCpp = false; + + // Prevent player input if botplay is on + if (PlayStateChangeables.botPlay) + { + holdArray = [false, false, false, false]; + pressArray = [false, false, false, false]; + releaseArray = [false, false, false, false]; } - var upHold:Bool = false; - var downHold:Bool = false; - var rightHold:Bool = false; - var leftHold:Bool = false; + #if !cpp + nonCpp = true; + #end - // THIS FUNCTION JUST FUCKS WIT HELD NOTES AND BOTPLAY/REPLAY (also gamepad shit) + var anas:Array = [null, null, null, null]; - private function keyShit():Void // I've invested in emma stocks + for (i in 0...pressArray.length) + if (pressArray[i]) + anas[i] = new Ana(Conductor.songPosition, null, false, "miss", i); + + // HOLDS, check for sustain notes + if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic) + { + notes.forEachAlive(function(daNote:Note) { - // control arrays, order L D R U - var holdArray:Array = [controls.LEFT, controls.DOWN, controls.UP, controls.RIGHT]; - var pressArray:Array = [ - controls.LEFT_P, - controls.DOWN_P, - controls.UP_P, - controls.RIGHT_P - ]; - var releaseArray:Array = [ - controls.LEFT_R, - controls.DOWN_R, - controls.UP_R, - controls.RIGHT_R - ]; - #if windows - if (luaModchart != null){ - if (controls.LEFT_P){luaModchart.executeState('keyPressed',["left"]);}; - if (controls.DOWN_P){luaModchart.executeState('keyPressed',["down"]);}; - if (controls.UP_P){luaModchart.executeState('keyPressed',["up"]);}; - if (controls.RIGHT_P){luaModchart.executeState('keyPressed',["right"]);}; - }; - #end - - var nonCpp = false; + if (daNote.isSustainNote && daNote.canBeHit && daNote.mustPress && holdArray[daNote.noteData]) + goodNoteHit(daNote); + }); + } - - // Prevent player input if botplay is on - if(PlayStateChangeables.botPlay) - { - holdArray = [false, false, false, false]; - pressArray = [false, false, false, false]; - releaseArray = [false, false, false, false]; - } + if ((KeyBinds.gamepad && !FlxG.keys.justPressed.ANY) || nonCpp) + { + // PRESSES, check for note hits + if (pressArray.contains(true) && generatedMusic) + { + boyfriend.holdTimer = 0; - #if !cpp - nonCpp = true; - #end + var possibleNotes:Array = []; // notes that can be hit + var directionList:Array = []; // directions that can be hit + var dumbNotes:Array = []; // notes to kill later + var directionsAccounted:Array = [false, false, false, false]; // we don't want to do judgments for more than one presses - var anas:Array = [null,null,null,null]; - - for (i in 0...pressArray.length) - if (pressArray[i]) - anas[i] = new Ana(Conductor.songPosition, null, false, "miss", i); - - // HOLDS, check for sustain notes - if (holdArray.contains(true) && /*!boyfriend.stunned && */ generatedMusic) - { - notes.forEachAlive(function(daNote:Note) - { - if (daNote.isSustainNote && daNote.canBeHit && daNote.mustPress && holdArray[daNote.noteData]) - goodNoteHit(daNote); - }); - } - - if ((KeyBinds.gamepad && !FlxG.keys.justPressed.ANY) || nonCpp) - { - // PRESSES, check for note hits - if (pressArray.contains(true) && generatedMusic) - { - boyfriend.holdTimer = 0; - - var possibleNotes:Array = []; // notes that can be hit - var directionList:Array = []; // directions that can be hit - var dumbNotes:Array = []; // notes to kill later - var directionsAccounted:Array = [false,false,false,false]; // we don't want to do judgments for more than one presses - - notes.forEachAlive(function(daNote:Note) - { - if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit && !directionsAccounted[daNote.noteData]) - { - if (directionList.contains(daNote.noteData)) - { - directionsAccounted[daNote.noteData] = true; - for (coolNote in possibleNotes) - { - if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10) - { // if it's the same note twice at < 10ms distance, just delete it - // EXCEPT u cant delete it in this loop cuz it fucks with the collection lol - dumbNotes.push(daNote); - break; - } - else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime) - { // if daNote is earlier than existing note (coolNote), replace - possibleNotes.remove(coolNote); - possibleNotes.push(daNote); - break; - } - } - } - else - { - possibleNotes.push(daNote); - directionList.push(daNote.noteData); - } - } - }); - - for (note in dumbNotes) - { - FlxG.log.add("killing dumb ass note at " + note.strumTime); - note.kill(); - notes.remove(note, true); - note.destroy(); - } - - possibleNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime)); - if (perfectMode) - goodNoteHit(possibleNotes[0]); - else if (possibleNotes.length > 0) - { - if (!FlxG.save.data.ghost) - { - for (shit in 0...pressArray.length) - { // if a direction is hit that shouldn't be - if (pressArray[shit] && !directionList.contains(shit)) - noteMiss(shit, null); - } - } - for (coolNote in possibleNotes) - { - if (pressArray[coolNote.noteData]) - { - if (mashViolations != 0) - mashViolations--; - scoreTxt.color = FlxColor.WHITE; - var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition); - anas[coolNote.noteData].hit = true; - anas[coolNote.noteData].hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000)); - anas[coolNote.noteData].nearestNote = [coolNote.strumTime,coolNote.noteData,coolNote.sustainLength]; - goodNoteHit(coolNote); - } - } - } - else if (!FlxG.save.data.ghost) - { - for (shit in 0...pressArray.length) - if (pressArray[shit]) - noteMiss(shit, null); - } - } - - if (!loadRep) - for (i in anas) - if (i != null) - replayAna.anaArray.push(i); // put em all there - } notes.forEachAlive(function(daNote:Note) { - if(PlayStateChangeables.useDownscroll && daNote.y > strumLine.y || - !PlayStateChangeables.useDownscroll && daNote.y < strumLine.y) + if (daNote.canBeHit && daNote.mustPress && !daNote.tooLate && !daNote.wasGoodHit && !directionsAccounted[daNote.noteData]) { - // Force good note hit regardless if it's too late to hit it or not as a fail safe - if(PlayStateChangeables.botPlay && daNote.canBeHit && daNote.mustPress || - PlayStateChangeables.botPlay && daNote.tooLate && daNote.mustPress) + if (directionList.contains(daNote.noteData)) { - if(loadRep) + directionsAccounted[daNote.noteData] = true; + for (coolNote in possibleNotes) { - //trace('ReplayNote ' + tmpRepNote.strumtime + ' | ' + tmpRepNote.direction); - var n = findByTime(daNote.strumTime); - trace(n); - if(n != null) - { - goodNoteHit(daNote); - boyfriend.holdTimer = daNote.sustainLength; + if (coolNote.noteData == daNote.noteData && Math.abs(daNote.strumTime - coolNote.strumTime) < 10) + { // if it's the same note twice at < 10ms distance, just delete it + // EXCEPT u cant delete it in this loop cuz it fucks with the collection lol + dumbNotes.push(daNote); + break; + } + else if (coolNote.noteData == daNote.noteData && daNote.strumTime < coolNote.strumTime) + { // if daNote is earlier than existing note (coolNote), replace + possibleNotes.remove(coolNote); + possibleNotes.push(daNote); + break; } - }else { - goodNoteHit(daNote); - boyfriend.holdTimer = daNote.sustainLength; } } + else + { + possibleNotes.push(daNote); + directionList.push(daNote.noteData); + } } }); + + for (note in dumbNotes) + { + FlxG.log.add("killing dumb ass note at " + note.strumTime); + note.kill(); + notes.remove(note, true); + note.destroy(); + } + + possibleNotes.sort((a, b) -> Std.int(a.strumTime - b.strumTime)); + if (perfectMode) + goodNoteHit(possibleNotes[0]); + else if (possibleNotes.length > 0) + { + if (!FlxG.save.data.ghost) + { + for (shit in 0...pressArray.length) + { // if a direction is hit that shouldn't be + if (pressArray[shit] && !directionList.contains(shit)) + noteMiss(shit, null); + } + } + for (coolNote in possibleNotes) + { + if (pressArray[coolNote.noteData]) + { + if (mashViolations != 0) + mashViolations--; + scoreTxt.color = FlxColor.WHITE; + var noteDiff:Float = -(coolNote.strumTime - Conductor.songPosition); + anas[coolNote.noteData].hit = true; + anas[coolNote.noteData].hitJudge = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000)); + anas[coolNote.noteData].nearestNote = [coolNote.strumTime, coolNote.noteData, coolNote.sustainLength]; + goodNoteHit(coolNote); + } + } + }; if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && (!holdArray.contains(true) || PlayStateChangeables.botPlay)) { if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss') && boyfriend.animation.curAnim.curFrame >= 10) boyfriend.playAnim('idle'); } - - playerStrums.forEach(function(spr:FlxSprite) + else if (!FlxG.save.data.ghost) { - if (pressArray[spr.ID] && spr.animation.curAnim.name != 'confirm') - spr.animation.play('pressed'); - if (!holdArray[spr.ID]) - spr.animation.play('static'); - - if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school')) + for (shit in 0...pressArray.length) + if (pressArray[shit]) + noteMiss(shit, null); + } + } + + if (!loadRep) + for (i in anas) + if (i != null) + replayAna.anaArray.push(i); // put em all there + } + notes.forEachAlive(function(daNote:Note) + { + if (PlayStateChangeables.useDownscroll && daNote.y > strumLine.y || !PlayStateChangeables.useDownscroll && daNote.y < strumLine.y) + { + // Force good note hit regardless if it's too late to hit it or not as a fail safe + if (PlayStateChangeables.botPlay && daNote.canBeHit && daNote.mustPress || PlayStateChangeables.botPlay && daNote.tooLate && daNote.mustPress) + { + if (loadRep) { - spr.centerOffsets(); - spr.offset.x -= 13; - spr.offset.y -= 13; + // trace('ReplayNote ' + tmpRepNote.strumtime + ' | ' + tmpRepNote.direction); + var n = findByTime(daNote.strumTime); + trace(n); + if (n != null) + { + goodNoteHit(daNote); + boyfriend.holdTimer = daNote.sustainLength; + } } else - spr.centerOffsets(); - }); - } - - public function findByTime(time:Float):Array - { - for (i in rep.replay.songNotes) { - //trace('checking ' + Math.round(i[0]) + ' against ' + Math.round(time)); - if (i[0] == time) - return i; + goodNoteHit(daNote); + boyfriend.holdTimer = daNote.sustainLength; } - return null; } - - public function findByTimeIndex(time:Float):Int - { - for (i in 0...rep.replay.songNotes.length) - { - //trace('checking ' + Math.round(i[0]) + ' against ' + Math.round(time)); - if (rep.replay.songNotes[i][0] == time) - return i; - } - return -1; - } - - public var fuckingVolume:Float = 1; - public var useVideo = false; - - public static var webmHandler:WebmHandler; - - public var playingDathing = false; - - public var videoSprite:FlxSprite; - - public function focusOut() { - if (paused) - return; - persistentUpdate = false; - persistentDraw = true; - paused = true; - - if (FlxG.sound.music != null) - { - FlxG.sound.music.pause(); - vocals.pause(); - } - - openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); } - public function focusIn() - { - // nada + }); + + if (boyfriend.holdTimer > Conductor.stepCrochet * 4 * 0.001 && (!holdArray.contains(true) || PlayStateChangeables.botPlay)) + { + if (boyfriend.animation.curAnim.name.startsWith('sing') && !boyfriend.animation.curAnim.name.endsWith('miss')) + boyfriend.playAnim('idle'); + } + + playerStrums.forEach(function(spr:FlxSprite) + { + if (pressArray[spr.ID] && spr.animation.curAnim.name != 'confirm') + spr.animation.play('pressed'); + if (!holdArray[spr.ID]) + spr.animation.play('static'); + + if (spr.animation.curAnim.name == 'confirm' && !curStage.startsWith('school')) + { + spr.centerOffsets(); + spr.offset.x -= 13; + spr.offset.y -= 13; } + else + spr.centerOffsets(); + }); + } + public function findByTime(time:Float):Array + { + for (i in rep.replay.songNotes) + { + // trace('checking ' + Math.round(i[0]) + ' against ' + Math.round(time)); + if (i[0] == time) + return i; + } + return null; + } - public function backgroundVideo(source:String) // for background videos - { - #if cpp - useVideo = true; - - FlxG.stage.window.onFocusOut.add(focusOut); - FlxG.stage.window.onFocusIn.add(focusIn); + public function findByTimeIndex(time:Float):Int + { + for (i in 0...rep.replay.songNotes.length) + { + // trace('checking ' + Math.round(i[0]) + ' against ' + Math.round(time)); + if (rep.replay.songNotes[i][0] == time) + return i; + } + return -1; + } - var ourSource:String = "assets/videos/daWeirdVid/dontDelete.webm"; - WebmPlayer.SKIP_STEP_LIMIT = 90; - var str1:String = "WEBM SHIT"; - webmHandler = new WebmHandler(); - webmHandler.source(ourSource); - webmHandler.makePlayer(); - webmHandler.webm.name = str1; - - GlobalVideo.setWebm(webmHandler); + public var fuckingVolume:Float = 1; + public var useVideo = false; - GlobalVideo.get().source(source); - GlobalVideo.get().clearPause(); - if (GlobalVideo.isWebm) - { - GlobalVideo.get().updatePlayer(); - } - GlobalVideo.get().show(); - - if (GlobalVideo.isWebm) - { - GlobalVideo.get().restart(); - } else { - GlobalVideo.get().play(); - } - - var data = webmHandler.webm.bitmapData; - - videoSprite = new FlxSprite(-470,-30).loadGraphic(data); - - videoSprite.setGraphicSize(Std.int(videoSprite.width * 1.2)); - - remove(gf); - remove(boyfriend); - remove(dad); - add(videoSprite); - add(gf); - add(boyfriend); - add(dad); - - trace('poggers'); - - if (!songStarted) - webmHandler.pause(); - else - webmHandler.resume(); - #end - } + public static var webmHandler:WebmHandler; + + public var playingDathing = false; + + public var videoSprite:FlxSprite; + + public function focusOut() + { + if (paused) + return; + persistentUpdate = false; + persistentDraw = true; + paused = true; + + if (FlxG.sound.music != null) + { + FlxG.sound.music.pause(); + vocals.pause(); + } + + openSubState(new PauseSubState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y)); + } + + public function focusIn() + { + // nada + } + + public function backgroundVideo(source:String) // for background videos + { + #if cpp + useVideo = true; + + FlxG.stage.window.onFocusOut.add(focusOut); + FlxG.stage.window.onFocusIn.add(focusIn); + + var ourSource:String = "assets/videos/daWeirdVid/dontDelete.webm"; + WebmPlayer.SKIP_STEP_LIMIT = 90; + var str1:String = "WEBM SHIT"; + webmHandler = new WebmHandler(); + webmHandler.source(ourSource); + webmHandler.makePlayer(); + webmHandler.webm.name = str1; + + GlobalVideo.setWebm(webmHandler); + + GlobalVideo.get().source(source); + GlobalVideo.get().clearPause(); + if (GlobalVideo.isWebm) + { + GlobalVideo.get().updatePlayer(); + } + GlobalVideo.get().show(); + + if (GlobalVideo.isWebm) + { + GlobalVideo.get().restart(); + } + else + { + GlobalVideo.get().play(); + } + + var data = webmHandler.webm.bitmapData; + + videoSprite = new FlxSprite(-470, -30).loadGraphic(data); + + videoSprite.setGraphicSize(Std.int(videoSprite.width * 1.2)); + + remove(gf); + remove(boyfriend); + remove(dad); + add(videoSprite); + add(gf); + add(boyfriend); + add(dad); + + trace('poggers'); + + if (!songStarted) + webmHandler.pause(); + else + webmHandler.resume(); + #end + } function noteMiss(direction:Int = 1, daNote:Note):Void { @@ -3502,19 +3713,28 @@ class PlayState extends MusicBeatState { if (!loadRep) { - saveNotes.push([daNote.strumTime,0,direction,166 * Math.floor((PlayState.rep.replay.sf / 60) * 1000) / 166]); + saveNotes.push([ + daNote.strumTime, + 0, + direction, + 166 * Math.floor((PlayState.rep.replay.sf / 60) * 1000) / 166 + ]); saveJudge.push("miss"); } } - else - if (!loadRep) - { - saveNotes.push([Conductor.songPosition,0,direction,166 * Math.floor((PlayState.rep.replay.sf / 60) * 1000) / 166]); - saveJudge.push("miss"); - } + else if (!loadRep) + { + saveNotes.push([ + Conductor.songPosition, + 0, + direction, + 166 * Math.floor((PlayState.rep.replay.sf / 60) * 1000) / 166 + ]); + saveJudge.push("miss"); + } - //var noteDiff:Float = Math.abs(daNote.strumTime - Conductor.songPosition); - //var wife:Float = EtternaFunctions.wife3(noteDiff, FlxG.save.data.etternaMode ? 1 : 1.7); + // var noteDiff:Float = Math.abs(daNote.strumTime - Conductor.songPosition); + // var wife:Float = EtternaFunctions.wife3(noteDiff, FlxG.save.data.etternaMode ? 1 : 1.7); if (FlxG.save.data.accuracyMod == 1) totalNotesHit -= 1; @@ -3533,38 +3753,36 @@ class PlayState extends MusicBeatState luaModchart.executeState('playerOneMiss', [direction, Conductor.songPosition]); #end - updateAccuracy(); } } /*function badNoteCheck() - { - // just double pasting this shit cuz fuk u - // REDO THIS SYSTEM! - var upP = controls.UP_P; - var rightP = controls.RIGHT_P; - var downP = controls.DOWN_P; - var leftP = controls.LEFT_P; - - if (leftP) - noteMiss(0); - if (upP) - noteMiss(2); - if (rightP) - noteMiss(3); - if (downP) - noteMiss(1); - updateAccuracy(); - } - */ - function updateAccuracy() - { - totalPlayed += 1; - accuracy = Math.max(0,totalNotesHit / totalPlayed * 100); - accuracyDefault = Math.max(0, totalNotesHitDefault / totalPlayed * 100); - } + { + // just double pasting this shit cuz fuk u + // REDO THIS SYSTEM! + var upP = controls.UP_P; + var rightP = controls.RIGHT_P; + var downP = controls.DOWN_P; + var leftP = controls.LEFT_P; + if (leftP) + noteMiss(0); + if (upP) + noteMiss(2); + if (rightP) + noteMiss(3); + if (downP) + noteMiss(1); + updateAccuracy(); + } + */ + function updateAccuracy() + { + totalPlayed += 1; + accuracy = Math.max(0, totalNotesHit / totalPlayed * 100); + accuracyDefault = Math.max(0, totalNotesHitDefault / totalPlayed * 100); + } function getKeyPresses(note:Note):Int { @@ -3582,19 +3800,19 @@ class PlayState extends MusicBeatState return possibleNotes.length + 1; return possibleNotes.length; } - + var mashing:Int = 0; var mashViolations:Int = 0; var etternaModeScore:Int = 0; function noteCheck(controlArray:Array, note:Note):Void // sorry lol - { - var noteDiff:Float = -(note.strumTime - Conductor.songPosition); + { + var noteDiff:Float = -(note.strumTime - Conductor.songPosition); - note.rating = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000)); + note.rating = Ratings.CalculateRating(noteDiff, Math.floor((PlayStateChangeables.safeFrames / 60) * 1000)); - /* if (loadRep) + /* if (loadRep) { if (controlArray[note.noteData]) goodNoteHit(note, false); @@ -3605,13 +3823,13 @@ class PlayState extends MusicBeatState goodNoteHit(note, false); } } - } */ - - if (controlArray[note.noteData]) - { - goodNoteHit(note, (mashing > getKeyPresses(note))); - - /*if (mashing > getKeyPresses(note) && mashViolations <= 2) + }*/ + + if (controlArray[note.noteData]) + { + goodNoteHit(note, (mashing > getKeyPresses(note))); + + /*if (mashing > getKeyPresses(note) && mashViolations <= 2) { mashViolations++; @@ -3630,42 +3848,78 @@ class PlayState extends MusicBeatState mashing = 0; } else - goodNoteHit(note, false);*/ - - } + goodNoteHit(note, false); */ } + } - function goodNoteHit(note:Note, resetMashViolation = true):Void + function goodNoteHit(note:Note, resetMashViolation = true):Void + { + if (mashing != 0) + mashing = 0; + + var noteDiff:Float = -(note.strumTime - Conductor.songPosition); + + if (loadRep) + { + noteDiff = findByTime(note.strumTime)[3]; + note.rating = rep.replay.songJudgements[findByTimeIndex(note.strumTime)]; + } + else + note.rating = Ratings.CalculateRating(noteDiff); + + if (note.rating == "miss") + return; + + // add newest note to front of notesHitArray + // the oldest notes are at the end and are removed first + if (!note.isSustainNote) + notesHitArray.unshift(Date.now()); + + if (!resetMashViolation && mashViolations >= 1) + mashViolations--; + + if (mashViolations < 0) + mashViolations = 0; + + if (!note.wasGoodHit) + { + if (!note.isSustainNote) { + popUpScore(note); + combo += 1; + } + else + totalNotesHit += 1; - if (mashing != 0) - mashing = 0; + switch (note.noteData) + { + case 2: + boyfriend.playAnim('singUP', true); + case 3: + boyfriend.playAnim('singRIGHT', true); + case 1: + boyfriend.playAnim('singDOWN', true); + case 0: + boyfriend.playAnim('singLEFT', true); + } - var noteDiff:Float = -(note.strumTime - Conductor.songPosition); + #if windows + if (luaModchart != null) + luaModchart.executeState('playerOneSing', [note.noteData, Conductor.songPosition]); + #end - if(loadRep) - { - noteDiff = findByTime(note.strumTime)[3]; - note.rating = rep.replay.songJudgements[findByTimeIndex(note.strumTime)]; - } - else - note.rating = Ratings.CalculateRating(noteDiff); + if (!loadRep && note.mustPress) + { + var array = [note.strumTime, note.sustainLength, note.noteData, noteDiff]; + if (note.isSustainNote) + array[1] = -1; + saveNotes.push(array); + saveJudge.push(note.rating); + } - if (note.rating == "miss") - return; - - // add newest note to front of notesHitArray - // the oldest notes are at the end and are removed first - if (!note.isSustainNote) - notesHitArray.unshift(Date.now()); - - if (!resetMashViolation && mashViolations >= 1) - mashViolations--; - - if (mashViolations < 0) - mashViolations = 0; - - if (!note.wasGoodHit) + playerStrums.forEach(function(spr:FlxSprite) + { + if (Math.abs(note.noteData) == spr.ID) { if (!note.isSustainNote) { @@ -3674,50 +3928,28 @@ class PlayState extends MusicBeatState } else totalNotesHit += 1; - - var singData:Int = Std.int(note.noteData); - boyfriend.playAnim('sing' + dataSuffix[singData], true); - + #if windows if (luaModchart != null) luaModchart.executeState('playerOneSing', [note.noteData, Conductor.songPosition]); #end - - - if(!loadRep && note.mustPress) - { - var array = [note.strumTime,note.sustainLength,note.noteData,noteDiff]; - if (note.isSustainNote) - array[1] = -1; - saveNotes.push(array); - saveJudge.push(note.rating); - } - - playerStrums.forEach(function(spr:FlxSprite) - { - if (Math.abs(note.noteData) == spr.ID) - { - spr.animation.play('confirm', true); - } - }); - - note.wasGoodHit = true; - vocals.volume = 1; - - note.kill(); - notes.remove(note, true); - note.destroy(); - - updateAccuracy(); + spr.animation.play('confirm', true); } - } - + }); + note.kill(); + notes.remove(note, true); + note.destroy(); + + updateAccuracy(); + } + } var fastCarCanDrive:Bool = true; function resetFastCar():Void { - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { fastCar.x = -12600; fastCar.y = FlxG.random.int(140, 250); fastCar.velocity.x = 0; @@ -3727,7 +3959,8 @@ class PlayState extends MusicBeatState function fastCarDrive() { - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { FlxG.sound.play(Paths.soundRandom('carPass', 0, 1), 0.7); fastCar.velocity.x = (FlxG.random.int(170, 220) / FlxG.elapsed) * 3; @@ -3748,7 +3981,8 @@ class PlayState extends MusicBeatState function trainStart():Void { - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { trainMoving = true; if (!trainSound.playing) trainSound.play(true); @@ -3759,36 +3993,37 @@ class PlayState extends MusicBeatState function updateTrainPos():Void { - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { if (trainSound.time >= 4700) - { - startedMoving = true; - gf.playAnim('hairBlow'); - } - - if (startedMoving) - { - phillyTrain.x -= 400; - - if (phillyTrain.x < -2000 && !trainFinishing) - { - phillyTrain.x = -1150; - trainCars -= 1; - - if (trainCars <= 0) - trainFinishing = true; - } - - if (phillyTrain.x < -4000 && trainFinishing) - trainReset(); - } - } + { + startedMoving = true; + gf.playAnim('hairBlow'); + } + if (startedMoving) + { + phillyTrain.x -= 400; + + if (phillyTrain.x < -2000 && !trainFinishing) + { + phillyTrain.x = -1150; + trainCars -= 1; + + if (trainCars <= 0) + trainFinishing = true; + } + + if (phillyTrain.x < -4000 && trainFinishing) + trainReset(); + } + } } function trainReset():Void { - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { gf.playAnim('hairFall'); phillyTrain.x = FlxG.width + 200; trainMoving = false; @@ -3825,8 +4060,8 @@ class PlayState extends MusicBeatState #if windows if (executeModchart && luaModchart != null) { - luaModchart.setVar('curStep',curStep); - luaModchart.executeState('stepHit',[curStep]); + luaModchart.setVar('curStep', curStep); + luaModchart.executeState('stepHit', [curStep]); } #end @@ -3838,9 +4073,22 @@ class PlayState extends MusicBeatState songLength = FlxG.sound.music.length; // Updating Discord Rich Presence (with Time Left) - DiscordClient.changePresence(detailsText + " " + SONG.song + " (" + storyDifficultyText + ") " + Ratings.GenerateLetterRank(accuracy), "Acc: " + HelperFunctions.truncateFloat(accuracy, 2) + "% | Score: " + songScore + " | Misses: " + misses , iconRPC,true, songLength - Conductor.songPosition); + DiscordClient.changePresence(detailsText + + " " + + SONG.song + + " (" + + storyDifficultyText + + ") " + + Ratings.GenerateLetterRank(accuracy), + "Acc: " + + HelperFunctions.truncateFloat(accuracy, 2) + + "% | Score: " + + songScore + + " | Misses: " + + misses, iconRPC, true, + songLength + - Conductor.songPosition); #end - } var lightningStrikeBeat:Int = 0; @@ -3858,12 +4106,13 @@ class PlayState extends MusicBeatState #if windows if (executeModchart && luaModchart != null) { - luaModchart.setVar('curBeat',curBeat); - luaModchart.executeState('beatHit',[curBeat]); + luaModchart.setVar('curBeat', curBeat); + luaModchart.executeState('beatHit', [curBeat]); } #end - if (curSong == 'Tutorial' && dad.curCharacter == 'gf') { + if (curSong == 'Tutorial' && dad.curCharacter == 'gf') + { if (curBeat % 2 == 1 && dad.animOffsets.exists('danceLeft')) dad.playAnim('danceLeft'); if (curBeat % 2 == 0 && dad.animOffsets.exists('danceRight')) @@ -3895,18 +4144,17 @@ class PlayState extends MusicBeatState FlxG.camera.zoom += 0.015; camHUD.zoom += 0.03; } - + if (camZooming && FlxG.camera.zoom < 1.35 && curBeat % 4 == 0) { FlxG.camera.zoom += 0.015; camHUD.zoom += 0.03; } - } iconP1.setGraphicSize(Std.int(iconP1.width + 30)); iconP2.setGraphicSize(Std.int(iconP2.width + 30)); - + iconP1.updateHitbox(); iconP2.updateHitbox(); @@ -3919,7 +4167,7 @@ class PlayState extends MusicBeatState { boyfriend.playAnim('idle'); } - + if (!dad.animation.curAnim.name.startsWith("sing")) { dad.dance(); @@ -3931,58 +4179,62 @@ class PlayState extends MusicBeatState } if (curBeat % 16 == 15 && SONG.song == 'Tutorial' && dad.curCharacter == 'gf' && curBeat > 16 && curBeat < 48) - { - boyfriend.playAnim('hey', true); - dad.playAnim('cheer', true); - } + { + boyfriend.playAnim('hey', true); + dad.playAnim('cheer', true); + } switch (curStage) { case 'school': - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { bgGirls.dance(); } case 'mall': - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { upperBoppers.animation.play('bop', true); bottomBoppers.animation.play('bop', true); santa.animation.play('idle', true); } case 'limo': - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { grpLimoDancers.forEach(function(dancer:BackgroundDancer) - { - dancer.dance(); - }); - - if (FlxG.random.bool(10) && fastCarCanDrive) - fastCarDrive(); + { + dancer.dance(); + }); + + if (FlxG.random.bool(10) && fastCarCanDrive) + fastCarDrive(); } case "philly": - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { if (!trainMoving) trainCooldown += 1; - + if (curBeat % 4 == 0) { phillyCityLights.forEach(function(light:FlxSprite) { light.visible = false; }); - + curLight = FlxG.random.int(0, phillyCityLights.length - 1); - + phillyCityLights.members[curLight].visible = true; // phillyCityLights.members[curLight].alpha = 1; - } - + } } if (curBeat % 8 == 4 && FlxG.random.bool(30) && !trainMoving && trainCooldown > 8) { - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { trainCooldown = FlxG.random.int(-4, 0); trainStart(); } @@ -3991,7 +4243,8 @@ class PlayState extends MusicBeatState if (isHalloween && FlxG.random.bool(10) && curBeat > lightningStrikeBeat + lightningOffset) { - if(FlxG.save.data.distractions){ + if (FlxG.save.data.distractions) + { lightningStrikeShit(); } }