From 7a9b4d6bf028c053d334b263398c4b764de5e3d4 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 11 Oct 2023 01:04:56 -0400 Subject: [PATCH 1/8] Add the "death.cameraOffset" attribute to character data --- assets | 2 +- source/funkin/play/GameOverSubState.hx | 3 +++ source/funkin/play/character/BaseCharacter.hx | 5 +++++ source/funkin/play/character/CharacterData.hx | 16 +++++++++++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/assets b/assets index 6e5ed4602..c1ef5f683 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 6e5ed46026a2eb1e575c5accf9192b90c13ff857 +Subproject commit c1ef5f68303b8069702193078c8228ffc9dc551e diff --git a/source/funkin/play/GameOverSubState.hx b/source/funkin/play/GameOverSubState.hx index 15ed0421e..cb350f028 100644 --- a/source/funkin/play/GameOverSubState.hx +++ b/source/funkin/play/GameOverSubState.hx @@ -103,6 +103,9 @@ class GameOverSubState extends MusicBeatSubState cameraFollowPoint = new FlxObject(PlayState.instance.cameraFollowPoint.x, PlayState.instance.cameraFollowPoint.y, 1, 1); cameraFollowPoint.x = boyfriend.getGraphicMidpoint().x; cameraFollowPoint.y = boyfriend.getGraphicMidpoint().y; + var offsets:Array = boyfriend.getDeathCameraOffsets(); + cameraFollowPoint.x += offsets[0]; + cameraFollowPoint.y += offsets[1]; add(cameraFollowPoint); FlxG.camera.target = null; diff --git a/source/funkin/play/character/BaseCharacter.hx b/source/funkin/play/character/BaseCharacter.hx index 30b549fd3..3a34144bf 100644 --- a/source/funkin/play/character/BaseCharacter.hx +++ b/source/funkin/play/character/BaseCharacter.hx @@ -188,6 +188,11 @@ class BaseCharacter extends Bopper shouldBop = false; } + public function getDeathCameraOffsets():Array + { + return _data.death?.cameraOffsets ?? [0.0, 0.0]; + } + /** * Gets the value of flipX from the character data. * `!getFlipX()` is the direction Boyfriend should face. diff --git a/source/funkin/play/character/CharacterData.hx b/source/funkin/play/character/CharacterData.hx index f1b316b7f..8be9f25c7 100644 --- a/source/funkin/play/character/CharacterData.hx +++ b/source/funkin/play/character/CharacterData.hx @@ -19,8 +19,10 @@ class CharacterDataParser * The current version string for the stage data format. * Handle breaking changes by incrementing this value * and adding migration to the `migrateStageData()` function. + * + * - Version 1.0.1 adds `death.cameraOffsets` */ - public static final CHARACTER_DATA_VERSION:String = '1.0.0'; + public static final CHARACTER_DATA_VERSION:String = '1.0.1'; /** * The current version rule check for the stage data format. @@ -603,6 +605,8 @@ typedef CharacterData = */ var healthIcon:Null; + var death:Null; + /** * The global offset to the character's position, in pixels. * @default [0, 0] @@ -695,3 +699,13 @@ typedef HealthIconData = */ var offsets:Null>; } + +typedef DeathData = +{ + /** + * The amount to offset the camera by while focusing on this character as they die. + * Default value focuses on the character's graphic midpoint. + * @default [0, 0] + */ + var ?cameraOffsets:Array; +} From 4e0934dbd11f8d87cc501878d268aa233d223a59 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 17 Oct 2023 16:57:06 -0400 Subject: [PATCH 2/8] Fix issues with changing BPMs of songs. --- source/funkin/play/character/BaseCharacter.hx | 3 +-- .../debug/charting/ChartEditorDialogHandler.hx | 18 ++++++++++++++++-- .../ui/debug/charting/ChartEditorState.hx | 18 ++++++++++++++---- .../charting/ChartEditorToolboxHandler.hx | 16 ++++++++++++++-- 4 files changed, 45 insertions(+), 10 deletions(-) diff --git a/source/funkin/play/character/BaseCharacter.hx b/source/funkin/play/character/BaseCharacter.hx index 30b549fd3..71022c5df 100644 --- a/source/funkin/play/character/BaseCharacter.hx +++ b/source/funkin/play/character/BaseCharacter.hx @@ -580,8 +580,7 @@ class BaseCharacter extends Bopper public override function playAnimation(name:String, restart:Bool = false, ignoreOther:Bool = false, reversed:Bool = false):Void { - FlxG.watch.addQuick('playAnim(${characterName})', name); - // trace('playAnim(${characterName}): ${name}'); + // FlxG.watch.addQuick('playAnim(${characterName})', name); super.playAnimation(name, restart, ignoreOther, reversed); } } diff --git a/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx b/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx index 30f0381c6..91576f2ee 100644 --- a/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx +++ b/source/funkin/ui/debug/charting/ChartEditorDialogHandler.hx @@ -667,8 +667,6 @@ class ChartEditorDialogHandler timeChanges[0].bpm = event.value; } - Conductor.forceBPM(event.value); - newSongMetadata.timeChanges = timeChanges; }; @@ -677,6 +675,8 @@ class ChartEditorDialogHandler dialogContinue.onClick = (_event) -> { state.songMetadata.set(targetVariation, newSongMetadata); + Conductor.mapTimeChanges(state.currentSongMetadata.timeChanges); + dialog.hideDialog(DialogButton.APPLY); } @@ -696,6 +696,8 @@ class ChartEditorDialogHandler var charData:SongCharacterData = state.currentSongMetadata.playData.characters; + var hasClearedVocals:Bool = false; + charIdsForVocals.push(charData.player); charIdsForVocals.push(charData.opponent); @@ -715,6 +717,7 @@ class ChartEditorDialogHandler if (dialogNoVocals == null) throw 'Could not locate dialogNoVocals button in Upload Vocals dialog'; dialogNoVocals.onClick = function(_event) { // Dismiss + ChartEditorAudioHandler.stopExistingVocals(state); dialog.hideDialog(DialogButton.APPLY); }; @@ -738,6 +741,12 @@ class ChartEditorDialogHandler trace('Selected file: $pathStr'); var path:Path = new Path(pathStr); + if (!hasClearedVocals) + { + hasClearedVocals = true; + ChartEditorAudioHandler.stopExistingVocals(state); + } + if (ChartEditorAudioHandler.loadVocalsFromPath(state, path, charKey, instId)) { // Tell the user the load was successful. @@ -788,6 +797,11 @@ class ChartEditorDialogHandler if (selectedFile != null && selectedFile.bytes != null) { trace('Selected file: ' + selectedFile.name); + if (!hasClearedVocals) + { + hasClearedVocals = true; + ChartEditorAudioHandler.stopExistingVocals(state); + } if (ChartEditorAudioHandler.loadVocalsFromBytes(state, selectedFile.bytes, charKey, instId)) { // Tell the user the load was successful. diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index b4c8c3483..4e561d040 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -1897,6 +1897,16 @@ class ChartEditorState extends HaxeUIState handleViewKeybinds(); handleTestKeybinds(); handleHelpKeybinds(); + + #if debug + handleQuickWatch(); + #end + } + + function handleQuickWatch():Void + { + FlxG.watch.addQuick('scrollPosInPixels', scrollPositionInPixels); + FlxG.watch.addQuick('playheadPosInPixels', playheadPositionInPixels); } /** @@ -3342,6 +3352,7 @@ class ChartEditorState extends HaxeUIState if (!isHaxeUIDialogOpen && !isCursorOverHaxeUI && FlxG.keys.justPressed.ENTER) { var minimal = FlxG.keys.pressed.SHIFT; + ChartEditorToolboxHandler.hideAllToolboxes(this); testSongInPlayState(minimal); } } @@ -4153,14 +4164,13 @@ class ChartEditorState extends HaxeUIState */ function moveSongToScrollPosition():Void { - // Update the songPosition in the Conductor. - var targetPos = scrollPositionInMs; - Conductor.update(targetPos); - // Update the songPosition in the audio tracks. if (audioInstTrack != null) audioInstTrack.time = scrollPositionInMs + playheadPositionInMs; if (audioVocalTrackGroup != null) audioVocalTrackGroup.time = scrollPositionInMs + playheadPositionInMs; + // Update the songPosition in the Conductor. + Conductor.update(audioInstTrack.time); + // We need to update the note sprites because we changed the scroll position. noteDisplayDirty = true; } diff --git a/source/funkin/ui/debug/charting/ChartEditorToolboxHandler.hx b/source/funkin/ui/debug/charting/ChartEditorToolboxHandler.hx index 6f89b6b63..d92e43cf2 100644 --- a/source/funkin/ui/debug/charting/ChartEditorToolboxHandler.hx +++ b/source/funkin/ui/debug/charting/ChartEditorToolboxHandler.hx @@ -136,6 +136,18 @@ class ChartEditorToolboxHandler } } + public static function rememberOpenToolboxes(state:ChartEditorState):Void {} + + public static function openRememberedToolboxes(state:ChartEditorState):Void {} + + public static function hideAllToolboxes(state:ChartEditorState):Void + { + for (toolbox in state.activeToolboxes.values()) + { + toolbox.hideDialog(DialogButton.CANCEL); + } + } + public static function minimizeToolbox(state:ChartEditorState, id:String):Void { var toolbox:Null = state.activeToolboxes.get(id); @@ -634,9 +646,9 @@ class ChartEditorToolboxHandler timeChanges[0].bpm = event.value; } - Conductor.forceBPM(event.value); - state.currentSongMetadata.timeChanges = timeChanges; + + Conductor.mapTimeChanges(state.currentSongMetadata.timeChanges); }; inputBPM.value = state.currentSongMetadata.timeChanges[0].bpm; From 6cb8a719afa17cc4dd1673d1ba9d0f9038dcfae8 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 17 Oct 2023 17:27:11 -0400 Subject: [PATCH 3/8] Additional cleanup on difficulty sort order (tested and working!) --- source/funkin/play/song/Song.hx | 28 ++-------------------------- source/funkin/ui/story/Level.hx | 27 ++------------------------- source/funkin/util/Constants.hx | 5 +++++ 3 files changed, 9 insertions(+), 51 deletions(-) diff --git a/source/funkin/play/song/Song.hx b/source/funkin/play/song/Song.hx index 33363e1ff..f996d75ef 100644 --- a/source/funkin/play/song/Song.hx +++ b/source/funkin/play/song/Song.hx @@ -1,5 +1,6 @@ package funkin.play.song; +import funkin.util.SortUtil; import flixel.sound.FlxSound; import openfl.utils.Assets; import funkin.modding.events.ScriptEvent; @@ -252,32 +253,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry = new Map(); - for (difficulty in diffFiltered) - { - var num:Int = 0; - switch (difficulty) - { - case 'easy': - num = 0; - case 'normal': - num = 1; - case 'hard': - num = 2; - case 'erect': - num = 3; - case 'nightmare': - num = 4; - } - diffMap.set(difficulty, num); - } - - diffFiltered.sort(function(a:String, b:String) { - return (diffMap.get(a) ?? 0) - (diffMap.get(b) ?? 0); - }); + diffFiltered.sort(SortUtil.defaultsThenAlphabetically.bind(Constants.DEFAULT_DIFFICULTY_LIST)); return diffFiltered; } diff --git a/source/funkin/ui/story/Level.hx b/source/funkin/ui/story/Level.hx index c976cbfce..e86241277 100644 --- a/source/funkin/ui/story/Level.hx +++ b/source/funkin/ui/story/Level.hx @@ -1,5 +1,6 @@ package funkin.ui.story; +import funkin.util.SortUtil; import flixel.FlxSprite; import flixel.util.FlxColor; import funkin.play.song.Song; @@ -155,31 +156,7 @@ class Level implements IRegistryEntry } } - // sort the difficulties, since they may be out of order in the chart JSON - // also copy/pasted to Song.listDifficulties()! - var diffMap:Map = new Map(); - for (difficulty in difficulties) - { - var num:Int = 0; - switch (difficulty) - { - case 'easy': - num = 0; - case 'normal': - num = 1; - case 'hard': - num = 2; - case 'erect': - num = 3; - case 'nightmare': - num = 4; - } - diffMap.set(difficulty, num); - } - - difficulties.sort(function(a:String, b:String) { - return diffMap.get(a) - diffMap.get(b); - }); + difficulties.sort(SortUtil.defaultsThenAlphabetically.bind(Constants.DEFAULT_DIFFICULTY_LIST)); // Filter to only include difficulties that are present in all songs for (songIndex in 1...songList.length) diff --git a/source/funkin/util/Constants.hx b/source/funkin/util/Constants.hx index c606e469f..b27a7d2f5 100644 --- a/source/funkin/util/Constants.hx +++ b/source/funkin/util/Constants.hx @@ -121,6 +121,11 @@ class Constants */ public static final DEFAULT_DIFFICULTY:String = 'normal'; + /** + * Default list of difficulties for charts. + */ + public static final DEFAULT_DIFFICULTY_LIST:Array = ['easy', 'normal', 'hard']; + /** * Default player character for charts. */ From 9330e2b68f31d194ca6323709e23b4e131bc3e04 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 17 Oct 2023 17:54:00 -0400 Subject: [PATCH 4/8] Update assets --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 8104d43e5..c86e6ba78 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 8104d43e584a1f25e574438d7b21a7e671358969 +Subproject commit c86e6ba78e80a0fb7514ba2d662b6fd00d327a74 From 92a4a41d20dc71db5e67d7e34aa6e3799beaf9f2 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 17 Oct 2023 17:59:01 -0400 Subject: [PATCH 5/8] Fix an issue where chart editor theme continues when exiting --- source/funkin/ui/debug/charting/ChartEditorState.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 4e561d040..c28c1c8c7 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -3129,6 +3129,7 @@ class ChartEditorState extends HaxeUIState function quitChartEditor():Void { autoSave(); + stopWelcomeMusic(); FlxG.switchState(new MainMenuState()); } From 75b9aefb1ccf6944398f29d427cf36ac5151fa1c Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 17 Oct 2023 20:14:36 -0400 Subject: [PATCH 6/8] senpai antialiasing fix --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index c1ef5f683..946cf0082 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit c1ef5f68303b8069702193078c8228ffc9dc551e +Subproject commit 946cf00829416b879881427d4e2fe09a09cb79ce From 1670cb70d041e8a8379dcb6a8509e7b3e6144e03 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 17 Oct 2023 20:21:12 -0400 Subject: [PATCH 7/8] dipshit mereg... --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index cb7a863e4..8eb0b74b4 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit cb7a863e4ab5a563828436be63c9f8cbbf09b4c5 +Subproject commit 8eb0b74b4149190f32f8bfab38bfdefa709b849d From 08845915eaec4c17ec0cef41f696c2868732aac8 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 17 Oct 2023 21:26:32 -0400 Subject: [PATCH 8/8] fixed cutscene skipping too fast from disabling inputs --- source/funkin/play/PlayState.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index d7c2a2a4c..e3aabc7a7 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1641,7 +1641,7 @@ class PlayState extends MusicBeatSubState */ function onConversationComplete():Void { - isInCutscene = true; + isInCutscene = false; remove(currentConversation); currentConversation = null;