Merge pull request #440 from FunkinCrew/bugfix/freeplay-menu-transition

Fix PlayState-Freeplay-MainMenu transition, add SFX over cartoon
This commit is contained in:
Cameron Taylor 2024-04-01 22:15:13 -04:00 committed by GitHub
commit 381bd0ac1f
8 changed files with 45 additions and 46 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;
@ -660,7 +661,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

@ -2799,18 +2799,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);
@ -3237,7 +3225,10 @@ class PlayState extends MusicBeatSubState
// Don't go back in time to before the song started.
targetTimeMs = Math.max(0, targetTimeMs);
if (FlxG.sound.music != null) FlxG.sound.music.time = targetTimeMs;
if (FlxG.sound.music != null)
{
FlxG.sound.music.time = targetTimeMs;
}
handleSkippedNotes();
SongEventRegistry.handleSkippedEvents(songEvents, Conductor.instance.songPosition);

View file

@ -384,7 +384,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

@ -27,8 +27,8 @@ class DJBoyfriend extends FlxAtlasSprite
var gotSpooked:Bool = false;
static final SPOOK_PERIOD:Float = 10.0;
static final TV_PERIOD:Float = 10.0;
static final SPOOK_PERIOD:Float = 120.0;
static final TV_PERIOD:Float = 180.0;
// Time since dad last SPOOKED you.
var timeSinceSpook:Float = 0;
@ -43,7 +43,14 @@ class DJBoyfriend extends FlxAtlasSprite
switch (name)
{
case "Boyfriend DJ watchin tv OG":
if (number == 85) runTvLogic();
if (number == 80)
{
FunkinSound.playOnce(Paths.sound('remote_click'));
}
if (number == 85)
{
runTvLogic();
}
default:
}
};
@ -219,19 +226,17 @@ class DJBoyfriend extends FlxAtlasSprite
if (cartoonSnd == null)
{
// tv is OFF, but getting turned on
// Eric got FUCKING TROLLED there is no `tv_on` or `channel_switch` sound!
// FunkinSound.playOnce(Paths.sound('tv_on'), 1.0, function() {
// });
loadCartoon();
FunkinSound.playOnce(Paths.sound('tv_on'), 1.0, function() {
loadCartoon();
});
}
else
{
// plays it smidge after the click
// new FlxTimer().start(0.1, function(_) {
// // FunkinSound.playOnce(Paths.sound('channel_switch'));
// });
cartoonSnd.destroy();
loadCartoon();
FunkinSound.playOnce(Paths.sound('channel_switch'), 1.0, function() {
cartoonSnd.destroy();
loadCartoon();
});
}
// loadCartoon();

View file

@ -145,7 +145,7 @@ class FreeplayState extends MusicBeatSubState
stickerSubState = stickers;
}
super();
super(FlxColor.TRANSPARENT);
}
override function create():Void
@ -928,7 +928,7 @@ class FreeplayState extends MusicBeatSubState
if (Type.getClass(FlxG.state) == MainMenuState)
{
FlxG.state.persistentUpdate = true;
FlxG.state.persistentUpdate = false;
FlxG.state.persistentDraw = true;
}
@ -1239,6 +1239,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

@ -53,7 +53,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;
@ -323,8 +324,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)