diff --git a/.vscode/settings.json b/.vscode/settings.json index ec86904ea..87ed06aed 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -71,6 +71,7 @@ "haxe.displayPort": "auto", "haxe.enableCompilationServer": false, + "haxe.enableServerView": true, "haxe.displayServer": { "arguments": ["-v"] }, diff --git a/assets b/assets index 874f7de39..dcfda23b5 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 874f7de39ee2dfe2ffe4c02edf701d36f2a393fd +Subproject commit dcfda23b549f84a2314d3b676972af237f321ac7 diff --git a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx index 90965847e..9a2af8913 100644 --- a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx +++ b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx @@ -116,7 +116,9 @@ class FlxAtlasSprite extends FlxAnimate } anim.callback = function(_, frame:Int) { - if (frame == (anim.getFrameLabel(id).duration - 1) + anim.getFrameLabel(id).index) + var offset = loop ? 0 : -1; + + if (frame == (anim.getFrameLabel(id).duration + offset) + anim.getFrameLabel(id).index) { if (loop) { @@ -183,7 +185,7 @@ class FlxAtlasSprite extends FlxAnimate public function cleanupAnimation(_:String):Void { canPlayOtherAnims = true; - this.currentAnimation = null; + // this.currentAnimation = null; this.anim.pause(); } } diff --git a/source/funkin/play/character/AnimateAtlasCharacter.hx b/source/funkin/play/character/AnimateAtlasCharacter.hx index f180bd457..9e7aa98bf 100644 --- a/source/funkin/play/character/AnimateAtlasCharacter.hx +++ b/source/funkin/play/character/AnimateAtlasCharacter.hx @@ -46,7 +46,8 @@ class AnimateAtlasCharacter extends BaseCharacter var _skipTransformChildren:Bool = false; var animations:Map = new Map(); - var currentAnimation:String; + var currentAnimName:Null = null; + var animFinished:Bool = false; public function new(id:String) { @@ -88,15 +89,21 @@ class AnimateAtlasCharacter extends BaseCharacter if ((!canPlayOtherAnims && !ignoreOther)) return; var correctName = correctAnimationName(name); - if (correctName == null) return; + if (correctName == null) + { + trace('Could not find Atlas animation: ' + name); + return; + } var animData = getAnimationData(correctName); - currentAnimation = correctName; + currentAnimName = correctName; var prefix:String = animData.prefix; if (prefix == null) prefix = correctName; var loop:Bool = animData.looped; this.mainSprite.playAnimation(prefix, restart, ignoreOther, loop); + + animFinished = false; } public override function hasAnimation(name:String):Bool @@ -104,6 +111,15 @@ class AnimateAtlasCharacter extends BaseCharacter return getAnimationData(name) != null; } + /** + * Returns true if the animation has finished playing. + * Never true if animation is configured to loop. + */ + public override function isAnimationFinished():Bool + { + return animFinished; + } + function loadAtlasSprite():FlxAtlasSprite { trace('[ATLASCHAR] Loading sprite atlas for ${characterId}.'); @@ -128,6 +144,8 @@ class AnimateAtlasCharacter extends BaseCharacter { // Make the game hold on the last frame. this.mainSprite.cleanupAnimation(prefix); + // currentAnimName = null; + animFinished = true; // Fallback to idle! // playAnimation('idle', true, false); @@ -178,7 +196,8 @@ class AnimateAtlasCharacter extends BaseCharacter public override function getCurrentAnimation():String { - return this.mainSprite.getCurrentAnimation(); + // return this.mainSprite.getCurrentAnimation(); + return currentAnimName; } function getAnimationData(name:String = null):AnimateAtlasAnimation diff --git a/source/funkin/play/notes/NoteSprite.hx b/source/funkin/play/notes/NoteSprite.hx index 45862b26d..b16b88466 100644 --- a/source/funkin/play/notes/NoteSprite.hx +++ b/source/funkin/play/notes/NoteSprite.hx @@ -16,26 +16,53 @@ class NoteSprite extends FunkinSprite var hsvShader:HSVShader; /** - * The time at which the note should be hit, in milliseconds. + * The strum time at which the note should be hit, in milliseconds. */ - public var strumTime(default, set):Float; + public var strumTime(get, set):Float; + + function get_strumTime():Float + { + return this.noteData?.time ?? 0.0; + } function set_strumTime(value:Float):Float { - this.strumTime = value; - return this.strumTime; + if (this.noteData == null) return value; + return this.noteData.time = value; + } + + /** + * The length for which the note should be held, in milliseconds. + * Defaults to 0 for single notes. + */ + public var length(get, set):Float; + + function get_length():Float + { + return this.noteData?.length ?? 0.0; + } + + function set_length(value:Float):Float + { + if (this.noteData == null) return value; + return this.noteData.length = value; } /** * An extra attribute for the note. * For example, whether the note is an "alt" note, or whether it has custom behavior on hit. */ - public var kind(default, set):String; + public var kind(get, set):Null; + + function get_kind():Null + { + return this.noteData?.kind; + } function set_kind(value:String):String { - this.kind = value; - return this.kind; + if (this.noteData == null) return value; + return this.noteData.kind = value; } /** @@ -100,16 +127,13 @@ class NoteSprite extends FunkinSprite */ public var handledMiss:Bool; - public function new(noteStyle:NoteStyle, strumTime:Float = 0, direction:Int = 0) + public function new(noteStyle:NoteStyle, direction:Int = 0) { super(0, -9999); - this.strumTime = strumTime; this.direction = direction; this.hsvShader = new HSVShader(); - if (this.strumTime < 0) this.strumTime = 0; - setupNoteGraphic(noteStyle); // Disables the update() function for performance. diff --git a/source/funkin/play/notes/Strumline.hx b/source/funkin/play/notes/Strumline.hx index 5fdd3945f..190aa3ee0 100644 --- a/source/funkin/play/notes/Strumline.hx +++ b/source/funkin/play/notes/Strumline.hx @@ -659,7 +659,6 @@ class Strumline extends FlxSpriteGroup if (noteSprite != null) { - noteSprite.strumTime = note.time; noteSprite.direction = note.getDirection(); noteSprite.noteData = note; diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 2f1764ecd..a662ce2bd 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -5308,7 +5308,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var startTimestamp:Float = 0; if (playtestStartTime) startTimestamp = scrollPositionInMs + playheadPositionInMs; - var playbackRate:Float = (menubarItemPlaybackSpeed.value.toFloat() * 2.0) / 100.0; + var playbackRate:Float = ((menubarItemPlaybackSpeed.value ?? 1.0) * 2.0) / 100.0; playbackRate = Math.floor(playbackRate / 0.05) * 0.05; // Round to nearest 5% playbackRate = Math.max(0.05, Math.min(2.0, playbackRate)); // Clamp to 5% to 200% diff --git a/source/funkin/ui/debug/charting/util/ChartEditorDropdowns.hx b/source/funkin/ui/debug/charting/util/ChartEditorDropdowns.hx index 26015161b..4ec5101f7 100644 --- a/source/funkin/ui/debug/charting/util/ChartEditorDropdowns.hx +++ b/source/funkin/ui/debug/charting/util/ChartEditorDropdowns.hx @@ -117,18 +117,30 @@ class ChartEditorDropdowns "ugh" => "Ugh (Week 7)", "hehPrettyGood" => "Heh, Pretty Good (Week 7)", // Weekend 1 - "weekend-1-lightcan" => "Light Can (2hot)", - "weekend-1-kickcan" => "Kick Can (2hot)", - "weekend-1-kneecan" => "Knee Can (2hot)", - "weekend-1-cockgun" => "Cock Gun (2hot)", - "weekend-1-firegun" => "Fire Gun (2hot)", - "weekend-1-punchlow" => "Punch Low (Blazin)", - "weekend-1-punchhigh" => "Punch High (Blazin)", - "weekend-1-punchlowblocked" => "Punch Low Blocked (Blazin)", - "weekend-1-punchhighblocked" => "Punch High Blocked (Blazin)", - "weekend-1-dodgelow" => "Dodge Low (Blazin)", - "weekend-1-blockhigh" => "Block High (Blazin)", - "weekend-1-fakeout" => "Fakeout (Blazin)", + "weekend-1-punchhigh" => "Punch High (Blazin')", + "weekend-1-punchhighdodged" => "Punch High (Dodge) (Blazin')", + "weekend-1-punchhighblocked" => "Punch High (Block) (Blazin')", + "weekend-1-punchhighspin" => "Punch High (Spin) (Blazin')", + "weekend-1-punchlow" => "Punch Low (Blazin')", + "weekend-1-punchlowdodged" => "Punch Low (Dodge) (Blazin')", + "weekend-1-punchlowblocked" => "Punch Low (Block) (Blazin')", + "weekend-1-punchlowspin" => "Punch High (Spin) (Blazin')", + "weekend-1-picouppercutprep" => "Pico Uppercut (Prep) (Blazin')", + "weekend-1-picouppercut" => "Pico Uppercut (Blazin')", + "weekend-1-blockhigh" => "Block High (Blazin')", + "weekend-1-blocklow" => "Dodge High (Blazin')", + "weekend-1-blockspin" => "Block High (Spin) (Blazin')", + "weekend-1-dodgehigh" => "Block Low (Blazin')", + "weekend-1-dodgelow" => "Dodge Low (Blazin')", + "weekend-1-dodgespin" => "Dodge High (Spin) (Blazin')", + "weekend-1-hithigh" => "Hit High (Blazin')", + "weekend-1-hitlow" => "Hit Low (Blazin')", + "weekend-1-hitspin" => "Hit High (Spin) (Blazin')", + "weekend-1-darnelluppercutprep" => "Darnell Uppercut (Prep) (Blazin')", + "weekend-1-darnelluppercut" => "Darnell Uppercut (Blazin')", + "weekend-1-idle" => "Idle (Blazin')", + "weekend-1-fakeout" => "Fakeout (Blazin')", + "weekend-1-reversefakeout" => "Reverse Fakeout (Blazin')", ]; public static function populateDropdownWithNoteKinds(dropDown:DropDown, startingKindId:String):DropDownEntry diff --git a/source/funkin/ui/debug/latency/LatencyState.hx b/source/funkin/ui/debug/latency/LatencyState.hx index 70ef97fd0..9ebd29537 100644 --- a/source/funkin/ui/debug/latency/LatencyState.hx +++ b/source/funkin/ui/debug/latency/LatencyState.hx @@ -130,7 +130,7 @@ class LatencyState extends MusicBeatSubState for (i in 0...32) { - var note:NoteSprite = new NoteSprite(NoteStyleRegistry.instance.fetchDefault(), Conductor.instance.beatLengthMs * i); + var note:NoteSprite = new NoteSprite(NoteStyleRegistry.instance.fetchDefault()); noteGrp.add(note); } diff --git a/source/funkin/ui/options/ColorsMenu.hx b/source/funkin/ui/options/ColorsMenu.hx index 928f74ba8..146384564 100644 --- a/source/funkin/ui/options/ColorsMenu.hx +++ b/source/funkin/ui/options/ColorsMenu.hx @@ -23,7 +23,7 @@ class ColorsMenu extends Page for (i in 0...4) { - var note:NoteSprite = new NoteSprite(NoteStyleRegistry.instance.fetchDefault(), 0, i); + var note:NoteSprite = new NoteSprite(NoteStyleRegistry.instance.fetchDefault(), i); note.x = (100 * i) + i; note.screenCenter(Y);