From a7eb91ce296de5ce24ea8a75514841d0780a095d Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 9 Jun 2023 15:44:29 -0400 Subject: [PATCH] the SubState... --- source/funkin/ButtonRemapSubstate.hx | 2 +- source/funkin/FreeplayState.hx | 2 +- source/funkin/LatencyState.hx | 2 +- source/funkin/MusicBeatState.hx | 14 +++++++------- .../{MusicBeatSubstate.hx => MusicBeatSubState.hx} | 4 ++-- source/funkin/PauseSubState.hx | 2 +- source/funkin/modding/IScriptedClass.hx | 8 ++++---- .../modding/base/ScriptedMusicBeatSubState.hx | 8 ++++++++ .../modding/base/ScriptedMusicBeatSubstate.hx | 8 -------- .../funkin/modding/events/ScriptEventDispatcher.hx | 8 ++++---- source/funkin/modding/module/Module.hx | 8 ++++---- .../{GameOverSubstate.hx => GameOverSubState.hx} | 6 +++--- source/funkin/play/PlayState.hx | 10 +++++----- source/funkin/play/ResultState.hx | 2 +- source/funkin/play/character/BaseCharacter.hx | 2 +- source/funkin/ui/StickerSubState.hx | 2 +- source/funkin/ui/debug/DebugMenuSubState.hx | 4 ++-- source/funkin/ui/haxeui/HaxeUISubState.hx | 2 +- .../funkin/ui/stageBuildShit/StageEditorCommand.hx | 12 ++++++------ ...ageOffsetSubstate.hx => StageOffsetSubState.hx} | 2 +- 20 files changed, 54 insertions(+), 54 deletions(-) rename source/funkin/{MusicBeatSubstate.hx => MusicBeatSubState.hx} (94%) create mode 100644 source/funkin/modding/base/ScriptedMusicBeatSubState.hx delete mode 100644 source/funkin/modding/base/ScriptedMusicBeatSubstate.hx rename source/funkin/play/{GameOverSubstate.hx => GameOverSubState.hx} (98%) rename source/funkin/ui/stageBuildShit/{StageOffsetSubstate.hx => StageOffsetSubState.hx} (99%) diff --git a/source/funkin/ButtonRemapSubstate.hx b/source/funkin/ButtonRemapSubstate.hx index 376cc4d54..8905ec8ba 100644 --- a/source/funkin/ButtonRemapSubstate.hx +++ b/source/funkin/ButtonRemapSubstate.hx @@ -2,7 +2,7 @@ package funkin; import flixel.FlxSubState; -class ButtonRemapSubstate extends FlxSubState +class ButtonRemapSubState extends FlxSubState { public function new() { diff --git a/source/funkin/FreeplayState.hx b/source/funkin/FreeplayState.hx index bab9b95a2..bcf6bfc18 100644 --- a/source/funkin/FreeplayState.hx +++ b/source/funkin/FreeplayState.hx @@ -37,7 +37,7 @@ import funkin.shaderslmfao.StrokeShader; import lime.app.Future; import lime.utils.Assets; -class FreeplayState extends MusicBeatSubstate +class FreeplayState extends MusicBeatSubState { var songs:Array = []; diff --git a/source/funkin/LatencyState.hx b/source/funkin/LatencyState.hx index ad803b963..694e9c3e5 100644 --- a/source/funkin/LatencyState.hx +++ b/source/funkin/LatencyState.hx @@ -14,7 +14,7 @@ import funkin.ui.CoolStatsGraph; import haxe.Timer; import openfl.events.KeyboardEvent; -class LatencyState extends MusicBeatSubstate +class LatencyState extends MusicBeatSubState { var offsetText:FlxText; var noteGrp:FlxTypedGroup; diff --git a/source/funkin/MusicBeatState.hx b/source/funkin/MusicBeatState.hx index 3614695c0..6c6591c62 100644 --- a/source/funkin/MusicBeatState.hx +++ b/source/funkin/MusicBeatState.hx @@ -35,8 +35,8 @@ class MusicBeatState extends FlxUIState function initCallbacks() { - subStateOpened.add(onOpenSubstateComplete); - subStateClosed.add(onCloseSubstateComplete); + subStateOpened.add(onOpenSubStateComplete); + subStateClosed.add(onCloseSubStateComplete); } override function create() @@ -162,18 +162,18 @@ class MusicBeatState extends FlxUIState } } - public override function openSubState(targetSubstate:FlxSubState):Void + public override function openSubState(targetSubState:FlxSubState):Void { - var event = new SubStateScriptEvent(ScriptEvent.SUBSTATE_OPEN_BEGIN, targetSubstate, true); + var event = new SubStateScriptEvent(ScriptEvent.SUBSTATE_OPEN_BEGIN, targetSubState, true); dispatchEvent(event); if (event.eventCanceled) return; - super.openSubState(targetSubstate); + super.openSubState(targetSubState); } - function onOpenSubstateComplete(targetState:FlxSubState):Void + function onOpenSubStateComplete(targetState:FlxSubState):Void { dispatchEvent(new SubStateScriptEvent(ScriptEvent.SUBSTATE_OPEN_END, targetState, true)); } @@ -189,7 +189,7 @@ class MusicBeatState extends FlxUIState super.closeSubState(); } - function onCloseSubstateComplete(targetState:FlxSubState):Void + function onCloseSubStateComplete(targetState:FlxSubState):Void { dispatchEvent(new SubStateScriptEvent(ScriptEvent.SUBSTATE_CLOSE_END, targetState, true)); } diff --git a/source/funkin/MusicBeatSubstate.hx b/source/funkin/MusicBeatSubState.hx similarity index 94% rename from source/funkin/MusicBeatSubstate.hx rename to source/funkin/MusicBeatSubState.hx index 802022a67..440e25c96 100644 --- a/source/funkin/MusicBeatSubstate.hx +++ b/source/funkin/MusicBeatSubState.hx @@ -7,9 +7,9 @@ import funkin.modding.events.ScriptEvent; import funkin.modding.module.ModuleHandler; /** - * MusicBeatSubstate reincorporates the functionality of MusicBeatState into an FlxSubState. + * MusicBeatSubState reincorporates the functionality of MusicBeatState into an FlxSubState. */ -class MusicBeatSubstate extends FlxSubState +class MusicBeatSubState extends FlxSubState { public function new(bgColor:FlxColor = FlxColor.TRANSPARENT) { diff --git a/source/funkin/PauseSubState.hx b/source/funkin/PauseSubState.hx index 67b58f41d..890b51cb7 100644 --- a/source/funkin/PauseSubState.hx +++ b/source/funkin/PauseSubState.hx @@ -11,7 +11,7 @@ import flixel.util.FlxColor; import funkin.play.PlayState; import funkin.play.song.SongData.SongDataParser; -class PauseSubState extends MusicBeatSubstate +class PauseSubState extends MusicBeatSubState { var grpMenuShit:FlxTypedGroup; diff --git a/source/funkin/modding/IScriptedClass.hx b/source/funkin/modding/IScriptedClass.hx index ee57de6be..abcce483f 100644 --- a/source/funkin/modding/IScriptedClass.hx +++ b/source/funkin/modding/IScriptedClass.hx @@ -24,10 +24,10 @@ interface IStateChangingScriptedClass extends IScriptedClass public function onStateChangeBegin(event:StateChangeScriptEvent):Void; public function onStateChangeEnd(event:StateChangeScriptEvent):Void; - public function onSubstateOpenBegin(event:SubStateScriptEvent):Void; - public function onSubstateOpenEnd(event:SubStateScriptEvent):Void; - public function onSubstateCloseBegin(event:SubStateScriptEvent):Void; - public function onSubstateCloseEnd(event:SubStateScriptEvent):Void; + public function onSubStateOpenBegin(event:SubStateScriptEvent):Void; + public function onSubStateOpenEnd(event:SubStateScriptEvent):Void; + public function onSubStateCloseBegin(event:SubStateScriptEvent):Void; + public function onSubStateCloseEnd(event:SubStateScriptEvent):Void; } /** diff --git a/source/funkin/modding/base/ScriptedMusicBeatSubState.hx b/source/funkin/modding/base/ScriptedMusicBeatSubState.hx new file mode 100644 index 000000000..7dab3d7dd --- /dev/null +++ b/source/funkin/modding/base/ScriptedMusicBeatSubState.hx @@ -0,0 +1,8 @@ +package funkin.modding.base; + +/** + * A script that can be tied to a MusicBeatSubState. + * Create a scripted class that extends MusicBeatSubState to use this. + */ +@:hscriptClass +class ScriptedMusicBeatSubState extends funkin.MusicBeatSubState implements HScriptedClass {} diff --git a/source/funkin/modding/base/ScriptedMusicBeatSubstate.hx b/source/funkin/modding/base/ScriptedMusicBeatSubstate.hx deleted file mode 100644 index d0d764aeb..000000000 --- a/source/funkin/modding/base/ScriptedMusicBeatSubstate.hx +++ /dev/null @@ -1,8 +0,0 @@ -package funkin.modding.base; - -/** - * A script that can be tied to a MusicBeatSubstate. - * Create a scripted class that extends MusicBeatSubstate to use this. - */ -@:hscriptClass -class ScriptedMusicBeatSubstate extends funkin.MusicBeatSubstate implements HScriptedClass {} diff --git a/source/funkin/modding/events/ScriptEventDispatcher.hx b/source/funkin/modding/events/ScriptEventDispatcher.hx index 18181a1d1..a816d748a 100644 --- a/source/funkin/modding/events/ScriptEventDispatcher.hx +++ b/source/funkin/modding/events/ScriptEventDispatcher.hx @@ -113,16 +113,16 @@ class ScriptEventDispatcher t.onStateChangeEnd(cast event); return; case ScriptEvent.SUBSTATE_OPEN_BEGIN: - t.onSubstateOpenBegin(cast event); + t.onSubStateOpenBegin(cast event); return; case ScriptEvent.SUBSTATE_OPEN_END: - t.onSubstateOpenEnd(cast event); + t.onSubStateOpenEnd(cast event); return; case ScriptEvent.SUBSTATE_CLOSE_BEGIN: - t.onSubstateCloseBegin(cast event); + t.onSubStateCloseBegin(cast event); return; case ScriptEvent.SUBSTATE_CLOSE_END: - t.onSubstateCloseEnd(cast event); + t.onSubStateCloseEnd(cast event); return; } } diff --git a/source/funkin/modding/module/Module.hx b/source/funkin/modding/module/Module.hx index 4d5e3457c..f50c9936a 100644 --- a/source/funkin/modding/module/Module.hx +++ b/source/funkin/modding/module/Module.hx @@ -107,13 +107,13 @@ class Module implements IPlayStateScriptedClass implements IStateChangingScripte public function onStateChangeEnd(event:StateChangeScriptEvent) {} - public function onSubstateOpenBegin(event:SubStateScriptEvent) {} + public function onSubStateOpenBegin(event:SubStateScriptEvent) {} - public function onSubstateOpenEnd(event:SubStateScriptEvent) {} + public function onSubStateOpenEnd(event:SubStateScriptEvent) {} - public function onSubstateCloseBegin(event:SubStateScriptEvent) {} + public function onSubStateCloseBegin(event:SubStateScriptEvent) {} - public function onSubstateCloseEnd(event:SubStateScriptEvent) {} + public function onSubStateCloseEnd(event:SubStateScriptEvent) {} public function onSongRetry(event:ScriptEvent) {} } diff --git a/source/funkin/play/GameOverSubstate.hx b/source/funkin/play/GameOverSubState.hx similarity index 98% rename from source/funkin/play/GameOverSubstate.hx rename to source/funkin/play/GameOverSubState.hx index 2c46fa10f..35365beb6 100644 --- a/source/funkin/play/GameOverSubstate.hx +++ b/source/funkin/play/GameOverSubState.hx @@ -18,7 +18,7 @@ import funkin.ui.PreferencesMenu; * * The newest implementation uses a substate, which prevents having to reload the song and stage each reset. */ -class GameOverSubstate extends MusicBeatSubstate +class GameOverSubState extends MusicBeatSubState { /** * Which alternate animation on the character to use. @@ -91,7 +91,7 @@ class GameOverSubstate extends MusicBeatSubstate bg.scrollFactor.set(); add(bg); - // Pluck Boyfriend from the PlayState and place him (in the same position) in the GameOverSubstate. + // Pluck Boyfriend from the PlayState and place him (in the same position) in the GameOverSubState. // We can then play the character's `firstDeath` animation. boyfriend = PlayState.instance.currentStage.getBoyfriend(true); boyfriend.isDead = true; @@ -212,7 +212,7 @@ class GameOverSubstate extends MusicBeatSubstate new FlxTimer().start(0.7, function(tmr:FlxTimer) { // ...fade out the graphics. Then after that happens... FlxG.camera.fade(FlxColor.BLACK, 2, false, function() { - // ...close the GameOverSubstate. + // ...close the GameOverSubState. FlxG.camera.fade(FlxColor.BLACK, 1, true, null, true); PlayState.needsReset = true; diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 987243585..cdc968609 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -45,7 +45,7 @@ import funkin.SongLoad.SwagSong; import funkin.audio.VoicesGroup; import funkin.ui.PopUpStuff; import funkin.ui.PreferencesMenu; -import funkin.ui.stageBuildShit.StageOffsetSubstate; +import funkin.ui.stageBuildShit.StageOffsetSubState; import funkin.util.Constants; import funkin.util.SerializerUtil; import funkin.util.SortUtil; @@ -1405,7 +1405,7 @@ class PlayState extends MusicBeatState // hack for HaxeUI generation, doesn't work unless persistentUpdate is false at state creation!! disableKeys = true; persistentUpdate = false; - openSubState(new StageOffsetSubstate()); + openSubState(new StageOffsetSubState()); } updateHealthBar(); @@ -1643,8 +1643,8 @@ class PlayState extends MusicBeatState } #end - var gameOverSubstate = new GameOverSubstate(); - openSubState(gameOverSubstate); + var gameOverSubState = new GameOverSubState(); + openSubState(gameOverSubState); #if discord_rpc // Game Over doesn't get his own variable because it's only used here @@ -2739,7 +2739,7 @@ class PlayState extends MusicBeatState currentStage = null; } - GameOverSubstate.reset(); + GameOverSubState.reset(); // Clear the static reference to this state. instance = null; diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index bdf4c19c9..6b9167846 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -19,7 +19,7 @@ import funkin.shaderslmfao.LeftMaskShader; import funkin.ui.TallyCounter; import flxanimate.FlxAnimate.Settings; -class ResultState extends MusicBeatSubstate +class ResultState extends MusicBeatSubState { var resultsVariation:ResultVariations; var songName:FlxBitmapText; diff --git a/source/funkin/play/character/BaseCharacter.hx b/source/funkin/play/character/BaseCharacter.hx index a2830f2a8..f4db7f66f 100644 --- a/source/funkin/play/character/BaseCharacter.hx +++ b/source/funkin/play/character/BaseCharacter.hx @@ -401,7 +401,7 @@ class BaseCharacter extends Bopper { if (force || (getCurrentAnimation().startsWith('firstDeath') && isAnimationFinished())) { - playAnimation('deathLoop' + GameOverSubstate.animationSuffix); + playAnimation('deathLoop' + GameOverSubState.animationSuffix); } } diff --git a/source/funkin/ui/StickerSubState.hx b/source/funkin/ui/StickerSubState.hx index 9658275e9..333d4bf57 100644 --- a/source/funkin/ui/StickerSubState.hx +++ b/source/funkin/ui/StickerSubState.hx @@ -17,7 +17,7 @@ import openfl.geom.Matrix; import openfl.display.Sprite; import openfl.display.Bitmap; -class StickerSubState extends MusicBeatSubstate +class StickerSubState extends MusicBeatSubState { public var grpStickers:FlxTypedGroup; diff --git a/source/funkin/ui/debug/DebugMenuSubState.hx b/source/funkin/ui/debug/DebugMenuSubState.hx index 5d00c03b8..9f18acd35 100644 --- a/source/funkin/ui/debug/DebugMenuSubState.hx +++ b/source/funkin/ui/debug/DebugMenuSubState.hx @@ -2,11 +2,11 @@ package funkin.ui.debug; import flixel.FlxObject; import flixel.FlxSprite; -import funkin.MusicBeatSubstate; +import funkin.MusicBeatSubState; import funkin.ui.TextMenuList; import funkin.ui.debug.charting.ChartEditorState; -class DebugMenuSubState extends MusicBeatSubstate +class DebugMenuSubState extends MusicBeatSubState { var items:TextMenuList; diff --git a/source/funkin/ui/haxeui/HaxeUISubState.hx b/source/funkin/ui/haxeui/HaxeUISubState.hx index 963223619..ba218f37c 100644 --- a/source/funkin/ui/haxeui/HaxeUISubState.hx +++ b/source/funkin/ui/haxeui/HaxeUISubState.hx @@ -7,7 +7,7 @@ import haxe.ui.core.Component; import haxe.ui.events.MouseEvent; import haxe.ui.events.UIEvent; -class HaxeUISubState extends MusicBeatSubstate +class HaxeUISubState extends MusicBeatSubState { // The component representing the main UI. public var component:Component; diff --git a/source/funkin/ui/stageBuildShit/StageEditorCommand.hx b/source/funkin/ui/stageBuildShit/StageEditorCommand.hx index e6ce2777b..1e19914da 100644 --- a/source/funkin/ui/stageBuildShit/StageEditorCommand.hx +++ b/source/funkin/ui/stageBuildShit/StageEditorCommand.hx @@ -9,8 +9,8 @@ import flixel.FlxSprite; */ interface StageEditorCommand { - public function execute(state:StageOffsetSubstate):Void; - public function undo(state:StageOffsetSubstate):Void; + public function execute(state:StageOffsetSubState):Void; + public function undo(state:StageOffsetSubState):Void; public function toString():String; } @@ -27,7 +27,7 @@ class MovePropCommand implements StageEditorCommand this.realMove = realMove; } - public function execute(state:StageOffsetSubstate):Void + public function execute(state:StageOffsetSubState):Void { if (realMove) { @@ -36,7 +36,7 @@ class MovePropCommand implements StageEditorCommand } } - public function undo(state:StageOffsetSubstate):Void + public function undo(state:StageOffsetSubState):Void { state.char.x -= xDiff; state.char.y -= yDiff; @@ -58,13 +58,13 @@ class SelectPropCommand implements StageEditorCommand this.prop = prop; } - public function execute(state:StageOffsetSubstate):Void + public function execute(state:StageOffsetSubState):Void { this.prevProp = state.char; state.char = prop; } - public function undo(state:StageOffsetSubstate):Void + public function undo(state:StageOffsetSubState):Void { var funnyShader = state.char.shader; if (state.char != null) state.char.shader = null; diff --git a/source/funkin/ui/stageBuildShit/StageOffsetSubstate.hx b/source/funkin/ui/stageBuildShit/StageOffsetSubState.hx similarity index 99% rename from source/funkin/ui/stageBuildShit/StageOffsetSubstate.hx rename to source/funkin/ui/stageBuildShit/StageOffsetSubState.hx index 15140b2a7..4a36bb21d 100644 --- a/source/funkin/ui/stageBuildShit/StageOffsetSubstate.hx +++ b/source/funkin/ui/stageBuildShit/StageOffsetSubState.hx @@ -28,7 +28,7 @@ import openfl.net.FileReference; */ // Give other classes access to private instance fields @:allow(funkin.ui.stageBuildShit.StageEditorCommand) -class StageOffsetSubstate extends HaxeUISubState +class StageOffsetSubState extends HaxeUISubState { var uiStuff:Component;