Skip to content

Commit

Permalink
Freeplay results screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Lasercar committed Feb 5, 2025
1 parent 6f40aea commit 83b30b2
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 15 deletions.
34 changes: 19 additions & 15 deletions source/funkin/play/ResultState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -730,19 +730,22 @@ class ResultState extends MusicBeatSubState

if (controls.PAUSE)
{
if (introMusicAudio != null) {
if (introMusicAudio != null)
{
@:nullSafety(Off)
introMusicAudio.onComplete = null;

FlxTween.tween(introMusicAudio, {volume: 0}, 0.8, {
onComplete: _ -> {
if (introMusicAudio != null) {
introMusicAudio.stop();
introMusicAudio.destroy();
introMusicAudio = null;
FlxTween.tween(introMusicAudio, {volume: 0}, 0.8,
{
onComplete: _ -> {
if (introMusicAudio != null)
{
introMusicAudio.stop();
introMusicAudio.destroy();
introMusicAudio = null;
}
}
}
});
});
FlxTween.tween(introMusicAudio, {pitch: 3}, 0.1,
{
onComplete: _ -> {
Expand All @@ -752,12 +755,13 @@ class ResultState extends MusicBeatSubState
}
else if (FlxG.sound.music != null)
{
FlxTween.tween(FlxG.sound.music, {volume: 0}, 0.8, {
onComplete: _ -> {
FlxG.sound.music.stop();
FlxG.sound.music.destroy();
}
});
FlxTween.tween(FlxG.sound.music, {volume: 0}, 0.8,
{
onComplete: _ -> {
FlxG.sound.music.stop();
FlxG.sound.music.destroy();
}
});
FlxTween.tween(FlxG.sound.music, {pitch: 3}, 0.1,
{
onComplete: _ -> {
Expand Down
54 changes: 54 additions & 0 deletions source/funkin/ui/freeplay/FreeplayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,11 @@ class FreeplayState extends MusicBeatSubState
{
grpCapsules.members[curSelected].onConfirm();
}

if (FlxG.keys.pressed.R)
{
moveToResultsScreen();
}
}

override function beatHit():Bool
Expand Down Expand Up @@ -2133,6 +2138,55 @@ class FreeplayState extends MusicBeatSubState
result.persistentDraw = true;
return result;
}

// I hope this works - Lasercar

@:nullSafety(Off) // This shouldn't cause any issues, right?
function moveToResultsScreen():Void
{
var save = Save.instance;
var song = save.getSongScore(rememberedSongId, currentDifficulty);
if (song != null)
{
// Ok, so there's actually a score for this song on this difficulty
var songEntry = SongRegistry.instance.fetchEntry(rememberedSongId);
var songName = songEntry.songName;
var songArtist = songEntry.songArtist;
var songScore = song.score;
// persistentUpdate = false;

var talliesToUse = song.tallies;

var res:funkin.play.ResultState = new funkin.play.ResultState(
{
storyMode: false,
songId: rememberedSongId,
difficultyId: currentDifficulty,
characterId: rememberedCharacterId,
title: ('${songName} by ${songArtist}'),
prevScoreData: song,
scoreData:
{
score: songScore,
tallies:
{
sick: talliesToUse.sick,
good: talliesToUse.good,
bad: talliesToUse.bad,
shit: talliesToUse.shit,
missed: talliesToUse.missed,
combo: talliesToUse.combo,
maxCombo: talliesToUse.maxCombo,
totalNotesHit: talliesToUse.totalNotesHit,
totalNotes: talliesToUse.totalNotes,
},
},
isNewHighscore: false
});
// this.persistentDraw = false;
openSubState(res);
}
}
}

/**
Expand Down

0 comments on commit 83b30b2

Please sign in to comment.