From 83a9f484ef947c15e7fbab7c7c1fc946e57b3c88 Mon Sep 17 00:00:00 2001 From: KadeDev Date: Sun, 4 Apr 2021 14:10:45 -0700 Subject: [PATCH] like a lot of things lmaooo --- source/ConvertScore.hx | 21 +++++++++ source/KadeEngineData.hx | 9 ++-- source/Options.hx | 99 ++++++++++++++++++++++++++++++++++++++-- source/OptionsMenu.hx | 82 +++++++++++++++------------------ source/PlayState.hx | 55 ++++++---------------- source/Ratings.hx | 30 ++++++++++++ 6 files changed, 203 insertions(+), 93 deletions(-) create mode 100644 source/ConvertScore.hx create mode 100644 source/Ratings.hx diff --git a/source/ConvertScore.hx b/source/ConvertScore.hx new file mode 100644 index 0000000..9eba969 --- /dev/null +++ b/source/ConvertScore.hx @@ -0,0 +1,21 @@ +class ConvertScore +{ + public static function convertScore(noteDiff:Float):Int + { + var daRating:String = Ratings.CalculateRating(noteDiff, 166); + + switch(daRating) + { + case 'shit': + return -300; + case 'bad': + return 0; + case 'good': + return 200; + case 'sick': + return 350; + } + return 0; + } + +} \ No newline at end of file diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index 458de55..da31db7 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -26,9 +26,6 @@ class KadeEngineData if (FlxG.save.data.songPosition == null) FlxG.save.data.songPosition = false; - if (FlxG.save.data.etternaMode == null) - FlxG.save.data.etternaMode = false; - if (FlxG.save.data.fps == null) FlxG.save.data.fps = false; @@ -54,6 +51,12 @@ class KadeEngineData if (FlxG.save.data.npsDisplay == null) FlxG.save.data.npsDisplay = false; + if (FlxG.save.data.frames == null) + FlxG.save.data.frames = 10; + + Conductor.safeFrames = FlxG.save.data.frames; + Conductor.safeZoneOffset = (Conductor.safeFrames / 60) * 1000; + (cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap); } } diff --git a/source/Options.hx b/source/Options.hx index f4e6e20..771d548 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -45,19 +45,28 @@ class Option } private var description:String = ""; private var display:String; + private var acceptValues:Bool = false; public final function getDisplay():String { return display; } + public final function getAccept():Bool + { + return acceptValues; + } + public final function getDescription():String { return description; } + // Returns whether the label is to be updated. public function press():Bool { return throw "stub!"; } private function updateDisplay():String { return throw "stub!"; } + public function left():Bool { return throw "stub!"; } + public function right():Bool { return throw "stub!"; } } class DFJKOption extends Option @@ -150,24 +159,55 @@ class SongPositionOption extends Option } } -class EtternaModeOption extends Option +class Judgement extends Option { + + public function new(desc:String) { super(); description = desc; + acceptValues = true; } public override function press():Bool { - FlxG.save.data.etternaMode = !FlxG.save.data.etternaMode; - display = updateDisplay(); return true; } private override function updateDisplay():String { - return "Etterna Mode " + (!FlxG.save.data.etternaMode ? "off" : "on"); + return "Safe Frames"; + } + + override function left():Bool { + Conductor.safeFrames -= 1; + FlxG.save.data.frames = Conductor.safeFrames; + + Conductor.safeZoneOffset = (Conductor.safeFrames / 60) * 1000; + + OptionsMenu.versionShit.text = "Current Safe Frames: " + Conductor.safeFrames + " - Description - " + description + + " - SIK: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset * 0.25, 0) + + "ms GD: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset * 0.40, 0) + + "ms BD: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset * 0.50, 0) + + "ms SHT: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset * 0.70, 0) + + "ms TOTAL: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset,0) + "ms"; + return true; + } + + override function right():Bool { + Conductor.safeFrames += 1; + FlxG.save.data.frames = Conductor.safeFrames; + + Conductor.safeZoneOffset = (Conductor.safeFrames / 60) * 1000; + + OptionsMenu.versionShit.text = "Current Safe Frames: " + Conductor.safeFrames + " - Description - " + description + + " - SIK: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset * 0.25, 0) + + "ms GD: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset * 0.40, 0) + + "ms BD: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset * 0.50, 0) + + "ms SHT: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset * 0.70, 0) + + "ms TOTAL: " + OptionsMenu.truncateFloat(Conductor.safeZoneOffset,0) + "ms"; + return true; } } @@ -199,6 +239,7 @@ class FPSCapOption extends Option { super(); description = desc; + acceptValues = true; } public override function press():Bool @@ -210,6 +251,28 @@ class FPSCapOption extends Option { return "FPS Cap"; } + + override function right():Bool { + if (FlxG.save.data.fpsCap > 290) + return false; + FlxG.save.data.fpsCap = FlxG.save.data.fpsCap + 10; + (cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap); + + OptionsMenu.versionShit.text = "Current FPS Cap: " + FlxG.save.data.fpsCap + " - Description - " + description; + + return true; + } + + override function left():Bool { + if (FlxG.save.data.fpsCap < 60) + return false; + FlxG.save.data.fpsCap = FlxG.save.data.fpsCap - 10; + (cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap); + + OptionsMenu.versionShit.text = "Current FPS Cap: " + FlxG.save.data.fpsCap + " - Description - " + description; + + return true; + } } @@ -219,6 +282,7 @@ class ScrollSpeedOption extends Option { super(); description = desc; + acceptValues = true; } public override function press():Bool @@ -230,6 +294,33 @@ class ScrollSpeedOption extends Option { return "Scroll Speed"; } + + override function right():Bool { + FlxG.save.data.scrollSpeed += 0.1; + + if (FlxG.save.data.scrollSpeed < 1) + FlxG.save.data.scrollSpeed = 1; + + if (FlxG.save.data.scrollSpeed > 10) + FlxG.save.data.scrollSpeed = 10; + + OptionsMenu.versionShit.text = "Current Scroll Speed: " + OptionsMenu.truncateFloat(FlxG.save.data.scrollSpeed,1) + " - Description - " + description; + return true; + } + + override function left():Bool { + FlxG.save.data.scrollSpeed -= 0.1; + + if (FlxG.save.data.scrollSpeed < 1) + FlxG.save.data.scrollSpeed = 1; + + if (FlxG.save.data.scrollSpeed > 10) + FlxG.save.data.scrollSpeed = 10; + + + OptionsMenu.versionShit.text = "Current Scroll Speed: " + OptionsMenu.truncateFloat(FlxG.save.data.scrollSpeed,1) + " - Description - " + description; + return true; + } } diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 35af037..f732001 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -22,7 +22,10 @@ class OptionsMenu extends MusicBeatState var options:Array = [ new OptionCatagory("Gameplay", [ new DFJKOption(controls), - new FPSCapOption("Cap your FPS (Left for -10, Right for -10)"), + new Judgement("Customize your Hit Timings (LEFT or RIGHT)"), + #if !html + new FPSCapOption("Cap your FPS (Left for -10, Right for -10. SHIFT to go faster)"), + #end new ScrollSpeedOption("Change your scroll speed (Left for -0.1, right for +0.1. If its at 1, it will be chart dependent)"), new OffsetMenu("Get a note offset based off of your inputs!"), new CustomizeGameplay("Drag'n'Drop Gameplay Modules around to your preference") @@ -30,22 +33,24 @@ class OptionsMenu extends MusicBeatState new OptionCatagory("Appearence", [ new SongPositionOption("Show the songs current position (as a bar)"), new DownscrollOption("Change the layout of the strumline."), + #if !html new RainbowFPSOption("Make the FPS Counter Rainbow (Only works with the FPS Counter toggeled on)"), + #end new AccuracyOption("Display accuracy information."), new NPSDisplayOption("Shows your current Notes Per Second.") ]), + #if !mobile new OptionCatagory("Misc", [ - new EtternaModeOption("Harder Hit Windows and a different scoring system."), - #if !mobile + new FPSOption("Toggle the FPS Counter"), - #end new ReplayOption("View replays") ]) + #end ]; private var currentDescription:String = ""; private var grpControls:FlxTypedGroup; - var versionShit:FlxText; + public static var versionShit:FlxText; var currentSelectedCat:OptionCatagory; @@ -84,7 +89,7 @@ class OptionsMenu extends MusicBeatState var isCat:Bool = false; - function truncateFloat( number : Float, precision : Int): Float { + public static function truncateFloat( number : Float, precision : Int): Float { var num = number; num = num * Math.pow(10, precision); num = Math.round( num ) / Math.pow(10, precision); @@ -118,51 +123,36 @@ class OptionsMenu extends MusicBeatState if (isCat) { - switch(currentSelectedCat.getOptions()[curSelected].getDisplay()) + if (currentSelectedCat.getOptions()[curSelected].getAccept()) { - case 'FPS Cap': - var fps = (cast (Lib.current.getChildAt(0), Main)).getFPSCap(); - - if (FlxG.keys.pressed.RIGHT && fps < 285) // actual cap is 285 + if (FlxG.keys.pressed.SHIFT) { - (cast (Lib.current.getChildAt(0), Main)).setFPSCap(fps + 10); - FlxG.save.data.fpsCap = fps + 10; + if (FlxG.keys.pressed.RIGHT) + currentSelectedCat.getOptions()[curSelected].right(); + if (FlxG.keys.pressed.LEFT) + currentSelectedCat.getOptions()[curSelected].left(); } - - if (FlxG.keys.pressed.LEFT && fps > 60) - { - (cast (Lib.current.getChildAt(0), Main)).setFPSCap(fps - 10); - FlxG.save.data.fpsCap = fps - 10; - } - - versionShit.text = "Current FPS Cap: " + fps + " - Description - " + currentDescription; - - - case 'Scroll Speed': + else + { if (FlxG.keys.justPressed.RIGHT) - FlxG.save.data.scrollSpeed += 0.1; - + currentSelectedCat.getOptions()[curSelected].right(); if (FlxG.keys.justPressed.LEFT) - FlxG.save.data.scrollSpeed -= 0.1; - - // caps - - if (FlxG.save.data.scrollSpeed < 1) - FlxG.save.data.scrollSpeed = 1; - - if (FlxG.save.data.scrollSpeed > 10) - FlxG.save.data.scrollSpeed = 10; - - - versionShit.text = "Current Scroll Speed: " + truncateFloat(FlxG.save.data.scrollSpeed,1) + " - Description - " + currentDescription; - default: + currentSelectedCat.getOptions()[curSelected].left(); + } + } + else + { + if (FlxG.keys.pressed.SHIFT) if (FlxG.keys.pressed.RIGHT) - FlxG.save.data.offset += 0.01; - - if (FlxG.keys.pressed.LEFT) - FlxG.save.data.offset -= 0.01; - - versionShit.text = "Offset (Left, Right): " + truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription; + FlxG.save.data.offset += 1; + else if (FlxG.keys.pressed.LEFT) + FlxG.save.data.offset -= 1; + else if (controls.RIGHT_P) + FlxG.save.data.offset += 0.1; + else if (controls.LEFT_P) + FlxG.save.data.offset -= 0.1; + + versionShit.text = "Offset (Left, Right, Shift to go faster): " + truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription; } } else @@ -173,7 +163,7 @@ class OptionsMenu extends MusicBeatState if (FlxG.keys.pressed.LEFT) FlxG.save.data.offset-= 0.01; - versionShit.text = "Offset (Left, Right): " + truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription; + versionShit.text = "Offset (Left, Right, Shift to go faster): " + truncateFloat(FlxG.save.data.offset,2) + " - Description - " + currentDescription; } diff --git a/source/PlayState.hx b/source/PlayState.hx index 762695d..034c64e 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -107,7 +107,9 @@ class PlayState extends MusicBeatState private var combo:Int = 0; public static var misses:Int = 0; private 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; @@ -154,6 +156,7 @@ class PlayState extends MusicBeatState var talking:Bool = true; var songScore:Int = 0; + var songScoreDef:Int = 0; var scoreTxt:FlxText; var replayTxt:FlxText; @@ -176,12 +179,6 @@ class PlayState extends MusicBeatState override public function create() { - if (FlxG.save.data.etternaMode) - Conductor.safeFrames = 5; // 116ms hit window (j3-4) - else - Conductor.safeFrames = 10; // 166ms hit window (j1) - - if (FlxG.sound.music != null) FlxG.sound.music.stop(); @@ -257,6 +254,8 @@ class PlayState extends MusicBeatState Conductor.mapBPMChanges(SONG); Conductor.changeBPM(SONG.bpm); + trace('INFORMATION ABOUT WHAT U PLAYIN WIT:\nFRAMES: ' + Conductor.safeFrames + '\nZONE: ' + Conductor.safeZoneOffset); + switch (SONG.song.toLowerCase()) { case 'tutorial': @@ -1615,7 +1614,7 @@ class PlayState extends MusicBeatState { if (FlxG.save.data.accuracyDisplay) { - scoreTxt.text = (FlxG.save.data.npsDisplay ? "NPS: " + nps + " | " : "") + "Score:" + (FlxG.save.data.etternaMode ? Math.max(0,etternaModeScore) + " (" + songScore + ")" : "" + songScore) + " | Combo Breaks:" + misses + " | Accuracy:" + truncateFloat(accuracy, 2) + "% | " + generateRanking(); + scoreTxt.text = (FlxG.save.data.npsDisplay ? "NPS: " + nps + " | " : "") + "Score:" + (Conductor.safeFrames != 10 ? songScore + " (" + songScoreDef + ")" : "" + songScore) + " | Combo Breaks:" + misses + " | Accuracy:" + truncateFloat(accuracy, 2) + "% | " + generateRanking(); } else { @@ -2058,8 +2057,8 @@ class PlayState extends MusicBeatState private function popUpScore(daNote:Note):Void { - 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(Conductor.songPosition - daNote.strumTime); + var wife:Float = EtternaFunctions.wife3(noteDiff, 1.7); // boyfriend.playAnim('hey'); vocals.volume = 1; @@ -2107,9 +2106,6 @@ class PlayState extends MusicBeatState sicks++; } - if (FlxG.save.data.etternaMode) - etternaModeScore += Math.round(score / wife); - // trace('Wife accuracy loss: ' + wife + ' | Rating: ' + daRating + ' | Score: ' + score + ' | Weight: ' + (1 - wife)); if (daRating != 'shit' || daRating != 'bad') @@ -2117,6 +2113,7 @@ class PlayState extends MusicBeatState songScore += Math.round(score); + songScoreDef += Math.round(ConvertScore.convertScore(noteDiff)); /* if (combo > 60) daRating = 'sick'; @@ -2198,6 +2195,8 @@ class PlayState extends MusicBeatState add(currentTimingShown); + + var comboSpr:FlxSprite = new FlxSprite().loadGraphic(Paths.image(pixelShitPart1 + 'combo' + pixelShitPart2)); comboSpr.screenCenter(); comboSpr.x = rating.x; @@ -2463,14 +2462,7 @@ class PlayState extends MusicBeatState { var noteDiff:Float = Math.abs(daNote.strumTime - Conductor.songPosition); - if (noteDiff > Conductor.safeZoneOffset * 0.70 || noteDiff < Conductor.safeZoneOffset * -0.70) - daNote.rating = "shit"; - else if (noteDiff > Conductor.safeZoneOffset * 0.50 || noteDiff < Conductor.safeZoneOffset * -0.50) - daNote.rating = "bad"; - else if (noteDiff > Conductor.safeZoneOffset * 0.45 || noteDiff < Conductor.safeZoneOffset * -0.45) - daNote.rating = "good"; - else if (noteDiff < Conductor.safeZoneOffset * 0.44 && noteDiff > Conductor.safeZoneOffset * -0.44) - daNote.rating = "sick"; + daNote.rating = Ratings.CalculateRating(noteDiff); if (NearlyEquals(daNote.strumTime,rep.replay.keyPresses[repPresses].time, 30)) { @@ -2520,14 +2512,7 @@ class PlayState extends MusicBeatState { var noteDiff:Float = Math.abs(daNote.strumTime - Conductor.songPosition); - if (noteDiff > Conductor.safeZoneOffset * 0.70 || noteDiff < Conductor.safeZoneOffset * -0.70) - daNote.rating = "shit"; - else if (noteDiff > Conductor.safeZoneOffset * 0.50 || noteDiff < Conductor.safeZoneOffset * -0.50) - daNote.rating = "bad"; - else if (noteDiff > Conductor.safeZoneOffset * 0.45 || noteDiff < Conductor.safeZoneOffset * -0.45) - daNote.rating = "good"; - else if (noteDiff < Conductor.safeZoneOffset * 0.44 && noteDiff > Conductor.safeZoneOffset * -0.44) - daNote.rating = "sick"; + daNote.rating = Ratings.CalculateRating(noteDiff); goodNoteHit(daNote); trace('force note hit'); @@ -2776,12 +2761,9 @@ class PlayState extends MusicBeatState */ function updateAccuracy() { - if (misses > 0 || accuracy < 96) - fc = false; - else - fc = true; totalPlayed += 1; accuracy = Math.max(0,totalNotesHit / totalPlayed * 100); + accuracyDefault = Math.max(0, totalNotesHitDefault / totalPlayed * 100); } @@ -2870,14 +2852,7 @@ class PlayState extends MusicBeatState var noteDiff:Float = Math.abs(note.strumTime - Conductor.songPosition); - if (noteDiff > Conductor.safeZoneOffset * 0.70 || noteDiff < Conductor.safeZoneOffset * -0.70) - note.rating = "shit"; - else if (noteDiff > Conductor.safeZoneOffset * 0.50 || noteDiff < Conductor.safeZoneOffset * -0.50) - note.rating = "bad"; - else if (noteDiff > Conductor.safeZoneOffset * 0.45 || noteDiff < Conductor.safeZoneOffset * -0.45) - note.rating = "good"; - else if (noteDiff < Conductor.safeZoneOffset * 0.44 && noteDiff > Conductor.safeZoneOffset * -0.44) - note.rating = "sick"; + note.rating = Ratings.CalculateRating(noteDiff); if (!note.isSustainNote) notesHitArray.push(Date.now()); diff --git a/source/Ratings.hx b/source/Ratings.hx new file mode 100644 index 0000000..410d63c --- /dev/null +++ b/source/Ratings.hx @@ -0,0 +1,30 @@ +class Ratings +{ + public static function CalculateRating(noteDiff:Float, ?customSafeZone:Float):String + { + + if (customSafeZone == null) + { + Conductor.safeZoneOffset = (Conductor.safeFrames / 60) * 1000; + customSafeZone = Conductor.safeZoneOffset; + } + + + // I HATE THIS IF CONDITION + // IF LEMON SEES THIS I'M SORRY :( + + if (noteDiff > customSafeZone * 0.50) // way early + return "shit"; + else if (noteDiff > customSafeZone * 0.26) // early + return "bad"; + else if (noteDiff > customSafeZone * 0.20) // your kinda there + return "good"; + else if (noteDiff < customSafeZone * -0.20) // little late + return "good"; + else if (noteDiff < customSafeZone * -0.26) // late + return "bad"; + else if (noteDiff < customSafeZone * -0.50) // late as fuck + return "shit"; + return "sick"; + } +} \ No newline at end of file