diff --git a/source/ChartingState.hx b/source/ChartingState.hx index 8e959f9..4371fad 100644 --- a/source/ChartingState.hx +++ b/source/ChartingState.hx @@ -1239,7 +1239,7 @@ class ChartingState extends MusicBeatState var daStrumTime = i[0]; var daSus = i[2]; - var note:Note = new Note(daStrumTime, daNoteInfo % 4); + var note:Note = new Note(daStrumTime, daNoteInfo % 4,null,false,true); note.sustainLength = daSus; note.setGraphicSize(GRID_SIZE, GRID_SIZE); note.updateHitbox(); diff --git a/source/HitGraph.hx b/source/HitGraph.hx index e3b3790..7b1d383 100644 --- a/source/HitGraph.hx +++ b/source/HitGraph.hx @@ -1,3 +1,4 @@ +import flixel.FlxG; import openfl.display.Bitmap; import openfl.display.BitmapData; import openfl.text.TextFieldAutoSize; @@ -29,6 +30,8 @@ class HitGraph extends Sprite public var minValue:Float = -(Math.floor((PlayState.rep.replay.sf / 60) * 1000) + 95); public var maxValue:Float = Math.floor((PlayState.rep.replay.sf / 60) * 1000) + 95; + public var showInput:Bool = FlxG.save.data.inputShow; + public var graphColor:FlxColor; public var history:Array = []; @@ -185,14 +188,33 @@ class HitGraph extends Sprite drawJudgementLine(-166); gfx.endFill(); - - var inc:Float = _width / (PlayState.rep.replay.songNotes.length); var range:Float = Math.max(maxValue - minValue, maxValue * 0.1); var graphX = _axis.x + 1; + if (showInput) + { + for (i in 0...PlayState.rep.replay.ana.anaArray.length) + { + var ana = PlayState.rep.replay.ana.anaArray[i]; + + var value = (ana.key * 25 - minValue) / range; + + if (ana.hit) + gfx.beginFill(0xFFFF00); + else + gfx.beginFill(0xC2B280); + + if (ana.hitTime < 0) + continue; + + var pointY = (-value * _height - 1) + _height; + gfx.drawRect(graphX + fitX(ana.hitTime), pointY,2,2); + gfx.endFill(); + } + } + for (i in 0...history.length) { - var value = (history[i][0] - minValue) / range; var judge = history[i][1]; @@ -212,21 +234,28 @@ class HitGraph extends Sprite gfx.beginFill(0xFFFFFF); } var pointY = (-value * _height - 1) + _height; + /*if (i == 0) gfx.moveTo(graphX, _axis.y + pointY);*/ - gfx.drawRect(graphX + (i * inc), pointY,4,4); + gfx.drawRect(graphX + fitX(history[i][2]), pointY,4,4); gfx.endFill(); } + var bm = new BitmapData(_width,_height); bm.draw(this); bitmap = new Bitmap(bm); } - public function addToHistory(diff:Float, judge:String) + public function fitX(x:Float) { - history.push([diff,judge]); + return (x / FlxG.sound.music.length) * width; + } + + public function addToHistory(diff:Float, judge:String, time:Float) + { + history.push([diff,judge, time]); } public function update():Void diff --git a/source/KadeEngineData.hx b/source/KadeEngineData.hx index 0a8204d..f69fb5f 100644 --- a/source/KadeEngineData.hx +++ b/source/KadeEngineData.hx @@ -87,6 +87,9 @@ class KadeEngineData if (FlxG.save.data.scoreScreen == null) FlxG.save.data.scoreScreen = true; + if (FlxG.save.data.inputShow == null) + FlxG.save.data.inputShow = false; + Conductor.recalculateTimings(); PlayerSettings.player1.controls.loadKeyBinds(); KeyBinds.keyCheck(); diff --git a/source/Note.hx b/source/Note.hx index 1eb3977..cdb9cb2 100644 --- a/source/Note.hx +++ b/source/Note.hx @@ -37,7 +37,7 @@ class Note extends FlxSprite public var rating:String = "shit"; - public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false) + public function new(strumTime:Float, noteData:Int, ?prevNote:Note, ?sustainNote:Bool = false, ?inCharter:Bool = false) { super(); @@ -50,7 +50,10 @@ class Note extends FlxSprite x += 50; // MAKE SURE ITS DEFINITELY OFF SCREEN? y -= 2000; - this.strumTime = strumTime; + if (inCharter) + this.strumTime = strumTime; + else + this.strumTime = Math.round(strumTime); if (this.strumTime < 0 ) this.strumTime = 0; diff --git a/source/Options.hx b/source/Options.hx index 4ed6a5f..c763b2c 100644 --- a/source/Options.hx +++ b/source/Options.hx @@ -261,6 +261,27 @@ class FlashingLightsOption extends Option } } +class ShowInput extends Option +{ + public function new(desc:String) + { + super(); + description = desc; + } + public override function press():Bool + { + FlxG.save.data.inputShow = !FlxG.save.data.inputShow; + display = updateDisplay(); + return true; + } + + private override function updateDisplay():String + { + return (FlxG.save.data.inputShow ? "Extended Score Info" : "Minimalized Info"); + } +} + + class Judgement extends Option { diff --git a/source/OptionsMenu.hx b/source/OptionsMenu.hx index 28aa34b..a79ade3 100644 --- a/source/OptionsMenu.hx +++ b/source/OptionsMenu.hx @@ -58,7 +58,8 @@ class OptionsMenu extends MusicBeatState new FlashingLightsOption("Toggle flashing lights that can cause epileptic seizures and strain."), new WatermarkOption("Enable and disable all watermarks from the engine."), new BotPlay("Showcase your charts and mods with autoplay."), - new ScoreScreen("Show the score screen after the end of a song") + new ScoreScreen("Show the score screen after the end of a song"), + new ShowInput("Display every single input in the score screen.") ]) ]; diff --git a/source/PlayState.hx b/source/PlayState.hx index eea9212..6e3ccac 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -1,5 +1,7 @@ package; +import Replay.Ana; +import Replay.Analysis; import webm.WebmPlayer; import flixel.input.keyboard.FlxKey; import haxe.Exception; @@ -213,6 +215,7 @@ class PlayState extends MusicBeatState // Replay shit private var saveNotes:Array = []; private var saveJudge:Array = []; + private var replayAna:Analysis = new Analysis(); // replay analysis public static var highestCombo:Int = 0; @@ -1475,7 +1478,7 @@ class PlayState extends MusicBeatState for (songNotes in section.sectionNotes) { - var daStrumTime:Float = Math.round(songNotes[0]) + FlxG.save.data.offset + songOffset; + var daStrumTime:Float = songNotes[0] + FlxG.save.data.offset + songOffset; if (daStrumTime < 0) daStrumTime = 0; var daNoteData:Int = Std.int(songNotes[1] % 4); @@ -1975,7 +1978,7 @@ class PlayState extends MusicBeatState FlxG.switchState(new Charting()); */ #if debug - if (FlxG.keys.justPressed.EIGHT) + if (FlxG.keys.justPressed.SIX) { if (useVideo) { @@ -2564,7 +2567,7 @@ class PlayState extends MusicBeatState campaignMisses = misses; if (!loadRep) - rep.SaveReplay(saveNotes, saveJudge); + rep.SaveReplay(saveNotes, saveJudge, replayAna); else { PlayStateChangeables.botPlay = false; @@ -3039,6 +3042,7 @@ class PlayState extends MusicBeatState }; #end + // Prevent player input if botplay is on if(PlayStateChangeables.botPlay) { @@ -3046,6 +3050,13 @@ class PlayState extends MusicBeatState pressArray = [false, false, false, false]; releaseArray = [false, false, false, false]; } + + 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) { @@ -3137,6 +3148,10 @@ class PlayState extends MusicBeatState 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); } } @@ -3148,19 +3163,12 @@ class PlayState extends MusicBeatState noteMiss(shit, null); } - if(dontCheck && possibleNotes.length > 0 && FlxG.save.data.ghost && !PlayStateChangeables.botPlay) - { - if (mashViolations > 8) - { - trace('mash violations ' + mashViolations); - scoreTxt.color = FlxColor.RED; - noteMiss(0,null); - } - else - mashViolations++; - } - } + + if (!loadRep) + for (i in anas) + if (i != null) + replayAna.anaArray.push(i); // put em all there notes.forEachAlive(function(daNote:Note) { diff --git a/source/Ratings.hx b/source/Ratings.hx index 4eec39d..c0d8593 100644 --- a/source/Ratings.hx +++ b/source/Ratings.hx @@ -122,18 +122,18 @@ class Ratings var rating = "miss"; if (ms <= 166 * ts && ms >= 135 * ts) rating = "shit"; - if (ms >= -166 * ts && ms <= -135 * ts) - rating = "shit"; - if (ms <= 135 * ts && ms >= 90 * ts) + if (ms < 135 * ts && ms >= 90 * ts) rating = "bad"; - if (ms >= -135 * ts && ms <= -90 * ts) - rating = "bad"; - if (ms <= 90 * ts && ms >= 45 * ts) + if (ms < 90 * ts && ms >= 45 * ts) rating = "good"; - if (ms >= -90 * ts && ms <= -45 * ts) - rating = "good"; - if (ms <= 45 * ts && ms >= -45 * ts) + if (ms < 45 * ts && ms >= -45 * ts) rating = "sick"; + if (ms > -90 * ts && ms <= -45 * ts) + rating = "good"; + if (ms > -135 * ts && ms <= -90 * ts) + rating = "bad"; + if (ms > -166 * ts && ms <= -135 * ts) + rating = "shit"; return rating; } diff --git a/source/Replay.hx b/source/Replay.hx index 92d9c1e..18ce656 100644 --- a/source/Replay.hx +++ b/source/Replay.hx @@ -17,6 +17,14 @@ class Ana public var nearestNote:Array; public var hit:Bool; public var hitJudge:String; + public var key:Int; + public function new(_hitTime:Float,_nearestNote:Array,_hit:Bool,_hitJudge:String, _key:Int) { + hitTime = _hitTime; + nearestNote = _nearestNote; + hit = _hit; + hitJudge = _hitJudge; + key = _key; + } } class Analysis @@ -76,7 +84,7 @@ class Replay return rep; } - public function SaveReplay(notearray:Array, judge:Array) + public function SaveReplay(notearray:Array, judge:Array, ana:Analysis) { var json = { "songName": PlayState.SONG.song, @@ -88,7 +96,7 @@ class Replay "timestamp": Date.now(), "replayGameVer": version, "sf": Conductor.safeFrames, - + "ana": ana }; var data:String = Json.stringify(json); @@ -101,6 +109,8 @@ class Replay path = "replay-" + PlayState.SONG.song + "-time" + time + ".kadeReplay"; // for score screen shit LoadFromJSON(); + + replay.ana = ana; #end } diff --git a/source/ResultsScreen.hx b/source/ResultsScreen.hx index 036b71a..8541ccc 100644 --- a/source/ResultsScreen.hx +++ b/source/ResultsScreen.hx @@ -126,11 +126,13 @@ class ResultsScreen extends FlxSubState // judgement var obj2 = PlayState.rep.replay.songJudgements[i]; + var obj3 = obj[0]; + var diff = obj[3]; var judge = obj2; mean += diff; if (obj[1] != -1) - graph.addToHistory(diff, judge); + graph.addToHistory(diff, judge, obj3); } graph.update(); @@ -186,6 +188,12 @@ class ResultsScreen extends FlxSubState FlxG.switchState(new FreeplayState()); } + if (FlxG.keys.justPressed.EIGHT) + { + graph.showInput = !graph.showInput; + graph.update(); + } + if (FlxG.keys.justPressed.F1) { trace(PlayState.rep.path);