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.isStoryMode = false;
PlayState.storyDifficulty = curDifficulty;
PlayState.storyWeek = songs[curSelected].week;
trace('CUR WEEK' + PlayState.storyWeek);
LoadingState.loadAndSwitchState(new PlayState());
@ -272,6 +271,7 @@ class FreeplayState extends MusicBeatState
#end
#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);
#end

View File

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

View File

@ -51,6 +51,9 @@ class KadeEngineData
if (FlxG.save.data.scrollSpeed == null)
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);
}
}

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

View File

@ -169,7 +169,7 @@ class Note extends FlxSprite
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.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
{
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 DFJKOption(controls),
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 SongPositionOption("Show the songs current position (as a bar)"),
new DownscrollOption("Change the layout of the strumline."),
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 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;
default:
if (FlxG.keys.pressed.RIGHT)
FlxG.save.data.offset++;
FlxG.save.data.offset += 0.1;
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;
}

View File

@ -124,6 +124,10 @@ class PlayState extends MusicBeatState
private var camHUD:FlxCamera;
private var camGame:FlxCamera;
var notesHitArray:Array<Date> = [];
var currentFrames:Int = 0;
var dialogue:Array<String> = ['blah blah blah', 'coolswag'];
var halloweenBG:FlxSprite;
@ -823,6 +827,8 @@ class PlayState extends MusicBeatState
scoreTxt.x = healthBarBG.x + healthBarBG.width / 2;
scoreTxt.setFormat(Paths.font("vcr.ttf"), 16, FlxColor.WHITE, CENTER, FlxTextBorderStyle.OUTLINE,FlxColor.BLACK);
scoreTxt.scrollFactor.set();
if (SONG.song.contains('offsetTest'))
scoreTxt.x += 300;
add(scoreTxt);
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)";
else if (misses == 0 && bads == 0 && shits == 0 && goods >= 1) // Good Full Combo (Nothing but Goods & Sicks)
ranking = "(GFC)";
else if ((shits < 10 && shits != 0) && misses == 0) // Single Digit Combo Breaks
ranking = "(SDCB)";
else if (misses == 0 && (shits >= 10)) // Regular FC
else if (misses == 0) // Regular FC
ranking = "(FC)";
else if (misses >= 10 || (shits >= 10)) // Combo Breaks
ranking = "(CB)";
else if (misses < 10) // Single Digit Combo Breaks
ranking = "(SDCB)";
else
ranking = "(Clear)";
@ -1564,6 +1568,21 @@ class PlayState extends MusicBeatState
perfectMode = false;
#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 (iconP1.animation.curAnim.name == 'bf-old')
@ -1590,13 +1609,21 @@ class PlayState extends MusicBeatState
super.update(elapsed);
if (FlxG.save.data.accuracyDisplay)
if (!SONG.song.contains('offsetTest'))
{
scoreTxt.text = "Score:" + (FlxG.save.data.etternaMode ? Math.max(0,etternaModeScore) + " (" + songScore + ")" : "" + songScore) + " | Combo Breaks:" + misses + " | Accuracy:" + truncateFloat(accuracy, 2) + "% | " + generateRanking();
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();
}
else
{
scoreTxt.text = (FlxG.save.data.npsDisplay ? "NPS: " + nps + " | " : "") + "Score:" + songScore;
}
}
else
{
scoreTxt.text = "Score:" + songScore;
scoreTxt.text = "Suggested Offset: " + offsetTest;
}
if (FlxG.keys.justPressed.ENTER && startedCountdown && canPause)
{
@ -1940,77 +1967,89 @@ class PlayState extends MusicBeatState
#end
}
if (isStoryMode)
if (SONG.song.contains('offsetTest'))
{
campaignScore += Math.round(songScore);
storyPlaylist.remove(storyPlaylist[0]);
if (storyPlaylist.length <= 0)
{
FlxG.sound.playMusic(Paths.music('freakyMenu'));
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
FlxG.switchState(new StoryMenuState());
// if ()
StoryMenuState.weekUnlocked[Std.int(Math.min(storyWeek + 1, StoryMenuState.weekUnlocked.length - 1))] = true;
if (SONG.validScore)
{
NGio.unlockMedal(60961);
Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty);
}
FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked;
FlxG.save.flush();
}
else
{
var difficulty:String = "";
if (storyDifficulty == 0)
difficulty = '-easy';
if (storyDifficulty == 2)
difficulty = '-hard';
trace('LOADING NEXT SONG');
trace(PlayState.storyPlaylist[0].toLowerCase() + difficulty);
if (SONG.song.toLowerCase() == 'eggnog')
{
var blackShit:FlxSprite = new FlxSprite(-FlxG.width * FlxG.camera.zoom,
-FlxG.height * FlxG.camera.zoom).makeGraphic(FlxG.width * 3, FlxG.height * 3, FlxColor.BLACK);
blackShit.scrollFactor.set();
add(blackShit);
camHUD.visible = false;
FlxG.sound.play(Paths.sound('Lights_Shut_off'));
}
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
prevCamFollow = camFollow;
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + difficulty, PlayState.storyPlaylist[0]);
FlxG.sound.music.stop();
LoadingState.loadAndSwitchState(new PlayState());
}
FlxG.sound.playMusic(Paths.music('freakyMenu'));
LoadingState.loadAndSwitchState(new OptionsMenu());
FlxG.save.data.offset = offsetTest;
}
else
{
trace('WENT BACK TO FREEPLAY??');
FlxG.switchState(new FreeplayState());
if (isStoryMode)
{
campaignScore += Math.round(songScore);
storyPlaylist.remove(storyPlaylist[0]);
if (storyPlaylist.length <= 0)
{
FlxG.sound.playMusic(Paths.music('freakyMenu'));
transIn = FlxTransitionableState.defaultTransIn;
transOut = FlxTransitionableState.defaultTransOut;
FlxG.switchState(new StoryMenuState());
// if ()
StoryMenuState.weekUnlocked[Std.int(Math.min(storyWeek + 1, StoryMenuState.weekUnlocked.length - 1))] = true;
if (SONG.validScore)
{
NGio.unlockMedal(60961);
Highscore.saveWeekScore(storyWeek, campaignScore, storyDifficulty);
}
FlxG.save.data.weekUnlocked = StoryMenuState.weekUnlocked;
FlxG.save.flush();
}
else
{
var difficulty:String = "";
if (storyDifficulty == 0)
difficulty = '-easy';
if (storyDifficulty == 2)
difficulty = '-hard';
trace('LOADING NEXT SONG');
trace(PlayState.storyPlaylist[0].toLowerCase() + difficulty);
if (SONG.song.toLowerCase() == 'eggnog')
{
var blackShit:FlxSprite = new FlxSprite(-FlxG.width * FlxG.camera.zoom,
-FlxG.height * FlxG.camera.zoom).makeGraphic(FlxG.width * 3, FlxG.height * 3, FlxColor.BLACK);
blackShit.scrollFactor.set();
add(blackShit);
camHUD.visible = false;
FlxG.sound.play(Paths.sound('Lights_Shut_off'));
}
FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;
prevCamFollow = camFollow;
PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0].toLowerCase() + difficulty, PlayState.storyPlaylist[0]);
FlxG.sound.music.stop();
LoadingState.loadAndSwitchState(new PlayState());
}
}
else
{
trace('WENT BACK TO FREEPLAY??');
FlxG.switchState(new FreeplayState());
}
}
}
var endingSong:Bool = false;
var hits:Array<Float> = [];
var offsetTest:Float = 0;
var timeShown = 0;
var currentTimingShown:FlxText = null;
@ -2130,6 +2169,18 @@ class PlayState extends MusicBeatState
currentTimingShown.text = msTiming + "ms";
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)
currentTimingShown.alpha = 1;
@ -2800,6 +2851,8 @@ class PlayState extends MusicBeatState
}
}
var nps:Int = 0;
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)
note.rating = "sick";
if (!note.isSustainNote)
notesHitArray.push(Date.now());
if (resetMashViolation)
mashViolations--;