From e14e6448ac4b082800677789a6df87378e29ffcc Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 25 Oct 2023 01:13:06 -0400 Subject: [PATCH] More event type refactors --- source/funkin/play/PlayState.hx | 28 +++++++++---------- .../play/cutscene/dialogue/Conversation.hx | 6 ++-- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 1d3480efe..53a076fc0 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -682,7 +682,7 @@ class PlayState extends MusicBeatSubState { if (!assertChartExists()) return; - dispatchEvent(new ScriptEvent(ScriptEvent.SONG_RETRY)); + dispatchEvent(new ScriptEvent(ScriptEventType.SONG_RETRY)); resetCamera(); @@ -867,7 +867,7 @@ class PlayState extends MusicBeatSubState deathCounter += 1; - dispatchEvent(new ScriptEvent(ScriptEvent.GAME_OVER)); + dispatchEvent(new ScriptEvent(ScriptEventType.GAME_OVER)); // Disable updates, preventing animations in the background from playing. persistentUpdate = false; @@ -994,7 +994,7 @@ class PlayState extends MusicBeatSubState { if (Std.isOfType(subState, PauseSubState)) { - var event:ScriptEvent = new ScriptEvent(ScriptEvent.RESUME, true); + var event:ScriptEvent = new ScriptEvent(ScriptEventType.RESUME, true); dispatchEvent(event); @@ -1097,7 +1097,7 @@ class PlayState extends MusicBeatSubState if (this.currentStage != null) { remove(currentStage); - var event:ScriptEvent = new ScriptEvent(ScriptEvent.DESTROY, false); + var event:ScriptEvent = new ScriptEvent(ScriptEventType.DESTROY, false); ScriptEventDispatcher.callEvent(currentStage, event); currentStage = null; } @@ -1116,7 +1116,7 @@ class PlayState extends MusicBeatSubState super.debug_refreshModules(); - var event:ScriptEvent = new ScriptEvent(ScriptEvent.CREATE, false); + var event:ScriptEvent = new ScriptEvent(ScriptEventType.CREATE, false); ScriptEventDispatcher.callEvent(currentSong, event); } @@ -1332,7 +1332,7 @@ class PlayState extends MusicBeatSubState if (currentStage != null) { // Actually create and position the sprites. - var event:ScriptEvent = new ScriptEvent(ScriptEvent.CREATE, false); + var event:ScriptEvent = new ScriptEvent(ScriptEventType.CREATE, false); ScriptEventDispatcher.callEvent(currentStage, event); // Apply camera zoom level from stage data. @@ -1640,7 +1640,7 @@ class PlayState extends MusicBeatSubState add(currentConversation); refresh(); - var event:ScriptEvent = new ScriptEvent(ScriptEvent.CREATE, false); + var event:ScriptEvent = new ScriptEvent(ScriptEventType.CREATE, false); ScriptEventDispatcher.callEvent(currentConversation, event); } @@ -1664,7 +1664,7 @@ class PlayState extends MusicBeatSubState */ function startSong():Void { - dispatchEvent(new ScriptEvent(ScriptEvent.SONG_START)); + dispatchEvent(new ScriptEvent(ScriptEventType.SONG_START)); startingSong = false; @@ -1783,7 +1783,7 @@ class PlayState extends MusicBeatSubState // Call an event to allow canceling the note hit. // NOTE: This is what handles the character animations! - var event:NoteScriptEvent = new NoteScriptEvent(ScriptEvent.NOTE_HIT, note, 0, true); + var event:NoteScriptEvent = new NoteScriptEvent(ScriptEventType.NOTE_HIT, note, 0, true); dispatchEvent(event); // Calling event.cancelEvent() skips all the other logic! Neat! @@ -1872,7 +1872,7 @@ class PlayState extends MusicBeatSubState { // Call an event to allow canceling the note miss. // NOTE: This is what handles the character animations! - var event:NoteScriptEvent = new NoteScriptEvent(ScriptEvent.NOTE_MISS, note, 0, true); + var event:NoteScriptEvent = new NoteScriptEvent(ScriptEventType.NOTE_MISS, note, 0, true); dispatchEvent(event); // Calling event.cancelEvent() skips all the other logic! Neat! @@ -2021,7 +2021,7 @@ class PlayState extends MusicBeatSubState function goodNoteHit(note:NoteSprite, input:PreciseInputEvent):Void { - var event:NoteScriptEvent = new NoteScriptEvent(ScriptEvent.NOTE_HIT, note, Highscore.tallies.combo + 1, true); + var event:NoteScriptEvent = new NoteScriptEvent(ScriptEventType.NOTE_HIT, note, Highscore.tallies.combo + 1, true); dispatchEvent(event); // Calling event.cancelEvent() skips all the other logic! Neat! @@ -2053,7 +2053,7 @@ class PlayState extends MusicBeatSubState // a MISS is when you let a note scroll past you!! Highscore.tallies.missed++; - var event:NoteScriptEvent = new NoteScriptEvent(ScriptEvent.NOTE_MISS, note, Highscore.tallies.combo, true); + var event:NoteScriptEvent = new NoteScriptEvent(ScriptEventType.NOTE_MISS, note, Highscore.tallies.combo, true); dispatchEvent(event); // Calling event.cancelEvent() skips all the other logic! Neat! if (event.eventCanceled) return; @@ -2385,7 +2385,7 @@ class PlayState extends MusicBeatSubState */ function endSong():Void { - dispatchEvent(new ScriptEvent(ScriptEvent.SONG_END)); + dispatchEvent(new ScriptEvent(ScriptEventType.SONG_END)); #if sys // spitter for ravy, teehee!! @@ -2593,7 +2593,7 @@ class PlayState extends MusicBeatSubState { remove(currentStage); currentStage.kill(); - dispatchEvent(new ScriptEvent(ScriptEvent.DESTROY, false)); + dispatchEvent(new ScriptEvent(ScriptEventType.DESTROY, false)); currentStage = null; } diff --git a/source/funkin/play/cutscene/dialogue/Conversation.hx b/source/funkin/play/cutscene/dialogue/Conversation.hx index 42f2ead65..fa46c9252 100644 --- a/source/funkin/play/cutscene/dialogue/Conversation.hx +++ b/source/funkin/play/cutscene/dialogue/Conversation.hx @@ -405,7 +405,7 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass public function endOutro():Void { outroTween = null; - ScriptEventDispatcher.callEvent(this, new ScriptEvent(ScriptEvent.DESTROY, false)); + ScriptEventDispatcher.callEvent(this, new ScriptEvent(ScriptEventType.DESTROY, false)); } /** @@ -445,7 +445,7 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass if (currentDialogueEntry >= currentDialogueEntryCount) { - dispatchEvent(new DialogueScriptEvent(ScriptEvent.DIALOGUE_END, this, false)); + dispatchEvent(new DialogueScriptEvent(ScriptEventType.DIALOGUE_END, this, false)); } else { @@ -485,7 +485,7 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass propagateEvent(event); if (event.eventCanceled) return; - dispatchEvent(new DialogueScriptEvent(ScriptEvent.DIALOGUE_END, this, false)); + dispatchEvent(new DialogueScriptEvent(ScriptEventType.DIALOGUE_END, this, false)); } public function onDialogueEnd(event:DialogueScriptEvent):Void