fixes + debug feature

This commit is contained in:
Spel0
2021-07-14 07:54:58 +03:00
parent 3184e0bacb
commit 1aade522ae
2 changed files with 96 additions and 31 deletions

View File

@@ -94,6 +94,7 @@ class PlayState extends MusicBeatState
public static var rep:Replay;
public static var loadRep:Bool = false;
public static var inResults:Bool = false;
public static var noteBools:Array<Bool> = [false, false, false, false];
@@ -214,6 +215,7 @@ class PlayState extends MusicBeatState
var funneEffect:FlxSprite;
var inCutscene:Bool = false;
var usedTimeTravel:Bool = false;
public static var repPresses:Int = 0;
public static var repReleases:Int = 0;
@@ -279,6 +281,7 @@ class PlayState extends MusicBeatState
highestCombo = 0;
repPresses = 0;
repReleases = 0;
inResults = false;
PlayStateChangeables.useDownscroll = FlxG.save.data.downscroll;
PlayStateChangeables.safeFrames = FlxG.save.data.frames;
@@ -2308,6 +2311,45 @@ class PlayState extends MusicBeatState
}
#end
}
if(FlxG.keys.justPressed.TWO) { //Go 10 seconds into the future, credit: Shadow Mario#9396
if (!usedTimeTravel && Conductor.songPosition + 10000 < FlxG.sound.music.length)
{
usedTimeTravel = true;
FlxG.sound.music.pause();
vocals.pause();
Conductor.songPosition += 10000;
notes.forEachAlive(function(daNote:Note)
{
if(daNote.strumTime - 500 < Conductor.songPosition) {
daNote.active = false;
daNote.visible = false;
daNote.kill();
notes.remove(daNote, true);
daNote.destroy();
}
});
for (i in 0...unspawnNotes.length) {
var daNote:Note = unspawnNotes[0];
if(daNote.strumTime - 500 >= Conductor.songPosition) {
break;
}
unspawnNotes.splice(unspawnNotes.indexOf(daNote), 1);
}
FlxG.sound.music.time = Conductor.songPosition;
FlxG.sound.music.play();
vocals.time = Conductor.songPosition;
vocals.play();
new FlxTimer().start(0.5, function(tmr:FlxTimer)
{
usedTimeTravel = false;
});
}
}
#end
if (startingSong)
@@ -2565,34 +2607,39 @@ class PlayState extends MusicBeatState
if (health <= 0)
{
boyfriend.stunned = true;
if (!usedTimeTravel)
{
boyfriend.stunned = true;
persistentUpdate = false;
persistentDraw = false;
paused = true;
persistentUpdate = false;
persistentDraw = false;
paused = true;
vocals.stop();
FlxG.sound.music.stop();
vocals.stop();
FlxG.sound.music.stop();
openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
openSubState(new GameOverSubstate(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
#if windows
// Game Over doesn't get his own variable because it's only used here
DiscordClient.changePresence("GAME OVER -- "
+ SONG.song
+ " ("
+ storyDifficultyText
+ ") "
+ Ratings.GenerateLetterRank(accuracy),
"\nAcc: "
+ HelperFunctions.truncateFloat(accuracy, 2)
+ "% | Score: "
+ songScore
+ " | Misses: "
+ misses, iconRPC);
#end
#if windows
// Game Over doesn't get his own variable because it's only used here
DiscordClient.changePresence("GAME OVER -- "
+ SONG.song
+ " ("
+ storyDifficultyText
+ ") "
+ Ratings.GenerateLetterRank(accuracy),
"\nAcc: "
+ HelperFunctions.truncateFloat(accuracy, 2)
+ "% | Score: "
+ songScore
+ " | Misses: "
+ misses, iconRPC);
#end
// FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
// FlxG.switchState(new GameOverState(boyfriend.getScreenPosition().x, boyfriend.getScreenPosition().y));
}
else
health = 0.01;
}
if (FlxG.save.data.resetButton)
{
@@ -3044,10 +3091,17 @@ class PlayState extends MusicBeatState
FlxG.sound.music.stop();
vocals.stop();
if (FlxG.save.data.scoreScreen)
{
openSubState(new ResultsScreen());
new FlxTimer().start(1, function(tmr:FlxTimer)
{
inResults = true;
});
}
else
{
FlxG.sound.playMusic(Paths.music('freakyMenu'));
Conductor.changeBPM(102);
FlxG.switchState(new StoryMenuState());
}
@@ -3114,8 +3168,14 @@ class PlayState extends MusicBeatState
FlxG.sound.music.stop();
vocals.stop();
if (FlxG.save.data.scoreScreen)
if (FlxG.save.data.scoreScreen)
{
openSubState(new ResultsScreen());
new FlxTimer().start(1, function(tmr:FlxTimer)
{
inResults = true;
});
}
else
FlxG.switchState(new FreeplayState());
}