mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-22 06:43:39 +00:00
Fix a boatload of deprecation warnings and upgrade a few libraries.
This commit is contained in:
parent
167976c8ba
commit
e5fb1de4ba
|
@ -108,7 +108,6 @@
|
|||
<haxelib name="hxCodec" /> <!-- Video playback -->
|
||||
|
||||
<haxelib name="json2object" /> <!-- JSON parsing -->
|
||||
<haxelib name="tink_json" /> <!-- JSON parsing (DEPRECATED) -->
|
||||
<haxelib name="thx.semver" /> <!-- Version string handling -->
|
||||
|
||||
<haxelib name="hmm" /> <!-- Read library version data at compile time so it can be baked into logs -->
|
||||
|
@ -124,8 +123,8 @@
|
|||
<!--
|
||||
Hide deprecation warnings until they're fixed.
|
||||
TODO: REMOVE THIS!!!!
|
||||
<haxeflag name="-w" value="-WDeprecated" />
|
||||
-->
|
||||
<haxeflag name="-w" value="-WDeprecated" />
|
||||
|
||||
<!-- Haxe 4.3.0+: Enable pretty syntax errors and stuff. -->
|
||||
<haxedef name="message.reporting" value="pretty" />
|
||||
|
|
18
hmm.json
18
hmm.json
|
@ -88,8 +88,10 @@
|
|||
},
|
||||
{
|
||||
"name": "hxcpp-debug-server",
|
||||
"type": "haxelib",
|
||||
"version": "1.2.4"
|
||||
"type": "git",
|
||||
"dir": "hxcpp-debug-server",
|
||||
"ref": "147294123f983e35f50a966741474438069a7a8f",
|
||||
"url": "https://github.com/FunkinCrew/hxcpp-debugger"
|
||||
},
|
||||
{
|
||||
"name": "hxp",
|
||||
|
@ -152,15 +154,17 @@
|
|||
"ref": "cb11a95d0159271eb3587428cf4b9602e46dc469",
|
||||
"url": "https://github.com/larsiusprime/polymod"
|
||||
},
|
||||
{
|
||||
"name": "thx.core",
|
||||
"type": "git",
|
||||
"dir": null,
|
||||
"ref": "22605ff44f01971d599641790d6bae4869f7d9f4",
|
||||
"url": "https://github.com/FunkinCrew/thx.core"
|
||||
},
|
||||
{
|
||||
"name": "thx.semver",
|
||||
"type": "haxelib",
|
||||
"version": "0.2.2"
|
||||
},
|
||||
{
|
||||
"name": "tink_json",
|
||||
"type": "haxelib",
|
||||
"version": "0.11.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import flixel.addons.transition.FlxTransitionableState;
|
|||
* var in:TransitionData = new TransitionData(...); // add your data where "..." is
|
||||
* var out:TransitionData = new TransitionData(...);
|
||||
*
|
||||
* FlxG.switchState(new FooState(in,out));
|
||||
* FlxG.switchState(() -> new FooState(in,out));
|
||||
* ```
|
||||
*
|
||||
* Method 2:
|
||||
|
@ -25,7 +25,7 @@ import flixel.addons.transition.FlxTransitionableState;
|
|||
* FlxTransitionableSubState.defaultTransIn = new TransitionData(...);
|
||||
* FlxTransitionableSubState.defaultTransOut = new TransitionData(...);
|
||||
*
|
||||
* FlxG.switchState(new FooState());
|
||||
* FlxG.switchState(() -> new FooState());
|
||||
* ```
|
||||
*/
|
||||
class FlxTransitionableSubState extends FlxSubState
|
||||
|
|
|
@ -240,17 +240,17 @@ class InitState extends FlxState
|
|||
#elseif LEVEL // -DLEVEL=week1 -DDIFFICULTY=hard
|
||||
startLevel(defineLevel(), defineDifficulty());
|
||||
#elseif FREEPLAY // -DFREEPLAY
|
||||
FlxG.switchState(new FreeplayState());
|
||||
FlxG.switchState(() -> new funkin.ui.freeplay.FreeplayState());
|
||||
#elseif ANIMATE // -DANIMATE
|
||||
FlxG.switchState(new funkin.ui.debug.anim.FlxAnimateTest());
|
||||
FlxG.switchState(() -> new funkin.ui.debug.anim.FlxAnimateTest());
|
||||
#elseif CHARTING // -DCHARTING
|
||||
FlxG.switchState(new funkin.ui.debug.charting.ChartEditorState());
|
||||
FlxG.switchState(() -> new funkin.ui.debug.charting.ChartEditorState());
|
||||
#elseif STAGEBUILD // -DSTAGEBUILD
|
||||
FlxG.switchState(new funkin.ui.debug.stage.StageBuilderState());
|
||||
FlxG.switchState(() -> new funkin.ui.debug.stage.StageBuilderState());
|
||||
#elseif ANIMDEBUG // -DANIMDEBUG
|
||||
FlxG.switchState(new funkin.ui.debug.anim.DebugBoundingState());
|
||||
FlxG.switchState(() -> new funkin.ui.debug.anim.DebugBoundingState());
|
||||
#elseif LATENCY // -DLATENCY
|
||||
FlxG.switchState(new funkin.LatencyState());
|
||||
FlxG.switchState(() -> new funkin.LatencyState());
|
||||
#else
|
||||
startGameNormally();
|
||||
#end
|
||||
|
@ -266,7 +266,7 @@ class InitState extends FlxState
|
|||
|
||||
if (params.chart.shouldLoadChart)
|
||||
{
|
||||
FlxG.switchState(new ChartEditorState(
|
||||
FlxG.switchState(() -> new ChartEditorState(
|
||||
{
|
||||
fnfcTargetPath: params.chart.chartPath,
|
||||
}));
|
||||
|
@ -274,7 +274,7 @@ class InitState extends FlxState
|
|||
else
|
||||
{
|
||||
FlxG.sound.cache(Paths.music('freakyMenu/freakyMenu'));
|
||||
FlxG.switchState(new TitleState());
|
||||
FlxG.switchState(() -> new TitleState());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ class InitState extends FlxState
|
|||
// TODO: Do this in the loading state.
|
||||
songData.cacheCharts(true);
|
||||
|
||||
LoadingState.loadAndSwitchState(new funkin.play.PlayState(
|
||||
LoadingState.loadAndSwitchState(() -> new funkin.play.PlayState(
|
||||
{
|
||||
targetSong: songData,
|
||||
targetDifficulty: difficultyId,
|
||||
|
@ -327,7 +327,7 @@ class InitState extends FlxState
|
|||
|
||||
var targetSong:funkin.play.song.Song = SongRegistry.instance.fetchEntry(targetSongId);
|
||||
|
||||
LoadingState.loadAndSwitchState(new funkin.play.PlayState(
|
||||
LoadingState.loadAndSwitchState(() -> new funkin.play.PlayState(
|
||||
{
|
||||
targetSong: targetSong,
|
||||
targetDifficulty: difficultyId,
|
||||
|
|
|
@ -207,11 +207,11 @@ class GameOverSubState extends MusicBeatSubState
|
|||
}
|
||||
else if (PlayStatePlaylist.isStoryMode)
|
||||
{
|
||||
FlxG.switchState(new StoryMenuState());
|
||||
FlxG.switchState(() -> new StoryMenuState());
|
||||
}
|
||||
else
|
||||
{
|
||||
FlxG.switchState(new FreeplayState());
|
||||
FlxG.switchState(() -> new FreeplayState());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -66,11 +66,11 @@ class GitarooPause extends MusicBeatState
|
|||
{
|
||||
FlxTransitionableState.skipNextTransIn = false;
|
||||
FlxTransitionableState.skipNextTransOut = false;
|
||||
FlxG.switchState(new PlayState(previousParams));
|
||||
FlxG.switchState(() -> new PlayState(previousParams));
|
||||
}
|
||||
else
|
||||
{
|
||||
FlxG.switchState(new MainMenuState());
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -234,11 +234,11 @@ class PauseSubState extends MusicBeatSubState
|
|||
if (PlayStatePlaylist.isStoryMode)
|
||||
{
|
||||
PlayStatePlaylist.reset();
|
||||
openSubState(new funkin.ui.transition.StickerSubState(null, STORY));
|
||||
openSubState(new funkin.ui.transition.StickerSubState(null, () -> new funkin.ui.story.StoryMenuState()));
|
||||
}
|
||||
else
|
||||
{
|
||||
openSubState(new funkin.ui.transition.StickerSubState(null, FREEPLAY));
|
||||
openSubState(new funkin.ui.transition.StickerSubState(null, () -> new funkin.ui.freeplay.FreeplayState()));
|
||||
}
|
||||
|
||||
case 'Exit to Chart Editor':
|
||||
|
|
|
@ -690,9 +690,9 @@ class PlayState extends MusicBeatSubState
|
|||
{
|
||||
message = 'The was a critical error selecting a difficulty for this song. Click OK to return to the main menu.';
|
||||
}
|
||||
else if (currentSong.getDifficulty(currentDifficulty) == null)
|
||||
else if (currentChart == null)
|
||||
{
|
||||
message = 'The was a critical error retrieving data for this song on "$currentDifficulty" difficulty. Click OK to return to the main menu.';
|
||||
message = 'The was a critical error retrieving data for this song on "$currentDifficulty" difficulty playing as "$currentPlayerId". Click OK to return to the main menu.';
|
||||
}
|
||||
|
||||
// Display a popup. This blocks the application until the user clicks OK.
|
||||
|
@ -705,7 +705,7 @@ class PlayState extends MusicBeatSubState
|
|||
}
|
||||
else
|
||||
{
|
||||
FlxG.switchState(new MainMenuState());
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -834,7 +834,7 @@ class PlayState extends MusicBeatSubState
|
|||
// It's a reference to Gitaroo Man, which doesn't let you pause the game.
|
||||
if (!isSubState && event.gitaroo)
|
||||
{
|
||||
FlxG.switchState(new GitarooPause(
|
||||
FlxG.switchState(() -> new GitarooPause(
|
||||
{
|
||||
targetSong: currentSong,
|
||||
targetDifficulty: currentDifficulty,
|
||||
|
@ -2235,7 +2235,7 @@ class PlayState extends MusicBeatSubState
|
|||
#end
|
||||
|
||||
// Eject button
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(new MainMenuState());
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState());
|
||||
|
||||
if (FlxG.keys.justPressed.F5) debug_refreshModules();
|
||||
|
||||
|
@ -2253,7 +2253,7 @@ class PlayState extends MusicBeatSubState
|
|||
{
|
||||
disableKeys = true;
|
||||
persistentUpdate = false;
|
||||
FlxG.switchState(new ChartEditorState(
|
||||
FlxG.switchState(() -> new ChartEditorState(
|
||||
{
|
||||
targetSongId: currentSong.id,
|
||||
}));
|
||||
|
@ -2595,14 +2595,16 @@ class PlayState extends MusicBeatSubState
|
|||
// TODO: Do this in the loading state.
|
||||
targetSong.cacheCharts(true);
|
||||
|
||||
var nextPlayState:PlayState = new PlayState(
|
||||
{
|
||||
targetSong: targetSong,
|
||||
targetDifficulty: PlayStatePlaylist.campaignDifficulty,
|
||||
targetCharacter: currentPlayerId,
|
||||
});
|
||||
nextPlayState.previousCameraFollowPoint = new FlxSprite(cameraFollowPoint.x, cameraFollowPoint.y);
|
||||
LoadingState.loadAndSwitchState(nextPlayState);
|
||||
LoadingState.loadAndSwitchState(() -> {
|
||||
var nextPlayState:PlayState = new PlayState(
|
||||
{
|
||||
targetSong: targetSong,
|
||||
targetDifficulty: PlayStatePlaylist.campaignDifficulty,
|
||||
targetCharacter: currentPlayerId,
|
||||
});
|
||||
nextPlayState.previousCameraFollowPoint = new FlxSprite(cameraFollowPoint.x, cameraFollowPoint.y);
|
||||
return nextPlayState;
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@ -2611,14 +2613,16 @@ class PlayState extends MusicBeatSubState
|
|||
// Load and cache the song's charts.
|
||||
// TODO: Do this in the loading state.
|
||||
targetSong.cacheCharts(true);
|
||||
var nextPlayState:PlayState = new PlayState(
|
||||
{
|
||||
targetSong: targetSong,
|
||||
targetDifficulty: PlayStatePlaylist.campaignDifficulty,
|
||||
targetCharacter: currentPlayerId,
|
||||
});
|
||||
nextPlayState.previousCameraFollowPoint = new FlxSprite(cameraFollowPoint.x, cameraFollowPoint.y);
|
||||
LoadingState.loadAndSwitchState(nextPlayState);
|
||||
LoadingState.loadAndSwitchState(() -> {
|
||||
var nextPlayState:PlayState = new PlayState(
|
||||
{
|
||||
targetSong: targetSong,
|
||||
targetDifficulty: PlayStatePlaylist.campaignDifficulty,
|
||||
targetCharacter: currentPlayerId,
|
||||
});
|
||||
nextPlayState.previousCameraFollowPoint = new FlxSprite(cameraFollowPoint.x, cameraFollowPoint.y);
|
||||
return nextPlayState;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -352,11 +352,11 @@ class ResultState extends MusicBeatSubState
|
|||
{
|
||||
if (params.storyMode)
|
||||
{
|
||||
FlxG.switchState(new StoryMenuState());
|
||||
FlxG.switchState(() -> new StoryMenuState());
|
||||
}
|
||||
else
|
||||
{
|
||||
FlxG.switchState(new FreeplayState());
|
||||
FlxG.switchState(() -> new FreeplayState());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ class ConversationData
|
|||
|
||||
public static function fromString(i:String):ConversationData
|
||||
{
|
||||
// TODO: Replace this with json2object.
|
||||
if (i == null || i == '') return null;
|
||||
var data:
|
||||
{
|
||||
|
@ -35,7 +36,7 @@ class ConversationData
|
|||
?outro:Dynamic, // TODO: tink.Json doesn't like when these are typed
|
||||
?music:Dynamic, // TODO: tink.Json doesn't like when these are typed
|
||||
dialogue:Array<Dynamic> // TODO: tink.Json doesn't like when these are typed
|
||||
} = tink.Json.parse(i);
|
||||
} = SerializerUtil.fromJSON(i);
|
||||
return fromJson(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ class DialogueBoxData
|
|||
|
||||
public static function fromString(i:String):DialogueBoxData
|
||||
{
|
||||
// TODO: Replace this with json2object.
|
||||
if (i == null || i == '') return null;
|
||||
var data:
|
||||
{
|
||||
|
@ -51,7 +52,7 @@ class DialogueBoxData
|
|||
text:Dynamic,
|
||||
scale:Float,
|
||||
animations:Array<AnimationData>
|
||||
} = tink.Json.parse(i);
|
||||
} = SerializerUtil.fromJSON(i);
|
||||
return fromJson(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package funkin.play.cutscene.dialogue;
|
||||
|
||||
import funkin.data.animation.AnimationData;
|
||||
import funkin.util.SerializerUtil;
|
||||
|
||||
/**
|
||||
* Data about a conversation.
|
||||
|
@ -37,6 +38,7 @@ class SpeakerData
|
|||
|
||||
public static function fromString(i:String):SpeakerData
|
||||
{
|
||||
// TODO: Replace this with json2object.
|
||||
if (i == null || i == '') return null;
|
||||
var data:
|
||||
{
|
||||
|
@ -48,7 +50,7 @@ class SpeakerData
|
|||
?flipX:Bool,
|
||||
?isPixel:Bool,
|
||||
?scale:Float
|
||||
} = tink.Json.parse(i);
|
||||
} = SerializerUtil.fromJSON(i);
|
||||
return fromJson(data);
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ class MusicBeatState extends FlxTransitionableState implements IEventHandler
|
|||
function handleFunctionControls():Void
|
||||
{
|
||||
// Emergency exit button.
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(new MainMenuState());
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState());
|
||||
|
||||
// This can now be used in EVERY STATE YAY!
|
||||
if (FlxG.keys.justPressed.F5) debug_refreshModules();
|
||||
|
|
|
@ -59,7 +59,7 @@ class MusicBeatSubState extends FlxTransitionableSubState implements IEventHandl
|
|||
else if (controls.VOLUME_DOWN) FlxG.sound.changeVolume(-0.1);
|
||||
|
||||
// Emergency exit button.
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(new MainMenuState());
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState());
|
||||
|
||||
// This can now be used in EVERY STATE YAY!
|
||||
if (FlxG.keys.justPressed.F5) debug_refreshModules();
|
||||
|
|
|
@ -87,12 +87,12 @@ class DebugMenuSubState extends MusicBeatSubState
|
|||
{
|
||||
FlxTransitionableState.skipNextTransIn = true;
|
||||
|
||||
FlxG.switchState(new ChartEditorState());
|
||||
FlxG.switchState(() -> new ChartEditorState());
|
||||
}
|
||||
|
||||
function openAnimationEditor()
|
||||
{
|
||||
FlxG.switchState(new funkin.ui.debug.anim.DebugBoundingState());
|
||||
FlxG.switchState(() -> new funkin.ui.debug.anim.DebugBoundingState());
|
||||
trace('Animation Editor');
|
||||
}
|
||||
|
||||
|
|
|
@ -364,7 +364,7 @@ class DebugBoundingState extends FlxState
|
|||
|
||||
if (FlxG.keys.justPressed.H) hudCam.visible = !hudCam.visible;
|
||||
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(new MainMenuState());
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState());
|
||||
|
||||
MouseUtil.mouseCamDrag();
|
||||
MouseUtil.mouseWheelZoom();
|
||||
|
|
|
@ -5037,7 +5037,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState
|
|||
stopWelcomeMusic();
|
||||
// TODO: PR Flixel to make onComplete nullable.
|
||||
if (audioInstTrack != null) audioInstTrack.onComplete = null;
|
||||
FlxG.switchState(new MainMenuState());
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
|
||||
resetWindowTitle();
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ class CopyItemsCommand implements ChartEditorCommand
|
|||
state.txtCopyNotif.y = FlxG.mouse.y - 16;
|
||||
FlxTween.tween(state.txtCopyNotif, {y: state.txtCopyNotif.y - 32}, 0.5,
|
||||
{
|
||||
type: FlxTween.ONESHOT,
|
||||
type: FlxTweenType.ONESHOT,
|
||||
ease: FlxEase.quadOut,
|
||||
onComplete: function(_) {
|
||||
state.txtCopyNotif.visible = false;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package funkin.ui.debug.charting.handlers;
|
||||
|
||||
import flixel.system.FlxAssets.FlxSoundAsset;
|
||||
import flixel.system.FlxSound;
|
||||
import flixel.sound.FlxSound;
|
||||
import funkin.audio.VoicesGroup;
|
||||
import funkin.audio.visualize.PolygonVisGroup;
|
||||
import funkin.audio.FunkinSound;
|
||||
|
|
|
@ -45,7 +45,7 @@ class HaxeUISubState extends MusicBeatSubState
|
|||
super.update(elapsed);
|
||||
|
||||
// Force quit.
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(new MainMenuState());
|
||||
if (FlxG.keys.justPressed.F4) FlxG.switchState(() -> new MainMenuState());
|
||||
|
||||
// Refresh the component.
|
||||
if (FlxG.keys.justPressed.F5)
|
||||
|
|
|
@ -8,6 +8,7 @@ import flixel.FlxState;
|
|||
import flixel.addons.transition.FlxTransitionableState;
|
||||
import flixel.effects.FlxFlicker;
|
||||
import flixel.graphics.frames.FlxAtlasFrames;
|
||||
import flixel.util.typeLimit.NextState;
|
||||
import flixel.group.FlxGroup.FlxTypedGroup;
|
||||
import flixel.input.touch.FlxTouch;
|
||||
import flixel.text.FlxText;
|
||||
|
@ -94,7 +95,7 @@ class MainMenuState extends MusicBeatState
|
|||
});
|
||||
|
||||
menuItems.enabled = true; // can move on intro
|
||||
createMenuItem('storymode', 'mainmenu/storymode', function() startExitState(new StoryMenuState()));
|
||||
createMenuItem('storymode', 'mainmenu/storymode', function() startExitState(() -> new StoryMenuState()));
|
||||
createMenuItem('freeplay', 'mainmenu/freeplay', function() {
|
||||
persistentDraw = true;
|
||||
persistentUpdate = false;
|
||||
|
@ -110,7 +111,7 @@ class MainMenuState extends MusicBeatState
|
|||
#end
|
||||
|
||||
createMenuItem('options', 'mainmenu/options', function() {
|
||||
startExitState(new funkin.ui.options.OptionsState());
|
||||
startExitState(() -> new funkin.ui.options.OptionsState());
|
||||
});
|
||||
|
||||
// Reset position of menu items.
|
||||
|
@ -255,7 +256,7 @@ class MainMenuState extends MusicBeatState
|
|||
openSubState(prompt);
|
||||
}
|
||||
|
||||
function startExitState(state:FlxState)
|
||||
function startExitState(state:NextState)
|
||||
{
|
||||
menuItems.enabled = false; // disable for exit
|
||||
var duration = 0.4;
|
||||
|
@ -313,7 +314,7 @@ class MainMenuState extends MusicBeatState
|
|||
if (controls.BACK && menuItems.enabled && !menuItems.busy)
|
||||
{
|
||||
FlxG.sound.play(Paths.sound('cancelMenu'));
|
||||
FlxG.switchState(new TitleState());
|
||||
FlxG.switchState(() -> new TitleState());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ class OptionsState extends MusicBeatState
|
|||
{
|
||||
currentPage.enabled = false;
|
||||
// TODO: Animate this transition?
|
||||
FlxG.switchState(new MainMenuState());
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -397,7 +397,7 @@ class StoryMenuState extends MusicBeatState
|
|||
{
|
||||
FlxG.sound.play(Paths.sound('cancelMenu'));
|
||||
exitingMenu = true;
|
||||
FlxG.switchState(new MainMenuState());
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -565,7 +565,7 @@ class StoryMenuState extends MusicBeatState
|
|||
FlxTransitionableState.skipNextTransIn = false;
|
||||
FlxTransitionableState.skipNextTransOut = false;
|
||||
|
||||
LoadingState.loadAndSwitchState(new PlayState(
|
||||
LoadingState.loadAndSwitchState(() -> new PlayState(
|
||||
{
|
||||
targetSong: targetSong,
|
||||
targetDifficulty: PlayStatePlaylist.campaignDifficulty,
|
||||
|
|
|
@ -105,6 +105,6 @@ class AttractState extends MusicBeatState
|
|||
vid.destroy();
|
||||
vid = null;
|
||||
|
||||
FlxG.switchState(new TitleState());
|
||||
FlxG.switchState(() -> new TitleState());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ class OutdatedSubState extends MusicBeatState
|
|||
if (controls.BACK)
|
||||
{
|
||||
leftState = true;
|
||||
FlxG.switchState(new MainMenuState());
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
}
|
||||
super.update(elapsed);
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import flixel.tweens.FlxTween;
|
|||
import flixel.util.FlxColor;
|
||||
import flixel.util.FlxDirectionFlags;
|
||||
import flixel.util.FlxTimer;
|
||||
import flixel.util.typeLimit.NextState;
|
||||
import funkin.audio.visualize.SpectogramSprite;
|
||||
import funkin.graphics.shaders.ColorSwap;
|
||||
import funkin.graphics.shaders.LeftMaskShader;
|
||||
|
@ -213,7 +214,7 @@ class TitleState extends MusicBeatState
|
|||
*/
|
||||
function moveToAttract():Void
|
||||
{
|
||||
FlxG.switchState(new AttractState());
|
||||
FlxG.switchState(() -> new AttractState());
|
||||
}
|
||||
|
||||
function playMenuMusic():Void
|
||||
|
@ -294,7 +295,7 @@ class TitleState extends MusicBeatState
|
|||
{
|
||||
if (touch.justPressed)
|
||||
{
|
||||
FlxG.switchState(new FreeplayState());
|
||||
FlxG.switchState(() -> new FreeplayState());
|
||||
pressedEnter = true;
|
||||
}
|
||||
}
|
||||
|
@ -313,7 +314,7 @@ class TitleState extends MusicBeatState
|
|||
// If you spam Enter, we should skip the transition.
|
||||
if (pressedEnter && transitioning && skippedIntro)
|
||||
{
|
||||
FlxG.switchState(new MainMenuState());
|
||||
FlxG.switchState(() -> new MainMenuState());
|
||||
}
|
||||
|
||||
if (pressedEnter && !transitioning && skippedIntro)
|
||||
|
@ -328,7 +329,7 @@ class TitleState extends MusicBeatState
|
|||
FlxG.sound.play(Paths.sound('confirmMenu'), 0.7);
|
||||
transitioning = true;
|
||||
|
||||
var targetState:FlxState = new MainMenuState();
|
||||
var targetState:NextState = () -> new MainMenuState();
|
||||
|
||||
new FlxTimer().start(2, function(tmr:FlxTimer) {
|
||||
// These assets are very unlikely to be used for the rest of gameplay, so it unloads them from cache/memory
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package funkin.ui.transition;
|
||||
|
||||
import flixel.FlxSprite;
|
||||
import flixel.FlxState;
|
||||
import flixel.math.FlxMath;
|
||||
import flixel.tweens.FlxEase;
|
||||
import flixel.tweens.FlxTween;
|
||||
|
@ -21,12 +20,13 @@ import lime.utils.AssetManifest;
|
|||
import lime.utils.Assets as LimeAssets;
|
||||
import openfl.filters.ShaderFilter;
|
||||
import openfl.utils.Assets;
|
||||
import flixel.util.typeLimit.NextState;
|
||||
|
||||
class LoadingState extends MusicBeatState
|
||||
{
|
||||
inline static var MIN_TIME = 1.0;
|
||||
|
||||
var target:FlxState;
|
||||
var target:NextState;
|
||||
var stopMusic = false;
|
||||
var callbacks:MultiCallback;
|
||||
var danceLeft = false;
|
||||
|
@ -34,7 +34,7 @@ class LoadingState extends MusicBeatState
|
|||
var loadBar:FlxSprite;
|
||||
var funkay:FlxSprite;
|
||||
|
||||
function new(target:FlxState, stopMusic:Bool)
|
||||
function new(target:NextState, stopMusic:Bool)
|
||||
{
|
||||
super();
|
||||
this.target = target;
|
||||
|
@ -172,12 +172,12 @@ class LoadingState extends MusicBeatState
|
|||
return Paths.inst(PlayState.instance.currentSong.id);
|
||||
}
|
||||
|
||||
inline static public function loadAndSwitchState(nextState:FlxState, shouldStopMusic = false):Void
|
||||
inline static public function loadAndSwitchState(nextState:NextState, shouldStopMusic = false):Void
|
||||
{
|
||||
FlxG.switchState(getNextState(nextState, shouldStopMusic));
|
||||
}
|
||||
|
||||
static function getNextState(nextState:FlxState, shouldStopMusic = false):FlxState
|
||||
static function getNextState(nextState:NextState, shouldStopMusic = false):NextState
|
||||
{
|
||||
Paths.setCurrentLevel(PlayStatePlaylist.campaignId);
|
||||
|
||||
|
@ -186,7 +186,7 @@ class LoadingState extends MusicBeatState
|
|||
// && (!PlayState.currentSong.needsVoices || isSoundLoaded(getVocalPath()))
|
||||
// && isLibraryLoaded('shared');
|
||||
//
|
||||
if (true) return new LoadingState(nextState, shouldStopMusic);
|
||||
if (true) return () -> new LoadingState(nextState, shouldStopMusic);
|
||||
#end
|
||||
if (shouldStopMusic && FlxG.sound.music != null) FlxG.sound.music.stop();
|
||||
|
||||
|
@ -332,7 +332,7 @@ class MultiCallback
|
|||
public function getUnfired():Array<Void->Void>
|
||||
return unfired.array();
|
||||
|
||||
public static function coolSwitchState(state:FlxState, transitionTex:String = "shaderTransitionStuff/coolDots", time:Float = 2)
|
||||
public static function coolSwitchState(state:NextState, transitionTex:String = "shaderTransitionStuff/coolDots", time:Float = 2)
|
||||
{
|
||||
var screenShit:FlxSprite = new FlxSprite().loadGraphic(Paths.image("shaderTransitionStuff/coolDots"));
|
||||
var screenWipeShit:ScreenWipeShader = new ScreenWipeShader();
|
||||
|
@ -343,9 +343,9 @@ class MultiCallback
|
|||
ease: FlxEase.quadInOut,
|
||||
onComplete: function(twn) {
|
||||
screenShit.destroy();
|
||||
FlxG.switchState(new MainMenuState());
|
||||
FlxG.switchState(state);
|
||||
}
|
||||
});
|
||||
FlxG.camera.setFilters([new ShaderFilter(screenWipeShit)]);
|
||||
FlxG.camera.filters = [new ShaderFilter(screenWipeShit)];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,7 @@ import funkin.ui.freeplay.FreeplayState;
|
|||
import openfl.geom.Matrix;
|
||||
import openfl.display.Sprite;
|
||||
import openfl.display.Bitmap;
|
||||
import flixel.FlxState;
|
||||
|
||||
using Lambda;
|
||||
using StringTools;
|
||||
|
@ -30,7 +31,12 @@ class StickerSubState extends MusicBeatSubState
|
|||
// yes... a damn OpenFL sprite!!!
|
||||
public var dipshit:Sprite;
|
||||
|
||||
var nextState:NEXTSTATE = FREEPLAY;
|
||||
/**
|
||||
* The state to switch to after the stickers are done.
|
||||
* This is a FUNCTION so we can pass it directly to `FlxG.switchState()`,
|
||||
* and we can add constructor parameters in the caller.
|
||||
*/
|
||||
var targetState:Void->FlxState;
|
||||
|
||||
// what "folders" to potentially load from (as of writing only "keys" exist)
|
||||
var soundSelections:Array<String> = [];
|
||||
|
@ -38,10 +44,15 @@ class StickerSubState extends MusicBeatSubState
|
|||
var soundSelection:String = "";
|
||||
var sounds:Array<String> = [];
|
||||
|
||||
public function new(?oldStickers:Array<StickerSprite>, ?nextState:NEXTSTATE = FREEPLAY):Void
|
||||
public function new(?oldStickers:Array<StickerSprite>, ?targetState:Void->FlxState):Void
|
||||
{
|
||||
super();
|
||||
|
||||
if (targetState != null)
|
||||
{
|
||||
this.targetState = () -> new MainMenuState();
|
||||
}
|
||||
|
||||
// todo still
|
||||
// make sure that ONLY plays mp3/ogg files
|
||||
// if there's no mp3/ogg file, then it regenerates/reloads the random folder
|
||||
|
@ -84,10 +95,6 @@ class StickerSubState extends MusicBeatSubState
|
|||
|
||||
trace(sounds);
|
||||
|
||||
// trace(assetsInList);
|
||||
|
||||
this.nextState = nextState;
|
||||
|
||||
grpStickers = new FlxTypedGroup<StickerSprite>();
|
||||
add(grpStickers);
|
||||
|
||||
|
@ -241,20 +248,8 @@ class StickerSubState extends MusicBeatSubState
|
|||
dipshit.addChild(bitmap);
|
||||
FlxG.addChildBelowMouse(dipshit);
|
||||
|
||||
switch (nextState)
|
||||
{
|
||||
case FREEPLAY:
|
||||
FlxG.switchState(new FreeplayState(this));
|
||||
case STORY:
|
||||
FlxG.switchState(new StoryMenuState(this));
|
||||
case MAIN_MENU:
|
||||
FlxG.switchState(new MainMenuState());
|
||||
default:
|
||||
FlxG.switchState(new MainMenuState());
|
||||
}
|
||||
FlxG.switchState(targetState);
|
||||
}
|
||||
|
||||
// sticky.angle *= FlxG.random.float(0, 0.05);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -368,10 +363,3 @@ typedef StickerShit =
|
|||
stickers:Map<String, Array<String>>,
|
||||
stickerPacks:Map<String, Array<String>>
|
||||
}
|
||||
|
||||
enum abstract NEXTSTATE(String)
|
||||
{
|
||||
var MAIN_MENU = 'mainmenu';
|
||||
var FREEPLAY = 'freeplay';
|
||||
var STORY = 'story';
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class EvacuateDebugPlugin extends FlxBasic
|
|||
|
||||
if (FlxG.keys.justPressed.F4)
|
||||
{
|
||||
FlxG.switchState(new funkin.ui.mainmenu.MainMenuState());
|
||||
FlxG.switchState(() -> new funkin.ui.mainmenu.MainMenuState());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ class Int64Tools
|
|||
|
||||
public static function toFloat(i:Int64):Float
|
||||
{
|
||||
var f:Float = Int64.getLow(i);
|
||||
var f:Float = i.low;
|
||||
if (f < 0) f += MAX_32_PRECISION;
|
||||
return (Int64.getHigh(i) * MAX_32_PRECISION + f);
|
||||
return (i.high * MAX_32_PRECISION + f);
|
||||
}
|
||||
|
||||
public static function isToIntSafe(i:Int64):Bool
|
||||
|
|
Loading…
Reference in a new issue