From d344741f85ca4eca5e399ffa86bda122e5c8e0db Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Wed, 1 Apr 2026 14:36:47 -0400 Subject: [PATCH] Tweaks to for loops --- source/funkin/FunkinMemory.hx | 14 ++++++- source/funkin/api/newgrounds/Medals.hx | 3 +- .../audio/visualize/SpectogramSprite.hx | 3 +- source/funkin/audio/visualize/VisShit.hx | 3 +- source/funkin/audio/visualize/dsp/FFT.hx | 18 +++----- source/funkin/audio/visualize/dsp/Signal.hx | 3 +- .../audio/waveform/WaveformDataParser.hx | 2 + source/funkin/data/DataParse.hx | 14 +++---- source/funkin/data/song/SongDataUtils.hx | 6 +-- .../data/song/importer/ChartManifestData.hx | 3 +- .../data/song/importer/FNFLegacyImporter.hx | 3 +- .../data/song/importer/StepManiaImporter.hx | 9 ++-- .../graphics/shaders/RuntimeRainShader.hx | 11 +++-- source/funkin/input/Controls.hx | 6 +-- source/funkin/modding/PolymodHandler.hx | 3 +- source/funkin/play/PlayState.hx | 3 +- source/funkin/play/components/TallyCounter.hx | 3 +- source/funkin/play/event/SongEventHelper.hx | 42 +++++++++---------- .../funkin/play/notes/notestyle/NoteStyle.hx | 3 +- .../funkin/ui/credits/CreditsDataHandler.hx | 3 +- .../ui/debug/charting/ChartEditorState.hx | 15 +++---- .../charting/commands/MoveEventsCommand.hx | 3 +- .../charting/commands/MoveNotesCommand.hx | 3 +- .../funkin/ui/debug/latency/CoolStatsGraph.hx | 3 +- .../ui/debug/stageeditor/StageEditorState.hx | 15 +++---- .../stageeditor/components/NewObjDialog.hx | 3 +- .../StageEditorObjectAnimsToolbox.hx | 8 ++-- source/funkin/ui/freeplay/DifficultyStars.hx | 3 +- source/funkin/ui/freeplay/FreeplayState.hx | 3 +- source/funkin/ui/freeplay/LetterSort.hx | 3 +- .../ui/freeplay/dj/MultiSparrowFreeplayDJ.hx | 2 + source/funkin/ui/options/ControlsMenu.hx | 6 +-- source/funkin/ui/options/FunkinSoundTray.hx | 3 +- source/funkin/ui/options/OffsetMenu.hx | 3 +- .../ui/transition/preload/FunkinPreloader.hx | 9 ++-- .../ui/transition/stickers/StickerSubState.hx | 3 +- source/funkin/util/logging/AnsiTrace.hx | 6 +-- source/funkin/util/tools/ArrayTools.hx | 7 ++-- source/funkin/util/tools/IteratorTools.hx | 8 ++-- source/funkin/util/tools/MapTools.hx | 2 +- 40 files changed, 108 insertions(+), 155 deletions(-) diff --git a/source/funkin/FunkinMemory.hx b/source/funkin/FunkinMemory.hx index 23c6d8f61..74e673d0a 100644 --- a/source/funkin/FunkinMemory.hx +++ b/source/funkin/FunkinMemory.hx @@ -341,9 +341,14 @@ class FunkinMemory } var sound:Null = Assets.getSound(key, true); - if (sound == null) return; + if (sound == null) + { + return; + } else + { currentCachedSounds.set(key, sound); + } } /** @@ -355,9 +360,14 @@ class FunkinMemory if (permanentCachedSounds.exists(key)) return; var sound:Null = Assets.getSound(key, true); - if (sound == null) return; + if (sound == null) + { + return; + } else + { permanentCachedSounds.set(key, sound); + } if (sound != null) currentCachedSounds.set(key, sound); } diff --git a/source/funkin/api/newgrounds/Medals.hx b/source/funkin/api/newgrounds/Medals.hx index 3e58f7f76..97ab0eecc 100644 --- a/source/funkin/api/newgrounds/Medals.hx +++ b/source/funkin/api/newgrounds/Medals.hx @@ -122,8 +122,7 @@ class Medals if (parser.errors.length > 0) { trace(' NEWGROUNDS '.bold().bg_orange() + ' Failed to parse local medal data!'); - for (error in parser.errors) - funkin.data.DataError.printError(error); + for (error in parser.errors) funkin.data.DataError.printError(error); medalJSON = []; } else diff --git a/source/funkin/audio/visualize/SpectogramSprite.hx b/source/funkin/audio/visualize/SpectogramSprite.hx index d58224660..b4ca12241 100644 --- a/source/funkin/audio/visualize/SpectogramSprite.hx +++ b/source/funkin/audio/visualize/SpectogramSprite.hx @@ -190,8 +190,7 @@ class SpectogramSprite extends FlxTypedSpriteGroup var freqPower:Float = 0; - for (pow in 0...freqShit.length) - freqPower += freqShit[pow][remappedFreq]; + for (pow in 0...freqShit.length) freqPower += freqShit[pow][remappedFreq]; freqPower /= freqShit.length; var freqIDK:Float = FlxMath.remapToRange(freqPower, 0, 0.000005, 0, 50); diff --git a/source/funkin/audio/visualize/VisShit.hx b/source/funkin/audio/visualize/VisShit.hx index 828f6a2a7..0bd45dc6b 100644 --- a/source/funkin/audio/visualize/VisShit.hx +++ b/source/funkin/audio/visualize/VisShit.hx @@ -65,8 +65,7 @@ class VisShit { // 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) + 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 diff --git a/source/funkin/audio/visualize/dsp/FFT.hx b/source/funkin/audio/visualize/dsp/FFT.hx index a9cd606e2..9661acece 100644 --- a/source/funkin/audio/visualize/dsp/FFT.hx +++ b/source/funkin/audio/visualize/dsp/FFT.hx @@ -48,8 +48,7 @@ class FFT { final n = nextPow2(input.length); var ts = [ - for (i in 0...n) - if (i < input.length) input[i] else Complex.zero + 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); @@ -127,22 +126,19 @@ 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() + 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() + 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] + 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); @@ -160,8 +156,7 @@ class FFT else { final freqs_err = [ - for (i in 0...freqs.length) - freqis[i] - freqs[i] + 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}'); @@ -170,8 +165,7 @@ class FFT // 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] + 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); diff --git a/source/funkin/audio/visualize/dsp/Signal.hx b/source/funkin/audio/visualize/dsp/Signal.hx index 619a65aaf..0f17e0cfe 100644 --- a/source/funkin/audio/visualize/dsp/Signal.hx +++ b/source/funkin/audio/visualize/dsp/Signal.hx @@ -48,8 +48,7 @@ class Signal var peaks = new Array(); final dy = [ - for (i in 1...y.length) - y[i] - y[i - 1] + for (i in 1...y.length) y[i] - y[i - 1] ]; for (i in 1...dy.length) { diff --git a/source/funkin/audio/waveform/WaveformDataParser.hx b/source/funkin/audio/waveform/WaveformDataParser.hx index 26388e140..0077b79ba 100644 --- a/source/funkin/audio/waveform/WaveformDataParser.hx +++ b/source/funkin/audio/waveform/WaveformDataParser.hx @@ -132,6 +132,8 @@ class WaveformDataParser trace('[WAVEFORM] Failed to parse waveform data: ${id}'); for (error in errors) + { funkin.data.DataError.printError(error); + } } } diff --git a/source/funkin/data/DataParse.hx b/source/funkin/data/DataParse.hx index c249ae94c..05fe0e040 100644 --- a/source/funkin/data/DataParse.hx +++ b/source/funkin/data/DataParse.hx @@ -224,9 +224,11 @@ class DataParse */ static function jsonArrayToDynamicArray(jsons:Array):Array> { - return [ + return[ for (json in jsons) + { Tools.getValue(json) + } ]; } @@ -235,9 +237,8 @@ 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}.'; @@ -299,9 +300,8 @@ 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/song/SongDataUtils.hx b/source/funkin/data/song/SongDataUtils.hx index 0e5082cc7..4b92eaf4a 100644 --- a/source/funkin/data/song/SongDataUtils.hx +++ b/source/funkin/data/song/SongDataUtils.hx @@ -34,8 +34,7 @@ class SongDataUtils }; var result = [ - for (i in 0...notes.length) - offsetNote(notes[i]) + for (i in 0...notes.length) offsetNote(notes[i]) ]; return result; } @@ -304,8 +303,7 @@ class SongDataUtils if (parser.errors.length > 0) { trace('[SongDataUtils] Error parsing note JSON data from clipboard.'); - for (error in parser.errors) - DataError.printError(error); + for (error in parser.errors) DataError.printError(error); return { valid: false, notes: [], diff --git a/source/funkin/data/song/importer/ChartManifestData.hx b/source/funkin/data/song/importer/ChartManifestData.hx index e39c9bca8..824dbd13e 100644 --- a/source/funkin/data/song/importer/ChartManifestData.hx +++ b/source/funkin/data/song/importer/ChartManifestData.hx @@ -88,8 +88,7 @@ class ChartManifestData { trace('[ChartManifest] Failed to parse chart file manifest'); - for (error in parser.errors) - DataError.printError(error); + for (error in parser.errors) DataError.printError(error); return null; } diff --git a/source/funkin/data/song/importer/FNFLegacyImporter.hx b/source/funkin/data/song/importer/FNFLegacyImporter.hx index e4a2a1188..5143692ab 100644 --- a/source/funkin/data/song/importer/FNFLegacyImporter.hx +++ b/source/funkin/data/song/importer/FNFLegacyImporter.hx @@ -21,8 +21,7 @@ class FNFLegacyImporter if (parser.errors.length > 0) { trace('[FNFLegacyImporter] Error parsing JSON data from ' + fileName + ':'); - for (error in parser.errors) - DataError.printError(error); + for (error in parser.errors) DataError.printError(error); return null; } return parser.value; diff --git a/source/funkin/data/song/importer/StepManiaImporter.hx b/source/funkin/data/song/importer/StepManiaImporter.hx index 078d4ce56..b6c953427 100644 --- a/source/funkin/data/song/importer/StepManiaImporter.hx +++ b/source/funkin/data/song/importer/StepManiaImporter.hx @@ -276,8 +276,7 @@ class StepManiaImporter var tps = parseTimingPointLine(line); if (tps != null) { - for (tp in tps) - result.TimingPoints.push(tp); + for (tp in tps) result.TimingPoints.push(tp); } return result; } @@ -287,8 +286,7 @@ class StepManiaImporter var sps = parseStopsLine(line); if (sps != null) { - for (sp in sps) - result.Stops.push(sp); + for (sp in sps) result.Stops.push(sp); } return result; } @@ -416,8 +414,7 @@ class StepManiaImporter { // end of measure var stepNotesInMeasure = parseMeasure(measure, currentMeasure); - for (stepNote in stepNotesInMeasure) - workingDiff.notes.push(stepNote); + for (stepNote in stepNotesInMeasure) workingDiff.notes.push(stepNote); measure = []; currentMeasure++; // end of StepNotes section diff --git a/source/funkin/graphics/shaders/RuntimeRainShader.hx b/source/funkin/graphics/shaders/RuntimeRainShader.hx index b1339baa0..ea692be1f 100644 --- a/source/funkin/graphics/shaders/RuntimeRainShader.hx +++ b/source/funkin/graphics/shaders/RuntimeRainShader.hx @@ -133,12 +133,11 @@ class RuntimeRainShader extends RuntimePostEffectShader 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), - } + for (i in 0...MAX_LIGHTS) { + position: addFloatUniform('lights[$i].position', 2), + color: addFloatUniform('lights[$i].color', 3), + radius: addFloatUniform('lights[$i].radius', 1), + } ]; } } diff --git a/source/funkin/input/Controls.hx b/source/funkin/input/Controls.hx index fc745290a..8446aae8b 100644 --- a/source/funkin/input/Controls.hx +++ b/source/funkin/input/Controls.hx @@ -844,8 +844,7 @@ class Controls extends FlxActionSet { case null: // add all - for (gamepad in controls.gamepadsAdded) - if (gamepadsAdded.indexOf(gamepad) == -1) gamepadsAdded.push(gamepad); + for (gamepad in controls.gamepadsAdded) if (gamepadsAdded.indexOf(gamepad) == -1) gamepadsAdded.push(gamepad); mergeKeyboardScheme(controls.keyboardScheme); @@ -1195,8 +1194,7 @@ class Controls extends FlxActionSet { gamepadsAdded.push(id); - for (control in buttonMap.keys()) - bindButtons(control, id, buttonMap[control]); + for (control in buttonMap.keys()) bindButtons(control, id, buttonMap[control]); } public function removeGamepad(deviceID:Int = FlxInputDeviceID.ALL):Void diff --git a/source/funkin/modding/PolymodHandler.hx b/source/funkin/modding/PolymodHandler.hx index e75c3455a..5abd4a6f5 100644 --- a/source/funkin/modding/PolymodHandler.hx +++ b/source/funkin/modding/PolymodHandler.hx @@ -599,8 +599,7 @@ class PolymodHandler public static function getAllModDirs():Array { var modDirs:Array = [ - for (i in getAllMods()) - i.dirName + for (i in getAllMods()) i.dirName ]; return modDirs; } diff --git a/source/funkin/play/PlayState.hx b/source/funkin/play/PlayState.hx index 4e36b599a..ea2cd0883 100644 --- a/source/funkin/play/PlayState.hx +++ b/source/funkin/play/PlayState.hx @@ -3015,8 +3015,7 @@ class PlayState extends MusicBeatSubState var notesByDirection:Array> = [[], [], [], []]; - for (note in notesInRange) - notesByDirection[note.direction].push(note); + for (note in notesInRange) notesByDirection[note.direction].push(note); while (inputPressQueue.length > 0) { diff --git a/source/funkin/play/components/TallyCounter.hx b/source/funkin/play/components/TallyCounter.hx index 4073b6748..a9677e8c8 100644 --- a/source/funkin/play/components/TallyCounter.hx +++ b/source/funkin/play/components/TallyCounter.hx @@ -85,8 +85,7 @@ class TallyNumber extends FlxSprite frames = Paths.getSparrowAtlas("resultScreen/tallieNumber"); - for (i in 0...10) - animation.addByPrefix(Std.string(i), i + " small", 24, false); + for (i in 0...10) animation.addByPrefix(Std.string(i), i + " small", 24, false); animation.play(Std.string(digit)); updateHitbox(); diff --git a/source/funkin/play/event/SongEventHelper.hx b/source/funkin/play/event/SongEventHelper.hx index cb7d728a3..2d3e9ec9c 100644 --- a/source/funkin/play/event/SongEventHelper.hx +++ b/source/funkin/play/event/SongEventHelper.hx @@ -27,18 +27,17 @@ class SongEventHelper public static function generateEaseGraphsBitmaps():Void { - for (ease in easeDirList) - for (dir in easeDirs) + for (ease in easeDirList) for (dir in easeDirs) + { + final func = getEaseFunc(ease, dir); + if (func == null) continue; + final key = ease + dir; + if (!easeBitmapMap.exists(key)) { - final func = getEaseFunc(ease, dir); - if (func == null) continue; - final key = ease + dir; - if (!easeBitmapMap.exists(key)) - { - final bd = createBitmapFromFunc(func, key); - if (bd != null) easeBitmapMap.set(key, bd); - } + final bd = createBitmapFromFunc(func, key); + if (bd != null) easeBitmapMap.set(key, bd); } + } var k = "INSTANT"; if (!easeBitmapMap.exists(k)) { @@ -137,17 +136,15 @@ class SongEventHelper var y:Int = getEaseY(raw, size, range); if (lastY == -1) { - for (xx in (i - half)...(i + half + 1)) - if (xx >= 0 && xx < size) for (yy in (y - half)...(y + half + 1)) - if (yy >= 0 && yy < size) bd.setPixel32(xx, yy, 0xFFFFFFFF); + for (xx in (i - half)...(i + half + 1)) if (xx >= 0 && xx < size) for (yy in (y - half)...(y + half + 1)) if (yy >= 0 && yy < size) + bd.setPixel32(xx, yy, 0xFFFFFFFF); } else { var a = Std.int(Math.min(y, lastY)); var b = Std.int(Math.max(y, lastY)); - for (xx in (i - half)...(i + half + 1)) - if (xx >= 0 && xx < size) for (yy in a - half...b + half + 1) - if (yy >= 0 && yy < size) bd.setPixel32(xx, yy, 0xFFFFFFFF); + for (xx in (i - half)...(i + half + 1)) if (xx >= 0 && xx < size) for (yy in a - half...b + half + 1) if (yy >= 0 && yy < size) bd.setPixel32(xx, + yy, 0xFFFFFFFF); } lastY = y; } @@ -204,13 +201,12 @@ class SongEventHelper var y:Int = getEaseY(raw, sizeH, range); var bd:BitmapData = new BitmapData(dotWidth, sizeH, false, 0xFF202223); var centerX:Int = Std.int(dotWidth / 2); - for (dx in -dotRadius...dotRadius + 1) - for (dy in -dotRadius...dotRadius + 1) - { - var px = centerX + dx; - var py = y + dy; - if (px >= 0 && px < dotWidth && py >= 0 && py < sizeH) if (dx * dx + dy * dy <= dotRadius * dotRadius) bd.setPixel32(px, py, 0xFFFFFFFF); - } + for (dx in -dotRadius...dotRadius + 1) for (dy in -dotRadius...dotRadius + 1) + { + var px = centerX + dx; + var py = y + dy; + if (px >= 0 && px < dotWidth && py >= 0 && py < sizeH) if (dx * dx + dy * dy <= dotRadius * dotRadius) bd.setPixel32(px, py, 0xFFFFFFFF); + } var gfxName = "ease_dot_" + key + "_" + f; var gfx = FlxG.bitmap.add(bd, true, gfxName); var spr = new FlxSprite(); diff --git a/source/funkin/play/notes/notestyle/NoteStyle.hx b/source/funkin/play/notes/notestyle/NoteStyle.hx index 8e5a1da64..14fc0286e 100644 --- a/source/funkin/play/notes/notestyle/NoteStyle.hx +++ b/source/funkin/play/notes/notestyle/NoteStyle.hx @@ -955,8 +955,7 @@ class NoteStyle implements IRegistryEntry var animData:Null> = fetchSplashAnimationData(dir); if (animData != null) { - for (anim in animData) - FlxAnimationUtil.addAtlasAnimation(target, anim); + for (anim in animData) FlxAnimationUtil.addAtlasAnimation(target, anim); } }; diff --git a/source/funkin/ui/credits/CreditsDataHandler.hx b/source/funkin/ui/credits/CreditsDataHandler.hx index fe58bff97..a5a426bf0 100644 --- a/source/funkin/ui/credits/CreditsDataHandler.hx +++ b/source/funkin/ui/credits/CreditsDataHandler.hx @@ -132,8 +132,7 @@ class CreditsDataHandler { trace('[CREDITS] Failed to parse credits data: ${id}'); - for (error in errors) - funkin.data.DataError.printError(error); + for (error in errors) funkin.data.DataError.printError(error); } #end } diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 234502d18..09d77724c 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -1381,8 +1381,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState function get_availableVariations():Array { var variations:Array = [ - for (x in songMetadata.keys()) - x + for (x in songMetadata.keys()) x ]; variations.sort(SortUtil.defaultThenAlphabetically.bind('default')); return variations; @@ -1417,8 +1416,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { var m:Null = songMetadata.get(x); [ - for (diff in (m?.playData?.difficulties ?? [])) - '$diff-$x' + for (diff in (m?.playData?.difficulties ?? [])) '$diff-$x' ]; } ]; @@ -1485,8 +1483,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState { // 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 + for (x in songChartData.get(selectedVariation).notes.keys()) x ]; for (key in keys) { @@ -2639,8 +2636,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // Can't use filter() because of null safety checking! var filteredWorkingFilePaths:Array = []; - for (chartPath in previousWorkingFilePaths) - if (chartPath != null) filteredWorkingFilePaths.push(chartPath); + for (chartPath in previousWorkingFilePaths) if (chartPath != null) filteredWorkingFilePaths.push(chartPath); save.chartEditorPreviousFiles.value = filteredWorkingFilePaths; if (hasBackup) trace('Queuing backup prompt for next time!'); @@ -4924,8 +4920,7 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState 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 + for (i in columnStart...(columnEnd + 1)) i ].map(function(i:Int):Int { if (i >= eventColumn) diff --git a/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx b/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx index b25ea38eb..7f70a26d7 100644 --- a/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx +++ b/source/funkin/ui/debug/charting/commands/MoveEventsCommand.hx @@ -20,8 +20,7 @@ class MoveEventsCommand implements ChartEditorCommand { // Clone the events to prevent editing from affecting the history. this.events = [ - for (event in events) - event.clone() + for (event in events) event.clone() ]; if (offsetInSteps) this.offset = Conductor.instance.getStepTimeInMs(offset); else diff --git a/source/funkin/ui/debug/charting/commands/MoveNotesCommand.hx b/source/funkin/ui/debug/charting/commands/MoveNotesCommand.hx index 425bf2e7a..2e790f5cb 100644 --- a/source/funkin/ui/debug/charting/commands/MoveNotesCommand.hx +++ b/source/funkin/ui/debug/charting/commands/MoveNotesCommand.hx @@ -20,8 +20,7 @@ class MoveNotesCommand implements ChartEditorCommand { // Clone the notes to prevent editing from affecting the history. this.notes = [ - for (note in notes) - note.clone() + for (note in notes) note.clone() ]; if (offsetInSteps) this.offset = Conductor.instance.getStepTimeInMs(offset); else diff --git a/source/funkin/ui/debug/latency/CoolStatsGraph.hx b/source/funkin/ui/debug/latency/CoolStatsGraph.hx index 9eaf80303..06a4070af 100644 --- a/source/funkin/ui/debug/latency/CoolStatsGraph.hx +++ b/source/funkin/ui/debug/latency/CoolStatsGraph.hx @@ -156,8 +156,7 @@ class CoolStatsGraph extends Sprite public function average():Float { var sum:Float = 0; - for (value in history) - sum += value; + for (value in history) sum += value; return sum / history.length; } diff --git a/source/funkin/ui/debug/stageeditor/StageEditorState.hx b/source/funkin/ui/debug/stageeditor/StageEditorState.hx index 60d2a20a0..f450c7212 100644 --- a/source/funkin/ui/debug/stageeditor/StageEditorState.hx +++ b/source/funkin/ui/debug/stageeditor/StageEditorState.hx @@ -536,8 +536,7 @@ class StageEditorState extends UIState { if (conductorInUse.currentBeat % 2 == 0) { - for (char in getCharacters()) - char?.dance(true); + for (char in getCharacters()) char?.dance(true); } for (asset in spriteArray) @@ -812,8 +811,7 @@ class StageEditorState extends UIState camMarker.visible = moveMode == "chars"; - for (item in sprDependant) - item.disabled = (moveMode != "assets" || selectedSprite == null); + for (item in sprDependant) item.disabled = (moveMode != "assets" || selectedSprite == null); menubarItemPaste.disabled = copiedSprite == null; menubarItemFindObj.disabled = !(moveMode == "assets"); @@ -1198,14 +1196,12 @@ class StageEditorState extends UIState menubarItemViewFloorLines.onChange = function(_) { - for (awesome in floorLines) - awesome.visible = menubarItemViewFloorLines.selected; + for (awesome in floorLines) awesome.visible = menubarItemViewFloorLines.selected; } menubarItemViewPosMarkers.onChange = function(_) { - for (coolbeans in posCircles) - coolbeans.visible = menubarItemViewPosMarkers.selected; + for (coolbeans in posCircles) coolbeans.visible = menubarItemViewPosMarkers.selected; } sprDependant = [menubarItemCopy, menubarItemCut, menubarItemDelete, menubarItemSelectNone]; @@ -1214,8 +1210,7 @@ class StageEditorState extends UIState function reloadRecentFiles():Void { - for (a in menubarItemOpenRecent.childComponents) - menubarItemOpenRecent.removeComponent(a); + for (a in menubarItemOpenRecent.childComponents) menubarItemOpenRecent.removeComponent(a); for (file in Save.instance.stageEditorPreviousFiles.value) { diff --git a/source/funkin/ui/debug/stageeditor/components/NewObjDialog.hx b/source/funkin/ui/debug/stageeditor/components/NewObjDialog.hx index b62bf9c55..9a742f008 100644 --- a/source/funkin/ui/debug/stageeditor/components/NewObjDialog.hx +++ b/source/funkin/ui/debug/stageeditor/components/NewObjDialog.hx @@ -40,8 +40,7 @@ class NewObjDialog extends Dialog if (button == '{{Create}}') { var objNames = [ - for (obj in StageEditorState.instance.spriteArray) - obj.name + for (obj in StageEditorState.instance.spriteArray) obj.name ]; if (field.text == '' || field.text == null || objNames.contains(field.text)) diff --git a/source/funkin/ui/debug/stageeditor/toolboxes/StageEditorObjectAnimsToolbox.hx b/source/funkin/ui/debug/stageeditor/toolboxes/StageEditorObjectAnimsToolbox.hx index cd5807a44..4eb2b497f 100644 --- a/source/funkin/ui/debug/stageeditor/toolboxes/StageEditorObjectAnimsToolbox.hx +++ b/source/funkin/ui/debug/stageeditor/toolboxes/StageEditorObjectAnimsToolbox.hx @@ -144,9 +144,8 @@ class StageEditorObjectAnimsToolbox extends StageEditorDefaultToolbox // Otherwise, update them accordingly. - if (previousFrames != [ - for (f in linkedObj.frames.frames) - f.name + if (previousFrames !=[ + for (f in linkedObj.frames.frames) f.name ]) updateFrameList(); if (previousAnims != linkedObj.animation.getNameList().copy()) updateAnimList(); } @@ -195,8 +194,7 @@ class StageEditorObjectAnimsToolbox extends StageEditorDefaultToolbox { var splitter = objAnimIndices.text.replace(" ", "").split(","); - for (num in splitter) - indices.push(Std.parseInt(num)); + for (num in splitter) indices.push(Std.parseInt(num)); } var shouldDoIndices:Bool = (indices.length > 0 && !indices.contains(null)); diff --git a/source/funkin/ui/freeplay/DifficultyStars.hx b/source/funkin/ui/freeplay/DifficultyStars.hx index a743e5311..43f90c1ab 100644 --- a/source/funkin/ui/freeplay/DifficultyStars.hx +++ b/source/funkin/ui/freeplay/DifficultyStars.hx @@ -39,8 +39,7 @@ class DifficultyStars extends FlxSpriteGroup stars.shader = hsvShader; - for (memb in flames.members) - memb.shader = hsvShader; + for (memb in flames.members) memb.shader = hsvShader; } override function update(elapsed:Float):Void diff --git a/source/funkin/ui/freeplay/FreeplayState.hx b/source/funkin/ui/freeplay/FreeplayState.hx index 596bfdc15..899358d2b 100644 --- a/source/funkin/ui/freeplay/FreeplayState.hx +++ b/source/funkin/ui/freeplay/FreeplayState.hx @@ -1612,8 +1612,7 @@ class FreeplayState extends MusicBeatSubState { fromCharSelect = false; - for (capsule in grpCapsules.members) - capsule.doLerp = true; + for (capsule in grpCapsules.members) capsule.doLerp = true; } }); } diff --git a/source/funkin/ui/freeplay/LetterSort.hx b/source/funkin/ui/freeplay/LetterSort.hx index 130f5c545..6aa96215e 100644 --- a/source/funkin/ui/freeplay/LetterSort.hx +++ b/source/funkin/ui/freeplay/LetterSort.hx @@ -220,8 +220,7 @@ class LetterSort extends FlxSpriteGroup if (curSelection < 0) curSelection = letters[0].regexLetters.length - 1; if (curSelection >= letters[0].regexLetters.length) curSelection = 0; - for (letter in letters) - letter.changeLetter(diff, curSelection); + for (letter in letters) letter.changeLetter(diff, curSelection); if (changeSelectionCallback != null) changeSelectionCallback(letters[2].regexLetters[letters[2].curLetter]); // bullshit and long lol! } diff --git a/source/funkin/ui/freeplay/dj/MultiSparrowFreeplayDJ.hx b/source/funkin/ui/freeplay/dj/MultiSparrowFreeplayDJ.hx index 9d4967f95..58b17590b 100644 --- a/source/funkin/ui/freeplay/dj/MultiSparrowFreeplayDJ.hx +++ b/source/funkin/ui/freeplay/dj/MultiSparrowFreeplayDJ.hx @@ -40,7 +40,9 @@ class MultiSparrowFreeplayDJ extends BaseFreeplayDJ var assetList = []; for (anim in playableCharData.getAnimationsList()) + { if (anim.assetPath != null && !assetList.contains(anim.assetPath)) assetList.push(anim.assetPath); + } var texture:FlxAtlasFrames = Paths.getSparrowAtlas(playableCharData.getAssetPath()); diff --git a/source/funkin/ui/options/ControlsMenu.hx b/source/funkin/ui/options/ControlsMenu.hx index f9ec1c48d..244e60d99 100644 --- a/source/funkin/ui/options/ControlsMenu.hx +++ b/source/funkin/ui/options/ControlsMenu.hx @@ -171,8 +171,7 @@ class ControlsMenu extends Page var formatName = name.replace('_', ' '); var label = labels.add(new AtlasText(Math.max(FullScreenScaleMode.gameNotchSize.x, CONTROL_BASE_X), y, formatName, AtlasFont.BOLD)); label.alpha = 0.6; - for (i in 0...COLUMNS) - createItem(label.x + CONTROL_MARGIN_X + i * CONTROL_SPACING_X, y, control, i); + for (i in 0...COLUMNS) createItem(label.x + CONTROL_MARGIN_X + i * CONTROL_SPACING_X, y, control, i); y += spacer; } @@ -284,8 +283,7 @@ class ControlsMenu extends Page { currentDevice = device; - for (item in controlGrid.members) - item.updateDevice(currentDevice); + for (item in controlGrid.members) item.updateDevice(currentDevice); var cancel = device == Keys ? "Escape" : "Back"; // todo: alignment diff --git a/source/funkin/ui/options/FunkinSoundTray.hx b/source/funkin/ui/options/FunkinSoundTray.hx index 283a955ad..5b04a233b 100644 --- a/source/funkin/ui/options/FunkinSoundTray.hx +++ b/source/funkin/ui/options/FunkinSoundTray.hx @@ -144,8 +144,7 @@ class FunkinSoundTray extends FlxSoundTray { var globalVolume:Int = FlxG.sound.muted || FlxG.sound.volume == 0 ? 0 : Math.round(FlxG.sound.logToLinear(FlxG.sound.volume) * 10); - for (i in 0..._bars.length) - _bars[i].visible = i < globalVolume; + for (i in 0..._bars.length) _bars[i].visible = i < globalVolume; } function saveVolumePreferences():Void diff --git a/source/funkin/ui/options/OffsetMenu.hx b/source/funkin/ui/options/OffsetMenu.hx index 79aa61b45..8e02b5dcf 100644 --- a/source/funkin/ui/options/OffsetMenu.hx +++ b/source/funkin/ui/options/OffsetMenu.hx @@ -857,8 +857,7 @@ class OffsetMenu extends Page var notesByDirection:Array> = [[], [], [], []]; - for (note in notesInRange) - notesByDirection[note.direction].push(note); + for (note in notesInRange) notesByDirection[note.direction].push(note); while (inputPressQueue.length > 0) { diff --git a/source/funkin/ui/transition/preload/FunkinPreloader.hx b/source/funkin/ui/transition/preload/FunkinPreloader.hx index 9e218745b..aa84f1954 100644 --- a/source/funkin/ui/transition/preload/FunkinPreloader.hx +++ b/source/funkin/ui/transition/preload/FunkinPreloader.hx @@ -847,15 +847,13 @@ class FunkinPreloader extends FlxBasePreloader // Render progress bar var piecesToRender:Int = Std.int(percent * progressBarPieces.length); - for (i => piece in progressBarPieces) - piece.alpha = i <= piecesToRender ? 0.9 : 0.1; + for (i => piece in progressBarPieces) piece.alpha = i <= piecesToRender ? 0.9 : 0.1; } // Cycle ellipsis count to show loading var ellipsisCount:Int = Std.int(elapsed / ELLIPSIS_TIME) % 3 + 1; var ellipsis:String = ''; - for (_ in 0...ellipsisCount) - ellipsis += '.'; + for (_ in 0...ellipsisCount) ellipsis += '.'; // Render status text updateProgressLeftText(currentState.getProgressLeftText(TOTAL_STEPS, ellipsis)); @@ -933,8 +931,7 @@ class FunkinPreloader extends FlxBasePreloader rTextGroup.alpha = alphaToFade; progressLines.alpha = alphaToFade; - for (piece in progressBarPieces) - piece.alpha = alphaToFade; + for (piece in progressBarPieces) piece.alpha = alphaToFade; return elapsedFinished; } diff --git a/source/funkin/ui/transition/stickers/StickerSubState.hx b/source/funkin/ui/transition/stickers/StickerSubState.hx index 6cd22a43a..5986fb345 100644 --- a/source/funkin/ui/transition/stickers/StickerSubState.hx +++ b/source/funkin/ui/transition/stickers/StickerSubState.hx @@ -108,8 +108,7 @@ class StickerSubState extends MusicBeatSubState } if (params.oldStickers != null) { - for (sticker in params.oldStickers) - grpStickers.add(sticker); + for (sticker in params.oldStickers) grpStickers.add(sticker); degenStickers(); } else diff --git a/source/funkin/util/logging/AnsiTrace.hx b/source/funkin/util/logging/AnsiTrace.hx index 17f27bafe..656fdbd34 100644 --- a/source/funkin/util/logging/AnsiTrace.hx +++ b/source/funkin/util/logging/AnsiTrace.hx @@ -100,8 +100,7 @@ class AnsiTrace } var pstr:String = infos.fileName + ":" + '${infos.lineNumber}'.bold(); - if (infos.customParams != null) for (v in infos.customParams) - str += ", " + Std.string(v); + if (infos.customParams != null) for (v in infos.customParams) str += ", " + Std.string(v); var header:String = ""; var body:String = str; @@ -124,8 +123,7 @@ class AnsiTrace #if (sys && debug) if (AnsiUtil.isColorCodesSupported()) { - for (line in ansiBF) - Sys.stdout().writeString(line + "\n"); + for (line in ansiBF) Sys.stdout().writeString(line + "\n"); Sys.stdout().flush(); } #end diff --git a/source/funkin/util/tools/ArrayTools.hx b/source/funkin/util/tools/ArrayTools.hx index 93a1c4dc9..a9741483b 100644 --- a/source/funkin/util/tools/ArrayTools.hx +++ b/source/funkin/util/tools/ArrayTools.hx @@ -41,7 +41,7 @@ class ArrayTools */ public static function clone(array:Array):Array { - return [for (element in array) element]; + return[for (element in array) element]; } /** @@ -53,9 +53,8 @@ class ArrayTools */ public static function deepClone>(array:Array):Array { - return [ - for (element in array) - element.clone() + return[ + for (element in array) element.clone() ]; } diff --git a/source/funkin/util/tools/IteratorTools.hx b/source/funkin/util/tools/IteratorTools.hx index 2297eedf7..d15645e44 100644 --- a/source/funkin/util/tools/IteratorTools.hx +++ b/source/funkin/util/tools/IteratorTools.hx @@ -12,7 +12,7 @@ class IteratorTools { public static function array(iterator:Iterator):Array { - return [for (i in iterator) i]; + return[for (i in iterator) i]; } public static function count(iterator:Iterator, ?predicate:(item:T) -> Bool):Int @@ -21,13 +21,11 @@ class IteratorTools if (predicate == null) { - for (_ in iterator) - n++; + for (_ in iterator) n++; } else { - for (x in iterator) - if (predicate(x)) n++; + for (x in iterator) if (predicate(x)) n++; } return n; diff --git a/source/funkin/util/tools/MapTools.hx b/source/funkin/util/tools/MapTools.hx index e35192659..a85b72d12 100644 --- a/source/funkin/util/tools/MapTools.hx +++ b/source/funkin/util/tools/MapTools.hx @@ -25,7 +25,7 @@ class MapTools public static function values(map:Null>):Array { if (map == null) return []; - return [for (i in map.iterator()) i]; + return[for (i in map.iterator()) i]; } /**