This commit is contained in:
KadeDev 2021-03-31 16:11:14 -07:00
parent d360ed048d
commit 6b79082a70
12 changed files with 193 additions and 151 deletions

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -217,7 +217,6 @@ class FreeplayState extends MusicBeatState
PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName.toLowerCase()); PlayState.SONG = Song.loadFromJson(poop, songs[curSelected].songName.toLowerCase());
PlayState.isStoryMode = false; PlayState.isStoryMode = false;
PlayState.storyDifficulty = curDifficulty; PlayState.storyDifficulty = curDifficulty;
PlayState.storyWeek = songs[curSelected].week; PlayState.storyWeek = songs[curSelected].week;
trace('CUR WEEK' + PlayState.storyWeek); trace('CUR WEEK' + PlayState.storyWeek);
LoadingState.loadAndSwitchState(new PlayState()); LoadingState.loadAndSwitchState(new PlayState());
@ -272,6 +271,7 @@ class FreeplayState extends MusicBeatState
#end #end
#if PRELOAD_ALL #if PRELOAD_ALL
Conductor.changeBPM(Song.loadFromJson(Highscore.formatSong(songs[curSelected].songName,0),songs[curSelected].songName.toLowerCase()).bpm);
FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0); FlxG.sound.playMusic(Paths.inst(songs[curSelected].songName), 0);
#end #end

View File

@ -12,7 +12,7 @@ class HealthIcon extends FlxSprite
public function new(char:String = 'bf', isPlayer:Bool = false) public function new(char:String = 'bf', isPlayer:Bool = false)
{ {
super(); super();
trace(Paths.image('iconGrid','data'));
loadGraphic(Paths.image('iconGrid'), true, 150, 150); loadGraphic(Paths.image('iconGrid'), true, 150, 150);
antialiasing = true; antialiasing = true;

View File

@ -51,6 +51,9 @@ class KadeEngineData
if (FlxG.save.data.scrollSpeed == null) if (FlxG.save.data.scrollSpeed == null)
FlxG.save.data.scrollSpeed = 1; FlxG.save.data.scrollSpeed = 1;
if (FlxG.save.data.npsDisplay == null)
FlxG.save.data.npsDisplay = false;
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap); (cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap);
} }
} }

View File

@ -1,74 +0,0 @@
package;
import flixel.FlxG;
import flixel.FlxSprite;
import flixel.FlxState;
import flixel.group.FlxGroup.FlxTypedGroup;
import flixel.text.FlxText;
class LatencyState extends FlxState
{
var offsetText:FlxText;
var noteGrp:FlxTypedGroup<Note>;
var strumLine:FlxSprite;
override function create()
{
FlxG.sound.playMusic(Paths.sound('soundTest'));
noteGrp = new FlxTypedGroup<Note>();
add(noteGrp);
for (i in 0...32)
{
var note:Note = new Note(Conductor.crochet * i, 1);
noteGrp.add(note);
}
offsetText = new FlxText();
offsetText.screenCenter();
add(offsetText);
strumLine = new FlxSprite(FlxG.width / 2, 100).makeGraphic(FlxG.width, 5);
add(strumLine);
Conductor.changeBPM(120);
super.create();
}
override function update(elapsed:Float)
{
offsetText.text = "Offset: " + Conductor.offset + "ms";
Conductor.songPosition = FlxG.sound.music.time - Conductor.offset;
var multiply:Float = 1;
if (FlxG.keys.pressed.SHIFT)
multiply = 10;
if (FlxG.keys.justPressed.RIGHT)
Conductor.offset += 1 * multiply;
if (FlxG.keys.justPressed.LEFT)
Conductor.offset -= 1 * multiply;
if (FlxG.keys.justPressed.SPACE)
{
FlxG.sound.music.stop();
FlxG.resetState();
}
noteGrp.forEach(function(daNote:Note)
{
daNote.y = (strumLine.y - (Conductor.songPosition - daNote.strumTime) * 0.45);
daNote.x = strumLine.x + 30;
if (daNote.y < strumLine.y)
daNote.kill();
});
super.update(elapsed);
}
}

View File

@ -24,6 +24,8 @@ class MusicBeatState extends FlxUIState
override function create() override function create()
{ {
(cast (Lib.current.getChildAt(0), Main)).setFPSCap(FlxG.save.data.fpsCap);
if (transIn != null) if (transIn != null)
trace('reg ' + transIn.region); trace('reg ' + transIn.region);
@ -69,6 +71,7 @@ class MusicBeatState extends FlxUIState
private function updateBeat():Void private function updateBeat():Void
{ {
lastBeat = curStep;
curBeat = Math.floor(curStep / 4); curBeat = Math.floor(curStep / 4);
} }

View File

@ -169,7 +169,7 @@ class Note extends FlxSprite
prevNote.animation.play('redhold'); prevNote.animation.play('redhold');
} }
prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.5 * PlayState.SONG.speed; prevNote.scale.y *= Conductor.stepCrochet / 100 * 1.8 * PlayState.SONG.speed;
prevNote.updateHitbox(); prevNote.updateHitbox();
// prevNote.setGraphicSize(); // prevNote.setGraphicSize();
} }

