From c6d5bda80209d09a7e7bb10691366c70db682f86 Mon Sep 17 00:00:00 2001 From: Victor G <84867412+Cheemsandfriends@users.noreply.github.com> Date: Tue, 26 Nov 2024 21:39:12 +0100 Subject: [PATCH] feat: Added non-naughty Perfect results screen animation for Boyfriend (#821) * change result state stuff * add more fields * change testing * assets submod --------- Co-authored-by: Cameron Taylor --- assets | 2 +- source/funkin/InitState.hx | 4 +-- .../funkin/data/freeplay/player/PlayerData.hx | 8 ++++++ source/funkin/play/ResultState.hx | 25 ++++++++++++++----- 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/assets b/assets index 8bc7fffb6..12f3546db 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 8bc7fffb6e431424354cc6d7df4572473185aaa6 +Subproject commit 12f3546db64724fb482f5583d5cc9d312ac192a2 diff --git a/source/funkin/InitState.hx b/source/funkin/InitState.hx index aba1cdee7..fe34cb224 100644 --- a/source/funkin/InitState.hx +++ b/source/funkin/InitState.hx @@ -235,7 +235,7 @@ class InitState extends FlxState storyMode: true, title: "Cum Song Erect by Kawai Sprite", songId: "cum", - characterId: "pico-playable", + characterId: "bf", difficultyId: "nightmare", isNewHighscore: true, scoreData: @@ -251,7 +251,7 @@ class InitState extends FlxState combo: 69, maxCombo: 69, totalNotesHit: 140, - totalNotes: 275 + totalNotes: 190 } // 2400 total notes = 7% = LOSS // 275 total notes = 69% = NICE diff --git a/source/funkin/data/freeplay/player/PlayerData.hx b/source/funkin/data/freeplay/player/PlayerData.hx index 91df7a232..dc972657d 100644 --- a/source/funkin/data/freeplay/player/PlayerData.hx +++ b/source/funkin/data/freeplay/player/PlayerData.hx @@ -331,6 +331,10 @@ typedef PlayerResultsAnimationData = @:default([0, 0]) var offsets:Array; + @:optional + @:default("both") + var filter:String; + @:optional @:default(500) var zIndex:Int; @@ -347,6 +351,10 @@ typedef PlayerResultsAnimationData = @:default('') var startFrameLabel:Null; + @:optional + @:default('') + var sound:Null; + @:optional @:default(true) var looped:Bool; diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index 2ba5bcb18..407daf08b 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -67,7 +67,9 @@ class ResultState extends MusicBeatSubState { sprite:FlxAtlasSprite, delay:Float, - forceLoop:Bool + forceLoop:Bool, + startFrameLabel:String, + sound:String }> = []; var characterSparrowAnimations:Array< { @@ -184,6 +186,11 @@ class ResultState extends MusicBeatSubState { if (animData == null) continue; + if (animData.filter != "both") + { + if (Preferences.naughtyness && animData.filter != "naughty" || !Preferences.naughtyness && animData.filter != "safe") continue; + } + var animPath:String = Paths.stripLibrary(animData.assetPath); var animLibrary:String = Paths.getLibrary(animData.assetPath); var offsets = animData.offsets ?? [0, 0]; @@ -199,7 +206,6 @@ class ResultState extends MusicBeatSubState { // Animation is not looped. animation.onAnimationComplete.add((_name:String) -> { - trace("AHAHAH 2"); if (animation != null) { animation.anim.pause(); @@ -209,7 +215,6 @@ class ResultState extends MusicBeatSubState else if (animData.loopFrameLabel != null) { animation.onAnimationComplete.add((_name:String) -> { - trace("AHAHAH 2"); if (animation != null) { animation.playAnimation(animData.loopFrameLabel ?? '', true, false, true); // unpauses this anim, since it's on PlayOnce! @@ -227,7 +232,6 @@ class ResultState extends MusicBeatSubState } }); } - // Hide until ready to play. animation.visible = false; // Queue to play. @@ -235,7 +239,9 @@ class ResultState extends MusicBeatSubState { sprite: animation, delay: animData.delay ?? 0.0, - forceLoop: (animData.loopFrame ?? -1) == 0 + forceLoop: (animData.loopFrame ?? -1) == 0, + startFrameLabel: (animData.startFrameLabel ?? ""), + sound: (animData.sound ?? "") }); // Add to the scene. add(animation); @@ -599,7 +605,14 @@ class ResultState extends MusicBeatSubState new FlxTimer().start(atlas.delay, _ -> { if (atlas.sprite == null) return; atlas.sprite.visible = true; - atlas.sprite.playAnimation(''); + atlas.sprite.playAnimation(atlas.startFrameLabel); + if (atlas.sound != "") + { + var sndPath:String = Paths.stripLibrary(atlas.sound); + var sndLibrary:String = Paths.getLibrary(atlas.sound); + + FunkinSound.playOnce(Paths.sound(sndPath, sndLibrary), 1.0); + } }); }