diff --git a/scripts/Postbuild.hx b/scripts/Postbuild.hx index fb10f422b..a2d300081 100644 --- a/scripts/Postbuild.hx +++ b/scripts/Postbuild.hx @@ -31,16 +31,15 @@ class Postbuild else { var bytes:haxe.io.Bytes = haxe.io.Bytes.ofData(sys.io.File.getBytes(path).getData()); - var entry:haxe.zip.Entry = - { - fileName: StringTools.replace(path, inDir, ""), - fileSize: bytes.length, - fileTime: Date.now(), - compressed: false, - dataSize: sys.FileSystem.stat(path).size, - data: bytes, - crc32: haxe.crypto.Crc32.make(bytes) - }; + var entry:haxe.zip.Entry = { + fileName: StringTools.replace(path, inDir, ""), + fileSize: bytes.length, + fileTime: Date.now(), + compressed: false, + dataSize: sys.FileSystem.stat(path).size, + data: bytes, + crc32: haxe.crypto.Crc32.make(bytes) + }; entries.push(entry); } } diff --git a/scripts/SongConverter.hx b/scripts/SongConverter.hx index b427b1778..ebfa92472 100644 --- a/scripts/SongConverter.hx +++ b/scripts/SongConverter.hx @@ -23,6 +23,7 @@ class SongConverter // TODO // Update engine shit, to accomodate single file + static function main() { // trace(Compiler.get); diff --git a/source/funkin/Conductor.hx b/source/funkin/Conductor.hx index 9012cec12..23701c4a4 100644 --- a/source/funkin/Conductor.hx +++ b/source/funkin/Conductor.hx @@ -868,10 +868,14 @@ class Conductor var wantedBeatLengthMs:Float = ((Constants.SECS_PER_MIN / wantedTimeChange.bpm) * Constants.MS_PER_SEC) * (4 / wantedTimeChange.timeSignatureDen); return switch (type.toLowerCase()) { - case "measure", "m": wantedBeatLengthMs * wantedTimeChange.timeSignatureNum; - case "beat", "b": wantedBeatLengthMs; - case "step", "s": wantedBeatLengthMs / Constants.STEPS_PER_BEAT; - default: wantedBeatLengthMs; + case "measure", "m": + wantedBeatLengthMs * wantedTimeChange.timeSignatureNum; + case "beat", "b": + wantedBeatLengthMs; + case "step", "s": + wantedBeatLengthMs / Constants.STEPS_PER_BEAT; + default: + wantedBeatLengthMs; } } diff --git a/source/funkin/FunkinMemory.hx b/source/funkin/FunkinMemory.hx index c164f72ca..42d032c9c 100644 --- a/source/funkin/FunkinMemory.hx +++ b/source/funkin/FunkinMemory.hx @@ -20,11 +20,9 @@ class FunkinMemory static var permanentCachedTextures:Map = []; static var currentCachedTextures:Map = []; static var previousCachedTextures:Map = []; - static var permanentCachedSounds:Map = []; static var currentCachedSounds:Map = []; static var previousCachedSounds:Map = []; - static var purgeFilter:Array = ["/week", "/characters", "/charSelect", "/results"]; /** diff --git a/source/funkin/Highscore.hx b/source/funkin/Highscore.hx index 2b29beaf3..fd37b47ca 100644 --- a/source/funkin/Highscore.hx +++ b/source/funkin/Highscore.hx @@ -82,9 +82,7 @@ typedef RawTallies = var good:Int; var sick:Int; var maxCombo:Int; - var score:Int; - var isNewHighscore:Bool; /** diff --git a/source/funkin/InitState.hx b/source/funkin/InitState.hx index bd7dabb80..eb4af20d3 100644 --- a/source/funkin/InitState.hx +++ b/source/funkin/InitState.hx @@ -237,7 +237,9 @@ class InitState extends FlxState // ANDROID SETUP // #if android - FlxG.android.preventDefaultKeys = [flixel.input.android.FlxAndroidKey.BACK]; + FlxG.android.preventDefaultKeys = [ + flixel.input.android.FlxAndroidKey.BACK + ]; #end // @@ -309,7 +311,8 @@ class InitState extends FlxState } #if FEATURE_LOST_FOCUS_VOLUME - @:noCompletion var _lastFocusVolume:Null; + @:noCompletion + var _lastFocusVolume:Null; function onLostFocus():Void { diff --git a/source/funkin/PlayerSettings.hx b/source/funkin/PlayerSettings.hx index bd37eec34..df9f28ea7 100644 --- a/source/funkin/PlayerSettings.hx +++ b/source/funkin/PlayerSettings.hx @@ -21,7 +21,6 @@ class PlayerSettings public static var player1(default, null):PlayerSettings; @:nullSafety(Off) public static var player2(default, null):PlayerSettings; - public static var onAvatarAdd(default, null) = new FlxTypedSignalVoid>(); public static var onAvatarRemove(default, null) = new FlxTypedSignalVoid>(); @@ -45,9 +44,12 @@ class PlayerSettings { return switch (id) { - case 1: player1; - case 2: player2; - default: null; + case 1: + player1; + case 2: + player2; + default: + null; }; } diff --git a/source/funkin/api/discord/DiscordClient.hx b/source/funkin/api/discord/DiscordClient.hx index e9177bafa..84ed8c6c8 100644 --- a/source/funkin/api/discord/DiscordClient.hx +++ b/source/funkin/api/discord/DiscordClient.hx @@ -8,13 +8,11 @@ import hxdiscord_rpc.Types.DiscordRichPresence; import hxdiscord_rpc.Types.DiscordUser; import sys.thread.Thread; -@:build(funkin.util.macro.EnvironmentMacro.build()) -@:nullSafety +@:build(funkin.util.macro.EnvironmentMacro.build()) @:nullSafety class DiscordClient { @:envField static final DISCORD_CLIENT_ID:Null; - public static var instance(get, never):DiscordClient; static var _instance:Null = null; @@ -138,6 +136,7 @@ class DiscordClient } // TODO: WHAT THE FUCK get this pointer bullfuckery out of here + private static function onReady(request:cpp.RawConstPointer):Void { trace(' DISCORD '.bold().bg_blue() + ' Client has connected!'); diff --git a/source/funkin/api/newgrounds/Leaderboards.hx b/source/funkin/api/newgrounds/Leaderboards.hx index 323777c0d..354fbb2a3 100644 --- a/source/funkin/api/newgrounds/Leaderboards.hx +++ b/source/funkin/api/newgrounds/Leaderboards.hx @@ -236,14 +236,12 @@ enum abstract Leaderboard(Int) from Int to Int public var StoryWeek6 = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 14244 #else 9957 #end; public var StoryWeek7 = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 14245 #else 14682 #end; public var StoryWeekend1 = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 14237 #else 14683 #end; - // Collab 1 only has one song. // // SONGS // // Tutorial public var Tutorial = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 14249 #else 14684 #end; - // Week 1 public var Bopeebo = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 14246 #else 9603 #end; public var BopeeboErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14685 #end; @@ -254,7 +252,6 @@ enum abstract Leaderboard(Int) from Int to Int public var DadBattle = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 14248 #else 9605 #end; public var DadBattleErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14689 #end; public var DadBattlePicoMix = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14690 #end; - // Week 2 public var Spookeez = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 9604 #end; public var SpookeezErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14691 #end; @@ -263,7 +260,6 @@ enum abstract Leaderboard(Int) from Int to Int public var SouthErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14693 #end; public var SouthPicoMix = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14694 #end; public var Monster = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14703 #end; - // Week 3 public var Pico = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 9766 #end; public var PicoErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14695 #end; @@ -274,14 +270,12 @@ enum abstract Leaderboard(Int) from Int to Int public var Blammed = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 9768 #end; public var BlammedErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14704 #end; public var BlammedPicoMix = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14705 #end; - // Week 4 public var SatinPanties = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 9869 #end; public var SatinPantiesErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14701 #end; public var High = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 9867 #end; public var HighErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14699 #end; public var MILF = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 9868 #end; - // Week 5 public var Cocoa = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14706 #end; public var CocoaErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14707 #end; @@ -290,7 +284,6 @@ enum abstract Leaderboard(Int) from Int to Int public var EggnogErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14711 #end; public var EggnogPicoMix = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14710 #end; public var WinterHorrorland = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14712 #end; - // Week 6 public var Senpai = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 9958 #end; public var SenpaiErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14713 #end; @@ -300,7 +293,6 @@ enum abstract Leaderboard(Int) from Int to Int public var RosesPicoMix = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14717 #end; public var Thorns = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 9960 #end; public var ThornsErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14715 #end; - // Week 7 public var Ugh = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14718 #end; public var UghErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14722 #end; @@ -309,7 +301,6 @@ enum abstract Leaderboard(Int) from Int to Int public var GunsPicoMix = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14723 #end; public var Stress = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14720 #end; public var StressPicoMix = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14724 #end; - // Weekend 1 public var Darnell = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14725 #end; public var DarnellErect = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14727 #end; @@ -318,7 +309,6 @@ enum abstract Leaderboard(Int) from Int to Int public var LitUpBFMix = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14729 #end; public var TwoHot = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14730 #end; // Variable names can't start with a number! public var Blazin = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 1000000 #else 14731 #end; - // Collab 1 public var Spaghetti = #if FEATURE_NEWGROUNDS_TESTING_MEDALS 15448 #else 15451 #end; diff --git a/source/funkin/api/newgrounds/Medals.hx b/source/funkin/api/newgrounds/Medals.hx index cbcb30c19..a25b957b2 100644 --- a/source/funkin/api/newgrounds/Medals.hx +++ b/source/funkin/api/newgrounds/Medals.hx @@ -438,7 +438,27 @@ enum abstract Medal(Int) from Int to Int */ public static function getAllMedals():Array { - return - [StartGame, StoryTutorial, StoryWeek1, StoryWeek2, StoryWeek3, StoryWeek4, StoryWeek5, StoryWeek6, StoryWeek7, StoryWeekend1, CharSelect, FreeplayPicoMix, FreeplayStressPico, LossRating, PerfectRatingHard, GoldPerfectRatingHard, ErectDifficulty, GoldPerfectRatingNightmare, FridayNight, Nice]; + return [ + StartGame, + StoryTutorial, + StoryWeek1, + StoryWeek2, + StoryWeek3, + StoryWeek4, + StoryWeek5, + StoryWeek6, + StoryWeek7, + StoryWeekend1, + CharSelect, + FreeplayPicoMix, + FreeplayStressPico, + LossRating, + PerfectRatingHard, + GoldPerfectRatingHard, + ErectDifficulty, + GoldPerfectRatingNightmare, + FridayNight, + Nice + ]; } } diff --git a/source/funkin/api/newgrounds/NGSaveSlot.hx b/source/funkin/api/newgrounds/NGSaveSlot.hx index e07da891c..8d14d7d02 100644 --- a/source/funkin/api/newgrounds/NGSaveSlot.hx +++ b/source/funkin/api/newgrounds/NGSaveSlot.hx @@ -7,8 +7,7 @@ import io.newgrounds.Call.CallError; import io.newgrounds.objects.events.Outcome; import funkin.save.Save; -@:nullSafety -@:access(funkin.save.Save) +@:nullSafety @:access(funkin.save.Save) class NGSaveSlot { public static var instance(get, never):NGSaveSlot; diff --git a/source/funkin/api/newgrounds/NewgroundsClient.hx b/source/funkin/api/newgrounds/NewgroundsClient.hx index 5c3277068..0cfa818fa 100644 --- a/source/funkin/api/newgrounds/NewgroundsClient.hx +++ b/source/funkin/api/newgrounds/NewgroundsClient.hx @@ -17,18 +17,14 @@ import io.newgrounds.objects.User; import funkin.mobile.util.WebViewUtil; #end -@:build(funkin.util.macro.EnvironmentMacro.build()) -@:nullSafety +@:build(funkin.util.macro.EnvironmentMacro.build()) @:nullSafety class NewgroundsClient { @:envField static final API_NG_APP_ID:Null; - @:envField static final API_NG_ENC_KEY:Null; - public static var instance(get, never):NewgroundsClient; - static var _instance:Null = null; static function get_instance():NewgroundsClient diff --git a/source/funkin/audio/FunkinSound.hx b/source/funkin/audio/FunkinSound.hx index f2d62ea1a..e9738e6e4 100644 --- a/source/funkin/audio/FunkinSound.hx +++ b/source/funkin/audio/FunkinSound.hx @@ -329,9 +329,12 @@ class FunkinSound extends FlxSound implements ICloneable var suffix = params.suffix ?? ''; var pathToUse = switch (pathsFunction) { - case MUSIC: Paths.music('$key/$key'); - case INST: Paths.inst('$key', suffix); - default: Paths.music('$key/$key'); + case MUSIC: + Paths.music('$key/$key'); + case INST: + Paths.inst('$key', suffix); + default: + Paths.music('$key/$key'); } var shouldLoadPartial = params.partialParams?.loadPartial ?? false; @@ -528,9 +531,7 @@ class FunkinSound extends FlxSound implements ICloneable this._waveformData = null; } - @:access(openfl.media.Sound) - @:access(openfl.media.SoundChannel) - @:access(openfl.media.SoundMixer) + @:access(openfl.media.Sound) @:access(openfl.media.SoundChannel) @:access(openfl.media.SoundMixer) override function startSound(startTime:Float) { if (!important) diff --git a/source/funkin/audio/SoundGroup.hx b/source/funkin/audio/SoundGroup.hx index 0c26a0dc8..f8c5583c3 100644 --- a/source/funkin/audio/SoundGroup.hx +++ b/source/funkin/audio/SoundGroup.hx @@ -11,13 +11,9 @@ import flixel.tweens.FlxTween; class SoundGroup extends FlxTypedGroup { public var time(get, set):Float; - public var volume(get, set):Float; - public var muted(get, set):Bool; - public var pitch(get, set):Float; - public var playing(get, never):Bool; public function new() @@ -242,6 +238,7 @@ class SoundGroup extends FlxTypedGroup } // in PlayState, adjust the code so that it only mutes the player1 vocal tracks? + function set_volume(volume:Float):Float { forEachAlive(function(snd:FunkinSound) diff --git a/source/funkin/audio/visualize/ABotVis.hx b/source/funkin/audio/visualize/ABotVis.hx index d39ee7b41..e644eadd4 100644 --- a/source/funkin/audio/visualize/ABotVis.hx +++ b/source/funkin/audio/visualize/ABotVis.hx @@ -15,7 +15,6 @@ class ABotVis extends FlxTypedSpriteGroup // public var vis:VisShit; var analyzer:Null = null; var analyzerLevelsCache:Array = new Array(); - var volumes:Array = []; public var snd:Null = null; @@ -23,6 +22,7 @@ class ABotVis extends FlxTypedSpriteGroup static final BAR_COUNT:Int = 7; // TODO: Make the sprites easier to soft code. + public function new(snd:FlxSound, pixel:Bool) { super(); @@ -35,8 +35,40 @@ class ABotVis extends FlxTypedSpriteGroup var visFrms:FlxAtlasFrames = Paths.getSparrowAtlas(pixel ? 'characters/abotPixel/aBotVizPixel' : 'characters/abot/aBotViz'); // these are the differences in X position, from left to right - var positionX:Array = pixel ? [0, 7 * 6, 8 * 6, 9 * 6, 10 * 6, 6 * 6, 7 * 6] : [0, 59, 56, 66, 54, 52, 51]; - var positionY:Array = pixel ? [0, -2 * 6, -1 * 6, 0, 0, 1 * 6, 2 * 6] : [0, -8, -3.5, -0.4, 0.5, 4.7, 7]; + var positionX:Array = pixel ? [ + 0, + 7 * 6, + 8 * 6, + 9 * 6, + 10 * 6, + 6 * 6, + 7 * 6 + ] : [ + 0, + 59, + 56, + 66, + 54, + 52, + 51 + ]; + var positionY:Array = pixel ? [ + 0, + -2 * 6, + -1 * 6, + 0, + 0, + 1 * 6, + 2 * 6 + ] : [ + 0, + -8, + -3.5, + -0.4, + 0.5, + 4.7, + 7 + ]; for (index in 1...visCount) { diff --git a/source/funkin/audio/visualize/PolygonSpectogram.hx b/source/funkin/audio/visualize/PolygonSpectogram.hx index cf255052c..aba12f96c 100644 --- a/source/funkin/audio/visualize/PolygonSpectogram.hx +++ b/source/funkin/audio/visualize/PolygonSpectogram.hx @@ -23,7 +23,6 @@ class PolygonSpectogram extends MeshRender public var audioData:Int16Array; public var detail:Float = 1; - public var thickness:Float = 2; public var waveAmplitude:Int = 100; diff --git a/source/funkin/audio/visualize/SpectogramSprite.hx b/source/funkin/audio/visualize/SpectogramSprite.hx index d7a8da8ed..d58224660 100644 --- a/source/funkin/audio/visualize/SpectogramSprite.hx +++ b/source/funkin/audio/visualize/SpectogramSprite.hx @@ -16,14 +16,11 @@ using flixel.util.FlxSpriteUtil; class SpectogramSprite extends FlxTypedSpriteGroup { var sampleRate:Int; - var lengthOfShit:Int = 500; public var visType:VISTYPE = UPDATED; - public var col:Int = FlxColor.WHITE; public var daHeight:Float = FlxG.height; - public var vis:VisShit; public function new(daSound:FlxSound, ?col:FlxColor = FlxColor.WHITE, ?height:Float = 720, ?amnt:Int = 500) diff --git a/source/funkin/audio/visualize/VisShit.hx b/source/funkin/audio/visualize/VisShit.hx index 7d960efdd..828f6a2a7 100644 --- a/source/funkin/audio/visualize/VisShit.hx +++ b/source/funkin/audio/visualize/VisShit.hx @@ -64,7 +64,10 @@ class VisShit while (c < samples.length) { // take a chunk (zero-padded if needed) and apply the window - final chunk = [for (n in 0...fftN) (c + n < samples.length ? samples[c + n] : 0.0) * window(n)]; + final chunk = [ + for (n in 0...fftN) + (c + n < samples.length ? samples[c + n] : 0.0) * window(n) + ]; // compute positive spectrum with sampling correction and BP filter final freqs = FFT.rfft(chunk).map(z -> z.scale(1 / fftN).magnitude).mapi(melodicBandPass); diff --git a/source/funkin/audio/visualize/dsp/Complex.hx b/source/funkin/audio/visualize/dsp/Complex.hx index 2e89c8ea3..c88dc9706 100644 --- a/source/funkin/audio/visualize/dsp/Complex.hx +++ b/source/funkin/audio/visualize/dsp/Complex.hx @@ -3,8 +3,7 @@ package funkin.audio.visualize.dsp; /** Complex number representation. **/ -@:forward(real, imag) @:notNull @:pure -@:nullSafety +@:forward(real, imag) @:notNull @:pure @:nullSafety abstract Complex({ final real:Float; final imag:Float; diff --git a/source/funkin/audio/visualize/dsp/FFT.hx b/source/funkin/audio/visualize/dsp/FFT.hx index 412a76f47..c7f622bb6 100644 --- a/source/funkin/audio/visualize/dsp/FFT.hx +++ b/source/funkin/audio/visualize/dsp/FFT.hx @@ -43,10 +43,14 @@ class FFT public static function ifft(input:Array):Array return do_fft(input, true); // Handles padding and scaling for forwards and inverse FFTs. + static function do_fft(input:Array, inverse:Bool):Array { final n = nextPow2(input.length); - var ts = [for (i in 0...n) if (i < input.length) input[i] else Complex.zero]; + var ts = [ + for (i in 0...n) + if (i < input.length) input[i] else Complex.zero + ]; var fs = [for (_ in 0...n) Complex.zero]; ditfft2(ts, 0, fs, 0, n, 1, inverse); return inverse ? fs.map(z -> z.scale(1 / n)) : fs; @@ -54,6 +58,7 @@ class FFT } // Radix-2 Decimation-In-Time variant of Cooley–Tukey's FFT, recursive. + static function ditfft2(time:Array, t:Int, freq:Array, f:Int, n:Int, step:Int, inverse:Bool):Void { if (n == 1) @@ -77,6 +82,7 @@ class FFT } // Naive O(n^2) DFT, used for testing purposes. + static function dft(ts:Array, ?inverse:Bool):Array { if (inverse == null) inverse = false; @@ -110,6 +116,7 @@ class FFT } // testing, but also acts like an example + static function main() { // sampling and buffer parameters @@ -119,15 +126,24 @@ class FFT // build a time signal as a sum of sinusoids final freqs = [5919.911]; - final ts = [for (n in 0...N) freqs.map(f -> Math.sin(2 * Math.PI * f * n / Fs)).sum()]; + final ts = [ + for (n in 0...N) + freqs.map(f -> Math.sin(2 * Math.PI * f * n / Fs)).sum() + ]; // get positive spectrum and use its symmetry to reconstruct negative domain final fs_pos = rfft(ts); - final fs_fft = new OffsetArray([for (k in -(halfN - 1)...0) fs_pos[-k].conj()].concat(fs_pos), -(halfN - 1)); + final fs_fft = new OffsetArray([ + for (k in -(halfN - 1)...0) + fs_pos[-k].conj() + ].concat(fs_pos), -(halfN - 1)); // double-check with naive DFT final fs_dft = new OffsetArray(dft(ts.map(Complex.fromReal)).circShift(halfN - 1), -(halfN - 1)); - final fs_err = [for (k in -(halfN - 1)...halfN) fs_fft[k] - fs_dft[k]]; + final fs_err = [ + for (k in -(halfN - 1)...halfN) + fs_fft[k] - fs_dft[k] + ]; final max_fs_err = fs_err.map(z -> z.magnitude).max(); if (max_fs_err > 1e-6) haxe.Log.trace('FT Error: ${max_fs_err}', null); // else for (k => s in fs_fft) haxe.Log.trace('${k * Fs / N};${s.scale(1 / Fs).magnitude}', null); @@ -143,14 +159,20 @@ class FFT } else { - final freqs_err = [for (i in 0...freqs.length) freqis[i] - freqs[i]]; + final freqs_err = [ + for (i in 0...freqs.length) + freqis[i] - freqs[i] + ]; final max_freqs_err = freqs_err.map(Math.abs).max(); if (max_freqs_err > Fs / N) trace('Frequency Errors: ${freqs_err}'); } // recover time signal from the frequency domain final ts_ifft = ifft(fs_fft.array.circShift(-(halfN - 1)).map(z -> z.scale(1 / Fs))); - final ts_err = [for (n in 0...N) ts_ifft[n].scale(Fs).real - ts[n]]; + final ts_err = [ + for (n in 0...N) + ts_ifft[n].scale(Fs).real - ts[n] + ]; final max_ts_err = ts_err.map(Math.abs).max(); if (max_ts_err > 1e-6) haxe.Log.trace('IFT Error: ${max_ts_err}', null); // else for (n in 0...ts_ifft.length) haxe.Log.trace('${n / Fs};${ts_ifft[n].scale(Fs).real}', null); diff --git a/source/funkin/audio/visualize/dsp/OffsetArray.hx b/source/funkin/audio/visualize/dsp/OffsetArray.hx index 3a391b583..42ea744d8 100644 --- a/source/funkin/audio/visualize/dsp/OffsetArray.hx +++ b/source/funkin/audio/visualize/dsp/OffsetArray.hx @@ -5,8 +5,7 @@ package funkin.audio.visualize.dsp; Usages include 1-indexed sequences or zero-centered buffers with negative indexing. **/ -@:forward(array, offset) -@:nullSafety +@:forward(array, offset) @:nullSafety abstract OffsetArray({ final array:Array; final offset:Int; diff --git a/source/funkin/audio/visualize/dsp/Signal.hx b/source/funkin/audio/visualize/dsp/Signal.hx index 8a5a73a42..c7291bab9 100644 --- a/source/funkin/audio/visualize/dsp/Signal.hx +++ b/source/funkin/audio/visualize/dsp/Signal.hx @@ -47,7 +47,10 @@ class Signal var peaks = new Array(); - final dy = [for (i in 1...y.length) y[i] - y[i - 1]]; + final dy = [ + for (i in 1...y.length) + y[i] - y[i - 1] + ]; for (i in 1...dy.length) { // peak: function growth positive to its left and negative to its right diff --git a/source/funkin/audio/waveform/WaveformDataParser.hx b/source/funkin/audio/waveform/WaveformDataParser.hx index 5a1343bd5..c668d104e 100644 --- a/source/funkin/audio/waveform/WaveformDataParser.hx +++ b/source/funkin/audio/waveform/WaveformDataParser.hx @@ -7,7 +7,6 @@ class WaveformDataParser static final INT16_MAX:Int = 32767; @:native("int16_min") static final INT16_MIN:Int = -32768; - @:native("int8_max") static final INT8_MAX:Int = 127; @:native("int8_min") @@ -82,7 +81,9 @@ class WaveformDataParser { for (channelIndex in 0...channels) { - var sampleValue:Int = soundData[sampleIndex * channels + channelIndex]; + var sampleValue:Int = soundData[ + sampleIndex * channels + channelIndex + ]; if (sampleValue < minValues[channelIndex]) minValues[channelIndex] = sampleValue; if (sampleValue > maxValues[channelIndex]) maxValues[channelIndex] = sampleValue; @@ -94,7 +95,9 @@ class WaveformDataParser for (channelIndex in 0...channels) { outputData[baseIndex + channelIndex * 2] = minValues[channelIndex]; - outputData[baseIndex + channelIndex * 2 + 1] = maxValues[channelIndex]; + outputData[ + baseIndex + channelIndex * 2 + 1 + ] = maxValues[channelIndex]; } } diff --git a/source/funkin/data/BaseRegistry.hx b/source/funkin/data/BaseRegistry.hx index 34cc8b9cf..4b65f9574 100644 --- a/source/funkin/data/BaseRegistry.hx +++ b/source/funkin/data/BaseRegistry.hx @@ -16,9 +16,7 @@ typedef EntryConstructorFunction = (String, ?Dynamic) -> Void; * @param J The type of the JSON data used when constructing. * @param P The type of the parameters used for `fetchEntry()`. */ -@:nullSafety -@:generic -@:autoBuild(funkin.util.macro.RegistryMacro.buildRegistry()) +@:nullSafety @:generic @:autoBuild(funkin.util.macro.RegistryMacro.buildRegistry()) abstract class BaseRegistry & Constructible), J, P> { /** diff --git a/source/funkin/data/DataParse.hx b/source/funkin/data/DataParse.hx index 98003fb7f..ef5c0ef9e 100644 --- a/source/funkin/data/DataParse.hx +++ b/source/funkin/data/DataParse.hx @@ -224,7 +224,10 @@ class DataParse */ static function jsonArrayToDynamicArray(jsons:Array):Array> { - return [for (json in jsons) Tools.getValue(json)]; + return [ + for (json in jsons) + Tools.getValue(json) + ]; } static function legacyNoteSectionArray(json:Json, name:String):Array @@ -232,7 +235,10 @@ class DataParse switch (json.value) { case JArray(values): - return [for (value in values) legacyNoteSection(value, name)]; + return [ + for (value in values) + legacyNoteSection(value, name) + ]; default: throw 'Expected property to be an array, but it was ${json.value}.'; } @@ -293,7 +299,10 @@ class DataParse switch (json.value) { case JArray(values): - return [for (value in values) legacyNote(value, name)]; + return [ + for (value in values) + legacyNote(value, name) + ]; default: throw 'Expected property $name to be an array of notes, but it was ${json.value}.'; } diff --git a/source/funkin/data/IRegistryEntry.hx b/source/funkin/data/IRegistryEntry.hx index 70f464f86..b0bef3d45 100644 --- a/source/funkin/data/IRegistryEntry.hx +++ b/source/funkin/data/IRegistryEntry.hx @@ -9,11 +9,9 @@ package funkin.data; interface IRegistryEntry { public final id:String; - // public function new(id:String):Void; public function destroy():Void; public function toString():String; - // Can't make an interface field private I guess. public final _data:T; // Can't make a static field required by an interface I guess. diff --git a/source/funkin/data/animation/AnimationData.hx b/source/funkin/data/animation/AnimationData.hx index 28ff2a272..84310284f 100644 --- a/source/funkin/data/animation/AnimationData.hx +++ b/source/funkin/data/animation/AnimationData.hx @@ -93,40 +93,35 @@ typedef UnnamedAnimationData = * Offset the character's position by this amount when playing this animation. * @default [0, 0] */ - @:default([0, 0]) - @:optional + @:default([0, 0]) @:optional var offsets:Null>; /** * Whether the animation should loop when it finishes. * @default false */ - @:default(false) - @:optional + @:default(false) @:optional var looped:Bool; /** * Whether the animation's sprites should be flipped horizontally. * @default false */ - @:default(false) - @:optional + @:default(false) @:optional var flipX:Null; /** * Whether the animation's sprites should be flipped vertically. * @default false */ - @:default(false) - @:optional + @:default(false) @:optional var flipY:Null; /** * The frame rate of the animation. * @default 24 */ - @:default(24) - @:optional + @:default(24) @:optional var frameRate:Null; /** @@ -135,8 +130,7 @@ typedef UnnamedAnimationData = * @example [0, 1, 2, 3] (use only the first four frames) * @default [] (all frames) */ - @:default([]) - @:optional + @:default([]) @:optional var frameIndices:Null>; /** @@ -144,8 +138,7 @@ typedef UnnamedAnimationData = * Only available for texture atlases. * Options: "framelabel", "symbol" */ - @:default("framelabel") - @:optional + @:default("framelabel") @:optional var animType:String; /** @@ -153,8 +146,7 @@ typedef UnnamedAnimationData = * Only available for multi-sparrow and multi-animateatlas characters. * Options: "sparrow", "animateatlas" */ - @:default("") - @:optional + @:default("") @:optional var renderType:String; /** diff --git a/source/funkin/data/character/CharacterData.hx b/source/funkin/data/character/CharacterData.hx index 0d7fdafea..1fcb34921 100644 --- a/source/funkin/data/character/CharacterData.hx +++ b/source/funkin/data/character/CharacterData.hx @@ -39,7 +39,6 @@ class CharacterDataParser static final characterCache:Map = new Map(); static final characterScriptedClass:Map = new Map(); - static final DEFAULT_CHAR_ID:String = 'UNKNOWN'; /** @@ -777,8 +776,7 @@ typedef CharacterData = * Supports up to `0.25` precision. * @default `1.0` on characters */ - @:optional - @:default(1.0) + @:optional @:default(1.0) var danceEvery:Null; /** diff --git a/source/funkin/data/dialogue/ConversationData.hx b/source/funkin/data/dialogue/ConversationData.hx index 8b5e7d4c2..d5ff00476 100644 --- a/source/funkin/data/dialogue/ConversationData.hx +++ b/source/funkin/data/dialogue/ConversationData.hx @@ -21,8 +21,7 @@ typedef ConversationData = /** * Data on the outro for the conversation. */ - @:jcustomparse(funkin.data.DataParse.outroData) - @:optional + @:jcustomparse(funkin.data.DataParse.outroData) @:optional public var outro:Null; /** @@ -65,8 +64,7 @@ typedef BackdropData_Solid = * Fade-in time for the backdrop. * @default No fade-in */ - @:optional - @:default(0.0) + @:optional @:default(0.0) var fadeTime:Float; }; @@ -95,8 +93,7 @@ typedef OutroData_Fade = * The time to fade out the conversation. * @default 1 second */ - @:optional - @:default(1.0) + @:optional @:default(1.0) var fadeTime:Float; } @@ -110,12 +107,10 @@ typedef MusicData = /** * The time to fade in the music. */ - @:optional - @:default(0.0) + @:optional @:default(0.0) var fadeTime:Float; - @:optional - @:default(false) + @:optional @:default(false) var looped:Bool; }; @@ -160,7 +155,6 @@ typedef DialogueEntryData = * Setting `speed` to `1.5` would make it look like the character is speaking quickly, * and setting `speed` to `0.5` would make it look like the character is emphasizing each word. */ - @:optional - @:default(1.0) + @:optional @:default(1.0) public var speed:Float; }; diff --git a/source/funkin/data/dialogue/DialogueBoxData.hx b/source/funkin/data/dialogue/DialogueBoxData.hx index a75a5595a..d138e65d7 100644 --- a/source/funkin/data/dialogue/DialogueBoxData.hx +++ b/source/funkin/data/dialogue/DialogueBoxData.hx @@ -29,29 +29,25 @@ typedef DialogueBoxData = /** * Whether to horizontally flip the dialogue box sprite. */ - @:optional - @:default(false) + @:optional @:default(false) public var flipX:Bool; /** * Whether to vertically flip the dialogue box sprite. */ - @:optional - @:default(false) + @:optional @:default(false) public var flipY:Bool; /** * Whether to disable anti-aliasing for the dialogue box sprite. */ - @:optional - @:default(false) + @:optional @:default(false) public var isPixel:Bool; /** * The relative horizontal and vertical offsets for the dialogue box sprite. */ - @:optional - @:default([0, 0]) + @:optional @:default([0, 0]) public var offsets:Array; /** @@ -62,15 +58,13 @@ typedef DialogueBoxData = /** * Multiply the size of the dialogue box sprite. */ - @:optional - @:default(1) + @:optional @:default(1) public var scale:Float; /** * If using a spritesheet for the dialogue box, the animations to use. */ - @:optional - @:default([]) + @:optional @:default([]) public var animations:Array; } @@ -79,30 +73,26 @@ typedef DialogueBoxTextData = /** * The position of the text in teh box. */ - @:optional - @:default([0, 0]) + @:optional @:default([0, 0]) var offsets:Array; /** * The width of the */ - @:optional - @:default(300) + @:optional @:default(300) var width:Int; /** * The font size to use for the text. */ - @:optional - @:default(32) + @:optional @:default(32) var size:Int; /** * The color to use for the text. * Use a string that can be translated to a color, like `#FF0000` for red. */ - @:optional - @:default("#000000") + @:optional @:default("#000000") var color:String; /** @@ -110,8 +100,7 @@ typedef DialogueBoxTextData = * @since v1.1.0 * @default `Arial`, make sure to switch this! */ - @:optional - @:default("Arial") + @:optional @:default("Arial") var fontFamily:String; /** @@ -122,7 +111,6 @@ typedef DialogueBoxTextData = /** * The width of the shadow of the text. */ - @:optional - @:default(0) + @:optional @:default(0) var shadowWidth:Int; }; diff --git a/source/funkin/data/dialogue/SpeakerData.hx b/source/funkin/data/dialogue/SpeakerData.hx index e8a2eacf0..1c6082ff1 100644 --- a/source/funkin/data/dialogue/SpeakerData.hx +++ b/source/funkin/data/dialogue/SpeakerData.hx @@ -27,42 +27,36 @@ typedef SpeakerData = /** * Whether the sprite should be flipped horizontally. */ - @:optional - @:default(false) + @:optional @:default(false) public var flipX:Bool; /** * Whether the sprite should be flipped vertically. */ - @:optional - @:default(false) + @:optional @:default(false) public var flipY:Bool; /** * Whether to disable anti-aliasing for the dialogue box sprite. */ - @:optional - @:default(false) + @:optional @:default(false) public var isPixel:Bool; /** * The offsets to apply to the sprite's position. */ - @:optional - @:default([0, 0]) + @:optional @:default([0, 0]) public var offsets:Array; /** * The scale to apply to the sprite. */ - @:optional - @:default(1.0) + @:optional @:default(1.0) public var scale:Float; /** * The available animations for the speaker. */ - @:optional - @:default([]) + @:optional @:default([]) public var animations:Array; } diff --git a/source/funkin/data/event/SongEventSchema.hx b/source/funkin/data/event/SongEventSchema.hx index 2cc212faf..f2a394208 100644 --- a/source/funkin/data/event/SongEventSchema.hx +++ b/source/funkin/data/event/SongEventSchema.hx @@ -1,7 +1,6 @@ package funkin.data.event; -@:nullSafety -@:forward(name, title, type, keys, min, max, step, units, defaultValue, iterator) +@:nullSafety @:forward(name, title, type, keys, min, max, step, units, defaultValue, iterator) abstract SongEventSchema(SongEventSchemaRaw) { /** @@ -209,46 +208,39 @@ typedef SongEventSchemaField = * The key is the display name and the value is the actual value. */ ?keys:Map, - /** * Used for INTEGER and FLOAT values. * The minimum value that can be entered. * @default No minimum */ ?min:Float, - /** * Used for INTEGER and FLOAT values. * The maximum value that can be entered. * @default No maximum */ ?max:Float, - /** * Used for INTEGER and FLOAT values. * The step value that will be used when incrementing/decrementing the value. * @default `0.1` */ ?step:Float, - /** * Used for INTEGER and FLOAT values. * The units that the value is expressed in (pixels, percent, etc). */ ?units:String, - /** * Used for FRAME values. * The child components that this frame contains. */ ?children:SongEventSchemaRaw, - /** * Used for FRAME values. * Whether to make the frame be collapsible. */ ?collapsible:Bool, - /** * An optional default value for the field. */ diff --git a/source/funkin/data/freeplay/album/AlbumData.hx b/source/funkin/data/freeplay/album/AlbumData.hx index 0f212b4a3..7f33d8802 100644 --- a/source/funkin/data/freeplay/album/AlbumData.hx +++ b/source/funkin/data/freeplay/album/AlbumData.hx @@ -39,15 +39,13 @@ typedef AlbumData = /** * Offsets for the album title. */ - @:optional - @:default([0, 0]) + @:optional @:default([0, 0]) public var albumTitleOffsets:Null>; /** * An optional array of animations for the album title. */ - @:optional - @:default([]) + @:optional @:default([]) public var albumTitleAnimations:Array; /** diff --git a/source/funkin/data/freeplay/player/PlayerData.hx b/source/funkin/data/freeplay/player/PlayerData.hx index d85eab9d2..dd56ff9da 100644 --- a/source/funkin/data/freeplay/player/PlayerData.hx +++ b/source/funkin/data/freeplay/player/PlayerData.hx @@ -27,8 +27,7 @@ class PlayerData /** * Whether to show songs with character IDs that aren't associated with any specific character. */ - @:optional - @:default(false) + @:optional @:default(false) public var showUnownedChars:Bool = false; /** @@ -36,15 +35,13 @@ class PlayerData * Can be overridden by specific songs. * @default `default` */ - @:optional - @:default(funkin.util.Constants.DEFAULT_STICKER_PACK) + @:optional @:default(funkin.util.Constants.DEFAULT_STICKER_PACK) public var stickerPack:String = Constants.DEFAULT_STICKER_PACK; /** * Which freeplay style to use for this character. */ - @:optional - @:default("bf") + @:optional @:default("bf") public var freeplayStyle:String = Constants.DEFAULT_FREEPLAY_STYLE; /** @@ -71,8 +68,7 @@ class PlayerData * Whether this character is unlocked by default. * Use a ScriptedPlayableCharacter to add custom logic. */ - @:optional - @:default(true) + @:optional @:default(true) public var unlocked:Bool = true; public function new() @@ -102,52 +98,33 @@ class PlayerFreeplayDJData { var assetPath:String; var animations:Array; - - @:optional - @:default(false) + @:optional @:default(false) var applyStageMatrix:Bool; - - @:optional - @:default("BOYFRIEND") + @:optional @:default("BOYFRIEND") var text1:String; - - @:optional - @:default("HOT BLOODED IN MORE WAYS THAN ONE") + @:optional @:default("HOT BLOODED IN MORE WAYS THAN ONE") var text2:String; - - @:optional - @:default("PROTECT YO NUTS") + @:optional @:default("PROTECT YO NUTS") var text3:String; - @:jignored var animationMap:Map; - @:jignored var prefixToOffsetsMap:Map>; - @:optional var charSelect:Null; - @:optional var fistPump:Null; @:optional public var atlasSettings:funkin.data.stage.StageData.TextureAtlasData; - - @:optional - @:default("animateatlas") + @:optional @:default("animateatlas") public var renderType:Null; - - @:optional - @:default("") + @:optional @:default("") public var scriptClass:Null; - - @:optional - @:default(false) + @:optional @:default(false) public var useAnimatePosition:Bool; - @:optional - @:default([0, 0]) + @:optional @:default([0, 0]) var offsets:Array; public function new() @@ -306,19 +283,15 @@ typedef PlayerCharSelectGFData = { @:optional public var assetPath:String; - @:optional public var animInfoPath:String; - - @:optional - @:default(false) + @:optional @:default(false) public var visualizer:Bool; } typedef PlayerResultsData = { var music:PlayerResultsMusicData; - var perfectGold:Array; var perfect:Array; var excellent:Array; @@ -331,19 +304,14 @@ typedef PlayerResultsMusicData = { @:optional var PERFECT_GOLD:String; - @:optional var PERFECT:String; - @:optional var EXCELLENT:String; - @:optional var GREAT:String; - @:optional var GOOD:String; - @:optional var SHIT:String; } @@ -355,51 +323,30 @@ typedef PlayerResultsAnimationData = */ var renderType:String; - @:optional - @:default(false) + @:optional @:default(false) var applyStageMatrix:Bool; - @:optional var assetPath:Null; - @:optional var scriptClass:Null; - - @:optional - @:default([0, 0]) + @:optional @:default([0, 0]) var offsets:Array; - - @:optional - @:default("both") + @:optional @:default("both") var filter:String; - - @:optional - @:default(500) + @:optional @:default(500) var zIndex:Int; - - @:optional - @:default(0.0) + @:optional @:default(0.0) var delay:Float; - - @:optional - @:default(1.0) + @:optional @:default(1.0) var scale:Float; - - @:optional - @:default('') + @:optional @:default('') var startFrameLabel:Null; - - @:optional - @:default('') + @:optional @:default('') var sound:Null; - - @:optional - @:default(true) + @:optional @:default(true) var looped:Bool; - @:optional var loopFrame:Null; - @:optional var loopFrameLabel:Null; }; @@ -413,25 +360,18 @@ typedef PlayerFreeplayDJFistPumpData = { @:default(0) var introStartFrame:Int; - @:default(4) var introEndFrame:Int; - @:default(4) var loopStartFrame:Int; - @:default(-1) var loopEndFrame:Int; - @:default(0) var introBadStartFrame:Int; - @:default(4) var introBadEndFrame:Int; - @:default(4) var loopBadStartFrame:Int; - @:default(-1) var loopBadEndFrame:Int; }; diff --git a/source/funkin/data/notestyle/NoteStyleData.hx b/source/funkin/data/notestyle/NoteStyleData.hx index de30261d0..38f089abc 100644 --- a/source/funkin/data/notestyle/NoteStyleData.hx +++ b/source/funkin/data/notestyle/NoteStyleData.hx @@ -125,31 +125,22 @@ typedef NoteStyleAssetsData = @:optional var comboNumber0:NoteStyleAssetData; - @:optional var comboNumber1:NoteStyleAssetData; - @:optional var comboNumber2:NoteStyleAssetData; - @:optional var comboNumber3:NoteStyleAssetData; - @:optional var comboNumber4:NoteStyleAssetData; - @:optional var comboNumber5:NoteStyleAssetData; - @:optional var comboNumber6:NoteStyleAssetData; - @:optional var comboNumber7:NoteStyleAssetData; - @:optional var comboNumber8:NoteStyleAssetData; - @:optional var comboNumber9:NoteStyleAssetData; } @@ -168,35 +159,30 @@ typedef NoteStyleAssetData = * The scale to render the note at. * @default 1.0 */ - @:default(1.0) - @:optional + @:default(1.0) @:optional var scale:Float; /** * Offset the sprite's position by this amount. * @default [0, 0] */ - @:default([0, 0]) - @:optional + @:default([0, 0]) @:optional var offsets:Null>; /** * If true, the note is a pixel sprite, and will be rendered without anti-aliasing. */ - @:default(false) - @:optional + @:default(false) @:optional var isPixel:Bool; - @:default(1.0) - @:optional + @:default(1.0) @:optional var alpha:Float; /** * If true, animations will be played on the graphic. * @default `false` to save performance. */ - @:default(false) - @:optional + @:default(false) @:optional var animated:Bool; /** @@ -260,31 +246,21 @@ typedef NoteStyleData_NoteSplash = * If false, note splashes are entirely hidden on this note style. * @default Note splashes are enabled. */ - @:optional - @:default(true) + @:optional @:default(true) var enabled:Bool; - @:optional - @:default(24) + @:optional @:default(24) var framerateDefault:Int; - - @:optional - @:default(2) + @:optional @:default(2) var framerateVariance:Int; - - @:optional - @:default("normal") + @:optional @:default("normal") var blendMode:String; - @:optional var leftSplashes:Array; - @:optional var downSplashes:Array; - @:optional var upSplashes:Array; - @:optional var rightSplashes:Array; }; @@ -295,19 +271,15 @@ typedef NoteStyleData_HoldNoteCover = * If false, hold note covers are entirely hidden on this note style. * @default Hold note covers are enabled. */ - @:optional - @:default(true) + @:optional @:default(true) var enabled:Bool; @:optional var left:NoteStyleData_HoldNoteCoverDirectionData; - @:optional var down:NoteStyleData_HoldNoteCoverDirectionData; - @:optional var up:NoteStyleData_HoldNoteCoverDirectionData; - @:optional var right:NoteStyleData_HoldNoteCoverDirectionData; }; diff --git a/source/funkin/data/song/SongData.hx b/source/funkin/data/song/SongData.hx index 5d9c9b7e3..aa403748e 100644 --- a/source/funkin/data/song/SongData.hx +++ b/source/funkin/data/song/SongData.hx @@ -22,25 +22,18 @@ class SongMetadata implements ICloneable * A semantic versioning string for the song data format. * */ - @:jcustomparse(funkin.data.DataParse.semverVersion) - @:jcustomwrite(funkin.data.DataWrite.semverVersion) + @:jcustomparse(funkin.data.DataParse.semverVersion) @:jcustomwrite(funkin.data.DataWrite.semverVersion) public var version:Version; @:default("Unknown") public var songName:String; - @:default("Unknown") public var artist:String; - @:optional public var charter:Null = null; - - @:optional - @:default(96) + @:optional @:default(96) public var divisions:Null; // Optional field - - @:optional - @:default(false) + @:optional @:default(false) public var looped:Bool; /** @@ -56,11 +49,8 @@ class SongMetadata implements ICloneable public var playData:SongPlayData; public var generatedBy:String; - - @:optional - @:default(funkin.data.song.SongData.SongTimeFormat.MILLISECONDS) + @:optional @:default(funkin.data.song.SongData.SongTimeFormat.MILLISECONDS) public var timeFormat:SongTimeFormat; - public var timeChanges:Array; /** @@ -167,9 +157,7 @@ enum abstract SongTimeFormat(String) from String to String class SongTimeChange implements ICloneable { public static final DEFAULT_SONGTIMECHANGE:SongTimeChange = new SongTimeChange(0, 100); - public static final DEFAULT_SONGTIMECHANGES:Array = [DEFAULT_SONGTIMECHANGE]; - static final DEFAULT_BEAT_TUPLETS:Array = [4, 4, 4, 4]; static final DEFAULT_BEAT_TIME:Null = null; // Later, null gets detected and recalculated. @@ -183,8 +171,7 @@ class SongTimeChange implements ICloneable * Time in beats (int). The game will calculate further beat values based on this one, * so it can do it in a simple linear fashion. */ - @:optional - @:alias("b") + @:optional @:alias("b") public var beatTime:Float; /** @@ -197,17 +184,13 @@ class SongTimeChange implements ICloneable /** * Time signature numerator (int). Optional, defaults to 4. */ - @:default(4) - @:optional - @:alias("n") + @:default(4) @:optional @:alias("n") public var timeSignatureNum:Int; /** * Time signature denominator (int). Optional, defaults to 4. Should only ever be a power of two. */ - @:default(4) - @:optional - @:alias("d") + @:default(4) @:optional @:alias("d") public var timeSignatureDen:Int; /** @@ -215,8 +198,7 @@ class SongTimeChange implements ICloneable * It can either be an array of length `n` (see above) or a single integer number. * Optional, defaults to `[4]`. */ - @:optional - @:alias("bt") + @:optional @:alias("bt") public var beatTuplets:Array; public function new(timeStamp:Float, bpm:Float, timeSignatureNum:Int = 4, timeSignatureDen:Int = 4, ?beatTime:Float, ?beatTuplets:Array) @@ -259,31 +241,27 @@ class SongOffsets implements ICloneable * Setting this to `-5000.0` means the chart start 5 seconds into the song. * Setting this to `5000.0` means there will be 5 seconds of silence before the song starts. */ - @:optional - @:default(0) + @:optional @:default(0) public var instrumental:Float; /** * Apply different offsets to different alternate instrumentals. */ - @:optional - @:default([]) + @:optional @:default([]) public var altInstrumentals:Map; /** * The offset, in milliseconds, to apply to the song's vocals, relative to the song's base instrumental. * These are applied ON TOP OF the instrumental offset. */ - @:optional - @:default([]) + @:optional @:default([]) public var vocals:Map; /** * The offset, in milliseconds, to apply to the songs vocals, relative to each alternate instrumental. * This is useful for the circumstance where, for example, an alt instrumental has a few seconds of lead in before the song starts. */ - @:optional - @:default([]) + @:optional @:default([]) public var altVocals:Map>; public function new(instrumental:Float = 0.0, ?altInstrumentals:Map, ?vocals:Map, ?altVocals:Map>) @@ -365,30 +343,21 @@ class SongMusicData implements ICloneable * A semantic versioning string for the song data format. * */ - @:jcustomparse(funkin.data.DataParse.semverVersion) - @:jcustomwrite(funkin.data.DataWrite.semverVersion) + @:jcustomparse(funkin.data.DataParse.semverVersion) @:jcustomwrite(funkin.data.DataWrite.semverVersion) public var version:Version; @:default("Unknown") public var songName:String; - @:default("Unknown") public var artist:String; - - @:optional - @:default(96) + @:optional @:default(96) public var divisions:Null; // Optional field - - @:optional - @:default(false) + @:optional @:default(false) public var looped:Null; - // @:default(funkin.data.song.SongRegistry.DEFAULT_GENERATEDBY) public var generatedBy:String; - // @:default(funkin.data.song.SongData.SongTimeFormat.MILLISECONDS) public var timeFormat:SongTimeFormat; - // @:default(funkin.data.song.SongData.SongTimeChange.DEFAULT_SONGTIMECHANGES) public var timeChanges:Array; @@ -445,8 +414,7 @@ class SongPlayData implements ICloneable /** * The variations this song has. The associated metadata files should exist. */ - @:default([]) - @:optional + @:default([]) @:optional public var songVariations:Array; /** @@ -473,9 +441,7 @@ class SongPlayData implements ICloneable * The difficulty ratings for this song as displayed in Freeplay. * Key is a difficulty ID. */ - @:optional - @:default(['normal' => 0]) - @:order(funkin.util.Constants.DEFAULT_DIFFICULTY_LIST_FULL) + @:optional @:default(['normal' => 0]) @:order(funkin.util.Constants.DEFAULT_DIFFICULTY_LIST_FULL) public var ratings:Map; /** @@ -497,8 +463,7 @@ class SongPlayData implements ICloneable * Defaults to 0 seconds in. * @since `2.2.2` */ - @:optional - @:default(funkin.util.Constants.DEFAULT_PREVIEW_START_TIME) + @:optional @:default(funkin.util.Constants.DEFAULT_PREVIEW_START_TIME) public var previewStart:Float; /** @@ -506,8 +471,7 @@ class SongPlayData implements ICloneable * Defaults to 20% seconds in. * @since `2.2.2` */ - @:optional - @:default(funkin.util.Constants.DEFAULT_PREVIEW_END_TIME) + @:optional @:default(funkin.util.Constants.DEFAULT_PREVIEW_END_TIME) public var previewEnd:Float; public function new() @@ -547,29 +511,18 @@ class SongPlayData implements ICloneable */ class SongCharacterData implements ICloneable { - @:optional - @:default('') + @:optional @:default('') public var player:String = ''; - - @:optional - @:default('') + @:optional @:default('') public var girlfriend:String = ''; - - @:optional - @:default('') + @:optional @:default('') public var opponent:String = ''; - - @:optional - @:default('') + @:optional @:default('') public var instrumental:String = ''; - - @:optional - @:default([]) + @:optional @:default([]) public var altInstrumentals:Array = []; - @:optional public var opponentVocals:Null> = null; - @:optional public var playerVocals:Null> = null; @@ -608,16 +561,13 @@ class SongCharacterData implements ICloneable class SongChartData implements ICloneable { - @:jcustomparse(funkin.data.DataParse.semverVersion) - @:jcustomwrite(funkin.data.DataWrite.semverVersion) + @:jcustomparse(funkin.data.DataParse.semverVersion) @:jcustomwrite(funkin.data.DataWrite.semverVersion) public var version:Version; - @:order(funkin.util.Constants.DEFAULT_DIFFICULTY_LIST_FULL) public var scrollSpeed:Map; public var events:Array; @:order(funkin.util.Constants.DEFAULT_DIFFICULTY_LIST_FULL) public var notes:Map>; - public var generatedBy:String; /** @@ -744,10 +694,7 @@ class SongEventDataRaw implements ICloneable * This can allow the event to include information used for custom behavior. * Data type depends on the event kind. It can be anything that's JSON serializable. */ - @:alias("v") - @:optional - @:jcustomparse(funkin.data.DataParse.dynamicValue) - @:jcustomwrite(funkin.data.DataWrite.dynamicValue) + @:alias("v") @:optional @:jcustomparse(funkin.data.DataParse.dynamicValue) @:jcustomwrite(funkin.data.DataWrite.dynamicValue) public var value:Dynamic = null; /** @@ -1117,9 +1064,7 @@ class SongNoteDataRaw implements ICloneable * Length of the note, if applicable. * Defaults to 0 for single notes. */ - @:alias("l") - @:default(0) - @:optional + @:alias("l") @:default(0) @:optional public var length(default, set):Float; function set_length(value:Float):Float @@ -1133,9 +1078,7 @@ class SongNoteDataRaw implements ICloneable * This can allow the note to include information used for custom behavior. * Defaults to `null` for no kind. */ - @:alias("k") - @:optional - @:isVar + @:alias("k") @:optional @:isVar public var kind(get, set):Null = null; function get_kind():Null @@ -1155,9 +1098,7 @@ class SongNoteDataRaw implements ICloneable * The parameters for the note. * Used for custom behavior on custom note kinds. Defaults to an empty array. */ - @:alias("p") - @:default([]) - @:optional + @:alias("p") @:default([]) @:optional public var params:Array; public function new(time:Float, data:Int, length:Float = 0, kind:String = '', ?params:Array) @@ -1472,10 +1413,7 @@ class NoteParamData implements ICloneable { @:alias("n") public var name:String; - - @:alias("v") - @:jcustomparse(funkin.data.DataParse.dynamicValue) - @:jcustomwrite(funkin.data.DataWrite.dynamicValue) + @:alias("v") @:jcustomparse(funkin.data.DataParse.dynamicValue) @:jcustomwrite(funkin.data.DataWrite.dynamicValue) public var value:Dynamic; public function new(name:String, value:Dynamic) diff --git a/source/funkin/data/song/SongDataUtils.hx b/source/funkin/data/song/SongDataUtils.hx index 7380845f8..0e5082cc7 100644 --- a/source/funkin/data/song/SongDataUtils.hx +++ b/source/funkin/data/song/SongDataUtils.hx @@ -33,7 +33,10 @@ class SongDataUtils return new SongNoteData(time, data, length, kind); }; - var result = [for (i in 0...notes.length) offsetNote(notes[i])]; + var result = [ + for (i in 0...notes.length) + offsetNote(notes[i]) + ]; return result; } diff --git a/source/funkin/data/song/SongRegistry.hx b/source/funkin/data/song/SongRegistry.hx index 837f2ea20..548929f33 100644 --- a/source/funkin/data/song/SongRegistry.hx +++ b/source/funkin/data/song/SongRegistry.hx @@ -15,7 +15,8 @@ import funkin.data.DefaultRegistryImpl; using funkin.data.song.migrator.SongDataMigrator; -@:nullSafety class SongRegistry extends BaseRegistry implements ISingleton implements DefaultRegistryImpl +@:nullSafety +class SongRegistry extends BaseRegistry implements ISingleton implements DefaultRegistryImpl { /** * The current version string for the stage data format. @@ -25,15 +26,10 @@ using funkin.data.song.migrator.SongDataMigrator; public static final SONG_METADATA_VERSION:thx.semver.Version = "2.2.4"; public static final SONG_METADATA_VERSION_RULE:thx.semver.VersionRule = "2.2.x"; - public static final SONG_CHART_DATA_VERSION:thx.semver.Version = "2.0.0"; - public static final SONG_CHART_DATA_VERSION_RULE:thx.semver.VersionRule = "2.0.x"; - public static final SONG_MUSIC_DATA_VERSION:thx.semver.Version = "2.0.0"; - public static final SONG_MUSIC_DATA_VERSION_RULE:thx.semver.VersionRule = "2.0.x"; - public static var DEFAULT_GENERATEDBY(get, never):String; public var scriptedSongVariations:Map = new Map(); diff --git a/source/funkin/data/song/importer/ChartManifestData.hx b/source/funkin/data/song/importer/ChartManifestData.hx index 407a4d4df..cb7556b47 100644 --- a/source/funkin/data/song/importer/ChartManifestData.hx +++ b/source/funkin/data/song/importer/ChartManifestData.hx @@ -12,8 +12,7 @@ class ChartManifestData public static final invalidIdRegex:EReg = ~/[\/\\:*?"<>|]/g; - @:jcustomparse(funkin.data.DataParse.semverVersion) - @:jcustomwrite(funkin.data.DataWrite.semverVersion) + @:jcustomparse(funkin.data.DataParse.semverVersion) @:jcustomwrite(funkin.data.DataWrite.semverVersion) public var version:thx.semver.Version; /** diff --git a/source/funkin/data/song/importer/FNFLegacyData.hx b/source/funkin/data/song/importer/FNFLegacyData.hx index a2426a656..d981ed424 100644 --- a/source/funkin/data/song/importer/FNFLegacyData.hx +++ b/source/funkin/data/song/importer/FNFLegacyData.hx @@ -16,13 +16,11 @@ class LegacySongData { public var player1:String; // Boyfriend public var player2:String; // Opponent - @:jcustomparse(funkin.data.DataParse.eitherLegacyScrollSpeeds) public var speed:Either; @:optional public var stageDefault:Null; public var bpm:Float; - @:jcustomparse(funkin.data.DataParse.eitherLegacyNoteData) public var notes:Either, LegacyNoteData>; public var song:String; // Song name @@ -35,7 +33,8 @@ class LegacySongData { var notesStr:String = switch (notes) { - case Left(sections): 'single difficulty w/ ${sections.length} sections'; + case Left(sections): + 'single difficulty w/ ${sections.length} sections'; case Right(data): var difficultyCount:Int = 0; if (data.easy != null) difficultyCount++; @@ -91,9 +90,7 @@ typedef LegacyNoteSection = public var sectionNotes:Array; public var ?typeOfSection:Int; - public var ?lengthInSteps:Int; - // BPM changes public var ?changeBPM:Bool; public var ?bpm:Float; diff --git a/source/funkin/data/song/importer/OsuManiaImporter.hx b/source/funkin/data/song/importer/OsuManiaImporter.hx index 35279d1a2..b27bd86cf 100644 --- a/source/funkin/data/song/importer/OsuManiaImporter.hx +++ b/source/funkin/data/song/importer/OsuManiaImporter.hx @@ -129,7 +129,9 @@ class OsuManiaImporter trace('Migrating song chart data from Osu!Mania.'); // Osu!Mania doesn't have a scroll speed variable as its controlled by the player - var songChartData:SongChartData = new SongChartData([difficulty => Constants.DEFAULT_SCROLLSPEED], [], [difficulty => []]); + var songChartData:SongChartData = new SongChartData([ + difficulty => Constants.DEFAULT_SCROLLSPEED + ], [], [difficulty => []]); // songData.HitObjects is a Array here so im casting it so haxe stops yelling at me var osuNotes:Array = parseManiaHitObjects(cast songData.HitObjects, songData.Difficulty.CircleSize); diff --git a/source/funkin/data/song/importer/StepManiaData.hx b/source/funkin/data/song/importer/StepManiaData.hx index f04a52af2..c98f8682f 100644 --- a/source/funkin/data/song/importer/StepManiaData.hx +++ b/source/funkin/data/song/importer/StepManiaData.hx @@ -69,7 +69,6 @@ class StepDifficulty public var charter:String; public var difficultyRating:Int; public var type:StepManiaChartType; - public var notes:Array; public function parseChartType(chartTypeStr:String):StepManiaChartType @@ -111,11 +110,11 @@ class StepTimingPoint // Not implemented, but if any chart uses them then the chart will break. // IE this messes with the timing of the notes. + class StepStop { public var startBeat:Float = Math.NEGATIVE_INFINITY; public var duration:Float = 0; - public var startTimestamp:Float = Math.NEGATIVE_INFINITY; public function new(startBeat:Float, duration:Float) diff --git a/source/funkin/data/song/importer/StepManiaImporter.hx b/source/funkin/data/song/importer/StepManiaImporter.hx index 65eb5f934..c9b3fda17 100644 --- a/source/funkin/data/song/importer/StepManiaImporter.hx +++ b/source/funkin/data/song/importer/StepManiaImporter.hx @@ -492,7 +492,16 @@ class StepManiaImporter } else if (type == StepManiaChartType.DanceDouble) { - holdArray = [-1, -1, -1, -1, -1, -1, -1, -1]; + holdArray = [ + -1, + -1, + -1, + -1, + -1, + -1, + -1, + -1 + ]; } else { diff --git a/source/funkin/data/song/migrator/SongData_v2_0_0.hx b/source/funkin/data/song/migrator/SongData_v2_0_0.hx index 29a08f03d..a019c81eb 100644 --- a/source/funkin/data/song/migrator/SongData_v2_0_0.hx +++ b/source/funkin/data/song/migrator/SongData_v2_0_0.hx @@ -17,36 +17,25 @@ class SongMetadata_v2_0_0 /** * In metadata `v2.1.0`, `variation` was set to `ignore` when writing. */ - @:optional - @:default('default') + @:optional @:default('default') public var variation:String; // ========== // UNMODIFIED VALUES // ========== - @:jcustomparse(funkin.data.DataParse.semverVersion) - @:jcustomwrite(funkin.data.DataWrite.semverVersion) + @:jcustomparse(funkin.data.DataParse.semverVersion) @:jcustomwrite(funkin.data.DataWrite.semverVersion) public var version:Version; - @:default("Unknown") public var songName:String; - @:default("Unknown") public var artist:String; - - @:optional - @:default(96) + @:optional @:default(96) public var divisions:Null; // Optional field - - @:optional - @:default(false) + @:optional @:default(false) public var looped:Bool; - @:default(funkin.data.song.SongRegistry.DEFAULT_GENERATEDBY) public var generatedBy:String; - public var timeFormat:SongData.SongTimeFormat; - public var timeChanges:Array; public function new() @@ -83,11 +72,9 @@ class SongPlayData_v2_0_0 // ========== // UNMODIFIED VALUES // ========== - @:default([]) - @:optional + @:default([]) @:optional public var songVariations:Array; public var difficulties:Array; - public var stage:String; public function new() @@ -105,19 +92,11 @@ class SongPlayData_v2_0_0 class SongPlayableChar_v2_0_0 { - @:alias('g') - @:optional - @:default('') + @:alias('g') @:optional @:default('') public var girlfriend:String = ''; - - @:alias('o') - @:optional - @:default('') + @:alias('o') @:optional @:default('') public var opponent:String = ''; - - @:alias('i') - @:optional - @:default('') + @:alias('i') @:optional @:default('') public var inst:String = ''; public function new(girlfriend:String = '', opponent:String = '', inst:String = '') diff --git a/source/funkin/data/song/migrator/SongData_v2_1_0.hx b/source/funkin/data/song/migrator/SongData_v2_1_0.hx index 68fd9be6d..0632a0268 100644 --- a/source/funkin/data/song/migrator/SongData_v2_1_0.hx +++ b/source/funkin/data/song/migrator/SongData_v2_1_0.hx @@ -21,29 +21,19 @@ class SongMetadata_v2_1_0 // ========== // UNMODIFIED VALUES // ========== - @:jcustomparse(funkin.data.DataParse.semverVersion) - @:jcustomwrite(funkin.data.DataWrite.semverVersion) + @:jcustomparse(funkin.data.DataParse.semverVersion) @:jcustomwrite(funkin.data.DataWrite.semverVersion) public var version:Version; - @:default("Unknown") public var songName:String; - @:default("Unknown") public var artist:String; - - @:optional - @:default(96) + @:optional @:default(96) public var divisions:Null; // Optional field - - @:optional - @:default(false) + @:optional @:default(false) public var looped:Bool; - @:default(funkin.data.song.SongRegistry.DEFAULT_GENERATEDBY) public var generatedBy:String; - public var timeFormat:SongData.SongTimeFormat; - public var timeChanges:Array; /** @@ -93,8 +83,7 @@ class SongPlayData_v2_1_0 // ========== // UNMODIFIED VALUES // ========== - @:default([]) - @:optional + @:default([]) @:optional public var songVariations:Array; public var difficulties:Array; public var characters:SongData.SongCharacterData; diff --git a/source/funkin/data/stage/StageData.hx b/source/funkin/data/stage/StageData.hx index c41052f94..a9dad3d98 100644 --- a/source/funkin/data/stage/StageData.hx +++ b/source/funkin/data/stage/StageData.hx @@ -15,13 +15,9 @@ class StageData public var name:String = 'Unknown'; public var props:Array = []; public var characters:StageDataCharacters; - - @:default(1.0) - @:optional + @:default(1.0) @:optional public var cameraZoom:Null; - - @:default("shared") - @:optional + @:default("shared") @:optional public var directory:Null; public function new() @@ -106,8 +102,7 @@ typedef StageDataProp = * This is just like CSS, it isn't hard. * @default 0 */ - @:optional - @:default(0) + @:optional @:default(0) var zIndex:Int; /** @@ -115,42 +110,35 @@ typedef StageDataProp = * This prevents blurry images on pixel-art levels. * @default false */ - @:optional - @:default(false) + @:optional @:default(false) var isPixel:Bool; /** * If set to true, the prop will be flipped horizontally. * @default false */ - @:optional - @:default(false) + @:optional @:default(false) var flipX:Bool; /** * If set to true, the prop will be flipped vertically. * @default false */ - @:optional - @:default(false) + @:optional @:default(false) var flipY:Bool; /** * Either the scale of the prop as a float, or the [w, h] scale as an array of two floats. * Pro tip: On pixel-art levels, save the sprite small and set this value to 6 or so to save memory. */ - @:jcustomparse(funkin.data.DataParse.eitherFloatOrFloats) - @:jcustomwrite(funkin.data.DataWrite.eitherFloatOrFloats) - @:optional - @:default(Left(1.0)) + @:jcustomparse(funkin.data.DataParse.eitherFloatOrFloats) @:jcustomwrite(funkin.data.DataWrite.eitherFloatOrFloats) @:optional @:default(Left(1.0)) var scale:haxe.ds.Either>; /** * The alpha of the prop, as a float. * @default 1.0 */ - @:optional - @:default(1.0) + @:optional @:default(1.0) var alpha:Float; /** @@ -160,8 +148,7 @@ typedef StageDataProp = * Supports up to 0.25 precision. * @default 0.0 */ - @:default(0.0) - @:optional + @:default(0.0) @:optional var danceEvery:Float; /** @@ -172,16 +159,14 @@ typedef StageDataProp = * [0, 0] means the prop is not moved. * @default [1, 1] */ - @:optional - @:default([1, 1]) + @:optional @:default([1, 1]) var scroll:Array; /** * An optional array of animations which the prop can play. * @default Prop has no animations. */ - @:optional - @:default([]) + @:optional @:default([]) var animations:Array; /** @@ -196,16 +181,14 @@ typedef StageDataProp = * Options: "sparrow", "packer", "animateatlas" * @default "sparrow" */ - @:default("sparrow") - @:optional + @:default("sparrow") @:optional var animType:String; /** * The angle of the prop, as a float. * @default 0.0 */ - @:optional - @:default(0.0) + @:optional @:default(0.0) var angle:Float; /** @@ -213,8 +196,7 @@ typedef StageDataProp = * Just like in photoshop. * @default Nothing. */ - @:default("") - @:optional + @:default("") @:optional var blend:String; /** @@ -222,8 +204,7 @@ typedef StageDataProp = * White overlays, or the ones with the value #FFFFFF, do not appear. * @default `#FFFFFF` */ - @:default("#FFFFFF") - @:optional + @:default("#FFFFFF") @:optional var color:String; /** @@ -291,22 +272,19 @@ typedef StageDataCharacter = * Again, just like CSS. * @default 0 */ - @:optional - @:default(0) + @:optional @:default(0) var zIndex:Int; /** * The position to render the character at. */ - @:optional - @:default([0, 0]) + @:optional @:default([0, 0]) var position:Array; /** * The scale to render the character at. */ - @:optional - @:default(1) + @:optional @:default(1) var scale:Float; /** @@ -324,23 +302,20 @@ typedef StageDataCharacter = * [0, 0] means the character is not moved. * @default [1, 1] */ - @:optional - @:default([1, 1]) + @:optional @:default([1, 1]) var scroll:Array; /** * The alpha of the character, as a float. * @default 1.0 */ - @:optional - @:default(1.0) + @:optional @:default(1.0) var alpha:Float; /** * The angle of the character, as a float. * @default 0.0 */ - @:optional - @:default(0.0) + @:optional @:default(0.0) var angle:Float; }; diff --git a/source/funkin/data/stickers/StickerRegistry.hx b/source/funkin/data/stickers/StickerRegistry.hx index 4cf20116f..48f3d0c40 100644 --- a/source/funkin/data/stickers/StickerRegistry.hx +++ b/source/funkin/data/stickers/StickerRegistry.hx @@ -15,7 +15,6 @@ class StickerRegistry extends BaseRegistry; /** * A set of animations to play on the prop. * If default/empty, the prop will be static. */ - @:default([]) - @:optional + @:default([]) @:optional var animations:Array; /** * If animations are used, this is the name of the animation to play first. * @default idle */ - @:default('') - @:optional + @:default('') @:optional var startingAnimation:String; /** * Flips the sprite on X axis. */ - @:default(false) - @:optional + @:default(false) @:optional var flipX:Null; - - /** + + /** * Flips the sprite on Y axis. */ - @:default(false) - @:optional + @:default(false) @:optional var flipY:Null; } diff --git a/source/funkin/data/story/level/LevelRegistry.hx b/source/funkin/data/story/level/LevelRegistry.hx index 506f2e9cf..da7614a28 100644 --- a/source/funkin/data/story/level/LevelRegistry.hx +++ b/source/funkin/data/story/level/LevelRegistry.hx @@ -31,7 +31,18 @@ class LevelRegistry extends BaseRegistry imp { // This MUST be hard-coded (overriding the auto-generated method) // because the auto-generated method spits out values in alphabetical order. - return ['tutorial', 'week1', 'week2', 'week3', 'week4', 'week5', 'week6', 'week7', 'weekend1', 'sserafim']; + return [ + 'tutorial', + 'week1', + 'week2', + 'week3', + 'week4', + 'week5', + 'week6', + 'week7', + 'weekend1', + 'sserafim' + ]; } /** diff --git a/source/funkin/effects/IntervalShake.hx b/source/funkin/effects/IntervalShake.hx index 49c835ce9..93bc6f27c 100644 --- a/source/funkin/effects/IntervalShake.hx +++ b/source/funkin/effects/IntervalShake.hx @@ -193,7 +193,6 @@ class IntervalShake implements IFlxDestroyable } public var _secondsSinceStart(default, null):Float = 0; - public var scale(default, null):Float = 0; /** diff --git a/source/funkin/effects/RetroCameraFade.hx b/source/funkin/effects/RetroCameraFade.hx index 7113f0a76..548de6a57 100644 --- a/source/funkin/effects/RetroCameraFade.hx +++ b/source/funkin/effects/RetroCameraFade.hx @@ -41,7 +41,9 @@ class RetroCameraFade 0, 0, 1, 0, 1.0 * 255, 0, 0, 0, 1, 0 ]; - camera.filters = [new ColorMatrixFilter(matrixDerp)]; + camera.filters = [ + new ColorMatrixFilter(matrixDerp) + ]; new FlxTimer().start(time / stepsTotal, _ -> { @@ -91,7 +93,9 @@ class RetroCameraFade 0, 0, 1, 0, -1.0 * 255, 0, 0, 0, 1, 0 ]; - camera.filters = [new ColorMatrixFilter(matrixDerp)]; + camera.filters = [ + new ColorMatrixFilter(matrixDerp) + ]; new FlxTimer().start(time / stepsTotal, _ -> { diff --git a/source/funkin/external/android/CallbackUtil.hx b/source/funkin/external/android/CallbackUtil.hx index c81972ed8..999bb91f3 100644 --- a/source/funkin/external/android/CallbackUtil.hx +++ b/source/funkin/external/android/CallbackUtil.hx @@ -52,7 +52,6 @@ class CallbackUtil #if (lime >= "8.0.0") implements JNISafety #end @:noCompletion private static var __staticFields:Array = null; - @:noCompletion public static var __callbacksFields:Map = new Map(); diff --git a/source/funkin/external/android/JNIUtil.hx b/source/funkin/external/android/JNIUtil.hx index cfebdfdad..b74a4f751 100644 --- a/source/funkin/external/android/JNIUtil.hx +++ b/source/funkin/external/android/JNIUtil.hx @@ -10,13 +10,10 @@ class JNIUtil { @:noCompletion private static var staticMethodCache:Map = []; - @:noCompletion private static var memberMethodCache:Map = []; - @:noCompletion private static var staticFieldCache:Map = []; - @:noCompletion private static var memberFieldCache:Map = []; diff --git a/source/funkin/external/apple/AudioSession.hx b/source/funkin/external/apple/AudioSession.hx index d647c83e4..133cf1dd5 100644 --- a/source/funkin/external/apple/AudioSession.hx +++ b/source/funkin/external/apple/AudioSession.hx @@ -4,9 +4,7 @@ package funkin.external.apple; /** * A utility class to manage the audio session on apple devices. */ -@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml')) -@:include('AudioSession.hpp') -@:unreflective +@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml')) @:include('AudioSession.hpp') @:unreflective extern class AudioSession { /** diff --git a/source/funkin/external/apple/FNFCExtern.hx b/source/funkin/external/apple/FNFCExtern.hx index 4fc3eb4d6..daa679f58 100644 --- a/source/funkin/external/apple/FNFCExtern.hx +++ b/source/funkin/external/apple/FNFCExtern.hx @@ -4,9 +4,7 @@ package funkin.external.apple; /** * A utility class for FNFC loading on apple devices. */ -@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml')) -@:include('FNFCExtern.hpp') -@:unreflective +@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml')) @:include('FNFCExtern.hpp') @:unreflective extern class FNFCExtern { /** diff --git a/source/funkin/external/apple/MemoryUtil.hx b/source/funkin/external/apple/MemoryUtil.hx index 401a877b6..1a86b0e64 100644 --- a/source/funkin/external/apple/MemoryUtil.hx +++ b/source/funkin/external/apple/MemoryUtil.hx @@ -4,9 +4,7 @@ package funkin.external.apple; /** * A utility class to get information about the mem usage. */ -@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml')) -@:include('MemoryUtil.hpp') -@:unreflective +@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml')) @:include('MemoryUtil.hpp') @:unreflective extern class MemoryUtil { /** diff --git a/source/funkin/external/apple/ScreenUtil.hx b/source/funkin/external/apple/ScreenUtil.hx index 6257e46fe..0207d1dc7 100644 --- a/source/funkin/external/apple/ScreenUtil.hx +++ b/source/funkin/external/apple/ScreenUtil.hx @@ -4,9 +4,7 @@ package funkin.external.apple; /** * A utility class to get screen related informations on apple devices. */ -@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml')) -@:include('ScreenUtil.hpp') -@:unreflective +@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml')) @:include('ScreenUtil.hpp') @:unreflective extern class ScreenUtil { /** diff --git a/source/funkin/external/windows/WinAPI.hx b/source/funkin/external/windows/WinAPI.hx index a2b6f16be..533f12adb 100644 --- a/source/funkin/external/windows/WinAPI.hx +++ b/source/funkin/external/windows/WinAPI.hx @@ -4,8 +4,7 @@ package funkin.external.windows; /** * This class provides handling for Windows API-related functions. */ -@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml')) -@:include('winapi.hpp') +@:build(funkin.util.macro.LinkerMacro.xml('project/Build.xml')) @:include('winapi.hpp') extern class WinAPI { /** diff --git a/source/funkin/graphics/FunkinCamera.hx b/source/funkin/graphics/FunkinCamera.hx index 301f0906a..459623dce 100644 --- a/source/funkin/graphics/FunkinCamera.hx +++ b/source/funkin/graphics/FunkinCamera.hx @@ -38,15 +38,7 @@ using funkin.graphics.framebuffer.BitmapDataUtil; * - COLOR * - LUMINOSITY */ -@:nullSafety -@:access(openfl.display.DisplayObject) -@:access(openfl.display.BitmapData) -@:access(openfl.display3D.Context3D) -@:access(openfl.display3D.textures.TextureBase) -@:access(flixel.graphics.FlxGraphic) -@:access(flixel.graphics.frames.FlxFrame) -@:access(openfl.display.OpenGLRenderer) -@:access(openfl.geom.ColorTransform) +@:nullSafety @:access(openfl.display.DisplayObject) @:access(openfl.display.BitmapData) @:access(openfl.display3D.Context3D) @:access(openfl.display3D.textures.TextureBase) @:access(flixel.graphics.FlxGraphic) @:access(flixel.graphics.frames.FlxFrame) @:access(openfl.display.OpenGLRenderer) @:access(openfl.geom.ColorTransform) class FunkinCamera extends FlxCamera { /** @@ -72,7 +64,21 @@ class FunkinCamera extends FlxCamera * - `LIGHTEN` is supported natively on desktop, but not other platforms. * - While `DARKEN` is supported natively on desktop, it causes issues with transparency. */ - static final KHR_BLEND_MODES:Array = [DARKEN, HARDLIGHT, #if !desktop LIGHTEN, #end OVERLAY, DIFFERENCE, COLORDODGE, COLORBURN, SOFTLIGHT, EXCLUSION, HUE, SATURATION, COLOR, LUMINOSITY]; + static final KHR_BLEND_MODES:Array = [ + DARKEN, + HARDLIGHT, + #if !desktop LIGHTEN, #end + OVERLAY, + DIFFERENCE, + COLORDODGE, + COLORBURN, + SOFTLIGHT, + EXCLUSION, + HUE, + SATURATION, + COLOR, + LUMINOSITY + ]; /** * A list of blend modes that require the shader no matter what. @@ -95,10 +101,8 @@ class FunkinCamera extends FlxCamera var _blendShader:RuntimeCustomBlendShader; var _backgroundFrame:FlxFrame; - var _blendRenderTexture:RenderTexture; var _backgroundRenderTexture:RenderTexture; - var _cameraTexture:FixedBitmapData; var _cameraMatrix:FlxMatrix; diff --git a/source/funkin/graphics/FunkinSprite.hx b/source/funkin/graphics/FunkinSprite.hx index 26d9412dc..e6d4282c5 100644 --- a/source/funkin/graphics/FunkinSprite.hx +++ b/source/funkin/graphics/FunkinSprite.hx @@ -113,8 +113,7 @@ typedef AtlasSpriteSettings = * - A more efficient method for creating solid color sprites. * - TODO: Better cache handling for textures. */ -@:nullSafety -@:access(animate.FlxAnimateController) +@:nullSafety @:access(animate.FlxAnimateController) class FunkinSprite extends FlxAnimate { /** diff --git a/source/funkin/graphics/framebuffer/BitmapDataUtil.hx b/source/funkin/graphics/framebuffer/BitmapDataUtil.hx index cc5e349e8..731899151 100644 --- a/source/funkin/graphics/framebuffer/BitmapDataUtil.hx +++ b/source/funkin/graphics/framebuffer/BitmapDataUtil.hx @@ -15,14 +15,7 @@ import openfl.geom.ColorTransform; /** * A utility class for `BitmapData`s. */ -@:nullSafety -@:access(openfl.display.BitmapData) -@:access(openfl.display3D.textures.TextureBase) -@:access(openfl.display3D.Context3D) -@:access(openfl.display.OpenGLRenderer) -@:access(flixel.FlxCamera) -@:access(openfl.display.Sprite) -@:access(openfl.geom.ColorTransform) +@:nullSafety @:access(openfl.display.BitmapData) @:access(openfl.display3D.textures.TextureBase) @:access(openfl.display3D.Context3D) @:access(openfl.display.OpenGLRenderer) @:access(flixel.FlxCamera) @:access(openfl.display.Sprite) @:access(openfl.geom.ColorTransform) class BitmapDataUtil { static var renderer(get, never):OpenGLRenderer; diff --git a/source/funkin/graphics/framebuffer/FixedBitmapData.hx b/source/funkin/graphics/framebuffer/FixedBitmapData.hx index 05de3d34a..5450a8897 100644 --- a/source/funkin/graphics/framebuffer/FixedBitmapData.hx +++ b/source/funkin/graphics/framebuffer/FixedBitmapData.hx @@ -11,9 +11,7 @@ import openfl.Lib; /** * `BitmapData` is kinda broken so I fixed it. */ -@:nullSafety -@:access(openfl.display3D.textures.TextureBase) -@:access(openfl.display.OpenGLRenderer) +@:nullSafety @:access(openfl.display3D.textures.TextureBase) @:access(openfl.display.OpenGLRenderer) class FixedBitmapData extends BitmapData { override function __drawGL(source:IBitmapDrawable, renderer:OpenGLRenderer):Void diff --git a/source/funkin/graphics/framebuffer/FunkinFilterRenderer.hx b/source/funkin/graphics/framebuffer/FunkinFilterRenderer.hx index 07c0de691..70a27b1f4 100644 --- a/source/funkin/graphics/framebuffer/FunkinFilterRenderer.hx +++ b/source/funkin/graphics/framebuffer/FunkinFilterRenderer.hx @@ -12,13 +12,7 @@ import animate.internal.FilterRenderer; /** * A helper for rendering filters on `FunkinSprite` instances. */ -@:access(animate.FlxAnimate) -@:access(openfl.filters.BitmapFilter) -@:access(animate.internal.FilterRenderer) -@:access(openfl.display.OpenGLRenderer) -@:access(openfl.geom.ColorTransform) -@:access(openfl.display.BitmapData) -@:nullSafety +@:access(animate.FlxAnimate) @:access(openfl.filters.BitmapFilter) @:access(animate.internal.FilterRenderer) @:access(openfl.display.OpenGLRenderer) @:access(openfl.geom.ColorTransform) @:access(openfl.display.BitmapData) @:nullSafety class FunkinFilterRenderer implements IFlxDestroyable { /** diff --git a/source/funkin/graphics/shaders/BlendModeEffect.hx b/source/funkin/graphics/shaders/BlendModeEffect.hx index ba0971cdf..1fc74440f 100644 --- a/source/funkin/graphics/shaders/BlendModeEffect.hx +++ b/source/funkin/graphics/shaders/BlendModeEffect.hx @@ -12,7 +12,6 @@ typedef BlendModeShader = class BlendModeEffect { public var shader(default, null):BlendModeShader; - @:isVar public var color(default, set):FlxColor = new FlxColor(); diff --git a/source/funkin/graphics/shaders/ColorSwap.hx b/source/funkin/graphics/shaders/ColorSwap.hx index 1be4d5429..ce33e72e9 100644 --- a/source/funkin/graphics/shaders/ColorSwap.hx +++ b/source/funkin/graphics/shaders/ColorSwap.hx @@ -9,9 +9,7 @@ class ColorSwap public var colorToReplace(default, set):FlxColor; public var newColor(default, set):FlxColor; public var daTime(default, set):Float; - public var hasOutline(default, set):Bool = false; - public var hueShit:Float = 0; public function new():Void diff --git a/source/funkin/graphics/shaders/RuntimePostEffectShader.hx b/source/funkin/graphics/shaders/RuntimePostEffectShader.hx index f18bc67de..07ebe9a0b 100644 --- a/source/funkin/graphics/shaders/RuntimePostEffectShader.hx +++ b/source/funkin/graphics/shaders/RuntimePostEffectShader.hx @@ -14,14 +14,12 @@ class RuntimePostEffectShader extends FlxRuntimeShader // (0, 0) is the top left of the window // (1, 1) is the bottom right of the window varying vec2 screenCoord; - ', true) - @:glVertexBody(' + ', true) @:glVertexBody(' screenCoord = vec2( openfl_TextureCoord.x > 0.0 ? 1.0 : 0.0, openfl_TextureCoord.y > 0.0 ? 1.0 : 0.0 ); - ') - @:glFragmentHeader(' + ') @:glFragmentHeader(' // normalized screen coord // (0, 0) is the top left of the window // (1, 1) is the bottom right of the window @@ -108,6 +106,7 @@ class RuntimePostEffectShader extends FlxRuntimeShader } // basically `updateViewInfo(FlxG.width, FlxG.height, FlxG.camera)` is good + public function updateViewInfo(screenWidth:Float, screenHeight:Float, camera:FlxCamera):Void { uScreenResolution.value = [screenWidth, screenHeight]; diff --git a/source/funkin/graphics/shaders/RuntimeRainShader.hx b/source/funkin/graphics/shaders/RuntimeRainShader.hx index 4c212314a..a576795e2 100644 --- a/source/funkin/graphics/shaders/RuntimeRainShader.hx +++ b/source/funkin/graphics/shaders/RuntimeRainShader.hx @@ -22,7 +22,6 @@ class RuntimeRainShader extends RuntimePostEffectShader color:ShaderParameter, radius:ShaderParameter, }>; - public var time(default, set):Float = 1; function set_time(value:Float):Float @@ -133,12 +132,14 @@ class RuntimeRainShader extends RuntimePostEffectShader super.__processGLData(source, storageType); if (storageType == 'uniform') { - lights = [for (i in 0...MAX_LIGHTS) - { - position: addFloatUniform('lights[$i].position', 2), - color: addFloatUniform('lights[$i].color', 3), - radius: addFloatUniform('lights[$i].radius', 1), - }]; + lights = [ + for (i in 0...MAX_LIGHTS) + { + position: addFloatUniform('lights[$i].position', 2), + color: addFloatUniform('lights[$i].color', 3), + radius: addFloatUniform('lights[$i].radius', 1), + } + ]; } } @@ -147,7 +148,13 @@ class RuntimeRainShader extends RuntimePostEffectShader { final res = new ShaderParameter(); res.name = name; - res.type = [null, FLOAT, FLOAT2, FLOAT3, FLOAT4][length]; + res.type = [ + null, + FLOAT, + FLOAT2, + FLOAT3, + FLOAT4 + ][length]; res.__arrayLength = 1; res.__isFloat = true; res.__isUniform = true; diff --git a/source/funkin/graphics/shaders/SserafimShader.hx b/source/funkin/graphics/shaders/SserafimShader.hx index 3e21ffb8e..93d19ca42 100644 --- a/source/funkin/graphics/shaders/SserafimShader.hx +++ b/source/funkin/graphics/shaders/SserafimShader.hx @@ -19,45 +19,37 @@ class SserafimShader extends FlxShader (this is treated differently when isCharacter is true) */ public var darkenAmount(default, set):Float; - /* The color of the pulse light behind the truck. */ public var pulseLightColor(default, set):FlxColor; - /* The strength/opacity of the light behind the truck. */ public var pulseLightStrength(default, set):Float; - /* The strength/opacity of the lights on the truck. */ public var truckLightStrength(default, set):Float; - /* Whether this shader is for the characters or not. This will change how dramatic the light effect is. */ public var isCharacter(default, set):Bool; - // TODO: this is for the future but maybe we should make support for AdjustColor to be like... a default thing any shader can pull from??? // (if thats possible??) i know flixel does some stuff like that /* The hue component of the Adjust Color part of the shader. */ public var baseHue(default, set):Float; - /* The saturation component of the Adjust Color part of the shader. */ public var baseSaturation(default, set):Float; - /* The brightness component of the Adjust Color part of the shader. */ public var baseBrightness(default, set):Float; - /* The contrast component of the Adjust Color part of the shader. */ diff --git a/source/funkin/graphics/shaders/StrokeShader.hx b/source/funkin/graphics/shaders/StrokeShader.hx index d110e7de9..fd9bb670a 100644 --- a/source/funkin/graphics/shaders/StrokeShader.hx +++ b/source/funkin/graphics/shaders/StrokeShader.hx @@ -9,7 +9,6 @@ class StrokeShader extends FlxShader // https://gist.github.com/AustinEast/d3892fdf6a6079366fffde071f0c2bae public var width(default, set):Float = 0; public var height(default, set):Float = 0; - public var col(default, set):FlxColor = 0xFFFFFFFF; function set_width(val):Float diff --git a/source/funkin/group/ScriptedFunkinGroup.hx b/source/funkin/group/ScriptedFunkinGroup.hx index 379526679..63b898c2f 100644 --- a/source/funkin/group/ScriptedFunkinGroup.hx +++ b/source/funkin/group/ScriptedFunkinGroup.hx @@ -5,11 +5,15 @@ package funkin.group; * Create a scripted class that extends FunkinGroup to use this. */ @:hscriptClass -class ScriptedFunkinGroup extends funkin.group.FunkinGroup implements polymod.hscript.HScriptedClass {} +class ScriptedFunkinGroup extends funkin.group.FunkinGroup implements polymod.hscript.HScriptedClass +{ +} /** * A script that can be tied to a FunkinSpriteGroup. * Create a scripted class that extends FunkinSpriteGroup to use this. */ @:hscriptClass -class ScriptedFunkinSpriteGroup extends funkin.group.FunkinGroup.FunkinSpriteGroup implements polymod.hscript.HScriptedClass {} +class ScriptedFunkinSpriteGroup extends funkin.group.FunkinGroup.FunkinSpriteGroup implements polymod.hscript.HScriptedClass +{ +} diff --git a/source/funkin/input/Controls.hx b/source/funkin/input/Controls.hx index e2c8d62a2..311f9c949 100644 --- a/source/funkin/input/Controls.hx +++ b/source/funkin/input/Controls.hx @@ -28,12 +28,10 @@ class Controls extends FlxActionSet 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 _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 _accept = new FunkinAction(Action.ACCEPT); var _back = new FunkinAction(Action.BACK); var _pause = new FunkinAction(Action.PAUSE); @@ -62,12 +60,10 @@ class Controls extends FlxActionSet 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(); public var gamepadsAdded:Array = []; public var keyboardScheme = KeyboardScheme.None; - public var UI_UP(get, never):Bool; inline function get_UI_UP() return _ui_up.checkPressed(); @@ -387,18 +383,24 @@ class Controls extends FlxActionSet { return switch (FunkinAction.lastDeviceUsed) { - case KEYBOARD: return '[${InputUtil.format(input.inputID, Keys).toUpperCase()}]'; - case GAMEPAD: return '(${InputUtil.format(input.inputID, Gamepad(input.deviceID)).toUpperCase()})'; - case device: throw 'unhandled device: $device'; + case KEYBOARD: + return '[${InputUtil.format(input.inputID, Keys).toUpperCase()}]'; + case GAMEPAD: + return '(${InputUtil.format(input.inputID, Gamepad(input.deviceID)).toUpperCase()})'; + case device: + throw 'unhandled device: $device'; } } else { return switch (FunkinAction.lastDeviceUsed) { - case KEYBOARD: return InputUtil.format(input.inputID, Keys).toUpperCase(); - case GAMEPAD: return InputUtil.format(input.inputID, Gamepad(input.deviceID)).toUpperCase(); - case device: throw 'unhandled device: $device'; + case KEYBOARD: + return InputUtil.format(input.inputID, Keys).toUpperCase(); + case GAMEPAD: + return InputUtil.format(input.inputID, Gamepad(input.deviceID)).toUpperCase(); + case device: + throw 'unhandled device: $device'; } } } @@ -417,34 +419,70 @@ class Controls extends FlxActionSet { return switch (control) { - case UI_UP: _ui_up; - case UI_DOWN: _ui_down; - case UI_LEFT: _ui_left; - case UI_RIGHT: _ui_right; - case NOTE_UP: _note_up; - case NOTE_DOWN: _note_down; - case NOTE_LEFT: _note_left; - case NOTE_RIGHT: _note_right; - case ACCEPT: _accept; - case BACK: _back; - case PAUSE: _pause; - case RESET: _reset; - #if FEATURE_SCREENSHOTS case WINDOW_SCREENSHOT: _window_screenshot; #end - case WINDOW_FULLSCREEN: _window_fullscreen; - case FREEPLAY_FAVORITE: _freeplay_favorite; - case FREEPLAY_LEFT: _freeplay_left; - case FREEPLAY_RIGHT: _freeplay_right; - case FREEPLAY_CHAR_SELECT: _freeplay_char_select; - case FREEPLAY_JUMP_TO_TOP: _freeplay_jump_to_top; - case FREEPLAY_JUMP_TO_BOTTOM: _freeplay_jump_to_bottom; - case CUTSCENE_ADVANCE: _cutscene_advance; - #if FEATURE_DEBUG_MENU case DEBUG_MENU: _debug_menu; #end - #if FEATURE_CHART_EDITOR case DEBUG_CHART: _debug_chart; #end - #if FEATURE_STAGE_EDITOR case DEBUG_STAGE: _debug_stage; #end - case DEBUG_DISPLAY: _debug_display; - case VOLUME_UP: _volume_up; - case VOLUME_DOWN: _volume_down; - case VOLUME_MUTE: _volume_mute; + case UI_UP: + _ui_up; + case UI_DOWN: + _ui_down; + case UI_LEFT: + _ui_left; + case UI_RIGHT: + _ui_right; + case NOTE_UP: + _note_up; + case NOTE_DOWN: + _note_down; + case NOTE_LEFT: + _note_left; + case NOTE_RIGHT: + _note_right; + case ACCEPT: + _accept; + case BACK: + _back; + case PAUSE: + _pause; + case RESET: + _reset; + #if FEATURE_SCREENSHOTS + case WINDOW_SCREENSHOT: + _window_screenshot; + #end + case WINDOW_FULLSCREEN: + _window_fullscreen; + case FREEPLAY_FAVORITE: + _freeplay_favorite; + case FREEPLAY_LEFT: + _freeplay_left; + case FREEPLAY_RIGHT: + _freeplay_right; + case FREEPLAY_CHAR_SELECT: + _freeplay_char_select; + case FREEPLAY_JUMP_TO_TOP: + _freeplay_jump_to_top; + case FREEPLAY_JUMP_TO_BOTTOM: + _freeplay_jump_to_bottom; + case CUTSCENE_ADVANCE: + _cutscene_advance; + #if FEATURE_DEBUG_MENU + case DEBUG_MENU: + _debug_menu; + #end + #if FEATURE_CHART_EDITOR + case DEBUG_CHART: + _debug_chart; + #end + #if FEATURE_STAGE_EDITOR + case DEBUG_STAGE: + _debug_stage; + #end + case DEBUG_DISPLAY: + _debug_display; + case VOLUME_UP: + _volume_up; + case VOLUME_DOWN: + _volume_down; + case VOLUME_MUTE: + _volume_mute; } } @@ -775,98 +813,206 @@ class Controls extends FlxActionSet case Solo: switch (control) { - case Control.UI_UP: return [W, FlxKey.UP]; - case Control.UI_DOWN: return [S, FlxKey.DOWN]; - case Control.UI_LEFT: return [A, FlxKey.LEFT]; - case Control.UI_RIGHT: return [D, FlxKey.RIGHT]; - case Control.NOTE_UP: return [W, FlxKey.UP]; - case Control.NOTE_DOWN: return [S, FlxKey.DOWN]; - case Control.NOTE_LEFT: return [A, FlxKey.LEFT]; - case Control.NOTE_RIGHT: return [D, FlxKey.RIGHT]; - case Control.ACCEPT: return [Z, SPACE, ENTER]; - case Control.BACK: return [X, BACKSPACE, ESCAPE]; - case Control.PAUSE: return [P, ENTER, ESCAPE]; - case Control.RESET: return [R]; - case Control.WINDOW_FULLSCREEN: return [F11]; // We use F for other things LOL. - #if FEATURE_SCREENSHOTS case Control.WINDOW_SCREENSHOT: return [F3]; #end - case Control.FREEPLAY_FAVORITE: return [F]; // Favorite a song on the menu - case Control.FREEPLAY_LEFT: return [Q]; // Switch tabs on the menu - case Control.FREEPLAY_RIGHT: return [E]; // Switch tabs on the menu - case Control.FREEPLAY_CHAR_SELECT: return [TAB]; - case Control.FREEPLAY_JUMP_TO_TOP: return [HOME]; - case Control.FREEPLAY_JUMP_TO_BOTTOM: return [END]; - case Control.CUTSCENE_ADVANCE: return [Z, ENTER]; - #if FEATURE_DEBUG_MENU case Control.DEBUG_MENU: return [GRAVEACCENT]; #end - #if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end - #if FEATURE_STAGE_EDITOR case Control.DEBUG_STAGE: return []; #end - case Control.DEBUG_DISPLAY: return [F6]; - case Control.VOLUME_UP: return [PLUS, NUMPADPLUS]; - case Control.VOLUME_DOWN: return [MINUS, NUMPADMINUS]; - case Control.VOLUME_MUTE: return [ZERO, NUMPADZERO]; + case Control.UI_UP: + return [W, FlxKey.UP]; + case Control.UI_DOWN: + return [S, FlxKey.DOWN]; + case Control.UI_LEFT: + return [A, FlxKey.LEFT]; + case Control.UI_RIGHT: + return [D, FlxKey.RIGHT]; + case Control.NOTE_UP: + return [W, FlxKey.UP]; + case Control.NOTE_DOWN: + return [S, FlxKey.DOWN]; + case Control.NOTE_LEFT: + return [A, FlxKey.LEFT]; + case Control.NOTE_RIGHT: + return [D, FlxKey.RIGHT]; + case Control.ACCEPT: + return [Z, SPACE, ENTER]; + case Control.BACK: + return [X, BACKSPACE, ESCAPE]; + case Control.PAUSE: + return [P, ENTER, ESCAPE]; + case Control.RESET: + return [R]; + case Control.WINDOW_FULLSCREEN: + return [F11]; // We use F for other things LOL. + #if FEATURE_SCREENSHOTS + case Control.WINDOW_SCREENSHOT: + return [F3]; + #end + case Control.FREEPLAY_FAVORITE: + return [F]; // Favorite a song on the menu + case Control.FREEPLAY_LEFT: + return [Q]; // Switch tabs on the menu + case Control.FREEPLAY_RIGHT: + return [E]; // Switch tabs on the menu + case Control.FREEPLAY_CHAR_SELECT: + return [TAB]; + case Control.FREEPLAY_JUMP_TO_TOP: + return [HOME]; + case Control.FREEPLAY_JUMP_TO_BOTTOM: + return [END]; + case Control.CUTSCENE_ADVANCE: + return [Z, ENTER]; + #if FEATURE_DEBUG_MENU + case Control.DEBUG_MENU: + return [GRAVEACCENT]; + #end + #if FEATURE_CHART_EDITOR + case Control.DEBUG_CHART: + return []; + #end + #if FEATURE_STAGE_EDITOR + case Control.DEBUG_STAGE: + return []; + #end + case Control.DEBUG_DISPLAY: + return [F6]; + case Control.VOLUME_UP: + return [PLUS, NUMPADPLUS]; + case Control.VOLUME_DOWN: + return [MINUS, NUMPADMINUS]; + case Control.VOLUME_MUTE: + return [ZERO, NUMPADZERO]; } case Duo(true): switch (control) { - case Control.UI_UP: return [W]; - case Control.UI_DOWN: return [S]; - case Control.UI_LEFT: return [A]; - case Control.UI_RIGHT: return [D]; - case Control.NOTE_UP: return [W]; - case Control.NOTE_DOWN: return [S]; - case Control.NOTE_LEFT: return [A]; - case Control.NOTE_RIGHT: return [D]; - case Control.ACCEPT: return [G, Z]; - case Control.BACK: return [H, X]; - case Control.PAUSE: return [ONE]; - case Control.RESET: return [R]; - #if FEATURE_SCREENSHOTS case Control.WINDOW_SCREENSHOT: return [F3]; #end - case Control.WINDOW_FULLSCREEN: return [F11]; - case Control.FREEPLAY_FAVORITE: return [F]; // Favorite a song on the menu - case Control.FREEPLAY_LEFT: return [Q]; // Switch tabs on the menu - case Control.FREEPLAY_RIGHT: return [E]; // Switch tabs on the menu - case Control.FREEPLAY_CHAR_SELECT: return [TAB]; - case Control.FREEPLAY_JUMP_TO_TOP: return [HOME]; - case Control.FREEPLAY_JUMP_TO_BOTTOM: return [END]; - case Control.CUTSCENE_ADVANCE: return [G, Z]; - #if FEATURE_DEBUG_MENU case Control.DEBUG_MENU: return [GRAVEACCENT]; #end - #if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end - #if FEATURE_STAGE_EDITOR case Control.DEBUG_STAGE: return []; #end - case Control.DEBUG_DISPLAY: return [F6]; - case Control.VOLUME_UP: return [PLUS]; - case Control.VOLUME_DOWN: return [MINUS]; - case Control.VOLUME_MUTE: return [ZERO]; + case Control.UI_UP: + return [W]; + case Control.UI_DOWN: + return [S]; + case Control.UI_LEFT: + return [A]; + case Control.UI_RIGHT: + return [D]; + case Control.NOTE_UP: + return [W]; + case Control.NOTE_DOWN: + return [S]; + case Control.NOTE_LEFT: + return [A]; + case Control.NOTE_RIGHT: + return [D]; + case Control.ACCEPT: + return [G, Z]; + case Control.BACK: + return [H, X]; + case Control.PAUSE: + return [ONE]; + case Control.RESET: + return [R]; + #if FEATURE_SCREENSHOTS + case Control.WINDOW_SCREENSHOT: + return [F3]; + #end + case Control.WINDOW_FULLSCREEN: + return [F11]; + case Control.FREEPLAY_FAVORITE: + return [F]; // Favorite a song on the menu + case Control.FREEPLAY_LEFT: + return [Q]; // Switch tabs on the menu + case Control.FREEPLAY_RIGHT: + return [E]; // Switch tabs on the menu + case Control.FREEPLAY_CHAR_SELECT: + return [TAB]; + case Control.FREEPLAY_JUMP_TO_TOP: + return [HOME]; + case Control.FREEPLAY_JUMP_TO_BOTTOM: + return [END]; + case Control.CUTSCENE_ADVANCE: + return [G, Z]; + #if FEATURE_DEBUG_MENU + case Control.DEBUG_MENU: + return [GRAVEACCENT]; + #end + #if FEATURE_CHART_EDITOR + case Control.DEBUG_CHART: + return []; + #end + #if FEATURE_STAGE_EDITOR + case Control.DEBUG_STAGE: + return []; + #end + case Control.DEBUG_DISPLAY: + return [F6]; + case Control.VOLUME_UP: + return [PLUS]; + case Control.VOLUME_DOWN: + return [MINUS]; + case Control.VOLUME_MUTE: + return [ZERO]; } case Duo(false): switch (control) { - case Control.UI_UP: return [FlxKey.UP]; - case Control.UI_DOWN: return [FlxKey.DOWN]; - case Control.UI_LEFT: return [FlxKey.LEFT]; - case Control.UI_RIGHT: return [FlxKey.RIGHT]; - case Control.NOTE_UP: return [FlxKey.UP]; - case Control.NOTE_DOWN: return [FlxKey.DOWN]; - case Control.NOTE_LEFT: return [FlxKey.LEFT]; - case Control.NOTE_RIGHT: return [FlxKey.RIGHT]; - case Control.ACCEPT: return [ENTER]; - case Control.BACK: return [ESCAPE]; - case Control.PAUSE: return [ONE]; - case Control.RESET: return [R]; - #if FEATURE_SCREENSHOTS case Control.WINDOW_SCREENSHOT: return []; #end - case Control.WINDOW_FULLSCREEN: return []; - case Control.FREEPLAY_FAVORITE: return []; - case Control.FREEPLAY_LEFT: return []; - case Control.FREEPLAY_RIGHT: return []; - case Control.FREEPLAY_CHAR_SELECT: return []; - case Control.FREEPLAY_JUMP_TO_TOP: return []; - case Control.FREEPLAY_JUMP_TO_BOTTOM: return []; - case Control.CUTSCENE_ADVANCE: return [ENTER]; - #if FEATURE_DEBUG_MENU case Control.DEBUG_MENU: return []; #end - #if FEATURE_CHART_EDITOR case Control.DEBUG_CHART: return []; #end - #if FEATURE_STAGE_EDITOR case Control.DEBUG_STAGE: return []; #end - case Control.DEBUG_DISPLAY: return []; - case Control.VOLUME_UP: return [NUMPADPLUS]; - case Control.VOLUME_DOWN: return [NUMPADMINUS]; - case Control.VOLUME_MUTE: return [NUMPADZERO]; + case Control.UI_UP: + return [FlxKey.UP]; + case Control.UI_DOWN: + return [FlxKey.DOWN]; + case Control.UI_LEFT: + return [FlxKey.LEFT]; + case Control.UI_RIGHT: + return [FlxKey.RIGHT]; + case Control.NOTE_UP: + return [FlxKey.UP]; + case Control.NOTE_DOWN: + return [FlxKey.DOWN]; + case Control.NOTE_LEFT: + return [FlxKey.LEFT]; + case Control.NOTE_RIGHT: + return [FlxKey.RIGHT]; + case Control.ACCEPT: + return [ENTER]; + case Control.BACK: + return [ESCAPE]; + case Control.PAUSE: + return [ONE]; + case Control.RESET: + return [R]; + #if FEATURE_SCREENSHOTS + case Control.WINDOW_SCREENSHOT: + return []; + #end + case Control.WINDOW_FULLSCREEN: + return []; + case Control.FREEPLAY_FAVORITE: + return []; + case Control.FREEPLAY_LEFT: + return []; + case Control.FREEPLAY_RIGHT: + return []; + case Control.FREEPLAY_CHAR_SELECT: + return []; + case Control.FREEPLAY_JUMP_TO_TOP: + return []; + case Control.FREEPLAY_JUMP_TO_BOTTOM: + return []; + case Control.CUTSCENE_ADVANCE: + return [ENTER]; + #if FEATURE_DEBUG_MENU + case Control.DEBUG_MENU: + return []; + #end + #if FEATURE_CHART_EDITOR + case Control.DEBUG_CHART: + return []; + #end + #if FEATURE_STAGE_EDITOR + case Control.DEBUG_STAGE: + return []; + #end + case Control.DEBUG_DISPLAY: + return []; + case Control.VOLUME_UP: + return [NUMPADPLUS]; + case Control.VOLUME_DOWN: + return [NUMPADMINUS]; + case Control.VOLUME_MUTE: + return [NUMPADZERO]; } default: // Fallthrough. @@ -920,8 +1066,36 @@ class Controls extends FlxActionSet public function addDefaultGamepad(id:Int):Void { - addGamepadLiteral(id, - [Control.ACCEPT => getDefaultGamepadBinds(Control.ACCEPT), Control.BACK => getDefaultGamepadBinds(Control.BACK), Control.UI_UP => getDefaultGamepadBinds(Control.UI_UP), Control.UI_DOWN => getDefaultGamepadBinds(Control.UI_DOWN), Control.UI_LEFT => getDefaultGamepadBinds(Control.UI_LEFT), Control.UI_RIGHT => getDefaultGamepadBinds(Control.UI_RIGHT), Control.NOTE_UP => getDefaultGamepadBinds(Control.NOTE_UP), Control.NOTE_DOWN => getDefaultGamepadBinds(Control.NOTE_DOWN), Control.NOTE_LEFT => getDefaultGamepadBinds(Control.NOTE_LEFT), Control.NOTE_RIGHT => getDefaultGamepadBinds(Control.NOTE_RIGHT), Control.PAUSE => getDefaultGamepadBinds(Control.PAUSE), Control.RESET => getDefaultGamepadBinds(Control.RESET), Control.WINDOW_FULLSCREEN => getDefaultGamepadBinds(Control.WINDOW_FULLSCREEN), #if FEATURE_SCREENSHOTS Control.WINDOW_SCREENSHOT => getDefaultGamepadBinds(Control.WINDOW_SCREENSHOT), #end Control.CUTSCENE_ADVANCE => getDefaultGamepadBinds(Control.CUTSCENE_ADVANCE), Control.FREEPLAY_FAVORITE => getDefaultGamepadBinds(Control.FREEPLAY_FAVORITE), Control.FREEPLAY_LEFT => getDefaultGamepadBinds(Control.FREEPLAY_LEFT), Control.FREEPLAY_RIGHT => getDefaultGamepadBinds(Control.FREEPLAY_RIGHT), Control.FREEPLAY_CHAR_SELECT => getDefaultGamepadBinds(Control.FREEPLAY_CHAR_SELECT), Control.FREEPLAY_JUMP_TO_TOP => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_TOP), Control.FREEPLAY_JUMP_TO_BOTTOM => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_BOTTOM), Control.VOLUME_UP => getDefaultGamepadBinds(Control.VOLUME_UP), Control.VOLUME_DOWN => getDefaultGamepadBinds(Control.VOLUME_DOWN), Control.VOLUME_MUTE => getDefaultGamepadBinds(Control.VOLUME_MUTE), #if FEATURE_DEBUG_MENU Control.DEBUG_MENU => getDefaultGamepadBinds(Control.DEBUG_MENU), #end#if FEATURE_CHART_EDITOR Control.DEBUG_CHART => getDefaultGamepadBinds(Control.DEBUG_CHART), #end#if FEATURE_STAGE_EDITOR Control.DEBUG_STAGE => getDefaultGamepadBinds(Control.DEBUG_STAGE), #end Control.DEBUG_DISPLAY => getDefaultGamepadBinds(Control.DEBUG_DISPLAY),]); + addGamepadLiteral(id, [ + Control.ACCEPT => getDefaultGamepadBinds(Control.ACCEPT), + Control.BACK => getDefaultGamepadBinds(Control.BACK), + Control.UI_UP => getDefaultGamepadBinds(Control.UI_UP), + Control.UI_DOWN => getDefaultGamepadBinds(Control.UI_DOWN), + Control.UI_LEFT => getDefaultGamepadBinds(Control.UI_LEFT), + Control.UI_RIGHT => getDefaultGamepadBinds(Control.UI_RIGHT), + Control.NOTE_UP => getDefaultGamepadBinds(Control.NOTE_UP), + Control.NOTE_DOWN => getDefaultGamepadBinds(Control.NOTE_DOWN), + Control.NOTE_LEFT => getDefaultGamepadBinds(Control.NOTE_LEFT), + Control.NOTE_RIGHT => getDefaultGamepadBinds(Control.NOTE_RIGHT), + Control.PAUSE => getDefaultGamepadBinds(Control.PAUSE), + Control.RESET => getDefaultGamepadBinds(Control.RESET), + Control.WINDOW_FULLSCREEN => getDefaultGamepadBinds(Control.WINDOW_FULLSCREEN), + #if FEATURE_SCREENSHOTS Control.WINDOW_SCREENSHOT => getDefaultGamepadBinds(Control.WINDOW_SCREENSHOT), #end + Control.CUTSCENE_ADVANCE => getDefaultGamepadBinds(Control.CUTSCENE_ADVANCE), + Control.FREEPLAY_FAVORITE => getDefaultGamepadBinds(Control.FREEPLAY_FAVORITE), + Control.FREEPLAY_LEFT => getDefaultGamepadBinds(Control.FREEPLAY_LEFT), + Control.FREEPLAY_RIGHT => getDefaultGamepadBinds(Control.FREEPLAY_RIGHT), + Control.FREEPLAY_CHAR_SELECT => getDefaultGamepadBinds(Control.FREEPLAY_CHAR_SELECT), + Control.FREEPLAY_JUMP_TO_TOP => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_TOP), + Control.FREEPLAY_JUMP_TO_BOTTOM => getDefaultGamepadBinds(Control.FREEPLAY_JUMP_TO_BOTTOM), + Control.VOLUME_UP => getDefaultGamepadBinds(Control.VOLUME_UP), + Control.VOLUME_DOWN => getDefaultGamepadBinds(Control.VOLUME_DOWN), + Control.VOLUME_MUTE => getDefaultGamepadBinds(Control.VOLUME_MUTE), + #if FEATURE_DEBUG_MENU Control.DEBUG_MENU => getDefaultGamepadBinds(Control.DEBUG_MENU), #end + #if FEATURE_CHART_EDITOR Control.DEBUG_CHART => getDefaultGamepadBinds(Control.DEBUG_CHART), #end + #if FEATURE_STAGE_EDITOR Control.DEBUG_STAGE => getDefaultGamepadBinds(Control.DEBUG_STAGE), #end + Control.DEBUG_DISPLAY => getDefaultGamepadBinds(Control.DEBUG_DISPLAY), + ]); } function getDefaultGamepadBinds(control:Control):Array @@ -1140,8 +1314,10 @@ class Controls extends FlxActionSet { return switch (device) { - case Keys: input.device == KEYBOARD; - case Gamepad(id): isGamepad(input, id); + case Keys: + input.device == KEYBOARD; + case Gamepad(id): + isGamepad(input, id); } } diff --git a/source/funkin/input/Cursor.hx b/source/funkin/input/Cursor.hx index 027e4ee12..1e4f224b6 100644 --- a/source/funkin/input/Cursor.hx +++ b/source/funkin/input/Cursor.hx @@ -54,7 +54,6 @@ class Cursor offsetY: 0, }; static var assetCursorDefault:Null = null; - public static final CURSOR_CROSS_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-cross.png", scale: 1.0, @@ -62,7 +61,6 @@ class Cursor offsetY: 0, }; static var assetCursorCross:Null = null; - public static final CURSOR_ERASER_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-eraser.png", scale: 1.0, @@ -70,7 +68,6 @@ class Cursor offsetY: 0, }; static var assetCursorEraser:Null = null; - public static final CURSOR_GRABBING_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-grabbing.png", scale: 1.0, @@ -78,7 +75,6 @@ class Cursor offsetY: 0, }; static var assetCursorGrabbing:Null = null; - public static final CURSOR_HOURGLASS_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-hourglass.png", scale: 1.0, @@ -86,7 +82,6 @@ class Cursor offsetY: 0, }; static var assetCursorHourglass:Null = null; - public static final CURSOR_POINTER_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-pointer.png", scale: 1.0, @@ -94,7 +89,6 @@ class Cursor offsetY: 0, }; static var assetCursorPointer:Null = null; - public static final CURSOR_TEXT_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-text.png", scale: 0.2, @@ -102,7 +96,6 @@ class Cursor offsetY: 0, }; static var assetCursorText:Null = null; - public static final CURSOR_TEXT_VERTICAL_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-text-vertical.png", scale: 0.2, @@ -110,7 +103,6 @@ class Cursor offsetY: 0, }; static var assetCursorTextVertical:Null = null; - public static final CURSOR_ZOOM_IN_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-zoom-in.png", scale: 1.0, @@ -118,7 +110,6 @@ class Cursor offsetY: 0, }; static var assetCursorZoomIn:Null = null; - public static final CURSOR_ZOOM_OUT_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-zoom-out.png", scale: 1.0, @@ -126,7 +117,6 @@ class Cursor offsetY: 0, }; static var assetCursorZoomOut:Null = null; - public static final CURSOR_CROSSHAIR_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-crosshair.png", scale: 1.0, @@ -134,7 +124,6 @@ class Cursor offsetY: -16, }; static var assetCursorCrosshair:Null = null; - public static final CURSOR_CELL_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-cell.png", scale: 1.0, @@ -142,7 +131,6 @@ class Cursor offsetY: -16, }; static var assetCursorCell:Null = null; - public static final CURSOR_SCROLL_PARAMS:CursorParams = { graphic: "assets/images/cursor/cursor-scroll.png", scale: 0.2, @@ -191,20 +179,34 @@ class Cursor var data = switch (mode) { - case Default: { cache: assetCursorDefault, params: CURSOR_DEFAULT_PARAMS, set: (bmp) -> assetCursorDefault = bmp }; - case Cross: { cache: assetCursorCross, params: CURSOR_CROSS_PARAMS, set: (bmp) -> assetCursorCross = bmp }; - case Eraser: { cache: assetCursorEraser, params: CURSOR_ERASER_PARAMS, set: (bmp) -> assetCursorEraser = bmp }; - case Grabbing: { cache: assetCursorGrabbing, params: CURSOR_GRABBING_PARAMS, set: (bmp) -> assetCursorGrabbing = bmp }; - case Hourglass: { cache: assetCursorHourglass, params: CURSOR_HOURGLASS_PARAMS, set: (bmp) -> assetCursorHourglass = bmp }; - case Pointer: { cache: assetCursorPointer, params: CURSOR_POINTER_PARAMS, set: (bmp) -> assetCursorPointer = bmp }; - case Text: { cache: assetCursorText, params: CURSOR_TEXT_PARAMS, set: (bmp) -> assetCursorText = bmp }; - case TextVertical: { cache: assetCursorTextVertical, params: CURSOR_TEXT_VERTICAL_PARAMS, set: (bmp) -> assetCursorTextVertical = bmp }; - case ZoomIn: { cache: assetCursorZoomIn, params: CURSOR_ZOOM_IN_PARAMS, set: (bmp) -> assetCursorZoomIn = bmp }; - case ZoomOut: { cache: assetCursorZoomOut, params: CURSOR_ZOOM_OUT_PARAMS, set: (bmp) -> assetCursorZoomOut = bmp }; - case Crosshair: { cache: assetCursorCrosshair, params: CURSOR_CROSSHAIR_PARAMS, set: (bmp) -> assetCursorCrosshair = bmp }; - case Cell: { cache: assetCursorCell, params: CURSOR_CELL_PARAMS, set: (bmp) -> assetCursorCell = bmp }; - case Scroll: { cache: assetCursorScroll, params: CURSOR_SCROLL_PARAMS, set: (bmp) -> assetCursorScroll = bmp }; - default: null; + case Default: + {cache: assetCursorDefault, params: CURSOR_DEFAULT_PARAMS, set: (bmp) -> assetCursorDefault = bmp}; + case Cross: + {cache: assetCursorCross, params: CURSOR_CROSS_PARAMS, set: (bmp) -> assetCursorCross = bmp}; + case Eraser: + {cache: assetCursorEraser, params: CURSOR_ERASER_PARAMS, set: (bmp) -> assetCursorEraser = bmp}; + case Grabbing: + {cache: assetCursorGrabbing, params: CURSOR_GRABBING_PARAMS, set: (bmp) -> assetCursorGrabbing = bmp}; + case Hourglass: + {cache: assetCursorHourglass, params: CURSOR_HOURGLASS_PARAMS, set: (bmp) -> assetCursorHourglass = bmp}; + case Pointer: + {cache: assetCursorPointer, params: CURSOR_POINTER_PARAMS, set: (bmp) -> assetCursorPointer = bmp}; + case Text: + {cache: assetCursorText, params: CURSOR_TEXT_PARAMS, set: (bmp) -> assetCursorText = bmp}; + case TextVertical: + {cache: assetCursorTextVertical, params: CURSOR_TEXT_VERTICAL_PARAMS, set: (bmp) -> assetCursorTextVertical = bmp}; + case ZoomIn: + {cache: assetCursorZoomIn, params: CURSOR_ZOOM_IN_PARAMS, set: (bmp) -> assetCursorZoomIn = bmp}; + case ZoomOut: + {cache: assetCursorZoomOut, params: CURSOR_ZOOM_OUT_PARAMS, set: (bmp) -> assetCursorZoomOut = bmp}; + case Crosshair: + {cache: assetCursorCrosshair, params: CURSOR_CROSSHAIR_PARAMS, set: (bmp) -> assetCursorCrosshair = bmp}; + case Cell: + {cache: assetCursorCell, params: CURSOR_CELL_PARAMS, set: (bmp) -> assetCursorCell = bmp}; + case Scroll: + {cache: assetCursorScroll, params: CURSOR_SCROLL_PARAMS, set: (bmp) -> assetCursorScroll = bmp}; + default: + null; } if (data == null) @@ -222,7 +224,8 @@ class Cursor if (async) { var future:Future = Assets.loadBitmapData(data.params.graphic); - future.onComplete((bmp:BitmapData) -> { + future.onComplete((bmp:BitmapData) -> + { data.set(bmp); applyGraphic(bmp, data.params); }); @@ -274,6 +277,7 @@ class Cursor } // https://developer.mozilla.org/en-US/docs/Web/CSS/cursor + enum CursorMode { Default; diff --git a/source/funkin/input/PreciseInputManager.hx b/source/funkin/input/PreciseInputManager.hx index b860f1c6b..79c685499 100644 --- a/source/funkin/input/PreciseInputManager.hx +++ b/source/funkin/input/PreciseInputManager.hx @@ -56,7 +56,6 @@ class PreciseInputManager extends FlxKeyManager var _buttonList:Map>; var _buttonListArray:Array>; - var _buttonListMap:Map>>; /** @@ -115,10 +114,14 @@ class PreciseInputManager extends FlxKeyManager { return switch (noteDirection) { - case NoteDirection.LEFT: controls.getKeysForAction(NOTE_LEFT); - case NoteDirection.DOWN: controls.getKeysForAction(NOTE_DOWN); - case NoteDirection.UP: controls.getKeysForAction(NOTE_UP); - case NoteDirection.RIGHT: controls.getKeysForAction(NOTE_RIGHT); + case NoteDirection.LEFT: + controls.getKeysForAction(NOTE_LEFT); + case NoteDirection.DOWN: + controls.getKeysForAction(NOTE_DOWN); + case NoteDirection.UP: + controls.getKeysForAction(NOTE_UP); + case NoteDirection.RIGHT: + controls.getKeysForAction(NOTE_RIGHT); }; } @@ -126,10 +129,14 @@ class PreciseInputManager extends FlxKeyManager { return switch (noteDirection) { - case NoteDirection.LEFT: controls.getButtonsForAction(NOTE_LEFT); - case NoteDirection.DOWN: controls.getButtonsForAction(NOTE_DOWN); - case NoteDirection.UP: controls.getButtonsForAction(NOTE_UP); - case NoteDirection.RIGHT: controls.getButtonsForAction(NOTE_RIGHT); + case NoteDirection.LEFT: + controls.getButtonsForAction(NOTE_LEFT); + case NoteDirection.DOWN: + controls.getButtonsForAction(NOTE_DOWN); + case NoteDirection.UP: + controls.getButtonsForAction(NOTE_UP); + case NoteDirection.RIGHT: + controls.getButtonsForAction(NOTE_RIGHT); }; } @@ -240,6 +247,7 @@ class PreciseInputManager extends FlxKeyManager // TODO: Why doesn't this work? // @:allow(funkin.input.PreciseInputManager.PreciseInputList) + public function getInputByKey(key:FlxKey):FlxKeyInput { return _keyListMap.get(key); diff --git a/source/funkin/input/TurboActionHandler.hx b/source/funkin/input/TurboActionHandler.hx index 16f258f8d..0c6b1b4c6 100644 --- a/source/funkin/input/TurboActionHandler.hx +++ b/source/funkin/input/TurboActionHandler.hx @@ -48,11 +48,9 @@ class TurboActionHandler extends FlxBasic } 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) diff --git a/source/funkin/input/TurboButtonHandler.hx b/source/funkin/input/TurboButtonHandler.hx index 45786f8a7..643ebca24 100644 --- a/source/funkin/input/TurboButtonHandler.hx +++ b/source/funkin/input/TurboButtonHandler.hx @@ -40,7 +40,6 @@ class TurboButtonHandler extends FlxBasic 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) diff --git a/source/funkin/input/TurboKeyHandler.hx b/source/funkin/input/TurboKeyHandler.hx index 9495b5802..2a884c7cf 100644 --- a/source/funkin/input/TurboKeyHandler.hx +++ b/source/funkin/input/TurboKeyHandler.hx @@ -38,7 +38,6 @@ class TurboKeyHandler extends FlxBasic var keys:Array; var delay:Float; var interval:Float; - var allPressedTime:Float = 0; function new(keys:Array, delay:Float = DEFAULT_DELAY, interval:Float = DEFAULT_INTERVAL) diff --git a/source/funkin/mobile/ui/FunkinBackButton.hx b/source/funkin/mobile/ui/FunkinBackButton.hx index dbbf872a4..f2c3825c9 100644 --- a/source/funkin/mobile/ui/FunkinBackButton.hx +++ b/source/funkin/mobile/ui/FunkinBackButton.hx @@ -12,9 +12,7 @@ class FunkinBackButton extends FunkinButton { public var onConfirmStart(default, null):FlxSignal = new FlxSignal(); public var onConfirmEnd(default, null):FlxSignal = new FlxSignal(); - public var enabled:Bool = true; - public var confirming(get, never):Bool; function get_confirming():Bool @@ -47,7 +45,25 @@ class FunkinBackButton extends FunkinButton frames = Paths.getSparrowAtlas("backButton"); animation.addByIndices('idle', 'back', [0], "", 24, false); animation.addByIndices('hold', 'back', [5], "", 24, false); - animation.addByIndices('confirm', 'back', [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22], "", 24, false); + animation.addByIndices('confirm', 'back', [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22 + ], "", 24, false); animation.play("idle"); scale.set(0.7, 0.7); diff --git a/source/funkin/mobile/ui/FunkinButton.hx b/source/funkin/mobile/ui/FunkinButton.hx index bfd61b2ed..d010462c9 100644 --- a/source/funkin/mobile/ui/FunkinButton.hx +++ b/source/funkin/mobile/ui/FunkinButton.hx @@ -28,8 +28,7 @@ enum abstract FunkinButtonStatus(Int) from Int to Int #if !display @:generic #end -@:allow(funkin.mobile.ui.FunkinHitbox) -@:allow(funkin.mobile.ui.FunkinButton) +@:allow(funkin.mobile.ui.FunkinHitbox) @:allow(funkin.mobile.ui.FunkinButton) class FunkinButton extends FunkinSprite implements IFlxInput { /** diff --git a/source/funkin/mobile/ui/FunkinHitbox.hx b/source/funkin/mobile/ui/FunkinHitbox.hx index b09e9762b..1dda6bb9c 100644 --- a/source/funkin/mobile/ui/FunkinHitbox.hx +++ b/source/funkin/mobile/ui/FunkinHitbox.hx @@ -43,8 +43,10 @@ class FunkinHint extends FunkinButton * - The second value corresponds to the alpha when the hint is not pressed. * - The third value corresponds to the duratuon it'll take to tween between the two values. */ - static final HINT_ALPHA_STYLE:Map> = [INVISIBLE_TILL_PRESS => [0.3, 0.00001, 0.01], VISIBLE_TILL_PRESS => [0.4, 0.2, 0.08]]; + static final HINT_ALPHA_STYLE:Map> = [ + INVISIBLE_TILL_PRESS => [0.3, 0.00001, 0.01], + VISIBLE_TILL_PRESS => [0.4, 0.2, 0.08] + ]; /** * Indicates whether the hint is pixel. @@ -77,7 +79,6 @@ class FunkinHint extends FunkinButton var alphaTween:Null; var followTarget:Null; - var followTargetSize:Bool = false; /** @@ -653,10 +654,42 @@ class FunkinHitbox extends FlxTypedSpriteGroup return switch (facing) { - case UP: [width / 2, 0, 0, height, width, height]; - case DOWN: [0, 0, width, 0, width / 2, height]; - case LEFT: [0, 0, width, height / 2, 0, height]; - case RIGHT: [width, 0, 0, height / 2, width, height]; + case UP: + [ + width / 2, + 0, + 0, + height, + width, + height + ]; + case DOWN: + [ + 0, + 0, + width, + 0, + width / 2, + height + ]; + case LEFT: + [ + 0, + 0, + width, + height / 2, + 0, + height + ]; + case RIGHT: + [ + width, + 0, + 0, + height / 2, + width, + height + ]; } } diff --git a/source/funkin/mobile/ui/mainmenu/FunkinOptionsButton.hx b/source/funkin/mobile/ui/mainmenu/FunkinOptionsButton.hx index 0afd570b1..32ed28441 100644 --- a/source/funkin/mobile/ui/mainmenu/FunkinOptionsButton.hx +++ b/source/funkin/mobile/ui/mainmenu/FunkinOptionsButton.hx @@ -11,9 +11,7 @@ class FunkinOptionsButton extends FunkinButton { public var onConfirmStart(default, null):FlxSignal = new FlxSignal(); public var onConfirmEnd(default, null):FlxSignal = new FlxSignal(); - public var enabled:Bool = true; - public var confirming(get, never):Bool; function get_confirming():Bool @@ -40,7 +38,21 @@ class FunkinOptionsButton extends FunkinButton frames = Paths.getSparrowAtlas("mainmenu/optionsButton"); animation.addByIndices('idle', 'options', [0], "", 24, false); animation.addByIndices('hold', 'options', [3], "", 24, false); - animation.addByIndices('confirm', 'options', [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], "", 24, false); + animation.addByIndices('confirm', 'options', [ + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16 + ], "", 24, false); animation.play("idle"); scale.set(0.7, 0.7); diff --git a/source/funkin/mobile/ui/options/ControlsSchemeMenu.hx b/source/funkin/mobile/ui/options/ControlsSchemeMenu.hx index b8a18332b..6d5af1562 100644 --- a/source/funkin/mobile/ui/options/ControlsSchemeMenu.hx +++ b/source/funkin/mobile/ui/options/ControlsSchemeMenu.hx @@ -64,7 +64,13 @@ class ControlsSchemeMenu extends MusicBeatSubState /** * An array of every single scheme. */ - final availableSchemes:Array = [FunkinHitbox.FunkinHitboxControlSchemes.Arrows, FunkinHitbox.FunkinHitboxControlSchemes.FourLanes, FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbTriangle, FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbSquare, FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbDPad]; + final availableSchemes:Array = [ + FunkinHitbox.FunkinHitboxControlSchemes.Arrows, + FunkinHitbox.FunkinHitboxControlSchemes.FourLanes, + FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbTriangle, + FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbSquare, + FunkinHitbox.FunkinHitboxControlSchemes.DoubleThumbDPad + ]; /** * Current selected index diff --git a/source/funkin/mobile/util/AdMobUtil.hx b/source/funkin/mobile/util/AdMobUtil.hx index a906b243d..fe7148af9 100644 --- a/source/funkin/mobile/util/AdMobUtil.hx +++ b/source/funkin/mobile/util/AdMobUtil.hx @@ -11,8 +11,7 @@ import funkin.play.cutscene.VideoCutscene; /** * Provides utility functions for working with admob advertisements. */ -@:build(funkin.util.macro.EnvironmentMacro.build()) -@:nullSafety +@:build(funkin.util.macro.EnvironmentMacro.build()) @:nullSafety class AdMobUtil { /** @@ -44,7 +43,6 @@ class AdMobUtil #else static final ADMOB_PUBLISHER:Null = "ca-app-pub-3940256099942544"; #end - /** * Ad unit ID for displaying banner ads. */ @@ -54,7 +52,6 @@ class AdMobUtil #else static final ADMOB_BANNER_AD_UNIT_ID:Null = #if android "9214589741" #elseif ios "2435281174" #else null #end; #end - /** * Ad unit ID for displaying interstitial ads. */ @@ -79,7 +76,10 @@ class AdMobUtil case AdmobEvent.INIT_OK: if (AdMobUtil.ADMOB_PUBLISHER != null && AdMobUtil.ADMOB_INTERSTITIAL_AD_UNIT_ID != null) { - final adUnitID:String = [AdMobUtil.ADMOB_PUBLISHER, AdMobUtil.ADMOB_INTERSTITIAL_AD_UNIT_ID].join('/'); + final adUnitID:String = [ + AdMobUtil.ADMOB_PUBLISHER, + AdMobUtil.ADMOB_INTERSTITIAL_AD_UNIT_ID + ].join('/'); Admob.startInterstitialPreloader(AdMobUtil.ADMOB_INTERSTITIAL_PRELOAD_ID, adUnitID, AdMobUtil.ADMOB_INTERSTITIAL_PRELOAD_BUFFER_SIZE); } @@ -120,7 +120,10 @@ class AdMobUtil if (AdMobUtil.ADMOB_PUBLISHER != null && AdMobUtil.ADMOB_BANNER_AD_UNIT_ID != null) { - Admob.showBanner([AdMobUtil.ADMOB_PUBLISHER, AdMobUtil.ADMOB_BANNER_AD_UNIT_ID].join('/'), size, align); + Admob.showBanner([ + AdMobUtil.ADMOB_PUBLISHER, + AdMobUtil.ADMOB_BANNER_AD_UNIT_ID + ].join('/'), size, align); } } @@ -187,7 +190,10 @@ class AdMobUtil } else { - Admob.loadInterstitial([AdMobUtil.ADMOB_PUBLISHER, AdMobUtil.ADMOB_INTERSTITIAL_AD_UNIT_ID].join('/')); + Admob.loadInterstitial([ + AdMobUtil.ADMOB_PUBLISHER, + AdMobUtil.ADMOB_INTERSTITIAL_AD_UNIT_ID + ].join('/')); } } else diff --git a/source/funkin/modding/IScriptedClass.hx b/source/funkin/modding/IScriptedClass.hx index d1162cf8f..ec5e045f3 100644 --- a/source/funkin/modding/IScriptedClass.hx +++ b/source/funkin/modding/IScriptedClass.hx @@ -10,7 +10,6 @@ import funkin.modding.events.ScriptEvent; interface IScriptedClass { public function onScriptEvent(event:ScriptEvent):Void; - public function onCreate(event:ScriptEvent):Void; public function onDestroy(event:ScriptEvent):Void; public function onUpdate(event:UpdateScriptEvent):Void; @@ -32,12 +31,10 @@ interface IStateChangingScriptedClass extends IScriptedClass { public function onStateChangeBegin(event:StateChangeScriptEvent):Void; public function onStateChangeEnd(event:StateChangeScriptEvent):Void; - public function onSubStateOpenBegin(event:SubStateScriptEvent):Void; public function onSubStateOpenEnd(event:SubStateScriptEvent):Void; public function onSubStateCloseBegin(event:SubStateScriptEvent):Void; public function onSubStateCloseEnd(event:SubStateScriptEvent):Void; - public function onFocusLost(event:FocusScriptEvent):Void; public function onFocusGained(event:FocusScriptEvent):Void; } diff --git a/source/funkin/modding/PolymodHandler.hx b/source/funkin/modding/PolymodHandler.hx index 05973d0d6..e75c3455a 100644 --- a/source/funkin/modding/PolymodHandler.hx +++ b/source/funkin/modding/PolymodHandler.hx @@ -257,7 +257,13 @@ class PolymodHandler static function buildImports():Void { // Add default imports for common classes. - static final DEFAULT_IMPORTS:Array> = [funkin.Assets, funkin.Paths, funkin.Preferences, funkin.util.Constants, flixel.FlxG]; + static final DEFAULT_IMPORTS:Array> = [ + funkin.Assets, + funkin.Paths, + funkin.Preferences, + funkin.util.Constants, + flixel.FlxG + ]; for (cls in DEFAULT_IMPORTS) { @@ -425,10 +431,14 @@ class PolymodHandler // `funkin.save.Save` // Direct access to save data is important for scripts (like checking unlocks), // but we don't want scripts to be able to perform operations like writing scores. - Polymod.blacklistInstanceFields(funkin.save.Save, [ // No direct field access + Polymod.blacklistInstanceFields(funkin.save.Save, [ + // No direct field access 'data', // LMFAO definitely not 'clearData', // No score manipulation please - 'setLevelScore', 'setSongScore', 'applySongRank']); + 'setLevelScore', + 'setSongScore', + 'applySongRank' + ]); // `openfl.filesystem.FileStream`, `openfl.net.Socket`, `openfl.utils.ByteArray.ByteArrayData` // Returns `Unseralizer.run` if encoded in HXSF format, though it does have to be seralized correctly for the exploit to work. @@ -532,7 +542,22 @@ class PolymodHandler static inline function buildFrameworkParams():polymod.Polymod.FrameworkParams { return { - assetLibraryPaths: ['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', 'sserafim' => 'sserafim'], + assetLibraryPaths: [ + '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', + 'sserafim' => 'sserafim' + ], coreAssetRedirect: CORE_FOLDER, } } @@ -573,7 +598,10 @@ class PolymodHandler */ public static function getAllModDirs():Array { - var modDirs:Array = [for (i in getAllMods()) i.dirName]; + var modDirs:Array = [ + for (i in getAllMods()) + i.dirName + ]; return modDirs; } diff --git a/source/funkin/modding/events/ScriptEventDispatcher.hx b/source/funkin/modding/events/ScriptEventDispatcher.hx index 15705c829..ab90af63f 100644 --- a/source/funkin/modding/events/ScriptEventDispatcher.hx +++ b/source/funkin/modding/events/ScriptEventDispatcher.hx @@ -92,8 +92,13 @@ class ScriptEventDispatcher else { // If the target doesn't support the event, stop trying to dispatch. - if ([ScriptEventType.DIALOGUE_START, ScriptEventType.DIALOGUE_LINE, ScriptEventType.DIALOGUE_COMPLETE_LINE, ScriptEventType.DIALOGUE_SKIP, ScriptEventType.DIALOGUE_END].contains(event.type)) - return; + if ([ + ScriptEventType.DIALOGUE_START, + ScriptEventType.DIALOGUE_LINE, + ScriptEventType.DIALOGUE_COMPLETE_LINE, + ScriptEventType.DIALOGUE_SKIP, + ScriptEventType.DIALOGUE_END + ].contains(event.type)) return; } if (Std.isOfType(target, INoteScriptedClass)) @@ -189,8 +194,20 @@ class ScriptEventDispatcher else { // If the target doesn't support the event, stop trying to dispatch. - if ([ScriptEventType.NOTE_GHOST_MISS, ScriptEventType.SONG_START, ScriptEventType.SONG_END, ScriptEventType.SONG_RETRY, ScriptEventType.GAME_OVER, ScriptEventType.PAUSE, ScriptEventType.RESUME, ScriptEventType.SONG_EVENT, ScriptEventType.COUNTDOWN_START, ScriptEventType.COUNTDOWN_STEP, ScriptEventType.COUNTDOWN_END, ScriptEventType.SONG_LOADED].contains(event.type)) - return; + if ([ + ScriptEventType.NOTE_GHOST_MISS, + ScriptEventType.SONG_START, + ScriptEventType.SONG_END, + ScriptEventType.SONG_RETRY, + ScriptEventType.GAME_OVER, + ScriptEventType.PAUSE, + ScriptEventType.RESUME, + ScriptEventType.SONG_EVENT, + ScriptEventType.COUNTDOWN_START, + ScriptEventType.COUNTDOWN_STEP, + ScriptEventType.COUNTDOWN_END, + ScriptEventType.SONG_LOADED + ].contains(event.type)) return; } if (Std.isOfType(target, IStateChangingScriptedClass)) @@ -228,8 +245,16 @@ class ScriptEventDispatcher else { // If the target doesn't support the event, stop trying to dispatch. - if ([ScriptEventType.STATE_CHANGE_BEGIN, ScriptEventType.STATE_CHANGE_END, ScriptEventType.SUBSTATE_OPEN_BEGIN, ScriptEventType.SUBSTATE_OPEN_END, ScriptEventType.SUBSTATE_CLOSE_BEGIN, ScriptEventType.SUBSTATE_CLOSE_END, ScriptEventType.FOCUS_LOST, ScriptEventType.FOCUS_GAINED].contains(event.type)) - return; + if ([ + ScriptEventType.STATE_CHANGE_BEGIN, + ScriptEventType.STATE_CHANGE_END, + ScriptEventType.SUBSTATE_OPEN_BEGIN, + ScriptEventType.SUBSTATE_OPEN_END, + ScriptEventType.SUBSTATE_CLOSE_BEGIN, + ScriptEventType.SUBSTATE_CLOSE_END, + ScriptEventType.FOCUS_LOST, + ScriptEventType.FOCUS_GAINED + ].contains(event.type)) return; } if (Std.isOfType(target, IFreeplayScriptedClass)) @@ -261,8 +286,14 @@ class ScriptEventDispatcher else { // If the target doesn't support the event, stop trying to dispatch. - if ([ScriptEventType.CAPSULE_SELECTED, ScriptEventType.DIFFICULTY_SWITCH, ScriptEventType.SONG_SELECTED, ScriptEventType.FREEPLAY_INTRO, ScriptEventType.FREEPLAY_OUTRO, ScriptEventType.FREEPLAY_CLOSE].contains(event.type)) - return; + if ([ + ScriptEventType.CAPSULE_SELECTED, + ScriptEventType.DIFFICULTY_SWITCH, + ScriptEventType.SONG_SELECTED, + ScriptEventType.FREEPLAY_INTRO, + ScriptEventType.FREEPLAY_OUTRO, + ScriptEventType.FREEPLAY_CLOSE + ].contains(event.type)) return; } if (Std.isOfType(target, ICharacterSelectScriptedClass)) @@ -285,7 +316,11 @@ class ScriptEventDispatcher else { // If the target doesn't support the event, stop trying to dispatch. - if ([ScriptEventType.CHARACTER_SELECTED, ScriptEventType.CHARACTER_DESELECTED, ScriptEventType.CHARACTER_CONFIRMED].contains(event.type)) return; + if ([ + ScriptEventType.CHARACTER_SELECTED, + ScriptEventType.CHARACTER_DESELECTED, + ScriptEventType.CHARACTER_CONFIRMED + ].contains(event.type)) return; } // If we reach this line, it means a script event was dispatched while not being properly handled. diff --git a/source/funkin/modding/events/ScriptEventType.hx b/source/funkin/modding/events/ScriptEventType.hx index 93e66853a..9f098d29f 100644 --- a/source/funkin/modding/events/ScriptEventType.hx +++ b/source/funkin/modding/events/ScriptEventType.hx @@ -357,7 +357,8 @@ enum abstract ScriptEventType(String) from String to String /** * Allow for comparing `ScriptEventType` to `String`. */ - @:op(A == B) private static inline function equals(a:ScriptEventType, b:String):Bool + @:op(A == B) + private static inline function equals(a:ScriptEventType, b:String):Bool { return (a : String) == b; } @@ -365,7 +366,8 @@ enum abstract ScriptEventType(String) from String to String /** * Allow for comparing `ScriptEventType` to `String`. */ - @:op(A != B) private static inline function notEquals(a:ScriptEventType, b:String):Bool + @:op(A != B) + private static inline function notEquals(a:ScriptEventType, b:String):Bool { return (a : String) != b; } diff --git a/source/funkin/play/GameOverSubState.hx b/source/funkin/play/GameOverSubState.hx index f002281ff..602e82f38 100644 --- a/source/funkin/play/GameOverSubState.hx +++ b/source/funkin/play/GameOverSubState.hx @@ -90,15 +90,12 @@ class GameOverSubState extends MusicBeatSubState var isStarting:Bool = true; var isChartingMode:Bool = false; - var mustNotExit:Bool = false; - var transparent:Bool; static final CAMERA_ZOOM_DURATION:Float = 0.5; var targetCameraZoom:Float = 1.0; - var canInput:Bool = false; public function new(params:GameOverParams) diff --git a/source/funkin/play/GitarooPause.hx b/source/funkin/play/GitarooPause.hx index d209b31ee..bc7aaf93e 100644 --- a/source/funkin/play/GitarooPause.hx +++ b/source/funkin/play/GitarooPause.hx @@ -15,9 +15,7 @@ class GitarooPause extends MusicBeatState { var replayButton:FlxSprite; var cancelButton:FlxSprite; - var replaySelect:Bool = false; - var previousParams:Null; public function new(?previousParams:PlayStateParams):Void diff --git a/source/funkin/play/PauseSubState.hx b/source/funkin/play/PauseSubState.hx index f78e85bf3..5f0ca2a40 100644 --- a/source/funkin/play/PauseSubState.hx +++ b/source/funkin/play/PauseSubState.hx @@ -37,7 +37,6 @@ typedef PauseSubStateParams = * Which mode to start in. Dictates what entries are displayed. */ ?mode:PauseMode, - /** * Whether the game paused because the window lost focus. */ @@ -56,50 +55,71 @@ class PauseSubState extends MusicBeatSubState /** * Pause menu entries for when the game is paused during a song. */ - static final PAUSE_MENU_ENTRIES_STANDARD:Array = [{text: 'Resume', callback: resume}, { - text: 'Restart Song', - callback: restartPlayState - }, { - text: 'Change Difficulty', - callback: switchMode.bind(_, Difficulty) - }, { - text: 'Enable Practice Mode', - callback: enablePracticeMode, - filter: () -> !(PlayState.instance?.isPracticeMode ?? false) - }, {text: 'Exit to Menu', callback: quitToMenu},]; + static final PAUSE_MENU_ENTRIES_STANDARD:Array = [ + {text: 'Resume', callback: resume}, + { + text: 'Restart Song', + callback: restartPlayState + }, + { + text: 'Change Difficulty', + callback: switchMode.bind(_, Difficulty) + }, + { + text: 'Enable Practice Mode', + callback: enablePracticeMode, + filter: () -> !(PlayState.instance?.isPracticeMode ?? false) + }, + {text: 'Exit to Menu', callback: quitToMenu}, + ]; /** * Pause menu entries for when the game is paused in the Chart Editor preview. */ - static final PAUSE_MENU_ENTRIES_CHARTING:Array = [{text: 'Resume', callback: resume}, { - text: 'Restart Song', - callback: restartPlayState - }, {text: 'Return to Chart Editor', callback: quitToChartEditor},]; + static final PAUSE_MENU_ENTRIES_CHARTING:Array = [ + {text: 'Resume', callback: resume}, + { + text: 'Restart Song', + callback: restartPlayState + }, + {text: 'Return to Chart Editor', callback: quitToChartEditor}, + ]; /** * Pause menu entries for when the user selects "Change Difficulty". */ - static final PAUSE_MENU_ENTRIES_DIFFICULTY:Array = [{ - text: 'Back', - callback: switchMode.bind(_, Standard) - } // Other entries are added dynamically. + static final PAUSE_MENU_ENTRIES_DIFFICULTY:Array = [ + { + text: 'Back', + callback: switchMode.bind(_, Standard) + } // Other entries are added dynamically. ]; /** * Pause menu entries for when the game is paused during a video cutscene. */ - static final PAUSE_MENU_ENTRIES_VIDEO_CUTSCENE:Array = [{text: 'Resume', callback: resume}, { - text: 'Skip Cutscene', - callback: skipVideoCutscene - }, {text: 'Restart Cutscene', callback: restartVideoCutscene}, {text: 'Exit to Menu', callback: quitToMenu},]; + static final PAUSE_MENU_ENTRIES_VIDEO_CUTSCENE:Array = [ + {text: 'Resume', callback: resume}, + { + text: 'Skip Cutscene', + callback: skipVideoCutscene + }, + {text: 'Restart Cutscene', callback: restartVideoCutscene}, + {text: 'Exit to Menu', callback: quitToMenu}, + ]; /** * Pause menu entries for when the game is paused during a conversation. */ - static final PAUSE_MENU_ENTRIES_CONVERSATION:Array = [{text: 'Resume', callback: resume}, { - text: 'Skip Dialogue', - callback: skipConversation - }, {text: 'Restart Dialogue', callback: restartConversation}, {text: 'Exit to Menu', callback: quitToMenu},]; + static final PAUSE_MENU_ENTRIES_CONVERSATION:Array = [ + {text: 'Resume', callback: resume}, + { + text: 'Skip Dialogue', + callback: skipConversation + }, + {text: 'Restart Dialogue', callback: restartConversation}, + {text: 'Exit to Menu', callback: quitToMenu}, + ]; /** * Duration for the music to fade in when the pause menu is opened. @@ -112,7 +132,6 @@ class PauseSubState extends MusicBeatSubState static final MUSIC_FINAL_VOLUME:Float = 0.75; static final CHARTER_FADE_DELAY:Float = 15.0; - static final CHARTER_FADE_DURATION:Float = 0.75; /** @@ -398,8 +417,35 @@ class PauseSubState extends MusicBeatSubState pauseButton = FunkinSprite.createSparrow(0, 0, "pauseButton"); pauseButton.animation.addByIndices('idle', 'pause', [0], "", 24, false); pauseButton.animation.addByIndices('hold', 'pause', [5], "", 24, false); - pauseButton.animation.addByIndices('confirm', 'pause', - [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "", 24, false); + pauseButton.animation.addByIndices('confirm', 'pause', [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32 + ], "", 24, false); pauseButton.scale.set(0.8, 0.8); pauseButton.updateHitbox(); pauseButton.animation.play("confirm"); diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 81a58397b..358e00b72 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -544,7 +544,6 @@ class PlayState extends MusicBeatSubState var discordRPCAlbum:String = ''; var discordRPCIcon:String = ''; #end - /** * RENDER OBJECTS */ @@ -732,10 +731,8 @@ class PlayState extends MusicBeatSubState static final MUSIC_EASE_RATIO:Float = 42; var mirrorSongData:Bool = false; - // TODO: Refactor or document var generatedMusic:Bool = false; - var skipEndingTransition:Bool = false; static final BACKGROUND_COLOR:FlxColor = FlxColor.BLACK; @@ -2302,8 +2299,35 @@ class PlayState extends MusicBeatSubState { pauseButton.animation.addByIndices('idle', 'back', [0], "", 24, false); pauseButton.animation.addByIndices('hold', 'back', [5], "", 24, false); - pauseButton.animation.addByIndices('confirm', 'back', - [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32], "", 24, false); + pauseButton.animation.addByIndices('confirm', 'back', [ + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32 + ], "", 24, false); pauseButton.scale.set(0.8, 0.8); pauseButton.updateHitbox(); pauseButton.animation.play("idle"); diff --git a/source/funkin/play/ResultScore.hx b/source/funkin/play/ResultScore.hx index ee445180e..ccd23d332 100644 --- a/source/funkin/play/ResultScore.hx +++ b/source/funkin/play/ResultScore.hx @@ -9,7 +9,6 @@ import flixel.tweens.FlxEase; class ResultScore extends FlxTypedSpriteGroup { public var scoreShit(default, set):Int = 0; - public var scoreStart:Int = 0; function set_scoreShit(val):Int @@ -17,7 +16,7 @@ class ResultScore extends FlxTypedSpriteGroup if (group == null || group.members == null) return val; var loopNum:Int = group.members.length - 1; var dumbNumb = Std.parseInt(Std.string(val)); - //var prevNum:ScoreNum; + // var prevNum:ScoreNum; dumbNumb = Std.int(Math.min(dumbNumb, Math.pow(10, group.members.length) - 1)); @@ -142,11 +141,22 @@ class ScoreNum extends FlxSprite public var shuffleTimer:FlxTimer; public var finalTween:FlxTween; public var finalDelay:Float = 0; - public var baseY:Float = 0; public var baseX:Float = 0; - var numToString:Array = ["ZERO", "ONE", "TWO", "THREE", "FOUR", "FIVE", "SIX", "SEVEN", "EIGHT", "NINE", "DISABLED"]; + var numToString:Array = [ + "ZERO", + "ONE", + "TWO", + "THREE", + "FOUR", + "FIVE", + "SIX", + "SEVEN", + "EIGHT", + "NINE", + "DISABLED" + ]; function finishShuffleTween():Void { diff --git a/source/funkin/play/ResultState.hx b/source/funkin/play/ResultState.hx index b747782a5..faa6b37ce 100644 --- a/source/funkin/play/ResultState.hx +++ b/source/funkin/play/ResultState.hx @@ -58,24 +58,18 @@ import funkin.util.DeviceUtil; class ResultState extends MusicBeatSubState { final params:ResultsStateParams; - final rank:ScoringRank; final songName:FlxBitmapText; final difficulty:FlxSprite; final clearPercentSmall:ClearPercentCounter; - final maskShaderSongName:LeftMaskShader = new LeftMaskShader(); final maskShaderDifficulty:LeftMaskShader = new LeftMaskShader(); - final resultsAnim:FunkinSprite; final ratingsPopin:FunkinSprite; final scorePopin:FunkinSprite; - final bgFlash:FlxSprite; - final highscoreNew:FlxSprite; final score:ResultScore; - var characterAtlasAnimations:Array< { sprite:FunkinSprite, @@ -89,10 +83,8 @@ class ResultState extends MusicBeatSubState sprite:FunkinSprite, delay:Float }> = []; - var playerCharacterId:Null = null; var playerCharacter:Null = null; - var introMusicAudio:Null = null; /** @@ -104,9 +96,7 @@ class ResultState extends MusicBeatSubState final cameraBG:FunkinCamera; final cameraScroll:FunkinCamera; final cameraEverything:FunkinCamera; - var blackTopBar:FlxSprite = new FlxSprite(); - var busy:Bool = false; public var isChartingMode(get, never):Bool; diff --git a/source/funkin/play/character/BaseCharacter.hx b/source/funkin/play/character/BaseCharacter.hx index 09751a37f..7419b152f 100644 --- a/source/funkin/play/character/BaseCharacter.hx +++ b/source/funkin/play/character/BaseCharacter.hx @@ -730,8 +730,7 @@ class BaseCharacter extends Bopper { PlayState.instance.vocals.opponentVolume = 1; } - else if (characterType != BF || characterType != DAD) - tempVocals = false; + else if (characterType != BF || characterType != DAD) tempVocals = false; } super.playAnimation(name, restart, ignoreOther, reversed); diff --git a/source/funkin/play/components/HealthIcon.hx b/source/funkin/play/components/HealthIcon.hx index e26453cd0..ad106ea8c 100644 --- a/source/funkin/play/components/HealthIcon.hx +++ b/source/funkin/play/components/HealthIcon.hx @@ -258,6 +258,7 @@ class HealthIcon extends FunkinSprite } // Apply custom icons offset after hitbox update. + override public function updateHitbox():Void { super.updateHitbox(); diff --git a/source/funkin/play/components/Subtitles.hx b/source/funkin/play/components/Subtitles.hx index afd55c70e..efb81ca2a 100644 --- a/source/funkin/play/components/Subtitles.hx +++ b/source/funkin/play/components/Subtitles.hx @@ -15,7 +15,6 @@ class Subtitles extends FlxSpriteGroup { var subtitleText:SubtitlesText; var background:FlxSprite; - var subtitlesData:Array; var assignedSound:FlxSound; diff --git a/source/funkin/play/components/TallyCounter.hx b/source/funkin/play/components/TallyCounter.hx index c5809735e..4073b6748 100644 --- a/source/funkin/play/components/TallyCounter.hx +++ b/source/funkin/play/components/TallyCounter.hx @@ -13,9 +13,7 @@ class TallyCounter extends FlxTypedSpriteGroup { public var curNumber:Float = 0; public var neededNumber:Int = 0; - public var flavour:Int = 0xFFFFFFFF; - public var align:FlxTextAlign = FlxTextAlign.LEFT; public function new(x:Float, y:Float, neededNumber:Int = 0, ?flavour:Int, align:FlxTextAlign = FlxTextAlign.LEFT) diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index e22291f99..e32526df6 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -22,15 +22,11 @@ class VideoCutscene @:noCompletion static final DEFAULT_LANGUAGE:String = 'English'; #end - static var blackScreen:FlxSprite; - static var cutsceneType:CutsceneType; - #if html5 static var vid:FlxVideo; #end - #if hxvlc static var vid:FunkinVideoSprite; #end diff --git a/source/funkin/play/cutscene/dialogue/Conversation.hx b/source/funkin/play/cutscene/dialogue/Conversation.hx index f892745ff..81d860a7d 100644 --- a/source/funkin/play/cutscene/dialogue/Conversation.hx +++ b/source/funkin/play/cutscene/dialogue/Conversation.hx @@ -86,7 +86,6 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass impl var backdrop:Null; var currentSpeaker:Null; - var currentDialogueBox:Null; public function new(id:String, ?params:Dynamic) @@ -650,6 +649,7 @@ class Conversation extends FlxSpriteGroup implements IDialogueScriptedClass impl } // Managing things with a single enum is a lot easier than a multitude of flags. + enum ConversationState { /** diff --git a/source/funkin/play/cutscene/dialogue/DialogueBox.hx b/source/funkin/play/cutscene/dialogue/DialogueBox.hx index c2f093168..f88611b45 100644 --- a/source/funkin/play/cutscene/dialogue/DialogueBox.hx +++ b/source/funkin/play/cutscene/dialogue/DialogueBox.hx @@ -71,7 +71,6 @@ class DialogueBox extends FlxSpriteGroup implements IDialogueScriptedClass imple var boxSprite:FlxSprite; var textDisplay:FunkinTypeText; - var text(default, set):String; function set_text(value:String):String @@ -289,7 +288,9 @@ class DialogueBox extends FlxSpriteGroup implements IDialogueScriptedClass imple FlxColor.fromString(_data.text.shadowColor ?? '#00000000'), false); textDisplay.borderSize = _data.text.shadowWidth ?? 2; // TODO: Add an option to configure this. - textDisplay.sounds = [FunkinSound.load(Paths.sound('pixelText'), 0.6)]; + textDisplay.sounds = [ + FunkinSound.load(Paths.sound('pixelText'), 0.6) + ]; textDisplay.completeCallback = onTypingComplete; diff --git a/source/funkin/play/event/FocusCameraSongEvent.hx b/source/funkin/play/event/FocusCameraSongEvent.hx index aa6520241..0b518e1d8 100644 --- a/source/funkin/play/event/FocusCameraSongEvent.hx +++ b/source/funkin/play/event/FocusCameraSongEvent.hx @@ -174,46 +174,69 @@ class FocusCameraSongEvent extends SongEvent */ public override function getEventSchema():SongEventSchema { - return new SongEventSchema([{ - name: "char", - title: "Target", - defaultValue: DEFAULT_TARGET, - type: SongEventFieldType.ENUM, - keys: ["Position" => -1, "Player" => 0, "Opponent" => 1, "Girlfriend" => 2] - }, { - name: "x", - title: "X Position", - defaultValue: DEFAULT_X_POSITION, - step: 10.0, - type: SongEventFieldType.FLOAT, - units: "px" - }, { - name: "y", - title: "Y Position", - defaultValue: DEFAULT_Y_POSITION, - step: 10.0, - type: SongEventFieldType.FLOAT, - units: "px" - }, { - name: 'duration', - title: 'Duration', - defaultValue: DEFAULT_DURATION, - min: 0, - step: 0.5, - type: SongEventFieldType.FLOAT, - units: 'steps' - }, { - name: 'ease', - title: 'Easing Type', - defaultValue: DEFAULT_CAMERA_EASE, - type: SongEventFieldType.ENUM, - keys: ['Linear' => 'linear', 'Instant (Ignores duration)' => 'INSTANT', 'Classic (Ignores duration)' => 'CLASSIC', 'Sine' => 'sine', 'Quad' => 'quad', 'Cube' => 'cube', 'Quart' => 'quart', 'Quint' => 'quint', 'Expo' => 'expo', 'Smooth Step' => 'smoothStep', 'Smoother Step' => 'smootherStep', 'Elastic' => 'elastic', 'Back' => 'back', 'Bounce' => 'bounce', 'Circ ' => 'circ',] - }, { - name: 'easeDir', - title: 'Easing Direction', - defaultValue: SongEvent.DEFAULT_EASE_DIR, - type: SongEventFieldType.ENUM, - keys: ['In' => 'In', 'Out' => 'Out', 'In/Out' => 'InOut'] - }]); + return new SongEventSchema([ + { + name: "char", + title: "Target", + defaultValue: DEFAULT_TARGET, + type: SongEventFieldType.ENUM, + keys: ["Position" => -1, "Player" => 0, "Opponent" => 1, "Girlfriend" => 2] + }, + { + name: "x", + title: "X Position", + defaultValue: DEFAULT_X_POSITION, + step: 10.0, + type: SongEventFieldType.FLOAT, + units: "px" + }, + { + name: "y", + title: "Y Position", + defaultValue: DEFAULT_Y_POSITION, + step: 10.0, + type: SongEventFieldType.FLOAT, + units: "px" + }, + { + name: 'duration', + title: 'Duration', + defaultValue: DEFAULT_DURATION, + min: 0, + step: 0.5, + type: SongEventFieldType.FLOAT, + units: 'steps' + }, + { + name: 'ease', + title: 'Easing Type', + defaultValue: DEFAULT_CAMERA_EASE, + type: SongEventFieldType.ENUM, + keys: [ + 'Linear' => 'linear', + 'Instant (Ignores duration)' => 'INSTANT', + 'Classic (Ignores duration)' => 'CLASSIC', + 'Sine' => 'sine', + 'Quad' => 'quad', + 'Cube' => 'cube', + 'Quart' => 'quart', + 'Quint' => 'quint', + 'Expo' => 'expo', + 'Smooth Step' => 'smoothStep', + 'Smoother Step' => 'smootherStep', + 'Elastic' => 'elastic', + 'Back' => 'back', + 'Bounce' => 'bounce', + 'Circ ' => 'circ', + ] + }, + { + name: 'easeDir', + title: 'Easing Direction', + defaultValue: SongEvent.DEFAULT_EASE_DIR, + type: SongEventFieldType.ENUM, + keys: ['In' => 'In', 'Out' => 'Out', 'In/Out' => 'InOut'] + } + ]); } } diff --git a/source/funkin/play/event/PlayAnimationSongEvent.hx b/source/funkin/play/event/PlayAnimationSongEvent.hx index 83a006653..319fbed5c 100644 --- a/source/funkin/play/event/PlayAnimationSongEvent.hx +++ b/source/funkin/play/event/PlayAnimationSongEvent.hx @@ -91,21 +91,25 @@ class PlayAnimationSongEvent extends SongEvent */ public override function getEventSchema():SongEventSchema { - return new SongEventSchema([{ - name: 'target', - title: 'Target', - type: SongEventFieldType.STRING, - defaultValue: DEFAULT_TARGET, - }, { - name: 'anim', - title: 'Animation', - type: SongEventFieldType.STRING, - defaultValue: DEFAULT_ANIM, - }, { - name: 'force', - title: 'Force', - type: SongEventFieldType.BOOL, - defaultValue: DEFAULT_FORCE - }]); + return new SongEventSchema([ + { + name: 'target', + title: 'Target', + type: SongEventFieldType.STRING, + defaultValue: DEFAULT_TARGET, + }, + { + name: 'anim', + title: 'Animation', + type: SongEventFieldType.STRING, + defaultValue: DEFAULT_ANIM, + }, + { + name: 'force', + title: 'Force', + type: SongEventFieldType.BOOL, + defaultValue: DEFAULT_FORCE + } + ]); } } diff --git a/source/funkin/play/event/ScrollSpeedEvent.hx b/source/funkin/play/event/ScrollSpeedEvent.hx index cbb9b6d46..ee66b2ff2 100644 --- a/source/funkin/play/event/ScrollSpeedEvent.hx +++ b/source/funkin/play/event/ScrollSpeedEvent.hx @@ -110,51 +110,75 @@ class ScrollSpeedEvent extends SongEvent */ public override function getEventSchema():SongEventSchema { - return new SongEventSchema([{ - name: 'scroll', - title: 'Target Value', - defaultValue: DEFAULT_SCROLL, - min: 0.1, - step: 0.1, - type: SongEventFieldType.FLOAT, - units: 'x' - }, { - name: 'duration', - title: 'Duration', - defaultValue: DEFAULT_DURATION, - min: 0, - step: 0.5, - type: SongEventFieldType.FLOAT, - units: 'steps' - }, { - name: 'ease', - title: 'Easing Type', - defaultValue: SongEvent.DEFAULT_EASE, - type: SongEventFieldType.ENUM, - keys: ['Linear' => 'linear', 'Instant (Ignores duration)' => 'INSTANT', 'Sine' => 'sine', 'Quad' => 'quad', 'Cube' => 'cube', 'Quart' => 'quart', 'Quint' => 'quint', 'Expo' => 'expo', 'Smooth Step' => 'smoothStep', 'Smoother Step' => 'smootherStep', 'Elastic' => 'elastic', 'Back' => 'back', 'Bounce' => 'bounce', 'Circ ' => 'circ',] - }, { - name: 'easeDir', - title: 'Easing Direction', - defaultValue: SongEvent.DEFAULT_EASE_DIR, - type: SongEventFieldType.ENUM, - keys: ['In' => 'In', 'Out' => 'Out', 'In/Out' => 'InOut'] - }, { - name: 'advanced', - title: 'Advanced', - type: SongEventFieldType.FRAME, - collapsible: true, - children: [{ - name: 'strumline', - title: 'Target Strumline', - defaultValue: DEFAULT_STRUMLINE, + return new SongEventSchema([ + { + name: 'scroll', + title: 'Target Value', + defaultValue: DEFAULT_SCROLL, + min: 0.1, + step: 0.1, + type: SongEventFieldType.FLOAT, + units: 'x' + }, + { + name: 'duration', + title: 'Duration', + defaultValue: DEFAULT_DURATION, + min: 0, + step: 0.5, + type: SongEventFieldType.FLOAT, + units: 'steps' + }, + { + name: 'ease', + title: 'Easing Type', + defaultValue: SongEvent.DEFAULT_EASE, type: SongEventFieldType.ENUM, - keys: ['Both' => 'both', 'Player' => 'player', 'Opponent' => 'opponent'] - }, { - name: 'absolute', - title: 'Absolute', - defaultValue: DEFAULT_ABSOLUTE, - type: SongEventFieldType.BOOL, - }] - }]); + keys: [ + 'Linear' => 'linear', + 'Instant (Ignores duration)' => 'INSTANT', + 'Sine' => 'sine', + 'Quad' => 'quad', + 'Cube' => 'cube', + 'Quart' => 'quart', + 'Quint' => 'quint', + 'Expo' => 'expo', + 'Smooth Step' => 'smoothStep', + 'Smoother Step' => 'smootherStep', + 'Elastic' => 'elastic', + 'Back' => 'back', + 'Bounce' => 'bounce', + 'Circ ' => 'circ', + ] + }, + { + name: 'easeDir', + title: 'Easing Direction', + defaultValue: SongEvent.DEFAULT_EASE_DIR, + type: SongEventFieldType.ENUM, + keys: ['In' => 'In', 'Out' => 'Out', 'In/Out' => 'InOut'] + }, + { + name: 'advanced', + title: 'Advanced', + type: SongEventFieldType.FRAME, + collapsible: true, + children: [ + { + name: 'strumline', + title: 'Target Strumline', + defaultValue: DEFAULT_STRUMLINE, + type: SongEventFieldType.ENUM, + keys: ['Both' => 'both', 'Player' => 'player', 'Opponent' => 'opponent'] + }, + { + name: 'absolute', + title: 'Absolute', + defaultValue: DEFAULT_ABSOLUTE, + type: SongEventFieldType.BOOL, + } + ] + } + ]); } } diff --git a/source/funkin/play/event/SetCameraBopSongEvent.hx b/source/funkin/play/event/SetCameraBopSongEvent.hx index aedad7b2b..a88a6b344 100644 --- a/source/funkin/play/event/SetCameraBopSongEvent.hx +++ b/source/funkin/play/event/SetCameraBopSongEvent.hx @@ -69,29 +69,33 @@ class SetCameraBopSongEvent extends SongEvent */ public override function getEventSchema():SongEventSchema { - return new SongEventSchema([{ - name: 'intensity', - title: 'Intensity', - defaultValue: Constants.DEFAULT_BOP_INTENSITY, - min: 0, - step: 0.1, - type: SongEventFieldType.FLOAT, - units: 'x' - }, { - name: 'offset', - title: 'Offset', - defaultValue: Constants.DEFAULT_ZOOM_OFFSET, - step: 0.25, - type: SongEventFieldType.FLOAT, - units: 'beats' - }, { - name: 'rate', - title: 'Rate', - defaultValue: Constants.DEFAULT_ZOOM_RATE, - min: 0, - step: 0.25, - type: SongEventFieldType.FLOAT, - units: 'beats/zoom' - }]); + return new SongEventSchema([ + { + name: 'intensity', + title: 'Intensity', + defaultValue: Constants.DEFAULT_BOP_INTENSITY, + min: 0, + step: 0.1, + type: SongEventFieldType.FLOAT, + units: 'x' + }, + { + name: 'offset', + title: 'Offset', + defaultValue: Constants.DEFAULT_ZOOM_OFFSET, + step: 0.25, + type: SongEventFieldType.FLOAT, + units: 'beats' + }, + { + name: 'rate', + title: 'Rate', + defaultValue: Constants.DEFAULT_ZOOM_RATE, + min: 0, + step: 0.25, + type: SongEventFieldType.FLOAT, + units: 'beats/zoom' + } + ]); } } diff --git a/source/funkin/play/event/SetHealthIconSongEvent.hx b/source/funkin/play/event/SetHealthIconSongEvent.hx index a5731978b..e94fc219b 100644 --- a/source/funkin/play/event/SetHealthIconSongEvent.hx +++ b/source/funkin/play/event/SetHealthIconSongEvent.hx @@ -39,7 +39,6 @@ class SetHealthIconSongEvent extends SongEvent static final DEFAULT_FLIPX:Bool = false; static final DEFAULT_ISPIXEL:Bool = false; static final DEFAULT_SHOULDBOP:Bool = true; - static final DEFAULT_X_OFFSET:Float = 0.0; static final DEFAULT_Y_OFFSET:Float = 0.0; @@ -51,7 +50,10 @@ class SetHealthIconSongEvent extends SongEvent // Works even if we are minimal mode. // if (PlayState.instance.isMinimalMode) return; - var offsets:Array = [data.value.offsetX ?? DEFAULT_X_OFFSET, data.value.offsetY ?? DEFAULT_Y_OFFSET]; + var offsets:Array = [ + data.value.offsetX ?? DEFAULT_X_OFFSET, + data.value.offsetY ?? DEFAULT_Y_OFFSET + ]; var healthIconData:HealthIconData = { id: data.value.id ?? Constants.DEFAULT_HEALTH_ICON, @@ -88,54 +90,65 @@ class SetHealthIconSongEvent extends SongEvent public override function getEventSchema():SongEventSchema { - return new SongEventSchema([{ - name: 'char', - title: 'Character', - defaultValue: DEFAULT_CHAR, - type: SongEventFieldType.ENUM, - keys: ['Player' => 0, 'Opponent' => 1], - }, { - name: 'id', - title: 'Health Icon ID', - defaultValue: Constants.DEFAULT_HEALTH_ICON, - type: SongEventFieldType.STRING, - }, { - name: 'shouldBop', - title: 'Should Bop?', - defaultValue: DEFAULT_SHOULDBOP, - type: SongEventFieldType.BOOL, - }, { - name: 'scale', - title: 'Scale', - defaultValue: DEFAULT_SCALE, - min: 0, - type: SongEventFieldType.FLOAT, - }, { - name: 'flipX', - title: 'Flip X?', - defaultValue: DEFAULT_FLIPX, - type: SongEventFieldType.BOOL, - }, { - name: 'advanced', - title: 'Advanced', - type: SongEventFieldType.FRAME, - collapsible: true, - children: [{ - name: 'isPixel', - title: 'Is Pixel?', - defaultValue: DEFAULT_ISPIXEL, + return new SongEventSchema([ + { + name: 'char', + title: 'Character', + defaultValue: DEFAULT_CHAR, + type: SongEventFieldType.ENUM, + keys: ['Player' => 0, 'Opponent' => 1], + }, + { + name: 'id', + title: 'Health Icon ID', + defaultValue: Constants.DEFAULT_HEALTH_ICON, + type: SongEventFieldType.STRING, + }, + { + name: 'shouldBop', + title: 'Should Bop?', + defaultValue: DEFAULT_SHOULDBOP, type: SongEventFieldType.BOOL, - }, { - name: 'offsetX', - title: 'X Offset', - defaultValue: DEFAULT_X_OFFSET, + }, + { + name: 'scale', + title: 'Scale', + defaultValue: DEFAULT_SCALE, + min: 0, type: SongEventFieldType.FLOAT, - }, { - name: 'offsetY', - title: 'Y Offset', - defaultValue: DEFAULT_Y_OFFSET, - type: SongEventFieldType.FLOAT, - }] - }]); + }, + { + name: 'flipX', + title: 'Flip X?', + defaultValue: DEFAULT_FLIPX, + type: SongEventFieldType.BOOL, + }, + { + name: 'advanced', + title: 'Advanced', + type: SongEventFieldType.FRAME, + collapsible: true, + children: [ + { + name: 'isPixel', + title: 'Is Pixel?', + defaultValue: DEFAULT_ISPIXEL, + type: SongEventFieldType.BOOL, + }, + { + name: 'offsetX', + title: 'X Offset', + defaultValue: DEFAULT_X_OFFSET, + type: SongEventFieldType.FLOAT, + }, + { + name: 'offsetY', + title: 'Y Offset', + defaultValue: DEFAULT_Y_OFFSET, + type: SongEventFieldType.FLOAT, + } + ] + } + ]); } } diff --git a/source/funkin/play/event/SetTargetBopSpeedEvent.hx b/source/funkin/play/event/SetTargetBopSpeedEvent.hx index cac7c7435..1f59c22ef 100644 --- a/source/funkin/play/event/SetTargetBopSpeedEvent.hx +++ b/source/funkin/play/event/SetTargetBopSpeedEvent.hx @@ -87,19 +87,22 @@ class SetTargetBopSpeedSongEvent extends SongEvent */ public override function getEventSchema():SongEventSchema { - return new SongEventSchema([{ - name: 'target', - title: 'Target', - type: SongEventFieldType.STRING, - defaultValue: DEFAULT_TARGET, - }, { - name: 'rate', - title: 'Rate', - defaultValue: Constants.DEFAULT_PROP_RATE, - min: 0, - step: 0.25, - type: SongEventFieldType.FLOAT, - units: 'beats/dance' - }]); + return new SongEventSchema([ + { + name: 'target', + title: 'Target', + type: SongEventFieldType.STRING, + defaultValue: DEFAULT_TARGET, + }, + { + name: 'rate', + title: 'Rate', + defaultValue: Constants.DEFAULT_PROP_RATE, + min: 0, + step: 0.25, + type: SongEventFieldType.FLOAT, + units: 'beats/dance' + } + ]); } } diff --git a/source/funkin/play/event/SongEventHelper.hx b/source/funkin/play/event/SongEventHelper.hx index 4bccb4464..cb7d728a3 100644 --- a/source/funkin/play/event/SongEventHelper.hx +++ b/source/funkin/play/event/SongEventHelper.hx @@ -8,7 +8,20 @@ class SongEventHelper { public static var EASE_CANVAS_SIZE:Int = 200; public static var easeBitmapMap:Map = new Map(); - public static var easeDirList:Array = ["sine", "quad", "cube", "quart", "quint", "expo", "smoothStep", "smootherStep", "elastic", "back", "bounce", "circ"]; + public static var easeDirList:Array = [ + "sine", + "quad", + "cube", + "quart", + "quint", + "expo", + "smoothStep", + "smootherStep", + "elastic", + "back", + "bounce", + "circ" + ]; public static var easeDirs:Array = ["In", "Out", "InOut"]; public static var easeDotCache:Map> = new Map>(); @@ -53,7 +66,8 @@ class SongEventHelper return easeBitmapMap.get(key); } - static function getEaseRange(func:Dynamic, samples:Int):{min:Float, max:Float} + static function getEaseRange(func:Dynamic, samples:Int): + {min:Float, max:Float} { if (func == null || samples <= 0) return {min: 0.0, max: 1.0}; @@ -84,13 +98,13 @@ class SongEventHelper return {min: min, max: max}; } - static function getEaseY(raw:Float, size:Int, range:{min:Float, max:Float}):Int + static function getEaseY(raw:Float, size:Int, range: + {min:Float, max:Float}):Int { var v:Float = raw; var span = range.max - range.min; - if (span > 0) - v = (raw - range.min) / span; + if (span > 0) v = (raw - range.min) / span; v = if (v < 0) 0 else if (v > 1) 1 else v; return Std.int((1 - v) * (size - 1)); diff --git a/source/funkin/play/event/ZoomCameraSongEvent.hx b/source/funkin/play/event/ZoomCameraSongEvent.hx index 282caa09c..a678715d2 100644 --- a/source/funkin/play/event/ZoomCameraSongEvent.hx +++ b/source/funkin/play/event/ZoomCameraSongEvent.hx @@ -101,62 +101,87 @@ class ZoomCameraSongEvent extends SongEvent */ public override function getEventSchema():SongEventSchema { - return new SongEventSchema([{ - name: 'zoom', - title: 'Zoom Level', - defaultValue: DEFAULT_ZOOM, - min: 0, - step: 0.05, - type: SongEventFieldType.FLOAT, - units: 'x' - }, { - name: 'duration', - title: 'Duration', - defaultValue: DEFAULT_DURATION, - min: 0, - step: 0.5, - type: SongEventFieldType.FLOAT, - units: 'steps' - }, { - name: 'ease', - title: 'Easing Type', - defaultValue: SongEvent.DEFAULT_EASE, - type: SongEventFieldType.ENUM, - keys: ['Linear' => 'linear', 'Instant (Ignores duration)' => 'INSTANT', 'Sine' => 'sine', 'Quad' => 'quad', 'Cube' => 'cube', 'Quart' => 'quart', 'Quint' => 'quint', 'Expo' => 'expo', 'Smooth Step' => 'smoothStep', 'Smoother Step' => 'smootherStep', 'Elastic' => 'elastic', 'Back' => 'back', 'Bounce' => 'bounce', 'Circ ' => 'circ',] - }, { - name: 'easeDir', - title: 'Easing Direction', - defaultValue: SongEvent.DEFAULT_EASE_DIR, - type: SongEventFieldType.ENUM, - keys: ['In' => 'In', 'Out' => 'Out', 'In/Out' => 'InOut'] - }, { - name: 'advanced', - title: 'Advanced', - type: SongEventFieldType.FRAME, - collapsible: true, - children: [{ - name: 'mode', - title: 'Mode', - defaultValue: DEFAULT_MODE, + return new SongEventSchema([ + { + name: 'zoom', + title: 'Zoom Level', + defaultValue: DEFAULT_ZOOM, + min: 0, + step: 0.05, + type: SongEventFieldType.FLOAT, + units: 'x' + }, + { + name: 'duration', + title: 'Duration', + defaultValue: DEFAULT_DURATION, + min: 0, + step: 0.5, + type: SongEventFieldType.FLOAT, + units: 'steps' + }, + { + name: 'ease', + title: 'Easing Type', + defaultValue: SongEvent.DEFAULT_EASE, type: SongEventFieldType.ENUM, - keys: ['Stage zoom' => 'stage', 'Absolute zoom' => 'direct'] - }, { - name: 'widescreenScaleX', - title: 'Widescreen Scale X', - defaultValue: DEFAULT_WIDESCREEN_SCALE, - min: 0, - max: 1, - type: SongEventFieldType.FLOAT, - units: 'x' - }, { - name: 'widescreenScaleY', - title: 'Widescreen Scale Y', - defaultValue: DEFAULT_WIDESCREEN_SCALE, - min: 0, - max: 1, - type: SongEventFieldType.FLOAT, - units: 'x' - }] - }]); + keys: [ + 'Linear' => 'linear', + 'Instant (Ignores duration)' => 'INSTANT', + 'Sine' => 'sine', + 'Quad' => 'quad', + 'Cube' => 'cube', + 'Quart' => 'quart', + 'Quint' => 'quint', + 'Expo' => 'expo', + 'Smooth Step' => 'smoothStep', + 'Smoother Step' => 'smootherStep', + 'Elastic' => 'elastic', + 'Back' => 'back', + 'Bounce' => 'bounce', + 'Circ ' => 'circ', + ] + }, + { + name: 'easeDir', + title: 'Easing Direction', + defaultValue: SongEvent.DEFAULT_EASE_DIR, + type: SongEventFieldType.ENUM, + keys: ['In' => 'In', 'Out' => 'Out', 'In/Out' => 'InOut'] + }, + { + name: 'advanced', + title: 'Advanced', + type: SongEventFieldType.FRAME, + collapsible: true, + children: [ + { + name: 'mode', + title: 'Mode', + defaultValue: DEFAULT_MODE, + type: SongEventFieldType.ENUM, + keys: ['Stage zoom' => 'stage', 'Absolute zoom' => 'direct'] + }, + { + name: 'widescreenScaleX', + title: 'Widescreen Scale X', + defaultValue: DEFAULT_WIDESCREEN_SCALE, + min: 0, + max: 1, + type: SongEventFieldType.FLOAT, + units: 'x' + }, + { + name: 'widescreenScaleY', + title: 'Widescreen Scale Y', + defaultValue: DEFAULT_WIDESCREEN_SCALE, + min: 0, + max: 1, + type: SongEventFieldType.FLOAT, + units: 'x' + } + ] + } + ]); } } diff --git a/source/funkin/play/notes/NoteDirection.hx b/source/funkin/play/notes/NoteDirection.hx index c937916f1..9e06a2f17 100644 --- a/source/funkin/play/notes/NoteDirection.hx +++ b/source/funkin/play/notes/NoteDirection.hx @@ -22,11 +22,16 @@ enum abstract NoteDirection(Int) from Int to Int { return switch (value % 4) { - case 0: LEFT; - case 1: DOWN; - case 2: UP; - case 3: RIGHT; - default: LEFT; + case 0: + LEFT; + case 1: + DOWN; + case 2: + UP; + case 3: + RIGHT; + default: + LEFT; } } diff --git a/source/funkin/play/notes/NoteHoldCover.hx b/source/funkin/play/notes/NoteHoldCover.hx index 032cfea17..5f1c63e86 100644 --- a/source/funkin/play/notes/NoteHoldCover.hx +++ b/source/funkin/play/notes/NoteHoldCover.hx @@ -11,7 +11,6 @@ class NoteHoldCover extends FlxTypedSpriteGroup static final FRAMERATE_DEFAULT:Int = 24; public var holdNote:SustainTrail; - public var glow:FlxSprite; var sparks:FlxSprite; diff --git a/source/funkin/play/notes/Strumline.hx b/source/funkin/play/notes/Strumline.hx index dfcbbc8bf..6f827560b 100644 --- a/source/funkin/play/notes/Strumline.hx +++ b/source/funkin/play/notes/Strumline.hx @@ -44,7 +44,6 @@ class Strumline extends FlxSpriteGroup // Positional fixes for new strumline graphics. static final INITIAL_OFFSET:Float = -0.275 * STRUMLINE_SIZE; static final NUDGE:Float = 2.0; - public static final KEY_COUNT:Int = 4; static final NOTE_SPLASH_CAP:Int = 6; @@ -153,9 +152,7 @@ class Strumline extends FlxSpriteGroup var notesVwoosh:FlxTypedSpriteGroup; var holdNotesVwoosh:FlxTypedSpriteGroup; - final noteStyle:NoteStyle; - var noteSpacingScale:Float = 1; /** @@ -1353,14 +1350,16 @@ class Strumline extends FlxSpriteGroup #end return switch (direction) { - case NoteDirection.LEFT: -pos * 2; + case NoteDirection.LEFT: + -pos * 2; case NoteDirection.DOWN: -(pos * 2) + (1 * Strumline.NOTE_SPACING) * (noteSpacingScale * strumlineScale.x); case NoteDirection.UP: pos + (2 * Strumline.NOTE_SPACING) * (noteSpacingScale * strumlineScale.x); case NoteDirection.RIGHT: pos + (3 * Strumline.NOTE_SPACING) * (noteSpacingScale * strumlineScale.x); - default: -pos * 2; + default: + -pos * 2; } } diff --git a/source/funkin/play/notes/SustainTrail.hx b/source/funkin/play/notes/SustainTrail.hx index 187dccee8..067270724 100644 --- a/source/funkin/play/notes/SustainTrail.hx +++ b/source/funkin/play/notes/SustainTrail.hx @@ -23,14 +23,26 @@ class SustainTrail extends FlxSprite * `top left, top right, bottom left` * `top left, bottom left, bottom right` */ - static final TRIANGLE_VERTEX_INDICES:Array = [0, 1, 2, 1, 2, 3, 4, 5, 6, 5, 6, 7]; + static final TRIANGLE_VERTEX_INDICES:Array = [ + 0, + 1, + 2, + 1, + 2, + 3, + 4, + 5, + 6, + 5, + 6, + 7 + ]; public var strumTime:Float = 0; // millis public var noteDirection:NoteDirection = 0; public var sustainLength(default, set):Float = 0; // millis public var fullSustainLength:Float = 0; public var parentStrumline:Strumline; - public var cover:NoteHoldCover = null; /** diff --git a/source/funkin/play/notes/notekind/NoteKind.hx b/source/funkin/play/notes/notekind/NoteKind.hx index c0e49976c..59e365ddb 100644 --- a/source/funkin/play/notes/notekind/NoteKind.hx +++ b/source/funkin/play/notes/notekind/NoteKind.hx @@ -128,9 +128,7 @@ class NoteKind implements INoteScriptedClass abstract NoteKindParamType(String) from String to String { public static final STRING:String = 'String'; - public static final INT:String = 'Int'; - public static final FLOAT:String = 'Float'; } @@ -140,22 +138,18 @@ typedef NoteKindParamData = * If `min` is null, there is no minimum */ ?min:Null, - /** * If `max` is null, there is no maximum */ ?max:Null, - /** * If `step` is null, it will use 1.0 */ ?step:Null, - /** * If `precision` is null, there will be 0 decimal places */ ?precision:Null, - ?defaultValue:Dynamic } diff --git a/source/funkin/play/notes/notestyle/NoteStyle.hx b/source/funkin/play/notes/notestyle/NoteStyle.hx index 2118f43ce..8e5a1da64 100644 --- a/source/funkin/play/notes/notestyle/NoteStyle.hx +++ b/source/funkin/play/notes/notestyle/NoteStyle.hx @@ -192,10 +192,14 @@ class NoteStyle implements IRegistryEntry { var result:Null = switch (dir) { - case LEFT: _data.assets?.note?.data?.left?.toNamed(); - case DOWN: _data.assets?.note?.data?.down?.toNamed(); - case UP: _data.assets?.note?.data?.up?.toNamed(); - case RIGHT: _data.assets?.note?.data?.right?.toNamed(); + case LEFT: + _data.assets?.note?.data?.left?.toNamed(); + case DOWN: + _data.assets?.note?.data?.down?.toNamed(); + case UP: + _data.assets?.note?.data?.up?.toNamed(); + case RIGHT: + _data.assets?.note?.data?.right?.toNamed(); }; return result ?? fallback?.fetchNoteAnimationData(dir); @@ -279,11 +283,35 @@ class NoteStyle implements IRegistryEntry var result:Array> = switch (dir) { case NoteDirection.LEFT: - [_data.assets.noteStrumline?.data?.leftStatic?.toNamed('static'), _data.assets.noteStrumline?.data?.leftPress?.toNamed('press'), _data.assets.noteStrumline?.data?.leftConfirm?.toNamed('confirm'), _data.assets.noteStrumline?.data?.leftConfirmHold?.toNamed('confirm-hold'),]; - case NoteDirection.DOWN: [_data.assets.noteStrumline?.data?.downStatic?.toNamed('static'), _data.assets.noteStrumline?.data?.downPress?.toNamed('press'), _data.assets.noteStrumline?.data?.downConfirm?.toNamed('confirm'), _data.assets.noteStrumline?.data?.downConfirmHold?.toNamed('confirm-hold'),]; - case NoteDirection.UP: [_data.assets.noteStrumline?.data?.upStatic?.toNamed('static'), _data.assets.noteStrumline?.data?.upPress?.toNamed('press'), _data.assets.noteStrumline?.data?.upConfirm?.toNamed('confirm'), _data.assets.noteStrumline?.data?.upConfirmHold?.toNamed('confirm-hold'),]; - case NoteDirection.RIGHT: [_data.assets.noteStrumline?.data?.rightStatic?.toNamed('static'), _data.assets.noteStrumline?.data?.rightPress?.toNamed('press'), _data.assets.noteStrumline?.data?.rightConfirm?.toNamed('confirm'), _data.assets.noteStrumline?.data?.rightConfirmHold?.toNamed('confirm-hold'),]; - default: []; + [ + _data.assets.noteStrumline?.data?.leftStatic?.toNamed('static'), + _data.assets.noteStrumline?.data?.leftPress?.toNamed('press'), + _data.assets.noteStrumline?.data?.leftConfirm?.toNamed('confirm'), + _data.assets.noteStrumline?.data?.leftConfirmHold?.toNamed('confirm-hold'), + ]; + case NoteDirection.DOWN: + [ + _data.assets.noteStrumline?.data?.downStatic?.toNamed('static'), + _data.assets.noteStrumline?.data?.downPress?.toNamed('press'), + _data.assets.noteStrumline?.data?.downConfirm?.toNamed('confirm'), + _data.assets.noteStrumline?.data?.downConfirmHold?.toNamed('confirm-hold'), + ]; + case NoteDirection.UP: + [ + _data.assets.noteStrumline?.data?.upStatic?.toNamed('static'), + _data.assets.noteStrumline?.data?.upPress?.toNamed('press'), + _data.assets.noteStrumline?.data?.upConfirm?.toNamed('confirm'), + _data.assets.noteStrumline?.data?.upConfirmHold?.toNamed('confirm-hold'), + ]; + case NoteDirection.RIGHT: + [ + _data.assets.noteStrumline?.data?.rightStatic?.toNamed('static'), + _data.assets.noteStrumline?.data?.rightPress?.toNamed('press'), + _data.assets.noteStrumline?.data?.rightConfirm?.toNamed('confirm'), + _data.assets.noteStrumline?.data?.rightConfirmHold?.toNamed('confirm-hold'), + ]; + default: + []; }; // New variable so we can change the type. @@ -952,10 +980,14 @@ class NoteStyle implements IRegistryEntry { var result:Null> = switch (dir) { - case LEFT: _data.assets?.noteSplash?.data?.leftSplashes?.toNamedArray("splashLEFT"); - case DOWN: _data.assets?.noteSplash?.data?.downSplashes?.toNamedArray("splashDOWN"); - case UP: _data.assets?.noteSplash?.data?.upSplashes?.toNamedArray("splashUP"); - case RIGHT: _data.assets?.noteSplash?.data?.rightSplashes?.toNamedArray("splashRIGHT"); + case LEFT: + _data.assets?.noteSplash?.data?.leftSplashes?.toNamedArray("splashLEFT"); + case DOWN: + _data.assets?.noteSplash?.data?.downSplashes?.toNamedArray("splashDOWN"); + case UP: + _data.assets?.noteSplash?.data?.upSplashes?.toNamedArray("splashUP"); + case RIGHT: + _data.assets?.noteSplash?.data?.rightSplashes?.toNamedArray("splashRIGHT"); }; return result ?? fallback?.fetchSplashAnimationData(dir); } @@ -1020,10 +1052,14 @@ class NoteStyle implements IRegistryEntry { var directionData = switch (direction) { - case LEFT: _data.assets?.holdNoteCover?.data?.left; - case DOWN: _data.assets?.holdNoteCover?.data?.down; - case UP: _data.assets?.holdNoteCover?.data?.up; - case RIGHT: _data.assets?.holdNoteCover?.data?.right; + case LEFT: + _data.assets?.holdNoteCover?.data?.left; + case DOWN: + _data.assets?.holdNoteCover?.data?.down; + case UP: + _data.assets?.holdNoteCover?.data?.up; + case RIGHT: + _data.assets?.holdNoteCover?.data?.right; }; if (directionData == null) return null; @@ -1067,11 +1103,32 @@ class NoteStyle implements IRegistryEntry var noteColor:String = dir.colorName.toTitleCase(); var result:Array> = switch (dir) { - case LEFT: [_data.assets?.holdNoteCover?.data?.left?.start?.toNamed('holdCoverStart$noteColor'), _data.assets?.holdNoteCover?.data?.left?.hold?.toNamed('holdCover$noteColor'), _data.assets?.holdNoteCover?.data?.left?.end?.toNamed('holdCoverEnd$noteColor'),]; - case DOWN: [_data.assets?.holdNoteCover?.data?.down?.start?.toNamed('holdCoverStart$noteColor'), _data.assets?.holdNoteCover?.data?.down?.hold?.toNamed('holdCover$noteColor'), _data.assets?.holdNoteCover?.data?.down?.end?.toNamed('holdCoverEnd$noteColor'),]; - case UP: [_data.assets?.holdNoteCover?.data?.up?.start?.toNamed('holdCoverStart$noteColor'), _data.assets?.holdNoteCover?.data?.up?.hold?.toNamed('holdCover$noteColor'), _data.assets?.holdNoteCover?.data?.up?.end?.toNamed('holdCoverEnd$noteColor'),]; - case RIGHT: [_data.assets?.holdNoteCover?.data?.right?.start?.toNamed('holdCoverStart$noteColor'), _data.assets?.holdNoteCover?.data?.right?.hold?.toNamed('holdCover$noteColor'), _data.assets?.holdNoteCover?.data?.right?.end?.toNamed('holdCoverEnd$noteColor'),]; - default: []; + case LEFT: + [ + _data.assets?.holdNoteCover?.data?.left?.start?.toNamed('holdCoverStart$noteColor'), + _data.assets?.holdNoteCover?.data?.left?.hold?.toNamed('holdCover$noteColor'), + _data.assets?.holdNoteCover?.data?.left?.end?.toNamed('holdCoverEnd$noteColor'), + ]; + case DOWN: + [ + _data.assets?.holdNoteCover?.data?.down?.start?.toNamed('holdCoverStart$noteColor'), + _data.assets?.holdNoteCover?.data?.down?.hold?.toNamed('holdCover$noteColor'), + _data.assets?.holdNoteCover?.data?.down?.end?.toNamed('holdCoverEnd$noteColor'), + ]; + case UP: + [ + _data.assets?.holdNoteCover?.data?.up?.start?.toNamed('holdCoverStart$noteColor'), + _data.assets?.holdNoteCover?.data?.up?.hold?.toNamed('holdCover$noteColor'), + _data.assets?.holdNoteCover?.data?.up?.end?.toNamed('holdCoverEnd$noteColor'), + ]; + case RIGHT: + [ + _data.assets?.holdNoteCover?.data?.right?.start?.toNamed('holdCoverStart$noteColor'), + _data.assets?.holdNoteCover?.data?.right?.hold?.toNamed('holdCover$noteColor'), + _data.assets?.holdNoteCover?.data?.right?.end?.toNamed('holdCoverEnd$noteColor'), + ]; + default: + []; }; // New variable so we can change the type. @@ -1085,6 +1142,7 @@ class NoteStyle implements IRegistryEntry // fallbacks: // assetPath for a direction -> root assetpath -> fallback assetpath for direction -> fallback root assetpath // `direction` here is required, however it only is used for fallback purposes + function getHoldCoverRootAssetPath(direction:NoteDirection, raw:Bool = false):Null { if (raw) @@ -1108,10 +1166,14 @@ class NoteStyle implements IRegistryEntry { var rawPath:Null = switch (direction) { - case LEFT: _data?.assets?.holdNoteCover?.data?.left?.assetPath; - case DOWN: _data?.assets?.holdNoteCover?.data?.down?.assetPath; - case UP: _data?.assets?.holdNoteCover?.data?.up?.assetPath; - case RIGHT: _data?.assets?.holdNoteCover?.data?.right?.assetPath; + case LEFT: + _data?.assets?.holdNoteCover?.data?.left?.assetPath; + case DOWN: + _data?.assets?.holdNoteCover?.data?.down?.assetPath; + case UP: + _data?.assets?.holdNoteCover?.data?.up?.assetPath; + case RIGHT: + _data?.assets?.holdNoteCover?.data?.right?.assetPath; }; // we don't want to fallback directly just yet, we want to check our root assetpath first diff --git a/source/funkin/play/scoring/Scoring.hx b/source/funkin/play/scoring/Scoring.hx index 01f4104f1..01aa548ba 100644 --- a/source/funkin/play/scoring/Scoring.hx +++ b/source/funkin/play/scoring/Scoring.hx @@ -42,9 +42,12 @@ class Scoring { return switch (scoringSystem) { - case LEGACY: scoreNoteLEGACY(msTiming); - case WEEK7: scoreNoteWEEK7(msTiming); - case PBOT1: scoreNotePBOT1(msTiming); + case LEGACY: + scoreNoteLEGACY(msTiming); + case WEEK7: + scoreNoteWEEK7(msTiming); + case PBOT1: + scoreNotePBOT1(msTiming); default: FlxG.log.error('Unknown scoring system: ${scoringSystem}'); 0; @@ -61,9 +64,12 @@ class Scoring { return switch (scoringSystem) { - case LEGACY: judgeNoteLEGACY(msTiming); - case WEEK7: judgeNoteWEEK7(msTiming); - case PBOT1: judgeNotePBOT1(msTiming); + case LEGACY: + judgeNoteLEGACY(msTiming); + case WEEK7: + judgeNoteWEEK7(msTiming); + case PBOT1: + judgeNotePBOT1(msTiming); default: FlxG.log.error('Unknown scoring system: ${scoringSystem}'); 'miss'; @@ -74,9 +80,12 @@ class Scoring { return switch (scoringSystem) { - case LEGACY: LEGACY_MISS_SCORE; - case WEEK7: WEEK7_MISS_SCORE; - case PBOT1: PBOT1_MISS_SCORE; + case LEGACY: + LEGACY_MISS_SCORE; + case WEEK7: + WEEK7_MISS_SCORE; + case PBOT1: + PBOT1_MISS_SCORE; default: FlxG.log.error('Unknown scoring system: ${scoringSystem}'); 0; @@ -461,7 +470,8 @@ enum abstract ScoringRank(String) } // Yes, we really need a different function for each comparison operator. - @:op(A > B) static function compareGT(a:Null, b:Null):Bool + @:op(A > B) + static function compareGT(a:Null, b:Null):Bool { if (a != null && b == null) return true; if (a == null || b == null) return false; @@ -473,7 +483,8 @@ enum abstract ScoringRank(String) } // Greater than or equal to comparison - @:op(A >= B) static function compareGTEQ(a:Null, b:Null):Bool + @:op(A >= B) + static function compareGTEQ(a:Null, b:Null):Bool { if (a != null && b == null) return true; if (a == null || b == null) return false; @@ -485,7 +496,8 @@ enum abstract ScoringRank(String) } // Less than comparison - @:op(A < B) static function compareLT(a:Null, b:Null):Bool + @:op(A < B) + static function compareLT(a:Null, b:Null):Bool { if (a != null && b == null) return true; if (a == null || b == null) return false; @@ -497,7 +509,8 @@ enum abstract ScoringRank(String) } // Less than or equal to comparison - @:op(A <= B) static function compareLTEQ(a:Null, b:Null):Bool + @:op(A <= B) + static function compareLTEQ(a:Null, b:Null):Bool { if (a != null && b == null) return true; if (a == null || b == null) return false; diff --git a/source/funkin/play/song/Song.hx b/source/funkin/play/song/Song.hx index 83b068d63..671574ec4 100644 --- a/source/funkin/play/song/Song.hx +++ b/source/funkin/play/song/Song.hx @@ -85,6 +85,7 @@ class Song implements IPlayStateScriptedClass implements IRegistryEntry _data]; + _metadata = _data == null ? [] : [ + Constants.DEFAULT_VARIATION => _data + ]; if (_data != null && _data.playData != null) { @@ -781,15 +784,11 @@ class SongDifficulty public var looped:Bool = false; public var offsets:SongOffsets = new SongOffsets(); public var generatedBy:String = SongRegistry.DEFAULT_GENERATEDBY; - public var timeChanges:Array = []; - public var stage:String = Constants.DEFAULT_STAGE; public var noteStyle:String = Constants.DEFAULT_NOTE_STYLE; public var characters:SongCharacterData = null; - public var scrollSpeed:Float = Constants.DEFAULT_SCROLLSPEED; - public var difficultyRating:Int = 0; public var album:Null = null; public var stickerPack:Null = null; diff --git a/source/funkin/play/stage/Bopper.hx b/source/funkin/play/stage/Bopper.hx index a797a0e59..c5f9b5d0f 100644 --- a/source/funkin/play/stage/Bopper.hx +++ b/source/funkin/play/stage/Bopper.hx @@ -248,7 +248,6 @@ class Bopper extends StageProp implements IPlayStateScriptedClass } public var canPlayOtherAnims:Bool = true; - public var ignoreExclusionPref:Array = []; /** @@ -332,6 +331,7 @@ class Bopper extends StageProp implements IPlayStateScriptedClass } // override getScreenPosition (used by FlxSprite's draw method) to account for animation offsets. + override function getScreenPosition(?result:FlxPoint, ?camera:FlxCamera):FlxPoint { var output:FlxPoint = super.getScreenPosition(result, camera); diff --git a/source/funkin/save/Save.hx b/source/funkin/save/Save.hx index 8e1152e66..85958e1b0 100644 --- a/source/funkin/save/Save.hx +++ b/source/funkin/save/Save.hx @@ -21,13 +21,11 @@ import funkin.api.newgrounds.Medals; import funkin.api.newgrounds.Leaderboards; #end -@:nullSafety -@:build(funkin.util.macro.SaveMacro.buildSaveProperties()) +@:nullSafety @:build(funkin.util.macro.SaveMacro.buildSaveProperties()) class Save implements ConsoleClass { public static final SAVE_DATA_VERSION:thx.semver.Version = "2.1.1"; public static final SAVE_DATA_VERSION_RULE:thx.semver.VersionRule = ">=2.1.0 <2.2.0"; - public static var system:SaveSystem = new SaveSystem(); /** @@ -246,64 +244,45 @@ class Save implements ConsoleClass /// @:saveProperty(data.mods.enabledMods) public var enabledModDirs:SaveProperty>; - /// /// CHART EDITOR OPTIONS /// @:saveProperty(data.optionsChartEditor.previousFiles, []) public var chartEditorPreviousFiles:SaveProperty>; - @:saveProperty(data.optionsChartEditor.hasBackup, false) public var chartEditorHasBackup:SaveProperty; - @:saveProperty(data.optionsChartEditor.noteQuant, 3) public var chartEditorNoteQuant:SaveProperty; - @:saveProperty(data.optionsChartEditor.chartEditorLiveInputStyle, ChartEditorLiveInputStyle.None) public var chartEditorLiveInputStyle:SaveProperty; - @:saveProperty(data.optionsChartEditor.downscroll, false) public var chartEditorDownscroll:SaveProperty; - @:saveProperty(data.optionsChartEditor.showNoteKinds, true) public var chartEditorShowNoteKinds:SaveProperty; - @:saveProperty(data.optionsChartEditor.showSubtitles, true) public var chartEditorShowSubtitles:SaveProperty; - @:saveProperty(data.optionsChartEditor.playtestStartTime, false) public var chartEditorPlaytestStartTime:SaveProperty; - @:saveProperty(data.optionsChartEditor.playtestAudioSettings, false) public var chartEditorPlaytestAudioSettings:SaveProperty; - @:saveProperty(data.optionsChartEditor.playtestResultsSettings, false) public var chartEditorPlaytestResultsSettings:SaveProperty; - @:saveProperty(data.optionsChartEditor.theme, ChartEditorTheme.Light) public var chartEditorTheme:SaveProperty; - @:saveProperty(data.optionsChartEditor.metronomeVolume, 1.0) public var chartEditorMetronomeVolume:SaveProperty; - @:saveProperty(data.optionsChartEditor.hitsoundVolumePlayer, 1.0) public var chartEditorHitsoundVolumePlayer:SaveProperty; - @:saveProperty(data.optionsChartEditor.hitsoundVolumeOpponent, 1.0) public var chartEditorHitsoundVolumeOpponent:SaveProperty; - @:saveProperty(data.optionsChartEditor.instVolume, 1.0) public var chartEditorInstVolume:SaveProperty; - @:saveProperty(data.optionsChartEditor.playerVoiceVolume, 1.0) public var chartEditorPlayerVoiceVolume:SaveProperty; - @:saveProperty(data.optionsChartEditor.opponentVoiceVolume, 1.0) public var chartEditorOpponentVoiceVolume:SaveProperty; - @:saveProperty(data.optionsChartEditor.themeMusic, true) public var chartEditorThemeMusic:SaveProperty; - @:saveProperty(data.optionsChartEditor.playbackSpeed, 0.5) public var chartEditorPlaybackSpeed:SaveProperty; @@ -332,7 +311,6 @@ class Save implements ConsoleClass public var stageEditorAngleStep:SaveProperty; @:saveProperty(data.optionsStageEditor.theme, StageEditorTheme.Light) public var stageEditorTheme:SaveProperty; - public var stageBoyfriendChar(get, set):String; function get_stageBoyfriendChar():String diff --git a/source/funkin/save/SaveProperty.hx b/source/funkin/save/SaveProperty.hx index 5c788e074..395772643 100644 --- a/source/funkin/save/SaveProperty.hx +++ b/source/funkin/save/SaveProperty.hx @@ -11,7 +11,6 @@ class SaveProperty var _autoFlush:Bool; public var onChange(default, null):FlxTypedSignalVoid>; - public var value(get, set):T; function get_value():T diff --git a/source/funkin/save/migrator/RawSaveData_v1_0_0.hx b/source/funkin/save/migrator/RawSaveData_v1_0_0.hx index a516f944a..98aec8907 100644 --- a/source/funkin/save/migrator/RawSaveData_v1_0_0.hx +++ b/source/funkin/save/migrator/RawSaveData_v1_0_0.hx @@ -7,13 +7,9 @@ typedef RawSaveData_v1_0_0 = var seenVideo:Bool; var mute:Bool; var volume:Float; - var sessionId:String; - var songCompletion:Map; - var songScores:Map; - var ?controls: { ?p1:SavePlayerControlsData_v1_0_0, diff --git a/source/funkin/ui/AtlasText.hx b/source/funkin/ui/AtlasText.hx index f6cc326af..87381a00d 100644 --- a/source/funkin/ui/AtlasText.hx +++ b/source/funkin/ui/AtlasText.hx @@ -89,9 +89,12 @@ class AtlasText extends FlxTypedSpriteGroup { return switch (caseAllowed) { - case Both: str; - case Upper: str.toUpperCase(); - case Lower: str.toLowerCase(); + case Both: + str; + case Upper: + str.toUpperCase(); + case Lower: + str.toLowerCase(); } } @@ -166,7 +169,11 @@ class AtlasText extends FlxTypedSpriteGroup override function toString():String { - return "InputItem, " + FlxStringUtil.getDebugString([LabelValuePair.weak("x", x), LabelValuePair.weak("y", y), LabelValuePair.weak("text", text)]); + return "InputItem, " + FlxStringUtil.getDebugString([ + LabelValuePair.weak("x", x), + LabelValuePair.weak("y", y), + LabelValuePair.weak("text", text) + ]); } } @@ -200,30 +207,52 @@ class AtlasChar extends FlxSprite { return switch (char) { - case '&': return '-andpersand-'; - case "😠": '-angry faic-'; // TODO: Do multi-flag characters work? - case "'": '-apostraphie-'; - case "\\": '-back slash-'; - case ",": '-comma-'; - case '-': '-dash-'; - case '↓': '-down arrow-'; // U+2193 - case "”": '-end quote-'; // U+0022 - case "!": '-exclamation point-'; // U+0021 - case "/": '-forward slash-'; // U+002F - case '>': '-greater than-'; // U+003E - case '♥': '-heart-'; // U+2665 - case '♡': '-heart-'; - case '←': '-left arrow-'; // U+2190 - case '<': '-less than-'; // U+003C - case "*": '-multiply x-'; - case '.': '-period-'; // U+002E - case "?": '-question mark-'; - case '→': '-right arrow-'; // U+2192 - case "“": '-start quote-'; - case '↑': '-up arrow-'; // U+2191 + case '&': + return '-andpersand-'; + case "😠": + '-angry faic-'; // TODO: Do multi-flag characters work? + case "'": + '-apostraphie-'; + case "\\": + '-back slash-'; + case ",": + '-comma-'; + case '-': + '-dash-'; + case '↓': + '-down arrow-'; // U+2193 + case "”": + '-end quote-'; // U+0022 + case "!": + '-exclamation point-'; // U+0021 + case "/": + '-forward slash-'; // U+002F + case '>': + '-greater than-'; // U+003E + case '♥': + '-heart-'; // U+2665 + case '♡': + '-heart-'; + case '←': + '-left arrow-'; // U+2190 + case '<': + '-less than-'; // U+003C + case "*": + '-multiply x-'; + case '.': + '-period-'; // U+002E + case "?": + '-question mark-'; + case '→': + '-right arrow-'; // U+2192 + case "“": + '-start quote-'; + case '↑': + '-up arrow-'; // U+2191 // Default to getting the character itself. - default: char; + default: + char; } } } diff --git a/source/funkin/ui/FullScreenScaleMode.hx b/source/funkin/ui/FullScreenScaleMode.hx index 03d24ad6c..c640beea7 100644 --- a/source/funkin/ui/FullScreenScaleMode.hx +++ b/source/funkin/ui/FullScreenScaleMode.hx @@ -97,13 +97,10 @@ class FullScreenScaleMode extends flixel.system.scaleModes.BaseScaleMode @:noCompletion private static var cutoutBitmaps:Array = [null, null]; - @:noCompletion private static var mustAwait:Bool = false; - @:noCompletion private static var awaitedSize:FlxPoint = FlxPoint.get(0, 0); - @:noCompletion private static var finishingAwait:Bool = false; diff --git a/source/funkin/ui/MenuList.hx b/source/funkin/ui/MenuList.hx index d09d3ccde..b35382785 100644 --- a/source/funkin/ui/MenuList.hx +++ b/source/funkin/ui/MenuList.hx @@ -67,9 +67,12 @@ class MenuTypedList extends FlxTypedGroup { this.wrapMode = switch (navControls) { - case Horizontal: Horizontal; - case Vertical: Vertical; - default: Both; + case Horizontal: + Horizontal; + case Vertical: + Vertical; + default: + Both; } } @@ -123,12 +126,17 @@ class MenuTypedList extends FlxTypedGroup // Keepin' these for keyboard/controller support on mobile platforms newIndex = switch (navControls) { - case Vertical: navList(inputUp, inputDown, wrapY); - case Horizontal: navList(inputLeft, inputRight, wrapX); - case Both: navList(inputLeft || inputUp, inputRight || inputDown, !wrapMode.match(None)); + case Vertical: + navList(inputUp, inputDown, wrapY); + case Horizontal: + navList(inputLeft, inputRight, wrapX); + case Both: + navList(inputLeft || inputUp, inputRight || inputDown, !wrapMode.match(None)); - case Columns(num): navGrid(num, inputLeft, inputRight, wrapX, inputUp, inputDown, wrapY); - case Rows(num): navGrid(num, inputUp, inputDown, wrapY, inputLeft, inputRight, wrapX); + case Columns(num): + navGrid(num, inputLeft, inputRight, wrapX, inputUp, inputDown, wrapY); + case Rows(num): + navGrid(num, inputUp, inputDown, wrapY, inputLeft, inputRight, wrapX); }; #if FEATURE_TOUCH_CONTROLS diff --git a/source/funkin/ui/MusicBeatState.hx b/source/funkin/ui/MusicBeatState.hx index f365321bd..0ff0a3634 100644 --- a/source/funkin/ui/MusicBeatState.hx +++ b/source/funkin/ui/MusicBeatState.hx @@ -37,7 +37,6 @@ class MusicBeatState extends FlxTransitionableState implements IEventHandler public var leftWatermarkText:Null = null; public var rightWatermarkText:Null = null; - public var conductorInUse(get, set):Conductor; var _conductorInUse:Null; @@ -117,6 +116,7 @@ class MusicBeatState extends FlxTransitionableState implements IEventHandler } // this should get moved post ui update but this is easier rn lolll + public function addOptionsButton(?xPos:Float = 0, ?yPos:Float = 0, ?confirmCallback:Void->Void = null, ?instant:Bool = false):Void { if (optionsButton != null) remove(optionsButton); diff --git a/source/funkin/ui/MusicBeatSubState.hx b/source/funkin/ui/MusicBeatSubState.hx index 0e263b1d5..bd51fe377 100644 --- a/source/funkin/ui/MusicBeatSubState.hx +++ b/source/funkin/ui/MusicBeatSubState.hx @@ -29,7 +29,6 @@ class MusicBeatSubState extends FlxSubState implements IEventHandler { public var leftWatermarkText:Null = null; public var rightWatermarkText:Null = null; - public var conductorInUse(get, set):Conductor; var _conductorInUse:Null; diff --git a/source/funkin/ui/Page.hx b/source/funkin/ui/Page.hx index 9e20b60d0..118eadcb0 100644 --- a/source/funkin/ui/Page.hx +++ b/source/funkin/ui/Page.hx @@ -16,10 +16,8 @@ class Page extends FlxGroup { public var onSwitch(default, null) = new FlxTypedSignalVoid>(); public var onExit(default, null) = new FlxSignal(); - public var enabled(default, set) = true; public var canExit = true; - public var codex:Codex; var controls(get, never):Controls; diff --git a/source/funkin/ui/UIStateMachine.hx b/source/funkin/ui/UIStateMachine.hx index 48d59cf35..3d2cf0607 100644 --- a/source/funkin/ui/UIStateMachine.hx +++ b/source/funkin/ui/UIStateMachine.hx @@ -33,7 +33,26 @@ class UIStateMachine public function new(?transitions:Map>) { // Default valid transitions if none provided - validTransitions = transitions != null ? transitions : [Idle => [Interacting, EnteringMainMenu, EnteringFreeplay, Exiting, Disabled], EnteringMainMenu => [Idle, Exiting, Disabled, Interacting], Interacting => [Idle, EnteringMainMenu, EnteringFreeplay, Exiting, Disabled], Exiting => [Idle], Disabled => [Idle], EnteringFreeplay => [Idle]]; + validTransitions = transitions != null ? transitions : [ + Idle => [ + Interacting, + EnteringMainMenu, + EnteringFreeplay, + Exiting, + Disabled + ], + EnteringMainMenu => [Idle, Exiting, Disabled, Interacting], + Interacting => [ + Idle, + EnteringMainMenu, + EnteringFreeplay, + Exiting, + Disabled + ], + Exiting => [Idle], + Disabled => [Idle], + EnteringFreeplay => [Idle] + ]; } public function canTransition(from:UIState, to:UIState):Bool diff --git a/source/funkin/ui/charSelect/CharSelectCursors.hx b/source/funkin/ui/charSelect/CharSelectCursors.hx index 8ac51107f..5a1b85ea8 100644 --- a/source/funkin/ui/charSelect/CharSelectCursors.hx +++ b/source/funkin/ui/charSelect/CharSelectCursors.hx @@ -17,7 +17,6 @@ class CharSelectCursors extends FlxTypedSpriteContainer var lightBlue:FunkinSprite; var darkBlue:FunkinSprite; - var cursorConfirmed:FunkinSprite; var cursorDenied:FunkinSprite; diff --git a/source/funkin/ui/charSelect/CharSelectGF.hx b/source/funkin/ui/charSelect/CharSelectGF.hx index 7ce827d4d..7e015aafe 100644 --- a/source/funkin/ui/charSelect/CharSelectGF.hx +++ b/source/funkin/ui/charSelect/CharSelectGF.hx @@ -13,10 +13,8 @@ class CharSelectGF extends FunkinSprite implements IBPMSyncedScriptedClass { var analyzer:Null; var analyzerLevelsCache:Array = new Array(); - var currentGFPath:String = ""; var enableVisualizer:Bool = false; - var danceEvery:Int = 2; public function new(x:Float, y:Float) diff --git a/source/funkin/ui/charSelect/CharSelectPlayer.hx b/source/funkin/ui/charSelect/CharSelectPlayer.hx index 68f3a5cb6..e1b8a0369 100644 --- a/source/funkin/ui/charSelect/CharSelectPlayer.hx +++ b/source/funkin/ui/charSelect/CharSelectPlayer.hx @@ -11,7 +11,6 @@ class CharSelectPlayer extends FunkinSprite implements IBPMSyncedScriptedClass var initialX:Float = 0; var initialY:Float = 0; - var currentBFPath:Null; public function new(x:Float, y:Float) @@ -45,7 +44,6 @@ class CharSelectPlayer extends FunkinSprite implements IBPMSyncedScriptedClass case "slidein idle point", "cannot select Label", "unlock": anim.play("idle", true); case "idle": - // TODO: once char select data is refactored, add a `shouldBop` field or something IDK if (currentBFPath != null) { diff --git a/source/funkin/ui/charSelect/CharSelectSubState.hx b/source/funkin/ui/charSelect/CharSelectSubState.hx index 466030aca..806b72e85 100644 --- a/source/funkin/ui/charSelect/CharSelectSubState.hx +++ b/source/funkin/ui/charSelect/CharSelectSubState.hx @@ -49,14 +49,12 @@ class CharSelectSubState extends MusicBeatSubState final DEFAULT_CURSOR_INDEX:Int = 4; var cursors:CharSelectCursors; - var cursorX:Int = 0; var cursorY:Int = 0; var cursorFactor:Float = 110; var cursorOffsetX:Float = -16; var cursorOffsetY:Float = -48; var cursorLocIntended:FlxPoint = new FlxPoint(0, 0); - var playerChill:CharSelectPlayer; var playerChillOut:CharSelectPlayer; var gfChill:CharSelectGF; @@ -74,23 +72,19 @@ class CharSelectSubState extends MusicBeatSubState var pressedSelect:Bool = false; var selectTimer:FlxTimer = new FlxTimer(); var allowInput:Bool = false; - var selectSound:FunkinSound = new FunkinSound(); var unlockSound:FunkinSound = new FunkinSound(); var lockedSound:FunkinSound = new FunkinSound(); var introSound:FunkinSound = new FunkinSound(); var staticSound:FunkinSound = new FunkinSound(); - - var selectedBizz:Array = [new DropShadowFilter(0, 0, 0xFFFFFF, 1, 2, 2, 19, 1, false, false, - false), new DropShadowFilter(5, 45, 0x000000, 1, 2, 2, 1, 1, false, false, false)]; - + var selectedBizz:Array = [ + new DropShadowFilter(0, 0, 0xFFFFFF, 1, 2, 2, 19, 1, false, false, false), + new DropShadowFilter(5, 45, 0x000000, 1, 2, 2, 1, 1, false, false, false) + ]; var bopInfo:Null>; - // var blackScreen:FunkinSprite; var charHitbox:FlxObject = new FlxObject(); - var cutoutSize:Float = 0; - var fadeShader:BlueFade = new BlueFade(); public function new(?params:CharSelectSubStateParams) @@ -300,7 +294,13 @@ class CharSelectSubState extends MusicBeatSubState nametag.scrollFactor.set(); - FlxG.debugger.addTrackerProfile(new TrackerProfile(FunkinSprite, ["x", "y", "alpha", "scale", "blend"])); + FlxG.debugger.addTrackerProfile(new TrackerProfile(FunkinSprite, [ + "x", + "y", + "alpha", + "scale", + "blend" + ])); FlxG.debugger.addTrackerProfile(new TrackerProfile(FlxSound, ["pitch", "volume"])); add(cursors); @@ -726,10 +726,8 @@ class CharSelectSubState extends MusicBeatSubState var holdTmrRight:Float = 0; var spamDirections:FlxDirectionFlags = NONE; var initSpam = 0.5; - var mobileDeny:Bool = false; var mobileAccept:Bool = false; - var wentBackToFreeplay:Bool = false; override public function update(elapsed:Float):Void diff --git a/source/funkin/ui/charSelect/IntroSubState.hx b/source/funkin/ui/charSelect/IntroSubState.hx index 528126d40..1a068535e 100644 --- a/source/funkin/ui/charSelect/IntroSubState.hx +++ b/source/funkin/ui/charSelect/IntroSubState.hx @@ -18,7 +18,6 @@ class IntroSubState extends MusicBeatSubState #if html5 static final LIGHTS_VIDEO_PATH:String = Paths.stripLibrary(Paths.videos('introSelect')); #end - #if hxvlc static final LIGHTS_VIDEO_PATH:String = Paths.videos('introSelect'); #end diff --git a/source/funkin/ui/charSelect/Nametag.hx b/source/funkin/ui/charSelect/Nametag.hx index 5a58f03d6..4c6069dfb 100644 --- a/source/funkin/ui/charSelect/Nametag.hx +++ b/source/funkin/ui/charSelect/Nametag.hx @@ -13,7 +13,6 @@ class Nametag extends FlxSprite @:allow(funkin.ui.charSelect.CharSelectSubState) var midpointY(default, set):Float = 100; var mosaicShader:MosaicEffect; - var currentMosaicSequence:Null; public function new(?x:Float = 0, ?y:Float = 0, character:String) @@ -83,26 +82,35 @@ class Nametag extends FlxSprite if (fadeOut) { - currentMosaicSequence = new Sequence([{ - time: 0 / 30, - callback: () -> mosaicShader.setBlockSize(1, 1) - }, { - time: 1 / 30, - callback: () -> mosaicShader.setBlockSize(width / 27, height / 26) - }, { - time: 2 / 30, - callback: () -> mosaicShader.setBlockSize(width / 10, height / 10) - }, {time: 3 / 30, callback: () -> mosaicShader.setBlockSize(1, 1)},]); + currentMosaicSequence = new Sequence([ + { + time: 0 / 30, + callback: () -> mosaicShader.setBlockSize(1, 1) + }, + { + time: 1 / 30, + callback: () -> mosaicShader.setBlockSize(width / 27, height / 26) + }, + { + time: 2 / 30, + callback: () -> mosaicShader.setBlockSize(width / 10, height / 10) + }, + {time: 3 / 30, callback: () -> mosaicShader.setBlockSize(1, 1)}, + ]); } else { - currentMosaicSequence = new Sequence([{ - time: 0 / 30, - callback: () -> mosaicShader.setBlockSize(width / 10, height / 10) - }, { - time: 1 / 30, - callback: () -> mosaicShader.setBlockSize(width / 73, height / 6) - }, {time: 2 / 30, callback: () -> mosaicShader.setBlockSize(width / 10, height / 10)},]); + currentMosaicSequence = new Sequence([ + { + time: 0 / 30, + callback: () -> mosaicShader.setBlockSize(width / 10, height / 10) + }, + { + time: 1 / 30, + callback: () -> mosaicShader.setBlockSize(width / 73, height / 6) + }, + {time: 2 / 30, callback: () -> mosaicShader.setBlockSize(width / 10, height / 10)}, + ]); } } diff --git a/source/funkin/ui/credits/CreditsData.hx b/source/funkin/ui/credits/CreditsData.hx index bf7f13ad5..f5f291eaa 100644 --- a/source/funkin/ui/credits/CreditsData.hx +++ b/source/funkin/ui/credits/CreditsData.hx @@ -15,13 +15,9 @@ typedef CreditsDataRole = { @:optional var header:String; - - @:optional - @:default([]) + @:optional @:default([]) var body:Array; - - @:optional - @:default(false) + @:optional @:default(false) var appendBackers:Bool; } diff --git a/source/funkin/ui/credits/CreditsDataHandler.hx b/source/funkin/ui/credits/CreditsDataHandler.hx index 39f2c3cd2..fe58bff97 100644 --- a/source/funkin/ui/credits/CreditsDataHandler.hx +++ b/source/funkin/ui/credits/CreditsDataHandler.hx @@ -9,7 +9,6 @@ using StringTools; class CreditsDataHandler { public static final BACKER_PUBLIC_URL:String = 'https://funkin.me/backers'; - #if HARDCODED_CREDITS static final CREDITS_DATA_PATH:String = "assets/exclude/data/credits.json"; #else @@ -51,10 +50,12 @@ class CreditsDataHandler public static inline function getFallback():CreditsData { return { - entries: [{ - header: 'Founders', - body: [{line: 'ninjamuffin99'}, {line: 'PhantomArcade'}, {line: 'Kawai Sprite'}, {line: 'evilsk8r'},] - }] + entries: [ + { + header: 'Founders', + body: [{line: 'ninjamuffin99'}, {line: 'PhantomArcade'}, {line: 'Kawai Sprite'}, {line: 'evilsk8r'},] + } + ] }; } diff --git a/source/funkin/ui/credits/CreditsState.hx b/source/funkin/ui/credits/CreditsState.hx index 5f74ac1c4..85b0b2ca1 100644 --- a/source/funkin/ui/credits/CreditsState.hx +++ b/source/funkin/ui/credits/CreditsState.hx @@ -83,7 +83,6 @@ class CreditsState extends MusicBeatState var creditsGroup:FlxSpriteGroup; var scrollPaused:Bool = false; - var backersToBuild:Array; var entriesToBuild:Array; diff --git a/source/funkin/ui/debug/FunkinDebugDisplay.hx b/source/funkin/ui/debug/FunkinDebugDisplay.hx index 316a22148..2edeb0842 100644 --- a/source/funkin/ui/debug/FunkinDebugDisplay.hx +++ b/source/funkin/ui/debug/FunkinDebugDisplay.hx @@ -32,20 +32,16 @@ class FunkinDebugDisplay extends Sprite var deltaTimeout:Float; var times:Array; var color:Int; - var fps:Int; var fpsPeak:Int; var gcMem:Float; var gcMemPeak:Float; var taskMem:Float; var taskMemPeak:Float; - var background:Shape; - var fpsGraph:FunkinStatsGraph; var gcMemGraph:FunkinStatsGraph; var taskMemGraph:FunkinStatsGraph; - var infoDisplay:TextField; public function new(x:Float = 10, y:Float = 10, color:Int = 0x000000):Void @@ -290,6 +286,7 @@ class FunkinDebugDisplay extends Sprite // Note: the string values here are deduced // so we dont need to do `Off = 'Off'` or nothin // https://haxe.org/manual/types-abstract-enum.html + enum abstract DebugDisplayMode(String) from String to String { /** diff --git a/source/funkin/ui/debug/WaveformTestState.hx b/source/funkin/ui/debug/WaveformTestState.hx index fb5817bce..e7b203bbd 100644 --- a/source/funkin/ui/debug/WaveformTestState.hx +++ b/source/funkin/ui/debug/WaveformTestState.hx @@ -17,13 +17,10 @@ class WaveformTestState extends MusicBeatState var waveformData:WaveformData; var waveformData2:WaveformData; - var waveformAudio:FunkinSound; - // var waveformSprite:WaveformSprite; // var waveformSprite2:WaveformSprite; var timeMarker:FlxSprite; - var polygonSprite:MeshRender; var vertexCount:Int = 3; diff --git a/source/funkin/ui/debug/anim/DebugBoundingState.hx b/source/funkin/ui/debug/anim/DebugBoundingState.hx index 9452dbfd4..bb096ef93 100644 --- a/source/funkin/ui/debug/anim/DebugBoundingState.hx +++ b/source/funkin/ui/debug/anim/DebugBoundingState.hx @@ -39,25 +39,17 @@ class DebugBoundingState extends FlxState - Cleaner UI */ var bg:FlxBackdrop; - var txtGrp:FlxTypedGroup; - var hudCam:FlxCamera; - var curView:ANIMDEBUGVIEW = SPRITESHEET; - var spriteSheetView:FlxGroup; var offsetView:FlxGroup; var dropDownSetup:Bool = false; - var onionSkinChar:BaseCharacter; var txtOffsetShit:FlxText; - var offsetEditorDialog:CollapsibleDialog; var offsetAnimationDropdown:DropDown; - var haxeUIFocused(get, default):Bool = false; - var currentAnimationName(get, never):String; function get_currentAnimationName():String @@ -238,7 +230,10 @@ class DebugBoundingState extends FlxState if (FlxG.mouse.pressed) { - swagChar.animOffsets = [(FlxG.mouse.x - mouseOffset.x) * -1, (FlxG.mouse.y - mouseOffset.y) * -1]; + swagChar.animOffsets = [ + (FlxG.mouse.x - mouseOffset.x) * -1, + (FlxG.mouse.y - mouseOffset.y) * -1 + ]; swagChar.animationOffsets.set(swagChar.getCurrentAnimation(), swagChar.animOffsets); @@ -431,7 +426,8 @@ class DebugBoundingState extends FlxState if (FlxG.keys.justPressed.SPACE) { if (swagChar?.hasAnimation('danceLeft')) offsetAnimationDropdown.value = {id: 'danceLeft', text: 'danceLeft'}; - else offsetAnimationDropdown.value = {id: 'idle', text: 'idle'}; + else + offsetAnimationDropdown.value = {id: 'idle', text: 'idle'}; playCharacterAnimation(currentAnimationName, true); } diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 98f2a7667..3ddd92a34 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -149,10 +149,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState public static final CHART_EDITOR_TOOLBOX_EVENT_DATA_LAYOUT:String = Paths.ui('chart-editor/toolbox/event-data'); public static final CHART_EDITOR_TOOLBOX_FREEPLAY_LAYOUT:String = Paths.ui('chart-editor/toolbox/freeplay'); public static final CHART_EDITOR_TOOLBOX_PLAYTEST_PROPERTIES_LAYOUT:String = Paths.ui('chart-editor/toolbox/playtest-properties'); - // Validation public static final SUPPORTED_MUSIC_FORMATS:Array = #if sys ['ogg'] #else ['mp3'] #end; - // Layout /** @@ -227,7 +225,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState public static final PLAYHEAD_SCROLL_AREA_COLOR:FlxColor = 0xFF682B2F; public static final SPECTROGRAM_COLOR:FlxColor = 0xFFFF0000; public static final PLAYHEAD_COLOR:FlxColor = 0xC0BD0231; - // Timings /** @@ -250,7 +247,19 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState /** * Precisions of notes you can snap to. */ - public static final SNAP_QUANTS:Array = [4, 8, 12, 16, 20, 24, 32, 48, 64, 96, 192]; + public static final SNAP_QUANTS:Array = [ + 4, + 8, + 12, + 16, + 20, + 24, + 32, + 48, + 64, + 96, + 192 + ]; /** * The default note snapping value. @@ -265,13 +274,17 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState /** * A map of the keys for every live input style. */ - public static final LIVE_INPUT_KEYS:Map> = [NumberKeys => [ - FIVE, SIX, SEVEN, EIGHT, - ONE, TWO, THREE, FOUR - ], WASDKeys => [ - LEFT, DOWN, UP, RIGHT, - A, S, W, D - ], None => []]; + public static final LIVE_INPUT_KEYS:Map> = [ + NumberKeys => [ + FIVE, SIX, SEVEN, EIGHT, + ONE, TWO, THREE, FOUR + ], + WASDKeys => [ + LEFT, DOWN, UP, RIGHT, + A, S, W, D + ], + None => [] + ]; /** * INSTANCE DATA @@ -282,7 +295,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState /** * The length of the current instrumental, in milliseconds. */ - @:isVar var songLengthInMs(get, set):Float = 0; + @:isVar + var songLengthInMs(get, set):Float = 0; function get_songLengthInMs():Float { @@ -775,7 +789,14 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState * The audio volume before it was toggled to zero. * Metronome, hitsounds (player and enemy), instrumental, vocals (player and enemy) */ - var previousAudioVolumes:Array = [1.0, 1.0, 1.0, 1.0, 1.0, 1.0]; + var previousAudioVolumes:Array = [ + 1.0, + 1.0, + 1.0, + 1.0, + 1.0, + 1.0 + ]; /** * Whether hitsounds are enabled for at least one character. @@ -789,7 +810,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var stretchySound1:Null = null; var stretchySound2:Null = null; - // Auto-save /** @@ -1154,7 +1174,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState */ var clipboardValid:Bool = true; - /** * If true, we are currently in the process of quitting the chart editor. * Skip any update functions as most of them will call a crash. @@ -1361,7 +1380,10 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function get_availableVariations():Array { - var variations:Array = [for (x in songMetadata.keys()) x]; + var variations:Array = [ + for (x in songMetadata.keys()) + x + ]; variations.sort(SortUtil.defaultThenAlphabetically.bind('default')); return variations; } @@ -1390,11 +1412,16 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function get_allDifficulties():Array { - var result:Array> = [for (x in availableVariations) - { - var m:Null = songMetadata.get(x); - [for (diff in (m?.playData?.difficulties ?? [])) '$diff-$x']; - }]; + var result:Array> = [ + for (x in availableVariations) + { + var m:Null = songMetadata.get(x); + [ + for (diff in (m?.playData?.difficulties ?? [])) + '$diff-$x' + ]; + } + ]; return result.flatten(); } @@ -1440,7 +1467,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var result:Null = songChartData.get(selectedVariation); if (result == null) { - result = new SongChartData([Constants.DEFAULT_DIFFICULTY => 1.0], [], [Constants.DEFAULT_DIFFICULTY => []]); + result = new SongChartData([ + Constants.DEFAULT_DIFFICULTY => 1.0 + ], [], [ + Constants.DEFAULT_DIFFICULTY => [] + ]); songChartData.set(selectedVariation, result); } return result; @@ -1453,7 +1484,10 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState if (variationMetadata != null) { // Add the chartdata difficulties to the metadata difficulties if they don't exist so that the editor properly loads them - var keys:Array = [for (x in songChartData.get(selectedVariation).notes.keys()) x]; + var keys:Array = [ + for (x in songChartData.get(selectedVariation).notes.keys()) + x + ]; for (key in keys) { variationMetadata.playData.difficulties.pushUnique(key); @@ -1577,8 +1611,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function get_currentSongAlbum():Null { if (currentSongMetadata.playData.album == null - || currentSongMetadata.playData.album == '' - || currentSongMetadata.playData.album == 'item') + || currentSongMetadata.playData.album == '' + || currentSongMetadata.playData.album == 'item') { // Initialize to the default value if not set. currentSongMetadata.playData.album = Constants.DEFAULT_ALBUM_ID; @@ -1596,8 +1630,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function get_currentSongStickerPack():Null { if (currentSongMetadata.playData.stickerPack == null - || currentSongMetadata.playData.stickerPack == '' - || currentSongMetadata.playData.stickerPack == 'item') + || currentSongMetadata.playData.stickerPack == '' + || currentSongMetadata.playData.stickerPack == 'item') { // Initialize to the default value if not set. currentSongMetadata.playData.stickerPack = Constants.DEFAULT_STICKER_PACK; @@ -2372,7 +2406,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var renderedEvents:FlxTypedSpriteGroup = new FlxTypedSpriteGroup(); var renderedSelectionSquares:FlxTypedSpriteGroup = new FlxTypedSpriteGroup(); - /** * LIFE CYCLE FUNCTIONS */ @@ -2561,7 +2594,8 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState this.welcomeMusic.looped = true; } - public function resetPreviewTimes() { + public function resetPreviewTimes() + { currentSongFreeplayPreviewStart = (currentSongMetadata?.playData?.previewStart ?? Constants.DEFAULT_PREVIEW_START_TIME); currentSongFreeplayPreviewEnd = (currentSongMetadata?.playData?.previewEnd ?? Constants.DEFAULT_PREVIEW_END_TIME); } @@ -3340,9 +3374,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState menubarItemSelectNone.onClick = _ -> performCommand(new DeselectAllItemsCommand()); - menubarItemSelectBeforePlayhead.onClick = _ -> performCommand(new SelectAllItemsBetweenTimeCommand(scrollPositionInMs + playheadPositionInMs, true, true, true)); + menubarItemSelectBeforePlayhead.onClick = _ -> performCommand(new SelectAllItemsBetweenTimeCommand(scrollPositionInMs + playheadPositionInMs, true, true, + true)); - menubarItemSelectAfterPlayhead.onClick = _ -> performCommand(new SelectAllItemsBetweenTimeCommand(scrollPositionInMs + playheadPositionInMs, false, true, true)); + menubarItemSelectAfterPlayhead.onClick = _ -> performCommand(new SelectAllItemsBetweenTimeCommand(scrollPositionInMs + playheadPositionInMs, false, true, + true)); menubarItemPlaytestFull.onClick = _ -> testSongInPlayState(false); menubarItemPlaytestMinimal.onClick = _ -> testSongInPlayState(true); @@ -3650,11 +3686,16 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState else { displayAutosavePopup = false; - var absoluteBackupsPath:String = Path.join([Sys.getCwd(), ChartEditorImportExportHandler.BACKUPS_PATH]); - this.infoWithActions('Auto-Save', 'Chart auto-saved to ${absoluteBackupsPath}.', [{ - text: "Open In Folder", - callback: openBackupsFolder, - }]); + var absoluteBackupsPath:String = Path.join([ + Sys.getCwd(), + ChartEditorImportExportHandler.BACKUPS_PATH + ]); + this.infoWithActions('Auto-Save', 'Chart auto-saved to ${absoluteBackupsPath}.', [ + { + text: "Open In Folder", + callback: openBackupsFolder, + } + ]); } } #end @@ -3668,7 +3709,10 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { #if sys // TODO: Is there a way to open a folder and highlight a file in it? - var absoluteBackupsPath:String = Path.join([Sys.getCwd(), ChartEditorImportExportHandler.BACKUPS_PATH]); + var absoluteBackupsPath:String = Path.join([ + Sys.getCwd(), + ChartEditorImportExportHandler.BACKUPS_PATH + ]); FileUtil.openFolder(absoluteBackupsPath); return true; #else @@ -4879,7 +4923,10 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // We build a list of columns to select. var columnStart:Int = Std.int(Math.min(cursorColumnBase, cursorColumnBaseStart)); var columnEnd:Int = Std.int(Math.max(cursorColumnBase, cursorColumnBaseStart)); - var columns:Array = [for (i in columnStart...(columnEnd + 1)) i].map(function(i:Int):Int + var columns:Array = [ + for (i in columnStart...(columnEnd + 1)) + i + ].map(function(i:Int):Int { if (i >= eventColumn) { @@ -6023,9 +6070,12 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { waveform.x = switch (waveform.iconId) { - case BF: healthIconBF != null ? healthIconBF.x : 840 + FullScreenScaleMode.gameCutoutSize.x * 0.5; - case DAD: healthIconDad != null ? healthIconDad.x : 360 + FullScreenScaleMode.gameCutoutSize.x * 0.5; - default: 0; + case BF: + healthIconBF != null ? healthIconBF.x : 840 + FullScreenScaleMode.gameCutoutSize.x * 0.5; + case DAD: + healthIconDad != null ? healthIconDad.x : 360 + FullScreenScaleMode.gameCutoutSize.x * 0.5; + default: + 0; } } @@ -6275,8 +6325,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState if (FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.HOME) { // CTRL + SHIFT + Home = Inverse - deselect all above playhead - if (FlxG.keys.pressed.CONTROL) - performCommand(new DeselectAllItemsBetweenTimeCommand(scrollPositionInMs + playheadPositionInMs, true, true, true)); + if (FlxG.keys.pressed.CONTROL) performCommand(new DeselectAllItemsBetweenTimeCommand(scrollPositionInMs + playheadPositionInMs, true, true, true)); else performCommand(new SelectAllItemsBetweenTimeCommand(scrollPositionInMs + playheadPositionInMs, true, true, true)); } @@ -6285,8 +6334,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState if (FlxG.keys.pressed.SHIFT && FlxG.keys.justPressed.END) { // CTRL + SHIFT + Home = Inverse - deselect all below playhead - if (FlxG.keys.pressed.CONTROL) - performCommand(new DeselectAllItemsBetweenTimeCommand(scrollPositionInMs + playheadPositionInMs, false, true, true)); + if (FlxG.keys.pressed.CONTROL) performCommand(new DeselectAllItemsBetweenTimeCommand(scrollPositionInMs + playheadPositionInMs, false, true, true)); else performCommand(new SelectAllItemsBetweenTimeCommand(scrollPositionInMs + playheadPositionInMs, false, true, true)); } @@ -6891,7 +6939,9 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var currentVariationIndex:Int = availableVariations.indexOf(selectedVariation); var prevVariation = availableVariations[currentVariationIndex - 1]; var prevVariationDifficulties:Array = getAvailableDifficulties(prevVariation); - var prevDifficulty = prevVariationDifficulties[prevVariationDifficulties.length - 1]; + var prevDifficulty = prevVariationDifficulties[ + prevVariationDifficulties.length - 1 + ]; trace('${selectedVariation}:${selectedDifficulty} -> ${prevVariation}:${prevDifficulty}'); performCommand(new SwitchDifficultyCommand(selectedDifficulty, prevDifficulty, selectedVariation, prevVariation)); @@ -7000,11 +7050,16 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState #if sys haxe.ui.Toolkit.callLater(() -> { - var absoluteBackupsPath:String = Path.join([Sys.getCwd(), ChartEditorImportExportHandler.BACKUPS_PATH]); - this.infoWithActions('Auto-Save', 'Chart auto-saved to ${absoluteBackupsPath}.', [{ - text: "Open In Folder", - callback: openBackupsFolder, - }]); + var absoluteBackupsPath:String = Path.join([ + Sys.getCwd(), + ChartEditorImportExportHandler.BACKUPS_PATH + ]); + this.infoWithActions('Auto-Save', 'Chart auto-saved to ${absoluteBackupsPath}.', [ + { + text: "Open In Folder", + callback: openBackupsFolder, + } + ]); }); #else // TODO: No auto-save on HTML5? @@ -7196,7 +7251,6 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState var _scriptNoteObj:NoteSprite = null; var _noteScriptEvent:NoteScriptEvent = null; - var _currentEvents = null; var _allowedEvents = null; var _eventTarget:Null = null; diff --git a/source/funkin/ui/debug/charting/commands/AddEventsCommand.hx b/source/funkin/ui/debug/charting/commands/AddEventsCommand.hx index 9fa1635df..3fbbba65c 100644 --- a/source/funkin/ui/debug/charting/commands/AddEventsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/AddEventsCommand.hx @@ -7,8 +7,7 @@ import funkin.data.song.SongDataUtils; /** * Adds the given events to the current chart in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class AddEventsCommand implements ChartEditorCommand { var events:Array; diff --git a/source/funkin/ui/debug/charting/commands/AddNewTimeChangeCommand.hx b/source/funkin/ui/debug/charting/commands/AddNewTimeChangeCommand.hx index e8bb45841..6017debfe 100644 --- a/source/funkin/ui/debug/charting/commands/AddNewTimeChangeCommand.hx +++ b/source/funkin/ui/debug/charting/commands/AddNewTimeChangeCommand.hx @@ -8,14 +8,11 @@ import funkin.ui.debug.charting.toolboxes.ChartEditorMetadataToolbox; * A command which adds a new timechange to the current song's timechanges, after the index value given, at the given timestamp. * Will clamp the target timestamp to a valid value. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class AddNewTimeChangeCommand implements ChartEditorCommand { var timeChangeIndex:Int; - var previousTimeChanges:Null>; - var targetTimeStamp:Float; public function new(timeChangeIndex:Int, targetTimeStamp:Float) diff --git a/source/funkin/ui/debug/charting/commands/AddNotesCommand.hx b/source/funkin/ui/debug/charting/commands/AddNotesCommand.hx index dd4465fdf..580c2b5f3 100644 --- a/source/funkin/ui/debug/charting/commands/AddNotesCommand.hx +++ b/source/funkin/ui/debug/charting/commands/AddNotesCommand.hx @@ -7,8 +7,7 @@ import funkin.data.song.SongDataUtils; /** * Adds the given notes to the current chart in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class AddNotesCommand implements ChartEditorCommand { var notes:Array; diff --git a/source/funkin/ui/debug/charting/commands/CopyItemsCommand.hx b/source/funkin/ui/debug/charting/commands/CopyItemsCommand.hx index 7a10d109c..f12a46576 100644 --- a/source/funkin/ui/debug/charting/commands/CopyItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/CopyItemsCommand.hx @@ -11,8 +11,7 @@ import flixel.tweens.FlxTween; * Command that copies a given set of notes and song events to the clipboard, * without deleting them from the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class CopyItemsCommand implements ChartEditorCommand { var notes:Array; diff --git a/source/funkin/ui/debug/charting/commands/CutItemsCommand.hx b/source/funkin/ui/debug/charting/commands/CutItemsCommand.hx index ae193effd..1beca56df 100644 --- a/source/funkin/ui/debug/charting/commands/CutItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/CutItemsCommand.hx @@ -9,8 +9,7 @@ import funkin.data.song.SongDataUtils; * Command that copies a given set of notes and song events to the clipboard, * and then deletes them from the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class CutItemsCommand implements ChartEditorCommand { var notes:Array; diff --git a/source/funkin/ui/debug/charting/commands/DeselectAllItemsBetweenTimeCommand.hx b/source/funkin/ui/debug/charting/commands/DeselectAllItemsBetweenTimeCommand.hx index 6c1c4fc6e..cd7fe9c54 100644 --- a/source/funkin/ui/debug/charting/commands/DeselectAllItemsBetweenTimeCommand.hx +++ b/source/funkin/ui/debug/charting/commands/DeselectAllItemsBetweenTimeCommand.hx @@ -7,16 +7,13 @@ import funkin.data.song.SongDataUtils; /** * Command that deselects all selected notes and/or events above or past the time given in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class DeselectAllItemsBetweenTimeCommand implements ChartEditorCommand { var time:Float; var above:Bool; - var notes:Array; var events:Array; - var shouldDeselectNotes:Bool; var shouldDeselectEvents:Bool; @@ -40,8 +37,7 @@ class DeselectAllItemsBetweenTimeCommand implements ChartEditorCommand { for (i in 0...state.currentSongChartNoteData.length) { - if (state.currentSongChartNoteData[i].time < time) - notes.push(state.currentSongChartNoteData[i]); + if (state.currentSongChartNoteData[i].time < time) notes.push(state.currentSongChartNoteData[i]); else // We've reached the end of the notes above this time, // there's no reason to waste our time running this loop to completion @@ -52,8 +48,7 @@ class DeselectAllItemsBetweenTimeCommand implements ChartEditorCommand { for (i in 0...state.currentSongChartEventData.length) { - if (state.currentSongChartEventData[i].time < time) - events.push(state.currentSongChartEventData[i]); + if (state.currentSongChartEventData[i].time < time) events.push(state.currentSongChartEventData[i]); else break; } @@ -66,8 +61,11 @@ class DeselectAllItemsBetweenTimeCommand implements ChartEditorCommand for (i in 0...state.currentSongChartNoteData.length) { // Backwards for loop (kinda). Neat! - if (state.currentSongChartNoteData[state.currentSongChartNoteData.length - i - 1].time > time) - notes.push(state.currentSongChartNoteData[state.currentSongChartNoteData.length - i - 1]); + if (state.currentSongChartNoteData[ + state.currentSongChartNoteData.length - i - 1 + ].time > time) notes.push(state.currentSongChartNoteData[ + state.currentSongChartNoteData.length - i - 1 + ]); else // We've reached the end of the notes below this time, // there's no reason to waste our time running this loop to completion @@ -78,8 +76,11 @@ class DeselectAllItemsBetweenTimeCommand implements ChartEditorCommand { for (i in 0...state.currentSongChartEventData.length) { - if (state.currentSongChartEventData[state.currentSongChartEventData.length - i - 1].time > time) - events.push(state.currentSongChartEventData[state.currentSongChartEventData.length- i - 1]); + if (state.currentSongChartEventData[ + state.currentSongChartEventData.length - i - 1 + ].time > time) events.push(state.currentSongChartEventData[ + state.currentSongChartEventData.length - i - 1 + ]); else break; } diff --git a/source/funkin/ui/debug/charting/commands/DeselectAllItemsCommand.hx b/source/funkin/ui/debug/charting/commands/DeselectAllItemsCommand.hx index 44e42483a..d63f6487c 100644 --- a/source/funkin/ui/debug/charting/commands/DeselectAllItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/DeselectAllItemsCommand.hx @@ -7,8 +7,7 @@ import funkin.data.song.SongData.SongEventData; /** * Command that deselects all selected notes and events in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class DeselectAllItemsCommand implements ChartEditorCommand { var previousNoteSelection:Array = []; diff --git a/source/funkin/ui/debug/charting/commands/DeselectItemsCommand.hx b/source/funkin/ui/debug/charting/commands/DeselectItemsCommand.hx index 98993ab84..9a4d6fbf9 100644 --- a/source/funkin/ui/debug/charting/commands/DeselectItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/DeselectItemsCommand.hx @@ -8,8 +8,7 @@ import funkin.data.song.SongDataUtils; /** * Command to deselect a specific set of notes and events in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class DeselectItemsCommand implements ChartEditorCommand { var notes:Array; diff --git a/source/funkin/ui/debug/charting/commands/ExtendNoteLengthCommand.hx b/source/funkin/ui/debug/charting/commands/ExtendNoteLengthCommand.hx index 0efc987fe..bd474320f 100644 --- a/source/funkin/ui/debug/charting/commands/ExtendNoteLengthCommand.hx +++ b/source/funkin/ui/debug/charting/commands/ExtendNoteLengthCommand.hx @@ -7,8 +7,7 @@ import funkin.data.song.SongData.SongNoteData; * Command that modifies the length of a hold note in the chart editor. * If it is not a hold note, it will become one, and if it is already a hold note, its length will change. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ExtendNoteLengthCommand implements ChartEditorCommand { var note:SongNoteData; diff --git a/source/funkin/ui/debug/charting/commands/FlipNotesCommand.hx b/source/funkin/ui/debug/charting/commands/FlipNotesCommand.hx index 48815b4a9..5341ce82e 100644 --- a/source/funkin/ui/debug/charting/commands/FlipNotesCommand.hx +++ b/source/funkin/ui/debug/charting/commands/FlipNotesCommand.hx @@ -7,8 +7,7 @@ import funkin.data.song.SongDataUtils; /** * Command that flips a given array of notes from the player's side of the chart editor to the opponent's side, or vice versa. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class FlipNotesCommand implements ChartEditorCommand { var notes:Array = []; diff --git a/source/funkin/ui/debug/charting/commands/InvertSelectedItemsCommand.hx b/source/funkin/ui/debug/charting/commands/InvertSelectedItemsCommand.hx index 2492b8eb0..7fec0557b 100644 --- a/source/funkin/ui/debug/charting/commands/InvertSelectedItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/InvertSelectedItemsCommand.hx @@ -9,8 +9,7 @@ import funkin.data.song.SongDataUtils; * Command to deselect all items that are currently selected in the chart editor, * then select all the items that were previously unselected. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class InvertSelectedItemsCommand implements ChartEditorCommand { var previousNoteSelection:Array = []; diff --git a/source/funkin/ui/debug/charting/commands/MirrorNotesCommand.hx b/source/funkin/ui/debug/charting/commands/MirrorNotesCommand.hx index fcd912831..811d50d53 100644 --- a/source/funkin/ui/debug/charting/commands/MirrorNotesCommand.hx +++ b/source/funkin/ui/debug/charting/commands/MirrorNotesCommand.hx @@ -8,8 +8,7 @@ import funkin.data.song.SongDataUtils; * along either the X (note direction) axis or Y (note time) axis. * Flip middle will only work when the given notes are in both strumlines - it's incompatible with individually mirroring the selection. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class MirrorNotesCommand implements ChartEditorCommand { var notes:Array = []; diff --git a/source/funkin/ui/debug/charting/commands/ModifyTimeChangeCommand.hx b/source/funkin/ui/debug/charting/commands/ModifyTimeChangeCommand.hx index 7803cde78..177f38bf3 100644 --- a/source/funkin/ui/debug/charting/commands/ModifyTimeChangeCommand.hx +++ b/source/funkin/ui/debug/charting/commands/ModifyTimeChangeCommand.hx @@ -9,21 +9,16 @@ import funkin.ui.debug.charting.toolboxes.ChartEditorMetadataToolbox; * Annoyingly, due to the way haxe works, every value of the time change has to be passed into this. * Will clamp the target timestamp to a valid value. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ModifyTimeChangeCommand implements ChartEditorCommand { var timeChangeIndex:Int; - var targetBPM:Float; var previousBPM:Float = 100; - var targetTimeStamp:Float; var previousTimeStamp:Float = 0; - var targetNumerator:Int; var previousNumerator:Int = 4; - var targetDenominator:Int; var previousDenominator:Int = 4; @@ -43,7 +38,9 @@ class ModifyTimeChangeCommand implements ChartEditorCommand { previousBPM = 100; previousTimeStamp = 0; - timeChanges = [new SongTimeChange(previousTimeStamp, targetBPM)]; + timeChanges = [ + new SongTimeChange(previousTimeStamp, targetBPM) + ]; } else { @@ -82,7 +79,9 @@ class ModifyTimeChangeCommand implements ChartEditorCommand var timeChanges:Array = state.currentSongMetadata.timeChanges; if (timeChanges == null || timeChanges.length == 0) { - timeChanges = [new SongTimeChange(previousTimeStamp, targetBPM)]; + timeChanges = [ + new SongTimeChange(previousTimeStamp, targetBPM) + ]; } else { diff --git a/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx b/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx index 86a6d9769..b25ea38eb 100644 --- a/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx @@ -8,8 +8,7 @@ import funkin.data.song.SongDataUtils; /** * Move the given events by the given offset and shift them by the given number of columns in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class MoveEventsCommand implements ChartEditorCommand { var events:Array; @@ -20,10 +19,13 @@ class MoveEventsCommand implements ChartEditorCommand public function new(events:Array, offset:Float, setPos:Bool = false, offsetInSteps:Bool = false) { // Clone the events to prevent editing from affecting the history. - this.events = [for (event in events) event.clone()]; + this.events = [ + for (event in events) + event.clone() + ]; if (offsetInSteps) this.offset = Conductor.instance.getStepTimeInMs(offset); else - this.offset = offset; + this.offset = offset; this.setPos = setPos; this.movedEvents = []; } @@ -41,7 +43,7 @@ class MoveEventsCommand implements ChartEditorCommand // If setting position, use the offset as the resulting time if (setPos) resultEvent.time = offset.clamp(0, Conductor.instance.getStepTimeInMs(state.songLengthInSteps - (1 * state.noteSnapRatio))); else - resultEvent.time = (resultEvent.time + offset).clamp(0, Conductor.instance.getStepTimeInMs(state.songLengthInSteps - (1 * state.noteSnapRatio))); + resultEvent.time = (resultEvent.time + offset).clamp(0, Conductor.instance.getStepTimeInMs(state.songLengthInSteps - (1 * state.noteSnapRatio))); movedEvents.push(resultEvent); } diff --git a/source/funkin/ui/debug/charting/commands/MoveItemsCommand.hx b/source/funkin/ui/debug/charting/commands/MoveItemsCommand.hx index 66a6f694e..145ba72b5 100644 --- a/source/funkin/ui/debug/charting/commands/MoveItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/MoveItemsCommand.hx @@ -8,8 +8,7 @@ import funkin.data.song.SongDataUtils; /** * Move the given notes by the given offset and shift them by the given number of columns in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class MoveItemsCommand implements ChartEditorCommand { var notes:Array; diff --git a/source/funkin/ui/debug/charting/commands/MoveNotesCommand.hx b/source/funkin/ui/debug/charting/commands/MoveNotesCommand.hx index 5e0c3ae74..425bf2e7a 100644 --- a/source/funkin/ui/debug/charting/commands/MoveNotesCommand.hx +++ b/source/funkin/ui/debug/charting/commands/MoveNotesCommand.hx @@ -7,8 +7,7 @@ import funkin.data.song.SongDataUtils; /** * Move the given notes by the given offset and shift them by the given number of columns in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class MoveNotesCommand implements ChartEditorCommand { var notes:Array; @@ -20,7 +19,10 @@ class MoveNotesCommand implements ChartEditorCommand public function new(notes:Array, offset:Float, columns:Int, setPos:Bool = false, offsetInSteps:Bool = false) { // Clone the notes to prevent editing from affecting the history. - this.notes = [for (note in notes) note.clone()]; + this.notes = [ + for (note in notes) + note.clone() + ]; if (offsetInSteps) this.offset = Conductor.instance.getStepTimeInMs(offset); else this.offset = offset; @@ -42,7 +44,7 @@ class MoveNotesCommand implements ChartEditorCommand // If setting position, use the offset as the resulting time if (setPos) resultNote.time = offset.clamp(0, Conductor.instance.getStepTimeInMs(state.songLengthInSteps - (1 * state.noteSnapRatio))); else - resultNote.time = (resultNote.time + offset).clamp(0, Conductor.instance.getStepTimeInMs(state.songLengthInSteps - (1 * state.noteSnapRatio))); + resultNote.time = (resultNote.time + offset).clamp(0, Conductor.instance.getStepTimeInMs(state.songLengthInSteps - (1 * state.noteSnapRatio))); resultNote.data = ChartEditorState.gridColumnToNoteData((ChartEditorState.noteDataToGridColumn(resultNote.data) + columns).clamp(0, ChartEditorState.STRUMLINE_SIZE * 2 - 1)); diff --git a/source/funkin/ui/debug/charting/commands/PasteItemsCommand.hx b/source/funkin/ui/debug/charting/commands/PasteItemsCommand.hx index d85ae2887..c618e3030 100644 --- a/source/funkin/ui/debug/charting/commands/PasteItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/PasteItemsCommand.hx @@ -11,8 +11,7 @@ import funkin.ui.debug.charting.ChartEditorState; /** * A command which inserts the contents of the clipboard into the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class PasteItemsCommand implements ChartEditorCommand { var targetTimestamp:Float; @@ -21,13 +20,11 @@ class PasteItemsCommand implements ChartEditorCommand var addedEvents:Array = []; var removedNotes:Array = []; var isRedo:Bool = false; - - var currentClipboard:SongClipboardItems = - { - valid: false, - notes: [], - events: [] - }; + var currentClipboard:SongClipboardItems = { + valid: false, + notes: [], + events: [] + }; public function new(targetTimestamp:Float) { diff --git a/source/funkin/ui/debug/charting/commands/RemoveEventsCommand.hx b/source/funkin/ui/debug/charting/commands/RemoveEventsCommand.hx index ea1b06a3e..f21e2ca88 100644 --- a/source/funkin/ui/debug/charting/commands/RemoveEventsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/RemoveEventsCommand.hx @@ -8,8 +8,7 @@ import funkin.data.song.SongDataUtils; * Deletes the given events from the current chart in the chart editor. * Use only when ONLY events are being deleted. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class RemoveEventsCommand implements ChartEditorCommand { var events:Array; diff --git a/source/funkin/ui/debug/charting/commands/RemoveItemsCommand.hx b/source/funkin/ui/debug/charting/commands/RemoveItemsCommand.hx index f02198ab1..5073af40c 100644 --- a/source/funkin/ui/debug/charting/commands/RemoveItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/RemoveItemsCommand.hx @@ -9,8 +9,7 @@ import funkin.data.song.SongDataUtils; * Deletes the given notes and events from the current chart in the chart editor. * Use only when BOTH notes and events are being deleted. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class RemoveItemsCommand implements ChartEditorCommand { var notes:Array; diff --git a/source/funkin/ui/debug/charting/commands/RemoveNotesCommand.hx b/source/funkin/ui/debug/charting/commands/RemoveNotesCommand.hx index d1f797efc..ea7abfcee 100644 --- a/source/funkin/ui/debug/charting/commands/RemoveNotesCommand.hx +++ b/source/funkin/ui/debug/charting/commands/RemoveNotesCommand.hx @@ -8,8 +8,7 @@ import funkin.data.song.SongDataUtils; * Deletes the given notes from the current chart in the chart editor. * Use only when ONLY notes are being deleted. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class RemoveNotesCommand implements ChartEditorCommand { var notes:Array; diff --git a/source/funkin/ui/debug/charting/commands/RemoveStackedNotesCommand.hx b/source/funkin/ui/debug/charting/commands/RemoveStackedNotesCommand.hx index 5c72df4c3..9d6a2da33 100644 --- a/source/funkin/ui/debug/charting/commands/RemoveStackedNotesCommand.hx +++ b/source/funkin/ui/debug/charting/commands/RemoveStackedNotesCommand.hx @@ -9,8 +9,7 @@ import funkin.data.song.SongNoteDataUtils; * Deletes the given notes from the current chart in the chart editor if any overlap another. * Use when ONLY notes are being deleted. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class RemoveStackedNotesCommand implements ChartEditorCommand { var notes:Null>; diff --git a/source/funkin/ui/debug/charting/commands/RemoveTimeChangeCommand.hx b/source/funkin/ui/debug/charting/commands/RemoveTimeChangeCommand.hx index a9c5f2a07..559be3f4d 100644 --- a/source/funkin/ui/debug/charting/commands/RemoveTimeChangeCommand.hx +++ b/source/funkin/ui/debug/charting/commands/RemoveTimeChangeCommand.hx @@ -7,14 +7,11 @@ import funkin.ui.debug.charting.toolboxes.ChartEditorMetadataToolbox; /** * A command which removes the given timechange from the current song's timechanges. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class RemoveTimeChangeCommand implements ChartEditorCommand { var timeChangeIndex:Int; - var previousTimeChanges:Null>; - var removedTimeChange:Null>; public function new(timeChangeIndex:Int) diff --git a/source/funkin/ui/debug/charting/commands/SelectAllItemsBetweenTimeCommand.hx b/source/funkin/ui/debug/charting/commands/SelectAllItemsBetweenTimeCommand.hx index 530da58be..f01e81167 100644 --- a/source/funkin/ui/debug/charting/commands/SelectAllItemsBetweenTimeCommand.hx +++ b/source/funkin/ui/debug/charting/commands/SelectAllItemsBetweenTimeCommand.hx @@ -7,16 +7,13 @@ import funkin.data.song.SongDataUtils; /** * Command that selects all notes and/or events above or past the time given in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class SelectAllItemsBetweenTimeCommand implements ChartEditorCommand { var time:Float; var above:Bool; - var notes:Array; var events:Array; - var shouldSelectNotes:Bool; var shouldSelectEvents:Bool; @@ -34,16 +31,15 @@ class SelectAllItemsBetweenTimeCommand implements ChartEditorCommand public function execute(state:ChartEditorState):Void { - if(above) + if (above) { if (shouldSelectNotes) { for (i in 0...state.currentSongChartNoteData.length) { - if (state.currentSongChartNoteData[i].time < time) - notes.push(state.currentSongChartNoteData[i]); + if (state.currentSongChartNoteData[i].time < time) notes.push(state.currentSongChartNoteData[i]); else - //We've reached the end of the notes above this time, + // We've reached the end of the notes above this time, // there's no reason to waste our time running this loop to completion break; } @@ -52,9 +48,7 @@ class SelectAllItemsBetweenTimeCommand implements ChartEditorCommand { for (i in 0...state.currentSongChartEventData.length) { - if (state.currentSongChartEventData[i].time < time) - events.push(state.currentSongChartEventData[i]); - + if (state.currentSongChartEventData[i].time < time) events.push(state.currentSongChartEventData[i]); else break; } @@ -67,8 +61,11 @@ class SelectAllItemsBetweenTimeCommand implements ChartEditorCommand for (i in 0...state.currentSongChartNoteData.length) { // Backwards for loop (kinda). Neat! - if (state.currentSongChartNoteData[state.currentSongChartNoteData.length - i - 1].time > time) - notes.push(state.currentSongChartNoteData[state.currentSongChartNoteData.length - i- 1]); + if (state.currentSongChartNoteData[ + state.currentSongChartNoteData.length - i - 1 + ].time > time) notes.push(state.currentSongChartNoteData[ + state.currentSongChartNoteData.length - i - 1 + ]); else // We've reached the end of the notes below this time, // there's no reason to waste our time running this loop to completion @@ -79,8 +76,11 @@ class SelectAllItemsBetweenTimeCommand implements ChartEditorCommand { for (i in 0...state.currentSongChartEventData.length) { - if (state.currentSongChartEventData[state.currentSongChartEventData.length - i - 1].time > time) - events.push(state.currentSongChartEventData[state.currentSongChartEventData.length- i- 1]); + if (state.currentSongChartEventData[ + state.currentSongChartEventData.length - i - 1 + ].time > time) events.push(state.currentSongChartEventData[ + state.currentSongChartEventData.length - i - 1 + ]); else break; } @@ -98,7 +98,6 @@ class SelectAllItemsBetweenTimeCommand implements ChartEditorCommand state.currentEventSelection.push(event); } - // I don't think it's neccesary to copy this code in, but someone will make an issue out of this if I don't, I'm sure. // If we just selected one or more events (and no notes), then we should make the event data toolbox display the event data for the selected event. if (this.notes.length == 0 && this.events.length == 1) diff --git a/source/funkin/ui/debug/charting/commands/SelectAllItemsCommand.hx b/source/funkin/ui/debug/charting/commands/SelectAllItemsCommand.hx index a4c89c27d..e48102c58 100644 --- a/source/funkin/ui/debug/charting/commands/SelectAllItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/SelectAllItemsCommand.hx @@ -7,13 +7,11 @@ import funkin.data.song.SongData.SongEventData; /** * Command to set the selection to all notes and events in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class SelectAllItemsCommand implements ChartEditorCommand { var shouldSelectNotes:Bool; var shouldSelectEvents:Bool; - var previousNoteSelection:Array = []; var previousEventSelection:Array = []; diff --git a/source/funkin/ui/debug/charting/commands/SelectItemsCommand.hx b/source/funkin/ui/debug/charting/commands/SelectItemsCommand.hx index 07fd55602..d92fd4dae 100644 --- a/source/funkin/ui/debug/charting/commands/SelectItemsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/SelectItemsCommand.hx @@ -9,8 +9,7 @@ import funkin.data.song.SongDataUtils; * Appends one or more items to the selection in the chart editor. * This does not deselect any items that are already selected, if any. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class SelectItemsCommand implements ChartEditorCommand { var notes:Array; diff --git a/source/funkin/ui/debug/charting/commands/SetAudioOffsetCommand.hx b/source/funkin/ui/debug/charting/commands/SetAudioOffsetCommand.hx index ea2ecaffd..2fa0e314c 100644 --- a/source/funkin/ui/debug/charting/commands/SetAudioOffsetCommand.hx +++ b/source/funkin/ui/debug/charting/commands/SetAudioOffsetCommand.hx @@ -5,8 +5,7 @@ package funkin.ui.debug.charting.commands; * Command that copies a given set of notes and song events to the clipboard, * without deleting them from the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class SetAudioOffsetCommand implements ChartEditorCommand { var type:AudioOffsetType; diff --git a/source/funkin/ui/debug/charting/commands/SetFreeplayPreviewCommand.hx b/source/funkin/ui/debug/charting/commands/SetFreeplayPreviewCommand.hx index 7304065aa..f6c7c9275 100644 --- a/source/funkin/ui/debug/charting/commands/SetFreeplayPreviewCommand.hx +++ b/source/funkin/ui/debug/charting/commands/SetFreeplayPreviewCommand.hx @@ -7,8 +7,7 @@ import funkin.data.song.SongDataUtils; /** * Command that sets the start time or end time of the Freeplay preview. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class SetFreeplayPreviewCommand implements ChartEditorCommand { var previousStartTime:Float = 0; diff --git a/source/funkin/ui/debug/charting/commands/SetItemSelectionCommand.hx b/source/funkin/ui/debug/charting/commands/SetItemSelectionCommand.hx index d27b4af81..ef42cea3e 100644 --- a/source/funkin/ui/debug/charting/commands/SetItemSelectionCommand.hx +++ b/source/funkin/ui/debug/charting/commands/SetItemSelectionCommand.hx @@ -8,8 +8,7 @@ import funkin.data.song.SongData.SongEventData; * Command to set the current selection in the chart editor (rather than appending it). * Deselects any notes that are not in the new selection. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class SetItemSelectionCommand implements ChartEditorCommand { var notes:Array; diff --git a/source/funkin/ui/debug/charting/commands/SwitchDifficultyCommand.hx b/source/funkin/ui/debug/charting/commands/SwitchDifficultyCommand.hx index 633b48e00..404fa0270 100644 --- a/source/funkin/ui/debug/charting/commands/SwitchDifficultyCommand.hx +++ b/source/funkin/ui/debug/charting/commands/SwitchDifficultyCommand.hx @@ -4,8 +4,7 @@ package funkin.ui.debug.charting.commands; /** * Switch the current difficulty (and possibly variation) of the chart in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class SwitchDifficultyCommand implements ChartEditorCommand { var prevDifficulty:String; diff --git a/source/funkin/ui/debug/charting/components/ChartEditorEventSprite.hx b/source/funkin/ui/debug/charting/components/ChartEditorEventSprite.hx index 8e86a97c2..6c859bea5 100644 --- a/source/funkin/ui/debug/charting/components/ChartEditorEventSprite.hx +++ b/source/funkin/ui/debug/charting/components/ChartEditorEventSprite.hx @@ -30,7 +30,6 @@ class ChartEditorEventSprite extends FlxSprite public var eventData(default, set):Null = null; public var overrideStepTime(default, set):Null = null; - public var tooltip:ToolTipRegionOptions; /** diff --git a/source/funkin/ui/debug/charting/components/ChartEditorHoldNoteSprite.hx b/source/funkin/ui/debug/charting/components/ChartEditorHoldNoteSprite.hx index 3c0390cfd..b2644f9a1 100644 --- a/source/funkin/ui/debug/charting/components/ChartEditorHoldNoteSprite.hx +++ b/source/funkin/ui/debug/charting/components/ChartEditorHoldNoteSprite.hx @@ -13,8 +13,7 @@ import flixel.math.FlxMath; * A sprite that can be used to display the trail of a hold note in a chart. * Designed to be used and reused efficiently. Has no gameplay functionality. */ -@:access(funkin.ui.debug.charting.ChartEditorState) -@:nullSafety +@:access(funkin.ui.debug.charting.ChartEditorState) @:nullSafety class ChartEditorHoldNoteSprite extends SustainTrail { /** diff --git a/source/funkin/ui/debug/charting/components/ChartEditorMeasureTicks.hx b/source/funkin/ui/debug/charting/components/ChartEditorMeasureTicks.hx index 5e94d57e4..188f48bb5 100644 --- a/source/funkin/ui/debug/charting/components/ChartEditorMeasureTicks.hx +++ b/source/funkin/ui/debug/charting/components/ChartEditorMeasureTicks.hx @@ -13,8 +13,7 @@ import openfl.geom.Rectangle; /** * Handles the display of the measure ticks and numbers on the left side. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorMeasureTicks extends FlxTypedSpriteGroup { /** @@ -88,15 +87,21 @@ class ChartEditorMeasureTicks extends FlxTypedSpriteGroup { var backingColor:FlxColor = switch (chartEditorState.currentTheme) { - case Light: ChartEditorThemeHandler.MEASTURE_TICKS_BACKING_COLOR_LIGHT; - case Dark: ChartEditorThemeHandler.MEASTURE_TICKS_BACKING_COLOR_DARK; - default: ChartEditorThemeHandler.MEASTURE_TICKS_BACKING_COLOR_LIGHT; + case Light: + ChartEditorThemeHandler.MEASTURE_TICKS_BACKING_COLOR_LIGHT; + case Dark: + ChartEditorThemeHandler.MEASTURE_TICKS_BACKING_COLOR_DARK; + default: + ChartEditorThemeHandler.MEASTURE_TICKS_BACKING_COLOR_LIGHT; }; var dividerColor:FlxColor = switch (chartEditorState.currentTheme) { - case Light: ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_LIGHT; - case Dark: ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_DARK; - default: ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_LIGHT; + case Light: + ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_LIGHT; + case Dark: + ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_DARK; + default: + ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_LIGHT; }; // TODO: This does NOT account for time signature, and always assumes 4/4! @@ -243,9 +248,12 @@ class ChartEditorMeasureTicks extends FlxTypedSpriteGroup { var dividerColor:FlxColor = switch (chartEditorState.currentTheme) { - case Light: ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_LIGHT; - case Dark: ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_DARK; - default: ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_LIGHT; + case Light: + ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_LIGHT; + case Dark: + ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_DARK; + default: + ChartEditorThemeHandler.GRID_MEASURE_DIVIDER_COLOR_LIGHT; }; var measureDivider = new FunkinSprite().makeSolidColor(ChartEditorState.GRID_SIZE * ChartEditorThemeHandler.TOTAL_COLUMN_COUNT, diff --git a/source/funkin/ui/debug/charting/components/ChartEditorNotePreview.hx b/source/funkin/ui/debug/charting/components/ChartEditorNotePreview.hx index ed13a207c..7908225c2 100644 --- a/source/funkin/ui/debug/charting/components/ChartEditorNotePreview.hx +++ b/source/funkin/ui/debug/charting/components/ChartEditorNotePreview.hx @@ -11,8 +11,7 @@ import flixel.util.FlxSpriteUtil; /** * Handles the note scrollbar preview in the chart editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorNotePreview extends FlxSprite { // @@ -21,7 +20,6 @@ class ChartEditorNotePreview extends FlxSprite static final NOTE_WIDTH:Int = 5; static final WIDTH:Int = NOTE_WIDTH * 9; static final NOTE_HEIGHT:Int = 1; - static final BG_COLOR:FlxColor = 0xFF606060; static final LEFT_COLOR:FlxColor = 0xFFFF22AA; static final DOWN_COLOR:FlxColor = 0xFF00EEFF; @@ -156,11 +154,16 @@ class ChartEditorNotePreview extends FlxSprite { var color:FlxColor = switch (dir) { - case 0: LEFT_COLOR; - case 1: DOWN_COLOR; - case 2: UP_COLOR; - case 3: RIGHT_COLOR; - default: EVENT_COLOR; + case 0: + LEFT_COLOR; + case 1: + DOWN_COLOR; + case 2: + UP_COLOR; + case 3: + RIGHT_COLOR; + default: + EVENT_COLOR; }; var noteHeight:Int = NOTE_HEIGHT; diff --git a/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx b/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx index 7506318e0..033032c3d 100644 --- a/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx +++ b/source/funkin/ui/debug/charting/components/ChartEditorNoteSprite.hx @@ -21,8 +21,7 @@ import haxe.ui.tooltips.ToolTipManager; * A sprite that can be used to display a note in a chart. * Designed to be used and reused efficiently. Has no gameplay functionality. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorNoteSprite extends FlxSprite { /** @@ -118,8 +117,7 @@ class ChartEditorNoteSprite extends FlxSprite return NoteStyleRegistry.instance.fetchDefault(); } - @:access(funkin.play.notes.notestyle.NoteStyle) - @:nullSafety(Off) + @:access(funkin.play.notes.notestyle.NoteStyle) @:nullSafety(Off) static function addNoteStyleFrames(noteStyle:NoteStyle):Void { var prefix:String = noteStyle.id.toTitleCase(); @@ -141,8 +139,7 @@ class ChartEditorNoteSprite extends FlxSprite } } - @:access(funkin.play.notes.notestyle.NoteStyle) - @:nullSafety(Off) + @:access(funkin.play.notes.notestyle.NoteStyle) @:nullSafety(Off) function addNoteStyleAnimations(noteStyle:NoteStyle):Void { var prefix:String = noteStyle.id.toTitleCase(); diff --git a/source/funkin/ui/debug/charting/components/ChartEditorSelectionSquareSprite.hx b/source/funkin/ui/debug/charting/components/ChartEditorSelectionSquareSprite.hx index 17252b05c..57d550458 100644 --- a/source/funkin/ui/debug/charting/components/ChartEditorSelectionSquareSprite.hx +++ b/source/funkin/ui/debug/charting/components/ChartEditorSelectionSquareSprite.hx @@ -11,8 +11,7 @@ import funkin.ui.debug.charting.handlers.ChartEditorThemeHandler; * A sprite that can be used to display a square over a selected note or event in the chart. * Designed to be used and reused efficiently. Has no gameplay functionality. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorSelectionSquareSprite extends FlxSliceSprite { public var noteData:Null; diff --git a/source/funkin/ui/debug/charting/contextmenus/ChartEditorDefaultContextMenu.hx b/source/funkin/ui/debug/charting/contextmenus/ChartEditorDefaultContextMenu.hx index eb38b0a69..15047d7c7 100644 --- a/source/funkin/ui/debug/charting/contextmenus/ChartEditorDefaultContextMenu.hx +++ b/source/funkin/ui/debug/charting/contextmenus/ChartEditorDefaultContextMenu.hx @@ -1,8 +1,7 @@ package funkin.ui.debug.charting.contextmenus; #if FEATURE_CHART_EDITOR -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/context-menus/default.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/context-menus/default.xml")) class ChartEditorDefaultContextMenu extends ChartEditorBaseContextMenu { public function new(chartEditorState2:ChartEditorState, xPos2:Float = 0, yPos2:Float = 0) diff --git a/source/funkin/ui/debug/charting/contextmenus/ChartEditorEventContextMenu.hx b/source/funkin/ui/debug/charting/contextmenus/ChartEditorEventContextMenu.hx index 1e68d9e0c..4eb54e052 100644 --- a/source/funkin/ui/debug/charting/contextmenus/ChartEditorEventContextMenu.hx +++ b/source/funkin/ui/debug/charting/contextmenus/ChartEditorEventContextMenu.hx @@ -11,8 +11,7 @@ import funkin.data.song.SongData.SongEventData; import funkin.ui.debug.charting.commands.MoveEventsCommand; import funkin.ui.debug.charting.commands.RemoveEventsCommand; -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/context-menus/event.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/context-menus/event.xml")) class ChartEditorEventContextMenu extends ChartEditorBaseContextMenu { var contextmenuEventKind:Label; @@ -22,7 +21,6 @@ class ChartEditorEventContextMenu extends ChartEditorBaseContextMenu var contextmenuDelete:MenuItem; public var selectedUnit:Int; - public var data:SongEventData; public function new(chartEditorState2:ChartEditorState, xPos2:Float = 0, yPos2:Float = 0, data:SongEventData, selectedUnit:Int = 0) diff --git a/source/funkin/ui/debug/charting/contextmenus/ChartEditorHoldNoteContextMenu.hx b/source/funkin/ui/debug/charting/contextmenus/ChartEditorHoldNoteContextMenu.hx index 7b01b6d67..88395cdb6 100644 --- a/source/funkin/ui/debug/charting/contextmenus/ChartEditorHoldNoteContextMenu.hx +++ b/source/funkin/ui/debug/charting/contextmenus/ChartEditorHoldNoteContextMenu.hx @@ -13,8 +13,7 @@ import funkin.ui.debug.charting.commands.FlipNotesCommand; import funkin.ui.debug.charting.commands.RemoveNotesCommand; import funkin.ui.debug.charting.commands.ExtendNoteLengthCommand; -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/context-menus/hold-note.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/context-menus/hold-note.xml")) class ChartEditorHoldNoteContextMenu extends ChartEditorBaseContextMenu { var contextmenuNoteKind:Label; @@ -27,7 +26,6 @@ class ChartEditorHoldNoteContextMenu extends ChartEditorBaseContextMenu var contextmenuDelete:MenuItem; public var selectedUnit:Int; - public var data:SongNoteData; public function new(chartEditorState2:ChartEditorState, xPos2:Float = 0, yPos2:Float = 0, data:SongNoteData, selectedUnit:Int = 0) diff --git a/source/funkin/ui/debug/charting/contextmenus/ChartEditorNoteContextMenu.hx b/source/funkin/ui/debug/charting/contextmenus/ChartEditorNoteContextMenu.hx index c76cbf936..45fbb59a6 100644 --- a/source/funkin/ui/debug/charting/contextmenus/ChartEditorNoteContextMenu.hx +++ b/source/funkin/ui/debug/charting/contextmenus/ChartEditorNoteContextMenu.hx @@ -14,8 +14,7 @@ import funkin.ui.debug.charting.commands.MirrorNotesCommand; import funkin.ui.debug.charting.commands.RemoveNotesCommand; import funkin.ui.debug.charting.commands.ExtendNoteLengthCommand; -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/context-menus/note.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/context-menus/note.xml")) class ChartEditorNoteContextMenu extends ChartEditorBaseContextMenu { var contextmenuNoteKind:Label; @@ -27,7 +26,6 @@ class ChartEditorNoteContextMenu extends ChartEditorBaseContextMenu var contextmenuDelete:MenuItem; public var selectedUnit:Int; - public var data:SongNoteData; public function new(chartEditorState2:ChartEditorState, xPos2:Float = 0, yPos2:Float = 0, data:SongNoteData, selectedUnit:Int = 0) diff --git a/source/funkin/ui/debug/charting/contextmenus/ChartEditorSelectionContextMenu.hx b/source/funkin/ui/debug/charting/contextmenus/ChartEditorSelectionContextMenu.hx index a26dbe738..bff775720 100644 --- a/source/funkin/ui/debug/charting/contextmenus/ChartEditorSelectionContextMenu.hx +++ b/source/funkin/ui/debug/charting/contextmenus/ChartEditorSelectionContextMenu.hx @@ -18,8 +18,7 @@ import funkin.ui.debug.charting.commands.SelectAllItemsCommand; import funkin.ui.debug.charting.commands.InvertSelectedItemsCommand; import funkin.ui.debug.charting.commands.DeselectAllItemsCommand; -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/context-menus/selection.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/context-menus/selection.xml")) class ChartEditorSelectionContextMenu extends ChartEditorBaseContextMenu { var contextmenuOffset:NumberStepper; diff --git a/source/funkin/ui/debug/charting/dialogs/ChartEditorBaseDialog.hx b/source/funkin/ui/debug/charting/dialogs/ChartEditorBaseDialog.hx index cff3639ff..9d35d7103 100644 --- a/source/funkin/ui/debug/charting/dialogs/ChartEditorBaseDialog.hx +++ b/source/funkin/ui/debug/charting/dialogs/ChartEditorBaseDialog.hx @@ -13,7 +13,6 @@ class ChartEditorBaseDialog extends Dialog { var chartEditorState:ChartEditorState; var params:DialogParams; - var locked:Bool = false; public function new(chartEditorState:ChartEditorState, params:DialogParams) diff --git a/source/funkin/ui/debug/charting/dialogs/ChartEditorCharacterIconSelectorMenu.hx b/source/funkin/ui/debug/charting/dialogs/ChartEditorCharacterIconSelectorMenu.hx index 56e86792b..bf1e75974 100644 --- a/source/funkin/ui/debug/charting/dialogs/ChartEditorCharacterIconSelectorMenu.hx +++ b/source/funkin/ui/debug/charting/dialogs/ChartEditorCharacterIconSelectorMenu.hx @@ -16,8 +16,7 @@ import flixel.tweens.FlxEase; import haxe.ui.components.Button; // @:nullSafety // TODO: Fix null safety when used with HaxeUI build macros. -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/dialogs/character-icon-selector.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/dialogs/character-icon-selector.xml")) class ChartEditorCharacterIconSelectorMenu extends ChartEditorBaseMenu { public var charSelectScroll:ScrollView; @@ -49,18 +48,25 @@ class ChartEditorCharacterIconSelectorMenu extends ChartEditorBaseMenu { currentCharId = switch (charType) { - case BF: chartEditorState.currentSongMetadata.playData.characters.player; - case GF: chartEditorState.currentSongMetadata.playData.characters.girlfriend; - case DAD: chartEditorState.currentSongMetadata.playData.characters.opponent; - default: throw 'Invalid charType: ' + charType; + case BF: + chartEditorState.currentSongMetadata.playData.characters.player; + case GF: + chartEditorState.currentSongMetadata.playData.characters.girlfriend; + case DAD: + chartEditorState.currentSongMetadata.playData.characters.opponent; + default: + throw 'Invalid charType: ' + charType; }; // Position this menu. var targetHealthIcon:Null = switch (charType) { - case BF: chartEditorState.healthIconBF; - case DAD: chartEditorState.healthIconDad; - default: null; + case BF: + chartEditorState.healthIconBF; + case DAD: + chartEditorState.healthIconDad; + default: + null; }; if (lockPosition && targetHealthIcon != null) @@ -120,11 +126,13 @@ class ChartEditorCharacterIconSelectorMenu extends ChartEditorBaseMenu case BF: chartEditorState.currentSongMetadata.playData.characters.player = charId; chartEditorState.playerPreviewDirty = true; - case GF: chartEditorState.currentSongMetadata.playData.characters.girlfriend = charId; + case GF: + chartEditorState.currentSongMetadata.playData.characters.girlfriend = charId; case DAD: chartEditorState.currentSongMetadata.playData.characters.opponent = charId; chartEditorState.opponentPreviewDirty = true; - default: throw 'Invalid charType: ' + charType; + default: + throw 'Invalid charType: ' + charType; }; defaultText = (charId != "") ? '${charData.name} [${charId}]' : 'None'; diff --git a/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx b/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx index b821f396c..db07c501e 100644 --- a/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx +++ b/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadChartDialog.hx @@ -10,8 +10,7 @@ import haxe.ui.containers.dialogs.Dialog.DialogButton; import haxe.ui.containers.dialogs.Dialog.DialogEvent; // @:nullSafety // TODO: Fix null safety when used with HaxeUI build macros. -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/dialogs/upload-chart.xml")) -@:access(funkin.ui.debug.charting.ChartEditorState) +@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/dialogs/upload-chart.xml")) @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorUploadChartDialog extends ChartEditorBaseDialog { var dropHandlers:Array = []; diff --git a/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadVocalsDialog.hx b/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadVocalsDialog.hx index dfb8ae66b..275eb0f6b 100644 --- a/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadVocalsDialog.hx +++ b/source/funkin/ui/debug/charting/dialogs/ChartEditorUploadVocalsDialog.hx @@ -17,17 +17,14 @@ import haxe.ui.core.Component; // @:nullSafety // TODO: Fix null safety when used with HaxeUI build macros. -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/dialogs/upload-vocals.xml")) -@:access(funkin.ui.debug.charting.ChartEditorState) +@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/dialogs/upload-vocals.xml")) @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorUploadVocalsDialog extends ChartEditorBaseDialog { var dropHandlers:Array = []; - var vocalContainer:Component; var dialogCancel:Button; var dialogNoVocals:Button; var dialogContinue:Button; - var charIds:Array; var instId:String; var hasClearedVocals:Bool = false; diff --git a/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx b/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx index f1db0f5be..1ff254281 100644 --- a/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx +++ b/source/funkin/ui/debug/charting/dialogs/ChartEditorWelcomeDialog.hx @@ -17,8 +17,7 @@ import haxe.ui.events.MouseEvent; * Builds and opens a dialog letting the user create a new chart, open a recent chart, or load from a template. * Opens when the chart editor first opens. */ -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/dialogs/welcome.xml")) -@:access(funkin.ui.debug.charting.ChartEditorState) +@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/dialogs/welcome.xml")) @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorWelcomeDialog extends ChartEditorBaseDialog { /** diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx index c85651299..131dccfd5 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorAudioHandler.hx @@ -18,8 +18,7 @@ import haxe.io.Path; * Functions for loading audio for the chart editor. * Handlers split up the functionality of the Chart Editor into different classes based on focus to limit the amount of code in each class. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorAudioHandler { /** @@ -244,6 +243,7 @@ class ChartEditorAudioHandler } // initializes a waveform sprite with buncho non-charType specific things + static function initWaveformSprite(waveformData:WaveformData, state:ChartEditorState, charType:CharacterType):WaveformSprite { var waveformSprite:WaveformSprite = new WaveformSprite(waveformData, VERTICAL, FlxColor.WHITE); diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorContextMenuHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorContextMenuHandler.hx index 0bd82862f..cfd1e0866 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorContextMenuHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorContextMenuHandler.hx @@ -15,8 +15,7 @@ import haxe.ui.events.UIEvent; /** * Handles context menus (the little menus that appear when you right click on stuff) for the new Chart Editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorContextMenuHandler { static var existingMenu:Null; diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorDialogHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorDialogHandler.hx index 64b8b6d8d..6f7d6314d 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorDialogHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorDialogHandler.hx @@ -49,8 +49,7 @@ using Lambda; /** * Handles dialogs for the new Chart Editor. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorDialogHandler { // Paths to HaxeUI layout files for each dialog. @@ -694,7 +693,8 @@ class ChartEditorDialogHandler var inputAlbum:Null = dialog.findComponent('inputAlbum', DropDown); if (inputAlbum == null) throw 'Could not locate inputAlbum DropDown in Song Metadata dialog'; - inputAlbum.onChange = (event:UIEvent) -> { + inputAlbum.onChange = (event:UIEvent) -> + { if (event.data?.id == null) return; newSongMetadata.playData.album = event.data.id; }; @@ -703,7 +703,8 @@ class ChartEditorDialogHandler var inputStickerPack:Null = dialog.findComponent('inputStickerPack', DropDown); if (inputStickerPack == null) throw 'Could not locate inputStickerPack DropDown in Song Metadata dialog'; - inputStickerPack.onChange = (event:UIEvent) -> { + inputStickerPack.onChange = (event:UIEvent) -> + { if (event.data?.id == null) return; newSongMetadata.playData.stickerPack = event.data.id; }; @@ -752,7 +753,9 @@ class ChartEditorDialogHandler var timeChanges:Array = newSongMetadata.timeChanges; if (timeChanges == null || timeChanges.length == 0) { - timeChanges = [new SongTimeChange(0, event.value)]; + timeChanges = [ + new SongTimeChange(0, event.value) + ]; } else { @@ -1126,10 +1129,14 @@ class ChartEditorDialogHandler var prettyFormat:String = switch (format) { - case 'legacy': 'FNF Legacy'; - case 'stepmania': 'StepMania'; - case 'osumania': 'osu!Mania'; - default: 'Unknown'; + case 'legacy': + 'FNF Legacy'; + case 'stepmania': + 'StepMania'; + case 'osumania': + 'osu!Mania'; + default: + 'Unknown'; } var fileFilter = switch (format) @@ -1140,7 +1147,8 @@ class ChartEditorDialogHandler [FileUtil.FILE_FILTER_SM]; case 'osumania': [FileUtil.FILE_FILTER_OSU]; - default: null; + default: + null; } var fileExt:String = switch (format) @@ -1149,7 +1157,8 @@ class ChartEditorDialogHandler "osu"; case 'stepmania': "sm"; - default: "json"; + default: + "json"; } dialog.title = 'Import Chart - ${prettyFormat}'; @@ -1262,7 +1271,11 @@ class ChartEditorDialogHandler state.error('Failure', 'Failed to load song (${path.file}.${path.ext})'); return; } - state.loadSong([Constants.DEFAULT_VARIATION => songMetadata], [Constants.DEFAULT_VARIATION => songChartData]); + state.loadSong([ + Constants.DEFAULT_VARIATION => songMetadata + ], [ + Constants.DEFAULT_VARIATION => songChartData + ]); dialog.hideDialog(DialogButton.APPLY); state.success('Success', '$loadedText (${path.file}.${path.ext})'); diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx index a7497c550..e3c32818e 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorImportExportHandler.hx @@ -19,8 +19,7 @@ import thx.semver.Version as SemverVersion; /** * Contains functions for importing, loading, saving, and exporting charts. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorImportExportHandler { public static final BACKUPS_PATH:String = './backups/charts/'; @@ -100,7 +99,7 @@ class ChartEditorImportExportHandler { state.loadVocalsFromAsset(voiceFile, diff.characters.player, instId); state.audioVocalTrackGroup.legacyVoiceSystem = true; - state.audioVocalTrackGroup.legacyVoiceUsesPlayer = true; + state.audioVocalTrackGroup.legacyVoiceUsesPlayer = true; } } @@ -177,7 +176,13 @@ class ChartEditorImportExportHandler if (stackedNotesCount > 0) { // Difficulty names might be out of order due to how maps work - affectedDiffs.sort(SortUtil.defaultsThenAlphabetically.bind(['Easy', 'Normal', 'Hard', 'Erect', 'Nightmare'])); + affectedDiffs.sort(SortUtil.defaultsThenAlphabetically.bind([ + 'Easy', + 'Normal', + 'Hard', + 'Erect', + 'Nightmare' + ])); // Delay it so it doesn't overlap other notifications flixel.util.FlxTimer.wait(delay, () -> @@ -496,7 +501,10 @@ class ChartEditorImportExportHandler // Force writing to a generic path (autosave or crash recovery) targetMode = Skip; if (state.currentSongId == '') state.currentSongName = 'New Chart'; // Hopefully no one notices this silliness - targetPath = Path.join([BACKUPS_PATH, 'chart-editor-${state.currentSongId}-${DateUtil.generateTimestamp()}.${Constants.EXT_CHART}']); + targetPath = Path.join([ + BACKUPS_PATH, + 'chart-editor-${state.currentSongId}-${DateUtil.generateTimestamp()}.${Constants.EXT_CHART}' + ]); // We have to force write because the program will die before the save dialog is closed. trace('Force exporting to $targetPath...'); try diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorNotificationHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorNotificationHandler.hx index fcf131939..e65df4404 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorNotificationHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorNotificationHandler.hx @@ -24,6 +24,7 @@ class ChartEditorNotificationHandler // since GUTTER_SIZE affects both x and y, we'll replace the positioning with this! // for some reason the first notif always has a downwards offset of like 10 and idk how to fix that // that was also a problem before this + public static function AnimateFromBottom(notifications:Array):Array { var builders = []; diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorThemeHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorThemeHandler.hx index c97e29b70..9f983db14 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorThemeHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorThemeHandler.hx @@ -14,8 +14,7 @@ import openfl.geom.Rectangle; /** * Static functions which handle building themed UI elements for a provided ChartEditorState. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorThemeHandler { // TODO: There's probably a better system of organization for these colors. @@ -23,32 +22,25 @@ class ChartEditorThemeHandler // ================================ static final BACKGROUND_COLOR_LIGHT:FlxColor = 0xFF673AB7; static final BACKGROUND_COLOR_DARK:FlxColor = 0xFF361E60; - // Color 1 of the grid pattern. Alternates with Color 2. public static final GRID_COLOR_1_LIGHT:FlxColor = 0xFFE7E6E6; public static final GRID_COLOR_1_DARK:FlxColor = 0xFF181919; - // Color 2 of the grid pattern. Alternates with Color 1. public static final GRID_COLOR_2_LIGHT:FlxColor = 0xFFF8F8F8; public static final GRID_COLOR_2_DARK:FlxColor = 0xFF202020; - // Color 3 of the grid pattern. Borders the other colors. public static final GRID_COLOR_3_LIGHT:FlxColor = 0xFFD9D5D5; public static final GRID_COLOR_3_DARK:FlxColor = 0xFF262A2A; - // Vertical divider between characters. public static final GRID_STRUMLINE_DIVIDER_COLOR_LIGHT:FlxColor = 0xFF111111; public static final GRID_STRUMLINE_DIVIDER_COLOR_DARK:FlxColor = 0xFFC4C4C4; static final GRID_STRUMLINE_DIVIDER_WIDTH:Float = ChartEditorState.GRID_SELECTION_BORDER_WIDTH; - // Horizontal divider between measures. public static final GRID_MEASURE_DIVIDER_COLOR_LIGHT:FlxColor = 0xFF111111; public static final GRID_MEASURE_DIVIDER_COLOR_DARK:FlxColor = 0xFFC4C4C4; static final GRID_MEASURE_DIVIDER_WIDTH:Float = ChartEditorState.GRID_SELECTION_BORDER_WIDTH; - public static final MEASTURE_TICKS_BACKING_COLOR_LIGHT:FlxColor = 0xFFC1C1C1; public static final MEASTURE_TICKS_BACKING_COLOR_DARK:FlxColor = 0xFF484848; - // Border on the square highlighting selected notes. static final SELECTION_SQUARE_BORDER_COLOR_LIGHT:FlxColor = 0xFF339933; static final SELECTION_SQUARE_BORDER_COLOR_DARK:FlxColor = 0xFF339933; @@ -62,24 +54,19 @@ class ChartEditorThemeHandler // Make sure this is transparent so you can see the notes underneath. static final SELECTION_SQUARE_FILL_COLOR_LIGHT:FlxColor = 0x4033FF33; static final SELECTION_SQUARE_FILL_COLOR_DARK:FlxColor = 0x4033FF33; - static final PLAYHEAD_BLOCK_BORDER_WIDTH:Int = 2; static final PLAYHEAD_BLOCK_BORDER_COLOR:FlxColor = 0xFF9D0011; static final PLAYHEAD_BLOCK_FILL_COLOR:FlxColor = 0xFFBD0231; - // Lines on the measure ticks. public static final MEASURE_TICKS_MEASURE_WIDTH:Int = 6; public static final MEASURE_TICKS_BEAT_WIDTH:Int = 4; public static final MEASURE_TICKS_STEP_WIDTH:Int = 2; - // Border on the square over the note preview. static final NOTE_PREVIEW_VIEWPORT_BORDER_COLOR_LIGHT = 0xFFF8A657; static final NOTE_PREVIEW_VIEWPORT_BORDER_COLOR_DARK = 0xFFF8A657; - // Fill on the square over the note preview. static final NOTE_PREVIEW_VIEWPORT_FILL_COLOR_LIGHT = 0x80F8A657; static final NOTE_PREVIEW_VIEWPORT_FILL_COLOR_DARK = 0x80F8A657; - public static final TOTAL_COLUMN_COUNT:Int = ChartEditorState.STRUMLINE_SIZE * 2 + 1; /** @@ -105,9 +92,12 @@ class ChartEditorThemeHandler if (state.menuBG == null) return; state.menuBG.color = switch (state.currentTheme) { - case ChartEditorTheme.Light: BACKGROUND_COLOR_LIGHT; - case ChartEditorTheme.Dark: BACKGROUND_COLOR_DARK; - default: BACKGROUND_COLOR_LIGHT; + case ChartEditorTheme.Light: + BACKGROUND_COLOR_LIGHT; + case ChartEditorTheme.Dark: + BACKGROUND_COLOR_DARK; + default: + BACKGROUND_COLOR_LIGHT; } } @@ -119,23 +109,32 @@ class ChartEditorThemeHandler { var gridColor1:FlxColor = switch (state.currentTheme) { - case Light: GRID_COLOR_1_LIGHT; - case Dark: GRID_COLOR_1_DARK; - default: GRID_COLOR_1_LIGHT; + case Light: + GRID_COLOR_1_LIGHT; + case Dark: + GRID_COLOR_1_DARK; + default: + GRID_COLOR_1_LIGHT; }; var gridColor2:FlxColor = switch (state.currentTheme) { - case Light: GRID_COLOR_2_LIGHT; - case Dark: GRID_COLOR_2_DARK; - default: GRID_COLOR_2_LIGHT; + case Light: + GRID_COLOR_2_LIGHT; + case Dark: + GRID_COLOR_2_DARK; + default: + GRID_COLOR_2_LIGHT; }; var dividerColor:FlxColor = switch (state.currentTheme) { - case Light: GRID_STRUMLINE_DIVIDER_COLOR_LIGHT; - case Dark: GRID_STRUMLINE_DIVIDER_COLOR_DARK; - default: GRID_STRUMLINE_DIVIDER_COLOR_LIGHT; + case Light: + GRID_STRUMLINE_DIVIDER_COLOR_LIGHT; + case Dark: + GRID_STRUMLINE_DIVIDER_COLOR_DARK; + default: + GRID_STRUMLINE_DIVIDER_COLOR_LIGHT; } // Draw the base grid. @@ -149,9 +148,12 @@ class ChartEditorThemeHandler // Selection borders var selectionBorderColor:FlxColor = switch (state.currentTheme) { - case Light: GRID_COLOR_3_LIGHT; - case Dark: GRID_COLOR_3_DARK; - default: GRID_COLOR_3_LIGHT; + case Light: + GRID_COLOR_3_LIGHT; + case Dark: + GRID_COLOR_3_DARK; + default: + GRID_COLOR_3_LIGHT; }; // Selection border at top. @@ -249,16 +251,22 @@ class ChartEditorThemeHandler { var selectionSquareBorderColor:FlxColor = switch (state.currentTheme) { - case Light: SELECTION_SQUARE_BORDER_COLOR_LIGHT; - case Dark: SELECTION_SQUARE_BORDER_COLOR_DARK; - default: SELECTION_SQUARE_BORDER_COLOR_LIGHT; + case Light: + SELECTION_SQUARE_BORDER_COLOR_LIGHT; + case Dark: + SELECTION_SQUARE_BORDER_COLOR_DARK; + default: + SELECTION_SQUARE_BORDER_COLOR_LIGHT; }; var selectionSquareFillColor:FlxColor = switch (state.currentTheme) { - case Light: SELECTION_SQUARE_FILL_COLOR_LIGHT; - case Dark: SELECTION_SQUARE_FILL_COLOR_DARK; - default: SELECTION_SQUARE_FILL_COLOR_LIGHT; + case Light: + SELECTION_SQUARE_FILL_COLOR_LIGHT; + case Dark: + SELECTION_SQUARE_FILL_COLOR_DARK; + default: + SELECTION_SQUARE_FILL_COLOR_LIGHT; }; state.selectionSquareBitmap = new BitmapData(ChartEditorState.GRID_SIZE, ChartEditorState.GRID_SIZE, true); @@ -288,16 +296,22 @@ class ChartEditorThemeHandler { var viewportBorderColor:FlxColor = switch (state.currentTheme) { - case Light: NOTE_PREVIEW_VIEWPORT_BORDER_COLOR_LIGHT; - case Dark: NOTE_PREVIEW_VIEWPORT_BORDER_COLOR_DARK; - default: NOTE_PREVIEW_VIEWPORT_BORDER_COLOR_LIGHT; + case Light: + NOTE_PREVIEW_VIEWPORT_BORDER_COLOR_LIGHT; + case Dark: + NOTE_PREVIEW_VIEWPORT_BORDER_COLOR_DARK; + default: + NOTE_PREVIEW_VIEWPORT_BORDER_COLOR_LIGHT; }; var viewportFillColor:FlxColor = switch (state.currentTheme) { - case Light: NOTE_PREVIEW_VIEWPORT_FILL_COLOR_LIGHT; - case Dark: NOTE_PREVIEW_VIEWPORT_FILL_COLOR_DARK; - default: NOTE_PREVIEW_VIEWPORT_FILL_COLOR_LIGHT; + case Light: + NOTE_PREVIEW_VIEWPORT_FILL_COLOR_LIGHT; + case Dark: + NOTE_PREVIEW_VIEWPORT_FILL_COLOR_DARK; + default: + NOTE_PREVIEW_VIEWPORT_FILL_COLOR_LIGHT; }; state.notePreviewViewportBitmap = new BitmapData(ChartEditorState.GRID_SIZE, ChartEditorState.GRID_SIZE, true); diff --git a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx index a9eb996ed..92b440c7f 100644 --- a/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx +++ b/source/funkin/ui/debug/charting/handlers/ChartEditorToolboxHandler.hx @@ -19,8 +19,7 @@ import funkin.ui.debug.charting.toolboxes.ChartEditorDifficultyToolbox; /** * Static functions which handle building themed UI elements for a provided ChartEditorState. */ -@:nullSafety -@:access(funkin.ui.debug.charting.ChartEditorState) +@:nullSafety @:access(funkin.ui.debug.charting.ChartEditorState) class ChartEditorToolboxHandler { public static function setToolboxState(state:ChartEditorState, id:String, shown:Bool):Void diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorDifficultyToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorDifficultyToolbox.hx index 25c9a38e9..793e41fa2 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorDifficultyToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorDifficultyToolbox.hx @@ -30,8 +30,7 @@ import haxe.ui.events.UIEvent; * and adding/removing variations and difficulties. */ // @:nullSafety // TODO: Fix null safety when used with HaxeUI build macros. -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/difficulty.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/difficulty.xml")) class ChartEditorDifficultyToolbox extends ChartEditorBaseToolbox { var difficultyToolboxTree:TreeView; diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorEventDataToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorEventDataToolbox.hx index e64a35b14..994081268 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorEventDataToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorEventDataToolbox.hx @@ -31,16 +31,13 @@ import flixel.FlxG; /** * The toolbox which allows modifying information like Song Title, Scroll Speed, Characters/Stages, and starting BPM. */ -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/event-data.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/event-data.xml")) class ChartEditorEventDataToolbox extends ChartEditorBaseToolbox { var toolboxEventsEventKind:DropDown; var toolboxEventsDataBox:VBox; - var easeGraphImage:Image; var easeDotImage:Image; - var _easeGraphSprite:Null = null; var _easeDotSprites:Array = []; var _dotTimer:Null = null; diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorFreeplayToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorFreeplayToolbox.hx index e9f68243b..9724da6ca 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorFreeplayToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorFreeplayToolbox.hx @@ -21,8 +21,7 @@ import haxe.ui.events.UIEvent; * The toolbox which allows modifying information like Song Title, Scroll Speed, Characters/Stages, and starting BPM. */ // @:nullSafety // TODO: Fix null safety when used with HaxeUI build macros. -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/freeplay.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/freeplay.xml")) class ChartEditorFreeplayToolbox extends ChartEditorBaseToolbox { var waveformContainer:Absolute; @@ -40,18 +39,14 @@ class ChartEditorFreeplayToolbox extends ChartEditorBaseToolbox var previewSelectionSprite:SpriteWrapper; static final TICK_LABEL_X_OFFSET:Float = 4.0; - static final PLAYHEAD_RIGHT_PAD:Float = 10.0; - static final BASE_SCALE:Float = 64.0; static final STARTING_SCALE:Float = 1024.0; static final MIN_SCALE:Float = 4.0; static final WAVEFORM_ZOOM_MULT:Float = 1.5; - static final MAGIC_SCALE_BASE_TIME:Float = 5.0; var waveformScale:Float = STARTING_SCALE; - var playheadAbsolutePos(get, set):Float; function get_playheadAbsolutePos():Float @@ -107,9 +102,7 @@ class ChartEditorFreeplayToolbox extends ChartEditorBaseToolbox var waveformMagicFactor:Float = 1.0; var audioPreviewTracks:SoundGroup; - var tickTiledSprite:FlxTiledSprite; - var freeplayPreviewVolume(get, null):Float; function get_freeplayPreviewVolume():Float @@ -377,7 +370,6 @@ class ChartEditorFreeplayToolbox extends ChartEditorBaseToolbox } var waveformDragStartPos:Null = null; - var waveformDragPreviewStartPos:Float; var waveformDragPreviewEndPos:Float; diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx index e576222e6..d6f4759f5 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorMetadataToolbox.hx @@ -27,8 +27,7 @@ import haxe.ui.events.UIEvent; * The toolbox which allows modifying information like Song Title, Scroll Speed, Characters/Stages, and starting BPM. */ // @:nullSafety // TODO: Fix null safety when used with HaxeUI build macros. -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/metadata.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/metadata.xml")) class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox { var inputSongId:TextField; @@ -158,7 +157,8 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox var startingValueNoteStyle = ChartEditorDropdowns.populateDropdownWithNoteStyles(inputNoteStyle, chartEditorState.currentSongMetadata.playData.noteStyle); inputNoteStyle.value = startingValueNoteStyle; - inputAlbum.onChange = (event:UIEvent) -> { + inputAlbum.onChange = (event:UIEvent) -> + { var valid:Bool = event.data != null && event.data.id != null; if (valid) @@ -169,7 +169,8 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox var startingValueAlbum = ChartEditorDropdowns.populateDropdownWithAlbums(inputAlbum, chartEditorState.currentSongMetadata.playData?.album); inputAlbum.value = startingValueAlbum; - inputStickerPack.onChange = (event:UIEvent) -> { + inputStickerPack.onChange = (event:UIEvent) -> + { var valid:Bool = event.data != null && event.data.id != null; if (valid) @@ -177,19 +178,24 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox chartEditorState.currentSongStickerPack = event.data.id; } } - var startingValueStickerPack = ChartEditorDropdowns.populateDropdownWithStickerPacks(inputStickerPack, chartEditorState.currentSongMetadata.playData?.stickerPack); + var startingValueStickerPack = ChartEditorDropdowns.populateDropdownWithStickerPacks(inputStickerPack, + chartEditorState.currentSongMetadata.playData?.stickerPack); inputStickerPack.value = startingValueStickerPack; inputTimeChange.onChange = function(event:UIEvent) { var currentTimeChange = refreshTimeChangeInputs(); - var previousTimeChange = chartEditorState.currentSongMetadata.timeChanges[inputTimeChange.selectedIndex - 1]; + var previousTimeChange = chartEditorState.currentSongMetadata.timeChanges[ + inputTimeChange.selectedIndex - 1 + ]; // Set the step of the timestamp to the step. inputTimeStamp.step = ((Constants.SECS_PER_MIN / (previousTimeChange?.bpm ?? currentTimeChange?.bpm ?? 100)) * Constants.MS_PER_SEC) * (4 / (previousTimeChange?.timeSignatureDen ?? currentTimeChange?.timeSignatureDen ?? 4)) / Constants.STEPS_PER_BEAT; // Set the min max values of the input timestamp to previous and next time change timestamps to in the array, // to prevent the conductor from breaking due to time change timestamps not being in ascending order. inputTimeStamp.min = (previousTimeChange?.timeStamp ?? 0); - inputTimeStamp.max = (chartEditorState.currentSongMetadata.timeChanges[inputTimeChange.selectedIndex + 1]?.timeStamp ?? chartEditorState.songLengthInMs); + inputTimeStamp.max = (chartEditorState.currentSongMetadata.timeChanges[ + inputTimeChange.selectedIndex + 1 + ]?.timeStamp ?? chartEditorState.songLengthInMs); inputTimeStamp.max -= 1; // Prevent the inital time change timestamp from being modified (it should always be 0) or removed. @@ -323,6 +329,7 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox } // Separate function because it needs to be refreshed in some of the time change commands, updating the entire toolbox would be wasteful. + public function refreshTimeChanges(startingTimeChangeIndex:Int = 0):Void { // Reset time change dropdown and the associated inputs @@ -390,9 +397,7 @@ class ChartEditorMetadataToolbox extends ChartEditorBaseToolbox var album:Null = AlbumRegistry.instance.fetchEntry(albumId); if (inputAlbum != null) { - inputAlbum.value = (album != null) ? - {id: album.id, text: album.getAlbumName()} : - {id: "volume1", text: "Volume 1"}; + inputAlbum.value = (album != null) ? {id: album.id, text: album.getAlbumName()} : {id: "volume1", text: "Volume 1"}; } var LIMIT = 6; diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorNoteDataToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorNoteDataToolbox.hx index 6a6c10d41..5d382d4b0 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorNoteDataToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorNoteDataToolbox.hx @@ -17,18 +17,15 @@ import funkin.data.song.SongData.NoteParamData; /** * The toolbox which allows modifying information like Note Kind. */ -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/note-data.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/note-data.xml")) class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox { // 100 is the height used in note-data.xml static final DIALOG_HEIGHT:Int = 100; - // toolboxNotesGrid.height + 45 // this is what i found out by printing this.height and grid.height // and then seeing that this.height is 100 and grid.height is 55 static final HEIGHT_OFFSET:Int = 45; - // minimizing creates a gray bar the bottom, which would obscure the components, // which is why we use an extra offset of 20 static final MINIMIZE_FIX:Int = 20; @@ -37,7 +34,6 @@ class ChartEditorNoteDataToolbox extends ChartEditorBaseToolbox var toolboxNotesNoteKind:DropDown; var toolboxNotesCustomKind:TextField; var toolboxNotesParams:Array = []; - var _initializing:Bool = true; public function new(chartEditorState2:ChartEditorState) diff --git a/source/funkin/ui/debug/charting/toolboxes/ChartEditorOffsetsToolbox.hx b/source/funkin/ui/debug/charting/toolboxes/ChartEditorOffsetsToolbox.hx index 69f15de58..a6c17ac5d 100644 --- a/source/funkin/ui/debug/charting/toolboxes/ChartEditorOffsetsToolbox.hx +++ b/source/funkin/ui/debug/charting/toolboxes/ChartEditorOffsetsToolbox.hx @@ -21,8 +21,7 @@ import haxe.ui.events.UIEvent; */ // @:nullSafety // TODO: Fix null safety when used with HaxeUI build macros. -@:access(funkin.ui.debug.charting.ChartEditorState) -@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/offsets.xml")) +@:access(funkin.ui.debug.charting.ChartEditorState) @:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/toolboxes/offsets.xml")) class ChartEditorOffsetsToolbox extends ChartEditorBaseToolbox { var waveformContainer:Absolute; @@ -42,17 +41,13 @@ class ChartEditorOffsetsToolbox extends ChartEditorBaseToolbox var playheadSprite:SpriteWrapper; static final TICK_LABEL_X_OFFSET:Float = 4.0; - static final PLAYHEAD_RIGHT_PAD:Float = 10.0; - static final BASE_SCALE:Float = 64.0; static final MIN_SCALE:Float = 4.0; static final WAVEFORM_ZOOM_MULT:Float = 1.5; - static final MAGIC_SCALE_BASE_TIME:Float = 5.0; var waveformScale:Float = BASE_SCALE; - var playheadAbsolutePos(get, set):Float; function get_playheadAbsolutePos():Float @@ -83,11 +78,8 @@ class ChartEditorOffsetsToolbox extends ChartEditorBaseToolbox var waveformMagicFactor:Float = 1.0; var audioPreviewTracks:SoundGroup; - var tickTiledSprite:FlxTiledSprite; - var tickLabels:Array