From 4804b9ae22eec299d84569402cb25ca21baf6a86 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 6 Jan 2024 01:06:10 -0500 Subject: [PATCH 001/124] Work in progress for Chart Editor gamepad support (navigation implemented, note placement WIP) --- source/funkin/input/Controls.hx | 367 +++++++++++----- source/funkin/input/TurboActionHandler.hx | 111 +++++ source/funkin/input/TurboButtonHandler.hx | 127 ++++++ .../ui/debug/charting/ChartEditorState.hx | 397 ++++++++++++++++-- .../charting/commands/RemoveEventsCommand.hx | 4 + .../charting/commands/RemoveItemsCommand.hx | 4 + .../charting/commands/RemoveNotesCommand.hx | 4 + .../components/ChartEditorHoldNoteSprite.hx | 9 +- .../handlers/ChartEditorGamepadHandler.hx | 133 ++++++ source/funkin/ui/debug/charting/import.hx | 1 + 10 files changed, 1009 insertions(+), 148 deletions(-) create mode 100644 source/funkin/input/TurboActionHandler.hx create mode 100644 source/funkin/input/TurboButtonHandler.hx create mode 100644 source/funkin/ui/debug/charting/handlers/ChartEditorGamepadHandler.hx diff --git a/source/funkin/input/Controls.hx b/source/funkin/input/Controls.hx index 3fa4e0f75..5c761cd19 100644 --- a/source/funkin/input/Controls.hx +++ b/source/funkin/input/Controls.hx @@ -30,47 +30,31 @@ class Controls extends FlxActionSet * A list of actions that a player would invoke via some input device. * Uses FlxActions to funnel various inputs to a single action. */ - var _ui_up = new FlxActionDigital(Action.UI_UP); - var _ui_left = new FlxActionDigital(Action.UI_LEFT); - var _ui_right = new FlxActionDigital(Action.UI_RIGHT); - var _ui_down = new FlxActionDigital(Action.UI_DOWN); - var _ui_upP = new FlxActionDigital(Action.UI_UP_P); - var _ui_leftP = new FlxActionDigital(Action.UI_LEFT_P); - var _ui_rightP = new FlxActionDigital(Action.UI_RIGHT_P); - var _ui_downP = new FlxActionDigital(Action.UI_DOWN_P); - var _ui_upR = new FlxActionDigital(Action.UI_UP_R); - var _ui_leftR = new FlxActionDigital(Action.UI_LEFT_R); - var _ui_rightR = new FlxActionDigital(Action.UI_RIGHT_R); - var _ui_downR = new FlxActionDigital(Action.UI_DOWN_R); - var _note_up = new FlxActionDigital(Action.NOTE_UP); - var _note_left = new FlxActionDigital(Action.NOTE_LEFT); - var _note_right = new FlxActionDigital(Action.NOTE_RIGHT); - var _note_down = new FlxActionDigital(Action.NOTE_DOWN); - var _note_upP = new FlxActionDigital(Action.NOTE_UP_P); - var _note_leftP = new FlxActionDigital(Action.NOTE_LEFT_P); - var _note_rightP = new FlxActionDigital(Action.NOTE_RIGHT_P); - var _note_downP = new FlxActionDigital(Action.NOTE_DOWN_P); - var _note_upR = new FlxActionDigital(Action.NOTE_UP_R); - var _note_leftR = new FlxActionDigital(Action.NOTE_LEFT_R); - var _note_rightR = new FlxActionDigital(Action.NOTE_RIGHT_R); - var _note_downR = new FlxActionDigital(Action.NOTE_DOWN_R); - var _accept = new FlxActionDigital(Action.ACCEPT); - var _back = new FlxActionDigital(Action.BACK); - var _pause = new FlxActionDigital(Action.PAUSE); - var _reset = new FlxActionDigital(Action.RESET); - var _cutscene_advance = new FlxActionDigital(Action.CUTSCENE_ADVANCE); - var _cutscene_skip = new FlxActionDigital(Action.CUTSCENE_SKIP); - var _debug_menu = new FlxActionDigital(Action.DEBUG_MENU); - var _debug_chart = new FlxActionDigital(Action.DEBUG_CHART); - var _debug_stage = new FlxActionDigital(Action.DEBUG_STAGE); - var _volume_up = new FlxActionDigital(Action.VOLUME_UP); - var _volume_down = new FlxActionDigital(Action.VOLUME_DOWN); - var _volume_mute = new FlxActionDigital(Action.VOLUME_MUTE); + var _ui_up = new FunkinAction(Action.UI_UP, Action.UI_UP_P, Action.UI_UP_R); + var _ui_left = new FunkinAction(Action.UI_LEFT, Action.UI_LEFT_P, Action.UI_LEFT_R); + var _ui_right = new FunkinAction(Action.UI_RIGHT, Action.UI_RIGHT_P, Action.UI_RIGHT_R); + var _ui_down = new FunkinAction(Action.UI_DOWN, Action.UI_DOWN_P, Action.UI_DOWN_R); + var _note_up = new FunkinAction(Action.NOTE_UP, Action.NOTE_UP_P, Action.NOTE_UP_R); + var _note_left = new FunkinAction(Action.NOTE_LEFT, Action.NOTE_LEFT_P, Action.NOTE_LEFT_R); + var _note_right = new FunkinAction(Action.NOTE_RIGHT, Action.NOTE_RIGHT_P, Action.NOTE_RIGHT_R); + var _note_down = new FunkinAction(Action.NOTE_DOWN, Action.NOTE_DOWN_P, Action.NOTE_DOWN_R); + var _accept = new FunkinAction(Action.ACCEPT); + var _back = new FunkinAction(Action.BACK); + var _pause = new FunkinAction(Action.PAUSE); + var _reset = new FunkinAction(Action.RESET); + var _cutscene_advance = new FunkinAction(Action.CUTSCENE_ADVANCE); + var _cutscene_skip = new FunkinAction(Action.CUTSCENE_SKIP); + var _debug_menu = new FunkinAction(Action.DEBUG_MENU); + var _debug_chart = new FunkinAction(Action.DEBUG_CHART); + var _debug_stage = new FunkinAction(Action.DEBUG_STAGE); + var _volume_up = new FunkinAction(Action.VOLUME_UP); + var _volume_down = new FunkinAction(Action.VOLUME_DOWN); + var _volume_mute = new FunkinAction(Action.VOLUME_MUTE); #if CAN_CHEAT - var _cheat = new FlxActionDigital(Action.CHEAT); + var _cheat = new FunkinAction(Action.CHEAT); #end - var byName:Map = new Map(); + var byName:Map = new Map(); public var gamepadsAdded:Array = []; public var keyboardScheme = KeyboardScheme.None; @@ -78,122 +62,142 @@ class Controls extends FlxActionSet public var UI_UP(get, never):Bool; inline function get_UI_UP() - return _ui_up.check(); + return _ui_up.checkPressed(); public var UI_LEFT(get, never):Bool; inline function get_UI_LEFT() - return _ui_left.check(); + return _ui_left.checkPressed(); public var UI_RIGHT(get, never):Bool; inline function get_UI_RIGHT() - return _ui_right.check(); + return _ui_right.checkPressed(); public var UI_DOWN(get, never):Bool; inline function get_UI_DOWN() - return _ui_down.check(); + return _ui_down.checkPressed(); public var UI_UP_P(get, never):Bool; inline function get_UI_UP_P() - return _ui_upP.check(); + return _ui_up.checkJustPressed(); public var UI_LEFT_P(get, never):Bool; inline function get_UI_LEFT_P() - return _ui_leftP.check(); + return _ui_left.checkJustPressed(); public var UI_RIGHT_P(get, never):Bool; inline function get_UI_RIGHT_P() - return _ui_rightP.check(); + return _ui_right.checkJustPressed(); public var UI_DOWN_P(get, never):Bool; inline function get_UI_DOWN_P() - return _ui_downP.check(); + return _ui_down.checkJustPressed(); public var UI_UP_R(get, never):Bool; inline function get_UI_UP_R() - return _ui_upR.check(); + return _ui_up.checkJustReleased(); public var UI_LEFT_R(get, never):Bool; inline function get_UI_LEFT_R() - return _ui_leftR.check(); + return _ui_left.checkJustReleased(); public var UI_RIGHT_R(get, never):Bool; inline function get_UI_RIGHT_R() - return _ui_rightR.check(); + return _ui_right.checkJustReleased(); public var UI_DOWN_R(get, never):Bool; inline function get_UI_DOWN_R() - return _ui_downR.check(); + return _ui_down.checkJustReleased(); + + public var UI_UP_GAMEPAD(get, never):Bool; + + inline function get_UI_UP_GAMEPAD() + return _ui_up.checkPressedGamepad(); + + public var UI_LEFT_GAMEPAD(get, never):Bool; + + inline function get_UI_LEFT_GAMEPAD() + return _ui_left.checkPressedGamepad(); + + public var UI_RIGHT_GAMEPAD(get, never):Bool; + + inline function get_UI_RIGHT_GAMEPAD() + return _ui_right.checkPressedGamepad(); + + public var UI_DOWN_GAMEPAD(get, never):Bool; + + inline function get_UI_DOWN_GAMEPAD() + return _ui_down.checkPressedGamepad(); public var NOTE_UP(get, never):Bool; inline function get_NOTE_UP() - return _note_up.check(); + return _note_up.checkPressed(); public var NOTE_LEFT(get, never):Bool; inline function get_NOTE_LEFT() - return _note_left.check(); + return _note_left.checkPressed(); public var NOTE_RIGHT(get, never):Bool; inline function get_NOTE_RIGHT() - return _note_right.check(); + return _note_right.checkPressed(); public var NOTE_DOWN(get, never):Bool; inline function get_NOTE_DOWN() - return _note_down.check(); + return _note_down.checkPressed(); public var NOTE_UP_P(get, never):Bool; inline function get_NOTE_UP_P() - return _note_upP.check(); + return _note_up.checkJustPressed(); public var NOTE_LEFT_P(get, never):Bool; inline function get_NOTE_LEFT_P() - return _note_leftP.check(); + return _note_left.checkJustPressed(); public var NOTE_RIGHT_P(get, never):Bool; inline function get_NOTE_RIGHT_P() - return _note_rightP.check(); + return _note_right.checkJustPressed(); public var NOTE_DOWN_P(get, never):Bool; inline function get_NOTE_DOWN_P() - return _note_downP.check(); + return _note_down.checkJustPressed(); public var NOTE_UP_R(get, never):Bool; inline function get_NOTE_UP_R() - return _note_upR.check(); + return _note_up.checkJustReleased(); public var NOTE_LEFT_R(get, never):Bool; inline function get_NOTE_LEFT_R() - return _note_leftR.check(); + return _note_left.checkJustReleased(); public var NOTE_RIGHT_R(get, never):Bool; inline function get_NOTE_RIGHT_R() - return _note_rightR.check(); + return _note_right.checkJustReleased(); public var NOTE_DOWN_R(get, never):Bool; inline function get_NOTE_DOWN_R() - return _note_downR.check(); + return _note_down.checkJustReleased(); public var ACCEPT(get, never):Bool; @@ -270,26 +274,10 @@ class Controls extends FlxActionSet add(_ui_left); add(_ui_right); add(_ui_down); - add(_ui_upP); - add(_ui_leftP); - add(_ui_rightP); - add(_ui_downP); - add(_ui_upR); - add(_ui_leftR); - add(_ui_rightR); - add(_ui_downR); add(_note_up); add(_note_left); add(_note_right); add(_note_down); - add(_note_upP); - add(_note_leftP); - add(_note_rightP); - add(_note_downP); - add(_note_upR); - add(_note_leftR); - add(_note_rightR); - add(_note_downR); add(_accept); add(_back); add(_pause); @@ -303,8 +291,16 @@ class Controls extends FlxActionSet add(_cheat); #end - for (action in digitalActions) - byName[action.name] = action; + for (action in digitalActions) { + if (Std.isOfType(action, FunkinAction)) { + var funkinAction:FunkinAction = cast action; + byName[funkinAction.name] = funkinAction; + if (funkinAction.namePressed != null) + byName[funkinAction.namePressed] = funkinAction; + if (funkinAction.nameReleased != null) + byName[funkinAction.nameReleased] = funkinAction; + } + } if (scheme == null) scheme = None; @@ -317,14 +313,17 @@ class Controls extends FlxActionSet super.update(); } - // inline - public function checkByName(name:Action):Bool + public function check(name:Action, trigger:FlxInputState = JUST_PRESSED, gamepadOnly:Bool = false):Bool { #if debug if (!byName.exists(name)) throw 'Invalid name: $name'; #end - return byName[name].check(); + var action = byName[name]; + if (gamepadOnly) + return action.checkFiltered(trigger, GAMEPAD); + else + return action.checkFiltered(trigger); } public function getKeysForAction(name:Action):Array { @@ -411,36 +410,36 @@ class Controls extends FlxActionSet { case UI_UP: func(_ui_up, PRESSED); - func(_ui_upP, JUST_PRESSED); - func(_ui_upR, JUST_RELEASED); + func(_ui_up, JUST_PRESSED); + func(_ui_up, JUST_RELEASED); case UI_LEFT: func(_ui_left, PRESSED); - func(_ui_leftP, JUST_PRESSED); - func(_ui_leftR, JUST_RELEASED); + func(_ui_left, JUST_PRESSED); + func(_ui_left, JUST_RELEASED); case UI_RIGHT: func(_ui_right, PRESSED); - func(_ui_rightP, JUST_PRESSED); - func(_ui_rightR, JUST_RELEASED); + func(_ui_right, JUST_PRESSED); + func(_ui_right, JUST_RELEASED); case UI_DOWN: func(_ui_down, PRESSED); - func(_ui_downP, JUST_PRESSED); - func(_ui_downR, JUST_RELEASED); + func(_ui_down, JUST_PRESSED); + func(_ui_down, JUST_RELEASED); case NOTE_UP: func(_note_up, PRESSED); - func(_note_upP, JUST_PRESSED); - func(_note_upR, JUST_RELEASED); + func(_note_up, JUST_PRESSED); + func(_note_up, JUST_RELEASED); case NOTE_LEFT: func(_note_left, PRESSED); - func(_note_leftP, JUST_PRESSED); - func(_note_leftR, JUST_RELEASED); + func(_note_left, JUST_PRESSED); + func(_note_left, JUST_RELEASED); case NOTE_RIGHT: func(_note_right, PRESSED); - func(_note_rightP, JUST_PRESSED); - func(_note_rightR, JUST_RELEASED); + func(_note_right, JUST_PRESSED); + func(_note_right, JUST_RELEASED); case NOTE_DOWN: func(_note_down, PRESSED); - func(_note_downP, JUST_PRESSED); - func(_note_downR, JUST_RELEASED); + func(_note_down, JUST_PRESSED); + func(_note_down, JUST_RELEASED); case ACCEPT: func(_accept, JUST_PRESSED); case BACK: @@ -1053,6 +1052,173 @@ typedef Swipes = ?curTouchPos:FlxPoint }; +/** + * An FlxActionDigital with additional functionality, including: + * - Combining `pressed` and `released` inputs into one action. + * - Filtering by input method (`KEYBOARD`, `MOUSE`, `GAMEPAD`, etc). + */ +class FunkinAction extends FlxActionDigital { + public var namePressed(default, null):Null; + public var nameReleased(default, null):Null; + + var cache:Map = []; + + public function new(?name:String = "", ?namePressed:String, ?nameReleased:String) + { + super(name); + + this.namePressed = namePressed; + this.nameReleased = nameReleased; + } + + /** + * Input checks default to whether the input was just pressed, on any input device. + */ + public override function check():Bool { + return checkFiltered(JUST_PRESSED); + } + + /** + * Check whether the input is currently being held. + */ + public function checkPressed():Bool { + return checkFiltered(PRESSED); + } + + /** + * Check whether the input is currently being held, and was not held last frame. + */ + public function checkJustPressed():Bool { + return checkFiltered(JUST_PRESSED); + } + + /** + * Check whether the input is not currently being held. + */ + public function checkReleased():Bool { + return checkFiltered(RELEASED); + } + + /** + * Check whether the input is not currently being held, and was held last frame. + */ + public function checkJustReleased():Bool { + return checkFiltered(JUST_RELEASED); + } + + /** + * Check whether the input is currently being held by a gamepad device. + */ + public function checkPressedGamepad():Bool { + return checkFiltered(PRESSED, GAMEPAD); + } + + /** + * Check whether the input is currently being held by a gamepad device, and was not held last frame. + */ + public function checkJustPressedGamepad():Bool { + return checkFiltered(JUST_PRESSED, GAMEPAD); + } + + /** + * Check whether the input is not currently being held by a gamepad device. + */ + public function checkReleasedGamepad():Bool { + return checkFiltered(RELEASED, GAMEPAD); + } + + /** + * Check whether the input is not currently being held by a gamepad device, and was held last frame. + */ + public function checkJustReleasedGamepad():Bool { + return checkFiltered(JUST_RELEASED, GAMEPAD); + } + + public function checkMultiFiltered(?filterTriggers:Array, ?filterDevices:Array):Bool { + if (filterTriggers == null) { + filterTriggers = [PRESSED, JUST_PRESSED]; + } + if (filterDevices == null) { + filterDevices = []; + } + + // Perform checkFiltered for each combination. + for (i in filterTriggers) { + if (filterDevices.length == 0) { + if (checkFiltered(i)) { + return true; + } + } else { + for (j in filterDevices) { + if (checkFiltered(i, j)) { + return true; + } + } + } + } + return false; + } + + /** + * Performs the functionality of `FlxActionDigital.check()`, but with optional filters. + * @param action The action to check for. + * @param filterTrigger Optionally filter by trigger condition (`JUST_PRESSED`, `PRESSED`, `JUST_RELEASED`, `RELEASED`). + * @param filterDevice Optionally filter by device (`KEYBOARD`, `MOUSE`, `GAMEPAD`, `OTHER`). + */ + public function checkFiltered(?filterTrigger:FlxInputState, ?filterDevice:FlxInputDevice):Bool { + // The normal + + // Make sure we only update the inputs once per frame. + var key = '${filterTrigger}:${filterDevice}'; + var cacheEntry = cache.get(key); + + if (cacheEntry != null && cacheEntry.timestamp == FlxG.game.ticks) { + return cacheEntry.value; + } + // Use a for loop instead so we can remove inputs while iterating. + + // We don't return early because we need to call check() on ALL inputs. + var result = false; + var len = inputs != null ? inputs.length : 0; + for (i in 0...len) + { + var j = len - i - 1; + var input = inputs[j]; + + // Filter out dead inputs. + if (input.destroyed) + { + inputs.splice(j, 1); + continue; + } + + // Update the input. + input.update(); + + // Check whether the input is the right trigger. + if (filterTrigger != null && input.trigger != filterTrigger) { + continue; + } + + // Check whether the input is the right device. + if (filterDevice != null && input.device != filterDevice) { + continue; + } + + // Check whether the input has triggered. + if (input.check(this)) + { + result = true; + } + } + + // We need to cache this result. + cache.set(key, {timestamp: FlxG.game.ticks, value: result}); + + return result; + } +} + class FlxActionInputDigitalMobileSwipeGameplay extends FlxActionInputDigital { var touchMap:Map = new Map(); @@ -1242,8 +1408,7 @@ enum Control #end } -enum -abstract Action(String) to String from String +enum abstract Action(String) to String from String { // NOTE var NOTE_UP = "note_up"; diff --git a/source/funkin/input/TurboActionHandler.hx b/source/funkin/input/TurboActionHandler.hx new file mode 100644 index 000000000..9425db8cd --- /dev/null +++ b/source/funkin/input/TurboActionHandler.hx @@ -0,0 +1,111 @@ +package funkin.input; + +import flixel.input.keyboard.FlxKey; +import flixel.FlxBasic; +import funkin.input.Controls; +import funkin.input.Controls.Action; + +/** + * Handles repeating behavior when holding down a control action. + * + * When the `action` is pressed, `activated` will be true for the first frame, + * then wait `delay` seconds before becoming true for one frame every `interval` seconds. + * + * Example: Pressing Ctrl+Z will undo, while holding Ctrl+Z will start to undo repeatedly. + */ +class TurboActionHandler extends FlxBasic +{ + /** + * Default delay before repeating. + */ + static inline final DEFAULT_DELAY:Float = 0.4; + + /** + * Default interval between repeats. + */ + static inline final DEFAULT_INTERVAL:Float = 0.1; + + /** + * Whether the action for this handler is pressed. + */ + public var pressed(get, never):Bool; + + /** + * Whether the action for this handler is pressed, + * and the handler is ready to repeat. + */ + public var activated(default, null):Bool = false; + + /** + * The Funkin Controls handler. + */ + var controls(get, never):Controls; + + function get_controls():Controls + { + return PlayerSettings.player1.controls; + } + + var action:Action; + + var delay:Float; + var interval:Float; + var gamepadOnly:Bool; + + var pressedTime:Float = 0; + + function new(action:Action, delay:Float = DEFAULT_DELAY, interval:Float = DEFAULT_INTERVAL, gamepadOnly:Bool = false) + { + super(); + this.action = action; + this.delay = delay; + this.interval = interval; + this.gamepadOnly = gamepadOnly; + } + + function get_pressed():Bool + { + return controls.check(action, PRESSED, gamepadOnly); + } + + public override function update(elapsed:Float):Void + { + super.update(elapsed); + + if (pressed) + { + if (pressedTime == 0) + { + activated = true; + } + else if (pressedTime >= (delay + interval)) + { + activated = true; + pressedTime -= interval; + } + else + { + activated = false; + } + pressedTime += elapsed; + } + else + { + pressedTime = 0; + activated = false; + } + } + + /** + * Builds a TurboActionHandler that monitors from a single key. + * @param inputKey The key to monitor. + * @param delay How long to wait before repeating. + * @param repeatDelay How long to wait between repeats. + * @return A TurboActionHandler + */ + public static overload inline extern function build(action:Action, ?delay:Float = DEFAULT_DELAY, ?interval:Float = DEFAULT_INTERVAL, + ?gamepadOnly:Bool = false):TurboActionHandler + { + return new TurboActionHandler(action, delay, interval); + } +} diff --git a/source/funkin/input/TurboButtonHandler.hx b/source/funkin/input/TurboButtonHandler.hx new file mode 100644 index 000000000..63c2a294b --- /dev/null +++ b/source/funkin/input/TurboButtonHandler.hx @@ -0,0 +1,127 @@ +package funkin.input; + +import flixel.input.gamepad.FlxGamepadInputID; +import flixel.input.gamepad.FlxGamepad; +import flixel.FlxBasic; + +/** + * Handles repeating behavior when holding down a gamepad button or button combination. + * + * When the `inputs` are pressed, `activated` will be true for the first frame, + * then wait `delay` seconds before becoming true for one frame every `interval` seconds. + * + * Example: Pressing Ctrl+Z will undo, while holding Ctrl+Z will start to undo repeatedly. + */ +class TurboButtonHandler extends FlxBasic +{ + /** + * Default delay before repeating. + */ + static inline final DEFAULT_DELAY:Float = 0.4; + + /** + * Default interval between repeats. + */ + static inline final DEFAULT_INTERVAL:Float = 0.1; + + /** + * Whether all of the keys for this handler are pressed. + */ + public var allPressed(get, never):Bool; + + /** + * Whether all of the keys for this handler are activated, + * and the handler is ready to repeat. + */ + public var activated(default, null):Bool = false; + + var inputs:Array; + var delay:Float; + var interval:Float; + var targetGamepad:FlxGamepad; + + var allPressedTime:Float = 0; + + function new(inputs:Array, delay:Float = DEFAULT_DELAY, interval:Float = DEFAULT_INTERVAL, ?targetGamepad:FlxGamepad) + { + super(); + this.inputs = inputs; + this.delay = delay; + this.interval = interval; + this.targetGamepad = targetGamepad ?? FlxG.gamepads.firstActive; + } + + function get_allPressed():Bool + { + if (targetGamepad == null) return false; + if (inputs == null || inputs.length == 0) return false; + if (inputs.length == 1) return targetGamepad.anyPressed(inputs); + + // Check if ANY keys are unpressed + for (input in inputs) + { + if (!targetGamepad.anyPressed([input])) return false; + } + return true; + } + + public override function update(elapsed:Float):Void + { + super.update(elapsed); + + // Try to find a gamepad if we don't have one + if (targetGamepad == null) + { + targetGamepad = FlxG.gamepads.firstActive; + } + + if (allPressed) + { + if (allPressedTime == 0) + { + activated = true; + } + else if (allPressedTime >= (delay + interval)) + { + activated = true; + allPressedTime -= interval; + } + else + { + activated = false; + } + allPressedTime += elapsed; + } + else + { + allPressedTime = 0; + activated = false; + } + } + + /** + * Builds a TurboButtonHandler that monitors from a single input. + * @param input The input to monitor. + * @param delay How long to wait before repeating. + * @param repeatDelay How long to wait between repeats. + * @return A TurboKeyHandler + */ + public static overload inline extern function build(input:FlxGamepadInputID, ?delay:Float = DEFAULT_DELAY, + ?interval:Float = DEFAULT_INTERVAL):TurboButtonHandler + { + return new TurboButtonHandler([input], delay, interval); + } + + /** + * Builds a TurboKeyHandler that monitors a key combination. + * @param inputs The combination of inputs to monitor. + * @param delay How long to wait before repeating. + * @param repeatDelay How long to wait between repeats. + * @return A TurboKeyHandler + */ + public static overload inline extern function build(inputs:Array, ?delay:Float = DEFAULT_DELAY, + ?interval:Float = DEFAULT_INTERVAL):TurboButtonHandler + { + return new TurboButtonHandler(inputs, delay, interval); + } +} diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 1773a84fe..f3236578a 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -1,24 +1,25 @@ package funkin.ui.debug.charting; -import funkin.util.logging.CrashHandler; -import haxe.ui.containers.HBox; -import haxe.ui.containers.Grid; -import haxe.ui.containers.ScrollView; -import haxe.ui.containers.menus.MenuBar; import flixel.addons.display.FlxSliceSprite; import flixel.addons.display.FlxTiledSprite; import flixel.addons.transition.FlxTransitionableState; import flixel.FlxCamera; import flixel.FlxSprite; import flixel.FlxSubState; +import flixel.graphics.FlxGraphic; +import flixel.group.FlxGroup.FlxTypedGroup; import flixel.group.FlxSpriteGroup; +import flixel.input.gamepad.FlxGamepadInputID; import flixel.input.keyboard.FlxKey; +import flixel.input.mouse.FlxMouseEvent; import flixel.math.FlxMath; import flixel.math.FlxPoint; import flixel.graphics.FlxGraphic; import flixel.math.FlxRect; import flixel.sound.FlxSound; +import flixel.system.debug.log.LogStyle; import flixel.system.FlxAssets.FlxSoundAsset; +import flixel.text.FlxText; import flixel.tweens.FlxEase; import flixel.tweens.FlxTween; import flixel.tweens.misc.VarTween; @@ -26,19 +27,31 @@ import haxe.ui.Toolkit; import flixel.util.FlxColor; import flixel.util.FlxSort; import flixel.util.FlxTimer; -import funkin.audio.visualize.PolygonSpectogram; -import funkin.audio.VoicesGroup; import funkin.audio.FunkinSound; +import funkin.audio.visualize.PolygonSpectogram; +import funkin.audio.visualize.PolygonSpectogram; +import funkin.audio.visualize.PolygonVisGroup; +import funkin.audio.VoicesGroup; import funkin.data.notestyle.NoteStyleRegistry; import funkin.data.song.SongData.SongCharacterData; +import funkin.data.song.SongData.SongCharacterData; +import funkin.data.song.SongData.SongChartData; import funkin.data.song.SongData.SongChartData; import funkin.data.song.SongData.SongEventData; +import funkin.data.song.SongData.SongEventData; import funkin.data.song.SongData.SongMetadata; +import funkin.data.song.SongData.SongMetadata; +import funkin.data.song.SongData.SongNoteData; import funkin.data.song.SongData.SongNoteData; import funkin.data.song.SongData.SongOffsets; import funkin.data.song.SongDataUtils; +import funkin.data.song.SongDataUtils; import funkin.data.song.SongRegistry; +import funkin.data.song.SongRegistry; +import funkin.input.Controls.Action; import funkin.input.Cursor; +import funkin.input.TurboActionHandler; +import funkin.input.TurboButtonHandler; import funkin.input.TurboKeyHandler; import funkin.modding.events.ScriptEvent; import funkin.play.character.BaseCharacter.CharacterType; @@ -48,20 +61,13 @@ import funkin.play.components.HealthIcon; import funkin.play.notes.NoteSprite; import funkin.play.PlayState; import funkin.play.song.Song; -import funkin.data.song.SongData.SongChartData; -import funkin.data.song.SongRegistry; -import funkin.data.song.SongData.SongEventData; -import funkin.data.song.SongData.SongMetadata; -import funkin.data.song.SongData.SongNoteData; -import funkin.data.song.SongData.SongCharacterData; -import funkin.data.song.SongDataUtils; -import funkin.ui.debug.charting.commands.ChartEditorCommand; import funkin.play.stage.StageData; import funkin.save.Save; import funkin.ui.debug.charting.commands.AddEventsCommand; import funkin.ui.debug.charting.commands.AddNotesCommand; import funkin.ui.debug.charting.commands.ChartEditorCommand; import funkin.ui.debug.charting.commands.ChartEditorCommand; +import funkin.ui.debug.charting.commands.ChartEditorCommand; import funkin.ui.debug.charting.commands.CutItemsCommand; import funkin.ui.debug.charting.commands.DeselectAllItemsCommand; import funkin.ui.debug.charting.commands.DeselectItemsCommand; @@ -80,17 +86,20 @@ import funkin.ui.debug.charting.commands.SelectItemsCommand; import funkin.ui.debug.charting.commands.SetItemSelectionCommand; import funkin.ui.debug.charting.components.ChartEditorEventSprite; import funkin.ui.debug.charting.components.ChartEditorHoldNoteSprite; +import funkin.ui.debug.charting.components.ChartEditorMeasureTicks; import funkin.ui.debug.charting.components.ChartEditorNotePreview; import funkin.ui.debug.charting.components.ChartEditorNoteSprite; import funkin.ui.debug.charting.components.ChartEditorMeasureTicks; import funkin.ui.debug.charting.components.ChartEditorPlaybarHead; import funkin.ui.debug.charting.components.ChartEditorSelectionSquareSprite; import funkin.ui.debug.charting.handlers.ChartEditorShortcutHandler; +import funkin.ui.debug.charting.toolboxes.ChartEditorBaseToolbox; import funkin.ui.haxeui.components.CharacterPlayer; import funkin.ui.haxeui.HaxeUIState; import funkin.ui.mainmenu.MainMenuState; import funkin.util.Constants; import funkin.util.FileUtil; +import funkin.util.logging.CrashHandler; import funkin.util.SortUtil; import funkin.util.WindowUtil; import haxe.DynamicAccess; @@ -98,22 +107,25 @@ import haxe.io.Bytes; import haxe.io.Path; import haxe.ui.backend.flixel.UIRuntimeState; import haxe.ui.backend.flixel.UIState; -import haxe.ui.components.DropDown; -import haxe.ui.components.Label; import haxe.ui.components.Button; +import haxe.ui.components.DropDown; +import haxe.ui.components.Image; +import haxe.ui.components.Label; import haxe.ui.components.NumberStepper; import haxe.ui.components.Slider; import haxe.ui.components.TextField; import haxe.ui.containers.dialogs.CollapsibleDialog; import haxe.ui.containers.Frame; +import haxe.ui.containers.Grid; +import haxe.ui.containers.HBox; import haxe.ui.containers.menus.Menu; import haxe.ui.containers.menus.MenuBar; -import haxe.ui.containers.menus.MenuItem; +import haxe.ui.containers.menus.MenuBar; import haxe.ui.containers.menus.MenuCheckBox; +import haxe.ui.containers.menus.MenuItem; +import haxe.ui.containers.ScrollView; import haxe.ui.containers.TreeView; import haxe.ui.containers.TreeViewNode; -import haxe.ui.components.Image; -import funkin.ui.debug.charting.toolboxes.ChartEditorBaseToolbox; import haxe.ui.core.Component; import haxe.ui.core.Screen; import haxe.ui.events.DragEvent; @@ -122,12 +134,6 @@ import haxe.ui.events.UIEvent; import haxe.ui.events.UIEvent; import haxe.ui.focus.FocusManager; import openfl.display.BitmapData; -import funkin.audio.visualize.PolygonSpectogram; -import flixel.group.FlxGroup.FlxTypedGroup; -import funkin.audio.visualize.PolygonVisGroup; -import flixel.input.mouse.FlxMouseEvent; -import flixel.text.FlxText; -import flixel.system.debug.log.LogStyle; using Lambda; @@ -360,6 +366,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } } + updatePlayheadGhostHoldNotes(); + // Move the rendered notes to the correct position. renderedNotes.setPosition(gridTiledSprite?.x ?? 0.0, gridTiledSprite?.y ?? 0.0); renderedHoldNotes.setPosition(gridTiledSprite?.x ?? 0.0, gridTiledSprite?.y ?? 0.0); @@ -429,6 +437,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Move the playhead sprite to the correct position. gridPlayhead.y = this.playheadPositionInPixels + (MENU_BAR_HEIGHT + GRID_TOP_PAD); + updatePlayheadGhostHoldNotes(); + return this.playheadPositionInPixels; } @@ -720,6 +730,13 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState */ var currentPlaceNoteData:Null = null; + /** + * The SongNoteData which is currently being placed, for each column. + * `null` if the user isn't currently placing a note. + * As the user moves down, we will update this note's sustain length, and finalize the note when they release. + */ + var currentLiveInputPlaceNoteData:Array = []; + // Note Movement /** @@ -750,6 +767,12 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState */ var dragLengthCurrent:Float = 0; + /** + * The current length of the hold note we are placing with the playhead, in steps. + * Play a sound when this value changes. + */ + var playheadDragLengthCurrent:Array = []; + /** * Flip-flop to alternate between two stretching sounds. */ @@ -1020,6 +1043,66 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState */ var pageDownKeyHandler:TurboKeyHandler = TurboKeyHandler.build(FlxKey.PAGEDOWN); + /** + * Variable used to track how long the user has been holding up on the dpad. + */ + var dpadUpGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.DPAD_UP); + + /** + * Variable used to track how long the user has been holding down on the dpad. + */ + var dpadDownGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.DPAD_DOWN); + + /** + * Variable used to track how long the user has been holding left on the dpad. + */ + var dpadLeftGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.DPAD_LEFT); + + /** + * Variable used to track how long the user has been holding right on the dpad. + */ + var dpadRightGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.DPAD_RIGHT); + + /** + * Variable used to track how long the user has been holding up on the left stick. + */ + var leftStickUpGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.LEFT_STICK_DIGITAL_UP); + + /** + * Variable used to track how long the user has been holding down on the left stick. + */ + var leftStickDownGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.LEFT_STICK_DIGITAL_DOWN); + + /** + * Variable used to track how long the user has been holding left on the left stick. + */ + var leftStickLeftGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.LEFT_STICK_DIGITAL_LEFT); + + /** + * Variable used to track how long the user has been holding right on the left stick. + */ + var leftStickRightGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.LEFT_STICK_DIGITAL_RIGHT); + + /** + * Variable used to track how long the user has been holding up on the right stick. + */ + var rightStickUpGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.RIGHT_STICK_DIGITAL_UP); + + /** + * Variable used to track how long the user has been holding down on the right stick. + */ + var rightStickDownGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.RIGHT_STICK_DIGITAL_DOWN); + + /** + * Variable used to track how long the user has been holding left on the right stick. + */ + var rightStickLeftGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.RIGHT_STICK_DIGITAL_LEFT); + + /** + * Variable used to track how long the user has been holding right on the right stick. + */ + var rightStickRightGamepadHandler:TurboButtonHandler = TurboButtonHandler.build(FlxGamepadInputID.RIGHT_STICK_DIGITAL_RIGHT); + /** * AUDIO AND SOUND DATA */ @@ -1733,10 +1816,15 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var gridGhostNote:Null = null; /** - * A sprite used to indicate the note that will be placed on click. + * A sprite used to indicate the hold note that will be placed on click. */ var gridGhostHoldNote:Null = null; + /** + * A sprite used to indicate the hold note that will be placed on button release. + */ + var gridPlayheadGhostHoldNotes:Array = []; + /** * A sprite used to indicate the event that will be placed on click. */ @@ -2126,11 +2214,23 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState gridGhostHoldNote = new ChartEditorHoldNoteSprite(this); gridGhostHoldNote.alpha = 0.6; - gridGhostHoldNote.noteData = new SongNoteData(0, 0, 0, ""); + gridGhostHoldNote.noteData = null; gridGhostHoldNote.visible = false; add(gridGhostHoldNote); gridGhostHoldNote.zIndex = 11; + while (gridPlayheadGhostHoldNotes.length < (STRUMLINE_SIZE * 2)) + { + var ghost = new ChartEditorHoldNoteSprite(this); + ghost.alpha = 0.6; + ghost.noteData = null; + ghost.visible = false; + add(ghost); + ghost.zIndex = 11; + + gridPlayheadGhostHoldNotes.push(ghost); + } + gridGhostEvent = new ChartEditorEventSprite(this); gridGhostEvent.alpha = 0.6; gridGhostEvent.eventData = new SongEventData(-1, '', {}); @@ -2702,6 +2802,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState */ function setupTurboKeyHandlers():Void { + // Keyboard shortcuts add(undoKeyHandler); add(redoKeyHandler); add(upKeyHandler); @@ -2710,6 +2811,20 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState add(sKeyHandler); add(pageUpKeyHandler); add(pageDownKeyHandler); + + // Gamepad inputs + add(dpadUpGamepadHandler); + add(dpadDownGamepadHandler); + add(dpadLeftGamepadHandler); + add(dpadRightGamepadHandler); + add(leftStickUpGamepadHandler); + add(leftStickDownGamepadHandler); + add(leftStickLeftGamepadHandler); + add(leftStickRightGamepadHandler); + add(rightStickUpGamepadHandler); + add(rightStickDownGamepadHandler); + add(rightStickLeftGamepadHandler); + add(rightStickRightGamepadHandler); } /** @@ -2865,6 +2980,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState handleTestKeybinds(); handleHelpKeybinds(); + this.handleGamepadControls(); + #if debug handleQuickWatch(); #end @@ -3370,32 +3487,56 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Up Arrow = Scroll Up if (upKeyHandler.activated && currentLiveInputStyle == None) { - scrollAmount = -GRID_SIZE * 0.25 * 25.0; + scrollAmount = -GRID_SIZE * 4; shouldPause = true; } // Down Arrow = Scroll Down if (downKeyHandler.activated && currentLiveInputStyle == None) { - scrollAmount = GRID_SIZE * 0.25 * 25.0; + scrollAmount = GRID_SIZE * 4; shouldPause = true; } // W = Scroll Up (doesn't work with Ctrl+Scroll) if (wKeyHandler.activated && currentLiveInputStyle == None && !FlxG.keys.pressed.CONTROL) { - scrollAmount = -GRID_SIZE * 0.25 * 25.0; + scrollAmount = -GRID_SIZE * 4; shouldPause = true; } // S = Scroll Down (doesn't work with Ctrl+Scroll) if (sKeyHandler.activated && currentLiveInputStyle == None && !FlxG.keys.pressed.CONTROL) { - scrollAmount = GRID_SIZE * 0.25 * 25.0; + scrollAmount = GRID_SIZE * 4; shouldPause = true; } - // PAGE UP = Jump up to nearest measure - if (pageUpKeyHandler.activated) + // GAMEPAD LEFT STICK UP = Scroll Up by 1 note snap + if (leftStickUpGamepadHandler.activated) { + scrollAmount = -GRID_SIZE * noteSnapRatio; + shouldPause = true; + } + // GAMEPAD LEFT STICK DOWN = Scroll Down by 1 note snap + if (leftStickDownGamepadHandler.activated) + { + scrollAmount = GRID_SIZE * noteSnapRatio; + shouldPause = true; + } + + // GAMEPAD RIGHT STICK UP = Scroll Up by 1 note snap (playhead only) + if (rightStickUpGamepadHandler.activated) + { + playheadAmount = -GRID_SIZE * noteSnapRatio; + shouldPause = true; + } + // GAMEPAD RIGHT STICK DOWN = Scroll Down by 1 note snap (playhead only) + if (rightStickDownGamepadHandler.activated) + { + playheadAmount = GRID_SIZE * noteSnapRatio; + shouldPause = true; + } + + var funcJumpUp = (playheadOnly:Bool) -> { var measureHeight:Float = GRID_SIZE * 4 * Conductor.instance.beatsPerMeasure; var playheadPos:Float = scrollPositionInPixels + playheadPositionInPixels; var targetScrollPosition:Float = Math.floor(playheadPos / measureHeight) * measureHeight; @@ -3405,20 +3546,37 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { targetScrollPosition -= GRID_SIZE * Constants.STEPS_PER_BEAT * Conductor.instance.beatsPerMeasure; } - scrollAmount = targetScrollPosition - playheadPos; + if (playheadOnly) + { + playheadAmount = targetScrollPosition - playheadPos; + } + else + { + scrollAmount = targetScrollPosition - playheadPos; + } + } + + // PAGE UP = Jump up to nearest measure + // GAMEPAD LEFT STICK LEFT = Jump up to nearest measure + if (pageUpKeyHandler.activated || leftStickLeftGamepadHandler.activated) + { + funcJumpUp(false); + shouldPause = true; + } + if (rightStickLeftGamepadHandler.activated) + { + funcJumpUp(true); shouldPause = true; } if (playbarButtonPressed == 'playbarBack') { playbarButtonPressed = ''; - scrollAmount = -GRID_SIZE * 4 * Conductor.instance.beatsPerMeasure; + funcJumpUp(false); shouldPause = true; } - // PAGE DOWN = Jump down to nearest measure - if (pageDownKeyHandler.activated) - { + var funcJumpDown = (playheadOnly:Bool) -> { var measureHeight:Float = GRID_SIZE * 4 * Conductor.instance.beatsPerMeasure; var playheadPos:Float = scrollPositionInPixels + playheadPositionInPixels; var targetScrollPosition:Float = Math.ceil(playheadPos / measureHeight) * measureHeight; @@ -3428,26 +3586,46 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { targetScrollPosition += GRID_SIZE * Constants.STEPS_PER_BEAT * Conductor.instance.beatsPerMeasure; } - scrollAmount = targetScrollPosition - playheadPos; + if (playheadOnly) + { + playheadAmount = targetScrollPosition - playheadPos; + } + else + { + scrollAmount = targetScrollPosition - playheadPos; + } + } + + // PAGE DOWN = Jump down to nearest measure + // GAMEPAD LEFT STICK RIGHT = Jump down to nearest measure + if (pageDownKeyHandler.activated || leftStickRightGamepadHandler.activated) + { + funcJumpDown(false); + shouldPause = true; + } + if (rightStickRightGamepadHandler.activated) + { + funcJumpDown(true); shouldPause = true; } if (playbarButtonPressed == 'playbarForward') { playbarButtonPressed = ''; - scrollAmount = GRID_SIZE * 4 * Conductor.instance.beatsPerMeasure; + funcJumpDown(false); shouldPause = true; } // SHIFT + Scroll = Scroll Fast - if (FlxG.keys.pressed.SHIFT) + // GAMEPAD LEFT STICK CLICK + Scroll = Scroll Fast + if (FlxG.keys.pressed.SHIFT || (FlxG.gamepads.firstActive?.pressed?.LEFT_STICK_CLICK ?? false)) { scrollAmount *= 2; } // CONTROL + Scroll = Scroll Precise if (FlxG.keys.pressed.CONTROL) { - scrollAmount /= 10; + scrollAmount /= 4; } // Alt + Drag = Scroll but move the playhead the same amount. @@ -4520,37 +4698,77 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function handlePlayhead():Void { - // Place notes at the playhead. + // Place notes at the playhead with the keyboard. switch (currentLiveInputStyle) { case ChartEditorLiveInputStyle.WASD: if (FlxG.keys.justPressed.A) placeNoteAtPlayhead(4); + if (FlxG.keys.justReleased.A) finishPlaceNoteAtPlayhead(4); if (FlxG.keys.justPressed.S) placeNoteAtPlayhead(5); + if (FlxG.keys.justReleased.S) finishPlaceNoteAtPlayhead(5); if (FlxG.keys.justPressed.W) placeNoteAtPlayhead(6); + if (FlxG.keys.justReleased.W) finishPlaceNoteAtPlayhead(6); if (FlxG.keys.justPressed.D) placeNoteAtPlayhead(7); + if (FlxG.keys.justReleased.D) finishPlaceNoteAtPlayhead(7); if (FlxG.keys.justPressed.LEFT) placeNoteAtPlayhead(0); + if (FlxG.keys.justReleased.LEFT) finishPlaceNoteAtPlayhead(0); if (FlxG.keys.justPressed.DOWN) placeNoteAtPlayhead(1); + if (FlxG.keys.justReleased.DOWN) finishPlaceNoteAtPlayhead(1); if (FlxG.keys.justPressed.UP) placeNoteAtPlayhead(2); + if (FlxG.keys.justReleased.UP) finishPlaceNoteAtPlayhead(2); if (FlxG.keys.justPressed.RIGHT) placeNoteAtPlayhead(3); + if (FlxG.keys.justReleased.RIGHT) finishPlaceNoteAtPlayhead(3); case ChartEditorLiveInputStyle.NumberKeys: // Flipped because Dad is on the left but represents data 0-3. if (FlxG.keys.justPressed.ONE) placeNoteAtPlayhead(4); + if (FlxG.keys.justReleased.ONE) finishPlaceNoteAtPlayhead(4); if (FlxG.keys.justPressed.TWO) placeNoteAtPlayhead(5); + if (FlxG.keys.justReleased.TWO) finishPlaceNoteAtPlayhead(5); if (FlxG.keys.justPressed.THREE) placeNoteAtPlayhead(6); + if (FlxG.keys.justReleased.THREE) finishPlaceNoteAtPlayhead(6); if (FlxG.keys.justPressed.FOUR) placeNoteAtPlayhead(7); + if (FlxG.keys.justReleased.FOUR) finishPlaceNoteAtPlayhead(7); if (FlxG.keys.justPressed.FIVE) placeNoteAtPlayhead(0); + if (FlxG.keys.justReleased.FIVE) finishPlaceNoteAtPlayhead(0); if (FlxG.keys.justPressed.SIX) placeNoteAtPlayhead(1); if (FlxG.keys.justPressed.SEVEN) placeNoteAtPlayhead(2); + if (FlxG.keys.justReleased.SEVEN) finishPlaceNoteAtPlayhead(2); if (FlxG.keys.justPressed.EIGHT) placeNoteAtPlayhead(3); + if (FlxG.keys.justReleased.EIGHT) finishPlaceNoteAtPlayhead(3); case ChartEditorLiveInputStyle.None: // Do nothing. } + + // Place notes at the playhead with the gamepad. + if (FlxG.gamepads.firstActive != null) + { + if (FlxG.gamepads.firstActive.justPressed.DPAD_LEFT) placeNoteAtPlayhead(4); + if (FlxG.gamepads.firstActive.justReleased.DPAD_LEFT) finishPlaceNoteAtPlayhead(4); + if (FlxG.gamepads.firstActive.justPressed.DPAD_DOWN) placeNoteAtPlayhead(5); + if (FlxG.gamepads.firstActive.justReleased.DPAD_DOWN) finishPlaceNoteAtPlayhead(5); + if (FlxG.gamepads.firstActive.justPressed.DPAD_UP) placeNoteAtPlayhead(6); + if (FlxG.gamepads.firstActive.justReleased.DPAD_UP) finishPlaceNoteAtPlayhead(6); + if (FlxG.gamepads.firstActive.justPressed.DPAD_RIGHT) placeNoteAtPlayhead(7); + if (FlxG.gamepads.firstActive.justReleased.DPAD_RIGHT) finishPlaceNoteAtPlayhead(7); + + if (FlxG.gamepads.firstActive.justPressed.X) placeNoteAtPlayhead(0); + if (FlxG.gamepads.firstActive.justReleased.X) finishPlaceNoteAtPlayhead(0); + if (FlxG.gamepads.firstActive.justPressed.A) placeNoteAtPlayhead(1); + if (FlxG.gamepads.firstActive.justReleased.A) finishPlaceNoteAtPlayhead(1); + if (FlxG.gamepads.firstActive.justPressed.Y) placeNoteAtPlayhead(2); + if (FlxG.gamepads.firstActive.justReleased.Y) finishPlaceNoteAtPlayhead(2); + if (FlxG.gamepads.firstActive.justPressed.B) placeNoteAtPlayhead(3); + if (FlxG.gamepads.firstActive.justReleased.B) finishPlaceNoteAtPlayhead(3); + } } function placeNoteAtPlayhead(column:Int):Void { + // SHIFT + press or LEFT_SHOULDER + press to remove notes instead of placing them. + var removeNoteInstead:Bool = FlxG.keys.pressed.SHIFT || (FlxG.gamepads.firstActive?.pressed?.LEFT_SHOULDER ?? false); + var playheadPos:Float = scrollPositionInPixels + playheadPositionInPixels; var playheadPosFractionalStep:Float = playheadPos / GRID_SIZE / noteSnapRatio; var playheadPosStep:Int = Std.int(Math.floor(playheadPosFractionalStep)); @@ -4561,10 +4779,18 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState playheadPosSnappedMs + Conductor.instance.stepLengthMs * noteSnapRatio); notesAtPos = SongDataUtils.getNotesWithData(notesAtPos, [column]); - if (notesAtPos.length == 0) + if (notesAtPos.length == 0 && !removeNoteInstead) { var newNoteData:SongNoteData = new SongNoteData(playheadPosSnappedMs, column, 0, noteKindToPlace); performCommand(new AddNotesCommand([newNoteData], FlxG.keys.pressed.CONTROL)); + currentLiveInputPlaceNoteData[column] = newNoteData; + gridPlayheadGhostHoldNotes[column].noteData = newNoteData.clone(); + gridPlayheadGhostHoldNotes[column].noteDirection = newNoteData.getDirection(); + } + else if (removeNoteInstead) + { + trace('Removing existing note at position.'); + performCommand(new RemoveNotesCommand(notesAtPos)); } else { @@ -4572,6 +4798,87 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } } + function updatePlayheadGhostHoldNotes():Void + { + // Update playhead ghost hold notes. + for (index in 0...gridPlayheadGhostHoldNotes.length) + { + var ghostHold = gridPlayheadGhostHoldNotes[index]; + if (ghostHold == null) continue; + + if (ghostHold.noteData == null) + { + ghostHold.visible = false; + ghostHold.setHeightDirectly(0); + playheadDragLengthCurrent[index] = 0; + continue; + }; + + var playheadPos:Float = scrollPositionInPixels + playheadPositionInPixels; + var playheadPosFractionalStep:Float = playheadPos / GRID_SIZE / noteSnapRatio; + var playheadPosStep:Int = Std.int(Math.floor(playheadPosFractionalStep)); + var playheadPosSnappedMs:Float = playheadPosStep * Conductor.instance.stepLengthMs * noteSnapRatio; + + var newNoteLength:Float = playheadPosSnappedMs - ghostHold.noteData.time; + trace('newNoteLength: ${newNoteLength}'); + + if (newNoteLength > 0) + { + ghostHold.noteData.length = newNoteLength; + var targetNoteLengthSteps:Float = ghostHold.noteData.getStepLength(true); + var targetNoteLengthStepsInt:Int = Std.int(Math.floor(targetNoteLengthSteps)); + var targetNoteLengthPixels:Float = targetNoteLengthSteps * GRID_SIZE; + + if (playheadDragLengthCurrent[index] != targetNoteLengthStepsInt) + { + stretchySounds = !stretchySounds; + this.playSound(Paths.sound('chartingSounds/stretch' + (stretchySounds ? '1' : '2') + '_UI')); + playheadDragLengthCurrent[index] = targetNoteLengthStepsInt; + } + ghostHold.visible = true; + trace('newHeight: ${targetNoteLengthPixels}'); + ghostHold.setHeightDirectly(targetNoteLengthPixels, true); + ghostHold.updateHoldNotePosition(renderedHoldNotes); + } + else + { + ghostHold.visible = false; + ghostHold.setHeightDirectly(0); + playheadDragLengthCurrent[index] = 0; + } + } + } + + function finishPlaceNoteAtPlayhead(column:Int):Void + { + if (currentLiveInputPlaceNoteData[column] == null) return; + + var playheadPos:Float = scrollPositionInPixels + playheadPositionInPixels; + var playheadPosFractionalStep:Float = playheadPos / GRID_SIZE / noteSnapRatio; + var playheadPosStep:Int = Std.int(Math.floor(playheadPosFractionalStep)); + var playheadPosSnappedMs:Float = playheadPosStep * Conductor.instance.stepLengthMs * noteSnapRatio; + + var newNoteLength:Float = playheadPosSnappedMs - currentLiveInputPlaceNoteData[column].time; + trace('finishPlace newNoteLength: ${newNoteLength}'); + + if (newNoteLength < Conductor.instance.stepLengthMs) + { + // Don't extend the note if it's too short. + trace('Not extending note.'); + currentLiveInputPlaceNoteData[column] = null; + gridPlayheadGhostHoldNotes[column].noteData = null; + } + else + { + // Extend the note to the playhead position. + trace('Extending note.'); + this.playSound(Paths.sound('chartingSounds/stretchSNAP_UI')); + performCommand(new ExtendNoteLengthCommand(currentLiveInputPlaceNoteData[column], newNoteLength)); + currentLiveInputPlaceNoteData[column] = null; + gridPlayheadGhostHoldNotes[column].noteData = null; + } + } + /** * Handle aligning the health icons next to the grid. */ diff --git a/source/funkin/ui/debug/charting/commands/RemoveEventsCommand.hx b/source/funkin/ui/debug/charting/commands/RemoveEventsCommand.hx index 7e620c210..102257fc8 100644 --- a/source/funkin/ui/debug/charting/commands/RemoveEventsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/RemoveEventsCommand.hx @@ -20,6 +20,8 @@ class RemoveEventsCommand implements ChartEditorCommand public function execute(state:ChartEditorState):Void { + if (events.length == 0) return; + state.currentSongChartEventData = SongDataUtils.subtractEvents(state.currentSongChartEventData, events); state.currentEventSelection = []; @@ -34,6 +36,8 @@ class RemoveEventsCommand implements ChartEditorCommand public function undo(state:ChartEditorState):Void { + if (events.length == 0) return; + for (event in events) { state.currentSongChartEventData.push(event); diff --git a/source/funkin/ui/debug/charting/commands/RemoveItemsCommand.hx b/source/funkin/ui/debug/charting/commands/RemoveItemsCommand.hx index 77184209e..376908726 100644 --- a/source/funkin/ui/debug/charting/commands/RemoveItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/RemoveItemsCommand.hx @@ -23,6 +23,8 @@ class RemoveItemsCommand implements ChartEditorCommand public function execute(state:ChartEditorState):Void { + if ((notes.length + events.length) == 0) return; + state.currentSongChartNoteData = SongDataUtils.subtractNotes(state.currentSongChartNoteData, notes); state.currentSongChartEventData = SongDataUtils.subtractEvents(state.currentSongChartEventData, events); @@ -40,6 +42,8 @@ class RemoveItemsCommand implements ChartEditorCommand public function undo(state:ChartEditorState):Void { + if ((notes.length + events.length) == 0) return; + for (note in notes) { state.currentSongChartNoteData.push(note); diff --git a/source/funkin/ui/debug/charting/commands/RemoveNotesCommand.hx b/source/funkin/ui/debug/charting/commands/RemoveNotesCommand.hx index e189be83e..4e7b480dd 100644 --- a/source/funkin/ui/debug/charting/commands/RemoveNotesCommand.hx +++ b/source/funkin/ui/debug/charting/commands/RemoveNotesCommand.hx @@ -20,6 +20,8 @@ class RemoveNotesCommand implements ChartEditorCommand public function execute(state:ChartEditorState):Void { + if (notes.length == 0) return; + state.currentSongChartNoteData = SongDataUtils.subtractNotes(state.currentSongChartNoteData, notes); state.currentNoteSelection = []; state.currentEventSelection = []; @@ -35,6 +37,8 @@ class RemoveNotesCommand implements ChartEditorCommand public function undo(state:ChartEditorState):Void { + if (notes.length == 0) return; + for (note in notes) { state.currentSongChartNoteData.push(note); diff --git a/source/funkin/ui/debug/charting/components/ChartEditorHoldNoteSprite.hx b/source/funkin/ui/debug/charting/components/ChartEditorHoldNoteSprite.hx index e5971db08..193390341 100644 --- a/source/funkin/ui/debug/charting/components/ChartEditorHoldNoteSprite.hx +++ b/source/funkin/ui/debug/charting/components/ChartEditorHoldNoteSprite.hx @@ -43,11 +43,16 @@ class ChartEditorHoldNoteSprite extends SustainTrail * Set the height directly, to a value in pixels. * @param h The desired height in pixels. */ - public function setHeightDirectly(h:Float, ?lerp:Bool = false) + public function setHeightDirectly(h:Float, lerp:Bool = false) { - if (lerp != null && lerp) sustainLength = FlxMath.lerp(sustainLength, h / (getScrollSpeed() * Constants.PIXELS_PER_MS), 0.25); + if (lerp) + { + sustainLength = FlxMath.lerp(sustainLength, h / (getScrollSpeed() * Constants.PIXELS_PER_MS), 0.25); + } else + { sustainLength = h / (getScrollSpeed() * Constants.PIXELS_PER_MS); + } fullSustainLength = sustainLength; } diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorGamepadHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorGamepadHandler.hx new file mode 100644 index 000000000..896e2df68 --- /dev/null +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorGamepadHandler.hx @@ -0,0 +1,133 @@ +package funkin.ui.debug.charting.handlers; + +/** + * Yes, we're that crazy. Gamepad support for the chart editor. + */ +@:nullSafety +@:access(funkin.ui.debug.charting.ChartEditorState) +class ChartEditorGamepadHandler +{ + public static function handleGamepadControls(chartEditorState:ChartEditorState) + { + if (FlxG.gamepads.firstActive == null) return; + + if (FlxG.gamepads.firstActive.justPressed.A) + { + // trace('Gamepad: A pressed'); + } + if (FlxG.gamepads.firstActive.justPressed.B) + { + // trace('Gamepad: B pressed'); + } + if (FlxG.gamepads.firstActive.justPressed.X) + { + // trace('Gamepad: X pressed'); + } + if (FlxG.gamepads.firstActive.justPressed.Y) + { + // trace('Gamepad: Y pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.LEFT_SHOULDER) + { + // trace('Gamepad: LEFT_SHOULDER pressed'); + } + if (FlxG.gamepads.firstActive.justPressed.RIGHT_SHOULDER) + { + // trace('Gamepad: RIGHT_SHOULDER pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.LEFT_STICK_CLICK) + { + // trace('Gamepad: LEFT_STICK_CLICK pressed'); + } + if (FlxG.gamepads.firstActive.justPressed.RIGHT_STICK_CLICK) + { + // trace('Gamepad: RIGHT_STICK_CLICK pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.LEFT_TRIGGER) + { + // trace('Gamepad: LEFT_TRIGGER pressed'); + } + if (FlxG.gamepads.firstActive.justPressed.RIGHT_TRIGGER) + { + // trace('Gamepad: RIGHT_TRIGGER pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.START) + { + // trace('Gamepad: START pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.BACK) + { + // trace('Gamepad: BACK pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.GUIDE) + { + // trace('Gamepad: GUIDE pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.DPAD_UP) + { + // trace('Gamepad: DPAD_UP pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.DPAD_DOWN) + { + // trace('Gamepad: DPAD_DOWN pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.DPAD_LEFT) + { + // trace('Gamepad: DPAD_LEFT pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.DPAD_RIGHT) + { + // trace('Gamepad: DPAD_RIGHT pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.LEFT_STICK_DIGITAL_UP) + { + // trace('Gamepad: LEFT_STICK_DIGITAL_UP pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.LEFT_STICK_DIGITAL_DOWN) + { + // trace('Gamepad: LEFT_STICK_DIGITAL_DOWN pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.LEFT_STICK_DIGITAL_LEFT) + { + // trace('Gamepad: LEFT_STICK_DIGITAL_LEFT pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.LEFT_STICK_DIGITAL_RIGHT) + { + // trace('Gamepad: LEFT_STICK_DIGITAL_RIGHT pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.RIGHT_STICK_DIGITAL_UP) + { + // trace('Gamepad: RIGHT_STICK_DIGITAL_UP pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.RIGHT_STICK_DIGITAL_DOWN) + { + // trace('Gamepad: RIGHT_STICK_DIGITAL_DOWN pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.RIGHT_STICK_DIGITAL_LEFT) + { + // trace('Gamepad: RIGHT_STICK_DIGITAL_LEFT pressed'); + } + + if (FlxG.gamepads.firstActive.justPressed.RIGHT_STICK_DIGITAL_RIGHT) + { + // trace('Gamepad: RIGHT_STICK_DIGITAL_RIGHT pressed'); + } + } +} diff --git a/source/funkin/ui/debug/charting/import.hx b/source/funkin/ui/debug/charting/import.hx index b0569e3bb..2c3d59ef7 100644 --- a/source/funkin/ui/debug/charting/import.hx +++ b/source/funkin/ui/debug/charting/import.hx @@ -5,6 +5,7 @@ package funkin.ui.debug.charting; using funkin.ui.debug.charting.handlers.ChartEditorAudioHandler; using funkin.ui.debug.charting.handlers.ChartEditorContextMenuHandler; using funkin.ui.debug.charting.handlers.ChartEditorDialogHandler; +using funkin.ui.debug.charting.handlers.ChartEditorGamepadHandler; using funkin.ui.debug.charting.handlers.ChartEditorImportExportHandler; using funkin.ui.debug.charting.handlers.ChartEditorNotificationHandler; using funkin.ui.debug.charting.handlers.ChartEditorShortcutHandler; From c6b3499897fd81090f2e7f564dc8d4bf7fe84b0d Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 8 Jan 2024 21:26:24 -0500 Subject: [PATCH 002/124] Finished up hold note placement on gamepad, implemented note preview playhead --- source/Main.hx | 2 + .../ui/debug/charting/ChartEditorState.hx | 130 ++++---- .../handlers/ChartEditorGamepadHandler.hx | 278 +++++++++++------- .../ui/haxeui/FlxGamepadActionInputSource.hx | 53 ++++ 4 files changed, 301 insertions(+), 162 deletions(-) create mode 100644 source/funkin/ui/haxeui/FlxGamepadActionInputSource.hx diff --git a/source/Main.hx b/source/Main.hx index 86e520e69..a7482c8d6 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -111,6 +111,8 @@ class Main extends Sprite Toolkit.init(); Toolkit.theme = 'dark'; // don't be cringe Toolkit.autoScale = false; + // Don't focus on UI elements when they first appear. + haxe.ui.focus.FocusManager.instance.autoFocus = false; funkin.input.Cursor.registerHaxeUICursors(); haxe.ui.tooltips.ToolTipManager.defaultDelay = 200; } diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index f3236578a..1b9176174 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -366,8 +366,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } } - updatePlayheadGhostHoldNotes(); - // Move the rendered notes to the correct position. renderedNotes.setPosition(gridTiledSprite?.x ?? 0.0, gridTiledSprite?.y ?? 0.0); renderedHoldNotes.setPosition(gridTiledSprite?.x ?? 0.0, gridTiledSprite?.y ?? 0.0); @@ -375,8 +373,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState renderedSelectionSquares.setPosition(gridTiledSprite?.x ?? 0.0, gridTiledSprite?.y ?? 0.0); // Offset the selection box start position, if we are dragging. if (selectionBoxStartPos != null) selectionBoxStartPos.y -= diff; - // Update the note preview viewport box. + + // Update the note preview. setNotePreviewViewportBounds(calculateNotePreviewViewportBounds()); + refreshNotePreviewPlayheadPosition(); + // Update the measure tick display. if (measureTicks != null) measureTicks.y = gridTiledSprite?.y ?? 0.0; return this.scrollPositionInPixels; @@ -438,6 +439,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState gridPlayhead.y = this.playheadPositionInPixels + (MENU_BAR_HEIGHT + GRID_TOP_PAD); updatePlayheadGhostHoldNotes(); + refreshNotePreviewPlayheadPosition(); return this.playheadPositionInPixels; } @@ -1842,6 +1844,12 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState */ var notePreviewViewport:Null = null; + /** + * The thin sprite used for representing the playhead on the note preview. + * We move this up and down to represent the current position. + */ + var notePreviewPlayhead:Null = null; + /** * The rectangular sprite used for rendering the selection box. * Uses a 9-slice to stretch the selection box to the correct size without warping. @@ -2219,18 +2227,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState add(gridGhostHoldNote); gridGhostHoldNote.zIndex = 11; - while (gridPlayheadGhostHoldNotes.length < (STRUMLINE_SIZE * 2)) - { - var ghost = new ChartEditorHoldNoteSprite(this); - ghost.alpha = 0.6; - ghost.noteData = null; - ghost.visible = false; - add(ghost); - ghost.zIndex = 11; - - gridPlayheadGhostHoldNotes.push(ghost); - } - gridGhostEvent = new ChartEditorEventSprite(this); gridGhostEvent.alpha = 0.6; gridGhostEvent.eventData = new SongEventData(-1, '', {}); @@ -2300,6 +2296,15 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState add(notePreviewViewport); notePreviewViewport.zIndex = 30; + notePreviewPlayhead = new FlxSprite().makeGraphic(2, 2, 0xFFFF0000); + notePreviewPlayhead.scrollFactor.set(0, 0); + notePreviewPlayhead.scale.set(notePreview.width / 2, 0.5); // Setting width does nothing. + notePreviewPlayhead.updateHitbox(); + notePreviewPlayhead.x = notePreview.x; + notePreviewPlayhead.y = notePreview.y; + add(notePreviewPlayhead); + notePreviewPlayhead.zIndex = 31; + setNotePreviewViewportBounds(calculateNotePreviewViewportBounds()); } @@ -2399,6 +2404,13 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState } } + function refreshNotePreviewPlayheadPosition():Void + { + if (notePreviewPlayhead == null) return; + + notePreviewPlayhead.y = notePreview.y + (notePreview.height * ((scrollPositionInPixels + playheadPositionInPixels) / songLengthInPixels)); + } + /** * Builds the group that will hold all the notes. */ @@ -4194,7 +4206,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState gridGhostHoldNote.visible = true; gridGhostHoldNote.noteData = gridGhostNote.noteData; gridGhostHoldNote.noteDirection = gridGhostNote.noteData.getDirection(); - gridGhostHoldNote.setHeightDirectly(dragLengthPixels, true); gridGhostHoldNote.updateHoldNotePosition(renderedHoldNotes); @@ -4741,27 +4752,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Do nothing. } - // Place notes at the playhead with the gamepad. - if (FlxG.gamepads.firstActive != null) - { - if (FlxG.gamepads.firstActive.justPressed.DPAD_LEFT) placeNoteAtPlayhead(4); - if (FlxG.gamepads.firstActive.justReleased.DPAD_LEFT) finishPlaceNoteAtPlayhead(4); - if (FlxG.gamepads.firstActive.justPressed.DPAD_DOWN) placeNoteAtPlayhead(5); - if (FlxG.gamepads.firstActive.justReleased.DPAD_DOWN) finishPlaceNoteAtPlayhead(5); - if (FlxG.gamepads.firstActive.justPressed.DPAD_UP) placeNoteAtPlayhead(6); - if (FlxG.gamepads.firstActive.justReleased.DPAD_UP) finishPlaceNoteAtPlayhead(6); - if (FlxG.gamepads.firstActive.justPressed.DPAD_RIGHT) placeNoteAtPlayhead(7); - if (FlxG.gamepads.firstActive.justReleased.DPAD_RIGHT) finishPlaceNoteAtPlayhead(7); - - if (FlxG.gamepads.firstActive.justPressed.X) placeNoteAtPlayhead(0); - if (FlxG.gamepads.firstActive.justReleased.X) finishPlaceNoteAtPlayhead(0); - if (FlxG.gamepads.firstActive.justPressed.A) placeNoteAtPlayhead(1); - if (FlxG.gamepads.firstActive.justReleased.A) finishPlaceNoteAtPlayhead(1); - if (FlxG.gamepads.firstActive.justPressed.Y) placeNoteAtPlayhead(2); - if (FlxG.gamepads.firstActive.justReleased.Y) finishPlaceNoteAtPlayhead(2); - if (FlxG.gamepads.firstActive.justPressed.B) placeNoteAtPlayhead(3); - if (FlxG.gamepads.firstActive.justReleased.B) finishPlaceNoteAtPlayhead(3); - } + updatePlayheadGhostHoldNotes(); } function placeNoteAtPlayhead(column:Int):Void @@ -4781,38 +4772,68 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState if (notesAtPos.length == 0 && !removeNoteInstead) { + trace('Placing note. ${column}'); var newNoteData:SongNoteData = new SongNoteData(playheadPosSnappedMs, column, 0, noteKindToPlace); performCommand(new AddNotesCommand([newNoteData], FlxG.keys.pressed.CONTROL)); currentLiveInputPlaceNoteData[column] = newNoteData; - gridPlayheadGhostHoldNotes[column].noteData = newNoteData.clone(); - gridPlayheadGhostHoldNotes[column].noteDirection = newNoteData.getDirection(); } else if (removeNoteInstead) { - trace('Removing existing note at position.'); + trace('Removing existing note at position. ${column}'); performCommand(new RemoveNotesCommand(notesAtPos)); } else { - trace('Already a note there.'); + trace('Already a note there. ${column}'); } } function updatePlayheadGhostHoldNotes():Void { - // Update playhead ghost hold notes. - for (index in 0...gridPlayheadGhostHoldNotes.length) + // Ensure all the ghost hold notes exist. + while (gridPlayheadGhostHoldNotes.length < (STRUMLINE_SIZE * 2)) { - var ghostHold = gridPlayheadGhostHoldNotes[index]; - if (ghostHold == null) continue; + var ghost = new ChartEditorHoldNoteSprite(this); + ghost.alpha = 0.6; + ghost.noteData = null; + ghost.visible = false; + ghost.zIndex = 11; + add(ghost); // Don't add to `renderedHoldNotes` because then it will get killed every frame. + + gridPlayheadGhostHoldNotes.push(ghost); + refresh(); + } + + // Update playhead ghost hold notes. + for (column in 0...gridPlayheadGhostHoldNotes.length) + { + var targetNoteData = currentLiveInputPlaceNoteData[column]; + var ghostHold = gridPlayheadGhostHoldNotes[column]; + + if (targetNoteData == null && ghostHold.noteData != null) + { + // Remove the ghost hold note. + ghostHold.noteData = null; + } + + if (targetNoteData != null && ghostHold.noteData == null) + { + // Readd the new ghost hold note. + ghostHold.noteData = targetNoteData.clone(); + ghostHold.noteDirection = ghostHold.noteData.getDirection(); + ghostHold.visible = true; + ghostHold.alpha = 0.6; + ghostHold.setHeightDirectly(0); + ghostHold.updateHoldNotePosition(renderedHoldNotes); + } if (ghostHold.noteData == null) { ghostHold.visible = false; ghostHold.setHeightDirectly(0); - playheadDragLengthCurrent[index] = 0; + playheadDragLengthCurrent[column] = 0; continue; - }; + } var playheadPos:Float = scrollPositionInPixels + playheadPositionInPixels; var playheadPosFractionalStep:Float = playheadPos / GRID_SIZE / noteSnapRatio; @@ -4829,22 +4850,25 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var targetNoteLengthStepsInt:Int = Std.int(Math.floor(targetNoteLengthSteps)); var targetNoteLengthPixels:Float = targetNoteLengthSteps * GRID_SIZE; - if (playheadDragLengthCurrent[index] != targetNoteLengthStepsInt) + if (playheadDragLengthCurrent[column] != targetNoteLengthStepsInt) { stretchySounds = !stretchySounds; this.playSound(Paths.sound('chartingSounds/stretch' + (stretchySounds ? '1' : '2') + '_UI')); - playheadDragLengthCurrent[index] = targetNoteLengthStepsInt; + playheadDragLengthCurrent[column] = targetNoteLengthStepsInt; } ghostHold.visible = true; - trace('newHeight: ${targetNoteLengthPixels}'); + ghostHold.alpha = 0.6; ghostHold.setHeightDirectly(targetNoteLengthPixels, true); ghostHold.updateHoldNotePosition(renderedHoldNotes); + trace('lerpLength: ${ghostHold.fullSustainLength}'); + trace('position: ${ghostHold.x}, ${ghostHold.y}'); } else { ghostHold.visible = false; ghostHold.setHeightDirectly(0); - playheadDragLengthCurrent[index] = 0; + playheadDragLengthCurrent[column] = 0; + continue; } } } @@ -4864,14 +4888,14 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState if (newNoteLength < Conductor.instance.stepLengthMs) { // Don't extend the note if it's too short. - trace('Not extending note.'); + trace('Not extending note. ${column}'); currentLiveInputPlaceNoteData[column] = null; gridPlayheadGhostHoldNotes[column].noteData = null; } else { // Extend the note to the playhead position. - trace('Extending note.'); + trace('Extending note. ${column}'); this.playSound(Paths.sound('chartingSounds/stretchSNAP_UI')); performCommand(new ExtendNoteLengthCommand(currentLiveInputPlaceNoteData[column], newNoteLength)); currentLiveInputPlaceNoteData[column] = null; diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorGamepadHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorGamepadHandler.hx index 896e2df68..70383d3fd 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorGamepadHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorGamepadHandler.hx @@ -1,133 +1,193 @@ package funkin.ui.debug.charting.handlers; +import haxe.ui.focus.FocusManager; +import flixel.input.gamepad.FlxGamepad; +import haxe.ui.actions.ActionManager; +import haxe.ui.actions.IActionInputSource; +import haxe.ui.actions.ActionType; + /** * Yes, we're that crazy. Gamepad support for the chart editor. */ -@:nullSafety +// @:nullSafety + @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorGamepadHandler { public static function handleGamepadControls(chartEditorState:ChartEditorState) { - if (FlxG.gamepads.firstActive == null) return; + if (FlxG.gamepads.firstActive != null) handleGamepad(chartEditorState, FlxG.gamepads.firstActive); + } - if (FlxG.gamepads.firstActive.justPressed.A) + /** + * Handle context-generic binds for the gamepad. + * @param chartEditorState The chart editor state. + * @param gamepad The gamepad to handle. + */ + static function handleGamepad(chartEditorState:ChartEditorState, gamepad:FlxGamepad):Void + { + if (chartEditorState.isHaxeUIFocused) { - // trace('Gamepad: A pressed'); + ChartEditorGamepadActionInputSource.instance.handleGamepad(gamepad); } - if (FlxG.gamepads.firstActive.justPressed.B) + else { - // trace('Gamepad: B pressed'); - } - if (FlxG.gamepads.firstActive.justPressed.X) - { - // trace('Gamepad: X pressed'); - } - if (FlxG.gamepads.firstActive.justPressed.Y) - { - // trace('Gamepad: Y pressed'); + handleGamepadLiveInputs(chartEditorState, gamepad); + + if (gamepad.justPressed.RIGHT_SHOULDER) + { + trace('Gamepad: Right shoulder pressed, toggling audio playback.'); + chartEditorState.toggleAudioPlayback(); + } + + if (gamepad.justPressed.START) + { + var minimal = gamepad.pressed.LEFT_SHOULDER; + chartEditorState.hideAllToolboxes(); + trace('Gamepad: Start pressed, opening playtest (minimal: ${minimal})'); + chartEditorState.testSongInPlayState(minimal); + } + + if (gamepad.justPressed.BACK && !gamepad.pressed.LEFT_SHOULDER) + { + trace('Gamepad: Back pressed, focusing on HaxeUI menu.'); + // FocusManager.instance.focus = chartEditorState.menubarMenuFile; + } + else if (gamepad.justPressed.BACK && gamepad.pressed.LEFT_SHOULDER) + { + trace('Gamepad: Back pressed, unfocusing on HaxeUI menu.'); + FocusManager.instance.focus = null; + } } - if (FlxG.gamepads.firstActive.justPressed.LEFT_SHOULDER) + if (gamepad.justPressed.GUIDE) { - // trace('Gamepad: LEFT_SHOULDER pressed'); - } - if (FlxG.gamepads.firstActive.justPressed.RIGHT_SHOULDER) - { - // trace('Gamepad: RIGHT_SHOULDER pressed'); + trace('Gamepad: Guide pressed, quitting chart editor.'); + chartEditorState.quitChartEditor(); } + } - if (FlxG.gamepads.firstActive.justPressed.LEFT_STICK_CLICK) + static function handleGamepadLiveInputs(chartEditorState:ChartEditorState, gamepad:FlxGamepad):Void + { + // Place notes at the playhead with the gamepad. + // Disable when we are interacting with HaxeUI. + if (!(chartEditorState.isHaxeUIFocused || chartEditorState.isHaxeUIDialogOpen)) { - // trace('Gamepad: LEFT_STICK_CLICK pressed'); - } - if (FlxG.gamepads.firstActive.justPressed.RIGHT_STICK_CLICK) - { - // trace('Gamepad: RIGHT_STICK_CLICK pressed'); - } + if (gamepad.justPressed.DPAD_LEFT) chartEditorState.placeNoteAtPlayhead(4); + if (gamepad.justReleased.DPAD_LEFT) chartEditorState.finishPlaceNoteAtPlayhead(4); + if (gamepad.justPressed.DPAD_DOWN) chartEditorState.placeNoteAtPlayhead(5); + if (gamepad.justReleased.DPAD_DOWN) chartEditorState.finishPlaceNoteAtPlayhead(5); + if (gamepad.justPressed.DPAD_UP) chartEditorState.placeNoteAtPlayhead(6); + if (gamepad.justReleased.DPAD_UP) chartEditorState.finishPlaceNoteAtPlayhead(6); + if (gamepad.justPressed.DPAD_RIGHT) chartEditorState.placeNoteAtPlayhead(7); + if (gamepad.justReleased.DPAD_RIGHT) chartEditorState.finishPlaceNoteAtPlayhead(7); - if (FlxG.gamepads.firstActive.justPressed.LEFT_TRIGGER) - { - // trace('Gamepad: LEFT_TRIGGER pressed'); - } - if (FlxG.gamepads.firstActive.justPressed.RIGHT_TRIGGER) - { - // trace('Gamepad: RIGHT_TRIGGER pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.START) - { - // trace('Gamepad: START pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.BACK) - { - // trace('Gamepad: BACK pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.GUIDE) - { - // trace('Gamepad: GUIDE pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.DPAD_UP) - { - // trace('Gamepad: DPAD_UP pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.DPAD_DOWN) - { - // trace('Gamepad: DPAD_DOWN pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.DPAD_LEFT) - { - // trace('Gamepad: DPAD_LEFT pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.DPAD_RIGHT) - { - // trace('Gamepad: DPAD_RIGHT pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.LEFT_STICK_DIGITAL_UP) - { - // trace('Gamepad: LEFT_STICK_DIGITAL_UP pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.LEFT_STICK_DIGITAL_DOWN) - { - // trace('Gamepad: LEFT_STICK_DIGITAL_DOWN pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.LEFT_STICK_DIGITAL_LEFT) - { - // trace('Gamepad: LEFT_STICK_DIGITAL_LEFT pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.LEFT_STICK_DIGITAL_RIGHT) - { - // trace('Gamepad: LEFT_STICK_DIGITAL_RIGHT pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.RIGHT_STICK_DIGITAL_UP) - { - // trace('Gamepad: RIGHT_STICK_DIGITAL_UP pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.RIGHT_STICK_DIGITAL_DOWN) - { - // trace('Gamepad: RIGHT_STICK_DIGITAL_DOWN pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.RIGHT_STICK_DIGITAL_LEFT) - { - // trace('Gamepad: RIGHT_STICK_DIGITAL_LEFT pressed'); - } - - if (FlxG.gamepads.firstActive.justPressed.RIGHT_STICK_DIGITAL_RIGHT) - { - // trace('Gamepad: RIGHT_STICK_DIGITAL_RIGHT pressed'); + if (gamepad.justPressed.X) chartEditorState.placeNoteAtPlayhead(0); + if (gamepad.justReleased.X) chartEditorState.finishPlaceNoteAtPlayhead(0); + if (gamepad.justPressed.A) chartEditorState.placeNoteAtPlayhead(1); + if (gamepad.justReleased.A) chartEditorState.finishPlaceNoteAtPlayhead(1); + if (gamepad.justPressed.Y) chartEditorState.placeNoteAtPlayhead(2); + if (gamepad.justReleased.Y) chartEditorState.finishPlaceNoteAtPlayhead(2); + if (gamepad.justPressed.B) chartEditorState.placeNoteAtPlayhead(3); + if (gamepad.justReleased.B) chartEditorState.finishPlaceNoteAtPlayhead(3); + } + } +} + +class ChartEditorGamepadActionInputSource implements IActionInputSource +{ + public static var instance:ChartEditorGamepadActionInputSource = new ChartEditorGamepadActionInputSource(); + + public function new() {} + + public function start():Void {} + + /** + * Handle HaxeUI-specific binds for the gamepad. + * Only called when the HaxeUI menu is focused. + * @param chartEditorState The chart editor state. + * @param gamepad The gamepad to handle. + */ + public function handleGamepad(gamepad:FlxGamepad):Void + { + if (gamepad.justPressed.DPAD_LEFT) + { + trace('Gamepad: DPAD_LEFT pressed, moving left.'); + ActionManager.instance.actionStart(ActionType.LEFT, this); + } + else if (gamepad.justReleased.DPAD_LEFT) + { + ActionManager.instance.actionEnd(ActionType.LEFT, this); + } + + if (gamepad.justPressed.DPAD_RIGHT) + { + trace('Gamepad: DPAD_RIGHT pressed, moving right.'); + ActionManager.instance.actionStart(ActionType.RIGHT, this); + } + else if (gamepad.justReleased.DPAD_RIGHT) + { + ActionManager.instance.actionEnd(ActionType.RIGHT, this); + } + + if (gamepad.justPressed.DPAD_UP) + { + trace('Gamepad: DPAD_UP pressed, moving up.'); + ActionManager.instance.actionStart(ActionType.UP, this); + } + else if (gamepad.justReleased.DPAD_UP) + { + ActionManager.instance.actionEnd(ActionType.UP, this); + } + + if (gamepad.justPressed.DPAD_DOWN) + { + trace('Gamepad: DPAD_DOWN pressed, moving down.'); + ActionManager.instance.actionStart(ActionType.DOWN, this); + } + else if (gamepad.justReleased.DPAD_DOWN) + { + ActionManager.instance.actionEnd(ActionType.DOWN, this); + } + + if (gamepad.justPressed.A) + { + trace('Gamepad: A pressed, confirmingg.'); + ActionManager.instance.actionStart(ActionType.CONFIRM, this); + } + else if (gamepad.justReleased.A) + { + ActionManager.instance.actionEnd(ActionType.CONFIRM, this); + } + + if (gamepad.justPressed.B) + { + trace('Gamepad: B pressed, cancelling.'); + ActionManager.instance.actionStart(ActionType.CANCEL, this); + } + else if (gamepad.justReleased.B) + { + ActionManager.instance.actionEnd(ActionType.CANCEL, this); + } + + if (gamepad.justPressed.LEFT_TRIGGER) + { + trace('Gamepad: LEFT_TRIGGER pressed, moving to previous item.'); + ActionManager.instance.actionStart(ActionType.PREVIOUS, this); + } + else if (gamepad.justReleased.LEFT_TRIGGER) + { + ActionManager.instance.actionEnd(ActionType.PREVIOUS, this); + } + + if (gamepad.justPressed.RIGHT_TRIGGER) + { + trace('Gamepad: RIGHT_TRIGGER pressed, moving to next item.'); + ActionManager.instance.actionStart(ActionType.NEXT, this); + } + else if (gamepad.justReleased.RIGHT_TRIGGER) + { + ActionManager.instance.actionEnd(ActionType.NEXT, this); } } } diff --git a/source/funkin/ui/haxeui/FlxGamepadActionInputSource.hx b/source/funkin/ui/haxeui/FlxGamepadActionInputSource.hx new file mode 100644 index 000000000..9c2901d16 --- /dev/null +++ b/source/funkin/ui/haxeui/FlxGamepadActionInputSource.hx @@ -0,0 +1,53 @@ +package funkin.ui.haxeui; + +import flixel.FlxBasic; +import flixel.input.gamepad.FlxGamepad; +import haxe.ui.actions.IActionInputSource; + +/** + * Receives button presses from the Flixel gamepad and emits HaxeUI events. + */ +class FlxGamepadActionInputSource extends FlxBasic +{ + public static var instance(get, null):FlxGamepadActionInputSource; + + static function get_instance():FlxGamepadActionInputSource + { + if (instance == null) instance = new FlxGamepadActionInputSource(); + return instance; + } + + public function new() + { + super(); + } + + public function start():Void + { + FlxG.plugins.addPlugin(this); + } + + public override function update(elapsed:Float):Void + { + super.update(elapsed); + + if (FlxG.gamepads.firstActive != null) + { + updateGamepad(elapsed, FlxG.gamepads.firstActive); + } + } + + function updateGamepad(elapsed:Float, gamepad:FlxGamepad):Void + { + if (gamepad.justPressed.BACK) + { + // + } + } + + public override function destroy():Void + { + super.destroy(); + FlxG.plugins.remove(this); + } +} From 2dbc0cda6e63a56eccb81f8ad8eb63407dfbc3d7 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 13 Feb 2024 03:18:51 -0500 Subject: [PATCH 003/124] Fix a missing import. --- 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 6d2b47ef4..d0ed095cc 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -45,6 +45,7 @@ import funkin.graphics.FunkinCamera; import funkin.graphics.FunkinSprite; import funkin.input.Cursor; import funkin.input.TurboActionHandler; +import funkin.input.TurboButtonHandler; import funkin.input.TurboKeyHandler; import funkin.modding.events.ScriptEvent; import funkin.play.character.BaseCharacter.CharacterType; From 8a9a8bb179976b35ee688fcc5fcd6af116f06869 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 22 Feb 2024 01:50:55 -0500 Subject: [PATCH 004/124] abot bars in probress --- assets | 2 +- hmm.json | 9 ++++++++- source/funkin/audio/visualize/ABotVis.hx | 4 +--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/assets b/assets index c8f320e89..d9a0b3b0b 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit c8f320e89f65f9e6242354b25f04aac2c07cceeb +Subproject commit d9a0b3b0bcc5b9cac89dde01cccf0b77e9187362 diff --git a/hmm.json b/hmm.json index 26cb0d0b4..1e5bf5f18 100644 --- a/hmm.json +++ b/hmm.json @@ -45,6 +45,13 @@ "type": "haxelib", "version": "3.5.0" }, + { + "name": "funkVis", + "type": "git", + "dir": null, + "ref": "separateDSP", + "url": "https://github.com/FunkinCrew/funkVis" + }, { "name": "hamcrest", "type": "haxelib", @@ -164,4 +171,4 @@ "url": "https://github.com/FunkinCrew/thx.semver" } ] -} +} \ No newline at end of file diff --git a/source/funkin/audio/visualize/ABotVis.hx b/source/funkin/audio/visualize/ABotVis.hx index 89b004df4..16a023474 100644 --- a/source/funkin/audio/visualize/ABotVis.hx +++ b/source/funkin/audio/visualize/ABotVis.hx @@ -35,9 +35,7 @@ class ABotVis extends FlxTypedSpriteGroup viz.frames = visFrms; add(viz); - var visStr = 'VIZ'; - if (lol == 5) visStr = 'viz'; // lol makes it lowercase, accomodates for art that I dont wanna rename! - + var visStr = 'viz'; viz.animation.addByPrefix('VIZ', visStr + lol, 0); viz.animation.play('VIZ', false, false, -1); } From fa8d1186544621d6ba6b63ce90391da1a239fe67 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 22 Feb 2024 02:49:08 -0500 Subject: [PATCH 005/124] vis positioning --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index d9a0b3b0b..a681c9293 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit d9a0b3b0bcc5b9cac89dde01cccf0b77e9187362 +Subproject commit a681c9293fae71fee41aca51266c53ff30564a6f From 40a056078c627be0e78b11bbae4fd6e4cb9a896d Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 23 Feb 2024 02:03:34 -0500 Subject: [PATCH 006/124] vispos --- source/funkin/audio/visualize/ABotVis.hx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/funkin/audio/visualize/ABotVis.hx b/source/funkin/audio/visualize/ABotVis.hx index 16a023474..aa843f6e8 100644 --- a/source/funkin/audio/visualize/ABotVis.hx +++ b/source/funkin/audio/visualize/ABotVis.hx @@ -26,12 +26,17 @@ class ABotVis extends FlxTypedSpriteGroup var visFrms:FlxAtlasFrames = Paths.getSparrowAtlas('aBotViz'); + // these are the differences in X position, from left to right + var positionX:Array = [0, 59, 56, 66, 54, 52, 51]; + for (lol in 1...8) { // pushes initial value volumes.push(0.0); - var viz:FlxSprite = new FlxSprite(50 * lol, 0); + var posX:Float = positionX[lol - 1] + (positionX[lol - 2] ?? 0); + + var viz:FlxSprite = new FlxSprite(posX, 0); viz.frames = visFrms; add(viz); From b261729fa3b895bc07c6d409be0da73b83239781 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 23 Feb 2024 02:18:50 -0500 Subject: [PATCH 007/124] abot positioning --- assets | 2 +- source/funkin/audio/visualize/ABotVis.hx | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/assets b/assets index a681c9293..181e41088 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit a681c9293fae71fee41aca51266c53ff30564a6f +Subproject commit 181e410888e7808ed373e14d539048a4ae17feea diff --git a/source/funkin/audio/visualize/ABotVis.hx b/source/funkin/audio/visualize/ABotVis.hx index aa843f6e8..1bd7d0457 100644 --- a/source/funkin/audio/visualize/ABotVis.hx +++ b/source/funkin/audio/visualize/ABotVis.hx @@ -28,15 +28,17 @@ class ABotVis extends FlxTypedSpriteGroup // these are the differences in X position, from left to right var positionX:Array = [0, 59, 56, 66, 54, 52, 51]; + var positionY:Array = [0, -8, -3.5, -0.4, 0.5, 4.7, 7]; for (lol in 1...8) { // pushes initial value volumes.push(0.0); + var sum = function(num:Float, total:Float) return total += num; + var posX:Float = positionX.slice(0, lol).fold(sum, 0); + var posY:Float = positionY.slice(0, lol).fold(sum, 0); - var posX:Float = positionX[lol - 1] + (positionX[lol - 2] ?? 0); - - var viz:FlxSprite = new FlxSprite(posX, 0); + var viz:FlxSprite = new FlxSprite(posX, posY); viz.frames = visFrms; add(viz); From 6f88865e0bd827b1858e3a7dbcd3ca7b2bdd3d9f Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 23 Feb 2024 04:00:31 -0500 Subject: [PATCH 008/124] viz in progress --- Project.xml | 1 + assets | 2 +- source/funkin/audio/visualize/ABotVis.hx | 214 +++++++++++---------- source/funkin/audio/visualize/AudioClip.hx | 23 +++ source/funkin/play/PlayState.hx | 4 +- 5 files changed, 140 insertions(+), 104 deletions(-) create mode 100644 source/funkin/audio/visualize/AudioClip.hx diff --git a/Project.xml b/Project.xml index c58153575..434ae52c9 100644 --- a/Project.xml +++ b/Project.xml @@ -109,6 +109,7 @@ + diff --git a/assets b/assets index ed3eb91f4..d0dc456b4 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit ed3eb91f4b04fa0473128698e0e079a28998401e +Subproject commit d0dc456b49bd9d62c924b2f87f0205dba338705e diff --git a/source/funkin/audio/visualize/ABotVis.hx b/source/funkin/audio/visualize/ABotVis.hx index 1bd7d0457..2501ca6e6 100644 --- a/source/funkin/audio/visualize/ABotVis.hx +++ b/source/funkin/audio/visualize/ABotVis.hx @@ -8,20 +8,26 @@ import flixel.group.FlxSpriteGroup.FlxTypedSpriteGroup; import flixel.math.FlxMath; import flixel.sound.FlxSound; import funkin.util.MathUtil; +import funkVis.dsp.SpectralAnalyzer; using Lambda; class ABotVis extends FlxTypedSpriteGroup { - public var vis:VisShit; + // public var vis:VisShit; + var analyzer:SpectralAnalyzer; var volumes:Array = []; + public var snd:FlxSound; + public function new(snd:FlxSound) { super(); - vis = new VisShit(snd); + this.snd = snd; + + // vis = new VisShit(snd); // vis.snd = snd; var visFrms:FlxAtlasFrames = Paths.getSparrowAtlas('aBotViz'); @@ -48,118 +54,124 @@ class ABotVis extends FlxTypedSpriteGroup } } + public function initAnalyzer() + { + @:privateAccess + analyzer = new SpectralAnalyzer(7, new AudioClip(cast snd._channel.__source), 0.005, 30); + } + override function update(elapsed:Float) { // updateViz(); - updateFFT(elapsed); + // updateFFT(elapsed); super.update(elapsed); } - function updateFFT(elapsed:Float) + static inline function min(x:Int, y:Int):Int { - if (vis.snd != null) - { - vis.checkAndSetBuffer(); - - if (vis.setBuffer) - { - var remappedShit:Int = 0; - - if (vis.snd.playing) remappedShit = Std.int(FlxMath.remapToRange(vis.snd.time, 0, vis.snd.length, 0, vis.numSamples)); - else - remappedShit = Std.int(FlxMath.remapToRange(Conductor.instance.songPosition, 0, vis.snd.length, 0, vis.numSamples)); - - var fftSamples:Array = []; - - var swagBucks = remappedShit; - - for (i in remappedShit...remappedShit + (Std.int((44100 * (1 / 144))))) - { - var left = vis.audioData[swagBucks] / 32767; - var right = vis.audioData[swagBucks + 1] / 32767; - - var balanced = (left + right) / 2; - - swagBucks += 2; - - fftSamples.push(balanced); - } - - var freqShit = vis.funnyFFT(fftSamples); - - for (i in 0...group.members.length) - { - var getSliceShit = function(s:Int) { - var powShit = FlxMath.remapToRange(s, 0, group.members.length, 0, MathUtil.logBase(10, freqShit[0].length)); - return Math.round(Math.pow(10, powShit)); - }; - - // var powShit:Float = getSliceShit(i); - var hzSliced:Int = getSliceShit(i); - - var sliceLength:Int = Std.int(freqShit[0].length / group.members.length); - - var volSlice = freqShit[0].slice(hzSliced, getSliceShit(i + 1)); - - var avgVel:Float = 0; - - for (slice in volSlice) - { - avgVel += slice; - } - - avgVel /= volSlice.length; - - avgVel *= 10000000; - - volumes[i] += avgVel - (elapsed * (volumes[i] * 50)); - - var animFrame:Int = Std.int(volumes[i]); - - animFrame = Math.floor(Math.min(5, animFrame)); - animFrame = Math.floor(Math.max(0, animFrame)); - - animFrame = Std.int(Math.abs(animFrame - 5)); // shitty dumbass flip, cuz dave got da shit backwards lol! - - group.members[i].animation.curAnim.curFrame = animFrame; - if (FlxG.keys.justPressed.U) - { - trace(avgVel); - trace(group.members[i].animation.curAnim.curFrame); - } - } - - // group.members[0].animation.curAnim.curFrame = - } - } + return x > y ? y : x; } - public function updateViz() + override function draw() { - if (vis.snd != null) + if (analyzer == null) { - var remappedShit:Int = 0; - vis.checkAndSetBuffer(); - - if (vis.setBuffer) - { - // var startingSample:Int = Std.int(FlxMath.remapToRange) - - if (vis.snd.playing) remappedShit = Std.int(FlxMath.remapToRange(vis.snd.time, 0, vis.snd.length, 0, vis.numSamples)); - - for (i in 0...group.members.length) - { - var sampleApprox:Int = Std.int(FlxMath.remapToRange(i, 0, group.members.length, remappedShit, remappedShit + 500)); - - var left = vis.audioData[sampleApprox] / 32767; - - var animFrame:Int = Std.int(FlxMath.remapToRange(left, -1, 1, 0, 6)); - - group.members[i].animation.curAnim.curFrame = animFrame; - } - } + super.draw(); + return; } + + var levels = analyzer.getLevels(false); + + for (i in 0...min(group.members.length, levels.length)) + { + var animFrame:Int = Math.round(levels[i].value * 5); + + animFrame = Math.floor(Math.min(5, animFrame)); + animFrame = Math.floor(Math.max(0, animFrame)); + + animFrame = Std.int(Math.abs(animFrame - 5)); // shitty dumbass flip, cuz dave got da shit backwards lol! + + group.members[i].animation.curAnim.curFrame = animFrame; + } + + super.draw(); } + + // function updateFFT(elapsed:Float) + // { + // if (vis.snd != null) + // { + // vis.checkAndSetBuffer(); + // if (vis.setBuffer) + // { + // var remappedShit:Int = 0; + // if (vis.snd.playing) remappedShit = Std.int(FlxMath.remapToRange(vis.snd.time, 0, vis.snd.length, 0, vis.numSamples)); + // else + // remappedShit = Std.int(FlxMath.remapToRange(Conductor.instance.songPosition, 0, vis.snd.length, 0, vis.numSamples)); + // var fftSamples:Array = []; + // var swagBucks = remappedShit; + // for (i in remappedShit...remappedShit + (Std.int((44100 * (1 / 144))))) + // { + // var left = vis.audioData[swagBucks] / 32767; + // var right = vis.audioData[swagBucks + 1] / 32767; + // var balanced = (left + right) / 2; + // swagBucks += 2; + // fftSamples.push(balanced); + // } + // var freqShit = vis.funnyFFT(fftSamples); + // for (i in 0...group.members.length) + // { + // var getSliceShit = function(s:Int) { + // var powShit = FlxMath.remapToRange(s, 0, group.members.length, 0, MathUtil.logBase(10, freqShit[0].length)); + // return Math.round(Math.pow(10, powShit)); + // }; + // // var powShit:Float = getSliceShit(i); + // var hzSliced:Int = getSliceShit(i); + // var sliceLength:Int = Std.int(freqShit[0].length / group.members.length); + // var volSlice = freqShit[0].slice(hzSliced, getSliceShit(i + 1)); + // var avgVel:Float = 0; + // for (slice in volSlice) + // { + // avgVel += slice; + // } + // avgVel /= volSlice.length; + // avgVel *= 10000000; + // volumes[i] += avgVel - (elapsed * (volumes[i] * 50)); + // var animFrame:Int = Std.int(volumes[i]); + // animFrame = Math.floor(Math.min(5, animFrame)); + // animFrame = Math.floor(Math.max(0, animFrame)); + // animFrame = Std.int(Math.abs(animFrame - 5)); // shitty dumbass flip, cuz dave got da shit backwards lol! + // group.members[i].animation.curAnim.curFrame = animFrame; + // if (FlxG.keys.justPressed.U) + // { + // trace(avgVel); + // trace(group.members[i].animation.curAnim.curFrame); + // } + // } + // // group.members[0].animation.curAnim.curFrame = + // } + // } + // } + // public function updateViz() + // { + // if (vis.snd != null) + // { + // var remappedShit:Int = 0; + // vis.checkAndSetBuffer(); + // if (vis.setBuffer) + // { + // // var startingSample:Int = Std.int(FlxMath.remapToRange) + // if (vis.snd.playing) remappedShit = Std.int(FlxMath.remapToRange(vis.snd.time, 0, vis.snd.length, 0, vis.numSamples)); + // for (i in 0...group.members.length) + // { + // var sampleApprox:Int = Std.int(FlxMath.remapToRange(i, 0, group.members.length, remappedShit, remappedShit + 500)); + // var left = vis.audioData[sampleApprox] / 32767; + // var animFrame:Int = Std.int(FlxMath.remapToRange(left, -1, 1, 0, 6)); + // group.members[i].animation.curAnim.curFrame = animFrame; + // } + // } + // } + // } } diff --git a/source/funkin/audio/visualize/AudioClip.hx b/source/funkin/audio/visualize/AudioClip.hx new file mode 100644 index 000000000..a8e353799 --- /dev/null +++ b/source/funkin/audio/visualize/AudioClip.hx @@ -0,0 +1,23 @@ +package funkin.audio.visualize; + +import flixel.FlxG; +import flixel.math.FlxMath; +import funkVis.AudioBuffer; +import lime.media.AudioSource; + +class AudioClip implements funkVis.AudioClip +{ + public var audioBuffer(default, null):AudioBuffer; + public var currentFrame(get, never):Int; + + public function new(audioSource:AudioSource) + { + var data:lime.utils.UInt16Array = cast audioSource.buffer.data; + this.audioBuffer = new AudioBuffer(data, audioSource.buffer.sampleRate); + } + + private function get_currentFrame():Int + { + return Std.int(FlxMath.remapToRange(FlxG.sound.music.time, 0, FlxG.sound.music.length, 0, audioBuffer.data.length / 2)); + } +} diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 1dbba5b54..0112a59e8 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1741,8 +1741,6 @@ class PlayState extends MusicBeatSubState */ function startSong():Void { - dispatchEvent(new ScriptEvent(SONG_START)); - startingSong = false; if (!overrideMusic && !isGamePaused && currentChart != null) @@ -1772,6 +1770,8 @@ class PlayState extends MusicBeatSubState // FlxG.sound.music.time = startTimestamp - Conductor.instance.instrumentalOffset; handleSkippedNotes(); } + + dispatchEvent(new ScriptEvent(SONG_START)); } /** From be348d0f13ad36c15d4cfc5fb881b02eceba261a Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 1 Mar 2024 00:15:51 -0500 Subject: [PATCH 009/124] moved vis code --- source/funkin/audio/visualize/ABotVis.hx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/funkin/audio/visualize/ABotVis.hx b/source/funkin/audio/visualize/ABotVis.hx index 2501ca6e6..13c7eb501 100644 --- a/source/funkin/audio/visualize/ABotVis.hx +++ b/source/funkin/audio/visualize/ABotVis.hx @@ -50,7 +50,7 @@ class ABotVis extends FlxTypedSpriteGroup var visStr = 'viz'; viz.animation.addByPrefix('VIZ', visStr + lol, 0); - viz.animation.play('VIZ', false, false, -1); + viz.animation.play('VIZ', false, false, 2); } } @@ -82,6 +82,16 @@ class ABotVis extends FlxTypedSpriteGroup return; } + // drawFFT(); + + super.draw(); + } + + /** + * TJW funkVis based visualizer! updateFFT() is the old nasty shit that dont worky! + */ + function drawFFT():Void + { var levels = analyzer.getLevels(false); for (i in 0...min(group.members.length, levels.length)) @@ -95,8 +105,6 @@ class ABotVis extends FlxTypedSpriteGroup group.members[i].animation.curAnim.curFrame = animFrame; } - - super.draw(); } // function updateFFT(elapsed:Float) From d6608fe435e8239925b69286cc01082b28b30fad Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 7 Mar 2024 14:19:26 -0500 Subject: [PATCH 010/124] a-bot in progress --- hmm.json | 38 ++++++++++++------------ source/funkin/audio/visualize/ABotVis.hx | 16 +++++----- source/funkin/play/PlayState.hx | 2 +- source/funkin/util/logging/AnsiTrace.hx | 7 ++++- 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/hmm.json b/hmm.json index b25aae806..021d22070 100644 --- a/hmm.json +++ b/hmm.json @@ -4,21 +4,21 @@ "name": "discord_rpc", "type": "git", "dir": null, - "ref": "2d83fa863ef0c1eace5f1cf67c3ac315d1a3a8a5", + "ref": "2d83fa8", "url": "https://github.com/Aidan63/linc_discord-rpc" }, { "name": "flixel", "type": "git", "dir": null, - "ref": "4d054bd10b05bb1309a0ba3427ffa5378e0b4b99", + "ref": "4d054bd1", "url": "https://github.com/FunkinCrew/flixel" }, { "name": "flixel-addons", "type": "git", "dir": null, - "ref": "a523c3b56622f0640933944171efed46929e360e", + "ref": "a523c3b", "url": "https://github.com/FunkinCrew/flixel-addons" }, { @@ -30,14 +30,14 @@ "name": "flixel-ui", "type": "git", "dir": null, - "ref": "719b4f10d94186ed55f6fef1b6618d32abec8c15", + "ref": "719b4f1", "url": "https://github.com/HaxeFlixel/flixel-ui" }, { "name": "flxanimate", "type": "git", "dir": null, - "ref": "9bacdd6ea39f5e3a33b0f5dfb7bc583fe76060d4", + "ref": "9bacdd6", "url": "https://github.com/FunkinCrew/flxanimate" }, { @@ -49,7 +49,7 @@ "name": "funkVis", "type": "git", "dir": null, - "ref": "separateDSP", + "ref": "7ed1f8fa6d8ca580f2359254482578a128be7ab8", "url": "https://github.com/FunkinCrew/funkVis" }, { @@ -61,14 +61,14 @@ "name": "haxeui-core", "type": "git", "dir": null, - "ref": "0212d8fdfcafeb5f0d5a41e1ddba8ff21d0e183b", + "ref": "0212d8fd", "url": "https://github.com/haxeui/haxeui-core" }, { "name": "haxeui-flixel", "type": "git", "dir": null, - "ref": "63a906a6148958dbfde8c7b48d90b0693767fd95", + "ref": "63a906a", "url": "https://github.com/haxeui/haxeui-flixel" }, { @@ -80,7 +80,7 @@ "name": "hxCodec", "type": "git", "dir": null, - "ref": "387e1665d6feb5762358134f168e6ebfe46acec8", + "ref": "387e166", "url": "https://github.com/FunkinCrew/hxCodec" }, { @@ -92,7 +92,7 @@ "name": "hxcpp-debug-server", "type": "git", "dir": "hxcpp-debug-server", - "ref": "147294123f983e35f50a966741474438069a7a8f", + "ref": "1472941", "url": "https://github.com/FunkinCrew/hxcpp-debugger" }, { @@ -104,56 +104,56 @@ "name": "json2object", "type": "git", "dir": null, - "ref": "a8c26f18463c98da32f744c214fe02273e1823fa", + "ref": "a8c26f1", "url": "https://github.com/FunkinCrew/json2object" }, { "name": "lime", "type": "git", "dir": null, - "ref": "1359fe6ad52e91175dc636a516d460bd54ea22ed", + "ref": "1359fe6a", "url": "https://github.com/FunkinCrew/lime" }, { "name": "mconsole", "type": "git", "dir": null, - "ref": "master", + "ref": "06c0499", "url": "https://github.com/massive-oss/mconsole" }, { "name": "mcover", "type": "git", "dir": "src", - "ref": "master", + "ref": "c3c47cd", "url": "https://github.com/massive-oss/mcover" }, { "name": "mockatoo", "type": "git", "dir": "src", - "ref": "master", + "ref": "13d77a0", "url": "https://github.com/FunkinCrew/mockatoo" }, { "name": "munit", "type": "git", "dir": "src", - "ref": "master", + "ref": "f61be7f", "url": "https://github.com/FunkinCrew/MassiveUnit" }, { "name": "openfl", "type": "git", "dir": null, - "ref": "f229d76361c7e31025a048fe7909847f75bb5d5e", + "ref": "f229d763", "url": "https://github.com/FunkinCrew/openfl" }, { "name": "polymod", "type": "git", "dir": null, - "ref": "d5a3b8995f64d20b95f844454e8c3b38c3d3a9fa", + "ref": "d5a3b89", "url": "https://github.com/larsiusprime/polymod" }, { @@ -171,4 +171,4 @@ "url": "https://github.com/FunkinCrew/thx.semver" } ] -} \ No newline at end of file +} diff --git a/source/funkin/audio/visualize/ABotVis.hx b/source/funkin/audio/visualize/ABotVis.hx index 13c7eb501..05131b795 100644 --- a/source/funkin/audio/visualize/ABotVis.hx +++ b/source/funkin/audio/visualize/ABotVis.hx @@ -57,15 +57,21 @@ class ABotVis extends FlxTypedSpriteGroup public function initAnalyzer() { @:privateAccess - analyzer = new SpectralAnalyzer(7, new AudioClip(cast snd._channel.__source), 0.005, 30); + analyzer = new SpectralAnalyzer(7, new AudioClip(cast snd._channel.__source), 0.06, 30); + analyzer.fftN = 2048; } + var visTimer:Float = -1; + var visTimeMax:Float = 1 / 30; + override function update(elapsed:Float) { // updateViz(); // updateFFT(elapsed); + if (analyzer != null) drawFFT(); + super.update(elapsed); } @@ -76,14 +82,6 @@ class ABotVis extends FlxTypedSpriteGroup override function draw() { - if (analyzer == null) - { - super.draw(); - return; - } - - // drawFFT(); - super.draw(); } diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 341f1d1b6..3c42834a5 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1784,7 +1784,7 @@ class PlayState extends MusicBeatSubState // I am going insane. FlxG.sound.music.volume = 1.0; - FlxG.sound.music.fadeTween.cancel(); + FlxG.sound.music.fadeTween?.cancel(); trace('Playing vocals...'); add(vocals); diff --git a/source/funkin/util/logging/AnsiTrace.hx b/source/funkin/util/logging/AnsiTrace.hx index c8d27b86f..9fdc19e1b 100644 --- a/source/funkin/util/logging/AnsiTrace.hx +++ b/source/funkin/util/logging/AnsiTrace.hx @@ -52,7 +52,12 @@ class AnsiTrace public static function traceBF() { #if sys - if (colorSupported) Sys.println(ansiBF.join("\n")); + if (colorSupported) + { + for (line in ansiBF) + Sys.stdout().writeString(line + "\n"); + Sys.stdout().flush(); + } #end } From 31ba13630269268b6cf5b6f8c6d5b21194ecf6b9 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 8 Mar 2024 20:52:30 -0500 Subject: [PATCH 011/124] Update assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index f550436bf..c8c395450 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit f550436bfed37f2e6efb1b97edd66a5c840bd262 +Subproject commit c8c395450b0cd899224bd4fbfd940ed2b376de44 From 4eea9b76e7393601b857168631bdb1eb5960a0ae Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 19 Mar 2024 13:04:58 -0700 Subject: [PATCH 012/124] idk assets revert this if I busted shit here lol --- hmm.json | 2 +- source/funkin/audio/visualize/ABotVis.hx | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hmm.json b/hmm.json index 3e5c07c29..04c09e50f 100644 --- a/hmm.json +++ b/hmm.json @@ -49,7 +49,7 @@ "name": "funkVis", "type": "git", "dir": null, - "ref": "7ed1f8fa6d8ca580f2359254482578a128be7ab8", + "ref": "0ac2fffa67fd30563df97c66718551efa92d283e", "url": "https://github.com/FunkinCrew/funkVis" }, { diff --git a/source/funkin/audio/visualize/ABotVis.hx b/source/funkin/audio/visualize/ABotVis.hx index 05131b795..a8b6fb937 100644 --- a/source/funkin/audio/visualize/ABotVis.hx +++ b/source/funkin/audio/visualize/ABotVis.hx @@ -57,8 +57,9 @@ class ABotVis extends FlxTypedSpriteGroup public function initAnalyzer() { @:privateAccess - analyzer = new SpectralAnalyzer(7, new AudioClip(cast snd._channel.__source), 0.06, 30); - analyzer.fftN = 2048; + analyzer = new SpectralAnalyzer(7, new AudioClip(cast snd._channel.__source), 0.01, 30); + analyzer.maxDb = -35; + // analyzer.fftN = 2048; } var visTimer:Float = -1; @@ -70,8 +71,7 @@ class ABotVis extends FlxTypedSpriteGroup // updateFFT(elapsed); - if (analyzer != null) drawFFT(); - + // super.update(elapsed); } @@ -82,6 +82,8 @@ class ABotVis extends FlxTypedSpriteGroup override function draw() { + if (analyzer != null) drawFFT(); + super.draw(); } From e64637ffdfd17436621a0a84e53a4283e9534326 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 22 Mar 2024 19:51:47 -0400 Subject: [PATCH 013/124] Rework Conductor to use instanced signals --- source/funkin/Conductor.hx | 158 ++++++++++++++++++++++++-------- source/funkin/play/song/Song.hx | 10 +- source/funkin/util/Constants.hx | 5 + 3 files changed, 132 insertions(+), 41 deletions(-) diff --git a/source/funkin/Conductor.hx b/source/funkin/Conductor.hx index 05c23108f..25694b973 100644 --- a/source/funkin/Conductor.hx +++ b/source/funkin/Conductor.hx @@ -36,23 +36,43 @@ class Conductor * You can also do stuff like store a reference to the Conductor and pass it around or temporarily replace it, * or have a second Conductor running at the same time, or other weird stuff like that if you need to. */ - public static var instance:Conductor = new Conductor(); + public static var instance(get, set):Conductor; + + static var _instance:Null = null; /** - * Signal fired when the current Conductor instance advances to a new measure. + * Signal fired when the current static Conductor instance advances to a new measure. */ public static var measureHit(default, null):FlxSignal = new FlxSignal(); + /** + * Signal fired when THIS Conductor instance advances to a new measure. + * TODO: This naming sucks but we can't make a static and instance field with the same name! + */ + public var onMeasureHit(default, null):FlxSignal = new FlxSignal(); + /** * Signal fired when the current Conductor instance advances to a new beat. */ public static var beatHit(default, null):FlxSignal = new FlxSignal(); + /** + * Signal fired when THIS Conductor instance advances to a new beat. + * TODO: This naming sucks but we can't make a static and instance field with the same name! + */ + public var onBeatHit(default, null):FlxSignal = new FlxSignal(); + /** * Signal fired when the current Conductor instance advances to a new step. */ public static var stepHit(default, null):FlxSignal = new FlxSignal(); + /** + * Signal fired when THIS Conductor instance advances to a new step. + * TODO: This naming sucks but we can't make a static and instance field with the same name! + */ + public var onStepHit(default, null):FlxSignal = new FlxSignal(); + /** * The list of time changes in the song. * There should be at least one time change (at the beginning of the song) to define the BPM. @@ -234,6 +254,81 @@ class Conductor return Std.int(timeSignatureNumerator / timeSignatureDenominator * Constants.STEPS_PER_BEAT * Constants.STEPS_PER_BEAT); } + /** + * Reset the Conductor, replacing the current instance with a fresh one. + */ + public static function reset():Void + { + set_instance(new Conductor()); + } + + /** + * Add values of the current main Conductor instance to the `FlxG.watch`. + */ + public static function watchQuick():Void + { + FlxG.watch.addQuick("songPosition", Conductor.instance.songPosition); + FlxG.watch.addQuick("bpm", Conductor.instance.bpm); + FlxG.watch.addQuick("currentMeasureTime", Conductor.instance.currentMeasureTime); + FlxG.watch.addQuick("currentBeatTime", Conductor.instance.currentBeatTime); + FlxG.watch.addQuick("currentStepTime", Conductor.instance.currentStepTime); + } + + static function dispatchMeasureHit():Void + { + Conductor.measureHit.dispatch(); + } + + static function dispatchBeatHit():Void + { + Conductor.beatHit.dispatch(); + } + + static function dispatchStepHit():Void + { + Conductor.stepHit.dispatch(); + } + + static function setupSingleton(input:Conductor):Void + { + input.onMeasureHit.add(dispatchMeasureHit); + + input.onBeatHit.add(dispatchBeatHit); + + input.onStepHit.add(dispatchStepHit); + } + + static function clearSingleton(input:Conductor):Void + { + input.onMeasureHit.remove(dispatchMeasureHit); + + input.onBeatHit.remove(dispatchBeatHit); + + input.onStepHit.remove(dispatchStepHit); + } + + static function get_instance():Conductor + { + if (Conductor._instance == null) set_instance(new Conductor()); + if (Conductor._instance == null) throw "Could not initialize singleton Conductor!"; + return Conductor._instance; + } + + static function set_instance(instance:Conductor):Conductor + { + // Use _instance in here to avoid recursion + if (Conductor._instance != null) clearSingleton(Conductor._instance); + + Conductor._instance = instance; + + if (Conductor._instance != null) setupSingleton(Conductor._instance); + + return Conductor._instance; + } + + /** + * The constructor. + */ public function new() {} /** @@ -244,6 +339,7 @@ class Conductor * * WARNING: Avoid this for things like setting the BPM of the title screen music, * you should have a metadata file for it instead. + * We should probably deprecate this in the future. */ public function forceBPM(?bpm:Float = null) { @@ -264,7 +360,7 @@ class Conductor * BPM, current step, etc. will be re-calculated based on the song position. * * @param songPosition The current position in the song in milliseconds. - * Leave blank to use the FlxG.sound.music position. + * Leave blank to use the `FlxG.sound.music` position. */ public function update(?songPos:Float) { @@ -317,27 +413,27 @@ class Conductor this.currentMeasure = Math.floor(currentMeasureTime); } - // Only fire the signal if we are THE Conductor. - if (this == Conductor.instance) + // FlxSignals are really cool. + if (currentStep != oldStep) { - // FlxSignals are really cool. - if (currentStep != oldStep) - { - Conductor.stepHit.dispatch(); - } + this.onStepHit.dispatch(); + } - if (currentBeat != oldBeat) - { - Conductor.beatHit.dispatch(); - } + if (currentBeat != oldBeat) + { + this.onBeatHit.dispatch(); + } - if (currentMeasure != oldMeasure) - { - Conductor.measureHit.dispatch(); - } + if (currentMeasure != oldMeasure) + { + this.onMeasureHit.dispatch(); } } + /** + * Apply the time changes from a SongMetadata file. + * @param songTimeChanges The time changes to apply. + */ public function mapTimeChanges(songTimeChanges:Array) { timeChanges = []; @@ -383,7 +479,8 @@ class Conductor } /** - * Given a time in milliseconds, return a time in steps. + * @param ms A timestamp in milliseconds. + * @return The corresponding time in steps. */ public function getTimeInSteps(ms:Float):Float { @@ -420,7 +517,8 @@ class Conductor } /** - * Given a time in steps and fractional steps, return a time in milliseconds. + * @param stepTime A timestamp in steps. + * @return The corresponding time in milliseconds. */ public function getStepTimeInMs(stepTime:Float):Float { @@ -456,7 +554,8 @@ class Conductor } /** - * Given a time in beats and fractional beats, return a time in milliseconds. + * @param beatTime A timestamp in fractional beats. + * @return The corresponding time in milliseconds. */ public function getBeatTimeInMs(beatTime:Float):Float { @@ -490,21 +589,4 @@ class Conductor return resultMs; } } - - public static function watchQuick():Void - { - FlxG.watch.addQuick("songPosition", Conductor.instance.songPosition); - FlxG.watch.addQuick("bpm", Conductor.instance.bpm); - FlxG.watch.addQuick("currentMeasureTime", Conductor.instance.currentMeasureTime); - FlxG.watch.addQuick("currentBeatTime", Conductor.instance.currentBeatTime); - FlxG.watch.addQuick("currentStepTime", Conductor.instance.currentStepTime); - } - - /** - * Reset the Conductor, replacing the current instance with a fresh one. - */ - public static function reset():Void - { - Conductor.instance = new Conductor(); - } } diff --git a/source/funkin/play/song/Song.hx b/source/funkin/play/song/Song.hx index 567c388c7..0d325876c 100644 --- a/source/funkin/play/song/Song.hx +++ b/source/funkin/play/song/Song.hx @@ -374,12 +374,16 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry):Null { - if (variations == null) possibleVariations = variations; + if (possibleVariations == null) + { + possibleVariations = variations; + possibleVariations.sort(SortUtil.defaultsThenAlphabetically.bind(Constants.DEFAULT_VARIATION_LIST)); + } if (diffId == null) diffId = listDifficulties(null, possibleVariations)[0]; - for (variation in variations) + for (variationId in possibleVariations) { - if (difficulties.exists('$diffId-$variation')) return variation; + if (difficulties.exists('$diffId-$variationId')) return variationId; } return null; diff --git a/source/funkin/util/Constants.hx b/source/funkin/util/Constants.hx index c9b99ed46..af3ae15b0 100644 --- a/source/funkin/util/Constants.hx +++ b/source/funkin/util/Constants.hx @@ -157,6 +157,11 @@ class Constants */ public static final DEFAULT_VARIATION:String = 'default'; + /** + * Standardized variations for charts + */ + public static final DEFAULT_VARIATION_LIST:Array = ['default', 'erect', 'pico']; + /** * The default intensity for camera zooms. */ From 77cf96716ef4ef3394c2b8fb58d0182a4b8049ef Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 27 Mar 2024 02:55:53 -0400 Subject: [PATCH 014/124] Work in progress on Conductor signal rework --- assets | 2 +- source/funkin/Conductor.hx | 20 -------------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/assets b/assets index 8013845e3..82b8d637f 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 8013845e331015b40c4cc35230f6d02bd2148d52 +Subproject commit 82b8d637fb402a4c69001fd3c4fb435b56a1b4f1 diff --git a/source/funkin/Conductor.hx b/source/funkin/Conductor.hx index 3c6d2951f..104682ffd 100644 --- a/source/funkin/Conductor.hx +++ b/source/funkin/Conductor.hx @@ -267,18 +267,6 @@ class Conductor set_instance(new Conductor()); } - /** - * Add values of the current main Conductor instance to the `FlxG.watch`. - */ - public static function watchQuick():Void - { - FlxG.watch.addQuick("songPosition", Conductor.instance.songPosition); - FlxG.watch.addQuick("bpm", Conductor.instance.bpm); - FlxG.watch.addQuick("currentMeasureTime", Conductor.instance.currentMeasureTime); - FlxG.watch.addQuick("currentBeatTime", Conductor.instance.currentBeatTime); - FlxG.watch.addQuick("currentStepTime", Conductor.instance.currentStepTime); - } - static function dispatchMeasureHit():Void { Conductor.measureHit.dispatch(); @@ -611,12 +599,4 @@ class Conductor FlxG.watch.addQuick('currentBeatTime', target.currentBeatTime); FlxG.watch.addQuick('currentStepTime', target.currentStepTime); } - - /** - * Reset the Conductor, replacing the current instance with a fresh one. - */ - public static function reset():Void - { - _instance = new Conductor(); - } } From 77b65ba68c2279b2868cd91cd80fb78342fe33aa Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 27 Mar 2024 21:32:13 -0400 Subject: [PATCH 015/124] shader var renames for hashlink --- Project.xml | 2 +- assets | 2 +- source/funkin/graphics/shaders/GaussianBlurShader.hx | 2 +- source/funkin/graphics/shaders/Grayscale.hx | 2 +- source/funkin/graphics/shaders/HSVShader.hx | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Project.xml b/Project.xml index ffc8382a4..ab709db17 100644 --- a/Project.xml +++ b/Project.xml @@ -111,7 +111,7 @@ - + diff --git a/assets b/assets index 8013845e3..47a2869c7 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 8013845e331015b40c4cc35230f6d02bd2148d52 +Subproject commit 47a2869c7fdcd342b15ceaa676710a7239615c01 diff --git a/source/funkin/graphics/shaders/GaussianBlurShader.hx b/source/funkin/graphics/shaders/GaussianBlurShader.hx index 81167655b..cecfdab80 100644 --- a/source/funkin/graphics/shaders/GaussianBlurShader.hx +++ b/source/funkin/graphics/shaders/GaussianBlurShader.hx @@ -20,6 +20,6 @@ class GaussianBlurShader extends FlxRuntimeShader public function setAmount(value:Float):Void { this.amount = value; - this.setFloat("amount", amount); + this.setFloat("_amount", amount); } } diff --git a/source/funkin/graphics/shaders/Grayscale.hx b/source/funkin/graphics/shaders/Grayscale.hx index 6673ace24..fbd0970e5 100644 --- a/source/funkin/graphics/shaders/Grayscale.hx +++ b/source/funkin/graphics/shaders/Grayscale.hx @@ -17,6 +17,6 @@ class Grayscale extends FlxRuntimeShader public function setAmount(value:Float):Void { amount = value; - this.setFloat("amount", amount); + this.setFloat("_amount", amount); } } diff --git a/source/funkin/graphics/shaders/HSVShader.hx b/source/funkin/graphics/shaders/HSVShader.hx index 733bbca7f..2dfdac2c9 100644 --- a/source/funkin/graphics/shaders/HSVShader.hx +++ b/source/funkin/graphics/shaders/HSVShader.hx @@ -20,7 +20,7 @@ class HSVShader extends FlxRuntimeShader function set_hue(value:Float):Float { - this.setFloat('hue', value); + this.setFloat('_hue', value); this.hue = value; return this.hue; From ef2cb4d9fcce1be15de1a139adf9fdd6ead90e63 Mon Sep 17 00:00:00 2001 From: Jenny Crowe Date: Thu, 28 Mar 2024 11:05:38 -0700 Subject: [PATCH 016/124] Convert zoom modifiers from additive to multiplicative --- source/funkin/play/PlayState.hx | 94 +++++++++---------- source/funkin/play/cutscene/VideoCutscene.hx | 2 +- .../funkin/play/event/FocusCameraSongEvent.hx | 4 + .../play/event/SetCameraBopSongEvent.hx | 4 +- .../funkin/play/event/ZoomCameraSongEvent.hx | 6 +- source/funkin/util/Constants.hx | 5 +- 6 files changed, 59 insertions(+), 56 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 169809a63..5b0837dcf 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -245,20 +245,26 @@ class PlayState extends MusicBeatSubState /** * The current camera zoom level without any modifiers applied. */ - public var currentCameraZoom:Float = FlxCamera.defaultZoom * 1.05; + public var currentCameraZoom:Float = FlxCamera.defaultZoom; /** - * currentCameraZoom is increased every beat, and lerped back to this value every frame, creating a smooth 'zoom-in' effect. - * Defaults to 1.05, but may be larger or smaller depending on the current stage. - * Tweened via the `ZoomCamera` song event in direct mode. + * Multiplier for currentCameraZoom for camera bops. + * Lerped back to 1.0x every frame. */ - public var defaultCameraZoom:Float = FlxCamera.defaultZoom * 1.05; + public var cameraBopMultiplier:Float = 1.0; /** - * Camera zoom applied on top of currentCameraZoom. - * Tweened via the `ZoomCamera` song event in additive mode. + * Default camera zoom for the current stage. + * If we aren't in a stage, just use the default zoom (1.05x). */ - public var additiveCameraZoom:Float = 0; + public var stageZoom(get, never):Float; + + function get_stageZoom():Float + { + if (currentStage != null) return currentStage.camZoom; + else + return FlxCamera.defaultZoom * 1.05; + } /** * The current HUD camera zoom level. @@ -268,16 +274,18 @@ class PlayState extends MusicBeatSubState public var defaultHUDCameraZoom:Float = FlxCamera.defaultZoom * 1.0; /** - * Intensity of the gameplay camera zoom. - * @default `1.5%` + * Camera bop intensity multiplier. + * Applied to cameraBopMultiplier on camera bops (usually every beat). + * @default `101.5%` */ - public var cameraZoomIntensity:Float = Constants.DEFAULT_ZOOM_INTENSITY; + public var cameraBopIntensity:Float = Constants.DEFAULT_BOP_INTENSITY; /** * Intensity of the HUD camera zoom. + * Need to make this a multiplier later. Just shoving in 0.015 for now so it doesn't break. * @default `3.0%` */ - public var hudCameraZoomIntensity:Float = Constants.DEFAULT_ZOOM_INTENSITY * 2.0; + public var hudCameraZoomIntensity:Float = 0.015 * 2.0; /** * How many beats (quarter notes) between camera zooms. @@ -857,8 +865,8 @@ class PlayState extends MusicBeatSubState regenNoteData(); // Reset camera zooming - cameraZoomIntensity = Constants.DEFAULT_ZOOM_INTENSITY; - hudCameraZoomIntensity = Constants.DEFAULT_ZOOM_INTENSITY * 2.0; + cameraBopIntensity = Constants.DEFAULT_BOP_INTENSITY; + hudCameraZoomIntensity = 0.015 * 2.0; cameraZoomRate = Constants.DEFAULT_ZOOM_RATE; health = Constants.HEALTH_STARTING; @@ -953,11 +961,12 @@ class PlayState extends MusicBeatSubState if (health > Constants.HEALTH_MAX) health = Constants.HEALTH_MAX; if (health < Constants.HEALTH_MIN) health = Constants.HEALTH_MIN; - // Lerp the camera zoom towards the target level. + // Apply camera zoom + multipliers. if (subState == null) { - currentCameraZoom = FlxMath.lerp(defaultCameraZoom, currentCameraZoom, 0.95); - FlxG.camera.zoom = currentCameraZoom + additiveCameraZoom; + cameraBopMultiplier = FlxMath.lerp(1.0, cameraBopMultiplier, 0.95); // Lerp bop multiplier back to 1.0x + var zoomPlusBop = currentCameraZoom * cameraBopMultiplier; // Apply camera bop multiplier. + FlxG.camera.zoom = zoomPlusBop; // Actually apply the zoom to the camera. camHUD.zoom = FlxMath.lerp(defaultHUDCameraZoom, camHUD.zoom, 0.95); } @@ -1363,15 +1372,15 @@ class PlayState extends MusicBeatSubState // activeNotes.sort(SortUtil.byStrumtime, FlxSort.DESCENDING); } - // Only zoom camera if we are zoomed by less than 35%. + // Only bop camera if zoom level is below 135% if (Preferences.zoomCamera - && FlxG.camera.zoom < (1.35 * defaultCameraZoom) + && FlxG.camera.zoom < (1.35 * FlxCamera.defaultZoom) && cameraZoomRate > 0 && Conductor.instance.currentBeat % cameraZoomRate == 0) { - // Zoom camera in (1.5%) - currentCameraZoom += cameraZoomIntensity * defaultCameraZoom; - // Hud zooms double (3%) + // Set zoom multiplier for camera bop. + cameraBopMultiplier = cameraBopIntensity; + // HUD camera zoom still uses old system. To change. (+3%) camHUD.zoom += hudCameraZoomIntensity * defaultHUDCameraZoom; } // trace('Not bopping camera: ${FlxG.camera.zoom} < ${(1.35 * defaultCameraZoom)} && ${cameraZoomRate} > 0 && ${Conductor.instance.currentBeat} % ${cameraZoomRate} == ${Conductor.instance.currentBeat % cameraZoomRate}}'); @@ -1562,12 +1571,11 @@ class PlayState extends MusicBeatSubState { if (PlayState.instance.isMinimalMode) return; // Apply camera zoom level from stage data. - defaultCameraZoom = currentStage.camZoom; - currentCameraZoom = defaultCameraZoom; + currentCameraZoom = stageZoom; FlxG.camera.zoom = currentCameraZoom; - // Reset additive zoom. - additiveCameraZoom = 0; + // Reset bop multiplier. + cameraBopMultiplier = 1.0; } /** @@ -3141,38 +3149,24 @@ class PlayState extends MusicBeatSubState /** * Tweens the camera zoom to the desired amount. */ - public function tweenCameraZoom(?zoom:Float, ?duration:Float, ?directMode:Bool, ?ease:NullFloat>):Void + public function tweenCameraZoom(?zoom:Float, ?duration:Float, ?direct:Bool, ?ease:NullFloat>):Void { // Cancel the current tween if it's active. cancelCameraZoomTween(); - var targetZoom = zoom * FlxCamera.defaultZoom; + // Direct mode: Set zoom directly. + // Stage mode: Set zoom as a multiplier of the current stage's default zoom. + var targetZoom = zoom * (direct ? FlxCamera.defaultZoom : stageZoom); - if (directMode) // Direct mode: Tween defaultCameraZoom for basic "smooth" zooms. + if (duration == 0) { - if (duration == 0) - { - // Instant zoom. No tween needed. - defaultCameraZoom = targetZoom; - } - else - { - // Zoom tween! Caching it so we can cancel/pause it later if needed. - cameraZoomTween = FlxTween.tween(this, {defaultCameraZoom: targetZoom}, duration, {ease: ease}); - } + // Instant zoom. No tween needed. + currentCameraZoom = targetZoom; } - else // Additive mode: Tween additiveCameraZoom for ease-based zooms. + else { - if (duration == 0) - { - // Instant zoom. No tween needed. - additiveCameraZoom = targetZoom; - } - else - { - // Zoom tween! Caching it so we can cancel/pause it later if needed. - cameraZoomTween = FlxTween.tween(this, {additiveCameraZoom: targetZoom}, duration, {ease: ease}); - } + // Zoom tween! Caching it so we can cancel/pause it later if needed. + cameraZoomTween = FlxTween.tween(this, {currentCameraZoom: targetZoom}, duration, {ease: ease}); } } diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 3da51185f..0c05bc876 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -311,7 +311,7 @@ class VideoCutscene blackScreen = null; } }); - FlxTween.tween(FlxG.camera, {zoom: PlayState.instance.defaultCameraZoom}, transitionTime, + FlxTween.tween(FlxG.camera, {zoom: PlayState.instance.stageZoom}, transitionTime, { ease: FlxEase.quadInOut, onComplete: function(twn:FlxTween) { diff --git a/source/funkin/play/event/FocusCameraSongEvent.hx b/source/funkin/play/event/FocusCameraSongEvent.hx index d4ab4f24f..e2db2fa79 100644 --- a/source/funkin/play/event/FocusCameraSongEvent.hx +++ b/source/funkin/play/event/FocusCameraSongEvent.hx @@ -132,6 +132,9 @@ class FocusCameraSongEvent extends SongEvent { case 'INSTANT': PlayState.instance.tweenCameraToFollowPoint(0); + case 'classic': + var classicDur = 1.0; // This is probably a fixed duration given how old zoom works. Need to sus it out. + PlayState.instance.tweenCameratoFollowPoint(classicDur); // Need to create an ease function to recreate classic follow-style movement. default: var durSeconds = Conductor.instance.stepLengthMs * duration / 1000; @@ -230,6 +233,7 @@ class FocusCameraSongEvent extends SongEvent 'Elastic In' => 'elasticIn', 'Elastic Out' => 'elasticOut', 'Elastic In/Out' => 'elasticInOut', + 'Classic' => 'classic' ] } ]); diff --git a/source/funkin/play/event/SetCameraBopSongEvent.hx b/source/funkin/play/event/SetCameraBopSongEvent.hx index a82577a5f..9d3e785ed 100644 --- a/source/funkin/play/event/SetCameraBopSongEvent.hx +++ b/source/funkin/play/event/SetCameraBopSongEvent.hx @@ -50,8 +50,8 @@ class SetCameraBopSongEvent extends SongEvent var intensity:Null = data.getFloat('intensity'); if (intensity == null) intensity = 1.0; - PlayState.instance.cameraZoomIntensity = Constants.DEFAULT_ZOOM_INTENSITY * intensity; - PlayState.instance.hudCameraZoomIntensity = Constants.DEFAULT_ZOOM_INTENSITY * intensity * 2.0; + PlayState.instance.cameraBopIntensity = Constants.DEFAULT_BOP_INTENSITY * intensity; + PlayState.instance.hudCameraZoomIntensity = 1.015 * intensity * 2.0; PlayState.instance.cameraZoomRate = rate; trace('Set camera zoom rate to ${PlayState.instance.cameraZoomRate}'); } diff --git a/source/funkin/play/event/ZoomCameraSongEvent.hx b/source/funkin/play/event/ZoomCameraSongEvent.hx index b913aebe7..f5d54b673 100644 --- a/source/funkin/play/event/ZoomCameraSongEvent.hx +++ b/source/funkin/play/event/ZoomCameraSongEvent.hx @@ -79,6 +79,9 @@ class ZoomCameraSongEvent extends SongEvent { case 'INSTANT': PlayState.instance.tweenCameraZoom(zoom, 0, isDirectMode); + case 'classic': + var classicDur = 1.0; // This is probably a fixed duration given how old zoom works. Need to sus it out. + PlayState.instance.tweenCameraZoom(zoom, 1.0; true); // Need to create an ease function to recreate classic lerp-style zooming. default: var durSeconds = Conductor.instance.stepLengthMs * duration / 1000; @@ -132,7 +135,7 @@ class ZoomCameraSongEvent extends SongEvent title: 'Mode', defaultValue: 'direct', type: SongEventFieldType.ENUM, - keys: ['Additive' => 'additive', 'Direct' => 'direct'] + keys: ['Stage' => 'stage', 'Direct' => 'direct'] }, { name: 'ease', @@ -163,6 +166,7 @@ class ZoomCameraSongEvent extends SongEvent 'Elastic In' => 'elasticIn', 'Elastic Out' => 'elasticOut', 'Elastic In/Out' => 'elasticInOut', + 'Classic' => 'classic' ] } ]); diff --git a/source/funkin/util/Constants.hx b/source/funkin/util/Constants.hx index c7bc03139..15378b5a4 100644 --- a/source/funkin/util/Constants.hx +++ b/source/funkin/util/Constants.hx @@ -163,9 +163,10 @@ class Constants public static final DEFAULT_VARIATION_LIST:Array = ['default', 'erect', 'pico']; /** - * The default intensity for camera zooms. + * The default intensity multiplier for camera bops. + * Prolly needs to be tuned bc it's a multiplier now. */ - public static final DEFAULT_ZOOM_INTENSITY:Float = 0.015; + public static final DEFAULT_BOP_INTENSITY:Float = 1.015; /** * The default rate for camera zooms (in beats per zoom). From c658862f48e8840fadf343832028f336495631e4 Mon Sep 17 00:00:00 2001 From: Jenny Crowe Date: Thu, 28 Mar 2024 11:07:13 -0700 Subject: [PATCH 017/124] submod update ughghghhhh --- art | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/art b/art index 00463685f..03e7c2a23 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit 00463685fa570f0c853d08e250b46ef80f30bc48 +Subproject commit 03e7c2a2353b184e45955c96d763b7cdf1acbc34 From 76885c421d7e521a97dba1025a50cb82fbf924fa Mon Sep 17 00:00:00 2001 From: Jenny Crowe Date: Thu, 28 Mar 2024 12:34:13 -0700 Subject: [PATCH 018/124] Cleanup + Focus Camera: Use Tween toggle converted to "Classic" ease type. --- source/funkin/play/PlayState.hx | 9 ++ .../funkin/play/event/FocusCameraSongEvent.hx | 106 ++++++++---------- .../funkin/play/event/ZoomCameraSongEvent.hx | 16 ++- 3 files changed, 64 insertions(+), 67 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 7a264243e..de8597c17 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -3104,6 +3104,15 @@ class PlayState extends MusicBeatSubState FlxG.camera.focusOn(cameraFollowPoint.getPosition()); } + /** + * Sets the camera follow point's position and tweens the camera there. + */ + public function tweenCameraToPosition(?x:Float, ?y:Float, ?duration:Float, ?ease:NullFloat>):Void + { + cameraFollowPoint.setPosition(x, y); + tweenCameraToFollowPoint(duration, ease); + } + /** * Disables camera following and tweens the camera to the follow point manually. */ diff --git a/source/funkin/play/event/FocusCameraSongEvent.hx b/source/funkin/play/event/FocusCameraSongEvent.hx index e2db2fa79..1bcac9ad3 100644 --- a/source/funkin/play/event/FocusCameraSongEvent.hx +++ b/source/funkin/play/event/FocusCameraSongEvent.hx @@ -70,83 +70,76 @@ class FocusCameraSongEvent extends SongEvent if (char == null) char = cast data.value; - var useTween:Null = data.getBool('useTween'); - if (useTween == null) useTween = false; var duration:Null = data.getFloat('duration'); if (duration == null) duration = 4.0; var ease:Null = data.getString('ease'); - if (ease == null) ease = 'linear'; + if (ease == null) ease = 'CLASSIC'; + + var currentStage = PlayState.instance.currentStage; + + // Get target position based on char. + var targetX:Float = posX; + var targetY:Float = posY; switch (char) { - case -1: // Position + case -1: // Position ("focus" on origin) trace('Focusing camera on static position.'); - var xTarget:Float = posX; - var yTarget:Float = posY; - PlayState.instance.cameraFollowPoint.setPosition(xTarget, yTarget); - case 0: // Boyfriend - // Focus the camera on the player. - if (PlayState.instance.currentStage.getBoyfriend() == null) + case 0: // Boyfriend (focus on player) + if (currentStage.getBoyfriend() == null) { trace('No BF to focus on.'); return; } trace('Focusing camera on player.'); - var xTarget:Float = PlayState.instance.currentStage.getBoyfriend().cameraFocusPoint.x + posX; - var yTarget:Float = PlayState.instance.currentStage.getBoyfriend().cameraFocusPoint.y + posY; + var bfPoint = currentStage.getBoyfriend().cameraFocusPoint; + targetX += bfPoint.x; + targetY += bfPoint.y; - PlayState.instance.cameraFollowPoint.setPosition(xTarget, yTarget); - case 1: // Dad - // Focus the camera on the dad. - if (PlayState.instance.currentStage.getDad() == null) + case 1: // Dad (focus on opponent) + if (currentStage.getDad() == null) { trace('No dad to focus on.'); return; } - trace('Focusing camera on dad.'); - trace(PlayState.instance.currentStage.getDad()); - var xTarget:Float = PlayState.instance.currentStage.getDad().cameraFocusPoint.x + posX; - var yTarget:Float = PlayState.instance.currentStage.getDad().cameraFocusPoint.y + posY; + trace('Focusing camera on opponent.'); + var dadPoint = currentStage.getDad().cameraFocusPoint; + targetX += dadPoint.x; + targetY += dadPoint.y; - PlayState.instance.cameraFollowPoint.setPosition(xTarget, yTarget); - case 2: // Girlfriend - // Focus the camera on the girlfriend. - if (PlayState.instance.currentStage.getGirlfriend() == null) + case 2: // Girlfriend (focus on girlfriend) + if (currentStage.getGirlfriend() == null) { trace('No GF to focus on.'); return; } trace('Focusing camera on girlfriend.'); - var xTarget:Float = PlayState.instance.currentStage.getGirlfriend().cameraFocusPoint.x + posX; - var yTarget:Float = PlayState.instance.currentStage.getGirlfriend().cameraFocusPoint.y + posY; + var gfPoint = currentStage.getGirlfriend().cameraFocusPoint; + targetX += gfPoint.x; + targetY += gfPoint.y; - PlayState.instance.cameraFollowPoint.setPosition(xTarget, yTarget); default: trace('Unknown camera focus: ' + data); } - if (useTween) + // Apply tween based on ease. + switch (ease) { - switch (ease) - { - case 'INSTANT': - PlayState.instance.tweenCameraToFollowPoint(0); - case 'classic': - var classicDur = 1.0; // This is probably a fixed duration given how old zoom works. Need to sus it out. - PlayState.instance.tweenCameratoFollowPoint(classicDur); // Need to create an ease function to recreate classic follow-style movement. - default: - var durSeconds = Conductor.instance.stepLengthMs * duration / 1000; - - var easeFunction:NullFloat> = Reflect.field(FlxEase, ease); - if (easeFunction == null) - { - trace('Invalid ease function: $ease'); - return; - } - - PlayState.instance.tweenCameraToFollowPoint(durSeconds, easeFunction); - } + case 'CLASSIC': // Old-school. No ease. Just set follow point. + PlayState.instance.cancelCameraFollowTween(); + PlayState.instance.cameraFollowPoint.setPosition(targetX, targetY); + case 'INSTANT': // Instant ease. Duration is automatically 0. + PlayState.instance.tweenCameraToPosition(targetX, targetY, 0); + default: + var durSeconds = Conductor.instance.stepLengthMs * duration / 1000; + var easeFunction:NullFloat> = Reflect.field(FlxEase, ease); + if (easeFunction == null) + { + trace('Invalid ease function: $ease'); + return; + } + PlayState.instance.tweenCameraToPosition(targetX, targetY, durSeconds, easeFunction); } } @@ -190,12 +183,6 @@ class FocusCameraSongEvent extends SongEvent type: SongEventFieldType.FLOAT, units: "px" }, - { - name: 'useTween', - title: 'Use Tween', - type: SongEventFieldType.BOOL, - defaultValue: false - }, { name: 'duration', title: 'Duration', @@ -211,7 +198,9 @@ class FocusCameraSongEvent extends SongEvent type: SongEventFieldType.ENUM, keys: [ 'Linear' => 'linear', - 'Instant' => 'INSTANT', + 'Sine In' => 'sineIn', + 'Sine Out' => 'sineOut', + 'Sine In/Out' => 'sineInOut', 'Quad In' => 'quadIn', 'Quad Out' => 'quadOut', 'Quad In/Out' => 'quadInOut', @@ -224,16 +213,17 @@ class FocusCameraSongEvent extends SongEvent 'Quint In' => 'quintIn', 'Quint Out' => 'quintOut', 'Quint In/Out' => 'quintInOut', + 'Expo In' => 'expoIn', + 'Expo Out' => 'expoOut', + 'Expo In/Out' => 'expoInOut', 'Smooth Step In' => 'smoothStepIn', 'Smooth Step Out' => 'smoothStepOut', 'Smooth Step In/Out' => 'smoothStepInOut', - 'Sine In' => 'sineIn', - 'Sine Out' => 'sineOut', - 'Sine In/Out' => 'sineInOut', 'Elastic In' => 'elasticIn', 'Elastic Out' => 'elasticOut', 'Elastic In/Out' => 'elasticInOut', - 'Classic' => 'classic' + 'Instant (Ignores duration)' => 'INSTANT', + 'Classic (Ignores duration)' => 'CLASSIC' ] } ]); diff --git a/source/funkin/play/event/ZoomCameraSongEvent.hx b/source/funkin/play/event/ZoomCameraSongEvent.hx index f5d54b673..46c746333 100644 --- a/source/funkin/play/event/ZoomCameraSongEvent.hx +++ b/source/funkin/play/event/ZoomCameraSongEvent.hx @@ -79,12 +79,8 @@ class ZoomCameraSongEvent extends SongEvent { case 'INSTANT': PlayState.instance.tweenCameraZoom(zoom, 0, isDirectMode); - case 'classic': - var classicDur = 1.0; // This is probably a fixed duration given how old zoom works. Need to sus it out. - PlayState.instance.tweenCameraZoom(zoom, 1.0; true); // Need to create an ease function to recreate classic lerp-style zooming. default: var durSeconds = Conductor.instance.stepLengthMs * duration / 1000; - var easeFunction:NullFloat> = Reflect.field(FlxEase, ease); if (easeFunction == null) { @@ -145,6 +141,9 @@ class ZoomCameraSongEvent extends SongEvent keys: [ 'Linear' => 'linear', 'Instant' => 'INSTANT', + 'Sine In' => 'sineIn', + 'Sine Out' => 'sineOut', + 'Sine In/Out' => 'sineInOut', 'Quad In' => 'quadIn', 'Quad Out' => 'quadOut', 'Quad In/Out' => 'quadInOut', @@ -157,16 +156,15 @@ class ZoomCameraSongEvent extends SongEvent 'Quint In' => 'quintIn', 'Quint Out' => 'quintOut', 'Quint In/Out' => 'quintInOut', + 'Expo In' => 'expoIn', + 'Expo Out' => 'expoOut', + 'Expo In/Out' => 'expoInOut', 'Smooth Step In' => 'smoothStepIn', 'Smooth Step Out' => 'smoothStepOut', 'Smooth Step In/Out' => 'smoothStepInOut', - 'Sine In' => 'sineIn', - 'Sine Out' => 'sineOut', - 'Sine In/Out' => 'sineInOut', 'Elastic In' => 'elasticIn', 'Elastic Out' => 'elasticOut', - 'Elastic In/Out' => 'elasticInOut', - 'Classic' => 'classic' + 'Elastic In/Out' => 'elasticInOut' ] } ]); From e2851818b387e2055b7beb9f1c85c56b613a6167 Mon Sep 17 00:00:00 2001 From: Jenny Crowe Date: Thu, 28 Mar 2024 17:47:38 -0700 Subject: [PATCH 019/124] Zoom Camera: Property tweaks --- source/funkin/play/event/ZoomCameraSongEvent.hx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/funkin/play/event/ZoomCameraSongEvent.hx b/source/funkin/play/event/ZoomCameraSongEvent.hx index 46c746333..748abda19 100644 --- a/source/funkin/play/event/ZoomCameraSongEvent.hx +++ b/source/funkin/play/event/ZoomCameraSongEvent.hx @@ -101,9 +101,9 @@ class ZoomCameraSongEvent extends SongEvent * ``` * { * 'zoom': FLOAT, // Target zoom level. - * 'duration': FLOAT, // Optional duration in steps. - * 'mode': ENUM, // Whether to set additive zoom or direct zoom. - * 'ease': ENUM, // Optional easing function. + * 'duration': FLOAT, // Duration in steps. + * 'mode': ENUM, // Whether zoom is relative to the stage or absolute zoom. + * 'ease': ENUM, // Easing function. * } * @return SongEventSchema */ @@ -129,9 +129,9 @@ class ZoomCameraSongEvent extends SongEvent { name: 'mode', title: 'Mode', - defaultValue: 'direct', + defaultValue: 'stage', type: SongEventFieldType.ENUM, - keys: ['Stage' => 'stage', 'Direct' => 'direct'] + keys: ['Stage zoom' => 'stage', 'Absolute zoom' => 'direct'] }, { name: 'ease', From b75c7c23614785fd31af2bdd2c6b059fd6c4f1b9 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 28 Mar 2024 23:08:50 -0400 Subject: [PATCH 020/124] funkVis html5 --- hmm.json | 2 +- source/funkin/audio/visualize/ABotVis.hx | 3 ++- source/funkin/audio/visualize/AudioClip.hx | 23 ---------------------- 3 files changed, 3 insertions(+), 25 deletions(-) delete mode 100644 source/funkin/audio/visualize/AudioClip.hx diff --git a/hmm.json b/hmm.json index 81624a08a..430f33f0d 100644 --- a/hmm.json +++ b/hmm.json @@ -49,7 +49,7 @@ "name": "funkVis", "type": "git", "dir": null, - "ref": "0ac2fffa67fd30563df97c66718551efa92d283e", + "ref": "backend-rework", "url": "https://github.com/FunkinCrew/funkVis" }, { diff --git a/source/funkin/audio/visualize/ABotVis.hx b/source/funkin/audio/visualize/ABotVis.hx index a8b6fb937..1188d389f 100644 --- a/source/funkin/audio/visualize/ABotVis.hx +++ b/source/funkin/audio/visualize/ABotVis.hx @@ -9,6 +9,7 @@ import flixel.math.FlxMath; import flixel.sound.FlxSound; import funkin.util.MathUtil; import funkVis.dsp.SpectralAnalyzer; +import funkVis.audioclip.frontends.LimeAudioClip; using Lambda; @@ -57,7 +58,7 @@ class ABotVis extends FlxTypedSpriteGroup public function initAnalyzer() { @:privateAccess - analyzer = new SpectralAnalyzer(7, new AudioClip(cast snd._channel.__source), 0.01, 30); + analyzer = new SpectralAnalyzer(7, new LimeAudioClip(cast snd._channel.__source), 0.01, 30); analyzer.maxDb = -35; // analyzer.fftN = 2048; } diff --git a/source/funkin/audio/visualize/AudioClip.hx b/source/funkin/audio/visualize/AudioClip.hx deleted file mode 100644 index a8e353799..000000000 --- a/source/funkin/audio/visualize/AudioClip.hx +++ /dev/null @@ -1,23 +0,0 @@ -package funkin.audio.visualize; - -import flixel.FlxG; -import flixel.math.FlxMath; -import funkVis.AudioBuffer; -import lime.media.AudioSource; - -class AudioClip implements funkVis.AudioClip -{ - public var audioBuffer(default, null):AudioBuffer; - public var currentFrame(get, never):Int; - - public function new(audioSource:AudioSource) - { - var data:lime.utils.UInt16Array = cast audioSource.buffer.data; - this.audioBuffer = new AudioBuffer(data, audioSource.buffer.sampleRate); - } - - private function get_currentFrame():Int - { - return Std.int(FlxMath.remapToRange(FlxG.sound.music.time, 0, FlxG.sound.music.length, 0, audioBuffer.data.length / 2)); - } -} From c97227b1300a40d2f6153940d86a04882ca8bdca Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 29 Mar 2024 00:39:32 -0400 Subject: [PATCH 021/124] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 69ac1b5f1..8a48607c8 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 69ac1b5f10ee8722ac0586a0e0282f04dccc07eb +Subproject commit 8a48607c800e096bbe6e67395adbbd48639a72ed From 175c580fef64d38c6314021f37d0e4cc0cd762d5 Mon Sep 17 00:00:00 2001 From: FabsTheFabs Date: Fri, 29 Mar 2024 23:34:22 +0000 Subject: [PATCH 022/124] update assets submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 2a0afcd76..72287eede 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 2a0afcd76a26251dbbebb6901df4651f25a92c23 +Subproject commit 72287eede3a46a162a1bf0651a742d17391b4a9b From 254648eb55b546c4aa34c62188b4ef8d6fae1386 Mon Sep 17 00:00:00 2001 From: FabsTheFabs Date: Sat, 30 Mar 2024 03:27:40 +0000 Subject: [PATCH 023/124] update assets submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 72287eede..811a3c208 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 72287eede3a46a162a1bf0651a742d17391b4a9b +Subproject commit 811a3c208be2b5e1074d5bd166471f43b22eb453 From 2f22bb8abeb4ae93f20624067db4ae783a8d7cb2 Mon Sep 17 00:00:00 2001 From: FabsTheFabs Date: Sat, 30 Mar 2024 05:10:33 +0000 Subject: [PATCH 024/124] update assets submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 811a3c208..09ba7bfd8 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 811a3c208be2b5e1074d5bd166471f43b22eb453 +Subproject commit 09ba7bfd84167f6a04922e9c6312224c8bcef6cd From e9b0af6ea246ea567d21fc719111b53f50fa35cd Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 3 Apr 2024 03:40:10 -0400 Subject: [PATCH 025/124] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 503b73d20..15cf800ac 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 503b73d20be0b55f881da6182b70432b0810fd17 +Subproject commit 15cf800ac9cc4e55210dafb8f2c64838360f9fd0 From 57a5973c2ceed56952dd1c283228bf8129bbe5f6 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Thu, 4 Apr 2024 05:22:44 -0400 Subject: [PATCH 026/124] small fade polish for week 8 convos --- .../play/cutscene/dialogue/Conversation.hx | 4 +++- source/funkin/util/EaseUtil.hx | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 source/funkin/util/EaseUtil.hx diff --git a/source/funkin/play/cutscene/dialogue/Conversation.hx b/source/funkin/play/cutscene/dialogue/Conversation.hx index c520c3e25..2c59eaba0 100644 --- a/source/funkin/play/cutscene/dialogue/Conversation.hx +++ b/source/funkin/play/cutscene/dialogue/Conversation.hx @@ -23,6 +23,7 @@ import funkin.modding.IScriptedClass.IDialogueScriptedClass; import funkin.modding.IScriptedClass.IEventHandler; import funkin.play.cutscene.dialogue.DialogueBox; import funkin.util.SortUtil; +import funkin.util.EaseUtil; /** * A high-level handler for dialogue. @@ -179,7 +180,7 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass impl if (backdropData.fadeTime > 0.0) { backdrop.alpha = 0.0; - FlxTween.tween(backdrop, {alpha: 1.0}, backdropData.fadeTime, {ease: FlxEase.linear}); + FlxTween.tween(backdrop, {alpha: 1.0}, backdropData.fadeTime, {ease: EaseUtil.stepped(10)}); } else { @@ -403,6 +404,7 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass impl type: ONESHOT, // holy shit like the game no way startDelay: 0, onComplete: (_) -> endOutro(), + ease: EaseUtil.stepped(8) }); FlxTween.tween(this.music, {volume: 0.0}, outroData.fadeTime); diff --git a/source/funkin/util/EaseUtil.hx b/source/funkin/util/EaseUtil.hx new file mode 100644 index 000000000..200e74d07 --- /dev/null +++ b/source/funkin/util/EaseUtil.hx @@ -0,0 +1,17 @@ +package funkin.util; + +class EaseUtil +{ + /** + * Returns an ease function that eases via steps. + * Useful for "retro" style fades (week 6!) + * @param steps how many steps to ease over + * @return Float->Float + */ + public static inline function stepped(steps:Int):Float->Float + { + return function(t:Float):Float { + return Math.floor(t * steps) / steps; + } + } +} From 823baa3326fb9b6268610e095f9173c261a3363b Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 30 Mar 2024 00:54:07 -0400 Subject: [PATCH 027/124] Add new album roll animation (again) --- assets | 2 +- .../graphics/adobeanimate/FlxAtlasSprite.hx | 3 +- source/funkin/ui/freeplay/AlbumRoll.hx | 129 ++++++------------ source/funkin/ui/freeplay/FreeplayState.hx | 10 +- 4 files changed, 47 insertions(+), 97 deletions(-) diff --git a/assets b/assets index fe0570d4c..36f0d2944 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit fe0570d4cfe20d232bad062f3140787faad1baeb +Subproject commit 36f0d29445579402cb42750c746bb07d2565fe81 diff --git a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx index 5394bce1a..5ab2df837 100644 --- a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx +++ b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx @@ -137,7 +137,8 @@ class FlxAtlasSprite extends FlxAnimate anim.callback = function(_, frame:Int) { var offset = loop ? 0 : -1; - if (frame == (anim.getFrameLabel(id).duration + offset) + anim.getFrameLabel(id).index) + var frameLabel = anim.getFrameLabel(id); + if (frame == (frameLabel.duration + offset) + frameLabel.index) { if (loop) { diff --git a/source/funkin/ui/freeplay/AlbumRoll.hx b/source/funkin/ui/freeplay/AlbumRoll.hx index bde946e79..189e04973 100644 --- a/source/funkin/ui/freeplay/AlbumRoll.hx +++ b/source/funkin/ui/freeplay/AlbumRoll.hx @@ -1,5 +1,6 @@ package funkin.ui.freeplay; +import funkin.graphics.adobeanimate.FlxAtlasSprite; import flixel.FlxSprite; import flixel.group.FlxSpriteGroup; import flixel.util.FlxSort; @@ -35,30 +36,47 @@ class AlbumRoll extends FlxSpriteGroup return value; } - var albumArt:FunkinSprite; - var albumTitle:FunkinSprite; + var newAlbumArt:FlxAtlasSprite; var difficultyStars:DifficultyStars; var _exitMovers:Null; var albumData:Album; + final animNames:Map = [ + "volume1-active" => "ENTRANCE", + "volume2-active" => "ENTRANCE VOL2", + "volume3-active" => "ENTRANCE VOL3", + "volume1-trans" => "VOL1 TRANS", + "volume2-trans" => "VOL2 TRANS", + "volume3-trans" => "VOL3 TRANS", + "volume1-idle" => "VOL1 STILL", + "volume2-idle" => "VOL2 STILL", + "volume3-idle" => "VOL3 STILL", + ]; + public function new() { super(); - albumTitle = new FunkinSprite(947, 491); - albumTitle.visible = true; - albumTitle.zIndex = 200; - add(albumTitle); + newAlbumArt = new FlxAtlasSprite(0, 0, Paths.animateAtlas("freeplay/albumRoll/freeplayAlbum")); + newAlbumArt.visible = false; + newAlbumArt.onAnimationFinish.add(onAlbumFinish); + + add(newAlbumArt); difficultyStars = new DifficultyStars(140, 39); + difficultyStars.stars.visible = false; + add(difficultyStars); + } - difficultyStars.stars.visible = true; - albumTitle.visible = false; - // albumArtist.visible = false; + function onAlbumFinish(animName:String):Void + { + // Play the idle animation for the current album. + newAlbumArt.playAnimation(animNames.get('$albumId-idle'), false, false, true); - // var albumArtist:FlxSprite = new FlxSprite(1010, 607).loadGraphic(Paths.image('freeplay/albumArtist-kawaisprite')); + // End on the last frame and don't continue until playAnimation is called again. + // newAlbumArt.anim.pause(); } /** @@ -68,13 +86,8 @@ class AlbumRoll extends FlxSpriteGroup { if (albumId == null) { - albumArt.visible = false; - albumTitle.visible = false; - if (titleTimer != null) - { - titleTimer.cancel(); - titleTimer = null; - } + difficultyStars.stars.visible = false; + return; } albumData = AlbumRegistry.instance.fetchEntry(albumId); @@ -86,41 +99,8 @@ class AlbumRoll extends FlxSpriteGroup return; }; - if (albumArt != null) - { - FlxTween.cancelTweensOf(albumArt); - albumArt.visible = false; - albumArt.destroy(); - remove(albumArt); - } - - // Paths.animateAtlas('freeplay/albumRoll'), - albumArt = FunkinSprite.create(1500, 360, albumData.getAlbumArtAssetKey()); - albumArt.setGraphicSize(262, 262); // Magic number for size IG - albumArt.zIndex = 100; - - // playIntro(); - add(albumArt); - applyExitMovers(); - if (Assets.exists(Paths.image(albumData.getAlbumTitleAssetKey()))) - { - if (albumData.hasAlbumTitleAnimations()) - { - albumTitle.loadSparrow(albumData.getAlbumTitleAssetKey()); - FlxAnimationUtil.addAtlasAnimations(albumTitle, albumData.getAlbumTitleAnimations()); - } - else - { - albumTitle.loadGraphic(Paths.image(albumData.getAlbumTitleAssetKey())); - } - } - else - { - albumTitle.visible = false; - } - refresh(); } @@ -146,27 +126,13 @@ class AlbumRoll extends FlxSpriteGroup if (exitMovers == null) return; - exitMovers.set([albumArt], + exitMovers.set([newAlbumArt], { x: FlxG.width, speed: 0.4, wait: 0 }); - exitMovers.set([albumTitle], - { - x: FlxG.width, - speed: 0.2, - wait: 0.1 - }); - /* - exitMovers.set([albumArtist], - { - x: FlxG.width * 1.1, - speed: 0.2, - wait: 0.2 - }); - */ exitMovers.set([difficultyStars], { x: FlxG.width * 1.2, @@ -182,22 +148,21 @@ class AlbumRoll extends FlxSpriteGroup */ public function playIntro():Void { - albumArt.visible = true; - FlxTween.tween(albumArt, {x: 950, y: 320, angle: -340}, 0.5, {ease: FlxEase.elasticOut}); + newAlbumArt.visible = true; + newAlbumArt.playAnimation(animNames.get('$albumId-active'), false, false, false); - albumTitle.visible = false; - - if (titleTimer != null) - { - titleTimer.cancel(); - titleTimer = null; - } - - titleTimer = new FlxTimer().start(0.75, function(_) { - showTitle(); + difficultyStars.stars.visible = false; + new FlxTimer().start(0.75, function(_) { + // showTitle(); + showStars(); }); } + public function skipIntro():Void + { + newAlbumArt.playAnimation(animNames.get('$albumId-trans'), false, false, false); + } + public function setDifficultyStars(?difficulty:Int):Void { if (difficulty == null) return; @@ -205,19 +170,11 @@ class AlbumRoll extends FlxSpriteGroup difficultyStars.difficulty = difficulty; } - public function showTitle():Void - { - albumTitle.visible = true; - albumTitle.animation.play('active'); - albumTitle.animation.finishCallback = (_) -> albumTitle.animation.play('idle'); - } - /** * Make the album stars visible. */ public function showStars():Void { - // albumArtist.visible = false; - difficultyStars.stars.visible = false; + difficultyStars.stars.visible = false; // true; } } diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 0724ad022..dc1f164ea 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -469,14 +469,6 @@ class FreeplayState extends MusicBeatSubState albumRoll.playIntro(); - new FlxTimer().start(0.75, function(_) { - albumRoll.showTitle(); - }); - - new FlxTimer().start(35 / 24, function(_) { - albumRoll.showStars(); - }); - FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut}); var diffSelLeft:DifficultySelector = new DifficultySelector(20, grpDifficulties.y - 10, false, controls); @@ -1055,7 +1047,7 @@ class FreeplayState extends MusicBeatSubState if (albumRoll.albumId != newAlbumId) { albumRoll.albumId = newAlbumId; - albumRoll.playIntro(); + albumRoll.skipIntro(); } } From a764112bd40b9458f4925f5b6a4998f760a9b3e1 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 5 Apr 2024 01:24:03 -0400 Subject: [PATCH 028/124] Removed many unused assets to optimize bandwidth usage. --- Project.xml | 4 + assets | 2 +- source/funkin/Paths.hx | 2 +- source/funkin/modding/PolymodHandler.hx | 4 +- source/funkin/play/cutscene/VideoCutscene.hx | 9 +- .../funkin/ui/credits/CreditsDataHandler.hx | 7 ++ .../components/ChartEditorNoteSprite.hx | 6 - source/funkin/ui/freeplay/AlbumRoll.hx | 35 ------ source/funkin/ui/freeplay/DifficultyStars.hx | 106 ------------------ source/funkin/ui/freeplay/FreeplayState.hx | 11 -- source/funkin/ui/mainmenu/MainMenuState.hx | 4 +- 11 files changed, 25 insertions(+), 165 deletions(-) delete mode 100644 source/funkin/ui/freeplay/DifficultyStars.hx diff --git a/Project.xml b/Project.xml index 8ba14e7dc..db338d32a 100644 --- a/Project.xml +++ b/Project.xml @@ -45,6 +45,7 @@ +
@@ -58,10 +59,13 @@ +
+ + diff --git a/assets b/assets index 5027bc656..a11c558e4 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 5027bc656c9df5ec208ab256f9494bd7da425111 +Subproject commit a11c558e4c0ed796c34246b43abc9c2d024d0a42 diff --git a/source/funkin/Paths.hx b/source/funkin/Paths.hx index fd4ef76fa..54a4b7acf 100644 --- a/source/funkin/Paths.hx +++ b/source/funkin/Paths.hx @@ -113,7 +113,7 @@ class Paths public static function videos(key:String, ?library:String):String { - return getPath('videos/$key.${Constants.EXT_VIDEO}', BINARY, library); + return getPath('videos/$key.${Constants.EXT_VIDEO}', BINARY, library ?? 'videos'); } public static function voices(song:String, ?suffix:String = ''):String diff --git a/source/funkin/modding/PolymodHandler.hx b/source/funkin/modding/PolymodHandler.hx index 78f660d3f..62860ee0f 100644 --- a/source/funkin/modding/PolymodHandler.hx +++ b/source/funkin/modding/PolymodHandler.hx @@ -240,8 +240,8 @@ class PolymodHandler { return { assetLibraryPaths: [ - 'default' => 'preload', 'shared' => 'shared', 'songs' => 'songs', 'tutorial' => 'tutorial', 'week1' => 'week1', 'week2' => 'week2', - 'week3' => 'week3', 'week4' => 'week4', 'week5' => 'week5', 'week6' => 'week6', 'week7' => 'week7', 'weekend1' => 'weekend1', + 'default' => 'preload', 'shared' => 'shared', 'songs' => 'songs', 'videos' => 'videos', 'tutorial' => 'tutorial', 'week1' => 'week1', + 'week2' => 'week2', 'week3' => 'week3', 'week4' => 'week4', 'week5' => 'week5', 'week6' => 'week6', 'week7' => 'week7', 'weekend1' => 'weekend1', ], coreAssetRedirect: CORE_FOLDER, } diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 3da51185f..6983fbcad 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -67,8 +67,13 @@ class VideoCutscene if (!openfl.Assets.exists(filePath)) { // Display a popup. - lime.app.Application.current.window.alert('Video file does not exist: ${filePath}', 'Error playing video'); - return; + // lime.app.Application.current.window.alert('Video file does not exist: ${filePath}', 'Error playing video'); + // return; + + // TODO: After moving videos to their own library, + // this function ALWAYS FAILS on web, but the video still plays. + // I think that's due to a weird quirk with how OpenFL libraries work. + trace('Video file does not exist: ${filePath}'); } var rawFilePath = Paths.stripLibrary(filePath); diff --git a/source/funkin/ui/credits/CreditsDataHandler.hx b/source/funkin/ui/credits/CreditsDataHandler.hx index 86afdafd1..628a9f893 100644 --- a/source/funkin/ui/credits/CreditsDataHandler.hx +++ b/source/funkin/ui/credits/CreditsDataHandler.hx @@ -99,12 +99,19 @@ class CreditsDataHandler static function fetchCreditsData():funkin.data.JsonFile { + #if !macro var rawJson:String = openfl.Assets.getText(CREDITS_DATA_PATH).trim(); return { fileName: CREDITS_DATA_PATH, contents: rawJson }; + #else + return { + fileName: CREDITS_DATA_PATH, + contents: null + }; + #end } static function parseCreditsData(file:JsonFile):Null diff --git a/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx b/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx index cd403c6f8..98f5a47aa 100644 --- a/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx +++ b/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx @@ -117,12 +117,6 @@ class ChartEditorNoteSprite extends FlxSprite { noteFrameCollection.pushFrame(frame); } - var frameCollectionNormal2:FlxAtlasFrames = Paths.getSparrowAtlas('NoteHoldNormal'); - - for (frame in frameCollectionNormal2.frames) - { - noteFrameCollection.pushFrame(frame); - } // Pixel notes var graphicPixel = FlxG.bitmap.add(Paths.image('weeb/pixelUI/arrows-pixels', 'week6'), false, null); diff --git a/source/funkin/ui/freeplay/AlbumRoll.hx b/source/funkin/ui/freeplay/AlbumRoll.hx index bde946e79..c1263fed6 100644 --- a/source/funkin/ui/freeplay/AlbumRoll.hx +++ b/source/funkin/ui/freeplay/AlbumRoll.hx @@ -37,7 +37,6 @@ class AlbumRoll extends FlxSpriteGroup var albumArt:FunkinSprite; var albumTitle:FunkinSprite; - var difficultyStars:DifficultyStars; var _exitMovers:Null; @@ -52,9 +51,6 @@ class AlbumRoll extends FlxSpriteGroup albumTitle.zIndex = 200; add(albumTitle); - difficultyStars = new DifficultyStars(140, 39); - - difficultyStars.stars.visible = true; albumTitle.visible = false; // albumArtist.visible = false; @@ -158,21 +154,6 @@ class AlbumRoll extends FlxSpriteGroup speed: 0.2, wait: 0.1 }); - - /* - exitMovers.set([albumArtist], - { - x: FlxG.width * 1.1, - speed: 0.2, - wait: 0.2 - }); - */ - exitMovers.set([difficultyStars], - { - x: FlxG.width * 1.2, - speed: 0.2, - wait: 0.3 - }); } var titleTimer:Null = null; @@ -198,26 +179,10 @@ class AlbumRoll extends FlxSpriteGroup }); } - public function setDifficultyStars(?difficulty:Int):Void - { - if (difficulty == null) return; - - difficultyStars.difficulty = difficulty; - } - public function showTitle():Void { albumTitle.visible = true; albumTitle.animation.play('active'); albumTitle.animation.finishCallback = (_) -> albumTitle.animation.play('idle'); } - - /** - * Make the album stars visible. - */ - public function showStars():Void - { - // albumArtist.visible = false; - difficultyStars.stars.visible = false; - } } diff --git a/source/funkin/ui/freeplay/DifficultyStars.hx b/source/funkin/ui/freeplay/DifficultyStars.hx deleted file mode 100644 index 51526bcbe..000000000 --- a/source/funkin/ui/freeplay/DifficultyStars.hx +++ /dev/null @@ -1,106 +0,0 @@ -package funkin.ui.freeplay; - -import flixel.group.FlxSpriteGroup; -import funkin.graphics.adobeanimate.FlxAtlasSprite; -import funkin.graphics.shaders.HSVShader; - -class DifficultyStars extends FlxSpriteGroup -{ - /** - * Internal handler var for difficulty... ranges from 0... to 15 - * 0 is 1 star... 15 is 0 stars! - */ - var curDifficulty(default, set):Int = 0; - - /** - * Range between 0 and 15 - */ - public var difficulty(default, set):Int = 1; - - public var stars:FlxAtlasSprite; - - var flames:FreeplayFlames; - - var hsvShader:HSVShader; - - public function new(x:Float, y:Float) - { - super(x, y); - - hsvShader = new HSVShader(); - - flames = new FreeplayFlames(0, 0); - add(flames); - - stars = new FlxAtlasSprite(0, 0, Paths.animateAtlas("freeplay/freeplayStars")); - stars.anim.play("diff stars"); - add(stars); - - stars.shader = hsvShader; - - for (memb in flames.members) - memb.shader = hsvShader; - } - - override function update(elapsed:Float):Void - { - super.update(elapsed); - - // "loops" the current animation - // for clarity, the animation file looks like - // frame : stars - // 0-99: 1 star - // 100-199: 2 stars - // ...... - // 1300-1499: 15 stars - // 1500 : 0 stars - if (curDifficulty < 15 && stars.anim.curFrame >= (curDifficulty + 1) * 100) - { - stars.anim.play("diff stars", true, false, curDifficulty * 100); - } - } - - function set_difficulty(value:Int):Int - { - difficulty = value; - - if (difficulty <= 0) - { - difficulty = 0; - curDifficulty = 15; - } - else if (difficulty <= 15) - { - difficulty = value; - curDifficulty = difficulty - 1; - } - else - { - difficulty = 15; - curDifficulty = difficulty - 1; - } - - if (difficulty > 10) flames.flameCount = difficulty - 10; - else - flames.flameCount = 0; - - return difficulty; - } - - function set_curDifficulty(value:Int):Int - { - curDifficulty = value; - if (curDifficulty == 15) - { - stars.anim.play("diff stars", true, false, 1500); - stars.anim.pause(); - } - else - { - stars.anim.curFrame = Std.int(curDifficulty * 100); - stars.anim.play("diff stars", true, false, curDifficulty * 100); - } - - return curDifficulty; - } -} diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 0724ad022..af76a42ce 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -473,10 +473,6 @@ class FreeplayState extends MusicBeatSubState albumRoll.showTitle(); }); - new FlxTimer().start(35 / 24, function(_) { - albumRoll.showStars(); - }); - FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut}); var diffSelLeft:DifficultySelector = new DifficultySelector(20, grpDifficulties.y - 10, false, controls); @@ -1047,9 +1043,6 @@ class FreeplayState extends MusicBeatSubState } } - // Set the difficulty star count on the right. - albumRoll.setDifficultyStars(daSong?.songRating); - // Set the album graphic and play the animation if relevant. var newAlbumId:String = daSong?.albumId; if (albumRoll.albumId != newAlbumId) @@ -1169,10 +1162,6 @@ class FreeplayState extends MusicBeatSubState { currentDifficulty = rememberedDifficulty; } - - // Set the difficulty star count on the right. - var daSong:Null = grpCapsules.members[curSelected]?.songData; - albumRoll.setDifficultyStars(daSong?.songRating ?? 0); } function changeSelection(change:Int = 0):Void diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index f38db1ccd..c1dc54ffe 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -1,5 +1,6 @@ package funkin.ui.mainmenu; +import funkin.graphics.FunkinSprite; import flixel.addons.transition.FlxTransitionableState; import funkin.ui.debug.DebugMenuSubState; import flixel.FlxObject; @@ -56,7 +57,8 @@ class MainMenuState extends MusicBeatState persistentUpdate = false; persistentDraw = true; - var bg:FlxSprite = new FlxSprite(Paths.image('menuBG')); + var bg = FunkinSprite.create('menuDesat'); + bg.color = 0xFFFDE871; bg.scrollFactor.x = 0; bg.scrollFactor.y = 0.17; bg.setGraphicSize(Std.int(bg.width * 1.2)); From 08e8530ad4c29d2b9454b3f155d94baad16290e4 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 5 Apr 2024 02:44:44 -0400 Subject: [PATCH 029/124] Fix SetCameraBopSongEvent to be additive --- art | 2 +- source/funkin/play/PlayState.hx | 3 ++- source/funkin/play/event/SetCameraBopSongEvent.hx | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/art b/art index 03e7c2a23..00463685f 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit 03e7c2a2353b184e45955c96d763b7cdf1acbc34 +Subproject commit 00463685fa570f0c853d08e250b46ef80f30bc48 diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index de8597c17..0ee85ac9b 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -866,7 +866,7 @@ class PlayState extends MusicBeatSubState // Reset camera zooming cameraBopIntensity = Constants.DEFAULT_BOP_INTENSITY; - hudCameraZoomIntensity = 0.015 * 2.0; + hudCameraZoomIntensity = (cameraBopIntensity - 1.0) * 2.0; cameraZoomRate = Constants.DEFAULT_ZOOM_RATE; health = Constants.HEALTH_STARTING; @@ -976,6 +976,7 @@ class PlayState extends MusicBeatSubState FlxG.watch.addQuick('bfAnim', currentStage.getBoyfriend().getCurrentAnimation()); } FlxG.watch.addQuick('health', health); + FlxG.watch.addQuick('cameraBopIntensity', cameraBopIntensity); // TODO: Add a song event for Handle GF dance speed. diff --git a/source/funkin/play/event/SetCameraBopSongEvent.hx b/source/funkin/play/event/SetCameraBopSongEvent.hx index 9d3e785ed..f3efc04e3 100644 --- a/source/funkin/play/event/SetCameraBopSongEvent.hx +++ b/source/funkin/play/event/SetCameraBopSongEvent.hx @@ -50,8 +50,8 @@ class SetCameraBopSongEvent extends SongEvent var intensity:Null = data.getFloat('intensity'); if (intensity == null) intensity = 1.0; - PlayState.instance.cameraBopIntensity = Constants.DEFAULT_BOP_INTENSITY * intensity; - PlayState.instance.hudCameraZoomIntensity = 1.015 * intensity * 2.0; + PlayState.instance.cameraBopIntensity = (Constants.DEFAULT_BOP_INTENSITY - 1.0) * intensity + 1.0; + PlayState.instance.hudCameraZoomIntensity = (Constants.DEFAULT_BOP_INTENSITY - 1.0) * intensity * 2.0; PlayState.instance.cameraZoomRate = rate; trace('Set camera zoom rate to ${PlayState.instance.cameraZoomRate}'); } From 95434018f70fa84c0cfb6808a361d4c3021cfde7 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 5 Apr 2024 02:56:47 -0400 Subject: [PATCH 030/124] Readd GF camera zoom into results state. --- 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 b59c48888..795f493e8 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -966,7 +966,7 @@ class PlayState extends MusicBeatSubState if (health < Constants.HEALTH_MIN) health = Constants.HEALTH_MIN; // Apply camera zoom + multipliers. - if (subState == null) + if (subState == null && cameraZoomRate > 0.0 && !isInCutscene) { cameraBopMultiplier = FlxMath.lerp(1.0, cameraBopMultiplier, 0.95); // Lerp bop multiplier back to 1.0x var zoomPlusBop = currentCameraZoom * cameraBopMultiplier; // Apply camera bop multiplier. From ab18c648217b9d28d6a17f01324ad6d30c07cb76 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 5 Apr 2024 03:33:15 -0400 Subject: [PATCH 031/124] Fix various audio fixes --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 5027bc656..d44f74fe8 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 5027bc656c9df5ec208ab256f9494bd7da425111 +Subproject commit d44f74fe8b7655d8fceea71d0854134279b1b61d From ab2c4bf20b5c91a75f8b0420b1f5baea39c22813 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 5 Apr 2024 16:42:14 -0400 Subject: [PATCH 032/124] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index d44f74fe8..e8f4d2d91 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit d44f74fe8b7655d8fceea71d0854134279b1b61d +Subproject commit e8f4d2d91c7bd5a922465e7d67a0efb7d7574bd6 From af8a37d299aa6ea015dd7476ec4dfa8fbf4c9264 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 5 Apr 2024 19:33:24 -0400 Subject: [PATCH 033/124] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index a11c558e4..2eb07acf1 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit a11c558e4c0ed796c34246b43abc9c2d024d0a42 +Subproject commit 2eb07acf1fbee70229b913f87cfc1bfddf22ab88 From a6d44b1f1552e747f45028659bf5887fc7da9f08 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 5 Apr 2024 01:24:03 -0400 Subject: [PATCH 034/124] Removed many unused assets to optimize bandwidth usage. --- Project.xml | 4 + assets | 2 +- source/funkin/Paths.hx | 2 +- source/funkin/modding/PolymodHandler.hx | 4 +- source/funkin/play/cutscene/VideoCutscene.hx | 9 +- .../funkin/ui/credits/CreditsDataHandler.hx | 7 ++ .../components/ChartEditorNoteSprite.hx | 6 - source/funkin/ui/freeplay/DifficultyStars.hx | 106 ------------------ source/funkin/ui/freeplay/FreeplayState.hx | 11 +- source/funkin/ui/mainmenu/MainMenuState.hx | 4 +- 10 files changed, 29 insertions(+), 126 deletions(-) delete mode 100644 source/funkin/ui/freeplay/DifficultyStars.hx diff --git a/Project.xml b/Project.xml index 8ba14e7dc..db338d32a 100644 --- a/Project.xml +++ b/Project.xml @@ -45,6 +45,7 @@ +
@@ -58,10 +59,13 @@ +
+ + diff --git a/assets b/assets index e8f4d2d91..2eb07acf1 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e8f4d2d91c7bd5a922465e7d67a0efb7d7574bd6 +Subproject commit 2eb07acf1fbee70229b913f87cfc1bfddf22ab88 diff --git a/source/funkin/Paths.hx b/source/funkin/Paths.hx index fd4ef76fa..54a4b7acf 100644 --- a/source/funkin/Paths.hx +++ b/source/funkin/Paths.hx @@ -113,7 +113,7 @@ class Paths public static function videos(key:String, ?library:String):String { - return getPath('videos/$key.${Constants.EXT_VIDEO}', BINARY, library); + return getPath('videos/$key.${Constants.EXT_VIDEO}', BINARY, library ?? 'videos'); } public static function voices(song:String, ?suffix:String = ''):String diff --git a/source/funkin/modding/PolymodHandler.hx b/source/funkin/modding/PolymodHandler.hx index 78f660d3f..62860ee0f 100644 --- a/source/funkin/modding/PolymodHandler.hx +++ b/source/funkin/modding/PolymodHandler.hx @@ -240,8 +240,8 @@ class PolymodHandler { return { assetLibraryPaths: [ - 'default' => 'preload', 'shared' => 'shared', 'songs' => 'songs', 'tutorial' => 'tutorial', 'week1' => 'week1', 'week2' => 'week2', - 'week3' => 'week3', 'week4' => 'week4', 'week5' => 'week5', 'week6' => 'week6', 'week7' => 'week7', 'weekend1' => 'weekend1', + 'default' => 'preload', 'shared' => 'shared', 'songs' => 'songs', 'videos' => 'videos', 'tutorial' => 'tutorial', 'week1' => 'week1', + 'week2' => 'week2', 'week3' => 'week3', 'week4' => 'week4', 'week5' => 'week5', 'week6' => 'week6', 'week7' => 'week7', 'weekend1' => 'weekend1', ], coreAssetRedirect: CORE_FOLDER, } diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 0c05bc876..0939dae38 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -67,8 +67,13 @@ class VideoCutscene if (!openfl.Assets.exists(filePath)) { // Display a popup. - lime.app.Application.current.window.alert('Video file does not exist: ${filePath}', 'Error playing video'); - return; + // lime.app.Application.current.window.alert('Video file does not exist: ${filePath}', 'Error playing video'); + // return; + + // TODO: After moving videos to their own library, + // this function ALWAYS FAILS on web, but the video still plays. + // I think that's due to a weird quirk with how OpenFL libraries work. + trace('Video file does not exist: ${filePath}'); } var rawFilePath = Paths.stripLibrary(filePath); diff --git a/source/funkin/ui/credits/CreditsDataHandler.hx b/source/funkin/ui/credits/CreditsDataHandler.hx index 86afdafd1..628a9f893 100644 --- a/source/funkin/ui/credits/CreditsDataHandler.hx +++ b/source/funkin/ui/credits/CreditsDataHandler.hx @@ -99,12 +99,19 @@ class CreditsDataHandler static function fetchCreditsData():funkin.data.JsonFile { + #if !macro var rawJson:String = openfl.Assets.getText(CREDITS_DATA_PATH).trim(); return { fileName: CREDITS_DATA_PATH, contents: rawJson }; + #else + return { + fileName: CREDITS_DATA_PATH, + contents: null + }; + #end } static function parseCreditsData(file:JsonFile):Null diff --git a/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx b/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx index cd403c6f8..98f5a47aa 100644 --- a/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx +++ b/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx @@ -117,12 +117,6 @@ class ChartEditorNoteSprite extends FlxSprite { noteFrameCollection.pushFrame(frame); } - var frameCollectionNormal2:FlxAtlasFrames = Paths.getSparrowAtlas('NoteHoldNormal'); - - for (frame in frameCollectionNormal2.frames) - { - noteFrameCollection.pushFrame(frame); - } // Pixel notes var graphicPixel = FlxG.bitmap.add(Paths.image('weeb/pixelUI/arrows-pixels', 'week6'), false, null); diff --git a/source/funkin/ui/freeplay/DifficultyStars.hx b/source/funkin/ui/freeplay/DifficultyStars.hx deleted file mode 100644 index 51526bcbe..000000000 --- a/source/funkin/ui/freeplay/DifficultyStars.hx +++ /dev/null @@ -1,106 +0,0 @@ -package funkin.ui.freeplay; - -import flixel.group.FlxSpriteGroup; -import funkin.graphics.adobeanimate.FlxAtlasSprite; -import funkin.graphics.shaders.HSVShader; - -class DifficultyStars extends FlxSpriteGroup -{ - /** - * Internal handler var for difficulty... ranges from 0... to 15 - * 0 is 1 star... 15 is 0 stars! - */ - var curDifficulty(default, set):Int = 0; - - /** - * Range between 0 and 15 - */ - public var difficulty(default, set):Int = 1; - - public var stars:FlxAtlasSprite; - - var flames:FreeplayFlames; - - var hsvShader:HSVShader; - - public function new(x:Float, y:Float) - { - super(x, y); - - hsvShader = new HSVShader(); - - flames = new FreeplayFlames(0, 0); - add(flames); - - stars = new FlxAtlasSprite(0, 0, Paths.animateAtlas("freeplay/freeplayStars")); - stars.anim.play("diff stars"); - add(stars); - - stars.shader = hsvShader; - - for (memb in flames.members) - memb.shader = hsvShader; - } - - override function update(elapsed:Float):Void - { - super.update(elapsed); - - // "loops" the current animation - // for clarity, the animation file looks like - // frame : stars - // 0-99: 1 star - // 100-199: 2 stars - // ...... - // 1300-1499: 15 stars - // 1500 : 0 stars - if (curDifficulty < 15 && stars.anim.curFrame >= (curDifficulty + 1) * 100) - { - stars.anim.play("diff stars", true, false, curDifficulty * 100); - } - } - - function set_difficulty(value:Int):Int - { - difficulty = value; - - if (difficulty <= 0) - { - difficulty = 0; - curDifficulty = 15; - } - else if (difficulty <= 15) - { - difficulty = value; - curDifficulty = difficulty - 1; - } - else - { - difficulty = 15; - curDifficulty = difficulty - 1; - } - - if (difficulty > 10) flames.flameCount = difficulty - 10; - else - flames.flameCount = 0; - - return difficulty; - } - - function set_curDifficulty(value:Int):Int - { - curDifficulty = value; - if (curDifficulty == 15) - { - stars.anim.play("diff stars", true, false, 1500); - stars.anim.pause(); - } - else - { - stars.anim.curFrame = Std.int(curDifficulty * 100); - stars.anim.play("diff stars", true, false, curDifficulty * 100); - } - - return curDifficulty; - } -} diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index dc1f164ea..150f5a0b1 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -469,6 +469,10 @@ class FreeplayState extends MusicBeatSubState albumRoll.playIntro(); + new FlxTimer().start(0.75, function(_) { + albumRoll.showTitle(); + }); + FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut}); var diffSelLeft:DifficultySelector = new DifficultySelector(20, grpDifficulties.y - 10, false, controls); @@ -1039,9 +1043,6 @@ class FreeplayState extends MusicBeatSubState } } - // Set the difficulty star count on the right. - albumRoll.setDifficultyStars(daSong?.songRating); - // Set the album graphic and play the animation if relevant. var newAlbumId:String = daSong?.albumId; if (albumRoll.albumId != newAlbumId) @@ -1161,10 +1162,6 @@ class FreeplayState extends MusicBeatSubState { currentDifficulty = rememberedDifficulty; } - - // Set the difficulty star count on the right. - var daSong:Null = grpCapsules.members[curSelected]?.songData; - albumRoll.setDifficultyStars(daSong?.songRating ?? 0); } function changeSelection(change:Int = 0):Void diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index f38db1ccd..c1dc54ffe 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -1,5 +1,6 @@ package funkin.ui.mainmenu; +import funkin.graphics.FunkinSprite; import flixel.addons.transition.FlxTransitionableState; import funkin.ui.debug.DebugMenuSubState; import flixel.FlxObject; @@ -56,7 +57,8 @@ class MainMenuState extends MusicBeatState persistentUpdate = false; persistentDraw = true; - var bg:FlxSprite = new FlxSprite(Paths.image('menuBG')); + var bg = FunkinSprite.create('menuDesat'); + bg.color = 0xFFFDE871; bg.scrollFactor.x = 0; bg.scrollFactor.y = 0.17; bg.setGraphicSize(Std.int(bg.width * 1.2)); From da4f1fb424564b1be658fd0d32b7b53e743299a0 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 5 Apr 2024 19:47:33 -0400 Subject: [PATCH 035/124] remove difficulty stars --- source/funkin/ui/freeplay/AlbumRoll.hx | 52 +++++++++++----------- source/funkin/ui/freeplay/FreeplayState.hx | 2 +- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/source/funkin/ui/freeplay/AlbumRoll.hx b/source/funkin/ui/freeplay/AlbumRoll.hx index 189e04973..89c6c73a6 100644 --- a/source/funkin/ui/freeplay/AlbumRoll.hx +++ b/source/funkin/ui/freeplay/AlbumRoll.hx @@ -37,8 +37,8 @@ class AlbumRoll extends FlxSpriteGroup } var newAlbumArt:FlxAtlasSprite; - var difficultyStars:DifficultyStars; + // var difficultyStars:DifficultyStars; var _exitMovers:Null; var albumData:Album; @@ -65,9 +65,9 @@ class AlbumRoll extends FlxSpriteGroup add(newAlbumArt); - difficultyStars = new DifficultyStars(140, 39); - difficultyStars.stars.visible = false; - add(difficultyStars); + // difficultyStars = new DifficultyStars(140, 39); + // difficultyStars.stars.visible = false; + // add(difficultyStars); } function onAlbumFinish(animName:String):Void @@ -86,7 +86,7 @@ class AlbumRoll extends FlxSpriteGroup { if (albumId == null) { - difficultyStars.stars.visible = false; + // difficultyStars.stars.visible = false; return; } @@ -133,12 +133,12 @@ class AlbumRoll extends FlxSpriteGroup wait: 0 }); - exitMovers.set([difficultyStars], - { - x: FlxG.width * 1.2, - speed: 0.2, - wait: 0.3 - }); + // exitMovers.set([difficultyStars], + // { + // x: FlxG.width * 1.2, + // speed: 0.2, + // wait: 0.3 + // }); } var titleTimer:Null = null; @@ -151,10 +151,10 @@ class AlbumRoll extends FlxSpriteGroup newAlbumArt.visible = true; newAlbumArt.playAnimation(animNames.get('$albumId-active'), false, false, false); - difficultyStars.stars.visible = false; + // difficultyStars.stars.visible = false; new FlxTimer().start(0.75, function(_) { // showTitle(); - showStars(); + // showStars(); }); } @@ -163,18 +163,16 @@ class AlbumRoll extends FlxSpriteGroup newAlbumArt.playAnimation(animNames.get('$albumId-trans'), false, false, false); } - public function setDifficultyStars(?difficulty:Int):Void - { - if (difficulty == null) return; - - difficultyStars.difficulty = difficulty; - } - - /** - * Make the album stars visible. - */ - public function showStars():Void - { - difficultyStars.stars.visible = false; // true; - } + // public function setDifficultyStars(?difficulty:Int):Void + // { + // if (difficulty == null) return; + // difficultyStars.difficulty = difficulty; + // } + // /** + // * Make the album stars visible. + // */ + // public function showStars():Void + // { + // difficultyStars.stars.visible = false; // true; + // } } diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 150f5a0b1..ae51ba82a 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -470,7 +470,7 @@ class FreeplayState extends MusicBeatSubState albumRoll.playIntro(); new FlxTimer().start(0.75, function(_) { - albumRoll.showTitle(); + // albumRoll.showTitle(); }); FlxTween.tween(grpDifficulties, {x: 90}, 0.6, {ease: FlxEase.quartOut}); From 2462bd2d9943fe7839335d080db74c0b3f3e5059 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 5 Apr 2024 22:05:34 -0400 Subject: [PATCH 036/124] Update assets submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 2eb07acf1..84c3c7fef 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 2eb07acf1fbee70229b913f87cfc1bfddf22ab88 +Subproject commit 84c3c7fef411c616e558b5b497f70c106adc11d1 From 9a7a385af1e051a1affd19725eb14b731da5f921 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 6 Apr 2024 01:11:27 -0400 Subject: [PATCH 037/124] Fix segmentation fault on Linux by rebuilding Lime. --- .vscode/settings.json | 5 +++++ hmm.json | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 13a1862d2..96481461d 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -96,6 +96,11 @@ "target": "windows", "args": ["-debug", "-DFORCE_DEBUG_VERSION"] }, + { + "label": "Linux / Debug", + "target": "linux", + "args": ["-debug", "-DFORCE_DEBUG_VERSION"] + }, { "label": "HashLink / Debug", "target": "hl", diff --git a/hmm.json b/hmm.json index 641ef1bbd..8c07023c7 100644 --- a/hmm.json +++ b/hmm.json @@ -104,7 +104,7 @@ "name": "lime", "type": "git", "dir": null, - "ref": "1359fe6ad52e91175dc636a516d460bd54ea22ed", + "ref": "43ebebdd8119936b99f23407057025c7849c5f5b", "url": "https://github.com/FunkinCrew/lime" }, { From 958ebe92a3b5f8e834706e306793426b4b98b5f1 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 6 Apr 2024 01:59:39 -0400 Subject: [PATCH 038/124] Fix tankman's offsets to not suck. --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index e8f4d2d91..da3c17f2b 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e8f4d2d91c7bd5a922465e7d67a0efb7d7574bd6 +Subproject commit da3c17f2b0473af1b95167e563c4b3799d006438 From 29f105a44d89487a69df84604719c5fd84df88f6 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 6 Apr 2024 01:59:46 -0400 Subject: [PATCH 039/124] Practice mode = no highscore! --- 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 795f493e8..215979fdd 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2786,7 +2786,7 @@ class PlayState extends MusicBeatSubState // adds current song data into the tallies for the level (story levels) Highscore.talliesLevel = Highscore.combineTallies(Highscore.tallies, Highscore.talliesLevel); - if (Save.instance.isSongHighScore(currentSong.id, currentDifficulty, data)) + if (!isPracticeMode && Save.instance.isSongHighScore(currentSong.id, currentDifficulty, data)) { Save.instance.setSongScore(currentSong.id, currentDifficulty, data); #if newgrounds From 99ee2b07ca1737430afc1bf8edcc1da58c12297f Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 6 Apr 2024 02:06:06 -0400 Subject: [PATCH 040/124] Make results screen use full campaign score in Story Mode --- source/funkin/play/PlayState.hx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 215979fdd..2c8d72293 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -3072,18 +3072,18 @@ class PlayState extends MusicBeatSubState title: PlayStatePlaylist.isStoryMode ? ('${PlayStatePlaylist.campaignTitle}') : ('${currentChart.songName} by ${currentChart.songArtist}'), scoreData: { - score: songScore, + score: PlayStatePlaylist.isStoryMode ? PlayStatePlaylist.campaignScore : songScore, tallies: { - sick: Highscore.tallies.sick, - good: Highscore.tallies.good, - bad: Highscore.tallies.bad, - shit: Highscore.tallies.shit, - missed: Highscore.tallies.missed, - combo: Highscore.tallies.combo, - maxCombo: Highscore.tallies.maxCombo, - totalNotesHit: Highscore.tallies.totalNotesHit, - totalNotes: Highscore.tallies.totalNotes, + sick: talliesToUse.sick, + good: talliesToUse.good, + bad: talliesToUse.bad, + shit: talliesToUse.shit, + missed: talliesToUse.missed, + combo: talliesToUse.combo, + maxCombo: talliesToUse.maxCombo, + totalNotesHit: talliesToUse.totalNotesHit, + totalNotes: talliesToUse.totalNotes, }, accuracy: Highscore.tallies.totalNotesHit / Highscore.tallies.totalNotes, }, From 14869b937329e455049595d905b95ce0b830333f Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 6 Apr 2024 02:08:10 -0400 Subject: [PATCH 041/124] Also disable highscores in botplay --- 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 2c8d72293..474caf031 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2786,7 +2786,7 @@ class PlayState extends MusicBeatSubState // adds current song data into the tallies for the level (story levels) Highscore.talliesLevel = Highscore.combineTallies(Highscore.tallies, Highscore.talliesLevel); - if (!isPracticeMode && Save.instance.isSongHighScore(currentSong.id, currentDifficulty, data)) + if (!isPracticeMode && !isBotPlayMode && Save.instance.isSongHighScore(currentSong.id, currentDifficulty, data)) { Save.instance.setSongScore(currentSong.id, currentDifficulty, data); #if newgrounds From 09d5370c2ead699969b135c61fd692075d7f72ee Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 6 Apr 2024 02:35:27 -0400 Subject: [PATCH 042/124] Fix an issue where Pico gets stuck blocking after a failed uppercut. --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index e8f4d2d91..c73fd0b0a 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e8f4d2d91c7bd5a922465e7d67a0efb7d7574bd6 +Subproject commit c73fd0b0ab8f904ac22b594afc847be2d10587f4 From 5beb20ec7cb876e6b571c9da7bf53c19ae14647d Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 6 Apr 2024 21:42:18 -0400 Subject: [PATCH 043/124] Fix bug where restarting the song would sometimes crash. --- source/funkin/play/PlayState.hx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 795f493e8..dbae9ed2a 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -834,9 +834,12 @@ class PlayState extends MusicBeatSubState inputSpitter = []; // Reset music properly. - FlxG.sound.music.time = startTimestamp - Conductor.instance.instrumentalOffset; - FlxG.sound.music.pitch = playbackRate; - FlxG.sound.music.pause(); + if (FlxG.sound.music != null) + { + FlxG.sound.music.time = startTimestamp - Conductor.instance.instrumentalOffset; + FlxG.sound.music.pitch = playbackRate; + FlxG.sound.music.pause(); + } if (!overrideMusic) { @@ -852,7 +855,7 @@ class PlayState extends MusicBeatSubState vocals.pause(); vocals.time = 0; - FlxG.sound.music.volume = 1; + if (FlxG.sound.music != null) FlxG.sound.music.volume = 1; vocals.volume = 1; vocals.playerVolume = 1; vocals.opponentVolume = 1; From ea1d123c49531d2f94063b0d4ed39a94b4654849 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 6 Apr 2024 21:42:31 -0400 Subject: [PATCH 044/124] Fixes to Pico Blazin' animations. --- assets | 2 +- source/funkin/play/character/AnimateAtlasCharacter.hx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/assets b/assets index e8f4d2d91..287f8e222 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e8f4d2d91c7bd5a922465e7d67a0efb7d7574bd6 +Subproject commit 287f8e222d00cfd0d24eb79465b7a256bb80318f diff --git a/source/funkin/play/character/AnimateAtlasCharacter.hx b/source/funkin/play/character/AnimateAtlasCharacter.hx index f1dadf3e2..ed58b92b5 100644 --- a/source/funkin/play/character/AnimateAtlasCharacter.hx +++ b/source/funkin/play/character/AnimateAtlasCharacter.hx @@ -192,6 +192,7 @@ class AnimateAtlasCharacter extends BaseCharacter if (!this.mainSprite.hasAnimation(prefix)) { FlxG.log.warn('[ATLASCHAR] Animation ${prefix} not found in Animate Atlas ${_data.assetPath}'); + trace('[ATLASCHAR] Animation ${prefix} not found in Animate Atlas ${_data.assetPath}'); continue; } animations.set(anim.name, anim); From b464f51ba2572ce57d01caedde7cb0fa03789c77 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 6 Apr 2024 22:38:32 -0400 Subject: [PATCH 045/124] Fix an issue where a missing stage would cause a crash (rather than an error popup) --- source/funkin/play/PlayState.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index dbae9ed2a..a5fbb7624 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1551,10 +1551,11 @@ class PlayState extends MusicBeatSubState function loadStage(id:String):Void { currentStage = StageRegistry.instance.fetchEntry(id); - currentStage.revive(); // Stages are killed and props destroyed when the PlayState is destroyed to save memory. if (currentStage != null) { + currentStage.revive(); // Stages are killed and props destroyed when the PlayState is destroyed to save memory. + // Actually create and position the sprites. var event:ScriptEvent = new ScriptEvent(CREATE, false); ScriptEventDispatcher.callEvent(currentStage, event); From 207eedf7b5dc4f9c92fc3c216576fff3858ea262 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 6 Apr 2024 22:38:39 -0400 Subject: [PATCH 046/124] Update assets submodule. --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 287f8e222..6e098afdc 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 287f8e222d00cfd0d24eb79465b7a256bb80318f +Subproject commit 6e098afdcc30c8508afc09bc3e57b502821029ab From 6d374c7af9e0e784bedd1c949b59c5c468b04c3d Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 8 Apr 2024 18:39:51 -0400 Subject: [PATCH 047/124] Fix loading issue tied to -DSONG compile define. --- .vscode/settings.json | 5 ++++ source/funkin/InitState.hx | 33 +++++++++++++++++++++ source/funkin/ui/transition/LoadingState.hx | 1 - 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 13a1862d2..0cca68aab 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -130,6 +130,11 @@ "-DFORCE_DEBUG_VERSION" ] }, + { + "label": "Windows / Debug (Straight to Play - 2hot)", + "target": "windows", + "args": ["-debug", "-DSONG=2hot", "-DFORCE_DEBUG_VERSION"] + }, { "label": "HashLink / Debug (Straight to Play - Bopeebo Normal)", "target": "hl", diff --git a/source/funkin/InitState.hx b/source/funkin/InitState.hx index 6ea77ec18..9b842bc13 100644 --- a/source/funkin/InitState.hx +++ b/source/funkin/InitState.hx @@ -261,6 +261,35 @@ class InitState extends FlxState return; } + // TODO: Rework loading behavior so we don't have to do this. + switch (songId) + { + case 'tutorial' | 'bopeebo' | 'fresh' | 'dadbattle': + Paths.setCurrentLevel('week1'); + PlayStatePlaylist.campaignId = 'week1'; + case 'spookeez' | 'south' | 'monster': + Paths.setCurrentLevel('week2'); + PlayStatePlaylist.campaignId = 'week2'; + case 'pico' | 'philly-nice' | 'blammed': + Paths.setCurrentLevel('week3'); + PlayStatePlaylist.campaignId = 'week3'; + case 'high' | 'satin-panties' | 'milf': + Paths.setCurrentLevel('week4'); + PlayStatePlaylist.campaignId = 'week4'; + case 'cocoa' | 'eggnog' | 'winter-horrorland': + Paths.setCurrentLevel('week5'); + PlayStatePlaylist.campaignId = 'week5'; + case 'senpai' | 'roses' | 'thorns': + Paths.setCurrentLevel('week6'); + PlayStatePlaylist.campaignId = 'week6'; + case 'ugh' | 'guns' | 'stress': + Paths.setCurrentLevel('week7'); + PlayStatePlaylist.campaignId = 'week7'; + case 'darnell' | 'lit-up' | '2hot' | 'blazin': + Paths.setCurrentLevel('weekend1'); + PlayStatePlaylist.campaignId = 'weekend1'; + } + LoadingState.loadPlayState( { targetSong: songData, @@ -283,6 +312,10 @@ class InitState extends FlxState return; } + // TODO: Rework loading behavior so we don't have to do this. + Paths.setCurrentLevel(levelId); + PlayStatePlaylist.campaignId = levelId; + PlayStatePlaylist.playlistSongIds = currentLevel.getSongs(); PlayStatePlaylist.isStoryMode = true; PlayStatePlaylist.campaignScore = 0; diff --git a/source/funkin/ui/transition/LoadingState.hx b/source/funkin/ui/transition/LoadingState.hx index af8798ae2..347190993 100644 --- a/source/funkin/ui/transition/LoadingState.hx +++ b/source/funkin/ui/transition/LoadingState.hx @@ -281,7 +281,6 @@ class LoadingState extends MusicBeatSubState { // TODO: This section is a hack! Redo this later when we have a proper asset caching system. FunkinSprite.preparePurgeCache(); - FunkinSprite.cacheTexture(Paths.image('combo')); FunkinSprite.cacheTexture(Paths.image('healthBar')); FunkinSprite.cacheTexture(Paths.image('menuDesat')); FunkinSprite.cacheTexture(Paths.image('combo')); From e3c3623ad4d6ba66770fa5c177ee14b420206ece Mon Sep 17 00:00:00 2001 From: FabsTheFabs Date: Tue, 9 Apr 2024 05:00:40 +0100 Subject: [PATCH 048/124] update assets submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 09ba7bfd8..9c35ee01c 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 09ba7bfd84167f6a04922e9c6312224c8bcef6cd +Subproject commit 9c35ee01c5305ba04cde618bc224535e56c051fb From 97884021c0ad7fab887611d7971cd189e63df597 Mon Sep 17 00:00:00 2001 From: Mike Welsh Date: Mon, 8 Apr 2024 22:08:24 -0700 Subject: [PATCH 049/124] Fix bad initial save data when no save data present If no save data was present, the game would check for legacy save data in the ninjamuffin99 path to migrate over. This code was incorrectly checking `FlxSave.data == null` to determine if legacy data was present. This caused an empty legacy save being migrated over, resulting in a `volume` of 0 for any new player of the game. --- source/funkin/save/Save.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index af2730ddd..bfbda2a02 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -693,7 +693,7 @@ class Save trace("[SAVE] Checking for legacy save data..."); var legacySave:FlxSave = new FlxSave(); legacySave.bind(SAVE_NAME_LEGACY, SAVE_PATH_LEGACY); - if (legacySave?.data == null) + if (legacySave.isEmpty()) { trace("[SAVE] No legacy save data found."); return null; From dbcbb73338db3dcb3ad758a8d2a1d8f4153db51e Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 9 Apr 2024 15:10:58 -0400 Subject: [PATCH 050/124] Main menu fix and Week 3 train fix --- assets | 2 +- source/funkin/ui/mainmenu/MainMenuState.hx | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/assets b/assets index e8f4d2d91..1a7a0b6cc 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e8f4d2d91c7bd5a922465e7d67a0efb7d7574bd6 +Subproject commit 1a7a0b6cc60dc8131f1651caa7abef0c1944a10c diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index f38db1ccd..ecd67b4da 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -174,6 +174,7 @@ class MainMenuState extends MusicBeatState { FlxG.cameras.reset(new FunkinCamera()); FlxG.camera.follow(camFollow, null, 0.06); + FlxG.camera.snapToTarget(); } function createMenuItem(name:String, atlas:String, callback:Void->Void, fireInstantly:Bool = false):Void From eb752c242f3c59d275640bacc875e99b80c5d5e5 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 9 Apr 2024 20:13:59 -0400 Subject: [PATCH 051/124] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 1a7a0b6cc..bef67ec4b 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 1a7a0b6cc60dc8131f1651caa7abef0c1944a10c +Subproject commit bef67ec4b3c834416e73ce4e7c3e7128c5d7de63 From 1058181cc93a609363de5faf8ae5bcc69c5478cf Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 9 Apr 2024 20:25:33 -0400 Subject: [PATCH 052/124] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 84c3c7fef..0782d868b 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 84c3c7fef411c616e558b5b497f70c106adc11d1 +Subproject commit 0782d868ba8379d699ef9ab9547c3507580628e2 From 6f5c3a043f87152c813ea0915629c7224cd67e01 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 10 Apr 2024 14:45:07 -0400 Subject: [PATCH 053/124] Fix crash caused when game tries to render disposed sprites during a Sticker transition. --- source/funkin/graphics/FunkinCamera.hx | 6 +++++- source/funkin/play/PlayState.hx | 2 +- .../funkin/ui/debug/charting/ChartEditorState.hx | 4 ++-- source/funkin/ui/freeplay/FreeplayState.hx | 2 +- source/funkin/ui/mainmenu/MainMenuState.hx | 2 +- source/funkin/ui/options/ControlsMenu.hx | 2 +- source/funkin/ui/options/PreferencesMenu.hx | 2 +- source/funkin/ui/transition/StickerSubState.hx | 14 +++++++++----- 8 files changed, 21 insertions(+), 13 deletions(-) diff --git a/source/funkin/graphics/FunkinCamera.hx b/source/funkin/graphics/FunkinCamera.hx index 90861c263..8c8a1c9a7 100644 --- a/source/funkin/graphics/FunkinCamera.hx +++ b/source/funkin/graphics/FunkinCamera.hx @@ -47,9 +47,13 @@ class FunkinCamera extends FlxCamera public var shouldDraw:Bool = true; - public function new(x:Int = 0, y:Int = 0, width:Int = 0, height:Int = 0, zoom:Float = 0) + // Used to identify the camera during debugging. + final id:String = 'unknown'; + + public function new(id:String = 'unknown', x:Int = 0, y:Int = 0, width:Int = 0, height:Int = 0, zoom:Float = 0) { super(x, y, width, height, zoom); + this.id = id; bgTexture = pickTexture(width, height); bgBitmap = FixedBitmapData.fromTexture(bgTexture); bgFrame = new FlxFrame(new FlxGraphic('', null)); diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 795f493e8..486eb742c 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -1467,7 +1467,7 @@ class PlayState extends MusicBeatSubState */ function initCameras():Void { - camGame = new FunkinCamera(); + camGame = new FunkinCamera('playStateCamGame'); camGame.bgColor = BACKGROUND_COLOR; // Show a pink background behind the stage. camHUD = new FlxCamera(); camHUD.bgColor.alpha = 0; // Show the game scene behind the camera. diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index dba1a7e55..78222570a 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -2091,7 +2091,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState loadPreferences(); - uiCamera = new FunkinCamera(); + uiCamera = new FunkinCamera('chartEditorUI'); FlxG.cameras.reset(uiCamera); buildDefaultSongData(); @@ -5382,7 +5382,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Kill and replace the UI camera so it doesn't get destroyed during the state transition. uiCamera.kill(); FlxG.cameras.remove(uiCamera, false); - FlxG.cameras.reset(new FunkinCamera()); + FlxG.cameras.reset(new FunkinCamera('chartEditorUI2')); this.persistentUpdate = false; this.persistentDraw = false; diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index dc1f164ea..6fdc7e309 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -513,7 +513,7 @@ class FreeplayState extends MusicBeatSubState // var swag:Alphabet = new Alphabet(1, 0, 'swag'); - var funnyCam:FunkinCamera = new FunkinCamera(0, 0, FlxG.width, FlxG.height); + var funnyCam:FunkinCamera = new FunkinCamera('freeplayFunny', 0, 0, FlxG.width, FlxG.height); funnyCam.bgColor = FlxColor.TRANSPARENT; FlxG.cameras.add(funnyCam); diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index ecd67b4da..0e444782c 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -172,7 +172,7 @@ class MainMenuState extends MusicBeatState function resetCamStuff() { - FlxG.cameras.reset(new FunkinCamera()); + FlxG.cameras.reset(new FunkinCamera('mainMenu')); FlxG.camera.follow(camFollow, null, 0.06); FlxG.camera.snapToTarget(); } diff --git a/source/funkin/ui/options/ControlsMenu.hx b/source/funkin/ui/options/ControlsMenu.hx index 62ae4b1a9..dd7d5ff38 100644 --- a/source/funkin/ui/options/ControlsMenu.hx +++ b/source/funkin/ui/options/ControlsMenu.hx @@ -48,7 +48,7 @@ class ControlsMenu extends funkin.ui.options.OptionsState.Page { super(); - menuCamera = new FunkinCamera(); + menuCamera = new FunkinCamera('controlsMenu'); FlxG.cameras.add(menuCamera, false); menuCamera.bgColor = 0x0; camera = menuCamera; diff --git a/source/funkin/ui/options/PreferencesMenu.hx b/source/funkin/ui/options/PreferencesMenu.hx index c23c3f165..783aef0ba 100644 --- a/source/funkin/ui/options/PreferencesMenu.hx +++ b/source/funkin/ui/options/PreferencesMenu.hx @@ -21,7 +21,7 @@ class PreferencesMenu extends Page { super(); - menuCamera = new FunkinCamera(); + menuCamera = new FunkinCamera('prefMenu'); FlxG.cameras.add(menuCamera, false); menuCamera.bgColor = 0x0; camera = menuCamera; diff --git a/source/funkin/ui/transition/StickerSubState.hx b/source/funkin/ui/transition/StickerSubState.hx index 0b5e16f97..e5abef872 100644 --- a/source/funkin/ui/transition/StickerSubState.hx +++ b/source/funkin/ui/transition/StickerSubState.hx @@ -247,10 +247,6 @@ class StickerSubState extends MusicBeatSubState FlxTransitionableState.skipNextTransIn = true; FlxTransitionableState.skipNextTransOut = true; - // TODO: Rework this asset caching stuff - FunkinSprite.preparePurgeCache(); - FunkinSprite.purgeCache(); - // I think this grabs the screen and puts it under the stickers? // Leaving this commented out rather than stripping it out because it's cool... /* @@ -265,7 +261,15 @@ class StickerSubState extends MusicBeatSubState // FlxG.addChildBelowMouse(dipshit); */ - FlxG.switchState(() -> targetState(this)); + FlxG.switchState(() -> { + // TODO: Rework this asset caching stuff + // NOTE: This has to come AFTER the state switch, + // otherwise the game tries to render destroyed sprites! + FunkinSprite.preparePurgeCache(); + FunkinSprite.purgeCache(); + + return targetState(this); + }); } }); }); From 5e7b417d6f8dfcdea303b0d4e4e58b328027e9d6 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 12 Apr 2024 14:44:01 -0400 Subject: [PATCH 054/124] Remove Kickstarter link from credits. --- assets | 2 +- source/funkin/ui/credits/CreditsDataHandler.hx | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/assets b/assets index 1a7a0b6cc..40d946207 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 1a7a0b6cc60dc8131f1651caa7abef0c1944a10c +Subproject commit 40d946207aa14b996b152800f285f94b7a679ba4 diff --git a/source/funkin/ui/credits/CreditsDataHandler.hx b/source/funkin/ui/credits/CreditsDataHandler.hx index 86afdafd1..1294dd73a 100644 --- a/source/funkin/ui/credits/CreditsDataHandler.hx +++ b/source/funkin/ui/credits/CreditsDataHandler.hx @@ -57,10 +57,6 @@ class CreditsDataHandler {line: 'KawaiSprite'}, {line: 'evilsk8r'}, ] - }, - { - header: 'Kickstarter Backers', - appendBackers: true } ] }; @@ -68,11 +64,11 @@ class CreditsDataHandler public static function fetchBackerEntries():Array { - // TODO: Replace this with a web request. + // TODO: Implement a web request. // We can't just grab the current Kickstarter data and include it in builds, // because we don't want to deadname people who haven't logged into the portal yet. // It can be async and paginated for performance! - return ['See the list of backers at $BACKER_PUBLIC_URL.']; + return []; } #if HARDCODED_CREDITS From bc0af9ae9ffd0c0b1eb9ee1aa24e358ed7fd15b6 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Sun, 14 Apr 2024 03:01:07 -0400 Subject: [PATCH 055/124] temp enabling fps --- source/Main.hx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/Main.hx b/source/Main.hx index f4c5d9eb2..7037bf390 100644 --- a/source/Main.hx +++ b/source/Main.hx @@ -113,6 +113,8 @@ class Main extends Sprite addChild(game); + addChild(fpsCounter); + #if hxcpp_debug_server trace('hxcpp_debug_server is enabled! You can now connect to the game with a debugger.'); #else From 7644ce1019e75fb1d14ed7b8d1fc6686b282af60 Mon Sep 17 00:00:00 2001 From: Hazel Date: Sun, 14 Apr 2024 23:49:41 +0200 Subject: [PATCH 056/124] feat: ci parallelization, linux builds, ci refactoring (#484) * first linux build attempt * linux deps! * hxcodec dependencies * build timeouts * reup hxcpp cache every time by default gh actions will not update caches on cache hit. since the hxcpp cache grows with compiles, that's not what we want here. since we *do* need the files newly compiled. * ci speed test * group runners by purpose * REFACTOR CI. IT WAS NEEDED * smol changies * second attempt at libc * fix any format issues * it's 1:50am * migrate away from gacts/run-and-post-run@v1 * apt does not have a stable cli interface. use with caution in scripts * first attempt at libffi6 * second attempt at libffi6 * fuck that * sigh * html5 also needs new libc * make sure rerunning ln -s doesn't fail the build * desperate attempt * arc attempt * arc, ii * ci * apt-GET * who needs safeguards anyway * clean ci build * debug time * lots of connectivity debugging * :pleading_face: * natesales/q * i'm not very smart * debug hard? * whose traceroute? * pls * ... * we go even newer * merge moment * haxelib maybe * debug info * :pleading_face: * lower mtu runner? * libffi my beloved * no multiline env? * smol buggy * non docker-aware vars * i love bash * builds hopefully go nyoom * forgor native dep * [skip ci] meow * convenient typo * sigh * [skip ci] waow * [skip ci] docker is hard * i don't understand docker tbh * debuggering * docking * small amount of dumb but still doesn't explain why curl doesn't curl * just vsc things * ca certs issue? * please this has to be the one * find -type d fail, laugh at this user * too eepy * im not that smart am i * attempt to run containerized from docker base image * [skip-ci] some more docking * might as well try * :pleaading_face: * ? * ! * idea * sigh * i give in * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa * :pleading_face: * hopefully fix hxcpp cache * [skip ci] a little dx never hurt anyone * try removing things until it breaks * welp that was easy * not-docker-friendly paths in non-docker env, etc. you get the point * more sane default cache size * finishing touches * welp * mounted volume * no systemd, got it * more failproof dockerfile * does this not have ossh * haxelib master * hopefully final docker build * bob the builder * docking :3 * image cleanup * github moment * okay mayb * gotta set it up first * i have an idea * hope we ready * :pleading_face: * fuck * sigh * trigger build on new image * no comment * global hxcpp, first idea * yikes * hxcpp oopsy * code dupe * more code dupe * lint * increase hxcpp cache size on native builds as well * buttons :3 * oops * forgor to export env variable * aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --- .github/actions/setup-haxe/action.yml | 135 ++++++++++++++ .github/actions/setup-haxeshit/action.yml | 55 ------ .github/actions/upload-itch/action.yml | 142 ++++++++++---- .github/workflows/build-docker-image.yml | 53 ++++++ .github/workflows/build-game.yml | 125 +++++++++++++ .github/workflows/build-shit.yml | 136 -------------- .github/workflows/cancel-merged-branches.yml | 45 ++--- build/Dockerfile | 185 +++++++++++++++++++ 8 files changed, 633 insertions(+), 243 deletions(-) create mode 100644 .github/actions/setup-haxe/action.yml delete mode 100644 .github/actions/setup-haxeshit/action.yml create mode 100644 .github/workflows/build-docker-image.yml create mode 100644 .github/workflows/build-game.yml delete mode 100644 .github/workflows/build-shit.yml create mode 100644 build/Dockerfile diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml new file mode 100644 index 000000000..54db9bf79 --- /dev/null +++ b/.github/actions/setup-haxe/action.yml @@ -0,0 +1,135 @@ +name: setup-haxeshit +description: "sets up haxe shit, using HMM!" + +inputs: + haxe: + description: 'Version of haxe to install' + required: true + default: '4.3.4' + hxcpp-cache: + description: 'Whether to use a shared hxcpp compile cache' + required: true + default: 'true' + hxcpp-cache-path: + description: 'Path to create hxcpp cache in' + required: true + default: ${{ runner.temp }}/hxcpp_cache + targets: + description: 'Targets we plan to compile to. Installs native dependencies needed.' + required: true + +runs: + using: "composite" + steps: + + - name: Setup timers + shell: bash + run: | + echo "TIMER_HAXE=$(date +%s)" >> "$GITHUB_ENV" + + - name: Install Haxe + uses: funkincrew/ci-haxe@v3.1.0 + with: + haxe-version: ${{ inputs.haxe }} + + - name: Install native dependencies + if: ${{ runner.os == 'Linux' }} + shell: bash + run: | + ls -lah /usr/lib/x86_64-linux-gnu/ + apt-get update + apt-get install -y \ + g++ \ + libx11-dev libxi-dev libxext-dev libxinerama-dev libxrandr-dev \ + libgl-dev libgl1-mesa-dev \ + libasound2-dev + ln -s /usr/lib/x86_64-linux-gnu/libffi.so.8 /usr/lib/x86_64-linux-gnu/libffi.so.6 || true + - name: Install linux-specific dependencies + if: ${{ runner.os == 'Linux' && contains(inputs.targets, 'linux') }} + shell: bash + run: | + apt-get install -y libvlc-dev libvlccore-dev + + - name: Config haxelib + shell: bash + run: | + echo "TIMER_HAXELIB=$(date +%s)" >> "$GITHUB_ENV" + haxelib --debug --never install haxelib 4.1.0 --global + haxelib --debug --never deleterepo || true + haxelib --debug --never newrepo + echo "HAXEPATH=$(haxelib config)" >> "$GITHUB_ENV" + haxelib --debug --never git haxelib https://github.com/HaxeFoundation/haxelib.git master + haxelib --debug --global install hmm + echo "TIMER_DEPS=$(date +%s)" >> "$GITHUB_ENV" + + - name: Restore cached dependencies + id: cache-hmm + uses: actions/cache@v4 + with: + path: .haxelib + key: haxe-hmm-${{ runner.os }}-${{ hashFiles('**/hmm.json') }} + + - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} + name: Install dependencies + shell: bash + run: | + haxelib --debug --global run hmm install + echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" + + # by default use a shared hxcpp cache + - if: ${{ inputs.hxcpp-cache == 'true' }} + name: Restore hxcpp cache + uses: actions/cache@v4 + with: + path: ${{ inputs.hxcpp-cache-path }} + key: haxe-hxcpp-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }} + restore-keys: haxe-hxcpp-${{ runner.os }}-${{ github.ref_name }} + # export env for it to reuse in builds + - if: ${{ inputs.hxcpp-cache == 'true' }} + name: Persist env for hxcpp cache + shell: bash + run: | + echo "HXCPP_COMPILE_CACHE=${{ inputs.hxcpp-cache-path }}" >> "$GITHUB_ENV" + echo 'HXCPP_CACHE_MB="4096"' >> "$GITHUB_ENV" + + # if it's explicitly disabled, still cache export/ since that then contains the builds + - if: ${{ inputs.hxcpp-cache != 'true' }} + name: Restore export cache + uses: actions/cache@v4 + with: + path: ${{ inputs.hxcpp-cache-path }} + key: haxe-export-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }} + restore-keys: haxe-export-${{ runner.os }}-${{ github.ref_name }} + + - name: Print debug info + shell: bash + run: | + cat << EOF + runner: + kernel: $(uname -a) + haxe: + version: $(haxe -version) + which: $(which haxe) + haxepath: $HAXEPATH + took: $((TIMER_HAXELIB - TIMER_HAXE))s + haxelib: + version: $(haxelib version) + which: $(which haxelib) + local: + config: $(haxelib config) + path: $(haxelib path haxelib || true) + global + config: $(haxelib config --global) + path: $(haxelib path haxelib --global || true) + system + version: $(haxelib --system version) + local: + config: $(haxelib --system config) + global: + config: $(haxelib --system config --global) + took: $((TIMER_DEPS - TIMER_HAXELIB))s + deps: + took: $((TIMER_DONE - TIMER_DEPS))s + hxcpp_cache: | + $(haxelib run hxcpp cache list || true) + EOF diff --git a/.github/actions/setup-haxeshit/action.yml b/.github/actions/setup-haxeshit/action.yml deleted file mode 100644 index 236d29944..000000000 --- a/.github/actions/setup-haxeshit/action.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: setup-haxeshit -description: "sets up haxe shit, using HMM!" -runs: - using: "composite" - steps: - - name: Install Haxe lol - uses: funkincrew/ci-haxe@v3.1.0 - with: - haxe-version: 4.3.3 - - name: Config haxelib - run: | - haxelib --never install haxelib 4.1.0 --global - haxelib --never deleterepo || true - haxelib --never newrepo - echo "HAXEPATH=$(haxelib config)" >> "$GITHUB_ENV" - haxelib --never git haxelib https://github.com/HaxeFoundation/haxelib.git master - shell: bash - - name: Gather debug info - run: | - cat << EOF >> "$GITHUB_STEP_SUMMARY" - ## haxe - - version: \`$(haxe -version)\` - - exe: \`$(which haxe)\` - ## haxelib - - version: \`$(haxelib version)\` - - exe: \`$(which haxelib)\` - - path: \`$HAXEPATH\` - ### local - - config: \`$(haxelib config)\` - - path: \`$(haxelib path haxelib || true)\` - ### global - - config: \`$(haxelib config --global)\` - - path: \`$(haxelib path haxelib --global || true)\` - ### system - - version: \`$(haxelib --system version)\` - - local: \`$(haxelib --system config)\` - - global: \`$(haxelib --system config --global)\` - EOF - shell: bash - - name: Install hmm - # hmm only supports global installs - run: | - haxelib --global install hmm - shell: bash - - name: Restore cached dependencies - id: cache-hmm - uses: actions/cache@v4 - with: - path: .haxelib - key: ${{ runner.os }}-hmm-${{ hashFiles('**/hmm.json') }} - - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} - name: hmm install - run: | - haxelib --global run hmm install - shell: bash diff --git a/.github/actions/upload-itch/action.yml b/.github/actions/upload-itch/action.yml index 2f7d3027d..fb049efc9 100644 --- a/.github/actions/upload-itch/action.yml +++ b/.github/actions/upload-itch/action.yml @@ -1,44 +1,124 @@ name: upload-itch description: "installs Butler, and uploads to itch.io!" + inputs: butler-key: description: "Butler API secret key" required: true + itch-repo: + description: "Where to upload the game to" + required: true + default: "ninja-muffin24/funkin-secret" build-dir: description: "Directory of the game build" - required: true + required: false target: - description: "Target (html5, win, linux, mac)" + description: "Target (html5, windows, linux, macos)" required: true + runs: using: "composite" steps: - - name: Install butler Windows - if: runner.os == 'Windows' - run: | - curl -L -o butler.zip https://broth.itch.ovh/butler/windows-amd64/LATEST/archive/default - 7z x butler.zip - ./butler -v - shell: bash - - name: Install butler Mac - if: runner.os == 'macOS' - run: | - curl -L -o butler.zip https://broth.itch.ovh/butler/darwin-amd64/LATEST/archive/default - unzip butler.zip - ./butler -V - shell: bash - - name: Install butler Linux - if: runner.os == 'Linux' - run: | - curl -L -o butler.zip https://broth.itch.ovh/butler/linux-amd64/LATEST/archive/default - unzip butler.zip - chmod +x butler - ./butler -V - shell: bash - - name: Upload game to itch.io - env: - BUTLER_API_KEY: ${{inputs.butler-key}} - run: | - ./butler login - ./butler push ${{inputs.build-dir}} ninja-muffin24/funkin-secret:${{inputs.target}}-${GITHUB_REF_NAME} - shell: bash + + # RUNNER_OS = Windows | macOS | Linux + # TARGET_BUILD = windows | macos | linux + # TARGET_ITCH = win | macos | linux + # TARGET_BUTLER_DOWNLOAD = windows-amd64 | darwin-amd64 | linux-amd64 + - name: Setup variables + shell: bash + run: | + TARGET_OS=${{ inputs.target }} + RUNNER=${RUNNER_OS@L} + TARGET=${TARGET_OS@L} + case "$TARGET" in + "windows") + TARGET_ITCH=win + ;; + *) + TARGET_ITCH=$TARGET + ;; + esac + case "$RUNNER" in + "macos") + OS_NODE=darwin + ;; + *) + OS_NODE=$RUNNER + ;; + esac + BUTLER_PATH=$RUNNER_TEMP/butler + + echo BUILD_DIR="export/release/$TARGET/bin" >> "$GITHUB_ENV" + echo ITCH_TAG=${{ inputs.itch-repo }}:$TARGET_ITCH-$GITHUB_REF_NAME >> "$GITHUB_ENV" + echo OS_AND_ARCH=$OS_NODE-amd64 >> "$GITHUB_ENV" + echo BUTLER_API_KEY=${{ inputs.butler-key }} >> "$GITHUB_ENV" + echo BUTLER_INSTALL_PATH=$BUTLER_PATH >> "$GITHUB_ENV" + echo TIMER_BUTLER=$(date +%s) >> "$GITHUB_ENV" + echo TARGET_ITCH=$TARGET_ITCH >> "$GITHUB_ENV" + + echo "$BUTLER_PATH" >> "$GITHUB_PATH" + + - name: Get latest butler version + shell: bash + run: | + LATEST=$(curl -sfL https://broth.itch.ovh/butler/$OS_AND_ARCH/LATEST) + echo BUTLER_LATEST=$LATEST >> "$GITHUB_ENV" + + command -v butler \ + && echo BUTLER_CURRENT=$(butler -V 2>&1 | cut -d ',' -f 1) >> "$GITHUB_ENV" \ + || echo BUTLER_CURRENT=none >> "$GITHUB_ENV" + + - name: Try to get butler from cache + id: cache-butler + uses: actions/cache@v4 + with: + path: ${{ env.BUTLER_INSTALL_PATH }} + key: butler-${{ runner.os }}-${{ env.BUTLER_LATEST }} + + - if: steps.cache-butler.outputs.cache-hit == 'true' + name: Make sure butler is executable + shell: bash + run: | + chmod +x $BUTLER_INSTALL_PATH/butler + + - if: steps.cache-butler.outputs.cache-hit != 'true' + name: Install butler + shell: bash + run: | + mkdir -p $BUTLER_INSTALL_PATH + cd $BUTLER_INSTALL_PATH + + curl -L -o butler.zip https://broth.itch.ovh/butler/$OS_AND_ARCH/LATEST/archive/default + unzip butler.zip + chmod +x butler + + - name: Upload game to itch.io + shell: bash + run: | + echo "TIMER_UPLOAD=$(date +%s)" >> "$GITHUB_ENV" + butler login + butler push $BUILD_DIR $ITCH_TAG + echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" + + - name: Print debug info + shell: bash + run: | + cat << EOF + butler: + version: $( + if [[ "$BUTLER_CURRENT" == "$BUTLER_LATEST" ]] + then + echo $BUTLER_CURRENT + else + echo $BUTLER_CURRENT -> $BUTLER_LATEST + fi + ) + install: + took: $(($TIMER_UPLOAD-$TIMER_BUTLER))s + upload: + tag: $TARGET_ITCH/$GITHUB_REF_NAME + took: $(($TIMER_DONE-$TIMER_UPLOAD))s + EOF + cat << EOF >> "$GITHUB_STEP_SUMMARY" + ### open in launcher: [$TARGET_ITCH/$GITHUB_REF_NAME](https://run.funkin.me/$TARGET_ITCH/$GITHUB_REF_NAME) + EOF diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml new file mode 100644 index 000000000..15c9e5582 --- /dev/null +++ b/.github/workflows/build-docker-image.yml @@ -0,0 +1,53 @@ +name: Create and publish Docker image + +on: + workflow_dispatch: + push: + paths: + - '**/Dockerfile' + - '.github/workflows/build-docker-image.yml' + +jobs: + build-and-push-image: + runs-on: build-set + permissions: + contents: read + packages: write + + steps: + - name: Get checkout token + uses: actions/create-github-app-token@v1 + id: app_token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.APP_PEM }} + owner: ${{ github.repository_owner }} + + - name: Checkout repo + uses: funkincrew/ci-checkout@v6 + with: + submodules: false + token: ${{ steps.app_token.outputs.token }} + + - name: Log into GitHub Container Registry + uses: docker/login-action@v3.1.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push Docker image + uses: docker/build-push-action@v5.3.0 + with: + context: ./build + push: true + tags: | + ghcr.io/funkincrew/build-dependencies:latest + ghcr.io/funkincrew/build-dependencies:${{ github.sha }} + labels: | + org.opencontainers.image.description=precooked haxe build-dependencies + org.opencontainers.image.revision=${{ github.sha }} + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.title=${{ github.repository_owner }}/build-dependencies + org.opencontainers.image.url=https://github.com/${{ github.repository }} + org.opencontainers.image.version=${{ github.sha }} diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml new file mode 100644 index 000000000..3bfea20f2 --- /dev/null +++ b/.github/workflows/build-game.yml @@ -0,0 +1,125 @@ +name: Build and Upload nightly game builds + +on: + workflow_dispatch: + push: + paths-ignore: + - '**/Dockerfile' + - '.github/workflows/build-docker-image.yml' + +jobs: + + build-game-on-host: + strategy: + matrix: + include: + - target: windows + - target: macos + runs-on: + - ${{ matrix.target }} + defaults: + run: + shell: bash + + steps: + - name: Make git happy + if: ${{ matrix.target == 'macos' }} + run: | + git config --global --add safe.directory $GITHUB_WORKSPACE + + - name: Get checkout token + uses: actions/create-github-app-token@v1 + id: app_token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.APP_PEM }} + owner: ${{ github.repository_owner }} + + - name: Checkout repo + uses: funkincrew/ci-checkout@v6 + with: + submodules: 'recursive' + token: ${{ steps.app_token.outputs.token }} + + - name: Setup build environment + uses: ./.github/actions/setup-haxe + + - name: Build game + if: ${{ matrix.target == 'windows' }} + run: | + haxelib run lime build windows -v -release -DGITHUB_BUILD + timeout-minutes: 120 + - name: Build game + if: ${{ matrix.target != 'windows' }} + run: | + haxelib run lime build ${{ matrix.target }} -v -release --times -DGITHUB_BUILD + timeout-minutes: 120 + + - name: Upload build artifacts + uses: ./.github/actions/upload-itch + with: + butler-key: ${{ secrets.BUTLER_API_KEY}} + target: ${{ matrix.target }} + + build-game-in-container: + runs-on: build-set + container: ghcr.io/funkincrew/build-dependencies:latest + strategy: + matrix: + include: + - target: linux + - target: html5 + defaults: + run: + shell: bash + + steps: + - name: Get checkout token + uses: actions/create-github-app-token@v1 + id: app_token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.APP_PEM }} + owner: ${{ github.repository_owner }} + + - name: Checkout repo + uses: funkincrew/ci-checkout@v6 + with: + submodules: 'recursive' + token: ${{ steps.app_token.outputs.token }} + + - name: Config haxelib + run: | + haxelib --never newrepo + echo "HAXEPATH=$(haxelib config)" >> "$GITHUB_ENV" + + - name: Restore cached dependencies + id: cache-hmm + uses: actions/cache@v4 + with: + path: .haxelib + key: haxe-hmm-${{ runner.os }}-${{ hashFiles('**/hmm.json') }} + + - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} + name: Install dependencies + run: | + haxelib --global run hmm install + + - if: ${{ matrix.target != 'html5' }} + name: Restore hxcpp cache + uses: actions/cache@v4 + with: + path: /usr/share/hxcpp + key: haxe-hxcpp-${{ runner.os }}-${{ github.ref_name }}-${{ github.sha }} + restore-keys: haxe-hxcpp-${{ runner.os }}-${{ github.ref_name }} + + - name: Build game + run: | + haxelib run lime build ${{ matrix.target }} -v -release --times -DGITHUB_BUILD + timeout-minutes: 120 + + - name: Upload build artifacts + uses: ./.github/actions/upload-itch + with: + butler-key: ${{ secrets.BUTLER_API_KEY}} + target: ${{ matrix.target }} diff --git a/.github/workflows/build-shit.yml b/.github/workflows/build-shit.yml deleted file mode 100644 index 4d674f025..000000000 --- a/.github/workflows/build-shit.yml +++ /dev/null @@ -1,136 +0,0 @@ -name: build-upload -on: - workflow_dispatch: - push: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - create-nightly-html5: - runs-on: [self-hosted, linux] - container: ubuntu:23.10 - steps: - - name: Install tools missing in container - run: | - apt update - apt install -y sudo git curl unzip - - name: Fix git config on posix runner - # this can't be {{ github.workspace }} because that's not docker-aware - run: | - git config --global --add safe.directory $GITHUB_WORKSPACE - - name: Get checkout token - uses: actions/create-github-app-token@v1 - id: app_token - with: - app-id: ${{ vars.APP_ID }} - private-key: ${{ secrets.APP_PEM }} - owner: ${{ github.repository_owner }} - - name: Checkout repo - uses: funkincrew/ci-checkout@v6 - with: - submodules: 'recursive' - token: ${{ steps.app_token.outputs.token }} - - name: Install Haxe, dependencies - uses: ./.github/actions/setup-haxeshit - - name: Install native dependencies - run: | - apt install -y \ - libx11-dev libxi-dev libxext-dev libxinerama-dev libxrandr-dev \ - libgl-dev libgl1-mesa-dev \ - libasound2-dev - - name: Build game - run: | - haxelib run lime build html5 -release --times -DGITHUB_BUILD - - name: Upload build artifacts - uses: ./.github/actions/upload-itch - with: - butler-key: ${{ secrets.BUTLER_API_KEY}} - build-dir: export/release/html5/bin - target: html5 - create-nightly-win: - runs-on: [self-hosted, windows] - defaults: - run: - shell: bash - steps: - - name: Get checkout token - uses: actions/create-github-app-token@v1 - id: app_token - with: - app-id: ${{ vars.APP_ID }} - private-key: ${{ secrets.APP_PEM }} - owner: ${{ github.repository_owner }} - - name: Checkout repo - uses: funkincrew/ci-checkout@v6 - with: - submodules: 'recursive' - token: ${{ steps.app_token.outputs.token }} - - name: Install Haxe, dependencies - uses: ./.github/actions/setup-haxeshit - - name: Setup build cache - run: | - mkdir -p ${{ runner.temp }}/hxcpp_cache - - name: Restore build cache - id: cache-build-win - uses: actions/cache@v4 - with: - path: | - export - ${{ runner.temp }}/hxcpp_cache - key: ${{ runner.os }}-build-win-${{ github.ref_name }} - - name: Build game - run: | - haxelib run lime build windows -v -release -DGITHUB_BUILD - env: - HXCPP_COMPILE_CACHE: "${{ runner.temp }}\\hxcpp_cache" - - name: Upload build artifacts - uses: ./.github/actions/upload-itch - with: - butler-key: ${{ secrets.BUTLER_API_KEY }} - build-dir: export/release/windows/bin - target: win - create-nightly-mac: - runs-on: [self-hosted, macos] - steps: - - name: Fix git config on posix runner - # this can't be {{ github.workspace }} because that's not docker-aware - run: | - git config --global --add safe.directory $GITHUB_WORKSPACE - - name: Get checkout token - uses: actions/create-github-app-token@v1 - id: app_token - with: - app-id: ${{ vars.APP_ID }} - private-key: ${{ secrets.APP_PEM }} - owner: ${{ github.repository_owner }} - - name: Checkout repo - uses: funkincrew/ci-checkout@v6 - with: - submodules: 'recursive' - token: ${{ steps.app_token.outputs.token }} - - name: Install Haxe, dependencies - uses: ./.github/actions/setup-haxeshit - - name: Setup build cache - run: | - mkdir -p ${{ runner.temp }}/hxcpp_cache - - name: Restore build cache - id: cache-build-win - uses: actions/cache@v4 - with: - path: | - export - ${{ runner.temp }}/hxcpp_cache - key: ${{ runner.os }}-build-mac-${{ github.ref_name }} - - name: Build game - run: | - haxelib run lime build macos -release --times -DGITHUB_BUILD - env: - HXCPP_COMPILE_CACHE: "${{ runner.temp }}/hxcpp_cache" - - name: Upload build artifacts - uses: ./.github/actions/upload-itch - with: - butler-key: ${{ secrets.BUTLER_API_KEY}} - build-dir: export/release/macos/bin - target: macos diff --git a/.github/workflows/cancel-merged-branches.yml b/.github/workflows/cancel-merged-branches.yml index 84e3bedc9..f66f9647b 100644 --- a/.github/workflows/cancel-merged-branches.yml +++ b/.github/workflows/cancel-merged-branches.yml @@ -1,35 +1,38 @@ -name: cancel-merged-branches +name: Cancel queued workflows on PR merge + on: pull_request: types: - closed jobs: + cancel_stuff: if: github.event.pull_request.merged == true - runs-on: ubuntu-latest + runs-on: build-set permissions: actions: write + steps: - - uses: actions/github-script@v7 - id: cancel-runs - with: - result-encoding: string - retries: 3 - script: | - let branch_workflows = await github.rest.actions.listWorkflowRuns({ + - name: Cancel queued workflows for ${{ github.event.pull_request.head.ref }} + uses: actions/github-script@v7 + with: + result-encoding: string + retries: 3 + script: | + let branch_workflows = await github.rest.actions.listWorkflowRuns({ + owner: context.repo.owner, + repo: context.repo.repo, + workflow_id: "build-shit.yml", + status: "queued", + branch: "${{ github.event.pull_request.head.ref }}" + }); + let runs = branch_workflows.data.workflow_runs; + runs.forEach((run) => { + github.rest.actions.cancelWorkflowRun({ owner: context.repo.owner, repo: context.repo.repo, - workflow_id: "build-shit.yml", - status: "queued", - branch: "${{ github.event.pull_request.head.ref }}" + run_id: run.id }); - let runs = branch_workflows.data.workflow_runs; - runs.forEach((run) => { - github.rest.actions.cancelWorkflowRun({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: run.id - }); - }); - console.log(runs); + }); + console.log(runs); diff --git a/build/Dockerfile b/build/Dockerfile new file mode 100644 index 000000000..88b44f7a6 --- /dev/null +++ b/build/Dockerfile @@ -0,0 +1,185 @@ +FROM ubuntu:mantic + +ARG haxe_version=4.3.4 +ARG haxelib_version=4.1.0 +ARG neko_version=2.3.0 + +# prepare runner +ENV GITHUB_HOME="/github/home" + +RUN <> /etc/apt/apt.conf.d/10apt-autoremove +APT::Get::AutomaticRemove "0"; +APT::Get::HideAutoRemove "1"; +EOC + +echo <> /etc/apt/apt.conf.d/80retries +"APT::Acquire::Retries \"10\";" +EOC + +echo <> /etc/apt/apt.conf.d/90assumeyes +"APT::Get::Assume-Yes \"true\";" +EOC +EOF + +# Prepare apt-fast +RUN <> /etc/gitconfig +[safe] + directory = * +EOC + +ssh-keyscan -t rsa,ecdsa,ed25519 github.com >> /etc/ssh/ssh_known_hosts +ssh-keyscan -t rsa,ecdsa,ed25519 ravy.dev >> /etc/ssh/ssh_known_hosts +EOF + +# Haxe native dependencies +RUN < Date: Mon, 15 Apr 2024 19:21:55 -0400 Subject: [PATCH 057/124] Fix the saturation on the main menu background. --- source/funkin/ui/mainmenu/MainMenuState.hx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index 3bdc2dfe6..1a4686c5b 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -58,7 +58,11 @@ class MainMenuState extends MusicBeatState persistentDraw = true; var bg = FunkinSprite.create('menuDesat'); + bg.color = 0xFFFDE871; + // This line accounts for the fact that the base color of menuDesat is #EFEFEF. + flixel.util.FlxColorTransformUtil.setOffsets(bg.colorTransform, 30, 27, 13, 0.0); + bg.scrollFactor.x = 0; bg.scrollFactor.y = 0.17; bg.setGraphicSize(Std.int(bg.width * 1.2)); From 43ec72fb9d96743388b05ea0db16dd4f3d62a2e1 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 15 Apr 2024 20:36:38 -0400 Subject: [PATCH 058/124] Ensure playNoteHoldCover doesn't call if note is judged as 'miss' --- source/funkin/play/PlayState.hx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 474caf031..3342a6b69 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2388,13 +2388,6 @@ class PlayState extends MusicBeatSubState // Display the combo meter and add the calculation to the score. popUpScore(note, event.score, event.judgement, event.healthChange); - - if (note.isHoldNote && note.holdNoteSprite != null) - { - playerStrumline.playNoteHoldCover(note.holdNoteSprite); - } - - vocals.playerVolume = 1; } /** @@ -2676,6 +2669,13 @@ class PlayState extends MusicBeatSubState } comboPopUps.displayRating(daRating); if (Highscore.tallies.combo >= 10 || Highscore.tallies.combo == 0) comboPopUps.displayCombo(Highscore.tallies.combo); + + if (daNote.isHoldNote && daNote.holdNoteSprite != null) + { + playerStrumline.playNoteHoldCover(daNote.holdNoteSprite); + } + + vocals.playerVolume = 1; } /** From b553dbd517efcac4c53a6595e0d8b69f22312b7b Mon Sep 17 00:00:00 2001 From: Eric Date: Tue, 16 Apr 2024 13:24:41 -0400 Subject: [PATCH 059/124] Remove janky animation on Freeplay menu. (#488) --- source/funkin/ui/freeplay/FreeplayState.hx | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index ae51ba82a..3ac441212 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -638,14 +638,7 @@ class FreeplayState extends MusicBeatSubState funnyMenu.favIcon.visible = tempSongs[i].isFav; funnyMenu.hsvShader = hsvShader; - if (i < 8) - { - funnyMenu.initJumpIn(Math.min(i, 4), force); - } - else - { - funnyMenu.forcePosition(); - } + funnyMenu.forcePosition(); grpCapsules.add(funnyMenu); } From 2210f8bc183888d755bcd23934a0152e6bd60370 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 16 Apr 2024 18:42:43 -0400 Subject: [PATCH 060/124] Made Blazin' death a separate asset to fix blend modes. --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 1b12b6c66..235d2695c 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 1b12b6c6666af6c84addf5aa0795546aa0d04185 +Subproject commit 235d2695c6de11b0daa49277a602d1045d45e510 From bc0a27c985eb7319cef8d5e9350b6198b1177279 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 16 Apr 2024 18:43:11 -0400 Subject: [PATCH 061/124] Fix references to missing graphics in Freeplay --- .vscode/settings.json | 5 +++++ source/funkin/ui/freeplay/SongMenuItem.hx | 24 +++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index c28bebeab..a8a67245b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -170,6 +170,11 @@ "target": "windows", "args": ["-debug", "-DANIMDEBUG", "-DFORCE_DEBUG_VERSION"] }, + { + "label": "Windows / Debug (Debug hxCodec)", + "target": "windows", + "args": ["-debug", "-DHXC_LIBVLC_LOGGING", "-DFORCE_DEBUG_VERSION"] + }, { "label": "HashLink / Debug (Straight to Animation Editor)", "target": "hl", diff --git a/source/funkin/ui/freeplay/SongMenuItem.hx b/source/funkin/ui/freeplay/SongMenuItem.hx index f8b3d7ac3..f6d85e56e 100644 --- a/source/funkin/ui/freeplay/SongMenuItem.hx +++ b/source/funkin/ui/freeplay/SongMenuItem.hx @@ -46,7 +46,7 @@ class SongMenuItem extends FlxSpriteGroup public var hsvShader(default, set):HSVShader; - var diffRatingSprite:FlxSprite; + // var diffRatingSprite:FlxSprite; public function new(x:Float, y:Float) { @@ -65,13 +65,13 @@ class SongMenuItem extends FlxSpriteGroup var rank:String = FlxG.random.getObject(ranks); ranking = new FlxSprite(capsule.width * 0.84, 30); - ranking.loadGraphic(Paths.image('freeplay/ranks/' + rank)); - ranking.scale.x = ranking.scale.y = realScaled; + // ranking.loadGraphic(Paths.image('freeplay/ranks/' + rank)); + // ranking.scale.x = ranking.scale.y = realScaled; // ranking.alpha = 0.75; - ranking.visible = false; - ranking.origin.set(capsule.origin.x - ranking.x, capsule.origin.y - ranking.y); - add(ranking); - grpHide.add(ranking); + // ranking.visible = false; + // ranking.origin.set(capsule.origin.x - ranking.x, capsule.origin.y - ranking.y); + // add(ranking); + // grpHide.add(ranking); switch (rank) { @@ -81,9 +81,9 @@ class SongMenuItem extends FlxSpriteGroup grayscaleShader = new Grayscale(1); - diffRatingSprite = new FlxSprite(145, 90).loadGraphic(Paths.image('freeplay/diffRatings/diff00')); - diffRatingSprite.shader = grayscaleShader; - diffRatingSprite.origin.set(capsule.origin.x - diffRatingSprite.x, capsule.origin.y - diffRatingSprite.y); + // diffRatingSprite = new FlxSprite(145, 90).loadGraphic(Paths.image('freeplay/diffRatings/diff00')); + // diffRatingSprite.shader = grayscaleShader; + // diffRatingSprite.origin.set(capsule.origin.x - diffRatingSprite.x, capsule.origin.y - diffRatingSprite.y); // TODO: Readd once ratings are fully implemented // add(diffRatingSprite); // grpHide.add(diffRatingSprite); @@ -118,8 +118,8 @@ class SongMenuItem extends FlxSpriteGroup function updateDifficultyRating(newRating:Int):Void { var ratingPadded:String = newRating < 10 ? '0$newRating' : '$newRating'; - diffRatingSprite.loadGraphic(Paths.image('freeplay/diffRatings/diff${ratingPadded}')); - diffRatingSprite.visible = false; + // diffRatingSprite.loadGraphic(Paths.image('freeplay/diffRatings/diff${ratingPadded}')); + // diffRatingSprite.visible = false; } function set_hsvShader(value:HSVShader):HSVShader From d346c9387cdb1001977a9dcf6b7d691069cafbcf Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 16 Apr 2024 19:42:52 -0400 Subject: [PATCH 062/124] Fix a crash in the Results state. also nudge GF over to the spot she's in in the FLA --- source/funkin/play/ResultState.hx | 66 +++++++++++++++---------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index c05257338..591020955 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -80,34 +80,34 @@ class ResultState extends MusicBeatSubState bgFlash.visible = false; add(bgFlash); - var bfGfExcellent:FlxAtlasSprite = new FlxAtlasSprite(380, -170, Paths.animateAtlas("resultScreen/resultsBoyfriendExcellent", "shared")); - bfGfExcellent.visible = false; - add(bfGfExcellent); + // var bfGfExcellent:FlxAtlasSprite = new FlxAtlasSprite(380, -170, Paths.animateAtlas("resultScreen/resultsBoyfriendExcellent", "shared")); + // bfGfExcellent.visible = false; + // add(bfGfExcellent); + // + // var bfPerfect:FlxAtlasSprite = new FlxAtlasSprite(370, -180, Paths.animateAtlas("resultScreen/resultsBoyfriendPerfect", "shared")); + // bfPerfect.visible = false; + // add(bfPerfect); + // + // var bfSHIT:FlxAtlasSprite = new FlxAtlasSprite(0, 20, Paths.animateAtlas("resultScreen/resultsBoyfriendSHIT", "shared")); + // bfSHIT.visible = false; + // add(bfSHIT); + // + // bfGfExcellent.anim.onComplete = () -> { + // bfGfExcellent.anim.curFrame = 28; + // bfGfExcellent.anim.play(); // unpauses this anim, since it's on PlayOnce! + // }; + // + // bfPerfect.anim.onComplete = () -> { + // bfPerfect.anim.curFrame = 136; + // bfPerfect.anim.play(); // unpauses this anim, since it's on PlayOnce! + // }; + // + // bfSHIT.anim.onComplete = () -> { + // bfSHIT.anim.curFrame = 150; + // bfSHIT.anim.play(); // unpauses this anim, since it's on PlayOnce! + // }; - var bfPerfect:FlxAtlasSprite = new FlxAtlasSprite(370, -180, Paths.animateAtlas("resultScreen/resultsBoyfriendPerfect", "shared")); - bfPerfect.visible = false; - add(bfPerfect); - - var bfSHIT:FlxAtlasSprite = new FlxAtlasSprite(0, 20, Paths.animateAtlas("resultScreen/resultsBoyfriendSHIT", "shared")); - bfSHIT.visible = false; - add(bfSHIT); - - bfGfExcellent.anim.onComplete = () -> { - bfGfExcellent.anim.curFrame = 28; - bfGfExcellent.anim.play(); // unpauses this anim, since it's on PlayOnce! - }; - - bfPerfect.anim.onComplete = () -> { - bfPerfect.anim.curFrame = 136; - bfPerfect.anim.play(); // unpauses this anim, since it's on PlayOnce! - }; - - bfSHIT.anim.onComplete = () -> { - bfSHIT.anim.curFrame = 150; - bfSHIT.anim.play(); // unpauses this anim, since it's on PlayOnce! - }; - - var gf:FlxSprite = FunkinSprite.createSparrow(500, 300, 'resultScreen/resultGirlfriendGOOD'); + var gf:FlxSprite = FunkinSprite.createSparrow(625, 325, 'resultScreen/resultGirlfriendGOOD'); gf.animation.addByPrefix("clap", "Girlfriend Good Anim", 24, false); gf.visible = false; gf.animation.finishCallback = _ -> { @@ -268,9 +268,9 @@ class ResultState extends MusicBeatSubState switch (resultsVariation) { - case SHIT: - bfSHIT.visible = true; - bfSHIT.playAnimation(""); + // case SHIT: + // bfSHIT.visible = true; + // bfSHIT.playAnimation(""); case NORMAL: boyfriend.animation.play('fall'); @@ -292,9 +292,9 @@ class ResultState extends MusicBeatSubState gf.animation.play('clap', true); gf.visible = true; }); - case PERFECT: - bfPerfect.visible = true; - bfPerfect.playAnimation(""); + // case PERFECT: + // bfPerfect.visible = true; + // bfPerfect.playAnimation(""); // bfGfExcellent.visible = true; // bfGfExcellent.playAnimation(""); From 80a558ac08119b3cf427f6714bb1bc3596ad8c6e Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 16 Apr 2024 19:57:19 -0400 Subject: [PATCH 063/124] Fix an issue where changing focus would pause some sounds but not others. --- source/funkin/audio/FunkinSound.hx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/source/funkin/audio/FunkinSound.hx b/source/funkin/audio/FunkinSound.hx index 8c1bf3b41..df05cc3ef 100644 --- a/source/funkin/audio/FunkinSound.hx +++ b/source/funkin/audio/FunkinSound.hx @@ -223,11 +223,12 @@ class FunkinSound extends FlxSound implements ICloneable // already paused before we lost focus. if (_lostFocus && !_alreadyPaused) { + trace('Resuming audio (${this._label}) on focus!'); resume(); } else { - trace('Not resuming audio on focus!'); + trace('Not resuming audio (${this._label}) on focus!'); } _lostFocus = false; } @@ -402,6 +403,12 @@ class FunkinSound extends FlxSound implements ICloneable sound.group = FlxG.sound.defaultSoundGroup; sound.persist = true; + // Make sure to add the sound to the list. + // If it's already in, it won't get re-added. + // If it's not in the list (it gets removed by FunkinSound.playMusic()), + // it will get re-added (then if this was called by playMusic(), removed again) + FlxG.sound.list.add(sound); + // Call onLoad() because the sound already loaded if (onLoad != null && sound._sound != null) onLoad(); From b9824848560d426247d4bf33403786e7898ab0fe Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 16 Apr 2024 20:19:20 -0400 Subject: [PATCH 064/124] Properly fix the menu background to use the correct line colors. --- assets | 2 +- source/funkin/ui/mainmenu/MainMenuState.hx | 10 ++-------- source/funkin/ui/options/OptionsState.hx | 3 +-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/assets b/assets index 1b12b6c66..f3d6cf30d 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 1b12b6c6666af6c84addf5aa0795546aa0d04185 +Subproject commit f3d6cf30dee60a237a6773d8140bd1661f62bd4e diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index 1a4686c5b..d2d8adeca 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -57,12 +57,7 @@ class MainMenuState extends MusicBeatState persistentUpdate = false; persistentDraw = true; - var bg = FunkinSprite.create('menuDesat'); - - bg.color = 0xFFFDE871; - // This line accounts for the fact that the base color of menuDesat is #EFEFEF. - flixel.util.FlxColorTransformUtil.setOffsets(bg.colorTransform, 30, 27, 13, 0.0); - + var bg:FlxSprite = new FlxSprite(Paths.image('menuBG')); bg.scrollFactor.x = 0; bg.scrollFactor.y = 0.17; bg.setGraphicSize(Std.int(bg.width * 1.2)); @@ -73,7 +68,7 @@ class MainMenuState extends MusicBeatState camFollow = new FlxObject(0, 0, 1, 1); add(camFollow); - magenta = new FlxSprite(Paths.image('menuDesat')); + magenta = new FlxSprite(Paths.image('menuBGMagenta')); magenta.scrollFactor.x = bg.scrollFactor.x; magenta.scrollFactor.y = bg.scrollFactor.y; magenta.setGraphicSize(Std.int(bg.width)); @@ -81,7 +76,6 @@ class MainMenuState extends MusicBeatState magenta.x = bg.x; magenta.y = bg.y; magenta.visible = false; - magenta.color = 0xFFfd719b; // TODO: Why doesn't this line compile I'm going fucking feral diff --git a/source/funkin/ui/options/OptionsState.hx b/source/funkin/ui/options/OptionsState.hx index 0f33a0780..a00b28dbb 100644 --- a/source/funkin/ui/options/OptionsState.hx +++ b/source/funkin/ui/options/OptionsState.hx @@ -23,8 +23,7 @@ class OptionsState extends MusicBeatState override function create() { - var menuBG = new FlxSprite().loadGraphic(Paths.image('menuDesat')); - menuBG.color = 0xFFea71fd; + var menuBG = new FlxSprite().loadGraphic(Paths.image('menuBGBlue')); menuBG.setGraphicSize(Std.int(menuBG.width * 1.1)); menuBG.updateHitbox(); menuBG.screenCenter(); From 1adef489952aaab9c6787a9d0a69eb47b4bed862 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 16 Apr 2024 22:12:07 -0400 Subject: [PATCH 065/124] some cleanins with letter sorts --- checkstyle.json | 3 +- source/funkin/ui/freeplay/FreeplayState.hx | 79 ++++++------ source/funkin/ui/freeplay/LetterSort.hx | 134 +++++++++------------ 3 files changed, 103 insertions(+), 113 deletions(-) diff --git a/checkstyle.json b/checkstyle.json index 5300d94ad..3da04230f 100644 --- a/checkstyle.json +++ b/checkstyle.json @@ -550,7 +550,8 @@ { "props": { "policy": "onlySingle", - "allowException": true + "allowException": true, + "severity": "IGNORE" }, "type": "StringLiteral" }, diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 2fc1128cd..e71681874 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -539,47 +539,14 @@ class FreeplayState extends MusicBeatSubState * Given the current filter, rebuild the current song list. * * @param filterStuff A filter to apply to the song list (regex, startswith, all, favorite) - * @param force + * @param force Whether the capsules should "jump" back in or not using their animation * @param onlyIfChanged Only apply the filter if the song list has changed */ public function generateSongList(filterStuff:Null, force:Bool = false, onlyIfChanged:Bool = true):Void { var tempSongs:Array = songs; - if (filterStuff != null) - { - switch (filterStuff.filterType) - { - case REGEXP: - // filterStuff.filterData has a string with the first letter of the sorting range, and the second one - // this creates a filter to return all the songs that start with a letter between those two - - // if filterData looks like "A-C", the regex should look something like this: ^[A-C].* - // to get every song that starts between A and C - var filterRegexp:EReg = new EReg('^[' + filterStuff.filterData + '].*', 'i'); - tempSongs = tempSongs.filter(str -> { - if (str == null) return true; // Random - return filterRegexp.match(str.songName); - }); - - case STARTSWITH: - // extra note: this is essentially a "search" - - tempSongs = tempSongs.filter(str -> { - if (str == null) return true; // Random - return str.songName.toLowerCase().startsWith(filterStuff.filterData); - }); - case ALL: - // no filter! - case FAVORITE: - tempSongs = tempSongs.filter(str -> { - if (str == null) return true; // Random - return str.isFav; - }); - default: - // return all on default - } - } + if (filterStuff != null) tempSongs = sortSongs(tempSongs, filterStuff); // Filter further by current selected difficulty. if (currentDifficulty != null) @@ -657,6 +624,48 @@ class FreeplayState extends MusicBeatSubState changeDiff(); } + /** + * Filters an array of songs based on a filter + * @param songsToFilter What data to use when filtering + * @param songFilter The filter to apply + * @return Array + */ + public function sortSongs(songsToFilter:Array, songFilter:SongFilter):Array + { + switch (songFilter.filterType) + { + case REGEXP: + // filterStuff.filterData has a string with the first letter of the sorting range, and the second one + // this creates a filter to return all the songs that start with a letter between those two + + // if filterData looks like "A-C", the regex should look something like this: ^[A-C].* + // to get every song that starts between A and C + var filterRegexp:EReg = new EReg('^[' + songFilter.filterData + '].*', 'i'); + songsToFilter = songsToFilter.filter(str -> { + if (str == null) return true; // Random + return filterRegexp.match(str.songName); + }); + + case STARTSWITH: + // extra note: this is essentially a "search" + + songsToFilter = songsToFilter.filter(str -> { + if (str == null) return true; // Random + return str.songName.toLowerCase().startsWith(songFilter.filterData); + }); + case ALL: + // no filter! + case FAVORITE: + songsToFilter = songsToFilter.filter(str -> { + if (str == null) return true; // Random + return str.isFav; + }); + default: + // return all on default + } + return songsToFilter; + } + var touchY:Float = 0; var touchX:Float = 0; var dxTouch:Float = 0; diff --git a/source/funkin/ui/freeplay/LetterSort.hx b/source/funkin/ui/freeplay/LetterSort.hx index 8017abe33..e813c9198 100644 --- a/source/funkin/ui/freeplay/LetterSort.hx +++ b/source/funkin/ui/freeplay/LetterSort.hx @@ -39,7 +39,6 @@ class LetterSort extends FlxTypedSpriteGroup var letter:FreeplayLetter = new FreeplayLetter(i * 80, 0, i); letter.x += 50; letter.y += 50; - letter.ogY = y; // letter.visible = false; add(letter); @@ -82,6 +81,26 @@ class LetterSort extends FlxTypedSpriteGroup } public function changeSelection(diff:Int = 0):Void + { + doLetterChangeAnims(diff); + + var multiPosOrNeg:Float = diff > 0 ? 1 : -1; + + // if we're moving left (diff < 0), we want control of the right arrow, and vice versa + var arrowToMove:FlxSprite = diff < 0 ? leftArrow : rightArrow; + arrowToMove.offset.x = 3 * multiPosOrNeg; + + new FlxTimer().start(2 / 24, function(_) { + arrowToMove.offset.x = 0; + }); + } + + /** + * Buncho timers and stuff to move the letters and seperators + * Seperated out so we can call it again on letters with songs within them + * @param diff + */ + function doLetterChangeAnims(diff:Int):Void { var ezTimer:Int->FlxSprite->Float->Void = function(frameNum:Int, spr:FlxSprite, offsetNum:Float) { new FlxTimer().start(frameNum / 24, function(_) { @@ -91,84 +110,39 @@ class LetterSort extends FlxTypedSpriteGroup var positions:Array = [-10, -22, 2, 0]; - if (diff < 0) + // if we're moving left, we want to move the positions the same amount, but negative direciton + var multiPosOrNeg:Float = diff > 0 ? 1 : -1; + + for (sep in grpSeperators) { - for (sep in grpSeperators) - { - ezTimer(0, sep, positions[0]); - ezTimer(1, sep, positions[1]); - ezTimer(2, sep, positions[2]); - ezTimer(3, sep, positions[3]); - } - - for (index => letter in letters) - { - letter.offset.x = positions[0]; - - new FlxTimer().start(1 / 24, function(_) { - letter.offset.x = positions[1]; - if (index == 0) letter.visible = false; - }); - - new FlxTimer().start(2 / 24, function(_) { - letter.offset.x = positions[2]; - if (index == 0.) letter.visible = true; - }); - - if (index == 2) - { - ezTimer(3, letter, 0); - // letter.offset.x = 0; - continue; - } - - ezTimer(3, letter, positions[3]); - } - - leftArrow.offset.x = 3; - new FlxTimer().start(2 / 24, function(_) { - leftArrow.offset.x = 0; - }); + ezTimer(0, sep, positions[0] * multiPosOrNeg); + ezTimer(1, sep, positions[1] * multiPosOrNeg); + ezTimer(2, sep, positions[2] * multiPosOrNeg); + ezTimer(3, sep, positions[3] * multiPosOrNeg); } - else if (diff > 0) + + for (index => letter in letters) { - for (sep in grpSeperators) - { - ezTimer(0, sep, -positions[0]); - ezTimer(1, sep, -positions[1]); - ezTimer(2, sep, -positions[2]); - ezTimer(3, sep, -positions[3]); - } - // same timing and functions and shit as the left one... except to the right!! + letter.offset.x = positions[0] * multiPosOrNeg; - for (index => letter in letters) - { - letter.offset.x = -positions[0]; - - new FlxTimer().start(1 / 24, function(_) { - letter.offset.x = -positions[1]; - if (index == 0) letter.visible = false; - }); - - new FlxTimer().start(2 / 24, function(_) { - letter.offset.x = -positions[2]; - if (index == 0) letter.visible = true; - }); - - if (index == 2) - { - ezTimer(3, letter, 0); - // letter.offset.x = 0; - continue; - } - - ezTimer(3, letter, -positions[3]); - } - - rightArrow.offset.x = -3; - new FlxTimer().start(2 / 24, function(_) { - rightArrow.offset.x = 0; + new FlxTimer().start(1 / 24, function(_) { + letter.offset.x = positions[1] * multiPosOrNeg; + if (index == 0) letter.visible = false; }); + + new FlxTimer().start(2 / 24, function(_) { + letter.offset.x = positions[2] * multiPosOrNeg; + if (index == 0.) letter.visible = true; + }); + + if (index == 2) + { + ezTimer(3, letter, 0); + // letter.offset.x = 0; + continue; + } + + ezTimer(3, letter, positions[3] * multiPosOrNeg); } curSelection += diff; @@ -182,6 +156,9 @@ class LetterSort extends FlxTypedSpriteGroup } } +/** + * The actual FlxAtlasSprite for the letters, with their animation code stuff and regex stuff + */ class FreeplayLetter extends FlxAtlasSprite { /** @@ -201,8 +178,6 @@ class FreeplayLetter extends FlxAtlasSprite */ public var curLetter:Int = 0; - public var ogY:Float = 0; - public function new(x:Float, y:Float, ?letterInd:Int) { super(x, y, Paths.animateAtlas("freeplay/sortedLetters")); @@ -231,6 +206,11 @@ class FreeplayLetter extends FlxAtlasSprite } } + /** + * Changes the letter graphic/anim, used in the LetterSort class above + * @param diff -1 or 1, to go left or right in the animation array + * @param curSelection what the current letter selection is, to play the bouncing anim if it matches the current letter + */ public function changeLetter(diff:Int = 0, ?curSelection:Int):Void { curLetter += diff; @@ -238,7 +218,7 @@ class FreeplayLetter extends FlxAtlasSprite if (curLetter < 0) curLetter = regexLetters.length - 1; if (curLetter >= regexLetters.length) curLetter = 0; - var animName:String = animLetters[curLetter] + " move"; + var animName:String = animLetters[curLetter] + ' move'; switch (animLetters[curLetter]) { From c3e777154e6d3655317b06c0261eefec7ca6c47c Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 16 Apr 2024 21:11:56 -0400 Subject: [PATCH 066/124] fix letter sort regex, and tiny LetterSort.hx cleanin --- source/funkin/ui/freeplay/FreeplayState.hx | 6 ++ source/funkin/ui/freeplay/LetterSort.hx | 72 ++++++++++++---------- 2 files changed, 47 insertions(+), 31 deletions(-) diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 3ac441212..2fc1128cd 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -553,12 +553,18 @@ class FreeplayState extends MusicBeatSubState case REGEXP: // filterStuff.filterData has a string with the first letter of the sorting range, and the second one // this creates a filter to return all the songs that start with a letter between those two + + // if filterData looks like "A-C", the regex should look something like this: ^[A-C].* + // to get every song that starts between A and C var filterRegexp:EReg = new EReg('^[' + filterStuff.filterData + '].*', 'i'); tempSongs = tempSongs.filter(str -> { if (str == null) return true; // Random return filterRegexp.match(str.songName); }); + case STARTSWITH: + // extra note: this is essentially a "search" + tempSongs = tempSongs.filter(str -> { if (str == null) return true; // Random return str.songName.toLowerCase().startsWith(filterStuff.filterData); diff --git a/source/funkin/ui/freeplay/LetterSort.hx b/source/funkin/ui/freeplay/LetterSort.hx index 7e71b6aa1..8017abe33 100644 --- a/source/funkin/ui/freeplay/LetterSort.hx +++ b/source/funkin/ui/freeplay/LetterSort.hx @@ -54,7 +54,7 @@ class LetterSort extends FlxTypedSpriteGroup // don't put the last seperator if (i == 4) continue; - var sep:FlxSprite = new FlxSprite((i * 80) + 55, 20).loadGraphic(Paths.image("freeplay/seperator")); + var sep:FlxSprite = new FlxSprite((i * 80) + 60, 20).loadGraphic(Paths.image("freeplay/seperator")); // sep.animation.play("seperator"); sep.color = letter.color.getDarkened(darkness); add(sep); @@ -70,7 +70,7 @@ class LetterSort extends FlxTypedSpriteGroup changeSelection(0); } - override function update(elapsed:Float) + override function update(elapsed:Float):Void { super.update(elapsed); @@ -81,7 +81,7 @@ class LetterSort extends FlxTypedSpriteGroup } } - public function changeSelection(diff:Int = 0) + public function changeSelection(diff:Int = 0):Void { var ezTimer:Int->FlxSprite->Float->Void = function(frameNum:Int, spr:FlxSprite, offsetNum:Float) { new FlxTimer().start(frameNum / 24, function(_) { @@ -172,20 +172,33 @@ class LetterSort extends FlxTypedSpriteGroup } curSelection += diff; - if (curSelection < 0) curSelection = letters[0].arr.length - 1; - if (curSelection >= letters[0].arr.length) curSelection = 0; + if (curSelection < 0) curSelection = letters[0].regexLetters.length - 1; + if (curSelection >= letters[0].regexLetters.length) curSelection = 0; for (letter in letters) letter.changeLetter(diff, curSelection); - if (changeSelectionCallback != null) changeSelectionCallback(letters[2].arr[letters[2].curLetter]); // bullshit and long lol! + if (changeSelectionCallback != null) changeSelectionCallback(letters[2].regexLetters[letters[2].curLetter]); // bullshit and long lol! } } class FreeplayLetter extends FlxAtlasSprite { - public var arr:Array = []; + /** + * A preformatted array of letter strings, for use when doing regex + * ex: ['A-B', 'C-D', 'E-H', 'I-L' ...] + */ + public var regexLetters:Array = []; + /** + * A preformatted array of the letters, for use when accessing symbol animation info + * ex: ['AB', 'CD', 'EH', 'IL' ...] + */ + public var animLetters:Array = []; + + /** + * The current letter in the regexLetters array this FreeplayLetter is on + */ public var curLetter:Int = 0; public var ogY:Float = 0; @@ -193,46 +206,43 @@ class FreeplayLetter extends FlxAtlasSprite public function new(x:Float, y:Float, ?letterInd:Int) { super(x, y, Paths.animateAtlas("freeplay/sortedLetters")); - // frames = Paths.getSparrowAtlas("freeplay/letterStuff"); - // this.anim.play("AB"); - // trace(this.anim.symbolDictionary); - var alphabet:String = "AB-CD-EH-I L-MN-OR-s-t-UZ"; - arr = alphabet.split("-"); - arr.insert(0, "ALL"); - arr.insert(0, "fav"); - arr.insert(0, "#"); + // this is used for the regex + // /^[OR].*/gi doesn't work for showing the song Pico, so now it's + // /^[O-R].*/gi ant it works for displaying Pico + // https://regex101.com/r/bWFPfS/1 + // we split by underscores, simply for nice lil convinience + var alphabet:String = 'A-B_C-D_E-H_I-L_M-N_O-R_S_T_U-Z'; + regexLetters = alphabet.split('_'); + regexLetters.insert(0, 'ALL'); + regexLetters.insert(0, 'fav'); + regexLetters.insert(0, '#'); - // trace(arr); - - // for (str in arr) - // { - // animation.addByPrefix(str, str + " "); // string followed by a space! intentional! - // } - - // animation.addByPrefix("arrow", "mini arrow"); - // animation.addByPrefix("seperator", "seperator"); + // the symbols from flash don't have dashes, so we clean this up for use with animations + // (we don't need to re-export, rule of thumb is to accomodate files named in flash from dave + // until we get him programming classes (and since i cant find the .fla file....)) + animLetters = regexLetters.map(animLetter -> animLetter.replace('-', '')); if (letterInd != null) { - this.anim.play(arr[letterInd] + " move"); + this.anim.play(animLetters[letterInd] + " move"); this.anim.pause(); curLetter = letterInd; } } - public function changeLetter(diff:Int = 0, ?curSelection:Int) + public function changeLetter(diff:Int = 0, ?curSelection:Int):Void { curLetter += diff; - if (curLetter < 0) curLetter = arr.length - 1; - if (curLetter >= arr.length) curLetter = 0; + if (curLetter < 0) curLetter = regexLetters.length - 1; + if (curLetter >= regexLetters.length) curLetter = 0; - var animName:String = arr[curLetter] + " move"; + var animName:String = animLetters[curLetter] + " move"; - switch (arr[curLetter]) + switch (animLetters[curLetter]) { - case "I L": + case "IL": animName = "IL move"; case "s": animName = "S move"; From 9a284c34e9fafa6ebb920e038551d25e34cede9b Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 19 Apr 2024 13:45:36 -0400 Subject: [PATCH 067/124] assets update for submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 6e098afdc..39c221849 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 6e098afdcc30c8508afc09bc3e57b502821029ab +Subproject commit 39c22184988e1b22bd63b07d83c30ece588e85df From 366bebc94cca62f36dadee505bf390cf0eb26446 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 19 Apr 2024 13:58:35 -0400 Subject: [PATCH 068/124] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 837a8639b..1266cb1c0 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 837a8639bd7abe4aa8786dc3790e8d4576f04f28 +Subproject commit 1266cb1c0c5078158df52b2b36205b332ccde019 From f385379935b64706b10c6847f9628d8f4b032947 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 19 Apr 2024 14:01:19 -0400 Subject: [PATCH 069/124] assets update for submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 837a8639b..069c9bf45 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 837a8639bd7abe4aa8786dc3790e8d4576f04f28 +Subproject commit 069c9bf45f197ebe0b38483d11bb30c15bbb5eca From 30d052f6ee4431ab295bc0aed758ffe202f56b3b Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 19 Apr 2024 14:05:38 -0400 Subject: [PATCH 070/124] assets update for submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 235d2695c..a24f42932 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 235d2695c6de11b0daa49277a602d1045d45e510 +Subproject commit a24f42932fbe9032d28be1603f197fb50c938276 From 3fa60cd2283037f338d2fd90107c69388466d856 Mon Sep 17 00:00:00 2001 From: FabsTheFabs Date: Sun, 7 Apr 2024 21:41:40 +0100 Subject: [PATCH 071/124] update assets submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index a24f42932..31dfbf9d5 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit a24f42932fbe9032d28be1603f197fb50c938276 +Subproject commit 31dfbf9d545ea897e58d0257381cbdf8e4281d3c From 351cb8cbaa6ea0c5570563a40c24c24219af4fed Mon Sep 17 00:00:00 2001 From: FabsTheFabs Date: Tue, 9 Apr 2024 03:56:28 +0100 Subject: [PATCH 072/124] popupstuff changes + make combopopup able to be edited outside of playstate --- source/funkin/play/PlayState.hx | 2 +- source/funkin/play/components/PopUpStuff.hx | 25 ++++++++++++--------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 2e023dccd..9f6e5a16b 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -498,7 +498,7 @@ class PlayState extends MusicBeatSubState /** * The combo popups. Includes the real-time combo counter and the rating. */ - var comboPopUps:PopUpStuff; + public var comboPopUps:PopUpStuff; /** * PROPERTIES diff --git a/source/funkin/play/components/PopUpStuff.hx b/source/funkin/play/components/PopUpStuff.hx index 724bf0cb9..b062b22cf 100644 --- a/source/funkin/play/components/PopUpStuff.hx +++ b/source/funkin/play/components/PopUpStuff.hx @@ -10,6 +10,8 @@ import funkin.util.TimerUtil; class PopUpStuff extends FlxTypedGroup { + public var offsets:Array = [0, 0]; + override public function new() { super(); @@ -29,9 +31,9 @@ class PopUpStuff extends FlxTypedGroup rating.scrollFactor.set(0.2, 0.2); rating.zIndex = 1000; - rating.x = FlxG.width * 0.50; + rating.x = (FlxG.width * 0.474) + offsets[0]; // rating.x -= FlxG.camera.scroll.x * 0.2; - rating.y = FlxG.camera.height * 0.4 - 60; + rating.y = (FlxG.camera.height * 0.45 - 60) + offsets[1]; rating.acceleration.y = 550; rating.velocity.y -= FlxG.random.int(140, 175); rating.velocity.x -= FlxG.random.int(0, 10); @@ -40,16 +42,19 @@ class PopUpStuff extends FlxTypedGroup if (PlayState.instance.currentStageId.startsWith('school')) { - rating.setGraphicSize(Std.int(rating.width * Constants.PIXEL_ART_SCALE * 0.7)); + rating.setGraphicSize(Std.int(rating.width * Constants.PIXEL_ART_SCALE * 0.65)); rating.antialiasing = false; } else { - rating.setGraphicSize(Std.int(rating.width * 0.7)); + rating.setGraphicSize(Std.int(rating.width * 0.65)); rating.antialiasing = true; } rating.updateHitbox(); + rating.x -= rating.width / 2; + rating.y -= rating.height / 2; + FlxTween.tween(rating, {alpha: 0}, 0.2, { onComplete: function(tween:FlxTween) { @@ -77,8 +82,8 @@ class PopUpStuff extends FlxTypedGroup pixelShitPart2 = '-pixel'; } var comboSpr:FunkinSprite = FunkinSprite.create(pixelShitPart1 + 'combo' + pixelShitPart2); - comboSpr.y = FlxG.camera.height * 0.4 + 80; - comboSpr.x = FlxG.width * 0.50; + comboSpr.y = (FlxG.camera.height * 0.44) + offsets[1]; + comboSpr.x = (FlxG.width * 0.507) + offsets[0]; // comboSpr.x -= FlxG.camera.scroll.x * 0.2; comboSpr.acceleration.y = 600; @@ -133,14 +138,14 @@ class PopUpStuff extends FlxTypedGroup } else { - numScore.setGraphicSize(Std.int(numScore.width * 0.5)); + numScore.setGraphicSize(Std.int(numScore.width * 0.45)); numScore.antialiasing = true; } numScore.updateHitbox(); - numScore.x = comboSpr.x - (43 * daLoop); //- 90; - numScore.acceleration.y = FlxG.random.int(200, 300); - numScore.velocity.y -= FlxG.random.int(140, 160); + numScore.x = comboSpr.x - (36 * daLoop) - 65; //- 90; + numScore.acceleration.y = FlxG.random.int(250, 300); + numScore.velocity.y -= FlxG.random.int(130, 150); numScore.velocity.x = FlxG.random.float(-5, 5); add(numScore); From b3869f6504a3f098ce0b01111975cc4dc2081a8c Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 19 Apr 2024 14:16:57 -0400 Subject: [PATCH 073/124] assets update for submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 31dfbf9d5..a24f42932 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 31dfbf9d545ea897e58d0257381cbdf8e4281d3c +Subproject commit a24f42932fbe9032d28be1603f197fb50c938276 From 49a81189c40b35fc77ed62eba0b2914fbc4e23dc Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 19 Apr 2024 15:00:12 -0400 Subject: [PATCH 074/124] use funkinaction in controls.hx --- source/funkin/input/Controls.hx | 72 ++++++++++++++++----------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/source/funkin/input/Controls.hx b/source/funkin/input/Controls.hx index d76c26153..14b226d88 100644 --- a/source/funkin/input/Controls.hx +++ b/source/funkin/input/Controls.hx @@ -30,42 +30,42 @@ class Controls extends FlxActionSet * A list of actions that a player would invoke via some input device. * Uses FlxActions to funnel various inputs to a single action. */ - var _ui_up = new FlxActionDigital(Action.UI_UP); - var _ui_left = new FlxActionDigital(Action.UI_LEFT); - var _ui_right = new FlxActionDigital(Action.UI_RIGHT); - var _ui_down = new FlxActionDigital(Action.UI_DOWN); - var _ui_upP = new FlxActionDigital(Action.UI_UP_P); - var _ui_leftP = new FlxActionDigital(Action.UI_LEFT_P); - var _ui_rightP = new FlxActionDigital(Action.UI_RIGHT_P); - var _ui_downP = new FlxActionDigital(Action.UI_DOWN_P); - var _ui_upR = new FlxActionDigital(Action.UI_UP_R); - var _ui_leftR = new FlxActionDigital(Action.UI_LEFT_R); - var _ui_rightR = new FlxActionDigital(Action.UI_RIGHT_R); - var _ui_downR = new FlxActionDigital(Action.UI_DOWN_R); - var _note_up = new FlxActionDigital(Action.NOTE_UP); - var _note_left = new FlxActionDigital(Action.NOTE_LEFT); - var _note_right = new FlxActionDigital(Action.NOTE_RIGHT); - var _note_down = new FlxActionDigital(Action.NOTE_DOWN); - var _note_upP = new FlxActionDigital(Action.NOTE_UP_P); - var _note_leftP = new FlxActionDigital(Action.NOTE_LEFT_P); - var _note_rightP = new FlxActionDigital(Action.NOTE_RIGHT_P); - var _note_downP = new FlxActionDigital(Action.NOTE_DOWN_P); - var _note_upR = new FlxActionDigital(Action.NOTE_UP_R); - var _note_leftR = new FlxActionDigital(Action.NOTE_LEFT_R); - var _note_rightR = new FlxActionDigital(Action.NOTE_RIGHT_R); - var _note_downR = new FlxActionDigital(Action.NOTE_DOWN_R); - var _accept = new FlxActionDigital(Action.ACCEPT); - var _back = new FlxActionDigital(Action.BACK); - var _pause = new FlxActionDigital(Action.PAUSE); - var _reset = new FlxActionDigital(Action.RESET); - var _screenshot = new FlxActionDigital(Action.SCREENSHOT); - var _cutscene_advance = new FlxActionDigital(Action.CUTSCENE_ADVANCE); - var _debug_menu = new FlxActionDigital(Action.DEBUG_MENU); - var _debug_chart = new FlxActionDigital(Action.DEBUG_CHART); - var _debug_stage = new FlxActionDigital(Action.DEBUG_STAGE); - var _volume_up = new FlxActionDigital(Action.VOLUME_UP); - var _volume_down = new FlxActionDigital(Action.VOLUME_DOWN); - var _volume_mute = new FlxActionDigital(Action.VOLUME_MUTE); + var _ui_up = new FunkinAction(Action.UI_UP); + var _ui_left = new FunkinAction(Action.UI_LEFT); + var _ui_right = new FunkinAction(Action.UI_RIGHT); + var _ui_down = new FunkinAction(Action.UI_DOWN); + var _ui_upP = new FunkinAction(Action.UI_UP_P); + var _ui_leftP = new FunkinAction(Action.UI_LEFT_P); + var _ui_rightP = new FunkinAction(Action.UI_RIGHT_P); + var _ui_downP = new FunkinAction(Action.UI_DOWN_P); + var _ui_upR = new FunkinAction(Action.UI_UP_R); + var _ui_leftR = new FunkinAction(Action.UI_LEFT_R); + var _ui_rightR = new FunkinAction(Action.UI_RIGHT_R); + var _ui_downR = new FunkinAction(Action.UI_DOWN_R); + var _note_up = new FunkinAction(Action.NOTE_UP); + var _note_left = new FunkinAction(Action.NOTE_LEFT); + var _note_right = new FunkinAction(Action.NOTE_RIGHT); + var _note_down = new FunkinAction(Action.NOTE_DOWN); + var _note_upP = new FunkinAction(Action.NOTE_UP_P); + var _note_leftP = new FunkinAction(Action.NOTE_LEFT_P); + var _note_rightP = new FunkinAction(Action.NOTE_RIGHT_P); + var _note_downP = new FunkinAction(Action.NOTE_DOWN_P); + var _note_upR = new FunkinAction(Action.NOTE_UP_R); + var _note_leftR = new FunkinAction(Action.NOTE_LEFT_R); + var _note_rightR = new FunkinAction(Action.NOTE_RIGHT_R); + var _note_downR = new FunkinAction(Action.NOTE_DOWN_R); + var _accept = new FunkinAction(Action.ACCEPT); + var _back = new FunkinAction(Action.BACK); + var _pause = new FunkinAction(Action.PAUSE); + var _reset = new FunkinAction(Action.RESET); + var _screenshot = new FunkinAction(Action.SCREENSHOT); + var _cutscene_advance = new FunkinAction(Action.CUTSCENE_ADVANCE); + var _debug_menu = new FunkinAction(Action.DEBUG_MENU); + var _debug_chart = new FunkinAction(Action.DEBUG_CHART); + var _debug_stage = new FunkinAction(Action.DEBUG_STAGE); + var _volume_up = new FunkinAction(Action.VOLUME_UP); + var _volume_down = new FunkinAction(Action.VOLUME_DOWN); + var _volume_mute = new FunkinAction(Action.VOLUME_MUTE); var byName:Map = new Map(); From 57df7db5f10a7017a8602c576bf7a26f15d65198 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 19 Apr 2024 15:10:43 -0400 Subject: [PATCH 075/124] add small #if web define --- source/funkin/audio/visualize/ABotVis.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/funkin/audio/visualize/ABotVis.hx b/source/funkin/audio/visualize/ABotVis.hx index 1188d389f..5874b8921 100644 --- a/source/funkin/audio/visualize/ABotVis.hx +++ b/source/funkin/audio/visualize/ABotVis.hx @@ -83,8 +83,9 @@ class ABotVis extends FlxTypedSpriteGroup override function draw() { + #if web if (analyzer != null) drawFFT(); - + #end super.draw(); } From 7826c7987118356eee1875eb2fc18c8170620647 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 19 Apr 2024 15:11:20 -0400 Subject: [PATCH 076/124] assets update for submodule --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index f98e9c66a..daf702a6e 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit f98e9c66aa06b978fd8f418c9fae3c8d4c163897 +Subproject commit daf702a6ec8b60f1922261872cc74eb107fece06 From 84c3fd452b8fcfd5005b630beb50f2a4820f0b91 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 20 Apr 2024 02:11:04 -0400 Subject: [PATCH 077/124] Update Weekend 1 cutscenes to use the instanced Conductor --- assets | 2 +- source/funkin/play/PlayState.hx | 5 ++++- source/funkin/play/event/FocusCameraSongEvent.hx | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/assets b/assets index 77a7f44a8..7ec8282b5 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 77a7f44a89349d40a41b94c1d65381386759359b +Subproject commit 7ec8282b5358302f3d862f4670d9c60102aa1cf7 diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 572eb6135..4e388407e 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -813,6 +813,7 @@ class PlayState extends MusicBeatSubState super.update(elapsed); + var list = FlxG.sound.list; updateHealthBar(); updateScoreText(); @@ -969,7 +970,7 @@ class PlayState extends MusicBeatSubState if (health < Constants.HEALTH_MIN) health = Constants.HEALTH_MIN; // Apply camera zoom + multipliers. - if (subState == null && cameraZoomRate > 0.0 && !isInCutscene) + if (subState == null && cameraZoomRate > 0.0) // && !isInCutscene) { cameraBopMultiplier = FlxMath.lerp(1.0, cameraBopMultiplier, 0.95); // Lerp bop multiplier back to 1.0x var zoomPlusBop = currentCameraZoom * cameraBopMultiplier; // Apply camera bop multiplier. @@ -1869,6 +1870,8 @@ class PlayState extends MusicBeatSubState isInCutscene = false; camCutscene.visible = false; + + // TODO: Maybe tween in the camera after any cutscenes. camHUD.visible = true; } diff --git a/source/funkin/play/event/FocusCameraSongEvent.hx b/source/funkin/play/event/FocusCameraSongEvent.hx index 1bcac9ad3..569dcb87a 100644 --- a/source/funkin/play/event/FocusCameraSongEvent.hx +++ b/source/funkin/play/event/FocusCameraSongEvent.hx @@ -127,7 +127,7 @@ class FocusCameraSongEvent extends SongEvent switch (ease) { case 'CLASSIC': // Old-school. No ease. Just set follow point. - PlayState.instance.cancelCameraFollowTween(); + PlayState.instance.resetCamera(); PlayState.instance.cameraFollowPoint.setPosition(targetX, targetY); case 'INSTANT': // Instant ease. Duration is automatically 0. PlayState.instance.tweenCameraToPosition(targetX, targetY, 0); From 7f18eb62d7ff7fce2adeb283a3ae7585787e635f Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 20 Apr 2024 23:04:08 -0400 Subject: [PATCH 078/124] Moved can explosion animation to weekend1 library so it's preloaded. --- .gitignore | 5 +++++ assets | 2 +- source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx | 5 +++++ source/funkin/ui/transition/LoadingState.hx | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b6a415fe9..84585eee0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,8 @@ RECOVER_*.fla shitAudio/ .build_time .swp + +# Exclude JS stuff +node_modules/ +package.json +package-lock.json diff --git a/assets b/assets index 1b12b6c66..3d8cfbb89 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 1b12b6c6666af6c84addf5aa0795546aa0d04185 +Subproject commit 3d8cfbb89527d5fbd52a1544e0724a6f37183178 diff --git a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx index 5ab2df837..8a77c1c85 100644 --- a/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx +++ b/source/funkin/graphics/adobeanimate/FlxAtlasSprite.hx @@ -37,6 +37,11 @@ class FlxAtlasSprite extends FlxAnimate { if (settings == null) settings = SETTINGS; + if (path == null) + { + throw 'Null path specified for FlxAtlasSprite!'; + } + super(x, y, path, settings); if (this.anim.curInstance == null) diff --git a/source/funkin/ui/transition/LoadingState.hx b/source/funkin/ui/transition/LoadingState.hx index 347190993..ec6621ee3 100644 --- a/source/funkin/ui/transition/LoadingState.hx +++ b/source/funkin/ui/transition/LoadingState.hx @@ -332,6 +332,7 @@ class LoadingState extends MusicBeatSubState // Since FlxGraphic tells OpenFL to not cache it, we have to do it manually. if (path.endsWith('spritemap1.png')) { + trace('Preloading FlxAnimate asset: ${path}'); openfl.Assets.getBitmapData(path, true); } } From 4671a9172cfbb261329dc21a983c7e1a3ae05bd9 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sat, 20 Apr 2024 23:48:27 -0400 Subject: [PATCH 079/124] Fix the NG logo overlapping the text --- source/funkin/ui/title/TitleState.hx | 1 + 1 file changed, 1 insertion(+) diff --git a/source/funkin/ui/title/TitleState.hx b/source/funkin/ui/title/TitleState.hx index e76e66003..d122bf7c1 100644 --- a/source/funkin/ui/title/TitleState.hx +++ b/source/funkin/ui/title/TitleState.hx @@ -188,6 +188,7 @@ class TitleState extends MusicBeatState ngSpr.animation.add('idle', [0, 1], 4); ngSpr.animation.play('idle'); ngSpr.setGraphicSize(Std.int(ngSpr.width * 0.55)); + ngSpr.y += 25; } else { From 5f26eaacd38c1827b0a340edb2d343eb9cb6e145 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sun, 21 Apr 2024 17:23:27 -0400 Subject: [PATCH 080/124] Fix issue where some FlxAnimate symbols wouldn't render on HTML5 --- hmm.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hmm.json b/hmm.json index 91beb40b0..6ee95f984 100644 --- a/hmm.json +++ b/hmm.json @@ -37,7 +37,7 @@ "name": "flxanimate", "type": "git", "dir": null, - "ref": "9bacdd6", + "ref": "17e0d59", "url": "https://github.com/FunkinCrew/flxanimate" }, { From d760a0d209acb9de769e4cf3a480a98ed5123421 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Sun, 21 Apr 2024 17:23:48 -0400 Subject: [PATCH 081/124] Add Ctrl-Alt-Shift-W as a debug hotkey to unlock all Darnell songs in Freeplay --- source/funkin/ui/mainmenu/MainMenuState.hx | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index 0a164cf86..f053d39fe 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -328,6 +328,31 @@ class MainMenuState extends MusicBeatState FlxG.state.openSubState(new DebugMenuSubState()); } + #if (debug || FORCE_DEBUG_VERSION) + if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.W) + { + // Give the user a score of 1 point on Weekend 1 story mode. + // This makes the level count as cleared and displays the songs in Freeplay. + funkin.save.Save.instance.setLevelScore('weekend1', 'easy', + { + score: 1, + tallies: + { + sick: 0, + good: 0, + bad: 0, + shit: 0, + missed: 0, + combo: 0, + maxCombo: 0, + totalNotesHit: 0, + totalNotes: 0, + }, + accuracy: 0, + }); + } + #end + if (FlxG.sound.music.volume < 0.8) { FlxG.sound.music.volume += 0.5 * elapsed; From b23ea585610f3410d4914f5b0754c2b2b4733333 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 22 Apr 2024 21:24:15 -0400 Subject: [PATCH 082/124] Fix Weekend 1 audio issue --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index daf702a6e..5a743b52e 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit daf702a6ec8b60f1922261872cc74eb107fece06 +Subproject commit 5a743b52ed0a1e80c489b580a3af0470c31dcf9c From 66b45b526f74f92a6711acccf75dfa00af8e2c7c Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 22 Apr 2024 21:24:44 -0400 Subject: [PATCH 083/124] Fix issue where controller couldn't switch difficulties in Story Menu --- source/funkin/ui/story/StoryMenuState.hx | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source/funkin/ui/story/StoryMenuState.hx b/source/funkin/ui/story/StoryMenuState.hx index 5881ef624..d4ffa961d 100644 --- a/source/funkin/ui/story/StoryMenuState.hx +++ b/source/funkin/ui/story/StoryMenuState.hx @@ -344,6 +344,17 @@ class StoryMenuState extends MusicBeatState changeDifficulty(0); } + // TODO: Querying UI_RIGHT_P (justPressed) after UI_RIGHT always returns false. Fix it! + if (controls.UI_RIGHT_P) + { + changeDifficulty(1); + } + + if (controls.UI_LEFT_P) + { + changeDifficulty(-1); + } + if (controls.UI_RIGHT) { rightDifficultyArrow.animation.play('press'); @@ -362,16 +373,6 @@ class StoryMenuState extends MusicBeatState leftDifficultyArrow.animation.play('idle'); } - if (controls.UI_RIGHT_P) - { - changeDifficulty(1); - } - - if (controls.UI_LEFT_P) - { - changeDifficulty(-1); - } - if (FlxG.keys.justPressed.TAB && modeText.visible) { switchMode(!displayingModdedLevels); From 6edd9e8c6af01ce3985abb2a0f255108b4f08e85 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 22 Apr 2024 22:30:29 -0400 Subject: [PATCH 084/124] Make cars stop moving while the game is paused. --- assets | 2 +- source/funkin/util/FlxTweenUtil.hx | 36 ++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 source/funkin/util/FlxTweenUtil.hx diff --git a/assets b/assets index 5a743b52e..e1a3527e0 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 5a743b52ed0a1e80c489b580a3af0470c31dcf9c +Subproject commit e1a3527e098910d34763b6a2f7f3f4242d13f2b9 diff --git a/source/funkin/util/FlxTweenUtil.hx b/source/funkin/util/FlxTweenUtil.hx new file mode 100644 index 000000000..57c8f0cfe --- /dev/null +++ b/source/funkin/util/FlxTweenUtil.hx @@ -0,0 +1,36 @@ +package funkin.util; + +import flixel.addons.plugin.taskManager.FlxTask; +import flixel.tweens.FlxTween; +import flixel.tweens.FlxEase; + +class FlxTweenUtil +{ + public static function pauseTween(tween:FlxTween):Void + { + if (tween != null) + { + tween.active = false; + } + } + + public static function resumeTween(tween:FlxTween):Void + { + if (tween != null) + { + tween.active = true; + } + } + + public static function pauseTweensOf(Object:Dynamic, ?FieldPaths:Array):Void + { + @:privateAccess + FlxTween.globalManager.forEachTweensOf(Object, FieldPaths, pauseTween); + } + + public static function resumeTweensOf(Object:Dynamic, ?FieldPaths:Array):Void + { + @:privateAccess + FlxTween.globalManager.forEachTweensOf(Object, FieldPaths, resumeTween); + } +} From 1e5153f133f47cf705f6a3e8718933b7c13982c6 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Mon, 22 Apr 2024 23:04:57 -0400 Subject: [PATCH 085/124] Fix an issue where zooming in the camera would persist to results screen --- source/funkin/play/ResultState.hx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index 591020955..acce8645a 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -64,6 +64,9 @@ class ResultState extends MusicBeatSubState loop: resultsVariation != SHIT }); + // Reset the camera zoom on the results screen. + FlxG.camera.zoom = 1.0; + // TEMP-ish, just used to sorta "cache" the 3000x3000 image! var cacheBullShit:FlxSprite = new FlxSprite().loadGraphic(Paths.image("resultScreen/soundSystem")); add(cacheBullShit); From 46f2dec67213c96a728b020ff9caf922c527af9f Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 23 Apr 2024 04:08:00 -0400 Subject: [PATCH 086/124] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index e1a3527e0..9676d4941 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit e1a3527e098910d34763b6a2f7f3f4242d13f2b9 +Subproject commit 9676d494146008bb99cd718fadffa3610a659ad4 From 939cb1e1711d59f350588be4a412cdb08d6c1409 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 23 Apr 2024 04:14:36 -0400 Subject: [PATCH 087/124] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 3d8cfbb89..949719607 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 3d8cfbb89527d5fbd52a1544e0724a6f37183178 +Subproject commit 94971960723adadcff39b39020694254ac88780a From c7163afc194adb3c24a4b95d497203c1e8b2be60 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 23 Apr 2024 04:20:26 -0400 Subject: [PATCH 088/124] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 949719607..3f3977d7b 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 94971960723adadcff39b39020694254ac88780a +Subproject commit 3f3977d7bf82856106e9c74fa11433c67b160323 From 878bb18c532a5a32ebacaa7869d5d60ed708ef2f Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Tue, 23 Apr 2024 04:24:23 -0400 Subject: [PATCH 089/124] art submod --- art | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/art b/art index 03e7c2a23..00463685f 160000 --- a/art +++ b/art @@ -1 +1 @@ -Subproject commit 03e7c2a2353b184e45955c96d763b7cdf1acbc34 +Subproject commit 00463685fa570f0c853d08e250b46ef80f30bc48 From 374c042ad020fd8b60adf6c9814f905f0f56d919 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Tue, 23 Apr 2024 18:32:07 -0400 Subject: [PATCH 090/124] Fix a critical issue causing instrumental variations to not load on web. --- source/funkin/play/song/Song.hx | 13 +++++++++---- source/funkin/ui/transition/LoadingState.hx | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/source/funkin/play/song/Song.hx b/source/funkin/play/song/Song.hx index d219dc2f6..e71ae3213 100644 --- a/source/funkin/play/song/Song.hx +++ b/source/funkin/play/song/Song.hx @@ -609,28 +609,33 @@ class SongDifficulty return cast events; } - public function cacheInst(instrumental = ''):Void + public function getInstPath(instrumental = ''):String { if (characters != null) { if (instrumental != '' && characters.altInstrumentals.contains(instrumental)) { var instId = '-$instrumental'; - FlxG.sound.cache(Paths.inst(this.song.id, instId)); + return Paths.inst(this.song.id, instId); } else { // Fallback to default instrumental. var instId = (characters.instrumental ?? '') != '' ? '-${characters.instrumental}' : ''; - FlxG.sound.cache(Paths.inst(this.song.id, instId)); + return Paths.inst(this.song.id, instId); } } else { - FlxG.sound.cache(Paths.inst(this.song.id)); + return Paths.inst(this.song.id); } } + public function cacheInst(instrumental = ''):Void + { + FlxG.sound.cache(getInstPath(instrumental)); + } + public function playInst(volume:Float = 1.0, looped:Bool = false):Void { var suffix:String = (variation != null && variation != '' && variation != 'default') ? '-$variation' : ''; diff --git a/source/funkin/ui/transition/LoadingState.hx b/source/funkin/ui/transition/LoadingState.hx index ec6621ee3..3b53e1b4a 100644 --- a/source/funkin/ui/transition/LoadingState.hx +++ b/source/funkin/ui/transition/LoadingState.hx @@ -77,7 +77,7 @@ class LoadingState extends MusicBeatSubState var difficulty:String = playParams.targetDifficulty ?? Constants.DEFAULT_DIFFICULTY; var variation:String = playParams.targetVariation ?? Constants.DEFAULT_VARIATION; var targetChart:SongDifficulty = playParams.targetSong?.getDifficulty(difficulty, variation); - var instPath:String = Paths.inst(targetChart.song.id); + var instPath:String = targetChart.getInstPath(playParams.targetInstrumental); var voicesPaths:Array = targetChart.buildVoiceList(); checkLoadSong(instPath); From 3734c6ecd3cff5c6ff3fd5322b2453066bca0201 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 24 Apr 2024 01:48:39 -0400 Subject: [PATCH 091/124] Make credits no longer pause and no longer autoformat. Add some names. --- .prettierignore | 2 ++ assets | 2 +- source/funkin/ui/credits/CreditsState.hx | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.prettierignore b/.prettierignore index 2e132c06f..ccf886f1a 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,3 +9,5 @@ assets/weekend1/images # Don't ignore data files # TODO: These don't work. !assets/preload/data/ + +assets/exclude/data/credits.json diff --git a/assets b/assets index 3f3977d7b..f9c94dfa6 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 3f3977d7bf82856106e9c74fa11433c67b160323 +Subproject commit f9c94dfa655b05d87fb37cbb71fe01aa798ec5b2 diff --git a/source/funkin/ui/credits/CreditsState.hx b/source/funkin/ui/credits/CreditsState.hx index d43e25114..6a15f1263 100644 --- a/source/funkin/ui/credits/CreditsState.hx +++ b/source/funkin/ui/credits/CreditsState.hx @@ -185,7 +185,7 @@ class CreditsState extends MusicBeatState } else if (controls.PAUSE) { - scrollPaused = !scrollPaused; + // scrollPaused = !scrollPaused; } } @@ -196,7 +196,7 @@ class CreditsState extends MusicBeatState function exit():Void { - FlxG.switchState(new funkin.ui.mainmenu.MainMenuState()); + FlxG.switchState(funkin.ui.mainmenu.MainMenuState.new); } public override function destroy():Void From ff5aacf1c10c447eb43995334dd5c3daa5da367b Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 24 Apr 2024 11:44:32 -0400 Subject: [PATCH 092/124] assets submod --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index f9c94dfa6..0e0781121 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit f9c94dfa655b05d87fb37cbb71fe01aa798ec5b2 +Subproject commit 0e07811217c579df376719c76d47c1e08b3070e2 From e33f14ea5cc52a364c0647c92725ee1cb2e923b5 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 24 Apr 2024 12:11:37 -0400 Subject: [PATCH 093/124] options screen menu bg fix --- source/funkin/graphics/shaders/HSVShader.hx | 1 + source/funkin/ui/options/OptionsState.hx | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/funkin/graphics/shaders/HSVShader.hx b/source/funkin/graphics/shaders/HSVShader.hx index 2dfdac2c9..b6d079612 100644 --- a/source/funkin/graphics/shaders/HSVShader.hx +++ b/source/funkin/graphics/shaders/HSVShader.hx @@ -13,6 +13,7 @@ class HSVShader extends FlxRuntimeShader public function new() { super(Assets.getText(Paths.frag('hsv'))); + FlxG.debugger.addTrackerProfile(new TrackerProfile(HSVShader, ['hue', 'saturation', 'value'])); hue = 1; saturation = 1; value = 1; diff --git a/source/funkin/ui/options/OptionsState.hx b/source/funkin/ui/options/OptionsState.hx index a00b28dbb..da375706b 100644 --- a/source/funkin/ui/options/OptionsState.hx +++ b/source/funkin/ui/options/OptionsState.hx @@ -8,6 +8,7 @@ import flixel.util.FlxSignal; import funkin.audio.FunkinSound; import funkin.ui.mainmenu.MainMenuState; import funkin.ui.MusicBeatState; +import funkin.graphics.shaders.HSVShader; import funkin.util.WindowUtil; import funkin.audio.FunkinSound; import funkin.input.Controls; @@ -18,12 +19,18 @@ class OptionsState extends MusicBeatState var currentName:PageName = Options; var currentPage(get, never):Page; - inline function get_currentPage() + inline function get_currentPage():Page return pages[currentName]; - override function create() + override function create():Void { - var menuBG = new FlxSprite().loadGraphic(Paths.image('menuBGBlue')); + var menuBG = new FlxSprite().loadGraphic(Paths.image('menuBG')); + var hsv = new HSVShader(); + hsv.hue = -0.6; + hsv.saturation = 0.9; + hsv.value = 3.6; + menuBG.shader = hsv; + FlxG.debugger.track(hsv); menuBG.setGraphicSize(Std.int(menuBG.width * 1.1)); menuBG.updateHitbox(); menuBG.screenCenter(); From 9a36c14f53117f62b716f3b1e2ef1fe9cc2356f5 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 19:32:28 +0100 Subject: [PATCH 094/124] debug moment --- .github/actions/setup-haxe/action.yml | 1 + .github/workflows/build-game.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index 54db9bf79..dd0a3a59d 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -73,6 +73,7 @@ runs: name: Install dependencies shell: bash run: | + git config --list --show-origin --show-scope haxelib --debug --global run hmm install echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 3bfea20f2..9ac024690 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -103,6 +103,7 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | + git config --list --show-origin --show-scope haxelib --global run hmm install - if: ${{ matrix.target != 'html5' }} From c87a16a0e152cf5cff85570e7691d45fbb3795ad Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 19:40:24 +0100 Subject: [PATCH 095/124] shasjakslkas --- .github/workflows/build-game.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 9ac024690..893f63def 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -23,8 +23,9 @@ jobs: steps: - name: Make git happy - if: ${{ matrix.target == 'macos' }} run: | + git config --global --unset http\.https\:\/\/github\.com\/\.extraheader + git config --global --unset safe.directory git config --global --add safe.directory $GITHUB_WORKSPACE - name: Get checkout token From b9b5c0dd9b6cd3a9e1c2a4051965dab1cfd187bd Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 19:48:18 +0100 Subject: [PATCH 096/124] i love working with git --- .github/workflows/build-game.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 893f63def..f87a3b93c 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -24,9 +24,7 @@ jobs: steps: - name: Make git happy run: | - git config --global --unset http\.https\:\/\/github\.com\/\.extraheader - git config --global --unset safe.directory - git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global --replace-all safe.directory $GITHUB_WORKSPACE - name: Get checkout token uses: actions/create-github-app-token@v1 @@ -105,6 +103,7 @@ jobs: name: Install dependencies run: | git config --list --show-origin --show-scope + cat .git/config haxelib --global run hmm install - if: ${{ matrix.target != 'html5' }} From 53d99df3fbf25170a1f8292ece98ac4536457b06 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 19:54:12 +0100 Subject: [PATCH 097/124] fuck around & find out --- .github/workflows/build-game.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index f87a3b93c..364635d56 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -102,9 +102,9 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | - git config --list --show-origin --show-scope - cat .git/config + git config --global --replace-all $(git config --get-regexp http\.https\:\/\/github\.com\/\.extraheader) haxelib --global run hmm install + git config --global --unset-all http\.https\:\/\/github\.com\/\.extraheader - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache From 54605ec430bfb22b3fa3688d2f03793c14ac42b5 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 20:02:28 +0100 Subject: [PATCH 098/124] https://open.spotify.com/track/7LVHVU3tWfcxj5aiPFEW4Q --- .github/workflows/build-game.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 364635d56..6529b5b06 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -102,9 +102,11 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | - git config --global --replace-all $(git config --get-regexp http\.https\:\/\/github\.com\/\.extraheader) + conf_key="http\.https\:\/\/github\.com\/\.extraheader" + conf_val=$(git config --get-regexp $conf_key | cut -d " " -f 2-) + git config --global $conf_key "$conf_val" haxelib --global run hmm install - git config --global --unset-all http\.https\:\/\/github\.com\/\.extraheader + git config --global --unset-all $conf_key - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache From a5b3d62a4a8dd45ecb3dce6282d185a45846b7e8 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 20:07:53 +0100 Subject: [PATCH 099/124] devops is such a fun profession, featuring 'staring at github actions broken web ui for 5 minutes' --- .github/workflows/build-game.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 6529b5b06..ec4e81c0e 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -102,11 +102,11 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | - conf_key="http\.https\:\/\/github\.com\/\.extraheader" - conf_val=$(git config --get-regexp $conf_key | cut -d " " -f 2-) - git config --global $conf_key "$conf_val" + conf_key="http.https://github.com/.extraheader" + conf_val=$(git config --get "$conf_key" | cut -d " " -f 2-) + git config --global "$conf_key" "$conf_val" haxelib --global run hmm install - git config --global --unset-all $conf_key + git config --global --unset-all "$conf_key" - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache From c896fed6c715c7b210b85e8efbc776d57c81d9d6 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 20:22:16 +0100 Subject: [PATCH 100/124] no --- .github/workflows/build-game.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index ec4e81c0e..ab6dc4006 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -105,7 +105,10 @@ jobs: conf_key="http.https://github.com/.extraheader" conf_val=$(git config --get "$conf_key" | cut -d " " -f 2-) git config --global "$conf_key" "$conf_val" - haxelib --global run hmm install + echo "$conf_val" + alias git='git --verbose' + haxelib --debug --global run hmm install + unalias git git config --global --unset-all "$conf_key" - if: ${{ matrix.target != 'html5' }} From 354f4cced002cff4365425057c6d6f94b8833df6 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 20:26:01 +0100 Subject: [PATCH 101/124] meow --- .github/workflows/build-game.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index ab6dc4006..1a21b008e 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -104,12 +104,9 @@ jobs: run: | conf_key="http.https://github.com/.extraheader" conf_val=$(git config --get "$conf_key" | cut -d " " -f 2-) - git config --global "$conf_key" "$conf_val" - echo "$conf_val" - alias git='git --verbose' - haxelib --debug --global run hmm install - unalias git - git config --global --unset-all "$conf_key" + git config --system "$conf_key" "$conf_val" + haxelib --global run hmm install -q + git config --system --unset-all "$conf_key" - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache From 804ae7ca6f53625938bfc2381ec4987f9a202a28 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 20:29:39 +0100 Subject: [PATCH 102/124] i am in spain but the s is silent --- .github/workflows/build-game.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 1a21b008e..c2444c175 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -102,11 +102,8 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | - conf_key="http.https://github.com/.extraheader" - conf_val=$(git config --get "$conf_key" | cut -d " " -f 2-) - git config --system "$conf_key" "$conf_val" + haxelib --debug git funkVis https://github.com/FunkinCrew/funkVis backend-rework haxelib --global run hmm install -q - git config --system --unset-all "$conf_key" - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache From 73bc4d474078f4472b4f8f7fd3dd0424316c5de8 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 20:35:55 +0100 Subject: [PATCH 103/124] https://open.spotify.com/track/2zXbLJiS5099aDVyTHIDU4 --- .github/workflows/build-game.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index c2444c175..599275e84 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -102,6 +102,7 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | + git config --global url.https://${{ steps.app_token.outputs.token }}@github.com/.insteadOf https://github.com/ haxelib --debug git funkVis https://github.com/FunkinCrew/funkVis backend-rework haxelib --global run hmm install -q From 2c1109cba0fa8b978eb7ed20fdc6b963857edcd1 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 20:40:45 +0100 Subject: [PATCH 104/124] meow --- build/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/Dockerfile b/build/Dockerfile index 88b44f7a6..b91237185 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -70,6 +70,8 @@ RUN <> /etc/gitconfig [safe] directory = * +[credential] + helper = cache EOC ssh-keyscan -t rsa,ecdsa,ed25519 github.com >> /etc/ssh/ssh_known_hosts From fbff2dc15659341021d1430bfb31182b5c85b800 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 20:44:24 +0100 Subject: [PATCH 105/124] git good --- build/Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/build/Dockerfile b/build/Dockerfile index b91237185..a52749e11 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -28,6 +28,7 @@ echo 'fs.inotify.max_user_instances=1280' | tee -a /etc/sysctl.conf EOF ENV DEBIAN_FRONTEND="noninteractive" +ENV GIT_TERMINAL_PROMPT="0" # Prepare APT RUN < Date: Wed, 24 Apr 2024 16:00:33 -0400 Subject: [PATCH 106/124] Revise Weekend 1 charts --- assets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets b/assets index 0e0781121..1d649965f 160000 --- a/assets +++ b/assets @@ -1 +1 @@ -Subproject commit 0e07811217c579df376719c76d47c1e08b3070e2 +Subproject commit 1d649965f5fcd4d2f83abea1f3f392b42fd0e270 From b6247c933a62c8b5152557f8147f295dd12d4893 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 24 Apr 2024 16:00:50 -0400 Subject: [PATCH 107/124] Disable chart editor on web until it's fixed. --- Project.xml | 6 ++++++ source/funkin/play/PlayState.hx | 2 ++ source/funkin/ui/mainmenu/MainMenuState.hx | 2 ++ 3 files changed, 10 insertions(+) diff --git a/Project.xml b/Project.xml index e232fff91..9c72a9532 100644 --- a/Project.xml +++ b/Project.xml @@ -239,6 +239,12 @@ + + +
+ +
+
diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 4e388407e..6e1452aa9 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -2529,6 +2529,7 @@ class PlayState extends MusicBeatSubState if (FlxG.keys.justPressed.H) camHUD.visible = !camHUD.visible; #end + #if CHART_EDITOR_SUPPORTED // Open the stage editor overlaying the current state. if (controls.DEBUG_STAGE) { @@ -2548,6 +2549,7 @@ class PlayState extends MusicBeatSubState targetSongId: currentSong.id, })); } + #end #if (debug || FORCE_DEBUG_VERSION) // 1: End the song immediately. diff --git a/source/funkin/ui/mainmenu/MainMenuState.hx b/source/funkin/ui/mainmenu/MainMenuState.hx index f053d39fe..90d79ccc1 100644 --- a/source/funkin/ui/mainmenu/MainMenuState.hx +++ b/source/funkin/ui/mainmenu/MainMenuState.hx @@ -323,10 +323,12 @@ class MainMenuState extends MusicBeatState } // Open the debug menu, defaults to ` / ~ + #if CHART_EDITOR_SUPPORTED if (controls.DEBUG_MENU) { FlxG.state.openSubState(new DebugMenuSubState()); } + #end #if (debug || FORCE_DEBUG_VERSION) if (FlxG.keys.pressed.CONTROL && FlxG.keys.pressed.ALT && FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.W) From 918c05b0ed5f056e37908afa6d073a60d7822e17 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 21:06:21 +0100 Subject: [PATCH 108/124] insane in the membrane --- .github/actions/setup-haxe/action.yml | 13 +++++++++++++ .github/workflows/build-game.yml | 10 +++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index dd0a3a59d..05641764e 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -17,6 +17,8 @@ inputs: targets: description: 'Targets we plan to compile to. Installs native dependencies needed.' required: true + gh-token: + description: 'GitHub secret for private repos as dependencies' runs: using: "composite" @@ -73,8 +75,19 @@ runs: name: Install dependencies shell: bash run: | + key="credential.https://github.com" git config --list --show-origin --show-scope + if [ ! -z "${{ inputs.gh-token }}" ]; then + git config --global "credential.helper" 'cache --timeout=3600' + git config --global "$key.username" "git" + git config --global "$key.password" "${{ inputs.gh-token }}" + fi haxelib --debug --global run hmm install + if [ ! -z "${{ inputs.gh-token }}" ]; then + git config --global --unset "credential.helper" + git config --global --unset "$key.username" + git config --global --unset "$key.password" + fi echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" # by default use a shared hxcpp cache diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 599275e84..4d72dc036 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -42,6 +42,8 @@ jobs: - name: Setup build environment uses: ./.github/actions/setup-haxe + with: + gh-token: ${{ steps.app_token.outputs.token }} - name: Build game if: ${{ matrix.target == 'windows' }} @@ -102,9 +104,15 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | - git config --global url.https://${{ steps.app_token.outputs.token }}@github.com/.insteadOf https://github.com/ + key="credential.https://github.com" + git config --global "credential.helper" 'cache --timeout=3600' + git config --global "$key.username" "git" + git config --global "$key.password" "${{ steps.app_token.outputs.token }}" haxelib --debug git funkVis https://github.com/FunkinCrew/funkVis backend-rework haxelib --global run hmm install -q + git config --global --unset "credential.helper" + git config --global --unset "$key.username" + git config --global --unset "$key.password" - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache From 72131af7949067cb3d704f3f58f12fb424aa11f8 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 21:10:39 +0100 Subject: [PATCH 109/124] suffering --- .github/actions/setup-haxe/action.yml | 2 +- .github/workflows/build-game.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index 05641764e..c92964392 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -78,7 +78,7 @@ runs: key="credential.https://github.com" git config --list --show-origin --show-scope if [ ! -z "${{ inputs.gh-token }}" ]; then - git config --global "credential.helper" 'cache --timeout=3600' + git config --global "credential.helper" "store --file=/tmp/git-credentials" git config --global "$key.username" "git" git config --global "$key.password" "${{ inputs.gh-token }}" fi diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 4d72dc036..cb4745d40 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -105,7 +105,7 @@ jobs: name: Install dependencies run: | key="credential.https://github.com" - git config --global "credential.helper" 'cache --timeout=3600' + git config --global "credential.helper" "store --file=/tmp/git-credentials" git config --global "$key.username" "git" git config --global "$key.password" "${{ steps.app_token.outputs.token }}" haxelib --debug git funkVis https://github.com/FunkinCrew/funkVis backend-rework From 7e624af6e63d2118ad181c4f715b74ba00decff6 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 21:18:23 +0100 Subject: [PATCH 110/124] i swear to grub --- .github/actions/setup-haxe/action.yml | 15 +-------------- .github/workflows/build-game.yml | 7 ------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index c92964392..5bed10db8 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -75,20 +75,7 @@ runs: name: Install dependencies shell: bash run: | - key="credential.https://github.com" - git config --list --show-origin --show-scope - if [ ! -z "${{ inputs.gh-token }}" ]; then - git config --global "credential.helper" "store --file=/tmp/git-credentials" - git config --global "$key.username" "git" - git config --global "$key.password" "${{ inputs.gh-token }}" - fi - haxelib --debug --global run hmm install - if [ ! -z "${{ inputs.gh-token }}" ]; then - git config --global --unset "credential.helper" - git config --global --unset "$key.username" - git config --global --unset "$key.password" - fi - echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" + haxelib --global run hmm install -q # by default use a shared hxcpp cache - if: ${{ inputs.hxcpp-cache == 'true' }} diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index cb4745d40..74fd0715d 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -104,15 +104,8 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | - key="credential.https://github.com" - git config --global "credential.helper" "store --file=/tmp/git-credentials" - git config --global "$key.username" "git" - git config --global "$key.password" "${{ steps.app_token.outputs.token }}" haxelib --debug git funkVis https://github.com/FunkinCrew/funkVis backend-rework haxelib --global run hmm install -q - git config --global --unset "credential.helper" - git config --global --unset "$key.username" - git config --global --unset "$key.password" - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache From 694bd2f2dd47e2fb019361ffeb6bb35a76d54a89 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 21:23:05 +0100 Subject: [PATCH 111/124] .......................... --- .github/workflows/build-game.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 74fd0715d..89376f90d 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -104,8 +104,14 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | + git config --global "credential.helper" "store --file=/tmp/git-credentials" + git config --global "credential.https://github.com.username" "git" + git config --global "credential.https://github.com.password" "${{ steps.app_token.outputs.token }}" haxelib --debug git funkVis https://github.com/FunkinCrew/funkVis backend-rework haxelib --global run hmm install -q + git config --global --unset "credential.helper" + git config --global --unset "credential.https://github.com.username" + git config --global --unset "credential.https://github.com.password" - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache From 2d1118ab04aeb2a43f13a896c6fe3d639f0a47aa Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 21:33:02 +0100 Subject: [PATCH 112/124] le pain --- .github/workflows/build-game.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 89376f90d..5786596a3 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -88,6 +88,7 @@ jobs: with: submodules: 'recursive' token: ${{ steps.app_token.outputs.token }} + persist-credentials: false - name: Config haxelib run: | @@ -105,7 +106,7 @@ jobs: name: Install dependencies run: | git config --global "credential.helper" "store --file=/tmp/git-credentials" - git config --global "credential.https://github.com.username" "git" + git config --global "credential.https://github.com.username" "x-access-token" git config --global "credential.https://github.com.password" "${{ steps.app_token.outputs.token }}" haxelib --debug git funkVis https://github.com/FunkinCrew/funkVis backend-rework haxelib --global run hmm install -q From 77bb8fb5d665cfca156e61058d240fc6d6a7bf5a Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 21:39:41 +0100 Subject: [PATCH 113/124] AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA --- .github/workflows/build-game.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 5786596a3..714c1c85c 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -105,14 +105,9 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | - git config --global "credential.helper" "store --file=/tmp/git-credentials" - git config --global "credential.https://github.com.username" "x-access-token" - git config --global "credential.https://github.com.password" "${{ steps.app_token.outputs.token }}" + git config --global url.https://x-access-token:${{ steps.app_token.outputs.token }}@github.com/.insteadOf https://github.com/ haxelib --debug git funkVis https://github.com/FunkinCrew/funkVis backend-rework haxelib --global run hmm install -q - git config --global --unset "credential.helper" - git config --global --unset "credential.https://github.com.username" - git config --global --unset "credential.https://github.com.password" - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache From b38d0026fd21cce3efef94d94093f31023fa86ce Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 21:58:21 +0100 Subject: [PATCH 114/124] i have no idea man --- .github/actions/setup-haxe/action.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index 5bed10db8..e6a309b9e 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -75,7 +75,9 @@ runs: name: Install dependencies shell: bash run: | + git config --global url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf https://github.com/ haxelib --global run hmm install -q + git config --global --unset url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf # by default use a shared hxcpp cache - if: ${{ inputs.hxcpp-cache == 'true' }} From f866b914b5e97dd8986f259b8c84ff5743be0e4d Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 22:02:54 +0100 Subject: [PATCH 115/124] i am dumb --- .github/workflows/build-game.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 714c1c85c..b262b08df 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -106,7 +106,6 @@ jobs: name: Install dependencies run: | git config --global url.https://x-access-token:${{ steps.app_token.outputs.token }}@github.com/.insteadOf https://github.com/ - haxelib --debug git funkVis https://github.com/FunkinCrew/funkVis backend-rework haxelib --global run hmm install -q - if: ${{ matrix.target != 'html5' }} From 7c034c3b81e4c8c761edeac0be129e2f32e1b6a5 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 22:03:56 +0100 Subject: [PATCH 116/124] oops --- .github/workflows/build-game.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index b262b08df..e13908db1 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -107,6 +107,7 @@ jobs: run: | git config --global url.https://x-access-token:${{ steps.app_token.outputs.token }}@github.com/.insteadOf https://github.com/ haxelib --global run hmm install -q + echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache From 55f5e45430975d0bdbebff2c213c540f04b2f82e Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 22:07:33 +0100 Subject: [PATCH 117/124] :pleading_face: --- .github/actions/setup-haxe/action.yml | 1 + .github/workflows/build-game.yml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index e6a309b9e..a27d8bc68 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -78,6 +78,7 @@ runs: git config --global url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf https://github.com/ haxelib --global run hmm install -q git config --global --unset url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf + echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" # by default use a shared hxcpp cache - if: ${{ inputs.hxcpp-cache == 'true' }} diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index e13908db1..b262b08df 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -107,7 +107,6 @@ jobs: run: | git config --global url.https://x-access-token:${{ steps.app_token.outputs.token }}@github.com/.insteadOf https://github.com/ haxelib --global run hmm install -q - echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache From 826199c055e2022909353e973a795f3a9b35787c Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 22:08:35 +0100 Subject: [PATCH 118/124] fix(ci): private repo auth (#508) --- .github/actions/setup-haxe/action.yml | 6 +++++- .github/workflows/build-game.yml | 9 ++++++--- build/Dockerfile | 3 +++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index 54db9bf79..a27d8bc68 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -17,6 +17,8 @@ inputs: targets: description: 'Targets we plan to compile to. Installs native dependencies needed.' required: true + gh-token: + description: 'GitHub secret for private repos as dependencies' runs: using: "composite" @@ -73,7 +75,9 @@ runs: name: Install dependencies shell: bash run: | - haxelib --debug --global run hmm install + git config --global url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf https://github.com/ + haxelib --global run hmm install -q + git config --global --unset url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" # by default use a shared hxcpp cache diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 3bfea20f2..b262b08df 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -23,9 +23,8 @@ jobs: steps: - name: Make git happy - if: ${{ matrix.target == 'macos' }} run: | - git config --global --add safe.directory $GITHUB_WORKSPACE + git config --global --replace-all safe.directory $GITHUB_WORKSPACE - name: Get checkout token uses: actions/create-github-app-token@v1 @@ -43,6 +42,8 @@ jobs: - name: Setup build environment uses: ./.github/actions/setup-haxe + with: + gh-token: ${{ steps.app_token.outputs.token }} - name: Build game if: ${{ matrix.target == 'windows' }} @@ -87,6 +88,7 @@ jobs: with: submodules: 'recursive' token: ${{ steps.app_token.outputs.token }} + persist-credentials: false - name: Config haxelib run: | @@ -103,7 +105,8 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | - haxelib --global run hmm install + git config --global url.https://x-access-token:${{ steps.app_token.outputs.token }}@github.com/.insteadOf https://github.com/ + haxelib --global run hmm install -q - if: ${{ matrix.target != 'html5' }} name: Restore hxcpp cache diff --git a/build/Dockerfile b/build/Dockerfile index 88b44f7a6..a52749e11 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -28,6 +28,7 @@ echo 'fs.inotify.max_user_instances=1280' | tee -a /etc/sysctl.conf EOF ENV DEBIAN_FRONTEND="noninteractive" +ENV GIT_TERMINAL_PROMPT="0" # Prepare APT RUN <> /etc/gitconfig [safe] directory = * +[credential] + helper = cache EOC ssh-keyscan -t rsa,ecdsa,ed25519 github.com >> /etc/ssh/ssh_known_hosts From c102224fc2f05160261111290ec0b17f09e2ddc3 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 22:19:57 +0100 Subject: [PATCH 119/124] this is all i can imagine --- .github/actions/setup-haxe/action.yml | 4 ++-- .github/workflows/build-game.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index a27d8bc68..d0d2178b7 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -75,9 +75,9 @@ runs: name: Install dependencies shell: bash run: | - git config --global url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf https://github.com/ + git config --global 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' https://github.com/ haxelib --global run hmm install -q - git config --global --unset url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf + git config --global --unset 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" # by default use a shared hxcpp cache diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index b262b08df..25c7edcd5 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -105,7 +105,7 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | - git config --global url.https://x-access-token:${{ steps.app_token.outputs.token }}@github.com/.insteadOf https://github.com/ + git config --global 'url.https://x-access-token:${{ steps.app_token.outputs.token }}@github.com/.insteadOf' https://github.com/ haxelib --global run hmm install -q - if: ${{ matrix.target != 'html5' }} From 71ea913f0a6a702d68ddf68958be246d5e47a6d3 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 22:21:54 +0100 Subject: [PATCH 120/124] fix(ci): priv repo auth, ii. (#509) --- .github/actions/setup-haxe/action.yml | 4 ++-- .github/workflows/build-game.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index a27d8bc68..d0d2178b7 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -75,9 +75,9 @@ runs: name: Install dependencies shell: bash run: | - git config --global url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf https://github.com/ + git config --global 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' https://github.com/ haxelib --global run hmm install -q - git config --global --unset url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf + git config --global --unset 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" # by default use a shared hxcpp cache diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index b262b08df..25c7edcd5 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -105,7 +105,7 @@ jobs: - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies run: | - git config --global url.https://x-access-token:${{ steps.app_token.outputs.token }}@github.com/.insteadOf https://github.com/ + git config --global 'url.https://x-access-token:${{ steps.app_token.outputs.token }}@github.com/.insteadOf' https://github.com/ haxelib --global run hmm install -q - if: ${{ matrix.target != 'html5' }} From 128958697ad7a3e887e5f4f7df898fa9df24f583 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 22:23:29 +0100 Subject: [PATCH 121/124] oh my god --- .github/actions/setup-haxe/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index d0d2178b7..fd0da3187 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -75,6 +75,7 @@ runs: name: Install dependencies shell: bash run: | + git config --global --unset 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' || true git config --global 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' https://github.com/ haxelib --global run hmm install -q git config --global --unset 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' From 0cb206cc524067a75eacc52006b31f4be2d4acf2 Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 23:10:17 +0100 Subject: [PATCH 122/124] fix(ci): private repo auth, for real this time (#510) --- .github/actions/setup-haxe/action.yml | 10 ++- .github/workflows/build-docker-image.yml | 70 ++++++++++---------- .github/workflows/build-game.yml | 1 + .github/workflows/cancel-merged-branches.yml | 2 +- build/Dockerfile | 2 - 5 files changed, 44 insertions(+), 41 deletions(-) diff --git a/.github/actions/setup-haxe/action.yml b/.github/actions/setup-haxe/action.yml index fd0da3187..5a9f7b293 100644 --- a/.github/actions/setup-haxe/action.yml +++ b/.github/actions/setup-haxe/action.yml @@ -71,14 +71,18 @@ runs: path: .haxelib key: haxe-hmm-${{ runner.os }}-${{ hashFiles('**/hmm.json') }} + - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} + name: Prep git for dependency install + uses: gacts/run-and-post-run@v1 + with: + run: git config --global 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' https://github.com/ + post: git config --global --unset 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' + - if: ${{ steps.cache-hmm.outputs.cache-hit != 'true' }} name: Install dependencies shell: bash run: | - git config --global --unset 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' || true - git config --global 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' https://github.com/ haxelib --global run hmm install -q - git config --global --unset 'url.https://x-access-token:${{ inputs.gh-token }}@github.com/.insteadOf' echo "TIMER_DONE=$(date +%s)" >> "$GITHUB_ENV" # by default use a shared hxcpp cache diff --git a/.github/workflows/build-docker-image.yml b/.github/workflows/build-docker-image.yml index 15c9e5582..6fbc9677e 100644 --- a/.github/workflows/build-docker-image.yml +++ b/.github/workflows/build-docker-image.yml @@ -4,8 +4,8 @@ on: workflow_dispatch: push: paths: - - '**/Dockerfile' - - '.github/workflows/build-docker-image.yml' + - '**/Dockerfile' + - '.github/workflows/build-docker-image.yml' jobs: build-and-push-image: @@ -15,39 +15,39 @@ jobs: packages: write steps: - - name: Get checkout token - uses: actions/create-github-app-token@v1 - id: app_token - with: - app-id: ${{ vars.APP_ID }} - private-key: ${{ secrets.APP_PEM }} - owner: ${{ github.repository_owner }} + - name: Get checkout token + uses: actions/create-github-app-token@v1 + id: app_token + with: + app-id: ${{ vars.APP_ID }} + private-key: ${{ secrets.APP_PEM }} + owner: ${{ github.repository_owner }} - - name: Checkout repo - uses: funkincrew/ci-checkout@v6 - with: - submodules: false - token: ${{ steps.app_token.outputs.token }} + - name: Checkout repo + uses: funkincrew/ci-checkout@v6 + with: + submodules: false + token: ${{ steps.app_token.outputs.token }} - - name: Log into GitHub Container Registry - uses: docker/login-action@v3.1.0 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + - name: Log into GitHub Container Registry + uses: docker/login-action@v3.1.0 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push Docker image - uses: docker/build-push-action@v5.3.0 - with: - context: ./build - push: true - tags: | - ghcr.io/funkincrew/build-dependencies:latest - ghcr.io/funkincrew/build-dependencies:${{ github.sha }} - labels: | - org.opencontainers.image.description=precooked haxe build-dependencies - org.opencontainers.image.revision=${{ github.sha }} - org.opencontainers.image.source=https://github.com/${{ github.repository }} - org.opencontainers.image.title=${{ github.repository_owner }}/build-dependencies - org.opencontainers.image.url=https://github.com/${{ github.repository }} - org.opencontainers.image.version=${{ github.sha }} + - name: Build and push Docker image + uses: docker/build-push-action@v5.3.0 + with: + context: ./build + push: true + tags: | + ghcr.io/funkincrew/build-dependencies:latest + ghcr.io/funkincrew/build-dependencies:${{ github.sha }} + labels: | + org.opencontainers.image.description=precooked haxe build-dependencies + org.opencontainers.image.revision=${{ github.sha }} + org.opencontainers.image.source=https://github.com/${{ github.repository }} + org.opencontainers.image.title=${{ github.repository_owner }}/build-dependencies + org.opencontainers.image.url=https://github.com/${{ github.repository }} + org.opencontainers.image.version=${{ github.sha }} diff --git a/.github/workflows/build-game.yml b/.github/workflows/build-game.yml index 25c7edcd5..07802557c 100644 --- a/.github/workflows/build-game.yml +++ b/.github/workflows/build-game.yml @@ -39,6 +39,7 @@ jobs: with: submodules: 'recursive' token: ${{ steps.app_token.outputs.token }} + persist-credentials: false - name: Setup build environment uses: ./.github/actions/setup-haxe diff --git a/.github/workflows/cancel-merged-branches.yml b/.github/workflows/cancel-merged-branches.yml index f66f9647b..254b21a24 100644 --- a/.github/workflows/cancel-merged-branches.yml +++ b/.github/workflows/cancel-merged-branches.yml @@ -3,7 +3,7 @@ name: Cancel queued workflows on PR merge on: pull_request: types: - - closed + - closed jobs: diff --git a/build/Dockerfile b/build/Dockerfile index a52749e11..c545d1364 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -71,8 +71,6 @@ RUN <> /etc/gitconfig [safe] directory = * -[credential] - helper = cache EOC ssh-keyscan -t rsa,ecdsa,ed25519 github.com >> /etc/ssh/ssh_known_hosts From bebb16875ebd1be5d3c024b3a48675bdcb08e1ca Mon Sep 17 00:00:00 2001 From: Hazel Date: Wed, 24 Apr 2024 23:31:00 +0100 Subject: [PATCH 123/124] hardcode funkvis version --- hmm.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hmm.json b/hmm.json index 6ee95f984..fd6da955c 100644 --- a/hmm.json +++ b/hmm.json @@ -49,7 +49,7 @@ "name": "funkVis", "type": "git", "dir": null, - "ref": "backend-rework", + "ref": "7fc9901", "url": "https://github.com/FunkinCrew/funkVis" }, { From 03b1f17fe2ce5e9e626aa8471c8e72e518a6b096 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Wed, 24 Apr 2024 19:25:05 -0400 Subject: [PATCH 124/124] clearer project.xml haxedefs --- Project.xml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Project.xml b/Project.xml index 9c72a9532..0a44a268c 100644 --- a/Project.xml +++ b/Project.xml @@ -240,10 +240,8 @@
- -
- -
+ +