1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-09-12 05:07:06 +00:00

Fix issue with pink screen when moving from PlayState->Freeplay->Main Menu

This commit is contained in:
EliteMasterEric 2024-03-28 22:33:50 -04:00
parent aa7ff6fbc4
commit 342782c3d3
7 changed files with 28 additions and 34 deletions

View file

@ -238,11 +238,11 @@ class GameOverSubState extends MusicBeatSubState
}
else if (PlayStatePlaylist.isStoryMode)
{
FlxG.switchState(() -> new StoryMenuState());
openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> new StoryMenuState(sticker)));
}
else
{
FlxG.switchState(() -> new FreeplayState());
openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(sticker)));
}
}

View file

@ -12,6 +12,7 @@ import flixel.tweens.FlxTween;
import flixel.util.FlxColor;
import funkin.audio.FunkinSound;
import funkin.data.song.SongRegistry;
import funkin.ui.freeplay.FreeplayState;
import funkin.graphics.FunkinSprite;
import funkin.play.cutscene.VideoCutscene;
import funkin.play.PlayState;
@ -658,7 +659,7 @@ class PauseSubState extends MusicBeatSubState
}
else
{
state.openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> new funkin.ui.freeplay.FreeplayState(null, sticker)));
state.openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(null, sticker)));
}
}

View file

@ -2785,18 +2785,6 @@ class PlayState extends MusicBeatSubState
if (targetSongId == null)
{
FunkinSound.playMusic('freakyMenu',
{
overrideExisting: true,
restartTrack: false
});
// transIn = FlxTransitionableState.defaultTransIn;
// transOut = FlxTransitionableState.defaultTransOut;
// TODO: Rework week unlock logic.
// StoryMenuState.weekUnlocked[Std.int(Math.min(storyWeek + 1, StoryMenuState.weekUnlocked.length - 1))] = true;
if (currentSong.validScore)
{
NGio.unlockMedal(60961);
@ -3205,7 +3193,10 @@ class PlayState extends MusicBeatSubState
// Don't go back in time to before the song started.
targetTimeMs = Math.max(0, targetTimeMs);
FlxG.sound.music.time = targetTimeMs;
if (FlxG.sound.music != null)
{
FlxG.sound.music.time = targetTimeMs;
}
handleSkippedNotes();
SongEventRegistry.handleSkippedEvents(songEvents, Conductor.instance.songPosition);

View file

@ -365,7 +365,7 @@ class ResultState extends MusicBeatSubState
}
else
{
openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> new FreeplayState(null, sticker)));
openSubState(new funkin.ui.transition.StickerSubState(null, (sticker) -> FreeplayState.build(null, sticker)));
}
}

View file

@ -145,7 +145,7 @@ class FreeplayState extends MusicBeatSubState
stickerSubState = stickers;
}
super();
super(FlxColor.TRANSPARENT);
}
override function create():Void
@ -899,7 +899,7 @@ class FreeplayState extends MusicBeatSubState
if (Type.getClass(FlxG.state) == MainMenuState)
{
FlxG.state.persistentUpdate = true;
FlxG.state.persistentUpdate = false;
FlxG.state.persistentDraw = true;
}
@ -1201,6 +1201,21 @@ class FreeplayState extends MusicBeatSubState
grpCapsules.members[curSelected].selected = true;
}
}
/**
* Build an instance of `FreeplayState` that is above the `MainMenuState`.
* @return The MainMenuState with the FreeplayState as a substate.
*/
public static function build(?params:FreeplayStateParams, ?stickers:StickerSubState):MusicBeatState
{
var result = new MainMenuState();
result.persistentUpdate = false;
result.persistentDraw = true;
result.openSubState(new FreeplayState(params, stickers));
return result;
}
}
/**

View file

@ -56,7 +56,8 @@ class MainMenuState extends MusicBeatState
playMenuMusic();
}
persistentUpdate = persistentDraw = true;
persistentUpdate = false;
persistentDraw = true;
var bg:FlxSprite = new FlxSprite(Paths.image('menuBG'));
bg.scrollFactor.x = 0;
@ -311,8 +312,6 @@ class MainMenuState extends MusicBeatState
// Open the debug menu, defaults to ` / ~
if (controls.DEBUG_MENU)
{
this.persistentUpdate = false;
this.persistentDraw = false;
FlxG.state.openSubState(new DebugMenuSubState());
}

View file

@ -290,18 +290,6 @@ class TitleState extends MusicBeatState
// do controls.PAUSE | controls.ACCEPT instead?
var pressedEnter:Bool = FlxG.keys.justPressed.ENTER;
if (FlxG.onMobile)
{
for (touch in FlxG.touches.list)
{
if (touch.justPressed)
{
FlxG.switchState(() -> new FreeplayState());
pressedEnter = true;
}
}
}
var gamepad:FlxGamepad = FlxG.gamepads.lastActive;
if (gamepad != null)