Merge branch 'master' into patch-2
This commit is contained in:
commit
acd3836dd2
16
docs/changelogs/changelog-1.5.3.md
Normal file
16
docs/changelogs/changelog-1.5.3.md
Normal file
@ -0,0 +1,16 @@
|
||||
# Latest (master) changelog
|
||||
|
||||
Changes marked with 💖 will be listed in the short version of the changelog in `version.downloadMe`.
|
||||
|
||||
### Additions
|
||||
- Score Screen (💖)
|
||||
- Show your highest combo in the freeplay menu
|
||||
- New asset loading system (💖)
|
||||
- New Logo (💖)
|
||||
|
||||
### Changes
|
||||
- Rewrote the entire hit ranking system (💖)
|
||||
|
||||
### Bugfixes
|
||||
- NPS not showing if accuracy is disabled
|
||||
- Fixed song names so they don't crash (💖)
|
@ -1,6 +1,7 @@
|
||||
# Changelogs
|
||||
|
||||
- [Latest](latest) (Contains changes that are not in a release yet)
|
||||
- [1.5.3](changelog-1.5.3)
|
||||
- [1.5.2](changelog-1.5.2)
|
||||
- [1.5.1](changelog-1.5.1)
|
||||
- [1.5.0](changelog-1.5.0)
|
||||
|
@ -3,10 +3,10 @@
|
||||
Changes marked with 💖 will be listed in the short version of the changelog in `version.downloadMe`.
|
||||
|
||||
### Additions
|
||||
- Nothing here yet!
|
||||
- Nothing yet!
|
||||
|
||||
### Changes
|
||||
- Nothing here yet!
|
||||
- Nothing yet!
|
||||
|
||||
### Bugfixes
|
||||
- Nothing here yet!
|
||||
- Nothing yet!
|
@ -1,3 +1,5 @@
|
||||
import flixel.math.FlxMath;
|
||||
|
||||
class HelperFunctions
|
||||
{
|
||||
public static function truncateFloat( number : Float, precision : Int): Float {
|
||||
@ -6,4 +8,8 @@ class HelperFunctions
|
||||
num = Math.round( num ) / Math.pow(10, precision);
|
||||
return num;
|
||||
}
|
||||
|
||||
public static function GCD(a, b) {
|
||||
return b == 0 ? FlxMath.absInt(a) : GCD(b, a % b);
|
||||
}
|
||||
}
|
250
source/HitGraph.hx
Normal file
250
source/HitGraph.hx
Normal file
@ -0,0 +1,250 @@
|
||||
import openfl.display.Bitmap;
|
||||
import openfl.display.BitmapData;
|
||||
import openfl.text.TextFieldAutoSize;
|
||||
import flixel.system.FlxAssets;
|
||||
import openfl.text.TextFormat;
|
||||
import flash.display.Graphics;
|
||||
import flash.display.Shape;
|
||||
import flash.display.Sprite;
|
||||
import flash.text.TextField;
|
||||
import flash.text.TextFormatAlign;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.util.FlxColor;
|
||||
import flixel.util.FlxDestroyUtil;
|
||||
|
||||
/**
|
||||
* stolen from https://github.com/HaxeFlixel/flixel/blob/master/flixel/system/debug/stats/StatsGraph.hx
|
||||
*/
|
||||
class HitGraph extends Sprite
|
||||
{
|
||||
static inline var AXIS_COLOR:FlxColor = 0xffffff;
|
||||
static inline var AXIS_ALPHA:Float = 0.5;
|
||||
inline static var HISTORY_MAX:Int = 30;
|
||||
|
||||
public var minLabel:TextField;
|
||||
public var curLabel:TextField;
|
||||
public var maxLabel:TextField;
|
||||
public var avgLabel:TextField;
|
||||
|
||||
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 graphColor:FlxColor;
|
||||
|
||||
public var history:Array<Dynamic> = [];
|
||||
|
||||
public var bitmap:Bitmap;
|
||||
|
||||
var _axis:Shape;
|
||||
var _width:Int;
|
||||
var _height:Int;
|
||||
var _unit:String;
|
||||
var _labelWidth:Int;
|
||||
var _label:String;
|
||||
|
||||
public function new(X:Int, Y:Int, Width:Int, Height:Int)
|
||||
{
|
||||
super();
|
||||
x = X;
|
||||
y = Y;
|
||||
_width = Width;
|
||||
_height = Height;
|
||||
|
||||
var bm = new BitmapData(Width,Height);
|
||||
bm.draw(this);
|
||||
bitmap = new Bitmap(bm);
|
||||
|
||||
_axis = new Shape();
|
||||
_axis.x = _labelWidth + 10;
|
||||
|
||||
var ts = Math.floor((PlayState.rep.replay.sf / 60) * 1000) / 166;
|
||||
|
||||
var early = createTextField(10,10,FlxColor.WHITE,12);
|
||||
var late = createTextField(10,_height - 20,FlxColor.WHITE,12);
|
||||
|
||||
early.text = "Early (" + -166 * ts + "ms)";
|
||||
late.text = "Late (" + 166 * ts + "ms)";
|
||||
|
||||
addChild(early);
|
||||
addChild(late);
|
||||
|
||||
addChild(_axis);
|
||||
|
||||
drawAxes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Redraws the axes of the graph.
|
||||
*/
|
||||
function drawAxes():Void
|
||||
{
|
||||
var gfx = _axis.graphics;
|
||||
gfx.clear();
|
||||
gfx.lineStyle(1, AXIS_COLOR, AXIS_ALPHA);
|
||||
|
||||
// y-Axis
|
||||
gfx.moveTo(0, 0);
|
||||
gfx.lineTo(0, _height);
|
||||
|
||||
// x-Axis
|
||||
gfx.moveTo(0, _height);
|
||||
gfx.lineTo(_width, _height);
|
||||
|
||||
gfx.moveTo(0, _height / 2);
|
||||
gfx.lineTo(_width, _height / 2);
|
||||
|
||||
}
|
||||
|
||||
public static function createTextField(X:Float = 0, Y:Float = 0, Color:FlxColor = FlxColor.WHITE, Size:Int = 12):TextField
|
||||
{
|
||||
return initTextField(new TextField(), X, Y, Color, Size);
|
||||
}
|
||||
|
||||
public static function initTextField<T:TextField>(tf:T, X:Float = 0, Y:Float = 0, Color:FlxColor = FlxColor.WHITE, Size:Int = 12):T
|
||||
{
|
||||
tf.x = X;
|
||||
tf.y = Y;
|
||||
tf.multiline = false;
|
||||
tf.wordWrap = false;
|
||||
tf.embedFonts = true;
|
||||
tf.selectable = false;
|
||||
#if flash
|
||||
tf.antiAliasType = AntiAliasType.NORMAL;
|
||||
tf.gridFitType = GridFitType.PIXEL;
|
||||
#end
|
||||
tf.defaultTextFormat = new TextFormat("assets/fonts/vcr.ttf", Size, Color.to24Bit());
|
||||
tf.alpha = Color.alphaFloat;
|
||||
tf.autoSize = TextFieldAutoSize.LEFT;
|
||||
return tf;
|
||||
}
|
||||
|
||||
function drawJudgementLine(ms:Float):Void
|
||||
{
|
||||
|
||||
var gfx:Graphics = graphics;
|
||||
|
||||
gfx.lineStyle(1, graphColor, 0.3);
|
||||
|
||||
var ts = Math.floor((PlayState.rep.replay.sf / 60) * 1000) / 166;
|
||||
var range:Float = Math.max(maxValue - minValue, maxValue * 0.1);
|
||||
|
||||
var value = ((ms * ts) - minValue) / range;
|
||||
|
||||
var pointY = _axis.y + ((-value * _height - 1) + _height);
|
||||
|
||||
var graphX = _axis.x + 1;
|
||||
|
||||
if (ms == 45)
|
||||
gfx.moveTo(graphX, _axis.y + pointY);
|
||||
|
||||
var graphX = _axis.x + 1;
|
||||
|
||||
gfx.drawRect(graphX,pointY, _width,1);
|
||||
|
||||
gfx.lineStyle(1, graphColor, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Redraws the graph based on the values stored in the history.
|
||||
*/
|
||||
function drawGraph():Void
|
||||
{
|
||||
var gfx:Graphics = graphics;
|
||||
gfx.clear();
|
||||
gfx.lineStyle(1, graphColor, 1);
|
||||
|
||||
gfx.beginFill(0x00FF00);
|
||||
drawJudgementLine(45);
|
||||
gfx.endFill();
|
||||
|
||||
gfx.beginFill(0xFF0000);
|
||||
drawJudgementLine(90);
|
||||
gfx.endFill();
|
||||
|
||||
gfx.beginFill(0x8b0000);
|
||||
drawJudgementLine(135);
|
||||
gfx.endFill();
|
||||
|
||||
gfx.beginFill(0x580000);
|
||||
drawJudgementLine(166);
|
||||
gfx.endFill();
|
||||
|
||||
gfx.beginFill(0x00FF00);
|
||||
drawJudgementLine(-45);
|
||||
gfx.endFill();
|
||||
|
||||
gfx.beginFill(0xFF0000);
|
||||
drawJudgementLine(-90);
|
||||
gfx.endFill();
|
||||
|
||||
gfx.beginFill(0x8b0000);
|
||||
drawJudgementLine(-135);
|
||||
gfx.endFill();
|
||||
|
||||
gfx.beginFill(0x580000);
|
||||
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;
|
||||
|
||||
for (i in 0...history.length)
|
||||
{
|
||||
|
||||
var value = (history[i][0] - minValue) / range;
|
||||
var judge = history[i][1];
|
||||
|
||||
switch(judge)
|
||||
{
|
||||
case "sick":
|
||||
gfx.beginFill(0x00FFFF);
|
||||
case "good":
|
||||
gfx.beginFill(0x00FF00);
|
||||
case "bad":
|
||||
gfx.beginFill(0xFF0000);
|
||||
case "shit":
|
||||
gfx.beginFill(0x8b0000);
|
||||
case "miss":
|
||||
gfx.beginFill(0x580000);
|
||||
default:
|
||||
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.endFill();
|
||||
}
|
||||
|
||||
var bm = new BitmapData(_width,_height);
|
||||
bm.draw(this);
|
||||
bitmap = new Bitmap(bm);
|
||||
}
|
||||
|
||||
public function addToHistory(diff:Float, judge:String)
|
||||
{
|
||||
history.push([diff,judge]);
|
||||
}
|
||||
|
||||
public function update():Void
|
||||
{
|
||||
drawGraph();
|
||||
}
|
||||
|
||||
public function average():Float
|
||||
{
|
||||
var sum:Float = 0;
|
||||
for (value in history)
|
||||
sum += value;
|
||||
return sum / history.length;
|
||||
}
|
||||
|
||||
public function destroy():Void
|
||||
{
|
||||
_axis = FlxDestroyUtil.removeChild(this, _axis);
|
||||
history = null;
|
||||
}
|
||||
}
|
@ -84,6 +84,9 @@ class KadeEngineData
|
||||
if (FlxG.save.data.camzoom == null)
|
||||
FlxG.save.data.camzoom = true;
|
||||
|
||||
if (FlxG.save.data.scoreScreen == null)
|
||||
FlxG.save.data.scoreScreen = true;
|
||||
|
||||
Conductor.recalculateTimings();
|
||||
PlayerSettings.player1.controls.loadKeyBinds();
|
||||
KeyBinds.keyCheck();
|
||||
|
@ -148,23 +148,32 @@ class LoadReplayState extends MusicBeatState
|
||||
|
||||
PlayState.loadRep = true;
|
||||
|
||||
// adjusting the song name to be compatible
|
||||
var songFormat = StringTools.replace(PlayState.rep.replay.songName, " ", "-");
|
||||
switch (songFormat) {
|
||||
case 'Dad-Battle': songFormat = 'Dadbattle';
|
||||
case 'Philly-Nice': songFormat = 'Philly';
|
||||
// Replay v1.0 support
|
||||
case 'dad-battle': songFormat = 'Dadbattle';
|
||||
case 'philly-nice': songFormat = 'Philly';
|
||||
if (PlayState.rep.replay.replayGameVer == Replay.version)
|
||||
{
|
||||
|
||||
// adjusting the song name to be compatible
|
||||
var songFormat = StringTools.replace(PlayState.rep.replay.songName, " ", "-");
|
||||
switch (songFormat) {
|
||||
case 'Dad-Battle': songFormat = 'Dadbattle';
|
||||
case 'Philly-Nice': songFormat = 'Philly';
|
||||
// Replay v1.0 support
|
||||
case 'dad-battle': songFormat = 'Dadbattle';
|
||||
case 'philly-nice': songFormat = 'Philly';
|
||||
}
|
||||
|
||||
var poop:String = Highscore.formatSong(songFormat, PlayState.rep.replay.songDiff);
|
||||
|
||||
PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName);
|
||||
PlayState.isStoryMode = false;
|
||||
PlayState.storyDifficulty = PlayState.rep.replay.songDiff;
|
||||
PlayState.storyWeek = getWeekNumbFromSong(PlayState.rep.replay.songName);
|
||||
LoadingState.loadAndSwitchState(new PlayState());
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayState.rep = null;
|
||||
PlayState.loadRep = false;
|
||||
}
|
||||
|
||||
var poop:String = Highscore.formatSong(songFormat, PlayState.rep.replay.songDiff);
|
||||
|
||||
PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName);
|
||||
PlayState.isStoryMode = false;
|
||||
PlayState.storyDifficulty = PlayState.rep.replay.songDiff;
|
||||
PlayState.storyWeek = getWeekNumbFromSong(PlayState.rep.replay.songName);
|
||||
LoadingState.loadAndSwitchState(new PlayState());
|
||||
}
|
||||
}
|
||||
|
||||
@ -187,7 +196,7 @@ class LoadReplayState extends MusicBeatState
|
||||
|
||||
var rep:Replay = Replay.LoadReplay(actualNames[curSelected]);
|
||||
|
||||
poggerDetails.text = "Replay Details - \nDate Created: " + rep.replay.timestamp + "\nSong: " + rep.replay.songName + "\nReplay Version: " + rep.replay.replayGameVer + ' (' + (rep.replay.replayGameVer != Replay.version ? "OUTDATED but still usable" : "Latest") + ')\n';
|
||||
poggerDetails.text = "Replay Details - \nDate Created: " + rep.replay.timestamp + "\nSong: " + rep.replay.songName + "\nReplay Version: " + rep.replay.replayGameVer + ' (' + (rep.replay.replayGameVer != Replay.version ? "OUTDATED not useable!" : "Latest") + ')\n';
|
||||
|
||||
// selector.y = (70 * curSelected) + 30;
|
||||
|
||||
|
@ -39,7 +39,7 @@ class MainMenuState extends MusicBeatState
|
||||
|
||||
public static var nightly:String = "";
|
||||
|
||||
public static var kadeEngineVer:String = "1.5.2" + nightly;
|
||||
public static var kadeEngineVer:String = "1.5.3" + nightly;
|
||||
public static var gameVer:String = "0.2.7.1";
|
||||
|
||||
var magenta:FlxSprite;
|
||||
@ -165,7 +165,7 @@ class MainMenuState extends MusicBeatState
|
||||
{
|
||||
if (optionShit[curSelected] == 'donate')
|
||||
{
|
||||
fancyOpenURL("https://www.kickstarter.com/projects/funkin/friday-night-funkin-the-full-ass-game");
|
||||
fancyOpenURL("https://ninja-muffin24.itch.io/funkin");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -437,8 +437,6 @@ class ModchartState
|
||||
PlayState.instance.removeObject(sprite);
|
||||
return true;
|
||||
});
|
||||
|
||||
|
||||
|
||||
// hud/camera
|
||||
|
||||
@ -461,6 +459,14 @@ class ModchartState
|
||||
GlobalVideo.get().restart();
|
||||
});
|
||||
|
||||
Lua_helper.add_callback(lua,"getVideoSpriteX", function() {
|
||||
return PlayState.instance.videoSprite.x;
|
||||
});
|
||||
|
||||
Lua_helper.add_callback(lua,"getVideoSpriteY", function() {
|
||||
return PlayState.instance.videoSprite.y;
|
||||
});
|
||||
|
||||
Lua_helper.add_callback(lua,"setVideoSpritePos", function(x:Int,y:Int) {
|
||||
PlayState.instance.videoSprite.setPosition(x,y);
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ class Note extends FlxSprite
|
||||
x += 50;
|
||||
// MAKE SURE ITS DEFINITELY OFF SCREEN?
|
||||
y -= 2000;
|
||||
this.strumTime = strumTime;
|
||||
this.strumTime = Math.round(strumTime);
|
||||
|
||||
if (this.strumTime < 0 )
|
||||
this.strumTime = 0;
|
||||
|
@ -296,8 +296,8 @@ class Judgement extends Option
|
||||
|
||||
override function getValue():String {
|
||||
return "Safe Frames: " + Conductor.safeFrames +
|
||||
" - SIK: " + HelperFunctions.truncateFloat(45 * Conductor.timeScale, 0) +
|
||||
"ms GD: " + HelperFunctions.truncateFloat(90 * Conductor.timeScale, 0) +
|
||||
" - SIK: " + HelperFunctions.truncateFloat(22 * Conductor.timeScale, 0) +
|
||||
"ms GD: " + HelperFunctions.truncateFloat(45 * Conductor.timeScale, 0) +
|
||||
"ms BD: " + HelperFunctions.truncateFloat(135 * Conductor.timeScale, 0) +
|
||||
"ms SHT: " + HelperFunctions.truncateFloat(155 * Conductor.timeScale, 0) +
|
||||
"ms TOTAL: " + HelperFunctions.truncateFloat(Conductor.safeZoneOffset,0) + "ms";
|
||||
@ -338,6 +338,27 @@ class FPSOption extends Option
|
||||
}
|
||||
}
|
||||
|
||||
class ScoreScreen extends Option
|
||||
{
|
||||
public function new(desc:String)
|
||||
{
|
||||
super();
|
||||
description = desc;
|
||||
}
|
||||
|
||||
public override function press():Bool
|
||||
{
|
||||
FlxG.save.data.scoreScreen = !FlxG.save.data.scoreScreen;
|
||||
return true;
|
||||
}
|
||||
|
||||
private override function updateDisplay():String
|
||||
{
|
||||
return (FlxG.save.data.scoreScreen ? "Show Score Screen" : "No Score Screen");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class FPSCapOption extends Option
|
||||
|
@ -57,7 +57,8 @@ class OptionsMenu extends MusicBeatState
|
||||
#end
|
||||
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 BotPlay("Showcase your charts and mods with autoplay."),
|
||||
new ScoreScreen("Show the score screen after the end of a song")
|
||||
])
|
||||
|
||||
];
|
||||
|
@ -33,6 +33,13 @@ class PauseSubState extends MusicBeatSubstate
|
||||
{
|
||||
super();
|
||||
|
||||
if (PlayState.instance.useVideo)
|
||||
{
|
||||
menuItems.remove("Resume");
|
||||
if (GlobalVideo.get().playing)
|
||||
GlobalVideo.get().pause();
|
||||
}
|
||||
|
||||
pauseMusic = new FlxSound().loadEmbedded(Paths.music('breakfast'), true, true);
|
||||
pauseMusic.volume = 0;
|
||||
pauseMusic.play(false, FlxG.random.int(0, Std.int(pauseMusic.length / 2)));
|
||||
@ -98,6 +105,9 @@ class PauseSubState extends MusicBeatSubstate
|
||||
|
||||
super.update(elapsed);
|
||||
|
||||
if (PlayState.instance.useVideo)
|
||||
menuItems.remove('Resume');
|
||||
|
||||
var upP = controls.UP_P;
|
||||
var downP = controls.DOWN_P;
|
||||
var leftP = controls.LEFT_P;
|
||||
@ -187,8 +197,20 @@ class PauseSubState extends MusicBeatSubstate
|
||||
case "Resume":
|
||||
close();
|
||||
case "Restart Song":
|
||||
if (PlayState.instance.useVideo)
|
||||
{
|
||||
GlobalVideo.get().stop();
|
||||
PlayState.instance.remove(PlayState.instance.videoSprite);
|
||||
PlayState.instance.removedVideo = true;
|
||||
}
|
||||
FlxG.resetState();
|
||||
case "Exit to menu":
|
||||
if (PlayState.instance.useVideo)
|
||||
{
|
||||
GlobalVideo.get().stop();
|
||||
PlayState.instance.remove(PlayState.instance.videoSprite);
|
||||
PlayState.instance.removedVideo = true;
|
||||
}
|
||||
if(PlayState.loadRep)
|
||||
{
|
||||
FlxG.save.data.botplay = false;
|
||||
|
7502
source/PlayState.hx
7502
source/PlayState.hx
File diff suppressed because it is too large
Load Diff
7
source/PlayStateChangeables.hx
Normal file
7
source/PlayStateChangeables.hx
Normal file
@ -0,0 +1,7 @@
|
||||
class PlayStateChangeables
|
||||
{
|
||||
public static var useDownscroll:Bool;
|
||||
public static var safeFrames:Int;
|
||||
public static var scrollSpeed:Float;
|
||||
public static var botPlay:Bool;
|
||||
}
|
@ -5,7 +5,7 @@ class Ratings
|
||||
public static function GenerateLetterRank(accuracy:Float) // generate a letter ranking
|
||||
{
|
||||
var ranking:String = "N/A";
|
||||
if(FlxG.save.data.botplay)
|
||||
if(FlxG.save.data.botplay && !PlayState.loadRep)
|
||||
ranking = "BotPlay";
|
||||
|
||||
if (PlayState.misses == 0 && PlayState.bads == 0 && PlayState.shits == 0 && PlayState.goods == 0) // Marvelous (SICK) Full Combo
|
||||
@ -86,7 +86,7 @@ class Ratings
|
||||
|
||||
if (accuracy == 0)
|
||||
ranking = "N/A";
|
||||
else if(FlxG.save.data.botplay)
|
||||
else if(FlxG.save.data.botplay && !PlayState.loadRep)
|
||||
ranking = "BotPlay";
|
||||
|
||||
return ranking;
|
||||
@ -107,37 +107,45 @@ class Ratings
|
||||
|
||||
// trace('Hit Info\nDifference: ' + noteDiff + '\nZone: ' + Conductor.safeZoneOffset * 1.5 + "\nTS: " + customTimeScale + "\nLate: " + 155 * customTimeScale);
|
||||
|
||||
if (FlxG.save.data.botplay)
|
||||
return "good"; // FUNNY
|
||||
|
||||
if (noteDiff > 166 * customTimeScale) // so god damn early its a miss
|
||||
return "miss";
|
||||
if (noteDiff > 135 * customTimeScale) // way early
|
||||
return "shit";
|
||||
else if (noteDiff > 90 * customTimeScale) // early
|
||||
return "bad";
|
||||
else if (noteDiff > 45 * customTimeScale) // your kinda there
|
||||
return "good";
|
||||
else if (noteDiff < -45 * customTimeScale) // little late
|
||||
return "good";
|
||||
else if (noteDiff < -90 * customTimeScale) // late
|
||||
return "bad";
|
||||
else if (noteDiff < -135 * customTimeScale) // late as fuck
|
||||
return "shit";
|
||||
else if (noteDiff < -166 * customTimeScale) // so god damn late its a miss
|
||||
return "miss";
|
||||
return "sick";
|
||||
if (FlxG.save.data.botplay && !PlayState.loadRep)
|
||||
return "sick"; // FUNNY
|
||||
|
||||
|
||||
var rating = checkRating(noteDiff,customTimeScale);
|
||||
|
||||
|
||||
return rating;
|
||||
}
|
||||
|
||||
public static function checkRating(ms:Float, ts:Float)
|
||||
{
|
||||
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)
|
||||
rating = "bad";
|
||||
if (ms > -135 * ts && ms < -90 * ts)
|
||||
rating = "bad";
|
||||
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)
|
||||
rating = "sick";
|
||||
return rating;
|
||||
}
|
||||
|
||||
public static function CalculateRanking(score:Int,scoreDef:Int,nps:Int,maxNPS:Int,accuracy:Float):String
|
||||
{
|
||||
return
|
||||
(FlxG.save.data.npsDisplay ? // NPS Toggle
|
||||
"NPS: " + nps + " (Max " + maxNPS + ")" + (!FlxG.save.data.botplay ? " | " : "") : "") + // NPS
|
||||
(!FlxG.save.data.botplay ? "Score:" + (Conductor.safeFrames != 10 ? score + " (" + scoreDef + ")" : "" + score) + // Score
|
||||
"NPS: " + nps + " (Max " + maxNPS + ")" + (!PlayStateChangeables.botPlay || PlayState.loadRep ? " | " : "") : "") + // NPS
|
||||
(!PlayStateChangeables.botPlay || PlayState.loadRep ? "Score:" + (Conductor.safeFrames != 10 ? score + " (" + scoreDef + ")" : "" + score) + // Score
|
||||
(FlxG.save.data.accuracyDisplay ? // Accuracy Toggle
|
||||
" | Combo Breaks:" + PlayState.misses + // Misses/Combo Breaks
|
||||
" | Accuracy:" + (FlxG.save.data.botplay ? "N/A" : HelperFunctions.truncateFloat(accuracy, 2) + " %") + // Accuracy
|
||||
" | Accuracy:" + (PlayStateChangeables.botPlay && !PlayState.loadRep ? "N/A" : HelperFunctions.truncateFloat(accuracy, 2) + " %") + // Accuracy
|
||||
" | " + GenerateLetterRank(accuracy) : "") : ""); // Letter Rank
|
||||
}
|
||||
}
|
||||
|
@ -17,14 +17,15 @@ typedef ReplayJSON =
|
||||
public var timestamp:Date;
|
||||
public var songName:String;
|
||||
public var songDiff:Int;
|
||||
public var songNotes:Array<Float>;
|
||||
public var songNotes:Array<Dynamic>;
|
||||
public var noteSpeed:Float;
|
||||
public var isDownscroll:Bool;
|
||||
public var sf:Int;
|
||||
}
|
||||
|
||||
class Replay
|
||||
{
|
||||
public static var version:String = "1.1"; // replay file version
|
||||
public static var version:String = "1.2"; // replay file version
|
||||
|
||||
public var path:String = "";
|
||||
public var replay:ReplayJSON;
|
||||
@ -38,7 +39,8 @@ class Replay
|
||||
isDownscroll: false,
|
||||
songNotes: [],
|
||||
replayGameVer: version,
|
||||
timestamp: Date.now()
|
||||
timestamp: Date.now(),
|
||||
sf: Conductor.safeFrames
|
||||
};
|
||||
}
|
||||
|
||||
@ -48,12 +50,12 @@ class Replay
|
||||
|
||||
rep.LoadFromJSON();
|
||||
|
||||
trace('basic replay data:\nSong Name: ' + rep.replay.songName + '\nSong Diff: ' + rep.replay.songDiff + '\nNotes Length: ' + rep.replay.songNotes.length);
|
||||
trace('basic replay data:\nSong Name: ' + rep.replay.songName + '\nSong Diff: ' + rep.replay.songDiff);
|
||||
|
||||
return rep;
|
||||
}
|
||||
|
||||
public function SaveReplay(notearray:Array<Float>)
|
||||
public function SaveReplay(notearray:Array<Dynamic>)
|
||||
{
|
||||
var json = {
|
||||
"songName": PlayState.SONG.song,
|
||||
@ -62,13 +64,20 @@ class Replay
|
||||
"isDownscroll": FlxG.save.data.downscroll,
|
||||
"songNotes": notearray,
|
||||
"timestamp": Date.now(),
|
||||
"replayGameVer": version
|
||||
"replayGameVer": version,
|
||||
"sf": Conductor.safeFrames
|
||||
};
|
||||
|
||||
var data:String = Json.stringify(json);
|
||||
|
||||
var time = Date.now().getTime();
|
||||
|
||||
#if sys
|
||||
File.saveContent("assets/replays/replay-" + PlayState.SONG.song + "-time" + Date.now().getTime() + ".kadeReplay", data);
|
||||
File.saveContent("assets/replays/replay-" + PlayState.SONG.song + "-time" + time + ".kadeReplay", data);
|
||||
|
||||
path = "replay-" + PlayState.SONG.song + "-time" + time + ".kadeReplay"; // for score screen shit
|
||||
|
||||
LoadFromJSON();
|
||||
#end
|
||||
}
|
||||
|
||||
|
250
source/ResultsScreen.hx
Normal file
250
source/ResultsScreen.hx
Normal file
@ -0,0 +1,250 @@
|
||||
package;
|
||||
|
||||
import openfl.geom.Matrix;
|
||||
import openfl.display.BitmapData;
|
||||
import flixel.system.FlxSound;
|
||||
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.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 ResultsScreen extends FlxSubState
|
||||
{
|
||||
public var background:FlxSprite;
|
||||
public var text:FlxText;
|
||||
|
||||
public var anotherBackground:FlxSprite;
|
||||
public var graph:HitGraph;
|
||||
public var graphSprite:FlxSprite;
|
||||
|
||||
public var comboText:FlxText;
|
||||
public var contText:FlxText;
|
||||
public var settingsText:FlxText;
|
||||
|
||||
public var music:FlxSound;
|
||||
|
||||
public var graphData:BitmapData;
|
||||
|
||||
public var ranking:String;
|
||||
public var accuracy:String;
|
||||
|
||||
override function create()
|
||||
{
|
||||
background = new FlxSprite(0,0).makeGraphic(FlxG.width,FlxG.height,FlxColor.BLACK);
|
||||
background.scrollFactor.set();
|
||||
add(background);
|
||||
|
||||
music = new FlxSound().loadEmbedded(Paths.music('breakfast'), true, true);
|
||||
music.volume = 0;
|
||||
music.play(false, FlxG.random.int(0, Std.int(music.length / 2)));
|
||||
|
||||
background.alpha = 0;
|
||||
|
||||
text = new FlxText(20,-55,0,"Song Cleared!");
|
||||
text.size = 34;
|
||||
text.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1);
|
||||
text.color = FlxColor.WHITE;
|
||||
text.scrollFactor.set();
|
||||
add(text);
|
||||
|
||||
var score = PlayState.instance.songScore;
|
||||
if (PlayState.isStoryMode)
|
||||
{
|
||||
score = PlayState.campaignScore;
|
||||
text.text = "Week Cleared!";
|
||||
}
|
||||
|
||||
comboText = new FlxText(20,-75,0,'Judgements:\nSicks - ${PlayState.sicks}\nGoods - ${PlayState.goods}\nBads - ${PlayState.bads}\n\nCombo Breaks: ${(PlayState.isStoryMode ? PlayState.campaignMisses : PlayState.misses) + PlayState.shits}\nHighest Combo: ${PlayState.highestCombo + 1}\n\nScore: ${PlayState.instance.songScore}\nAccuracy: ${HelperFunctions.truncateFloat(PlayState.instance.accuracy,2)}%\n\n${Ratings.GenerateLetterRank(PlayState.instance.accuracy)}\n\nF1 - View replay\nF2 - Replay song
|
||||
');
|
||||
comboText.size = 28;
|
||||
comboText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1);
|
||||
comboText.color = FlxColor.WHITE;
|
||||
comboText.scrollFactor.set();
|
||||
add(comboText);
|
||||
|
||||
contText = new FlxText(FlxG.width - 475,FlxG.height + 50,0,'Press ENTER to continue.');
|
||||
contText.size = 28;
|
||||
contText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,4,1);
|
||||
contText.color = FlxColor.WHITE;
|
||||
contText.scrollFactor.set();
|
||||
add(contText);
|
||||
|
||||
anotherBackground = new FlxSprite(FlxG.width - 500,45).makeGraphic(450,240,FlxColor.BLACK);
|
||||
anotherBackground.scrollFactor.set();
|
||||
anotherBackground.alpha = 0;
|
||||
add(anotherBackground);
|
||||
|
||||
graph = new HitGraph(FlxG.width - 500,45,495,240);
|
||||
graph.alpha = 0;
|
||||
|
||||
graphSprite = new FlxSprite(FlxG.width - 510,45);
|
||||
|
||||
graphSprite.scrollFactor.set();
|
||||
graphSprite.alpha = 0;
|
||||
|
||||
add(graphSprite);
|
||||
|
||||
|
||||
var sicks = HelperFunctions.truncateFloat(PlayState.sicks / PlayState.goods,1);
|
||||
var goods = HelperFunctions.truncateFloat(PlayState.goods / PlayState.bads,1);
|
||||
|
||||
if (sicks == Math.POSITIVE_INFINITY)
|
||||
sicks = 0;
|
||||
if (goods == Math.POSITIVE_INFINITY)
|
||||
goods = 0;
|
||||
|
||||
var mean:Float = 0;
|
||||
|
||||
|
||||
for (i in PlayState.rep.replay.songNotes)
|
||||
{
|
||||
// 0 = time
|
||||
// 1 = length
|
||||
// 2 = type
|
||||
// 3 = diff
|
||||
var diff = i[3];
|
||||
var judge = Ratings.CalculateRating(diff, Math.floor((PlayState.rep.replay.sf / 60) * 1000));
|
||||
mean += diff;
|
||||
if (i[1] != -1)
|
||||
graph.addToHistory(diff, judge);
|
||||
}
|
||||
|
||||
graph.update();
|
||||
|
||||
graphSprite.makeGraphic(460,240,FlxColor.TRANSPARENT);
|
||||
|
||||
graphSprite.pixels.draw(graph);
|
||||
|
||||
mean = HelperFunctions.truncateFloat(mean / PlayState.rep.replay.songNotes.length,2);
|
||||
|
||||
settingsText = new FlxText(20,FlxG.height + 50,0,'SF: ${PlayState.rep.replay.sf} | Ratio (SA/GA): ${Math.round(sicks)}:1 ${Math.round(goods)}:1 | Mean: ${mean}ms | Played on ${PlayState.SONG.song} ${CoolUtil.difficultyString()}');
|
||||
settingsText.size = 16;
|
||||
settingsText.setBorderStyle(FlxTextBorderStyle.OUTLINE,FlxColor.BLACK,2,1);
|
||||
settingsText.color = FlxColor.WHITE;
|
||||
settingsText.scrollFactor.set();
|
||||
add(settingsText);
|
||||
|
||||
|
||||
FlxTween.tween(background, {alpha: 0.5},0.5);
|
||||
FlxTween.tween(text, {y:20},0.5,{ease: FlxEase.expoInOut});
|
||||
FlxTween.tween(comboText, {y:145},0.5,{ease: FlxEase.expoInOut});
|
||||
FlxTween.tween(contText, {y:FlxG.height - 45},0.5,{ease: FlxEase.expoInOut});
|
||||
FlxTween.tween(settingsText, {y:FlxG.height - 35},0.5,{ease: FlxEase.expoInOut});
|
||||
FlxTween.tween(anotherBackground, {alpha: 0.6},0.5, {onUpdate: function(tween:FlxTween) {
|
||||
graph.alpha = FlxMath.lerp(0,1,tween.percent);
|
||||
graphSprite.alpha = FlxMath.lerp(0,1,tween.percent);
|
||||
}});
|
||||
|
||||
cameras = [FlxG.cameras.list[FlxG.cameras.list.length - 1]];
|
||||
|
||||
super.create();
|
||||
}
|
||||
|
||||
|
||||
var frames = 0;
|
||||
|
||||
override function update(elapsed:Float)
|
||||
{
|
||||
if (music.volume < 0.5)
|
||||
music.volume += 0.01 * elapsed;
|
||||
|
||||
// render
|
||||
if (frames != 2)
|
||||
{
|
||||
graphSprite.pixels.draw(graph);
|
||||
frames++;
|
||||
}
|
||||
// keybinds
|
||||
|
||||
if (FlxG.keys.justPressed.ENTER)
|
||||
{
|
||||
music.fadeOut(0.3);
|
||||
|
||||
PlayState.loadRep = false;
|
||||
PlayState.rep = null;
|
||||
|
||||
if (PlayState.isStoryMode)
|
||||
{
|
||||
FlxG.sound.playMusic(Paths.music('freakyMenu'));
|
||||
FlxG.switchState(new MainMenuState());
|
||||
}
|
||||
else
|
||||
FlxG.switchState(new FreeplayState());
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.F1)
|
||||
{
|
||||
trace(PlayState.rep.path);
|
||||
PlayState.rep = Replay.LoadReplay(PlayState.rep.path);
|
||||
|
||||
PlayState.loadRep = true;
|
||||
|
||||
var songFormat = StringTools.replace(PlayState.rep.replay.songName, " ", "-");
|
||||
switch (songFormat) {
|
||||
case 'Dad-Battle': songFormat = 'Dadbattle';
|
||||
case 'Philly-Nice': songFormat = 'Philly';
|
||||
// Replay v1.0 support
|
||||
case 'dad-battle': songFormat = 'Dadbattle';
|
||||
case 'philly-nice': songFormat = 'Philly';
|
||||
}
|
||||
|
||||
var poop:String = Highscore.formatSong(songFormat, PlayState.rep.replay.songDiff);
|
||||
|
||||
music.fadeOut(0.3);
|
||||
|
||||
PlayState.SONG = Song.loadFromJson(poop, PlayState.rep.replay.songName);
|
||||
PlayState.isStoryMode = false;
|
||||
PlayState.storyDifficulty = PlayState.rep.replay.songDiff;
|
||||
PlayState.storyWeek = 0;
|
||||
LoadingState.loadAndSwitchState(new PlayState());
|
||||
}
|
||||
|
||||
if (FlxG.keys.justPressed.F2 )
|
||||
{
|
||||
PlayState.rep = null;
|
||||
|
||||
PlayState.loadRep = false;
|
||||
|
||||
var songFormat = StringTools.replace(PlayState.SONG.song, " ", "-");
|
||||
switch (songFormat) {
|
||||
case 'Dad-Battle': songFormat = 'Dadbattle';
|
||||
case 'Philly-Nice': songFormat = 'Philly';
|
||||
case 'dad-battle': songFormat = 'Dadbattle';
|
||||
case 'philly-nice': songFormat = 'Philly';
|
||||
}
|
||||
|
||||
var poop:String = Highscore.formatSong(songFormat, PlayState.storyDifficulty);
|
||||
|
||||
music.fadeOut(0.3);
|
||||
|
||||
PlayState.SONG = Song.loadFromJson(poop, PlayState.SONG.song);
|
||||
PlayState.isStoryMode = false;
|
||||
PlayState.storyDifficulty = PlayState.storyDifficulty;
|
||||
PlayState.storyWeek = 0;
|
||||
LoadingState.loadAndSwitchState(new PlayState());
|
||||
}
|
||||
|
||||
super.update(elapsed);
|
||||
|
||||
}
|
||||
}
|
@ -296,7 +296,11 @@ class StoryMenuState extends MusicBeatState
|
||||
}
|
||||
|
||||
var poop:String = Highscore.formatSong(songFormat, curDifficulty);
|
||||
|
||||
PlayState.sicks = 0;
|
||||
PlayState.bads = 0;
|
||||
PlayState.shits = 0;
|
||||
PlayState.goods = 0;
|
||||
PlayState.campaignMisses = 0;
|
||||
PlayState.SONG = Song.loadFromJson(poop, PlayState.storyPlaylist[0]);
|
||||
PlayState.storyWeek = curWeek;
|
||||
PlayState.campaignScore = 0;
|
||||
|
@ -1,11 +1,6 @@
|
||||
1.5.2;
|
||||
- (1.5.2) Fix crashes on some songs
|
||||
- Added toggle for ghost tapping
|
||||
- Officially support macOS (and add macOS requirements to docs)
|
||||
- Autoplay
|
||||
- Clap assist for syncing charts
|
||||
- Bring back R to reset, but now you can toggle it in the options
|
||||
- You can now fully customize your keybinds
|
||||
- Change how replays work + store scroll speed and direction in replays
|
||||
- Opponent strumline now lights up when they hit a note, like the player's does
|
||||
- Now using the new recharts from Funkin v0.2.8
|
||||
1.5.3;
|
||||
- Score Screen
|
||||
- Rewrote the entire hit ranking system
|
||||
- Fixed song names so they don't crash
|
||||
- New asset loading system
|
||||
- New Logo
|
Loading…
x
Reference in New Issue
Block a user