View File

@ -255,6 +255,27 @@ class RainbowFPSOption extends Option
} }
} }
class NPSDisplayOption extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
FlxG.save.data.npsDisplay = !FlxG.save.data.npsDisplay;
display = updateDisplay();
return true;
}
private override function updateDisplay():String
{
return "NPS Display " + (!FlxG.save.data.npsDisplay ? "off" : "on");
}
}
class ReplayOption extends Option class ReplayOption extends Option
{ {
public function new(desc:String) public function new(desc:String)
@ -297,3 +318,33 @@ class CustomizeGameplay extends Option
} }
} }
class OffsetMenu extends Option
{
public function new(desc:String)
{
super();
description = desc;
}
public override function press():Bool
{
trace("switch");
var poop:String = Highscore.formatSong("offsetTest", 1);
PlayState.SONG = Song.loadFromJson(poop, "offsetTest");
PlayState.isStoryMode = false;
PlayState.storyDifficulty = 0;
PlayState.storyWeek = 0;
trace('CUR WEEK' + PlayState.storyWeek);
LoadingState.loadAndSwitchState(new PlayState());
return false;
}
private override function updateDisplay():String
{
return "Time your offset";
}
}

View File

@ -23,14 +23,16 @@ class OptionsMenu extends MusicBeatState
new OptionCatagory("Gameplay", [ new OptionCatagory("Gameplay", [
new DFJKOption(controls), new DFJKOption(controls),
new FPSCapOption("Cap your FPS (Left for -10, Right for -10)"), new FPSCapOption("Cap your FPS (Left for -10, Right for -10)"),
new CustomizeGameplay("Drag'n'Drop Gameplay Modules around to your preference"), new ScrollSpeedOption("Change your scroll speed (Left for -0.1, right for +0.1. If its at 1, it will be chart dependent)"),
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")
]), ]),
new OptionCatagory("Appearence", [ new OptionCatagory("Appearence", [
new SongPositionOption("Show the songs current position (as a bar)"), new SongPositionOption("Show the songs current position (as a bar)"),
new DownscrollOption("Change the layout of the strumline."), new DownscrollOption("Change the layout of the strumline."),
new RainbowFPSOption("Make the FPS Counter Rainbow (Only works with the FPS Counter toggeled on)"), new RainbowFPSOption("Make the FPS Counter Rainbow (Only works with the FPS Counter toggeled on)"),
new AccuracyOption("Display accuracy information.") new AccuracyOption("Display accuracy information."),
new NPSDisplayOption("Shows your current Notes Per Second.")
]), ]),
new OptionCatagory("Misc", [ new OptionCatagory("Misc", [
new EtternaModeOption("Harder Hit Windows and a different scoring system."), new EtternaModeOption("Harder Hit Windows and a different scoring system."),
@ -147,10 +149,10 @@ class OptionsMenu extends MusicBeatState
versionShit.text = "Current Scroll Speed: " + FlxG.save.data.scrollSpeed + " - Description - " + currentDescription; versionShit.text = "Current Scroll Speed: " + FlxG.save.data.scrollSpeed + " - Description - " + currentDescription;
default: default:
if (FlxG.keys.pressed.RIGHT) if (FlxG.keys.pressed.RIGHT)
FlxG.save.data.offset++; FlxG.save.data.offset += 0.1;
if (FlxG.keys.pressed.LEFT) if (FlxG.keys.pressed.LEFT)
FlxG.save.data.offset--; FlxG.save.data.offset -= 0.1;
versionShit.text = "Offset (Left, Right): " + FlxG.save.data.offset + " - Description - " + currentDescription; versionShit.text = "Offset (Left, Right): " + FlxG.save.data.offset + " - Description - " + currentDescription;
} }

View File

@ -124,6 +124,10 @@ class PlayState extends MusicBeatState
private var camHUD:FlxCamera; private var camHUD:FlxCamera;
private var camGame:FlxCamera; private var camGame:FlxCamera;
var notesHitArray:Array<Date> = [];
var currentFrames:Int = 0;
var dialogue:Array<String> = ['blah blah blah', 'coolswag']; var dialogue:Array<String> = ['blah blah blah', 'coolswag'];
var halloweenBG:FlxSprite; var halloweenBG:FlxSprite;
@ -823,6 +827,8 @@ class PlayState extends MusicBeatState
scoreTxt.x = healthBarBG.x + healthBarBG.width / 2; scoreTxt.x = healthBarBG.x + healthBarBG.width / 2;
scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK); scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
scoreTxt.scrollFactor.set(); scoreTxt.scrollFactor.set();
if (SONG.song.contains('offsetTest'))
scoreTxt.x += 300;
add(scoreTxt); add(scoreTxt);
replayTxt = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (FlxG.save.data.downscroll ? 100 : -100), 0, "REPLAY", 20); replayTxt = new FlxText(healthBarBG.x + healthBarBG.width / 2 - 75, healthBarBG.y + (FlxG.save.data.downscroll ? 100 : -100), 0, "REPLAY", 20);
@ -1476,12 +1482,10 @@ class PlayState extends MusicBeatState
ranking = "(MFC)"; ranking = "(MFC)";
else if (misses == 0 && bads == 0 && shits == 0 && goods >= 1) // Good Full Combo (Nothing but Goods & Sicks) else if (misses == 0 && bads == 0 && shits == 0 && goods >= 1) // Good Full Combo (Nothing but Goods & Sicks)
ranking = "(GFC)"; ranking = "(GFC)";
else if ((shits < 10 && shits != 0) && misses == 0) // Single Digit Combo Breaks else if (misses == 0) // Regular FC
ranking = "(SDCB)";
else if (misses == 0 && (shits >= 10)) // Regular FC
ranking = "(FC)"; ranking = "(FC)";
else if (misses >= 10 || (shits >= 10)) // Combo Breaks else if (misses < 10) // Single Digit Combo Breaks
ranking = "(CB)"; ranking = "(SDCB)";
else else
ranking = "(Clear)"; ranking = "(Clear)";
@ -1564,6 +1568,21 @@ class PlayState extends MusicBeatState
perfectMode = false; perfectMode = false;
#end #end
if (currentFrames == FlxG.save.data.fpsCap)
{
for(i in 0...notesHitArray.length)
{
var cock:Date = notesHitArray[i];
if (cock != null)
if (cock.getTime() + 2000 < Date.now().getTime())
notesHitArray.remove(cock);
}
nps = Math.floor(notesHitArray.length / 2);
currentFrames = 0;
}
else
currentFrames++;
if (FlxG.keys.justPressed.NINE) if (FlxG.keys.justPressed.NINE)
{ {
if (iconP1.animation.curAnim.name == 'bf-old') if (iconP1.animation.curAnim.name == 'bf-old')
@ -1590,13 +1609,21 @@ class PlayState extends MusicBeatState
super.update(elapsed); super.update(elapsed);
if (!SONG.song.contains('offsetTest'))
{
if (FlxG.save.data.accuracyDisplay) if (FlxG.save.data.accuracyDisplay)
{ {
scoreTxt.text = "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:" + (FlxG.save.data.etternaMode ? Math.max(0,etternaModeScore) + " (" + songScore + ")" : "" + songScore) + " | Combo Breaks:" + misses + " | Accuracy:" + truncateFloat(accuracy, 2) + "% | " + generateRanking();
} }
else else
{ {
scoreTxt.text = "Score:" + songScore; scoreTxt.text = (FlxG.save.data.npsDisplay ? "NPS: " + nps + " | " : "") + "Score:" + songScore;
}
}
else
{
scoreTxt.text = "Suggested Offset: " + offsetTest;
} }
if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause) if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause)
{ {
@ -1940,6 +1967,14 @@ class PlayState extends MusicBeatState
#end #end
} }
if (SONG.song.contains('offsetTest'))
{
FlxG.sound.playMusic(Paths.music('freakyMenu'));
LoadingState.loadAndSwitchState(new OptionsMenu());
FlxG.save.data.offset = offsetTest;
}
else
{
if (isStoryMode) if (isStoryMode)
{ {
campaignScore += Math.round(songScore); campaignScore += Math.round(songScore);
@ -2007,10 +2042,14 @@ class PlayState extends MusicBeatState
FlxG.switchState(new FreeplayState()); FlxG.switchState(new FreeplayState());
} }
} }
}
var endingSong:Bool = false; var endingSong:Bool = false;
var hits:Array<Float> = [];
var offsetTest:Float = 0;
var timeShown = 0; var timeShown = 0;
var currentTimingShown:FlxText = null; var currentTimingShown:FlxText = null;
@ -2130,6 +2169,18 @@ class PlayState extends MusicBeatState
currentTimingShown.text = msTiming + "ms"; currentTimingShown.text = msTiming + "ms";
currentTimingShown.size = 20; currentTimingShown.size = 20;
if (msTiming >= 0.03 && SONG.song.contains('offsetTest'))
{
hits.push(msTiming);
var total = 0.0;
for(i in hits)
total += i;
offsetTest = truncateFloat(total / hits.length,2);
}
if (currentTimingShown.alpha != 1) if (currentTimingShown.alpha != 1)
currentTimingShown.alpha = 1; currentTimingShown.alpha = 1;
@ -2800,6 +2851,8 @@ class PlayState extends MusicBeatState
} }
} }
var nps:Int = 0;
function goodNoteHit(note:Note, resetMashViolation = true):Void function goodNoteHit(note:Note, resetMashViolation = true):Void
{ {
@ -2814,6 +2867,9 @@ class PlayState extends MusicBeatState
else if (noteDiff < Conductor.safeZoneOffset * 0.44 && noteDiff > Conductor.safeZoneOffset * -0.44) else if (noteDiff < Conductor.safeZoneOffset * 0.44 && noteDiff > Conductor.safeZoneOffset * -0.44)
note.rating = "sick"; note.rating = "sick";
if (!note.isSustainNote)
notesHitArray.push(Date.now());
if (resetMashViolation) if (resetMashViolation)
mashViolations--; mashViolations--;