From 96b98513b322003058dff06b6d23c11b92e02840 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Sat, 30 Nov 2024 00:34:16 +0100 Subject: [PATCH 01/26] Added more stuff to git commit macro --- .../backend/system/macros/GitCommitMacro.hx | 101 +++++++++++++++++- 1 file changed, 99 insertions(+), 2 deletions(-) diff --git a/source/funkin/backend/system/macros/GitCommitMacro.hx b/source/funkin/backend/system/macros/GitCommitMacro.hx index c03988ce..11f32152 100644 --- a/source/funkin/backend/system/macros/GitCommitMacro.hx +++ b/source/funkin/backend/system/macros/GitCommitMacro.hx @@ -8,11 +8,27 @@ class GitCommitMacro { /** * Returns the current commit number */ - public static var commitNumber(get, null):Int; + public static var commitNumber(get, never):Int; /** * Returns the current commit hash */ - public static var commitHash(get, null):String; + public static var commitHash(get, never):String; + /** + * Returns the current commit hash in long format + */ + public static var commitHashLong(get, never):String; + /** + * Returns the current commit message + */ + public static var commitMessage(get, never):String; + /** + * Returns the current commit author + */ + public static var commitAuthor(get, never):String; + /** + * Returns the current commit date + time + **/ + public static var commitDate(get, never):Date; // GETTERS #if REGION @@ -21,6 +37,15 @@ class GitCommitMacro { private static inline function get_commitHash() return __getCommitHash(); + private static inline function get_commitHashLong() + return __getCommitHashLong(); + + private static inline function get_commitMessage() + return __getCommitMessage(); + private static inline function get_commitAuthor() + return __getCommitAuthor(); + private static inline function get_commitDate() + return __getCommitDate(); #end // INTERNAL MACROS @@ -52,5 +77,77 @@ class GitCommitMacro { return macro $v{0} #end } + + private static macro function __getCommitHashLong() { + #if display + return macro $v{"-"}; + #else + try { + var proc = new Process('git', ['rev-parse', 'HEAD'], false); + proc.exitCode(true); + + return macro $v{proc.stdout.readLine()}; + } catch(e) {} + return macro $v{"-"} + #end + } + + private static macro function __getCommitMessage() { + #if display + return macro $v{"-"}; + #else + try { + var proc = new Process('git', ['log', '-1', '--pretty=%B'], false); + proc.exitCode(true); + var all = proc.stdout.readAll().toString(); + while(StringTools.endsWith(all, "\r\n")) all = all.substr(0, all.length - 2); + while(StringTools.endsWith(all, "\n")) all = all.substr(0, all.length - 1); + while(StringTools.endsWith(all, "\r")) all = all.substr(0, all.length - 1); + + return macro $v{all}; + } catch(e) {} + return macro $v{"-"} + #end + } + + private static macro function __getCommitAuthor() { + #if display + return macro $v{"-"}; + #else + try { + var proc = new Process('git', ['log', '-1', '--pretty=%an'], false); + proc.exitCode(true); + + return macro $v{StringTools.trim(proc.stdout.readLine())}; + } catch(e) {} + return macro $v{"-"} + #end + } + + private static macro function __getCommitDate() { + #if display + return macro $v{Date.now()}; + #else + try { + // get the time in UTC format + var oldTz = Sys.getEnv("TZ"); + Sys.putEnv("TZ", "UTC0"); + var proc = new Process('git', ['log', "--date='format-local:%Y-%m-%dT%H:%M:%SZ'", '-1', '--pretty=%cd'], false); + proc.exitCode(true); + Sys.putEnv("TZ", oldTz); + + var rawDate = StringTools.trim(proc.stdout.readLine()); + + try { + Date.fromString(rawDate); + } catch(e) { + throw 'Invalid date format: $rawDate'; + } + + return macro Date.fromString($v{rawDate}); + } catch(e) {} + return macro Date.fromString("1970-01-01T00:00:00"); // failed to parse date + #end + } #end } \ No newline at end of file From 85b50c7ccee88000ada26ae73391ab8693c5d5de Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Sat, 30 Nov 2024 00:44:52 +0100 Subject: [PATCH 02/26] Bug Fixes + Cleanup --- .../backend/system/macros/DefinesMacro.hx | 2 +- .../backend/system/macros/FunkinSaveMacro.hx | 18 ++++-------------- .../backend/system/macros/OptionsMacro.hx | 10 ++-------- source/funkin/backend/utils/ZipUtil.hx | 2 +- .../editors/character/CharacterEditor.hx | 2 +- source/funkin/editors/charter/Charter.hx | 4 ++-- source/funkin/editors/ui/UIState.hx | 8 ++++---- source/funkin/game/Note.hx | 2 +- source/funkin/game/PlayState.hx | 10 +++++++--- .../funkin/game/cutscenes/ScriptedCutscene.hx | 4 ++-- source/funkin/options/type/OptionType.hx | 2 +- 11 files changed, 26 insertions(+), 38 deletions(-) diff --git a/source/funkin/backend/system/macros/DefinesMacro.hx b/source/funkin/backend/system/macros/DefinesMacro.hx index da257223..7fe19375 100644 --- a/source/funkin/backend/system/macros/DefinesMacro.hx +++ b/source/funkin/backend/system/macros/DefinesMacro.hx @@ -9,7 +9,7 @@ class DefinesMacro { /** * Returns the defined values */ - public static var defines(get, null):Map; + public static var defines(get, never):Map; // GETTERS #if REGION diff --git a/source/funkin/backend/system/macros/FunkinSaveMacro.hx b/source/funkin/backend/system/macros/FunkinSaveMacro.hx index 11632991..66b367b7 100644 --- a/source/funkin/backend/system/macros/FunkinSaveMacro.hx +++ b/source/funkin/backend/system/macros/FunkinSaveMacro.hx @@ -51,11 +51,9 @@ class FunkinSaveMacro { expr: EConst(CIdent(f)) }} ]; + var saveFuncBlocks:Array = [for(f in fieldNames) macro $i{saveFieldName}.data.$f = $i{f}]; - saveFuncBlocks.push(macro ${{ - pos: Context.currentPos(), - expr: EConst(CIdent(saveFieldName)) - }}.flush()); + saveFuncBlocks.push(macro $i{saveFieldName}.flush()); fields.push({ pos: Context.currentPos(), @@ -81,16 +79,8 @@ class FunkinSaveMacro { expr: { pos: Context.currentPos(), expr: EBlock([for(f in fieldNames) - macro if (${{ - pos: Context.currentPos(), - expr: EConst(CIdent(saveFieldName)) - }}.data.$f != null) ${{ - pos: Context.currentPos(), - expr: EConst(CIdent(f)) - }} = ${{ - pos: Context.currentPos(), - expr: EConst(CIdent(saveFieldName)) - }}.data.$f + macro if ($i{saveFieldName}.data.$f != null) + $i{f} = $i{saveFieldName}.data.$f ]) } }), diff --git a/source/funkin/backend/system/macros/OptionsMacro.hx b/source/funkin/backend/system/macros/OptionsMacro.hx index ae54eb66..bd688b59 100644 --- a/source/funkin/backend/system/macros/OptionsMacro.hx +++ b/source/funkin/backend/system/macros/OptionsMacro.hx @@ -24,14 +24,8 @@ class OptionsMacro { var ptwoname = 'P2_$name'; var newFuncExpr:Expr = macro { var a:Array = []; - for(e in ${{ - pos: Context.currentPos(), - expr: EConst(CIdent(ponename)) - }}) a.push(e); - for(e in ${{ - pos: Context.currentPos(), - expr: EConst(CIdent(ptwoname)) - }}) a.push(e); + for(e in $i{ponename}) a.push(e); + for(e in $i{ptwoname}) a.push(e); return a; }; diff --git a/source/funkin/backend/utils/ZipUtil.hx b/source/funkin/backend/utils/ZipUtil.hx index 16a353c2..13e5fa99 100644 --- a/source/funkin/backend/utils/ZipUtil.hx +++ b/source/funkin/backend/utils/ZipUtil.hx @@ -218,7 +218,7 @@ class ZipProgress { public var curFile:Int = 0; public var fileCount:Int = 0; public var done:Bool = false; - public var percentage(get, null):Float; + public var percentage(get, never):Float; private function get_percentage() { return fileCount <= 0 ? 0 : curFile / fileCount; diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index c8b6435f..73d991b3 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -14,7 +14,7 @@ class CharacterEditor extends UIState { public var ghosts:CharacterGhostsHandler; - public static var instance(get, null):CharacterEditor; + public static var instance(get, never):CharacterEditor; private static inline function get_instance() return FlxG.state is CharacterEditor ? cast FlxG.state : null; diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 99a87ded..3d6f3f12 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -22,11 +22,11 @@ class Charter extends UIState { static var __diff:String; static var __reload:Bool; - var chart(get, null):ChartData; + var chart(get, never):ChartData; private function get_chart() return PlayState.SONG; - public static var instance(get, null):Charter; + public static var instance(get, never):Charter; private static inline function get_instance() return FlxG.state is Charter ? cast FlxG.state : null; diff --git a/source/funkin/editors/ui/UIState.hx b/source/funkin/editors/ui/UIState.hx index 1c32fad6..1a66821d 100644 --- a/source/funkin/editors/ui/UIState.hx +++ b/source/funkin/editors/ui/UIState.hx @@ -13,7 +13,10 @@ import openfl.ui.MouseCursor; class UIState extends MusicBeatState { public var curContextMenu:UIContextMenu = null; - public static var state(get, null):UIState; + public static var state(get, never):UIState; + + private inline static function get_state() + return FlxG.state is UIState ? cast FlxG.state : null; public var buttonHandler:Void->Void = null; public var hoveredSprite:UISprite = null; @@ -24,9 +27,6 @@ class UIState extends MusicBeatState { private var __rect:FlxRect; private var __mousePos:FlxPoint; - private inline static function get_state() - return FlxG.state is UIState ? cast FlxG.state : null; - public override function create() { __rect = new FlxRect(); __mousePos = FlxPoint.get(); diff --git a/source/funkin/game/Note.hx b/source/funkin/game/Note.hx index 125ec419..d14b87fd 100644 --- a/source/funkin/game/Note.hx +++ b/source/funkin/game/Note.hx @@ -75,7 +75,7 @@ class Note extends FlxSprite public var scrollSpeed:Null = null; public var noteAngle:Null = null; - public var noteType(get, null):String; + public var noteType(get, never):String; @:dox(hide) public var __strumCameras:Array = null; @:dox(hide) public var __strum:Strum = null; diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 5d353e80..f39cc4e3 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -189,11 +189,11 @@ class PlayState extends MusicBeatState /** * Player strums. */ - public var playerStrums(get, null):StrumLine; + public var playerStrums(get, set):StrumLine; /** * CPU strums. */ - public var cpuStrums(get, null):StrumLine; + public var cpuStrums(get, set):StrumLine; /** * Shortcut to `playerStrums`. */ @@ -360,7 +360,7 @@ class PlayState extends MusicBeatState /** * Accuracy for the current week */ - public static var campaignAccuracy(get, null):Float; + public static var campaignAccuracy(get, never):Float; public static var campaignAccuracyTotal:Float = 0; public static var campaignAccuracyCount:Float = 0; @@ -1943,8 +1943,12 @@ class PlayState extends MusicBeatState } private inline function get_cpuStrums():StrumLine return strumLines.members[0]; + private inline function set_cpuStrums(v:StrumLine):StrumLine + return strumLines.members[0] = v; private inline function get_playerStrums():StrumLine return strumLines.members[1]; + private inline function set_playerStrums(v:StrumLine):StrumLine + return strumLines.members[1] = v; private inline function get_gfSpeed():Int return (strumLines.members[2] != null && strumLines.members[2].characters[0] != null) ? strumLines.members[2].characters[0].beatInterval : 1; private inline function set_gfSpeed(v:Int):Int { diff --git a/source/funkin/game/cutscenes/ScriptedCutscene.hx b/source/funkin/game/cutscenes/ScriptedCutscene.hx index 20a01aa2..cdd8c0f7 100644 --- a/source/funkin/game/cutscenes/ScriptedCutscene.hx +++ b/source/funkin/game/cutscenes/ScriptedCutscene.hx @@ -125,7 +125,7 @@ class ScriptedCutscene extends Cutscene { })); } - public var isVideoPlaying(get, null):Bool; + public var isVideoPlaying(get, never):Bool; private inline function get_isVideoPlaying() return subState is VideoCutscene; @@ -141,7 +141,7 @@ class ScriptedCutscene extends Cutscene { })); } - public var isDialoguePlaying(get, null):Bool; + public var isDialoguePlaying(get, never):Bool; private inline function get_isDialoguePlaying() return subState is DialogueCutscene; diff --git a/source/funkin/options/type/OptionType.hx b/source/funkin/options/type/OptionType.hx index 26699723..fbe25854 100644 --- a/source/funkin/options/type/OptionType.hx +++ b/source/funkin/options/type/OptionType.hx @@ -4,7 +4,7 @@ import flixel.group.FlxSpriteGroup; import funkin.backend.system.Controls; class OptionType extends FlxSpriteGroup { - public var controls(get, null):Controls; + public var controls(get, never):Controls; public var selected:Bool = false; public var desc:String; From eada3105a471034250aa4b385f3e49d8c801567d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Sat, 30 Nov 2024 02:15:35 +0100 Subject: [PATCH 03/26] psych 1.0 format + some charts improvements Fixes #448 --- source/funkin/backend/FunkinSprite.hx | 4 +- source/funkin/backend/chart/Chart.hx | 105 +++++++++++++----- .../funkin/backend/chart/FNFLegacyParser.hx | 14 +-- source/funkin/backend/chart/PsychParser.hx | 32 ++++-- source/funkin/editors/charter/Charter.hx | 2 +- source/hscript/Config.hx | 1 - 6 files changed, 111 insertions(+), 47 deletions(-) diff --git a/source/funkin/backend/FunkinSprite.hx b/source/funkin/backend/FunkinSprite.hx index fa79a95b..b04cdffd 100644 --- a/source/funkin/backend/FunkinSprite.hx +++ b/source/funkin/backend/FunkinSprite.hx @@ -22,9 +22,9 @@ enum abstract XMLAnimType(Int) var BEAT = 1; var LOOP = 2; - public static function fromString(str:String, def:XMLAnimType = NONE) + public static function fromString(str:String, def:XMLAnimType = XMLAnimType.NONE) { - return switch (str.trim().toLowerCase()) + return switch (StringTools.trim(str).toLowerCase()) { case "none": NONE; case "beat" | "onbeat": BEAT; diff --git a/source/funkin/backend/chart/Chart.hx b/source/funkin/backend/chart/Chart.hx index bd13fd50..a65f45b7 100644 --- a/source/funkin/backend/chart/Chart.hx +++ b/source/funkin/backend/chart/Chart.hx @@ -1,6 +1,5 @@ package funkin.backend.chart; -import funkin.backend.system.Conductor; import funkin.backend.chart.ChartData; import flixel.util.FlxColor; import haxe.io.Path; @@ -13,12 +12,68 @@ import sys.FileSystem; using StringTools; +enum abstract ChartFormat(Int) { + var CODENAME = 0; + var LEGACY = 1; // also used by many other engines (old Psych, Kade and more) - Nex + var VSLICE = 2; + var PSYCH_NEW = 3; + + @:to public function toString():String { + return switch(cast (this, ChartFormat)) { + case CODENAME: "CODENAME"; + case LEGACY: "LEGACY"; + case VSLICE: "VSLICE"; + case PSYCH_NEW: "PSYCH_NEW"; + } + } + + public static function fromString(str:String, def:ChartFormat = ChartFormat.LEGACY) { + str = str.toLowerCase(); + str = StringTools.replace(str, " ", ""); + str = StringTools.replace(str, "_", ""); + str = StringTools.replace(str, ".", ""); + + if(StringTools.startsWith(str, "psychv1") || StringTools.startsWith(str, "psych1")) + return PSYCH_NEW; + + return switch(str) { + case "codename" | "codenameengine": CODENAME; + case "newpsych" | "psychnew": PSYCH_NEW; + default: def; + } + } +} + class Chart { /** * Default background colors for songs without bg color */ public inline static var defaultColor:FlxColor = 0xFF9271FD; + public static function cleanSongData(data:Dynamic):Dynamic { + if (Reflect.hasField(data, "song")) { + var field:Dynamic = Reflect.field(data, "song"); + if (field != null && Type.typeof(field) == TObject) // Cant use Reflect.isObject, because it detects strings for some reason + return field; + } + return data; + } + + public static function detectChartFormat(data:Dynamic):ChartFormat { + var __temp:Dynamic; // imma reuse this var so the program doesnt have to get values multiple times - Nex + + if ((__temp = data.codenameChart) == true || __temp == "true") + return CODENAME; + + if (Reflect.hasField(data, "version") && Reflect.hasField(data, "scrollSpeed")) + return VSLICE; + + if ((__temp = cleanSongData(data).format) != null && __temp is String && StringTools.startsWith(__temp, "psych_v1")) + return PSYCH_NEW; + + return LEGACY; + } + public static function loadEventsJson(songName:String) { var path = Paths.file('songs/${songName.toLowerCase()}/events.json'); var data:Array = null; @@ -33,8 +88,9 @@ class Chart { } public static function loadChartMeta(songName:String, difficulty:String = "normal", fromMods:Bool = true) { - var metaPath = Paths.file('songs/${songName.toLowerCase()}/meta.json'); - var metaDiffPath = Paths.file('songs/${songName.toLowerCase()}/meta-${difficulty.toLowerCase()}.json'); + var songNameLower = songName.toLowerCase(); + var metaPath = Paths.file('songs/${songNameLower}/meta.json'); + var metaDiffPath = Paths.file('songs/${songNameLower}/meta-${difficulty.toLowerCase()}.json'); var data:ChartMetaData = null; var fromMods:Bool = fromMods; @@ -67,7 +123,7 @@ class Chart { data.setFieldDefault("parsedColor", data.color.getColorFromDynamic().getDefault(defaultColor)); if (data.difficulties.length <= 0) { - data.difficulties = [for(f in Paths.getFolderContent('songs/${songName.toLowerCase()}/charts/', false, !fromMods)) if (Path.extension(f = f.toUpperCase()) == "JSON") Path.withoutExtension(f)]; + data.difficulties = [for(f in Paths.getFolderContent('songs/${songNameLower}/charts/', false, !fromMods)) if (Path.extension(f = f.toUpperCase()) == "JSON") Path.withoutExtension(f)]; if (data.difficulties.length == 3) { var hasHard = false, hasNormal = false, hasEasy = false; for(d in data.difficulties) { @@ -116,12 +172,12 @@ class Chart { Logs.trace('Could not parse chart for song ${songName} ($difficulty): ${Std.string(e)}', ERROR, RED); } - if (data != null) { - /** - * CHART CONVERSION - */ - #if REGION - if (Reflect.hasField(data, "codenameChart") && Reflect.field(data, "codenameChart") == true) { + /** + * CHART CONVERSION + */ + #if REGION + if (data != null) switch (detectChartFormat(data)) { + case CODENAME: // backward compat on events since its caused problems var eventTypesToString:Map = [ -1 => "HScript Call", @@ -132,28 +188,23 @@ class Chart { ]; if (data.events == null) data.events = []; - for (event in cast(data.events, Array)) { - if (Reflect.hasField(event, "type")) { - if(event.type != null) - event.name = eventTypesToString[event.type]; - Reflect.deleteField(event, "type"); - } + for (event in cast(data.events, Array)) if (Reflect.hasField(event, "type")) { + if (event.type != null) + event.name = eventTypesToString[event.type]; + Reflect.deleteField(event, "type"); } - // codename chart base = data; - } else { - // base game chart - FNFLegacyParser.parse(data, base); - } - #end + case PSYCH_NEW: PsychParser.parse(data, base); + case VSLICE: // TODO + case LEGACY: FNFLegacyParser.parse(data, base); } + #end - if (base.meta == null) - base.meta = loadChartMeta(songName, difficulty, base.fromMods); + var loadedMeta = loadChartMeta(songName, difficulty, base.fromMods); + if (base.meta == null) base.meta = loadedMeta; else { - var loadedMeta = loadChartMeta(songName, difficulty, base.fromMods); - for(field in Reflect.fields(base.meta)) { + for (field in Reflect.fields(base.meta)) { var f = Reflect.field(base.meta, field); if (f != null) Reflect.setField(loadedMeta, field, f); @@ -249,4 +300,4 @@ typedef ChartSaveSettings = { var ?saveEventsInChart:Bool; var ?prettyPrint:Bool; var ?folder:String; -} +} \ No newline at end of file diff --git a/source/funkin/backend/chart/FNFLegacyParser.hx b/source/funkin/backend/chart/FNFLegacyParser.hx index ede54e18..61a0f837 100644 --- a/source/funkin/backend/chart/FNFLegacyParser.hx +++ b/source/funkin/backend/chart/FNFLegacyParser.hx @@ -6,12 +6,7 @@ import funkin.backend.system.Conductor; class FNFLegacyParser { public static function parse(data:Dynamic, result:ChartData) { // base fnf chart parsing - var data:SwagSong = data; - if (Reflect.hasField(data, "song")) { - var field:Dynamic = Reflect.field(data, "song"); - if (!(field is String)) - data = field; - } + var data:SwagSong = Chart.cleanSongData(data); result.scrollSpeed = data.speed; result.stage = data.stage; @@ -29,7 +24,7 @@ class FNFLegacyParser { position: "boyfriend", notes: [] }); - var gfName = data.gf != null ? data.gf : (data.gfVersion != null ? data.gfVersion : "gf"); + var gfName = data.gf != null ? data.gf : (data.gfVersion != null ? data.gfVersion : (data.player3 != null ? data.player3 : "gf")); if (!p2isGF && gfName != "none") { result.strumLines.push({ characters: [gfName], @@ -132,10 +127,10 @@ class FNFLegacyParser { if ((swagSection.mustHitSection && strumLine.type == OPPONENT) || (!swagSection.mustHitSection && strumLine.type == PLAYER)) sectionNote[1] += 4; - swagSection.sectionNotes.push(sectionNote); + swagSection.sectionNotes.push(sectionNote); } } - + return {song: base}; } @@ -214,6 +209,7 @@ typedef SwagSong = var player1:String; var player2:String; + var ?player3:String; // alt for gf but idr if it was just used in psych or what but eh whatever maybe its better here anyways - Nex var ?gf:String; var ?gfVersion:String; var validScore:Bool; diff --git a/source/funkin/backend/chart/PsychParser.hx b/source/funkin/backend/chart/PsychParser.hx index 1af9962a..a600b141 100644 --- a/source/funkin/backend/chart/PsychParser.hx +++ b/source/funkin/backend/chart/PsychParser.hx @@ -6,15 +6,33 @@ import funkin.backend.chart.FNFLegacyParser.SwagSong; import funkin.backend.system.Conductor; class PsychParser { - // Alreadly parsed in sections + // Already parsed in sections public static var ignoreEvents:Array = [ "Camera Movement", "Alt Animation Toggle", "BPM Change" ]; - public static function parse(data:Dynamic, result:ChartData) + /** + * Converts 1.0 Psych charts to older ones + */ + public static function standardize(data:Dynamic, result:ChartData) { + var sectionsData:Array = Chart.cleanSongData(data).notes; + if (sectionsData == null) return; + + for (section in sectionsData) for (note in cast(section.sectionNotes, Array)) { + var gottaHitNote:Bool = section.mustHitSection == (note[1] >= 4); + note[1] = (note[1] % 4) + (gottaHitNote ? 4 : 0); + + if (note[3] != null && Std.isOfType(note[3], String)) + note[3] = Chart.addNoteType(result, note[3]); + } + } + + public static function parse(data:Dynamic, result:ChartData) { + if (Chart.detectChartFormat(data) == PSYCH_NEW) standardize(data, result); FNFLegacyParser.parse(data, result); + } public static function encode(chart:ChartData):Dynamic { var base:SwagSong = FNFLegacyParser.__convertToSwagSong(chart); @@ -32,7 +50,7 @@ class PsychParser { for (note in strumLine.notes) { var section:Int = Math.floor(Conductor.getStepForTime(note.time) / Conductor.getMeasureLength()); var swagSection:SwagSection = base.notes[section]; - + if (section >= 0 && section < base.notes.length) { var sectionNote:Array = [ note.time, // TIME @@ -44,10 +62,10 @@ class PsychParser { if ((swagSection.mustHitSection && strumLine.type == OPPONENT) || (!swagSection.mustHitSection && strumLine.type == PLAYER)) sectionNote[1] += 4; - swagSection.sectionNotes.push(sectionNote); + swagSection.sectionNotes.push(sectionNote); } } - + var groupedEvents:Array> = []; var __last:Array = null; var __lastTime:Float = Math.NaN; @@ -91,7 +109,7 @@ class PsychParser { FlxMath.roundDecimal(event.params[1]/chart.scrollSpeed, 2), // SCROLL SPEED MULTIPLER FlxMath.roundDecimal( // TIME event.params[0] ? // IS TWEENED? - (Conductor.getTimeForStep(eventStep+event.params[2]) - Conductor.getTimeForStep(eventStep))/1000 + (Conductor.getTimeForStep(eventStep+event.params[2]) - Conductor.getTimeForStep(eventStep))/1000 : 0, 2) ]); default: @@ -106,7 +124,7 @@ class PsychParser { for (psychEvent in psychEvents) for (i in 1...3) // Turn both vals into strings - if (!(psychEvent[i] is String)) + if (!(psychEvent[i] is String)) psychEvent[i] = Std.string(psychEvent[i]); base.events.push([events[0].time, psychEvents]); diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index cf13c0c2..4ec2f299 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -1356,7 +1356,7 @@ class Charter extends UIState { defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == "normal" ? "" : '-${__diff.toLowerCase()}'}.json', })); } - + function _file_saveas_psych(_) { openSubState(new SaveSubstate(Json.stringify(PsychParser.encode(PlayState.SONG), null, Options.editorPrettyPrint ? "\t" : null), { defaultSaveFile: '${__song.toLowerCase().replace(" ", "-")}${__diff.toLowerCase() == "normal" ? "" : '-${__diff.toLowerCase()}'}.json', diff --git a/source/hscript/Config.hx b/source/hscript/Config.hx index d0667ab9..4eec6ab1 100644 --- a/source/hscript/Config.hx +++ b/source/hscript/Config.hx @@ -29,7 +29,6 @@ class Config { ]; public static final DISALLOW_ABSTRACT_AND_ENUM = [ - "funkin.backend.FunkinSprite", // Error: String has no field trim, Due to Func "funkin.backend.scripting.events.PlayAnimEvent", // Error: expected member name or ';' after declaration specifiers, Due to Func ]; } \ No newline at end of file From 83cf69b4777d581d816cc0d1f4cf3c8f22254ff2 Mon Sep 17 00:00:00 2001 From: Furo Date: Sat, 30 Nov 2024 21:10:00 +0100 Subject: [PATCH 04/26] UIState Reloading Fix (#469) * Reloading UIStates does not softlock anymore * fix * Removed all prev changes and use a better method * Switch to tabs --- source/funkin/backend/MusicBeatState.hx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/MusicBeatState.hx b/source/funkin/backend/MusicBeatState.hx index 35b684e5..6ef650bc 100644 --- a/source/funkin/backend/MusicBeatState.hx +++ b/source/funkin/backend/MusicBeatState.hx @@ -93,6 +93,9 @@ class MusicBeatState extends FlxState implements IBeatReceiver public var scriptsAllowed:Bool = true; + public static var lastScriptName:String = null; + public static var lastStateName:String = null; + public var scriptName:String = null; public static var skipTransOut:Bool = false; @@ -108,7 +111,12 @@ class MusicBeatState extends FlxState implements IBeatReceiver public function new(scriptsAllowed:Bool = true, ?scriptName:String) { super(); this.scriptsAllowed = #if SOFTCODED_STATES scriptsAllowed #else false #end; - this.scriptName = scriptName; + + if(lastStateName != (lastStateName = Type.getClassName(Type.getClass(this)))) { + lastScriptName = null; + } + this.scriptName = scriptName != null ? scriptName : lastScriptName; + lastScriptName = this.scriptName; } function loadScript() { From 3297befda227451a88fed36bfce5aae22950b42d Mon Sep 17 00:00:00 2001 From: TheZoroForce240 <86524550+TheZoroForce240@users.noreply.github.com> Date: Sat, 7 Dec 2024 21:34:18 +0000 Subject: [PATCH 05/26] Backwards compatibility with older vertex shaders (#477) * add backwards compatibility with older vertex shaders * add todo comment for fixing comments in shaders --- source/funkin/backend/shaders/FunkinShader.hx | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/shaders/FunkinShader.hx b/source/funkin/backend/shaders/FunkinShader.hx index cbfe8846..152ca6c3 100644 --- a/source/funkin/backend/shaders/FunkinShader.hx +++ b/source/funkin/backend/shaders/FunkinShader.hx @@ -192,7 +192,11 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour { if(value == null) value = ShaderTemplates.defaultVertexSource; glRawVertexSource = value; - value = value.replace("#pragma header", ShaderTemplates.vertHeader).replace("#pragma body", ShaderTemplates.vertBody); + + var useBackCompat:Bool = true; + for (regex in ShaderTemplates.vertBackCompatVarList) if (!regex.match(value)) useBackCompat = false; + + value = value.replace("#pragma header", useBackCompat ? ShaderTemplates.vertHeaderBackCompat : ShaderTemplates.vertHeader).replace("#pragma body", useBackCompat ? ShaderTemplates.vertBodyBackCompat : ShaderTemplates.vertBody); if (value != __glVertexSource) { __glSourceDirty = true; @@ -625,6 +629,38 @@ if(hasColorTransform) { gl_Position = openfl_Matrix * openfl_Position;"; +// TODO: make this ignore comments +public static final vertBackCompatVarList:Array = [ + ~/attribute float alpha/, + ~/attribute vec4 colorMultiplier/, + ~/attribute vec4 colorOffset/, + ~/uniform bool hasColorTransform/ +]; + +public static final vertHeaderBackCompat:String = "attribute float openfl_Alpha; +attribute vec4 openfl_ColorMultiplier; +attribute vec4 openfl_ColorOffset; +attribute vec4 openfl_Position; +attribute vec2 openfl_TextureCoord; + +varying float openfl_Alphav; +varying vec4 openfl_ColorMultiplierv; +varying vec4 openfl_ColorOffsetv; +varying vec2 openfl_TextureCoordv; + +uniform mat4 openfl_Matrix; +uniform bool openfl_HasColorTransform; +uniform vec2 openfl_TextureSize;"; + +public static final vertBodyBackCompat:String = "openfl_Alphav = openfl_Alpha; +openfl_TextureCoordv = openfl_TextureCoord; + +if(openfl_HasColorTransform) { + openfl_ColorMultiplierv = openfl_ColorMultiplier; + openfl_ColorOffsetv = openfl_ColorOffset / 255.0; +} + +gl_Position = openfl_Matrix * openfl_Position;"; public static final defaultVertexSource:String = "#pragma header From f6deda2c84984202effdfc5f6b577c2d956aa7b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=8D=9A=7ENex?= <87421482+NexIsDumb@users.noreply.github.com> Date: Sun, 8 Dec 2024 21:35:39 +0100 Subject: [PATCH 06/26] addAnim for FunkinSprite + better names so u dont have to manually add based if atlas or sparrow or else this behaves as both addByPrefix and addByIndices and like the xml animations --- source/funkin/backend/FunkinSprite.hx | 43 ++++++++++++++++++++------ source/funkin/backend/utils/XMLUtil.hx | 37 +++++++++++----------- 2 files changed, 51 insertions(+), 29 deletions(-) diff --git a/source/funkin/backend/FunkinSprite.hx b/source/funkin/backend/FunkinSprite.hx index b04cdffd..2e4df83d 100644 --- a/source/funkin/backend/FunkinSprite.hx +++ b/source/funkin/backend/FunkinSprite.hx @@ -328,7 +328,31 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I lastAnimContext = Context; } - public function getAnim(name:String):OneOfTwo { + public inline function addAnim(name:String, prefix:String, frameRate:Float = 24, ?looped:Bool, ?forced:Bool, ?indices:Array, x:Float = 0, y:Float = 0, animType:XMLAnimType = NONE) + { + return XMLUtil.addAnimToSprite(this, { + name: name, + anim: prefix, + fps: frameRate, + loop: looped == null ? animType == LOOP : looped, + animType: animType, + x: x, + y: y, + indices: indices, + forced: forced + }); + } + + public inline function removeAnim(name:String) + { + if (animateAtlas != null) + @:privateAccess animateAtlas.anim.animsMap.remove(name); + else + animation.remove(name); + } + + public function getAnim(name:String):OneOfTwo + { if(animateAtlas != null) return animateAtlas.anim.getByName(name); return animation.getByName(name); @@ -341,7 +365,7 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I return FlxPoint.weak(0, 0); } - public inline function hasAnimation(AnimName:String):Bool @:privateAccess + public inline function hasAnim(AnimName:String):Bool @:privateAccess return animateAtlas != null ? (animateAtlas.anim.animsMap.exists(AnimName) || animateAtlas.anim.symbolDictionary.exists(AnimName)) : animation.exists(AnimName); @@ -364,13 +388,6 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I return animateAtlas != null ? animateAtlas.anim.reversed : animation.curAnim != null ? animation.curAnim.reversed : false; } - public inline function removeAnimation(name:String) { - if (animateAtlas != null) - @:privateAccess animateAtlas.anim.animsMap.remove(name); - else - animation.remove(name); - } - public inline function getNameList():Array { if (animateAtlas != null) return [for (name in @:privateAccess animateAtlas.anim.animsMap.keys()) name]; @@ -378,7 +395,8 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I return animation.getNameList(); } - public inline function stopAnimation() { + public inline function stopAnim() + { if (animateAtlas != null) animateAtlas.anim.pause(); else @@ -393,6 +411,11 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I public inline function isAnimAtEnd() { return animateAtlas != null ? animateAtlas.anim.isAtEnd : (animation.curAnim != null ? animation.curAnim.isAtEnd : false); } + + // Backwards compat (the names used to be all different and it sucked, please lets use the same format in the future) - Nex + public inline function hasAnimation(AnimName:String) return hasAnim(AnimName); + public inline function removeAnimation(name:String) return removeAnim(name); + public inline function stopAnimation() return stopAnim(); #end // Getter / Setters diff --git a/source/funkin/backend/utils/XMLUtil.hx b/source/funkin/backend/utils/XMLUtil.hx index afb8ae04..df551985 100644 --- a/source/funkin/backend/utils/XMLUtil.hx +++ b/source/funkin/backend/utils/XMLUtil.hx @@ -164,19 +164,17 @@ class XMLUtil { if(node.hasNode.anim) { for(anim in node.nodes.anim) addXMLAnimation(spr, anim); - } else { - if (spr.frames != null && spr.frames.frames != null) { - addAnimToSprite(spr, { - name: "idle", - anim: null, - fps: 24, - loop: spr.spriteAnimType == LOOP, - animType: spr.spriteAnimType, - x: 0, - y: 0, - indices: [for(i in 0...spr.frames.frames.length) i] - }); - } + } else if (spr.frames != null && spr.frames.frames != null) { + addAnimToSprite(spr, { + name: "idle", + anim: null, + fps: 24, + loop: spr.spriteAnimType == LOOP, + animType: spr.spriteAnimType, + x: 0, + y: 0, + indices: [for(i in 0...spr.frames.frames.length) i] + }); } return spr; @@ -238,16 +236,17 @@ class XMLUtil { if(animData.anim == null) return MISSING_PROPERTY; - if (animData.indices.length > 0) + if (animData.indices != null && animData.indices.length > 0) animateAnim.addBySymbolIndices(animData.name, animData.anim, animData.indices, animData.fps, animData.loop); else animateAnim.addBySymbol(animData.name, animData.anim, animData.fps, animData.loop); } else { - if (animData.anim == null && animData.indices.length > 0) - sprite.animation.add(animData.name, animData.indices, animData.fps, animData.loop); - else if (animData.indices.length > 0) - sprite.animation.addByIndices(animData.name, animData.anim, animData.indices, "", animData.fps, animData.loop); - else + if (animData.indices != null && animData.indices.length > 0) { + if (animData.anim == null) + sprite.animation.add(animData.name, animData.indices, animData.fps, animData.loop); + else + sprite.animation.addByIndices(animData.name, animData.anim, animData.indices, "", animData.fps, animData.loop); + } else sprite.animation.addByPrefix(animData.name, animData.anim, animData.fps, animData.loop); } From 5a8af4301737b90b28500cb0409d77e51ae1e592 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Mon, 9 Dec 2024 22:42:57 +0100 Subject: [PATCH 07/26] Fixed links due to rename of Organization Remove Haxe 4.3.0 warning --- PATCHNOTES.md | 6 +++--- README.md | 4 ++-- art/generateDoc.bat | 2 +- commandline/commands/Update.hx | 8 ++++---- libs.xml | 12 ++++++------ .../funkin/backend/system/macros/NewHaxeWarning.hx | 5 +++-- source/funkin/backend/utils/AudioAnalyzer.hx | 2 +- source/funkin/menus/credits/CreditsCodename.hx | 2 +- 8 files changed, 21 insertions(+), 20 deletions(-) diff --git a/PATCHNOTES.md b/PATCHNOTES.md index 5a1512fe..cda299b5 100644 --- a/PATCHNOTES.md +++ b/PATCHNOTES.md @@ -41,9 +41,9 @@ - Reworked Lagless Credits Codename Engine's Contributors Menu - New Credit Method for GitHub accounts (also lagless) in Mod Credits (First gets the data normally, if fails uses the ratelimited api) - MANY OG GAME WEEK STUFF!! (still wip and softcoded and also many reworks by nex!) - - Senpai Cutscene got reworked! (https://github.com/FNF-CNE-Devs/CodenameEngine/assets/87421482/3b3f32fc-78d1-40fa-8398-776554cab1d6) - - Thorns got reworked with a cool chromatic aberration effect! (https://github.com/FNF-CNE-Devs/CodenameEngine/assets/87421482/73d9f7c5-1c9c-407e-baf0-e8e2c381ecbb) - - Winter Horrorland got reworked with a bloody vignette effect! (https://github.com/FNF-CNE-Devs/CodenameEngine/assets/87421482/1e10c3e2-32dc-4de2-b31a-d9d577d516da - https://github.com/FNF-CNE-Devs/CodenameEngine/assets/87421482/cad852c3-1ee2-409e-a70e-b3571ab5cf7b) + - Senpai Cutscene got reworked! (https://github.com/CodenameCrew/CodenameEngine/assets/87421482/3b3f32fc-78d1-40fa-8398-776554cab1d6) + - Thorns got reworked with a cool chromatic aberration effect! (https://github.com/CodenameCrew/CodenameEngine/assets/87421482/73d9f7c5-1c9c-407e-baf0-e8e2c381ecbb) + - Winter Horrorland got reworked with a bloody vignette effect! (https://github.com/CodenameCrew/CodenameEngine/assets/87421482/1e10c3e2-32dc-4de2-b31a-d9d577d516da - https://github.com/CodenameCrew/CodenameEngine/assets/87421482/cad852c3-1ee2-409e-a70e-b3571ab5cf7b) - SMALLER BUT STILL COOL - Ability to set Controls.hx variables (Being able to block inputs or even trigger them (needs to be in an if statement)) - You can now easily check if a cutscene was played (by default is disabled and makes it auto play or not; Check startCutscene() code for more details in PlayState) diff --git a/README.md b/README.md index 6600a2a9..2d95c17b 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Also, the command `.\cne test` uses the source assets folder instead of the expo ## Codename Engine Codename Engine is a new Friday Night Funkin' Engine aimed at simplifying modding, along with extensiblity and ease of use.
-### Before making issues or need help with something, check our website [HERE](https://fnf-cne-devs.github.io/) (it contains a wiki of how to mod with EXAMPLES, an api, lists of mods made with Codename Engine and more)!!! +### Before making issues or need help with something, check our website [HERE](https://codename-engine.com/) (it contains a wiki of how to mod with EXAMPLES, an api, lists of mods made with Codename Engine and more)!!! #### The Engine includes many new features, as seen [here](FEATURES.md)
#### Wanna see the new features added in the most recent update? Click [here](PATCHNOTES.md)
@@ -67,7 +67,7 @@ In the future (when the engine won't be a WIP anymore) we're gonna also publish - Download and play the engine with its mods and modpacks - Mod and fork the engine (without using it for illicit purposes) - Contribute to the engine (for example through *Pull Requests*, *Issues*, etc) - - Create a sub engine with Codename Engine as **TEMPLATE** with **CREDITS** (for example leaving the *credits menu submenu with the GitHub contributors* and putting the *[main devs](https://github.com/FNF-CNE-Devs)* in a *README* specifying that it's a *sub engine from Codename Engine*) + - Create a sub engine with Codename Engine as **TEMPLATE** with **CREDITS** (for example leaving the *credits menu submenu with the GitHub contributors* and putting the *[main devs](https://github.com/CodenameCrew)* in a *README* specifying that it's a *sub engine from Codename Engine*) - Release excutable mods that use Codename Engine as source (Specifing that uses Codename Engine by for example the same way written above this) - Release modpacks diff --git a/art/generateDoc.bat b/art/generateDoc.bat index e2d35e4f..0e430256 100644 --- a/art/generateDoc.bat +++ b/art/generateDoc.bat @@ -5,4 +5,4 @@ lime build windows --haxeflag="--macro include('scripting')" --haxeflag="-xml do echo art echo Generated the api xml file at docs/doc.xml -echo Please put this in FNF-CNE-Devs.github.io/api-generator/api/doc.xml \ No newline at end of file +echo Please put this in codename-website/api-generator/api/doc.xml \ No newline at end of file diff --git a/commandline/commands/Update.hx b/commandline/commands/Update.hx index 102cf0cd..77600497 100644 --- a/commandline/commands/Update.hx +++ b/commandline/commands/Update.hx @@ -77,17 +77,17 @@ class Update { if (curHaxeVer[i] < requiredHaxeVer[i]) { prettyPrint("!! WARNING !!"); Sys.println("Your current Haxe version is outdated."); - Sys.println('You\'re using ${haxeVer}, while the required version is 4.2.5.'); + Sys.println('You\'re using ${haxeVer}, while the minimum required version is 4.2.5.'); Sys.println('The engine may not compile with your current version of Haxe.'); - Sys.println('We recommend upgrading to 4.2.5'); + Sys.println('We recommend upgrading to 4.2.5 or newer'); break; - } else if (curHaxeVer[i] > requiredHaxeVer[i]) { + }/* else if (curHaxeVer[i] > requiredHaxeVer[i]) { prettyPrint("!! WARNING !!" + "\nUsing Haxe 4.3.0 and above is currently not recommended due to lack of testing."); Sys.println(''); Sys.println('We recommend downgrading back to 4.2.5.'); break; - } + }*/ } } diff --git a/libs.xml b/libs.xml index 103442fa..f932da09 100644 --- a/libs.xml +++ b/libs.xml @@ -5,17 +5,17 @@ - - + + - - - + + + - + diff --git a/source/funkin/backend/system/macros/NewHaxeWarning.hx b/source/funkin/backend/system/macros/NewHaxeWarning.hx index ee467955..aa3da3d9 100644 --- a/source/funkin/backend/system/macros/NewHaxeWarning.hx +++ b/source/funkin/backend/system/macros/NewHaxeWarning.hx @@ -1,16 +1,17 @@ package funkin.backend.system.macros; #if macro +@:dox(hide) class NewHaxeWarning { public static function warn() { - #if (haxe >= "4.3.0") + /*#if (haxe >= "4.3.0") Sys.println("===================="); Sys.println("[ WARNING ]"); Sys.println("Compiling with Haxe 4.3.0 isnt fully recommended yet, but it does work."); Sys.println("We recommend building the project using Haxe 4.2.5."); Sys.println("You can download it here -> https://haxe.org/download/version/4.2.5/"); Sys.println("===================="); - #end + #end*/ } } #end \ No newline at end of file diff --git a/source/funkin/backend/utils/AudioAnalyzer.hx b/source/funkin/backend/utils/AudioAnalyzer.hx index b5208fa3..03fc3967 100644 --- a/source/funkin/backend/utils/AudioAnalyzer.hx +++ b/source/funkin/backend/utils/AudioAnalyzer.hx @@ -4,7 +4,7 @@ import flixel.sound.FlxSound; import lime.media.AudioBuffer; // Thank you yosh :DDD -lunar -// (https://github.com/FNF-CNE-Devs/YoshiCrafterEngine/blob/main/source/WaveformSprite.hx) +// (https://github.com/CodenameCrew/YoshiCrafterEngine/blob/main/source/WaveformSprite.hx) class AudioAnalyzer { public var buffer:AudioBuffer; var __peakByte:Float = 0; diff --git a/source/funkin/menus/credits/CreditsCodename.hx b/source/funkin/menus/credits/CreditsCodename.hx index e6c717c0..f5929f18 100644 --- a/source/funkin/menus/credits/CreditsCodename.hx +++ b/source/funkin/menus/credits/CreditsCodename.hx @@ -10,7 +10,7 @@ using StringTools; class CreditsCodename extends funkin.options.OptionsScreen { public var error:Bool = false; - public var author:String = "FNF-CNE-Devs"; + public var author:String = "CodenameCrew"; public var totalContributions:Int = 0; public var mainDevCol:FlxColor = 0xFF9C35D5; From da717919ba291c725acfb4a73c7565e4d413dfb6 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Mon, 9 Dec 2024 22:59:45 +0100 Subject: [PATCH 08/26] Fix links --- libs.xml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/libs.xml b/libs.xml index a4b43767..2811f7b6 100644 --- a/libs.xml +++ b/libs.xml @@ -4,23 +4,23 @@ Preparing installation... - + - + - - + + - - - + + + - - + + @@ -29,10 +29,7 @@ - - - - + From d6dc3ea232369e2b7b3d59024655a4d15fd4b027 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Tue, 10 Dec 2024 04:34:53 +0100 Subject: [PATCH 09/26] Fix typos --- FEATURES.md | 6 +-- PATCHNOTES.md | 6 +-- README.md | 4 +- TODO.md | 4 +- assets/data/characters/spirit.hx | 2 +- .../data/dialogue/boxes/hating-simulator.hx | 8 ++-- assets/data/stages/mall-evil.hx | 2 +- assets/data/stages/school.xml | 2 +- assets/data/stages/spooky.hx | 2 +- assets/data/stages/tank.xml | 2 +- assets/data/weeks/weeks.txt | 2 +- assets/shaders/engine/CompatabilityGuide.md | 4 +- assets/shaders/engine/editorWaveforms.frag | 38 +++++++++---------- commandline/Main.hx | 6 +-- project.xml | 2 +- source/Xml.hx | 2 +- source/flx3d/Flx3DUtil.hx | 2 +- source/funkin/backend/FlxAnimate.hx | 6 +-- source/funkin/backend/FunkinSprite.hx | 3 +- source/funkin/backend/MusicBeatSubstate.hx | 2 +- source/funkin/backend/assets/ModsFolder.hx | 3 +- source/funkin/backend/chart/BaseGameParser.hx | 6 +-- source/funkin/backend/chart/Chart.hx | 2 +- source/funkin/backend/chart/ChartData.hx | 2 +- source/funkin/backend/chart/PsychParser.hx | 2 +- .../funkin/backend/scripting/EventManager.hx | 2 +- .../funkin/backend/scripting/GlobalScript.hx | 6 +-- source/funkin/backend/scripting/HScript.hx | 2 +- source/funkin/backend/scripting/Script.hx | 2 +- .../menu/freeplay/FreeplayAlphaUpdateEvent.hx | 4 +- .../scripting/events/note/NoteHitEvent.hx | 2 +- source/funkin/backend/shaders/FunkinShader.hx | 2 +- source/funkin/backend/system/Conductor.hx | 4 +- source/funkin/backend/system/Flags.hx | 2 +- .../backend/system/GraphicCacheSprite.hx | 2 +- source/funkin/backend/system/Logs.hx | 2 +- source/funkin/backend/system/Main.hx | 4 +- .../backend/system/framerate/Framerate.hx | 2 +- .../backend/system/framerate/SystemInfo.hx | 2 +- .../system/macros/ControlsMacro.macro.hx | 4 +- .../backend/system/macros/FlagMacro.macro.hx | 2 +- .../backend/system/macros/HashLinkFixer.hx | 8 ++-- .../backend/system/modules/AudioSwitchFix.hx | 2 +- source/funkin/backend/utils/CoolUtil.hx | 31 +++++++-------- source/funkin/backend/utils/FunkinSave.hx | 2 +- source/funkin/backend/utils/IniUtil.hx | 2 +- source/funkin/backend/utils/NativeAPI.hx | 20 +++++----- source/funkin/backend/utils/NdllUtil.hx | 2 +- source/funkin/backend/utils/ZipUtil.hx | 4 +- source/funkin/backend/utils/native/Windows.hx | 4 +- source/funkin/editors/DebugOptions.hx | 8 ++-- .../editors/character/CharacterEditor.hx | 34 ++++++++--------- .../editors/character/CharacterSelection.hx | 2 +- .../editors/charter/ChartCreationScreen.hx | 16 ++++---- source/funkin/editors/charter/Charter.hx | 12 +++--- .../editors/charter/CharterAutoSaveUI.hx | 4 +- .../editors/charter/CharterMetaDataScreen.hx | 10 ++--- .../editors/charter/CharterSelection.hx | 12 +++--- .../editors/charter/CharterStrumlineScreen.hx | 22 +++++------ .../editors/charter/SongCreationScreen.hx | 10 ++--- source/funkin/editors/ui/UIColorwheel.hx | 12 +++--- source/funkin/editors/ui/UISlider.hx | 6 +-- source/funkin/editors/ui/UIUtil.hx | 2 +- source/funkin/game/NoteGroup.hx | 2 +- source/funkin/game/PlayState.hx | 4 +- source/funkin/game/SplashGroup.hx | 2 +- source/funkin/game/Stage.hx | 2 +- source/funkin/game/StrumLine.hx | 4 +- .../funkin/game/cutscenes/DialogueCutscene.hx | 2 +- .../game/cutscenes/dialogue/DialogueBox.hx | 4 +- source/funkin/menus/FreeplayState.hx | 4 +- source/funkin/menus/MainMenuState.hx | 2 +- source/funkin/menus/ui/FunkinSoundTray.hx | 2 +- source/funkin/options/Options.hx | 2 +- .../options/categories/AppearanceOptions.hx | 4 +- .../funkin/options/type/GithubIconOption.hx | 2 +- 76 files changed, 214 insertions(+), 211 deletions(-) diff --git a/FEATURES.md b/FEATURES.md index caa85417..2272cee4 100644 --- a/FEATURES.md +++ b/FEATURES.md @@ -13,7 +13,7 @@ _**QOL = Quality of Life**_ - Downscroll - Ghost Tapping - Opponent & Co-op modes -- Memory optimisation (most of the game runs < 500mb) +- Memory optimization (most of the game runs < 500mb) - Usage of [flxanimate](https://github.com/Dot-Stuff/flxanimate) on big sprites, such as Girlfriend to save memory. - You can further optimize it on certain stages by enabling `Low Memory Mode` in `Options > Appearance`. - New volume change SFX (no more loud flixel beep, customizable) @@ -36,7 +36,7 @@ _**QOL = Quality of Life**_ - Support for `hscript-improved`, a fork made to allow HScript to push modding even further - Allows for imports - Allows for public variables (variables shared between every script in a ScriptPack such as a song scripts) - - Allows for static variables (variabels shared between every single script ran in this mod) + - Allows for static variables (variables shared between every single script ran in this mod) - Allows you to use for example `boyfriend` instead of `PlayState.boyfriend` or `game.boyfriend`, for smaller and easier to comprehend code. - Allows you to use `@:bypassAccessor` - Allows you to use maps @@ -59,7 +59,7 @@ _**QOL = Quality of Life**_ - Position them - Add animations - Change their scale - - Change their scrollfactor + - Change their scroll factor - Change their zoomfactor - Turn on/off their antialiasing (on by default) - Change additional properties via child nodes. diff --git a/PATCHNOTES.md b/PATCHNOTES.md index 5a1512fe..e3e4bb46 100644 --- a/PATCHNOTES.md +++ b/PATCHNOTES.md @@ -15,7 +15,7 @@ - New SEXY editor assets by paige and nex!!!! (and lunar, does 16x16 even count??? 😭) - NEW EVENTS (Camera events, play animation, scroll speed change) - Events window is now scrollable (more events, more room) - - Custom Properities in Meta AND Character (Editable in Charter and Character Editor :D) (accessible with SONG.meta.customValues.[property] and [character].extras.[property]) + - Custom Properties in Meta AND Character (Editable in Charter and Character Editor :D) (accessible with SONG.meta.customValues.[property] and [character].extras.[property]) - SMALLER BUT STILL COOL - Multiple Icons now show up on strumlines with multiple characters in the charter - Note hoverer to show where your note is going to be placed @@ -63,7 +63,7 @@ - Fix for pressing F5 in an editor breaking it - Fix when getting GitHub data and a redirect happens - Fix for healthbar incorrectly colored in opponent mode - - Video cutscenes are ALOT more stable (thanks majigsaw :D) + - Video cutscenes are A LOT more stable (thanks majigsaw :D) - 3D now works again (so cool i love away3d in 2024) - Lots and lots of grammar and wording fixes (so true bro -lunar) - Lots and lots of other optimizations made @@ -76,5 +76,5 @@ - Some other shit idk ill add it whenever someone tells me backward compat is broke 💔 -thanks so much for the support and always being there, it really does mean alot to us < 3 +thanks so much for the support and always being there, it really does mean a lot to us < 3 we are one step closer to turning beta so we really can't wait ! \ No newline at end of file diff --git a/README.md b/README.md index 93b36034..5c67f700 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ Also, the command `.\cne test` uses the source assets folder instead of the expo ## Codename Engine -Codename Engine is a new Friday Night Funkin' Engine aimed at simplifying modding, along with extensiblity and ease of use.
+Codename Engine is a new Friday Night Funkin' Engine aimed at simplifying modding, along with extensibility and ease of use.
### Before making issues or need help with something, check our website [HERE](https://fnf-cne-devs.github.io/) (it contains a wiki of how to mod with EXAMPLES, an api, lists of mods made with Codename Engine and more)!!! #### The Engine includes many new features, as seen [here](FEATURES.md)
#### Wanna see the new features added in the most recent update? Click [here](PATCHNOTES.md)
@@ -70,7 +70,7 @@ If you don't have a github account please go onto https://fnf-cne-devs.github.io - Mod and fork the engine (without using it for illicit purposes) - Contribute to the engine (for example through *Pull Requests*, *Issues*, etc) - Create a sub engine with Codename Engine as **TEMPLATE** with **CREDITS** (for example leaving the *credits menu submenu with the GitHub contributors* and putting the *[main devs](https://github.com/FNF-CNE-Devs)* in a *README* specifying that it's a *sub engine from Codename Engine*) - - Release excutable mods that use Codename Engine as source (Specifing that uses Codename Engine by for example the same way written above this) + - Release executable mods that use Codename Engine as source (Specifying that uses Codename Engine by for example the same way written above this) - Release modpacks ### You can't: diff --git a/TODO.md b/TODO.md index 66ba0373..b3d2e4cf 100644 --- a/TODO.md +++ b/TODO.md @@ -26,7 +26,7 @@ - [ ] BPM Changes Events - [ ] Character Editor - [x] Animation Editing - - [x] Animation Deletion/Creationg + - [x] Animation Deletion/Creation - [x] Character Info Editing - [x] Character Saving - [x] Add Undos to Actions @@ -49,7 +49,7 @@ - [ ] Fix bugs ## `v1.1.0` -- [ ] Charter Waveforms (maybe in v1.1.0, dont wanna slow shit down) +- [ ] Charter Waveforms (maybe in v1.1.0, don't wanna slow shit down) - [ ] Custom classes - [ ] Proper super overrides (FlxText_HSX doesn't allow overrides for update because of this) - [ ] Custom Class extending Custom Classes diff --git a/assets/data/characters/spirit.hx b/assets/data/characters/spirit.hx index 137787e8..41b554af 100644 --- a/assets/data/characters/spirit.hx +++ b/assets/data/characters/spirit.hx @@ -7,7 +7,7 @@ function postCreate() { } var toAdd:Bool = true; // Using this just to make sure -function update(elpased) { +function update(elapsed) { if(toAdd) { toAdd = false; PlayState.instance.insert(PlayState.instance.members.indexOf(self), trail); diff --git a/assets/data/dialogue/boxes/hating-simulator.hx b/assets/data/dialogue/boxes/hating-simulator.hx index b3584aee..12bab0d2 100644 --- a/assets/data/dialogue/boxes/hating-simulator.hx +++ b/assets/data/dialogue/boxes/hating-simulator.hx @@ -1,4 +1,4 @@ -var loopedTimah:FlxTimer; // Hey! a man has fallen into the river in lego city! and if youre asking why this is here, you shall disappear! - Nex +var loopedTimer:FlxTimer; // Hey! a man has fallen into the river in lego city! and if youre asking why this is here, you shall disappear! - Nex var bgFade:FlxSprite; var hand:FlxSprite; @@ -9,7 +9,7 @@ function postCreate() { bgFade.alpha = 0; cutscene.insert(0, bgFade); - loopedTimah = new FlxTimer().start(0.83, function(tmr:FlxTimer) + loopedTimer = new FlxTimer().start(0.83, function(tmr:FlxTimer) { bgFade.alpha += (1 / 5) * 0.7; if (bgFade.alpha > 0.7) @@ -30,8 +30,8 @@ function close(event) { cutscene.curMusic?.fadeOut(1, 0); for(c in cutscene.charMap) c.visible = false; - loopedTimah.cancel(); - loopedTimah = new FlxTimer().start(0.2, function(tmr:FlxTimer) + loopedTimer.cancel(); + loopedTimer = new FlxTimer().start(0.2, function(tmr:FlxTimer) { if (tmr.elapsedLoops <= 5) { cutscene.dialogueBox.alpha -= 1 / 5; diff --git a/assets/data/stages/mall-evil.hx b/assets/data/stages/mall-evil.hx index ef8685cf..ead73b80 100644 --- a/assets/data/stages/mall-evil.hx +++ b/assets/data/stages/mall-evil.hx @@ -11,7 +11,7 @@ function create() { } var adder:Int = 0; -function postUpdate(elapsed:Float) { // Doing it like this so at least the red bump doesnt look too much instant +function postUpdate(elapsed:Float) { // Doing it like this so at least the red bump doesn't look too much instant var toAdd:Int = lerp(adder, 0, elapsed); idk.amount = camGame.zoom * camHUD.zoom + toAdd; idk.strength = (camGame.zoom - camHUD.zoom + toAdd) * 5; diff --git a/assets/data/stages/school.xml b/assets/data/stages/school.xml index 7a2740ad..5647a6f7 100644 --- a/assets/data/stages/school.xml +++ b/assets/data/stages/school.xml @@ -16,7 +16,7 @@ antialiasing="false" scale="4.797" scroll="0.9" updateHitbox="true" type="loop"/> - + diff --git a/assets/data/stages/spooky.hx b/assets/data/stages/spooky.hx index 340a80f3..a8531fe4 100644 --- a/assets/data/stages/spooky.hx +++ b/assets/data/stages/spooky.hx @@ -16,7 +16,7 @@ public function lightningStrikeShit():Void lightningStrikeBeat = curBeat; lightningOffset = FlxG.random.int(8, 24); - boyfriend.playAnim('scared', true, "SING"); // SING so that they dont get indefinitely looped + boyfriend.playAnim('scared', true, "SING"); // SING so that they don't get indefinitely looped gf.playAnim('scared', true, "SING"); } diff --git a/assets/data/stages/tank.xml b/assets/data/stages/tank.xml index d321e315..b0c1d97a 100644 --- a/assets/data/stages/tank.xml +++ b/assets/data/stages/tank.xml @@ -25,7 +25,7 @@ - + diff --git a/assets/data/weeks/weeks.txt b/assets/data/weeks/weeks.txt index 570a1bb5..d5b81933 100644 --- a/assets/data/weeks/weeks.txt +++ b/assets/data/weeks/weeks.txt @@ -1,4 +1,4 @@ -# THIS FILE ISNT NECESSARY, +# THIS FILE ISN'T NECESSARY, # BUT YOU CAN USE IT TO SORT WEEKS tutorial diff --git a/assets/shaders/engine/CompatabilityGuide.md b/assets/shaders/engine/CompatabilityGuide.md index 2fe7bc87..bee94522 100644 --- a/assets/shaders/engine/CompatabilityGuide.md +++ b/assets/shaders/engine/CompatabilityGuide.md @@ -1,4 +1,4 @@ -## Here are guides on common mistakes and advices for writting shaders for flixel and openfl. +## Here are guides on common mistakes and advices for writing shaders for flixel and openfl. It's important to follow this guide as most shader coders make these mistakes a lot and end up with shaders that only work on certain devices. @@ -51,7 +51,7 @@ We will show each step to converting this shader into an usable openfl/flixel sh 1. replace ``void mainImage( out vec4 fragColor, in vec2 fragCoord )`` with a simple ``void main()`` (flixel and openfl do not have any parameters since the coords are defined outside the function) 2. replace ``vec2 uv = fragCoord/iResolution.xy;`` with ``vec2 uv = openfl_TextureCoordv`` (or in some cases, add ``vec2 fragCoord = openfl_TextureCoordv*openfl_TextureSize.xy`` before it and replace `iResolution.xy` with ``openfl_TextureSize.xy`` (if the uv value is different than usual)) -3. replace ``vec4 col = texture(iChannel0, uv);`` with ``vec4 col = texture2D(bitmap, uv);`` or ``vec4 col = flixel_texture2D(bitmap, uv);`` (keep in mind bitmap is the pixels of the camera/sprite the shader is aplied to) +3. replace ``vec4 col = texture(iChannel0, uv);`` with ``vec4 col = texture2D(bitmap, uv);`` or ``vec4 col = flixel_texture2D(bitmap, uv);`` (keep in mind bitmap is the pixels of the camera/sprite the shader is applied to) 4. finally, replace ``fragColor = col;`` with ``gl_FragColor = col;`` ###### Keep in mind that this covers the most basic on how to convert a shader from shadertoy.com, complex shaders will need more expertise with handling shaders before converting those. diff --git a/assets/shaders/engine/editorWaveforms.frag b/assets/shaders/engine/editorWaveforms.frag index b90ea5ea..490d6698 100644 --- a/assets/shaders/engine/editorWaveforms.frag +++ b/assets/shaders/engine/editorWaveforms.frag @@ -5,8 +5,8 @@ const vec3 gradient1 = vec3(114.0/255.0, 81.0/255.0, 135.0/255.0); const vec3 gradient2 = vec3(144.0/255.0, 80.0/255.0, 186.0/255.0); -const vec4 outlinecolor = vec4(0.1); -const vec3 lowdetailcol = vec3(0.0, 0.0, 1.0); +const vec4 outlineColor = vec4(0.1); +const vec3 lowDetailCol = vec3(0.0, 0.0, 1.0); uniform vec2 textureRes; uniform float pixelOffset; @@ -21,7 +21,7 @@ uniform bool lowDetail; float getAmplitude(vec2 pixel) { float pixelID = floor((pixel.y+pixelOffset)/3.0); - // TODO: INVESTIGATE THE 1.+ AND WHY IT WORKS (SRSLY I GOT NO CLUE) -lunar + // TODO: INVESTIGATE THE 1.+ AND WHY IT WORKS (SERIOUSLY I GOT NO CLUE) -lunar vec2 wavePixel = vec2(mod(pixelID, waveformSize.x), 1.0+floor(pixelID/waveformSize.x)); vec4 waveData = texture2D(waveformTexture, wavePixel / waveformSize); @@ -41,28 +41,28 @@ bool inWaveForm(vec2 pixel, float width) { return pixel.x > widthdiv2 && pixel.x < textureRes.x-widthdiv2; } -float getHightlight(float ampwidth) { - float remapCoord = (ampwidth/textureRes.x)/2.0; +float getHighlight(float ampWidth) { + float remapCoord = (ampWidth/textureRes.x)/2.0; float mappedCoord = map(openfl_TextureCoordv.x, remapCoord, 1.0-remapCoord, 0.0, 1.0); return 1.0-(abs(mappedCoord-0.5)*2.0); } void outlineWaveform(vec2 pixel, vec2 offset) { float amplitude = getAmplitude(pixel - offset); - float ampwidth = (1.0-amplitude) * textureRes.x; + float ampWidth = (1.0-amplitude) * textureRes.x; - if (!inWaveForm(pixel, ampwidth)) - gl_FragColor -= outlinecolor*mix(0.5, 0.8, amplitude); + if (!inWaveForm(pixel, ampWidth)) + gl_FragColor -= outlineColor*mix(0.5, 0.8, amplitude); } -void highDetailWaveform(vec2 pixel, float amplitude, float ampwidth) { +void highDetailWaveform(vec2 pixel, float amplitude, float ampWidth) { vec3 gradientColor = mix(gradient1, gradient2, openfl_TextureCoordv.x); gradientColor *= pixel.y+pixelOffset>playerPosition ? 0.7 : 1.0; - gradientColor = mix(gradientColor, gradientColor * vec3(1.8), map(getHightlight(amplitude), 0.0, 1.0, 0.5, 1.0)); + gradientColor = mix(gradientColor, gradientColor * vec3(1.8), map(getHighlight(amplitude), 0.0, 1.0, 0.5, 1.0)); - float ampwidthHighlight = getAmpWidth(amplitude/3.0); - if (inWaveForm(pixel, ampwidthHighlight)) - gradientColor = mix(gradientColor, gradientColor * vec3(1.8), map(getHightlight(ampwidthHighlight), 0.0, 1.0, 0.5, 1.0)); + float ampWidthHighlight = getAmpWidth(amplitude/3.0); + if (inWaveForm(pixel, ampWidthHighlight)) + gradientColor = mix(gradientColor, gradientColor * vec3(1.8), map(getHighlight(ampWidthHighlight), 0.0, 1.0, 0.5, 1.0)); gl_FragColor = vec4(vec3(gradientColor * mix(0.5, 0.8, amplitude))*openfl_Alphav, openfl_Alphav); @@ -70,19 +70,19 @@ void highDetailWaveform(vec2 pixel, float amplitude, float ampwidth) { outlineWaveform(pixel, vec2(0.0, 1.0)); } -void lowDetailWaveform(vec2 pixel, float amplitude, float ampwidth) { - gl_FragColor = vec4(lowdetailcol * (pixel.y+pixelOffset>playerPosition ? 0.7 : 1.0), 1.0); +void lowDetailWaveform(vec2 pixel, float amplitude, float ampWidth) { + gl_FragColor = vec4(lowDetailCol * (pixel.y+pixelOffset>playerPosition ? 0.7 : 1.0), 1.0); } void main() { vec2 pixel = openfl_TextureCoordv * textureRes; float amplitude = getAmplitude(pixel); - float ampwidth = getAmpWidth(amplitude); + float ampWidth = getAmpWidth(amplitude); gl_FragColor = vec4(0.0); - if (!inWaveForm(pixel, ampwidth)) return; + if (!inWaveForm(pixel, ampWidth)) return; - if (lowDetail) lowDetailWaveform(pixel, amplitude, ampwidth); - else highDetailWaveform(pixel, amplitude, ampwidth); + if (lowDetail) lowDetailWaveform(pixel, amplitude, ampWidth); + else highDetailWaveform(pixel, amplitude, ampWidth); } \ No newline at end of file diff --git a/commandline/Main.hx b/commandline/Main.hx index 1b5b01b8..fc0c7333 100644 --- a/commandline/Main.hx +++ b/commandline/Main.hx @@ -41,7 +41,7 @@ class Main { dDoc: [ "Usage: test ", "", - "This will create a quick debug build binded to the source then run it, which means:", + "This will create a quick debug build connected to the source then run it, which means:", "- The assets WON'T be copied over - Assets will be read from the game's source.", "- This build WON'T be ready for release - Running anywhere else than in the bin folder will result in a crash from missing assets", "- This build will also use the mods folder from the source directory.", @@ -59,7 +59,7 @@ class Main { dDoc: [ "Usage: build ", "", - "This will create a quick debug build binded to the source then run it, which means:", + "This will create a quick debug build connected to the source then run it, which means:", "- The assets WON'T be copied over - Assets will be read from the game's source.", "- This build WON'T be ready for release - Running anywhere else than in the bin folder will result in a crash from missing assets", "- This build will also use the mods folder from the source directory.", @@ -103,7 +103,7 @@ class Main { "", "This will optimize a JSON file, which means it will remove all unnecessary spacing from the file.", "WARNING: Order might be lost.", - "WARNING: Comments arent supported.", + "WARNING: Comments aren't supported.", "", "-O | --no-old : No Old file will be created.", ].join("\n") diff --git a/project.xml b/project.xml index 81ef21ec..a1ba997f 100644 --- a/project.xml +++ b/project.xml @@ -133,7 +133,7 @@ - + diff --git a/source/Xml.hx b/source/Xml.hx index 82613dcd..143bc693 100644 --- a/source/Xml.hx +++ b/source/Xml.hx @@ -363,7 +363,7 @@ class Xml { /** Removes a child from the Document or Element. - Returns true if the child was successfuly removed. + Returns true if the child was successfully removed. **/ public function removeChild(x:Xml):Bool { ensureElementType(); diff --git a/source/flx3d/Flx3DUtil.hx b/source/flx3d/Flx3DUtil.hx index 029a06f3..b90076a8 100644 --- a/source/flx3d/Flx3DUtil.hx +++ b/source/flx3d/Flx3DUtil.hx @@ -7,7 +7,7 @@ import flixel.FlxG; #end /** - * @author lunarclient + * @author lunarcleint * @see https://twitter.com/lunarcleint * * Help from Ne_Eo diff --git a/source/funkin/backend/FlxAnimate.hx b/source/funkin/backend/FlxAnimate.hx index a0df7cf9..46a4c422 100644 --- a/source/funkin/backend/FlxAnimate.hx +++ b/source/funkin/backend/FlxAnimate.hx @@ -28,7 +28,7 @@ class FlxAnimate extends flxanimate.FlxAnimate { var angleOff = (frameOffsetAngle - angle) * FlxAngle.TO_RAD; var cos = Math.cos(angleOff); var sin = Math.sin(angleOff); - // cos doesnt need to be negated + // cos doesn't need to be negated rMatrix.rotateWithTrig(cos, -sin); rMatrix.translate(-frameOffset.x, -frameOffset.y); rMatrix.rotateWithTrig(cos, sin); @@ -72,7 +72,7 @@ class FlxAnimate extends flxanimate.FlxAnimate { #end } - // doesnt work, needs to be remade + // doesn't work, needs to be remade // #if FLX_DEBUG // if (FlxG.debugger.drawDebug) // drawDebug(); @@ -81,7 +81,7 @@ class FlxAnimate extends flxanimate.FlxAnimate { override function limbOnScreen(limb:FlxFrame, m:FlxMatrix, ?Camera:FlxCamera) { - // TODO: ACTUAL OPTIMISATION + // TODO: ACTUAL OPTIMIZATION return true; } } \ No newline at end of file diff --git a/source/funkin/backend/FunkinSprite.hx b/source/funkin/backend/FunkinSprite.hx index 22257ad4..00373e7b 100644 --- a/source/funkin/backend/FunkinSprite.hx +++ b/source/funkin/backend/FunkinSprite.hx @@ -49,7 +49,8 @@ class FunkinSprite extends FlxSkewedSprite implements IBeatReceiver implements I public var globalCurFrame(get, set):Int; /** - * ODD interval -> asynced; EVEN interval -> synced + * ODD interval -> not aligned to beats + * EVEN interval -> aligned to beats */ public var beatInterval(default, set):Int = 2; public var beatOffset:Int = 0; diff --git a/source/funkin/backend/MusicBeatSubstate.hx b/source/funkin/backend/MusicBeatSubstate.hx index d0d0f86f..49025664 100644 --- a/source/funkin/backend/MusicBeatSubstate.hx +++ b/source/funkin/backend/MusicBeatSubstate.hx @@ -17,7 +17,7 @@ class MusicBeatSubstate extends FlxSubState implements IBeatReceiver private var lastStep:Float = 0; /** - * Whether this specifc substate can open custom transitions + * Whether this specific substate can open custom transitions */ public var canOpenCustomTransition:Bool = false; /** diff --git a/source/funkin/backend/assets/ModsFolder.hx b/source/funkin/backend/assets/ModsFolder.hx index 9f761b85..0f837351 100644 --- a/source/funkin/backend/assets/ModsFolder.hx +++ b/source/funkin/backend/assets/ModsFolder.hx @@ -42,8 +42,9 @@ class ModsFolder { * Whenever its the first time mods has been reloaded. */ private static var __firstTime:Bool = true; + /** - * Initialises `mods` folder. + * Initializes `mods` folder. */ public static function init() { if(!getModsList().contains(Options.lastLoadedMod)) diff --git a/source/funkin/backend/chart/BaseGameParser.hx b/source/funkin/backend/chart/BaseGameParser.hx index 84b281aa..02c89c81 100644 --- a/source/funkin/backend/chart/BaseGameParser.hx +++ b/source/funkin/backend/chart/BaseGameParser.hx @@ -15,9 +15,9 @@ class BaseGameParser { result.customValues = {}; result.customValues.timeChanges = data.timeChanges; - var firstTimeChng:SwagTimeChange = data.timeChanges[0]; - result.bpm = firstTimeChng.bpm; - result.beatsPerMeasure = firstTimeChng.b != null ? firstTimeChng.b : Flags.DEFAULT_BEATS_PER_MEASURE; + var firstTimeChange:SwagTimeChange = data.timeChanges[0]; + result.bpm = firstTimeChange.bpm; + result.beatsPerMeasure = firstTimeChange.b != null ? firstTimeChange.b : Flags.DEFAULT_BEATS_PER_MEASURE; result.difficulties = data.playData.difficulties.concat(data.playData.songVariations); Reflect.deleteField(data.playData, "difficulties"); diff --git a/source/funkin/backend/chart/Chart.hx b/source/funkin/backend/chart/Chart.hx index b6bc18eb..07b2a2ae 100644 --- a/source/funkin/backend/chart/Chart.hx +++ b/source/funkin/backend/chart/Chart.hx @@ -55,7 +55,7 @@ class Chart { } public static function detectChartFormat(data:Dynamic):ChartFormat { - var __temp:Dynamic; // imma reuse this var so the program doesnt have to get values multiple times - Nex + var __temp:Dynamic; // imma reuse this var so the program doesn't have to get values multiple times - Nex if ((__temp = data.codenameChart) == true || __temp == "true") return CODENAME; diff --git a/source/funkin/backend/chart/ChartData.hx b/source/funkin/backend/chart/ChartData.hx index 425cfc3a..25e98597 100644 --- a/source/funkin/backend/chart/ChartData.hx +++ b/source/funkin/backend/chart/ChartData.hx @@ -44,7 +44,7 @@ typedef ChartStrumLine = { var ?scrollSpeed:Float; var ?vocalsSuffix:String; - var ?strumLinePos:Float; // Backwards compatability + var ?strumLinePos:Float; // Backwards compatibility } typedef ChartNote = { diff --git a/source/funkin/backend/chart/PsychParser.hx b/source/funkin/backend/chart/PsychParser.hx index c51d0b30..3249780e 100644 --- a/source/funkin/backend/chart/PsychParser.hx +++ b/source/funkin/backend/chart/PsychParser.hx @@ -106,7 +106,7 @@ class PsychParser { var eventStep:Float = Conductor.getStepForTime(event.time); psychEvents.push([ "Change Scroll Speed", - FlxMath.roundDecimal(event.params[1]/chart.scrollSpeed, 2), // SCROLL SPEED MULTIPLER + FlxMath.roundDecimal(event.params[1]/chart.scrollSpeed, 2), // SCROLL SPEED MULTIPLIER FlxMath.roundDecimal( // TIME event.params[0] ? // IS TWEENED? (Conductor.getTimeForStep(eventStep+event.params[2]) - Conductor.getTimeForStep(eventStep))/1000 diff --git a/source/funkin/backend/scripting/EventManager.hx b/source/funkin/backend/scripting/EventManager.hx index ab47bb5d..34c1a473 100644 --- a/source/funkin/backend/scripting/EventManager.hx +++ b/source/funkin/backend/scripting/EventManager.hx @@ -4,7 +4,7 @@ import flixel.FlxState; import funkin.backend.scripting.events.*; class EventManager { - // map doesnt work for that + // map doesn't work for that public static var eventValues:Array = []; public static var eventKeys:Array> = []; diff --git a/source/funkin/backend/scripting/GlobalScript.hx b/source/funkin/backend/scripting/GlobalScript.hx index 1ca88772..ecd52be7 100644 --- a/source/funkin/backend/scripting/GlobalScript.hx +++ b/source/funkin/backend/scripting/GlobalScript.hx @@ -11,11 +11,11 @@ import funkin.backend.system.Conductor; class GlobalScript { public static var scripts:ScriptPack; - private static var initalized:Bool = false; + private static var initialized:Bool = false; public static function init() { - if(initalized) return; - initalized = true; + if(initialized) return; + initialized = true; #if MOD_SUPPORT ModsFolder.onModSwitch.add(onModSwitch); #end diff --git a/source/funkin/backend/scripting/HScript.hx b/source/funkin/backend/scripting/HScript.hx index 62a80fe4..f937d3dc 100644 --- a/source/funkin/backend/scripting/HScript.hx +++ b/source/funkin/backend/scripting/HScript.hx @@ -16,7 +16,7 @@ class HScript extends Script { public static function initParser() { var parser = new Parser(); parser.allowJSON = parser.allowMetadata = parser.allowTypes = true; - parser.preprocesorValues = Script.getDefaultPreprocessors(); + parser.preprocessorValues = Script.getDefaultPreprocessors(); return parser; } diff --git a/source/funkin/backend/scripting/Script.hx b/source/funkin/backend/scripting/Script.hx index f493aff2..8dde2413 100644 --- a/source/funkin/backend/scripting/Script.hx +++ b/source/funkin/backend/scripting/Script.hx @@ -307,7 +307,7 @@ class Script extends FlxBasic implements IFlxDestroyable { } /** - * Loads the code from a string, doesnt really work after the script has been loaded + * Loads the code from a string, doesn't really work after the script has been loaded * @param code The code. */ public function loadFromString(code:String) { diff --git a/source/funkin/backend/scripting/events/menu/freeplay/FreeplayAlphaUpdateEvent.hx b/source/funkin/backend/scripting/events/menu/freeplay/FreeplayAlphaUpdateEvent.hx index d8ab6f0b..48e20db1 100644 --- a/source/funkin/backend/scripting/events/menu/freeplay/FreeplayAlphaUpdateEvent.hx +++ b/source/funkin/backend/scripting/events/menu/freeplay/FreeplayAlphaUpdateEvent.hx @@ -2,11 +2,11 @@ package funkin.backend.scripting.events.menu.freeplay; final class FreeplayAlphaUpdateEvent extends CancellableEvent { /** - * The alpha when nothing is playing and isnt selected + * The alpha when nothing is playing and isn't selected */ public var idleAlpha:Float; /** - * The alpha when something is playing and isnt selected + * The alpha when something is playing and isn't selected */ public var idlePlayingAlpha:Float; /** diff --git a/source/funkin/backend/scripting/events/note/NoteHitEvent.hx b/source/funkin/backend/scripting/events/note/NoteHitEvent.hx index 4c4a2053..5614b75c 100644 --- a/source/funkin/backend/scripting/events/note/NoteHitEvent.hx +++ b/source/funkin/backend/scripting/events/note/NoteHitEvent.hx @@ -86,7 +86,7 @@ final class NoteHitEvent extends CancellableEvent { */ public var healthGain:Float; /** - * Rating name. Defaults to "sick", "good", "bad" and "shit". Customisable. + * Rating name. Defaults to "sick", "good", "bad" and "shit". Customizable. */ public var rating:String = "sick"; /** diff --git a/source/funkin/backend/shaders/FunkinShader.hx b/source/funkin/backend/shaders/FunkinShader.hx index 7d34e890..d3af27b5 100644 --- a/source/funkin/backend/shaders/FunkinShader.hx +++ b/source/funkin/backend/shaders/FunkinShader.hx @@ -532,7 +532,7 @@ class FunkinShader extends FlxShader implements IHScriptCustomBehaviour { // cant do "field is ShaderInput" because ShaderInput has the @:generic metadata // aka instead of ShaderInput it gets built as ShaderInput_Float - // this should be fine tho because we check the class, and the fields dont vary based on the type + // this should be fine tho because we check the class, and the fields don't vary based on the type // thanks for looking in the code cne fans :D!! -lunar diff --git a/source/funkin/backend/system/Conductor.hx b/source/funkin/backend/system/Conductor.hx index 56dbfcd9..aaf47774 100644 --- a/source/funkin/backend/system/Conductor.hx +++ b/source/funkin/backend/system/Conductor.hx @@ -38,7 +38,7 @@ class Conductor public static var stepCrochet:Float = crochet / 4; // steps in milliseconds /** - * Number of beats per mesure (top number in time signature). Defaults to 4. + * Number of beats per measure (top number in time signature). Defaults to 4. */ public static var beatsPerMeasure:Float = 4; @@ -190,7 +190,7 @@ class Conductor __updateSongPos(FlxG.elapsed); if (bpm > 0) { - // updates curbeat and stuff + // updates curBeat and stuff __lastChange = { stepTime: 0, songTime: 0, diff --git a/source/funkin/backend/system/Flags.hx b/source/funkin/backend/system/Flags.hx index 1a28c222..214216d6 100644 --- a/source/funkin/backend/system/Flags.hx +++ b/source/funkin/backend/system/Flags.hx @@ -76,7 +76,7 @@ class Flags { public static var DEFAULT_OPPONENT_MODE_ALLOWED:Bool = false; @:also(funkin.game.PlayState.coopMode) - public static var DEFAULT_COOP_MODE:Bool = false; // used in playstate if it doesnt find it + public static var DEFAULT_COOP_MODE:Bool = false; // used in playstate if it doesn't find it @:also(funkin.game.PlayState.opponentMode) public static var DEFAULT_OPPONENT_MODE:Bool = false; diff --git a/source/funkin/backend/system/GraphicCacheSprite.hx b/source/funkin/backend/system/GraphicCacheSprite.hx index fd03bdc4..6ff61905 100644 --- a/source/funkin/backend/system/GraphicCacheSprite.hx +++ b/source/funkin/backend/system/GraphicCacheSprite.hx @@ -3,7 +3,7 @@ package funkin.backend.system; import flixel.graphics.FlxGraphic; /** - * Dummy FlxSprite that allows you to cache FlxGraphics, and immediatly send them to GPU memory. + * Dummy FlxSprite that allows you to cache FlxGraphics, and immediately send them to GPU memory. */ class GraphicCacheSprite extends FlxSprite { /** diff --git a/source/funkin/backend/system/Logs.hx b/source/funkin/backend/system/Logs.hx index 60713004..4c8223a4 100644 --- a/source/funkin/backend/system/Logs.hx +++ b/source/funkin/backend/system/Logs.hx @@ -31,7 +31,7 @@ class Logs { var prefix = "[FLIXEL]"; var color:ConsoleColor = LIGHTGRAY; var level:Level = INFO; - if (style == LogStyle.CONSOLE) // cant place a switch here as these arent inline values - Nex + if (style == LogStyle.CONSOLE) // cant place a switch here as these aren't inline values - Nex { prefix = "> "; color = WHITE; diff --git a/source/funkin/backend/system/Main.hx b/source/funkin/backend/system/Main.hx index 9ada0694..31a9d8e7 100644 --- a/source/funkin/backend/system/Main.hx +++ b/source/funkin/backend/system/Main.hx @@ -202,8 +202,8 @@ class Main extends Sprite } private static function onStateSwitchPost() { - // manual asset clearing since base openfl one doesnt clear lime one - // doesnt clear bitmaps since flixel fork does it auto + // manual asset clearing since base openfl one does'nt clear lime one + // does'nt clear bitmaps since flixel fork does it auto @:privateAccess { // clear uint8 pools diff --git a/source/funkin/backend/system/framerate/Framerate.hx b/source/funkin/backend/system/framerate/Framerate.hx index 7e8e3f8e..237762dc 100644 --- a/source/funkin/backend/system/framerate/Framerate.hx +++ b/source/funkin/backend/system/framerate/Framerate.hx @@ -126,7 +126,7 @@ class Framerate extends Sprite { bgSprite.scaleY = height; var selectable = debugMode == 2; - { // idk i tried to make it more lookable:sob: - Nex + { // idk i tried to make it more readable:sob: - Nex memoryCounter.memoryText.selectable = memoryCounter.memoryPeakText.selectable = fpsCounter.fpsNum.selectable = fpsCounter.fpsLabel.selectable = #if SHOW_BUILD_ON_FPS codenameBuildField.selectable = #end selectable; diff --git a/source/funkin/backend/system/framerate/SystemInfo.hx b/source/funkin/backend/system/framerate/SystemInfo.hx index e736b7d2..637f4bdc 100644 --- a/source/funkin/backend/system/framerate/SystemInfo.hx +++ b/source/funkin/backend/system/framerate/SystemInfo.hx @@ -63,7 +63,7 @@ class SystemInfo extends FramerateCategory { cpuName = process.stdout.readAll().toString().trim().split("\n")[1].trim(); #elseif mac - var process = new HiddenProcess("sysctl -a | grep brand_string"); // Somehow this isnt able to use the args but it still works + var process = new HiddenProcess("sysctl -a | grep brand_string"); // Somehow this isn't able to use the args but it still works if (process.exitCode() != 0) throw 'Could not fetch CPU information'; cpuName = process.stdout.readAll().toString().trim().split(":")[1].trim(); diff --git a/source/funkin/backend/system/macros/ControlsMacro.macro.hx b/source/funkin/backend/system/macros/ControlsMacro.macro.hx index 49cb0a65..2219a677 100644 --- a/source/funkin/backend/system/macros/ControlsMacro.macro.hx +++ b/source/funkin/backend/system/macros/ControlsMacro.macro.hx @@ -78,9 +78,9 @@ class ControlsMacro }); function buildBindControl(s:String, prefix:String) { - var prefixxed = prefix + s; + var prefixed = prefix + s; - return macro bindKeys(Control.$s, Options.$prefixxed); + return macro bindKeys(Control.$s, Options.$prefixed); } fields.push({ diff --git a/source/funkin/backend/system/macros/FlagMacro.macro.hx b/source/funkin/backend/system/macros/FlagMacro.macro.hx index d18c10d1..b1e6b68d 100644 --- a/source/funkin/backend/system/macros/FlagMacro.macro.hx +++ b/source/funkin/backend/system/macros/FlagMacro.macro.hx @@ -184,7 +184,7 @@ class FlagMacro { } case TPath({name: "Array", pack: []}): - Context.error("Flag " + field.name + " cannot be an Array that isnt a String or Bool or TrimmedString or Int or Float", field.pos); + Context.error("Flag " + field.name + " cannot be an Array that isn't a String or Bool or TrimmedString or Int or Float", field.pos); case TPath({name: "Map", pack: []}): Context.error("Flag " + field.name + " cannot be a Map", field.pos); default: diff --git a/source/funkin/backend/system/macros/HashLinkFixer.hx b/source/funkin/backend/system/macros/HashLinkFixer.hx index 697d3c01..0a46990b 100644 --- a/source/funkin/backend/system/macros/HashLinkFixer.hx +++ b/source/funkin/backend/system/macros/HashLinkFixer.hx @@ -81,8 +81,8 @@ class HashLinkFixer { var returns:Bool = !fun.ret.match(TPath({name: "Void"})); var printer = new haxe.macro.Printer(); - if(cl.module == "hl.Gc" && fun.ret == null) returns = false; // fix since they dont explicitly set :Void - if(cl.module == "hl.Format" && fun.ret == null) returns = false; // fix since they dont explicitly set :Void + if(cl.module == "hl.Gc" && fun.ret == null) returns = false; // fix since they don't explicitly set :Void + if(cl.module == "hl.Format" && fun.ret == null) returns = false; // fix since they don't explicitly set :Void var name = 'hlf_${f.name}'; @@ -114,7 +114,7 @@ class HashLinkFixer { default: } - var fiel:Field = { + var field:Field = { name: name, pos: Context.currentPos(), kind: FFun({ @@ -126,7 +126,7 @@ class HashLinkFixer { access: f.access.copy().filter(function(a) return a != APublic && a != APrivate).concat([APrivate]), meta: meta }; - fields.push(fiel); + fields.push(field); definedFields.push(f.name); // Remove meta from original function diff --git a/source/funkin/backend/system/modules/AudioSwitchFix.hx b/source/funkin/backend/system/modules/AudioSwitchFix.hx index 86ebcb0a..941846e0 100644 --- a/source/funkin/backend/system/modules/AudioSwitchFix.hx +++ b/source/funkin/backend/system/modules/AudioSwitchFix.hx @@ -6,7 +6,7 @@ import funkin.backend.utils.NativeAPI; import lime.media.AudioManager; /** - * if youre stealing this keep this comment at least please lol + * if you are stealing this keep this comment at least please lol * * hi gray itsa me yoshicrafter29 i fixed it hehe */ diff --git a/source/funkin/backend/utils/CoolUtil.hx b/source/funkin/backend/utils/CoolUtil.hx index a33e11d2..86f68383 100644 --- a/source/funkin/backend/utils/CoolUtil.hx +++ b/source/funkin/backend/utils/CoolUtil.hx @@ -117,14 +117,14 @@ class CoolUtil * Gets file attributes from a file or a folder adding eventual missing folders in the path * (WARNING: Only works on `windows` for now. On other platforms the attributes' value it's always going to be `0` -thanks to the wrapper you can also use `isNothing` for checking- but still creates eventual missing folders if the platforms allows it to). * @param path Path to the file or folder - * @param useAbsol If it should use the absolute path (By default it's `true` but if it's `false` you can use files outside from this program's directory for example) + * @param useAbsolute If it should use the absolute path (By default it's `true` but if it's `false` you can use files outside from this program's directory for example) * @return The attributes through the `FileAttributeWrapper` */ - @:noUsing public static inline function safeGetAttributes(path:String, useAbsol:Bool = true):FileAttributeWrapper { + @:noUsing public static inline function safeGetAttributes(path:String, useAbsolute:Bool = true):FileAttributeWrapper { #if sys addMissingFolders(Path.directory(path)); - var result = NativeAPI.getFileAttributes(path, useAbsol); + var result = NativeAPI.getFileAttributes(path, useAbsolute); if(result.isNothing) Logs.trace('The file where it has been tried to get the attributes from, might be corrupted or inexistent (code: ${result.getValue()})', WARNING); return result; #else @@ -137,15 +137,15 @@ class CoolUtil * (WARNING: Only works on `windows` for now. On other platforms the return code it's always going to be `0` but still creates eventual missing folders if the platforms allows it to). * @param path Path to the file or folder * @param attrib The attribute(s) to set (WARNING: There are some non settable attributes, such as the `COMPRESSED` one) - * @param useAbsol If it should use the absolute path (By default it's `true` but if it's `false` you can use files outside from this program's directory for example) + * @param useAbsolute If it should use the absolute path (By default it's `true` but if it's `false` you can use files outside from this program's directory for example) * @return The result code: `0` means that it failed setting */ - @:noUsing public static inline function safeSetAttributes(path:String, attrib:OneOfThree, useAbsol:Bool = true):Int { + @:noUsing public static inline function safeSetAttributes(path:String, attrib:OneOfThree, useAbsolute:Bool = true):Int { // yes, i'm aware that FileAttribute is also an Int so need to include it too, but at least like this we don't have to make cast sometimes while passing the arguments - Nex #if sys addMissingFolders(Path.directory(path)); - var result = NativeAPI.setFileAttributes(path, attrib, useAbsol); + var result = NativeAPI.setFileAttributes(path, attrib, useAbsolute); if(result == 0) Logs.trace('Failed to set attributes to $path with a code of: $result', WARNING); return result; #else @@ -158,14 +158,14 @@ class CoolUtil * (WARNING: Only works on `windows` for now. On other platforms the return code it's always going to be `0` but still creates eventual missing folders if the platforms allows it to). * @param path Path to the file or folder * @param attrib The attribute(s) to add (WARNING: There are some non settable attributes, such as the `COMPRESSED` one) - * @param useAbsol If it should use the absolute path (By default it's `true` but if it's `false` you can use files outside from this program's directory for example) + * @param useAbsolute If it should use the absolute path (By default it's `true` but if it's `false` you can use files outside from this program's directory for example) * @return The result code: `0` means that it failed setting */ - @:noUsing public static inline function safeAddAttributes(path:String, attrib:OneOfTwo, useAbsol:Bool = true):Int { + @:noUsing public static inline function safeAddAttributes(path:String, attrib:OneOfTwo, useAbsolute:Bool = true):Int { #if sys addMissingFolders(Path.directory(path)); - var result = NativeAPI.addFileAttributes(path, attrib, useAbsol); + var result = NativeAPI.addFileAttributes(path, attrib, useAbsolute); if(result == 0) Logs.trace('Failed to add attributes to $path with a code of: $result', WARNING); return result; #else @@ -178,14 +178,14 @@ class CoolUtil * (WARNING: Only works on `windows` for now. On other platforms the return code it's always going to be `0` but still creates eventual missing folders if the platforms allows it to). * @param path Path to the file or folder * @param attrib The attribute(s) to remove (WARNING: There are some non settable attributes, such as the `COMPRESSED` one) - * @param useAbsol If it should use the absolute path (By default it's `true` but if it's `false` you can use files outside from this program's directory for example) + * @param useAbsolute If it should use the absolute path (By default it's `true` but if it's `false` you can use files outside from this program's directory for example) * @return The result code: `0` means that it failed setting */ - @:noUsing public static inline function safeRemoveAttributes(path:String, attrib:OneOfTwo, useAbsol:Bool = true):Int { + @:noUsing public static inline function safeRemoveAttributes(path:String, attrib:OneOfTwo, useAbsolute:Bool = true):Int { #if sys addMissingFolders(Path.directory(path)); - var result = NativeAPI.removeFileAttributes(path, attrib, useAbsol); + var result = NativeAPI.removeFileAttributes(path, attrib, useAbsolute); if(result == 0) Logs.trace('Failed to remove attributes to $path with a code of: $result', WARNING); return result; #else @@ -426,7 +426,7 @@ class CoolUtil var beatsPerMeasure:Float = Flags.DEFAULT_BEATS_PER_MEASURE; var stepsPerBeat:Int = Flags.DEFAULT_STEPS_PER_BEAT; - // Check later, i dont think timeSignParsed can contain null, only nan + // Check later, i don't think timeSignParsed can contain null, only nan if (timeSignParsed.length == 2 && !timeSignParsed.contains(null)) { beatsPerMeasure = timeSignParsed[0] == null || timeSignParsed[0] <= 0 ? Flags.DEFAULT_BEATS_PER_MEASURE : cast timeSignParsed[0]; stepsPerBeat = timeSignParsed[1] == null || timeSignParsed[1] <= 0 ? Flags.DEFAULT_STEPS_PER_BEAT : cast timeSignParsed[1]; @@ -884,9 +884,10 @@ class CoolUtil * Converts an array of numbers into a string of ranges. * Example: [1,2,3,5,7,8,9,8,7,6,5] -> "1..3,5,7..9,8..5" * @param numbers Array of numbers + * @param separator Separator between ranges * @return String representing the ranges */ - public static function formatNumberRange(numbers:Array, seperator:String = ","):String { + public static function formatNumberRange(numbers:Array, separator:String = ","):String { if (numbers.length == 0) return ""; var result:Array = []; @@ -923,7 +924,7 @@ class CoolUtil i++; } - return result.join(seperator); + return result.join(separator); } public static function deepFlatten(arr:Array, ?result:Array):Array { diff --git a/source/funkin/backend/utils/FunkinSave.hx b/source/funkin/backend/utils/FunkinSave.hx index 82167fe6..eeb4b266 100644 --- a/source/funkin/backend/utils/FunkinSave.hx +++ b/source/funkin/backend/utils/FunkinSave.hx @@ -32,7 +32,7 @@ class FunkinSave { if (!__eventAdded) { Lib.application.onExit.add(function(i:Int) { - trace("Saving savedata..."); + trace("Saving save data..."); flush(); }); __eventAdded = true; diff --git a/source/funkin/backend/utils/IniUtil.hx b/source/funkin/backend/utils/IniUtil.hx index e39d0a23..5de61303 100644 --- a/source/funkin/backend/utils/IniUtil.hx +++ b/source/funkin/backend/utils/IniUtil.hx @@ -1,7 +1,7 @@ package funkin.backend.utils; /** - * DOESNT SUPPORT CATEGORIES YET!! + * DOESN'T SUPPORT CATEGORIES YET!! */ class IniUtil { public static inline function parseAsset(assetPath:String, ?defaultVariables:Map) diff --git a/source/funkin/backend/utils/NativeAPI.hx b/source/funkin/backend/utils/NativeAPI.hx index e7623620..143497df 100644 --- a/source/funkin/backend/utils/NativeAPI.hx +++ b/source/funkin/backend/utils/NativeAPI.hx @@ -35,9 +35,9 @@ class NativeAPI { /** * Gets the specified file's (or folder) attributes. */ - public static function getFileAttributesRaw(path:String, useAbsol:Bool = true):Int { + public static function getFileAttributesRaw(path:String, useAbsolute:Bool = true):Int { #if windows - if(useAbsol) path = sys.FileSystem.absolutePath(path); + if(useAbsolute) path = sys.FileSystem.absolutePath(path); return Windows.getFileAttributes(path); #else return -1; @@ -47,16 +47,16 @@ class NativeAPI { /** * Gets the specified file's (or folder) attributes and passes it to `FileAttributeWrapper`. */ - public static function getFileAttributes(path:String, useAbsol:Bool = true):FileAttributeWrapper { - return new FileAttributeWrapper(getFileAttributesRaw(path, useAbsol)); + public static function getFileAttributes(path:String, useAbsolute:Bool = true):FileAttributeWrapper { + return new FileAttributeWrapper(getFileAttributesRaw(path, useAbsolute)); } /** * Sets the specified file's (or folder) attributes. If it fails, the return value is `0`. */ - public static function setFileAttributes(path:String, attrib:OneOfThree, useAbsol:Bool = true):Int { + public static function setFileAttributes(path:String, attrib:OneOfThree, useAbsolute:Bool = true):Int { #if windows - if(useAbsol) path = sys.FileSystem.absolutePath(path); + if(useAbsolute) path = sys.FileSystem.absolutePath(path); return Windows.setFileAttributes(path, attrib is FileAttributeWrapper ? cast(attrib, FileAttributeWrapper).getValue() : cast(attrib, Int)); #else return 0; @@ -66,9 +66,9 @@ class NativeAPI { /** * Removes from the specified file's (or folder) one (or more) specific attribute. */ - public static function addFileAttributes(path:String, attrib:OneOfTwo, useAbsol:Bool = true):Int { + public static function addFileAttributes(path:String, attrib:OneOfTwo, useAbsolute:Bool = true):Int { #if windows - return setFileAttributes(path, getFileAttributesRaw(path, useAbsol) | cast(attrib, Int), useAbsol); + return setFileAttributes(path, getFileAttributesRaw(path, useAbsolute) | cast(attrib, Int), useAbsolute); #else return 0; #end @@ -77,9 +77,9 @@ class NativeAPI { /** * Removes from the specified file's (or folder) one (or more) specific attribute. */ - public static function removeFileAttributes(path:String, attrib:OneOfTwo, useAbsol:Bool = true):Int { + public static function removeFileAttributes(path:String, attrib:OneOfTwo, useAbsolute:Bool = true):Int { #if windows - return setFileAttributes(path, getFileAttributesRaw(path, useAbsol) & ~cast(attrib, Int), useAbsol); + return setFileAttributes(path, getFileAttributesRaw(path, useAbsolute) & ~cast(attrib, Int), useAbsolute); #else return 0; #end diff --git a/source/funkin/backend/utils/NdllUtil.hx b/source/funkin/backend/utils/NdllUtil.hx index 97ab5d3e..b4e84daa 100644 --- a/source/funkin/backend/utils/NdllUtil.hx +++ b/source/funkin/backend/utils/NdllUtil.hx @@ -38,7 +38,7 @@ class NdllUtil { return Reflect.makeVarArgs(function(a:Array) { // This generates horrific code return funkin.backend.system.macros.Utils.generateReflectionLike(25, "func", "a"); - //return Reflect.callMethod(null, func, a); // wouldnt work for some reason, maybe cause like c++ functions doesnt have reflection enabled + //return Reflect.callMethod(null, func, a); // wouldn't work for some reason, maybe cause like c++ functions doesn't have reflection enabled }); #else Logs.trace('NDLLs are not supported on this platform.', WARNING); diff --git a/source/funkin/backend/utils/ZipUtil.hx b/source/funkin/backend/utils/ZipUtil.hx index 13e5fa99..d082e009 100644 --- a/source/funkin/backend/utils/ZipUtil.hx +++ b/source/funkin/backend/utils/ZipUtil.hx @@ -21,13 +21,13 @@ import sys.thread.Thread; using StringTools; // import ZipUtils; ZipUtils.uncompressZip(ZipUtils.openZip("E:\\Desktop\\test\\termination lua.ycemod"), "E:\\Desktop\\test\\uncompressed\\"); -// import ZipUtils; var e = ZipUtils.createZipFile("gjnsdghs.ycemod"); ZipUtils.writeFolderToZip(e, "./mods/Friday Night Funkin'/", "Friday Night Funkin'/"); e.flush(); e.close(); +// import ZipUtils; var e = ZipUtils.createZipFile("file.ycemod"); ZipUtils.writeFolderToZip(e, "./mods/Friday Night Funkin'/", "Friday Night Funkin'/"); e.flush(); e.close(); class ZipUtil { public static var bannedNames:Array = [".git", ".gitignore", ".github", ".vscode", ".gitattributes", "readme.txt"]; /** - * [Description] Uncompresses `zip` into the `destFolder` folder + * [Description] Decompresses a `zip` into the `destFolder` folder * @param zip * @param destFolder */ diff --git a/source/funkin/backend/utils/native/Windows.hx b/source/funkin/backend/utils/native/Windows.hx index 8653d2e8..9ec12843 100644 --- a/source/funkin/backend/utils/native/Windows.hx +++ b/source/funkin/backend/utils/native/Windows.hx @@ -13,7 +13,7 @@ import funkin.backend.utils.NativeAPI.MessageBoxIcon; ') -// majority is taken from microsofts doc +// majority is taken from Microsoft's doc @:cppFileCode(' #include "mmdeviceapi.h" #include "combaseapi.h" @@ -132,7 +132,7 @@ class Windows { int darkMode = enable ? 1 : 0; HWND window = FindWindowA(NULL, title.c_str()); - // Look for child windows if top level aint found + // Look for child windows if top level is not found if (window == NULL) window = FindWindowExA(GetActiveWindow(), NULL, NULL, title.c_str()); // If still not found, try to get the active window if (window == NULL) window = GetActiveWindow(); diff --git a/source/funkin/editors/DebugOptions.hx b/source/funkin/editors/DebugOptions.hx index 7f5201b9..05987a27 100644 --- a/source/funkin/editors/DebugOptions.hx +++ b/source/funkin/editors/DebugOptions.hx @@ -37,11 +37,11 @@ class DebugOptionsScreen extends OptionsScreen { #end add(new Checkbox( "Editor SFXs", - "If checked, will play sound effects when working on editors (ex: will play sfxs when checking checkboxes...)", + "If checked, will play sound effects when working on editors (ex: will play SFXs when checking checkboxes...)", "editorSFX")); add(new Checkbox( "Pretty Print", - "If checked, the saved files from the editor will be formatted to be easily viewable (does not apply to xmls...)", + "If checked, the saved files from the editor will be formatted to be easily viewable (does not apply to XMLs...)", "editorPrettyPrint")); add(new Checkbox( "Intensive Blur", @@ -65,7 +65,7 @@ class DebugOptionsScreen extends OptionsScreen { )); add(new Checkbox( "Autosaves Folder", - "If checked, this will autosave your file in a seperate folder with a time stamp instead of overriding your current file. (song/autosaves/)", - "charterAutoSavesSeperateFolder")); + "If checked, this will autosave your file in a separate folder with a time stamp instead of overriding your current file. (song/autosaves/)", + "charterAutoSavesSeparateFolder")); } } \ No newline at end of file diff --git a/source/funkin/editors/character/CharacterEditor.hx b/source/funkin/editors/character/CharacterEditor.hx index 73d991b3..9a4fa977 100644 --- a/source/funkin/editors/character/CharacterEditor.hx +++ b/source/funkin/editors/character/CharacterEditor.hx @@ -29,7 +29,7 @@ class CharacterEditor extends UIState { public var uiGroup:FlxTypedGroup = new FlxTypedGroup(); // WINDOWS - public var characterPropertiresWindow:CharacterPropertiesWindow; + public var characterPropertiesWindow:CharacterPropertiesWindow; public var characterAnimsWindow:UIButtonList; // camera for the character itself so that it can be unzoomed/zoomed in again @@ -237,8 +237,8 @@ class CharacterEditor extends UIState { topMenuSpr = new UITopMenu(topMenu); topMenuSpr.cameras = uiGroup.cameras = [uiCamera]; - characterPropertiresWindow = new CharacterPropertiesWindow(); - uiGroup.add(characterPropertiresWindow); + characterPropertiesWindow = new CharacterPropertiesWindow(); + uiGroup.add(characterPropertiesWindow); characterAnimsWindow = new UIButtonList(777, 209, 473, 488, "Character Animations", FlxPoint.get(429, 32)); characterAnimsWindow.addButton.callback = function() CharacterEditor.instance.createAnimWithUI(); @@ -284,9 +284,9 @@ class CharacterEditor extends UIState { } if (character != null) - characterPropertiresWindow.characterInfo.text = '${character.getNameList().length} Animations\nFlipped: ${character.flipX}\nSprite: ${character.sprite}\nAnim: ${character.getAnimName()}\nOffset: (${character.frameOffset.x}, ${character.frameOffset.y})'; + characterPropertiesWindow.characterInfo.text = '${character.getNameList().length} Animations\nFlipped: ${character.flipX}\nSprite: ${character.sprite}\nAnim: ${character.getAnimName()}\nOffset: (${character.frameOffset.x}, ${character.frameOffset.y})'; - if (!(characterPropertiresWindow.hovered || characterAnimsWindow.hovered) && !characterAnimsWindow.dragging) { + if (!(characterPropertiesWindow.hovered || characterAnimsWindow.hovered) && !characterAnimsWindow.dragging) { if (FlxG.mouse.wheel != 0) { zoom += 0.25 * FlxG.mouse.wheel; __camZoom = Math.pow(2, zoom); @@ -441,7 +441,7 @@ class CharacterEditor extends UIState { })); } - public function createAnim(animData:AnimData, animID:Int = -1, addtoUndo:Bool = true) { + public function createAnim(animData:AnimData, animID:Int = -1, addToUndo:Bool = true) { XMLUtil.addAnimToSprite(character, animData); ghosts.createGhost(animData.name); var newButton = new CharacterAnimButtons(0, 0, animData.name, FlxPoint.get(animData.x,animData.y)); @@ -450,11 +450,11 @@ class CharacterEditor extends UIState { playAnimation(animData.name); - if (addtoUndo) + if (addToUndo) undos.addToUndo(CCreateAnim(character.getNameList().length, animData)); } - public function editAnim(name:String, animData:AnimData, addtoUndo:Bool = true) { + public function editAnim(name:String, animData:AnimData, addToUndo:Bool = true) { var oldAnimData:AnimData = character.animDatas.get(name); var buttoner:CharacterAnimButtons = null; for (button in characterAnimsWindow.buttons.members) @@ -468,11 +468,11 @@ class CharacterEditor extends UIState { if (character.getAnimName() == animData.name) // update anim ifs its currently selected playAnimation(animData.name); - if (addtoUndo) + if (addToUndo) undos.addToUndo(CEditAnim(animData.name, oldAnimData, animData)); } - public function deleteAnim(name:String, addtoUndo:Bool = true) { + public function deleteAnim(name:String, addToUndo:Bool = true) { var animOrder:Array = [ for (button in characterAnimsWindow.buttons.members) button.anim @@ -495,7 +495,7 @@ class CharacterEditor extends UIState { if (character.animOffsets.exists(name)) character.animOffsets.remove(name); if (character.animDatas.exists(name)) character.animDatas.remove(name); - if (addtoUndo) + if (addToUndo) undos.addToUndo(CDeleteAnim(oldID, oldAnimData)); } @@ -505,7 +505,7 @@ class CharacterEditor extends UIState { })); } - public function editInfo(newInfo:Xml, addtoUndo:Bool = true) { + public function editInfo(newInfo:Xml, addToUndo:Bool = true) { var lastAnim:String = character.getAnimName(); var oldInfo = character.buildXML(); @@ -514,7 +514,7 @@ class CharacterEditor extends UIState { playAnimation(lastAnim); - if (addtoUndo) + if (addToUndo) undos.addToUndo(CEditInfo(oldInfo, newInfo)); } @@ -581,7 +581,7 @@ class CharacterEditor extends UIState { clearOffsets(); } - function changeOffset(anim:String, change:FlxPoint, addtoUndo:Bool = true) { + function changeOffset(anim:String, change:FlxPoint, addToUndo:Bool = true) { if (character.getNameList().length == 0) return; var animData = character.animDatas.get(anim); @@ -598,11 +598,11 @@ class CharacterEditor extends UIState { ghosts.updateOffsets(anim, change); - if (addtoUndo) + if (addToUndo) undos.addToUndo(CChangeOffset(anim, change)); } - function clearOffsets(addtoUndo:Bool = true) { + function clearOffsets(addToUndo:Bool = true) { if (character.getNameList().length == 0) return; var oldOffsets:Map = [ @@ -619,7 +619,7 @@ class CharacterEditor extends UIState { changeOffset(character.getAnimName(), FlxPoint.get(), false); ghosts.clearOffsets(); - if (addtoUndo) + if (addToUndo) undos.addToUndo(CResetOffsets(oldOffsets)); } diff --git a/source/funkin/editors/character/CharacterSelection.hx b/source/funkin/editors/character/CharacterSelection.hx index 3776b353..cf5e26d6 100644 --- a/source/funkin/editors/character/CharacterSelection.hx +++ b/source/funkin/editors/character/CharacterSelection.hx @@ -44,7 +44,7 @@ class CharacterSelection extends EditorTreeMenu } list.insert(0, new NewOption("New Character", "New Character", function() { - openSubState(new UIWarningSubstate("New Character: Feature Not Implemented!", "This feature isnt implemented yet. Please wait for more cne updates to have this functional.\n\n\n- Codename Devs", [ + openSubState(new UIWarningSubstate("New Character: Feature Not Implemented!", "This feature isn't implemented yet. Please wait for more cne updates to have this functional.\n\n\n- Codename Devs", [ {label: "Ok", color: 0xFFFF0000, onClick: function(t) {}} ])); })); diff --git a/source/funkin/editors/charter/ChartCreationScreen.hx b/source/funkin/editors/charter/ChartCreationScreen.hx index 4b67a64c..b41e147e 100644 --- a/source/funkin/editors/charter/ChartCreationScreen.hx +++ b/source/funkin/editors/charter/ChartCreationScreen.hx @@ -61,7 +61,7 @@ class ChartCreationScreen extends UISubstateWindow { scrollSpeedTextBox.onChange = function (text:String) { @:privateAccess scrollSpeedTextBox.__onChange(text); for (button in strumLineList.buttons.members) - if (button.usesChartscrollSpeed.checked) + if (button.usesChartScrollSpeed.checked) button.scrollSpeedStepper.value = scrollSpeedTextBox.value; } add(scrollSpeedTextBox); @@ -148,7 +148,7 @@ class ChartCreationScreen extends UISubstateWindow { @:privateAccess stepper.__onChange(stepper.label.text); strumLines.push({ - characters: [for (charb in strline.charactersList.buttons.members) charb.textBox.label.text], + characters: [for (char in strline.charactersList.buttons.members) char.textBox.label.text], type: strline.typeDropdown.index, notes: [], position: strline.stagePositionDropdown.label.text.toLowerCase(), @@ -156,7 +156,7 @@ class ChartCreationScreen extends UISubstateWindow { strumPos: [0, strline.hudYStepper.value], strumLinePos: strline.hudXStepper.value, strumScale: strline.hudScaleStepper.value, - scrollSpeed: strline.usesChartscrollSpeed.checked ? strline.scrollSpeedStepper.value : null + scrollSpeed: strline.usesChartScrollSpeed.checked ? strline.scrollSpeedStepper.value : null }); } @@ -185,7 +185,7 @@ class StrumLineButton extends UIButton { public var hudYStepper:UINumericStepper; public var visibleCheckbox:UICheckbox; public var scrollSpeedStepper:UINumericStepper; - public var usesChartscrollSpeed:UICheckbox; + public var usesChartScrollSpeed:UICheckbox; public var deleteButton:UIButton; public var deleteIcon:FlxSprite; @@ -260,15 +260,15 @@ class StrumLineButton extends UIButton { members.push(scrollSpeedStepper); addLabelOn(scrollSpeedStepper, "Scroll Speed"); - usesChartscrollSpeed = new UICheckbox(scrollSpeedStepper.x + 104, typeDropdown.y + 135, "Uses charts scroll speed?", strumLine.scrollSpeed == null); - usesChartscrollSpeed.onChecked = function(b) { + usesChartScrollSpeed = new UICheckbox(scrollSpeedStepper.x + 104, typeDropdown.y + 135, "Uses charts scroll speed?", strumLine.scrollSpeed == null); + usesChartScrollSpeed.onChecked = function(b) { if(b) { scrollSpeedStepper.value = subState.scrollSpeedTextBox.value; scrollSpeedStepper.selectable = false; } else scrollSpeedStepper.selectable = true; } - members.push(usesChartscrollSpeed); + members.push(usesChartScrollSpeed); deleteButton = new UIButton(16, 246-32-11, "", function () { parent.remove(this); @@ -293,7 +293,7 @@ class StrumLineButton extends UIButton { hudYStepper.follow(this, hudXStepper.x + 84 - 32 + 26, 8+26 + 64); visibleCheckbox.follow(this, hudYStepper.x + hudYStepper.bWidth + 42, 8+26 + 64 + 9); scrollSpeedStepper.follow(this, typeDropdown.x, 8+26 + 128); - usesChartscrollSpeed.follow(this, scrollSpeedStepper.x + 104, 8+26 + 135); + usesChartScrollSpeed.follow(this, scrollSpeedStepper.x + 104, 8+26 + 135); deleteButton.follow(this, 16, 246-32-11); deleteIcon.follow(this, 16 + ((deleteButton.bWidth/2)-(15/2)), (246-32-11) + ((deleteButton.bHeight/2)-(16/2))); diff --git a/source/funkin/editors/charter/Charter.hx b/source/funkin/editors/charter/Charter.hx index 3d6f3f12..2df502b6 100644 --- a/source/funkin/editors/charter/Charter.hx +++ b/source/funkin/editors/charter/Charter.hx @@ -714,10 +714,10 @@ class Charter extends UIState { autoSaveTimer -= elapsed; if (autoSaveTimer < Options.charterAutoSaveWarningTime && !autoSaveNotif.cancelled && !autoSaveNotif.showedAnimation) { - if (Options.charterAutoSavesSeperateFolder) + if (Options.charterAutoSavesSeparateFolder) __autoSaveLocation = __diff.toLowerCase() + DateTools.format(Date.now(), "%m-%d_%H-%M"); autoSaveNotif.startAutoSave(autoSaveTimer, - !Options.charterAutoSavesSeperateFolder ? 'Saved chart at ${__diff.toLowerCase()}.json!' : + !Options.charterAutoSavesSeparateFolder ? 'Saved chart at ${__diff.toLowerCase()}.json!' : 'Saved chart at $__autoSaveLocation.json!' ); } @@ -727,7 +727,7 @@ class Charter extends UIState { buildChart(); var songPath:String = '${Paths.getAssetsRoot()}/songs/${__song.toLowerCase()}'; - if (Options.charterAutoSavesSeperateFolder) + if (Options.charterAutoSavesSeparateFolder) Chart.save(songPath, PlayState.SONG, __autoSaveLocation, {saveMetaInChart: false, folder: "autosaves", prettyPrint: Options.editorPrettyPrint}); else Chart.save(songPath, PlayState.SONG, __diff.toLowerCase(), {saveMetaInChart: false, prettyPrint: Options.editorPrettyPrint}); @@ -820,7 +820,7 @@ class Charter extends UIState { var boundedChange:FlxPoint = changePoint.clone(); - // Some maths, so cool bro -lunar (i dont know why i quopte my self here) + // Some maths, so cool bro -lunar (i don't know why i quote my self here) if (s.step + changePoint.x < 0) boundedChange.x += Math.abs(s.step + changePoint.x); if (s.step + changePoint.x > __endStep-1) boundedChange.x -= (s.step + changePoint.x) - (__endStep-1); @@ -1651,7 +1651,7 @@ class Charter extends UIState { inline function _snap_resetsnap(_) setquant(16); inline function changequant(change:Int) {quant = quants[FlxMath.wrap(quants.indexOf(quant) + change, 0, quants.length-1)]; buildSnapsUI();}; - inline function setquant(newquant:Int) {quant = newquant; buildSnapsUI();} + inline function setquant(newQuant:Int) {quant = newQuant; buildSnapsUI();} function buildSnapsUI():Array { var snapsTopButton:UITopMenuButton = topMenuSpr == null ? null : cast topMenuSpr.members[snapIndex]; @@ -1856,7 +1856,7 @@ class Charter extends UIState { return newSelection.filter((s:ICharterSelectable) -> {return s != null;}); } - // UH OH!!! DANGER ZONE APPOARCHING !!!! LUNARS SHITTY CODE !!!! -lunar + // UH OH!!! DANGER ZONE APPROACHING !!!! LUNARS SHITTY CODE !!!! -lunar @:noCompletion public function __relinkSingleSelection(selectable:ICharterSelectable):ICharterSelectable { if (selectable is CharterNote) diff --git a/source/funkin/editors/charter/CharterAutoSaveUI.hx b/source/funkin/editors/charter/CharterAutoSaveUI.hx index 81f207ad..b67fb76d 100644 --- a/source/funkin/editors/charter/CharterAutoSaveUI.hx +++ b/source/funkin/editors/charter/CharterAutoSaveUI.hx @@ -63,7 +63,7 @@ class CharterAutoSaveUI extends UISliceSprite { var __timer:FlxTimer; var __tween:FlxTween; - public function startAutoSave(time:Float, sucessText:String) { + public function startAutoSave(time:Float, successText:String) { appearAnimation(); __tween = FlxTween.num(0, 1, time, null, (v:Float) -> { @@ -74,7 +74,7 @@ class CharterAutoSaveUI extends UISliceSprite { }); __timer = new FlxTimer(); __timer.start(time, (_) -> { - autosavingText.text = sucessText; cancelButton.visible = false; + autosavingText.text = successText; cancelButton.visible = false; icon.animation.curAnim.curFrame = 1; for (member in [this, progressBar, progressBarBack, autosavingText]) member.color = 0xFFA3EC95; diff --git a/source/funkin/editors/charter/CharterMetaDataScreen.hx b/source/funkin/editors/charter/CharterMetaDataScreen.hx index bdc38f87..8dd5f937 100644 --- a/source/funkin/editors/charter/CharterMetaDataScreen.hx +++ b/source/funkin/editors/charter/CharterMetaDataScreen.hx @@ -23,7 +23,7 @@ class CharterMetaDataScreen extends UISubstateWindow { public var opponentModeCheckbox:UICheckbox; public var coopAllowedCheckbox:UICheckbox; public var colorWheel:UIColorwheel; - public var difficulitesTextBox:UITextBox; + public var difficultiesTextBox:UITextBox; public function new(metadata:ChartMetaData) { super(); @@ -88,9 +88,9 @@ class CharterMetaDataScreen extends UISubstateWindow { add(colorWheel); addLabelOn(colorWheel, "Color"); - difficulitesTextBox = new UITextBox(opponentModeCheckbox.x, opponentModeCheckbox.y + 6 + 32 + 26, metadata.difficulties.join(", ")); - add(difficulitesTextBox); - addLabelOn(difficulitesTextBox, "Difficulties"); + difficultiesTextBox = new UITextBox(opponentModeCheckbox.x, opponentModeCheckbox.y + 6 + 32 + 26, metadata.difficulties.join(", ")); + add(difficultiesTextBox); + addLabelOn(difficultiesTextBox, "Difficulties"); customPropertiesButtonList = new UIButtonList(stepsPerBeatStepper.x + 80 + 26 + 105, songNameTextBox.y, 290, 316, '', FlxPoint.get(280, 35), null, 5); customPropertiesButtonList.frames = Paths.getFrames('editors/ui/inputbox'); @@ -162,7 +162,7 @@ class CharterMetaDataScreen extends UISubstateWindow { parsedColor: colorWheel.curColor, opponentModeAllowed: opponentModeCheckbox.checked, coopAllowed: coopAllowedCheckbox.checked, - difficulties: [for (diff in difficulitesTextBox.label.text.split(",")) diff.trim()], + difficulties: [for (diff in difficultiesTextBox.label.text.split(",")) diff.trim()], customValues: customVals, }; diff --git a/source/funkin/editors/charter/CharterSelection.hx b/source/funkin/editors/charter/CharterSelection.hx index a3e0910d..57172751 100644 --- a/source/funkin/editors/charter/CharterSelection.hx +++ b/source/funkin/editors/charter/CharterSelection.hx @@ -89,10 +89,10 @@ class CharterSelection extends EditorTreeMenu { } public function saveSong(creation:SongCreationData) { - var songAlreadlyExsits:Bool = [for (s in freeplayList.songs) s.name.toLowerCase()].contains(creation.meta.name.toLowerCase()); + var songAlreadyExists:Bool = [for (s in freeplayList.songs) s.name.toLowerCase()].contains(creation.meta.name.toLowerCase()); - if (songAlreadlyExsits) { - openSubState(new UIWarningSubstate("Creating Song: Error!", "The song you are trying to create alreadly exists, if you would like to override it delete the song first!", [ + if (songAlreadyExists) { + openSubState(new UIWarningSubstate("Creating Song: Error!", "The song you are trying to create Already exists, if you would like to override it delete the song first!", [ {label: "Ok", color: 0xFFFF0000, onClick: function(t) {}} ])); return; @@ -134,10 +134,10 @@ class CharterSelection extends EditorTreeMenu { } public function saveChart(name:String, data:ChartData) { - var difficultyAlreadlyExsits:Bool = curSong.difficulties.contains(name); + var difficultyAlreadyExists:Bool = curSong.difficulties.contains(name); - if (difficultyAlreadlyExsits) { - openSubState(new UIWarningSubstate("Creating Chart: Error!", "The chart you are trying to create alreadly exists, if you would like to override it delete the chart first!", [ + if (difficultyAlreadyExists) { + openSubState(new UIWarningSubstate("Creating Chart: Error!", "The chart you are trying to create already exists, if you would like to override it delete the chart first!", [ {label: "Ok", color: 0xFFFF0000, onClick: function(t) {}} ])); return; diff --git a/source/funkin/editors/charter/CharterStrumlineScreen.hx b/source/funkin/editors/charter/CharterStrumlineScreen.hx index d5a1ef00..35730dc8 100644 --- a/source/funkin/editors/charter/CharterStrumlineScreen.hx +++ b/source/funkin/editors/charter/CharterStrumlineScreen.hx @@ -18,7 +18,7 @@ class CharterStrumlineScreen extends UISubstateWindow { public var hudYStepper:UINumericStepper; public var visibleCheckbox:UICheckbox; public var scrollSpeedStepper:UINumericStepper; - public var usesChartscrollSpeed:UICheckbox; + public var usesChartScrollSpeed:UICheckbox; public var characterIcons:Array = []; @@ -78,8 +78,8 @@ class CharterStrumlineScreen extends UISubstateWindow { add(typeDropdown); addLabelOn(typeDropdown, "Type"); - usesChartscrollSpeed = new UICheckbox(typeDropdown.x + 104, typeDropdown.y + 135, "Uses charts scroll speed?", strumLine.scrollSpeed == null); - usesChartscrollSpeed.onChecked = function(b) { + usesChartScrollSpeed = new UICheckbox(typeDropdown.x + 104, typeDropdown.y + 135, "Uses charts scroll speed?", strumLine.scrollSpeed == null); + usesChartScrollSpeed.onChecked = function(b) { if(b) { scrollSpeedStepper.value = PlayState.SONG.scrollSpeed; @@ -88,10 +88,10 @@ class CharterStrumlineScreen extends UISubstateWindow { scrollSpeedStepper.selectable = true; } } - add(usesChartscrollSpeed); + add(usesChartScrollSpeed); - scrollSpeedStepper = new UINumericStepper(typeDropdown.x, typeDropdown.y + 128, usesChartscrollSpeed.checked ? PlayState.SONG.scrollSpeed : strumLine.scrollSpeed, 0.1, 2, 0, 10, 82); - if(usesChartscrollSpeed.checked) + scrollSpeedStepper = new UINumericStepper(typeDropdown.x, typeDropdown.y + 128, usesChartScrollSpeed.checked ? PlayState.SONG.scrollSpeed : strumLine.scrollSpeed, 0.1, 2, 0, 10, 82); + if(usesChartScrollSpeed.checked) { scrollSpeedStepper.selectable = false; } else { @@ -141,20 +141,20 @@ class CharterStrumlineScreen extends UISubstateWindow { add(closeButton); closeButton.color = 0xFFFF0000; - var suffixlist = ["NONE"]; + var suffixList = ["NONE"]; for (i in Paths.getFolderContent('songs/${Charter.__song.toLowerCase()}/song')) if (i.startsWith("Voices")) { i = haxe.io.Path.withoutExtension(i.substr("Voices".length)); if (i == "") continue; for (j in PlayState.SONG.meta.difficulties) { if (i.endsWith('-${j.toLowerCase()}')) - suffixlist.pushOnce(i.substring(0, i.length - j.length)); + suffixList.pushOnce(i.substring(0, i.length - j.length)); else - suffixlist.pushOnce(i); + suffixList.pushOnce(i); } } - vocalsSuffixDropDown = new UIDropDown(typeDropdown.x, hudScaleStepper.y + 128, 200, 32, suffixlist, strumLine.vocalsSuffix != null && strumLine.vocalsSuffix != "" ? suffixlist.indexOf(strumLine.vocalsSuffix) : 0); + vocalsSuffixDropDown = new UIDropDown(typeDropdown.x, hudScaleStepper.y + 128, 200, 32, suffixList, strumLine.vocalsSuffix != null && strumLine.vocalsSuffix != "" ? suffixList.indexOf(strumLine.vocalsSuffix) : 0); add(vocalsSuffixDropDown); addLabelOn(vocalsSuffixDropDown, "Vocal Suffix"); } @@ -177,7 +177,7 @@ class CharterStrumlineScreen extends UISubstateWindow { strumScale: hudScaleStepper.value, vocalsSuffix: vocalsSuffixDropDown.options[vocalsSuffixDropDown.index] != "NONE" ? vocalsSuffixDropDown.options[vocalsSuffixDropDown.index] : "" }; - if(!usesChartscrollSpeed.checked) newStrumLine.scrollSpeed = scrollSpeedStepper.value; + if(!usesChartScrollSpeed.checked) newStrumLine.scrollSpeed = scrollSpeedStepper.value; if (onSave != null) onSave(newStrumLine); } } diff --git a/source/funkin/editors/charter/SongCreationScreen.hx b/source/funkin/editors/charter/SongCreationScreen.hx index d6d526e5..becf6efd 100644 --- a/source/funkin/editors/charter/SongCreationScreen.hx +++ b/source/funkin/editors/charter/SongCreationScreen.hx @@ -28,7 +28,7 @@ class SongCreationScreen extends UISubstateWindow { public var opponentModeCheckbox:UICheckbox; public var coopAllowedCheckbox:UICheckbox; public var colorWheel:UIColorwheel; - public var difficulitesTextBox:UITextBox; + public var difficultiesTextBox:UITextBox; public var backButton:UIButton; public var saveButton:UIButton; @@ -125,9 +125,9 @@ class SongCreationScreen extends UISubstateWindow { menuDataGroup.add(colorWheel); addLabelOn(colorWheel, "Color"); - difficulitesTextBox = new UITextBox(opponentModeCheckbox.x, opponentModeCheckbox.y + 6 + 32 + 26, ""); - menuDataGroup.add(difficulitesTextBox); - addLabelOn(difficulitesTextBox, "Difficulties"); + difficultiesTextBox = new UITextBox(opponentModeCheckbox.x, opponentModeCheckbox.y + 6 + 32 + 26, ""); + menuDataGroup.add(difficultiesTextBox); + addLabelOn(difficultiesTextBox, "Difficulties"); for (checkbox in [opponentModeCheckbox, coopAllowedCheckbox]) {checkbox.y += 6; checkbox.x += 4;} @@ -240,7 +240,7 @@ class SongCreationScreen extends UISubstateWindow { parsedColor: colorWheel.curColor, opponentModeAllowed: opponentModeCheckbox.checked, coopAllowed: coopAllowedCheckbox.checked, - difficulties: [for (diff in difficulitesTextBox.label.text.split(",")) diff.trim()], + difficulties: [for (diff in difficultiesTextBox.label.text.split(",")) diff.trim()], }; if (onSave != null) onSave({ diff --git a/source/funkin/editors/ui/UIColorwheel.hx b/source/funkin/editors/ui/UIColorwheel.hx index 5607853b..fb7f525b 100644 --- a/source/funkin/editors/ui/UIColorwheel.hx +++ b/source/funkin/editors/ui/UIColorwheel.hx @@ -44,10 +44,10 @@ class UIColorwheel extends UISliceSprite { // Im too lazy to use a shader for this if its not even gonna change colorSlider.pixels.lock(); - for (pixely in 0...Std.int(colorSlider.height)) { - var color:Int = FlxColor.fromHSB(pixely / (colorSlider.height-1) * 360, 1, 1); - for (pixelx in 0...Std.int(colorSlider.width)) - if (colorSlider.pixels.getPixel32(pixelx, pixely) != FlxColor.TRANSPARENT) colorSlider.pixels.setPixel32(pixelx, pixely, color); + for (pixelY in 0...Std.int(colorSlider.height)) { + var color:Int = FlxColor.fromHSB(pixelY / (colorSlider.height-1) * 360, 1, 1); + for (pixelX in 0...Std.int(colorSlider.width)) + if (colorSlider.pixels.getPixel32(pixelX, pixelY) != FlxColor.TRANSPARENT) colorSlider.pixels.setPixel32(pixelX, pixelY, color); } colorSlider.pixels.unlock(); @@ -123,7 +123,7 @@ class UIColorwheel extends UISliceSprite { public var colorChanged:Bool = false; // Make the colorwheel feel better - static inline var hitBoxExtenstion:Float = 8; + static inline var hitBoxExtension:Float = 8; public override function update(elapsed:Float) { if (hovered && FlxG.mouse.pressed) { @@ -132,7 +132,7 @@ class UIColorwheel extends UISliceSprite { for (sprite in [colorPicker, colorSlider]) { var spritePos:FlxPoint = sprite.getScreenPosition(FlxPoint.get(), __lastDrawCameras[0]); - if (((mousePos.x > (spritePos.x - (hitBoxExtenstion/2))) && (mousePos.x < spritePos.x - (hitBoxExtenstion/2) + (sprite.width + hitBoxExtenstion))) && ((mousePos.y > (spritePos.y - (hitBoxExtenstion/2))) && (mousePos.y < spritePos.y - (hitBoxExtenstion/2) + (sprite.height + hitBoxExtenstion)))) { + if (((mousePos.x > (spritePos.x - (hitBoxExtension/2))) && (mousePos.x < spritePos.x - (hitBoxExtension/2) + (sprite.width + hitBoxExtension))) && ((mousePos.y > (spritePos.y - (hitBoxExtension/2))) && (mousePos.y < spritePos.y - (hitBoxExtension/2) + (sprite.height + hitBoxExtension)))) { mousePos -= FlxPoint.weak(spritePos.x, spritePos.y); mousePos.set(FlxMath.bound(mousePos.x, 0, sprite.width), FlxMath.bound(mousePos.y, 0, sprite.height)); diff --git a/source/funkin/editors/ui/UISlider.hx b/source/funkin/editors/ui/UISlider.hx index 13b67dae..0a6a853d 100644 --- a/source/funkin/editors/ui/UISlider.hx +++ b/source/funkin/editors/ui/UISlider.hx @@ -5,14 +5,14 @@ import flixel.util.FlxColor; using StringTools; using flixel.util.FlxSpriteUtil; -typedef SliderSegement = { +typedef SliderSegment = { var start:Float; var end:Float; var size:Float; } class UISlider extends UISprite { - public var segments:Array = []; + public var segments:Array = []; public var barWidth:Int = 120; public var progressbar:UISprite; @@ -36,7 +36,7 @@ class UISlider extends UISprite { public var valueStepper:UINumericStepper; public var onChange:Float->Void; - public function new(x:Float, y:Float, width:Int = 120, value:Float, segments:Array, centered:Bool) { + public function new(x:Float, y:Float, width:Int = 120, value:Float, segments:Array, centered:Bool) { this.segments = segments; this.barWidth = width; this.progressCentered = centered; diff --git a/source/funkin/editors/ui/UIUtil.hx b/source/funkin/editors/ui/UIUtil.hx index ac445a05..2d2a2843 100644 --- a/source/funkin/editors/ui/UIUtil.hx +++ b/source/funkin/editors/ui/UIUtil.hx @@ -15,7 +15,7 @@ class UIUtil { } /** - * Process all options with shortcuts present in a `Array`. Also checks childrens. + * Process all options with shortcuts present in a `Array`. Also checks children. * @param topMenuOptions */ public static function processShortcuts(topMenuOptions:Array) { diff --git a/source/funkin/game/NoteGroup.hx b/source/funkin/game/NoteGroup.hx index 24c61469..0657a60e 100644 --- a/source/funkin/game/NoteGroup.hx +++ b/source/funkin/game/NoteGroup.hx @@ -117,7 +117,7 @@ class NoteGroup extends FlxTypedGroup { if (index < 0) return null; - // doesnt prevent looping from breaking + // doesn't prevent looping from breaking if (Splice && __currentlyLooping && i >= index) i++; diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index f39cc4e3..0f0f8c73 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -423,7 +423,7 @@ class PlayState extends MusicBeatState */ public var events:Array = []; /** - * Current camera target. -1 means no automatic camera targetting. + * Current camera target. -1 means no automatic camera targeting. */ public var curCameraTarget:Int = 0; /** @@ -642,7 +642,7 @@ class PlayState extends MusicBeatState for(folder in scriptsFolders) { for(file in Paths.getFolderContent(folder, true, fromMods ? MODS : BOTH)) { if (folder == 'data/charts/') - Logs.trace('[PlayState] data/charts/ is deprecrated and will be removed in the future. Please move script $file to songs/', WARNING, DARKYELLOW); + Logs.trace('[PlayState] data/charts/ is deprecated and will be removed in the future. Please move script $file to songs/', WARNING, DARKYELLOW); addScript(file); } diff --git a/source/funkin/game/SplashGroup.hx b/source/funkin/game/SplashGroup.hx index 6660ca75..99ed6027 100644 --- a/source/funkin/game/SplashGroup.hx +++ b/source/funkin/game/SplashGroup.hx @@ -35,7 +35,7 @@ class SplashGroup extends FlxTypedGroup { pregenerateSplashes(splash); add(splash); - // immediatly draw once and put image in GPU to prevent freezes + // immediately draw once and put image in GPU to prevent freezes // TODO: change to graphics cache splash.drawComplex(FlxG.camera); } catch(e:Dynamic) { diff --git a/source/funkin/game/Stage.hx b/source/funkin/game/Stage.hx index 5cc145f0..5a9c3a8d 100644 --- a/source/funkin/game/Stage.hx +++ b/source/funkin/game/Stage.hx @@ -185,7 +185,7 @@ class Stage extends FlxBasic implements IBeatReceiver { setStagesSprites(stageScript); - // i know this for gets run twice under, but its better like this in case a script modifies the short lived ones, i dont wanna save them in an array; more dynamic like this - Nex + // i know this for gets run twice under, but its better like this in case a script modifies the short lived ones, i don't wanna save them in an array; more dynamic like this - Nex for (info in xmlImportedScripts) if (info.importStageSprites) { var script = info.getScript(); if (script != null) setStagesSprites(script); diff --git a/source/funkin/game/StrumLine.hx b/source/funkin/game/StrumLine.hx index 5417b494..1a74e0b1 100644 --- a/source/funkin/game/StrumLine.hx +++ b/source/funkin/game/StrumLine.hx @@ -71,7 +71,7 @@ class StrumLine extends FlxTypedGroup { */ public var animSuffix(default, set):String = ""; /** - * TODO: Write documention about this being a variable that can help when making multi key + * TODO: Write documentation about this being a variable that can help when making multi key */ public var strumAnimPrefix = ["left", "down", "up", "right"]; /** @@ -153,7 +153,7 @@ class StrumLine extends FlxTypedGroup { if(scrollSpeed == null) if (PlayState.instance != null) scrollSpeed = PlayState.instance.scrollSpeed; if(scrollSpeed == null) scrollSpeed = 1; - // TODO: Make this work by accounting zoom and scrollspeed changes - Nex + // TODO: Make this work by accounting zoom and scroll speed changes - Nex /*var limit = FlxG.height / 0.45; notes.limit = limit / scrollSpeed; OR diff --git a/source/funkin/game/cutscenes/DialogueCutscene.hx b/source/funkin/game/cutscenes/DialogueCutscene.hx index d7ebd934..5f3aed63 100644 --- a/source/funkin/game/cutscenes/DialogueCutscene.hx +++ b/source/funkin/game/cutscenes/DialogueCutscene.hx @@ -35,7 +35,7 @@ class DialogueCutscene extends ScriptedCutscene { return curLine = val; } - // Backwards comapt funcs - Nex + // Backwards compat funcs - Nex public function set_dialogueScript(val:Script) return script = val; public function get_dialogueScript() return script; diff --git a/source/funkin/game/cutscenes/dialogue/DialogueBox.hx b/source/funkin/game/cutscenes/dialogue/DialogueBox.hx index b445b611..a82beda5 100644 --- a/source/funkin/game/cutscenes/dialogue/DialogueBox.hx +++ b/source/funkin/game/cutscenes/dialogue/DialogueBox.hx @@ -10,7 +10,7 @@ import haxe.xml.Access; class DialogueBox extends FunkinSprite { public var dialogueBoxData:Access; public var positions:Map = []; - public var dialogueEnded:Bool = false; // Using text._typing is also fair but it doesnt check for eventual opening anims! - Nex + public var dialogueEnded:Bool = false; // Using text._typing is also fair but it doesn't check for eventual opening anims! - Nex public var nextSFX:String = Paths.sound('dialogue/next'); public var defaultTextTypeSFX:Array; @@ -22,7 +22,7 @@ class DialogueBox extends FunkinSprite { public function new(name:String) { super(); - var textTypeSFX:String = Paths.sound('dialogue/text'); // Default if xml doesnt have it - Nex + var textTypeSFX:String = Paths.sound('dialogue/text'); // Default if xml doesn't have it - Nex dialogueBoxScript = Script.create(Paths.script('data/' + defPath + name)); dialogueBoxScript.setParent(this); diff --git a/source/funkin/menus/FreeplayState.hx b/source/funkin/menus/FreeplayState.hx index 93435aa5..ef6ba116 100644 --- a/source/funkin/menus/FreeplayState.hx +++ b/source/funkin/menus/FreeplayState.hx @@ -14,7 +14,7 @@ using StringTools; class FreeplayState extends MusicBeatState { /** - * Array containing all of the songs metadatas + * Array containing all of the songs' metadata. */ public var songs:Array = []; @@ -144,7 +144,7 @@ class FreeplayState extends MusicBeatState add(icon); // songText.x += 40; - // DONT PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! + // DON'T PUT X IN THE FIRST PARAMETER OF new ALPHABET() !! // songText.screenCenter(X); } diff --git a/source/funkin/menus/MainMenuState.hx b/source/funkin/menus/MainMenuState.hx index 14600f83..06f1cbe1 100644 --- a/source/funkin/menus/MainMenuState.hx +++ b/source/funkin/menus/MainMenuState.hx @@ -162,7 +162,7 @@ class MainMenuState extends MusicBeatState { case 'story mode': FlxG.switchState(new StoryMenuState()); case 'freeplay': FlxG.switchState(new FreeplayState()); - case 'donate', 'credits': FlxG.switchState(new CreditsMain()); // kept donate for not breaking scripts, if you dont want donate to bring you to the credits menu, thats easy softcodable - Nex + case 'donate', 'credits': FlxG.switchState(new CreditsMain()); // kept donate for not breaking scripts, if you don't want donate to bring you to the credits menu, thats easy softcodable - Nex case 'options': FlxG.switchState(new OptionsMenu()); } }); diff --git a/source/funkin/menus/ui/FunkinSoundTray.hx b/source/funkin/menus/ui/FunkinSoundTray.hx index 21280679..885b0414 100644 --- a/source/funkin/menus/ui/FunkinSoundTray.hx +++ b/source/funkin/menus/ui/FunkinSoundTray.hx @@ -10,7 +10,7 @@ class FunkinSoundTray extends FlxSoundTray { public var script:Script; - // Neeo wanted them since it would reduce lags for some people if activated - Nex + // Ne_Eo wanted them since it would reduce lags for some people if activated - Nex public var callsUpdate:Bool = true; public var callsPostUpdate:Bool = true; diff --git a/source/funkin/options/Options.hx b/source/funkin/options/Options.hx index 972ff69c..5fa86155 100644 --- a/source/funkin/options/Options.hx +++ b/source/funkin/options/Options.hx @@ -66,7 +66,7 @@ class Options public static var charterAutoSaves:Bool = true; public static var charterAutoSaveTime:Float = 60*5; public static var charterAutoSaveWarningTime:Float = 5; - public static var charterAutoSavesSeperateFolder:Bool = false; + public static var charterAutoSavesSeparateFolder:Bool = false; /** * PLAYER 1 CONTROLS diff --git a/source/funkin/options/categories/AppearanceOptions.hx b/source/funkin/options/categories/AppearanceOptions.hx index 92621343..9b97e299 100644 --- a/source/funkin/options/categories/AppearanceOptions.hx +++ b/source/funkin/options/categories/AppearanceOptions.hx @@ -13,11 +13,11 @@ class AppearanceOptions extends OptionsScreen { __changeFPS)); // callback add(new Checkbox( "Antialiasing", - "If unchecked, will disable antialiasing on every sprite. Can boost performances at the cost of sharper, more pixely sprites.", + "If unchecked, will disable antialiasing on every sprite. Can boost performances at the cost of sharper, more pixelated sprites.", "antialiasing")); add(new Checkbox( "Colored Healthbar", - "If unchecked, the game will use the orginal red/green health bar from the week 6 fnf game.", + "If unchecked, the game will use the original red/green health bar from the week 6 fnf game.", "colorHealthBar")); add(new Checkbox( "Pixel Perfect Effect", diff --git a/source/funkin/options/type/GithubIconOption.hx b/source/funkin/options/type/GithubIconOption.hx index d5553486..d766cd80 100644 --- a/source/funkin/options/type/GithubIconOption.hx +++ b/source/funkin/options/type/GithubIconOption.hx @@ -49,7 +49,7 @@ class GithubUserIcon extends FlxSprite } final mutex = new sys.thread.Mutex(); - override function drawComplex(camera:FlxCamera):Void { // Making the image downlaod only if the player actually sees it on the screeeeen - Nex + override function drawComplex(camera:FlxCamera):Void { // Making the image download only if the player actually sees it on the screen - Nex if(waitUntilLoad <= 0) { waitUntilLoad = null; Main.execAsync(function() { From 0040d93950d89f20acc09ae43fb9c248d8028748 Mon Sep 17 00:00:00 2001 From: NyxieFemboy Date: Tue, 10 Dec 2024 19:13:28 -0500 Subject: [PATCH 10/26] Fixes to Negative note sustain lengths in the charter --- source/funkin/editors/charter/CharterNote.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/funkin/editors/charter/CharterNote.hx b/source/funkin/editors/charter/CharterNote.hx index 1d130842..d039962e 100644 --- a/source/funkin/editors/charter/CharterNote.hx +++ b/source/funkin/editors/charter/CharterNote.hx @@ -76,7 +76,7 @@ class CharterNote extends UISprite implements ICharterSelectable { public function updatePos(step:Float, id:Int, susLength:Float = 0, ?type:Int = 0, ?strumLine:CharterStrumline = null) { this.step = step; this.id = id; - this.susLength = susLength; + this.susLength = Math.max(susLength, 0); this.type = type; if (strumLine != null) this.strumLine = strumLine; From c4abac4ba1ef0692325a736f1123a511965368a6 Mon Sep 17 00:00:00 2001 From: ItsLJcool Date: Wed, 11 Dec 2024 02:26:58 -0700 Subject: [PATCH 11/26] Fixed pasting, and added copying in `UITextBox` (#486) KeyModifier somehow returned an int outside of the KeyModifier's range :sob: Apparently there is a boolean that just checks for you called `ctrlKey`......... --- source/funkin/editors/ui/UITextBox.hx | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/source/funkin/editors/ui/UITextBox.hx b/source/funkin/editors/ui/UITextBox.hx index 3aa97fd2..b12c1770 100644 --- a/source/funkin/editors/ui/UITextBox.hx +++ b/source/funkin/editors/ui/UITextBox.hx @@ -119,12 +119,21 @@ class UITextBox extends UISliceSprite implements IUIFocusable { case END: position = label.text.length; case V: - if (modifier == KeyModifier.LEFT_CTRL || modifier == KeyModifier.RIGHT_CTRL) { - // paste - var data:String = Clipboard.generalClipboard.getData(TEXT_FORMAT); - if (data != null) - onTextInput(data); - } + // Hey lj here, fixed copying because before we checked if the modifier was left or right ctrl + // but somehow it gave a int outside of the KeyModifier's range :sob: + // apparently there is a boolean that just checks for you. yw :D + + // if we are not holding ctrl, ignore + if (!modifier.ctrlKey) return; + // we pasting + var data:String = Clipboard.generalClipboard.getData(TEXT_FORMAT); + if (data != null) onTextInput(data); + case C: + // if we are not holding ctrl, ignore + if (!modifier.ctrlKey) return; + + // copying + Clipboard.generalClipboard.setData(TEXT_FORMAT, label.text); default: // nothing } From 49f13ed8c857b66c29e983322036cbe5a40e191c Mon Sep 17 00:00:00 2001 From: TheZoroForce240 <86524550+TheZoroForce240@users.noreply.github.com> Date: Fri, 13 Dec 2024 15:19:44 +0000 Subject: [PATCH 12/26] fix transition crash when skipping (#490) --- source/funkin/backend/MusicBeatTransition.hx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/MusicBeatTransition.hx b/source/funkin/backend/MusicBeatTransition.hx index 34b02388..252b99b2 100644 --- a/source/funkin/backend/MusicBeatTransition.hx +++ b/source/funkin/backend/MusicBeatTransition.hx @@ -79,7 +79,8 @@ class MusicBeatTransition extends MusicBeatSubstate { public function finish() { if (newState != null) FlxG.switchState(newState); - close(); + else + close(); } public override function destroy() { From ee33acf1b847e4ec2edc3b82594bf8ea1490b166 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Fri, 13 Dec 2024 19:18:56 +0100 Subject: [PATCH 13/26] Revert "fix transition crash when skipping (#490)" (#492) This reverts commit 49f13ed8c857b66c29e983322036cbe5a40e191c. --- source/funkin/backend/MusicBeatTransition.hx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/source/funkin/backend/MusicBeatTransition.hx b/source/funkin/backend/MusicBeatTransition.hx index 252b99b2..34b02388 100644 --- a/source/funkin/backend/MusicBeatTransition.hx +++ b/source/funkin/backend/MusicBeatTransition.hx @@ -79,8 +79,7 @@ class MusicBeatTransition extends MusicBeatSubstate { public function finish() { if (newState != null) FlxG.switchState(newState); - else - close(); + close(); } public override function destroy() { From 6e2877c2a9dc2d6de1ef793d35b6746f766d86b5 Mon Sep 17 00:00:00 2001 From: Microkat <89645987+KadePleaseHelpMe@users.noreply.github.com> Date: Sat, 14 Dec 2024 09:47:47 -0500 Subject: [PATCH 14/26] Added flipX and flipY to loadSpriteFromXML() (#487) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #478 * Added flipX and flipY to loadSpriteFromXML() why was this not already implemented? Nevermind I'm pretty sure it's because parseBool isn't a thing * WHOOPS gotta update my heckin repo * Wow neo is good at simplifying stuff rip parseBool but HAXE MAKE IT A THING * sigma ¯\_(ツ)_/¯ * Allow for flipx and flipy as opposed to flipX and flipY (cammel text) * gaming chair 🪑 --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/backend/utils/XMLUtil.hx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/funkin/backend/utils/XMLUtil.hx b/source/funkin/backend/utils/XMLUtil.hx index df551985..a074f97d 100644 --- a/source/funkin/backend/utils/XMLUtil.hx +++ b/source/funkin/backend/utils/XMLUtil.hx @@ -143,6 +143,8 @@ class XMLUtil { var graphicSizey:Null = Std.parseInt(node.att.graphicSizey); if (graphicSizey.isNotNull()) spr.setGraphicSize(0, graphicSizey); } + if (node.has.flipX) spr.flipX = node.att.flipX == "true"; + if (node.has.flipY) spr.flipY = node.att.flipY == "true"; if (node.has.updateHitbox && node.att.updateHitbox == "true") spr.updateHitbox(); if (node.has.zoomfactor) @@ -392,4 +394,4 @@ typedef BeatAnim = { interface IXMLEvents { public function onPropertySet(property:String, value:Dynamic):Void; -} \ No newline at end of file +} From e2a39517025e38832d24ce999be872963a19d105 Mon Sep 17 00:00:00 2001 From: TheZoroForce240 <86524550+TheZoroForce240@users.noreply.github.com> Date: Sat, 14 Dec 2024 15:48:58 +0000 Subject: [PATCH 15/26] Transition crash fix again + changeable transition script (#493) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix transition crash when skipping * transition crash fix again * rename transition script var * better transition scripting * add more transition script functions * move post create to actually be after * change this * actually destroy the script * add a variable to disable skipping the transition * opa idk felt better like this --------- Co-authored-by: ⍚~Nex <87421482+NexIsDumb@users.noreply.github.com> --- source/funkin/backend/MusicBeatTransition.hx | 69 +++++++++++++++---- .../events/TransitionCreationEvent.hx | 18 +++++ source/funkin/backend/system/MainState.hx | 1 + .../backend/utils/FunkinParentDisabler.hx | 9 ++- 4 files changed, 82 insertions(+), 15 deletions(-) create mode 100644 source/funkin/backend/scripting/events/TransitionCreationEvent.hx diff --git a/source/funkin/backend/MusicBeatTransition.hx b/source/funkin/backend/MusicBeatTransition.hx index 34b02388..58ddc2c5 100644 --- a/source/funkin/backend/MusicBeatTransition.hx +++ b/source/funkin/backend/MusicBeatTransition.hx @@ -1,15 +1,24 @@ package funkin.backend; +import funkin.backend.scripting.events.CancellableEvent; +import funkin.backend.scripting.events.TransitionCreationEvent; +import funkin.backend.scripting.Script; import flixel.tweens.FlxTween; import flixel.FlxState; import funkin.backend.utils.FunkinParentDisabler; class MusicBeatTransition extends MusicBeatSubstate { + public static var script:String = ""; + public var transitionScript:Script; + var nextFrameSkip:Bool = false; public var transitionTween:FlxTween = null; public var transitionCamera:FlxCamera; public var newState:FlxState; + public var transOut:Bool = false; + + public var allowSkip:Bool = true; public var blackSpr:FlxSprite; public var transitionSprite:FunkinSprite; @@ -20,16 +29,30 @@ class MusicBeatTransition extends MusicBeatSubstate { public override function create() { if (newState != null) - add(new FunkinParentDisabler(true)); + add(new FunkinParentDisabler(true, false)); transitionCamera = new FlxCamera(); transitionCamera.bgColor = 0; FlxG.cameras.add(transitionCamera, false); cameras = [transitionCamera]; - var out = newState != null; - blackSpr = new FlxSprite(0, out ? -transitionCamera.height : transitionCamera.height).makeGraphic(1, 1, -1); + transitionScript = Script.create(Paths.script(script)); + transitionScript.setParent(this); + transitionScript.load(); + + var event = EventManager.get(TransitionCreationEvent).recycle(newState != null, newState); + transitionScript.call('create', [event]); + + transOut = event.transOut; + newState = event.newState; + + if (event.cancelled) { + super.create(); + return; + } + + blackSpr = new FlxSprite(0, transOut ? -transitionCamera.height : transitionCamera.height).makeGraphic(1, 1, -1); blackSpr.scale.set(transitionCamera.width, transitionCamera.height); blackSpr.color = 0xFF000000; blackSpr.updateHitbox(); @@ -43,7 +66,7 @@ class MusicBeatTransition extends MusicBeatSubstate { } else { transitionSprite.screenCenter(); } - transitionCamera.flipY = !out; + transitionCamera.flipY = !transOut; add(transitionSprite); transitionCamera.scroll.y = transitionCamera.height; @@ -55,41 +78,59 @@ class MusicBeatTransition extends MusicBeatSubstate { }); super.create(); + transitionScript.call('postCreate', [event]); } public override function update(elapsed:Float) { + transitionScript.call('update', [elapsed]); super.update(elapsed); if (nextFrameSkip) { - finish(); - return; + var event = new CancellableEvent(); + transitionScript.call('onSkip', [event]); + if (!event.cancelled) { + finish(); + return; + } } - if (!parent.persistentUpdate && FlxG.keys.pressed.SHIFT) { + if (allowSkip && !parent.persistentUpdate && FlxG.keys.pressed.SHIFT) { // skip if (newState != null) { nextFrameSkip = true; parent.persistentDraw = false; } else { - finish(); + var event = new CancellableEvent(); + transitionScript.call('onSkip', [event]); + if (!event.cancelled) { + finish(); + } } } + transitionScript.call('postUpdate', [elapsed]); } public function finish() { + var event = new CancellableEvent(); + transitionScript.call('onFinish', [event]); + if (event.cancelled) return; + if (newState != null) FlxG.switchState(newState); close(); + + transitionScript.call('onPostFinish'); } public override function destroy() { - if (transitionTween != null) - transitionTween.cancel(); + transitionScript.call('destroy'); + + if (transitionTween != null) transitionTween.cancel(); transitionTween = FlxDestroyUtil.destroy(transitionTween); - if (newState == null && FlxG.cameras.list.contains(transitionCamera)) - FlxG.cameras.remove(transitionCamera); - else - transitionCamera.bgColor = 0xFF000000; + if (newState == null && FlxG.cameras.list.contains(transitionCamera)) FlxG.cameras.remove(transitionCamera); + else transitionCamera.bgColor = 0xFF000000; + + transitionScript.destroy(); super.destroy(); } } \ No newline at end of file diff --git a/source/funkin/backend/scripting/events/TransitionCreationEvent.hx b/source/funkin/backend/scripting/events/TransitionCreationEvent.hx new file mode 100644 index 00000000..e72a56c2 --- /dev/null +++ b/source/funkin/backend/scripting/events/TransitionCreationEvent.hx @@ -0,0 +1,18 @@ +package funkin.backend.scripting.events; + +import flixel.FlxState; + +/** + * CANCEL this event to prevent default behaviour! + */ +final class TransitionCreationEvent extends CancellableEvent { + /** + * If the transition is going out into another state + */ + public var transOut:Bool; + + /** + * The state that is about to be loaded (only on trans out) + */ + public var newState:FlxState; +} \ No newline at end of file diff --git a/source/funkin/backend/system/MainState.hx b/source/funkin/backend/system/MainState.hx index 14c40aff..a5011d6d 100644 --- a/source/funkin/backend/system/MainState.hx +++ b/source/funkin/backend/system/MainState.hx @@ -53,6 +53,7 @@ class MainState extends FlxState { } #end + MusicBeatTransition.script = ""; Main.refreshAssets(); ModsFolder.onModSwitch.dispatch(ModsFolder.currentModFolder); DiscordUtil.init(); diff --git a/source/funkin/backend/utils/FunkinParentDisabler.hx b/source/funkin/backend/utils/FunkinParentDisabler.hx index 29e076be..bd8b1684 100644 --- a/source/funkin/backend/utils/FunkinParentDisabler.hx +++ b/source/funkin/backend/utils/FunkinParentDisabler.hx @@ -19,9 +19,11 @@ class FunkinParentDisabler extends FlxBasic { var __timers:Array; var __sounds:Array; var __replaceUponDestroy:Bool; - public function new(replaceUponDestroy:Bool = false) { + var __restoreUponDestroy:Bool; + public function new(replaceUponDestroy:Bool = false, restoreUponDestroy:Bool = true) { super(); __replaceUponDestroy = replaceUponDestroy; + __restoreUponDestroy = restoreUponDestroy; @:privateAccess { // tweens __tweens = FlxTween.globalManager._tweens.copy(); @@ -53,6 +55,11 @@ class FunkinParentDisabler extends FlxBasic { public override function destroy() { super.destroy(); @:privateAccess { + if (!__restoreUponDestroy) { + for(t in __tweens) { t.cancel(); t.destroy(); }; + for(t in __timers) { t.cancel(); t.destroy(); }; + return; + } if (__replaceUponDestroy) { FlxTween.globalManager._tweens = __tweens; FlxTimer.globalManager._timers = __timers; From fd0c188577cf58e34e8ed706e59903a989ee2d11 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Mon, 16 Dec 2024 03:21:04 +0100 Subject: [PATCH 16/26] Added some flags for Transition/Pause/Gameover --- source/funkin/backend/MusicBeatTransition.hx | 2 +- source/funkin/backend/system/Flags.hx | 7 +++++++ source/funkin/backend/system/MainState.hx | 2 +- source/funkin/game/GameOverSubstate.hx | 2 +- source/funkin/game/PlayState.hx | 4 ++-- source/funkin/menus/PauseSubState.hx | 2 +- 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/source/funkin/backend/MusicBeatTransition.hx b/source/funkin/backend/MusicBeatTransition.hx index bd3a23c0..0cb44df0 100644 --- a/source/funkin/backend/MusicBeatTransition.hx +++ b/source/funkin/backend/MusicBeatTransition.hx @@ -8,7 +8,7 @@ import funkin.backend.scripting.events.TransitionCreationEvent; import funkin.backend.utils.FunkinParentDisabler; class MusicBeatTransition extends MusicBeatSubstate { - public static var script:String = ""; + public static var script:String = Flags.DEFAULT_TRANSITION_SCRIPT; public var transitionScript:Script; var nextFrameSkip:Bool = false; diff --git a/source/funkin/backend/system/Flags.hx b/source/funkin/backend/system/Flags.hx index f7c00e52..1f3d3f84 100644 --- a/source/funkin/backend/system/Flags.hx +++ b/source/funkin/backend/system/Flags.hx @@ -135,6 +135,13 @@ class Flags { public static var DISABLE_EDITORS:Bool = false; public static var DISABLE_BETA_WARNING_SCREEN:Bool = false; public static var DISABLE_TRANSITIONS:Bool = false; + + @:also(funkin.backend.MusicBeatTransition.script) + public static var DEFAULT_TRANSITION_SCRIPT:String = ""; + @:also(funkin.menus.PauseSubState.script) + public static var DEFAULT_PAUSE_SCRIPT:String = ""; + @:also(funkin.game.GameOverSubstate.script) + public static var DEFAULT_GAMEOVER_SCRIPT:String = ""; // -- End of Codename's Default Flags -- /** diff --git a/source/funkin/backend/system/MainState.hx b/source/funkin/backend/system/MainState.hx index cebf218a..0aa26a09 100644 --- a/source/funkin/backend/system/MainState.hx +++ b/source/funkin/backend/system/MainState.hx @@ -58,7 +58,7 @@ class MainState extends FlxState { Flags.load(); ModsFolder.onModSwitch.dispatch(ModsFolder.currentModFolder); // Loads global.hx - MusicBeatTransition.script = ""; + MusicBeatTransition.script = Flags.DEFAULT_TRANSITION_SCRIPT; Main.refreshAssets(); DiscordUtil.init(); EventsData.reloadEvents(); diff --git a/source/funkin/game/GameOverSubstate.hx b/source/funkin/game/GameOverSubstate.hx index a871422f..2d7af30d 100644 --- a/source/funkin/game/GameOverSubstate.hx +++ b/source/funkin/game/GameOverSubstate.hx @@ -24,7 +24,7 @@ class GameOverSubstate extends MusicBeatSubstate var camFollow:FlxObject; - public static var script:String = ""; + public static var script:String = Flags.DEFAULT_GAMEOVER_SCRIPT; public var gameoverScript:Script; public var game:PlayState = PlayState.instance; // shortcut diff --git a/source/funkin/game/PlayState.hx b/source/funkin/game/PlayState.hx index 0f0f8c73..4344acec 100644 --- a/source/funkin/game/PlayState.hx +++ b/source/funkin/game/PlayState.hx @@ -586,8 +586,8 @@ class PlayState extends MusicBeatState instance = this; if (FlxG.sound.music != null) FlxG.sound.music.stop(); - PauseSubState.script = ""; - GameOverSubstate.script = ""; + PauseSubState.script = Flags.DEFAULT_PAUSE_SCRIPT; + GameOverSubstate.script = Flags.DEFAULT_GAMEOVER_SCRIPT; (scripts = new ScriptPack("PlayState")).setParent(this); camGame = camera; diff --git a/source/funkin/menus/PauseSubState.hx b/source/funkin/menus/PauseSubState.hx index b543742a..096ea443 100644 --- a/source/funkin/menus/PauseSubState.hx +++ b/source/funkin/menus/PauseSubState.hx @@ -18,7 +18,7 @@ import funkin.options.TreeMenu; class PauseSubState extends MusicBeatSubstate { - public static var script:String = ""; + public static var script:String = Flags.DEFAULT_PAUSE_SCRIPT; var grpMenuShit:FlxTypedGroup; From a6c99754fd1bfe56db61b82b9749f073a1a0a170 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Mon, 16 Dec 2024 03:53:42 +0100 Subject: [PATCH 17/26] Added some documentation --- source/funkin/backend/system/ErrorCode.hx | 10 --- source/funkin/backend/system/github/GitHub.hx | 5 ++ source/funkin/backend/utils/CoolUtil.hx | 43 ++++++++++- source/funkin/backend/utils/MemoryUtil.hx | 31 ++++++++ .../funkin/backend/utils/SortedArrayUtil.hx | 17 ++++- source/funkin/backend/utils/WindowUtils.hx | 29 +++++-- source/funkin/backend/utils/XMLUtil.hx | 75 ++++++++++++++++++- 7 files changed, 187 insertions(+), 23 deletions(-) delete mode 100644 source/funkin/backend/system/ErrorCode.hx diff --git a/source/funkin/backend/system/ErrorCode.hx b/source/funkin/backend/system/ErrorCode.hx deleted file mode 100644 index c1121c0e..00000000 --- a/source/funkin/backend/system/ErrorCode.hx +++ /dev/null @@ -1,10 +0,0 @@ -package funkin.backend.system; - -enum abstract ErrorCode(Int) { - var OK = 0; - var FAILED = 1; - var MISSING_PROPERTY = 2; - var TYPE_INCORRECT = 3; - var VALUE_NULL = 4; - var REFLECT_ERROR = 5; -} \ No newline at end of file diff --git a/source/funkin/backend/system/github/GitHub.hx b/source/funkin/backend/system/github/GitHub.hx index ce7e61dc..1e29d143 100644 --- a/source/funkin/backend/system/github/GitHub.hx +++ b/source/funkin/backend/system/github/GitHub.hx @@ -7,6 +7,11 @@ import haxe.Json; import haxe.Exception; // TODO: Document further and perhaps make this a Haxelib. +/** + * Set of functions to interact with GitHub. + * Requires the `GITHUB_API` macro to be defined. + * This has no authentication, so it's limited to unauthenticated requests, and rate limits. +**/ class GitHub { /** * Gets all the releases from a specific GitHub repository using the GitHub API. diff --git a/source/funkin/backend/utils/CoolUtil.hx b/source/funkin/backend/utils/CoolUtil.hx index 86f68383..cd345844 100644 --- a/source/funkin/backend/utils/CoolUtil.hx +++ b/source/funkin/backend/utils/CoolUtil.hx @@ -40,9 +40,15 @@ import openfl.geom.ColorTransform; using StringTools; +/** + * Various utilities, that have no specific Util class. +**/ @:allow(funkin.game.PlayState) class CoolUtil { + /** + * Gets the last exception stack. Useful for debugging. + */ public static function getLastExceptionStack():String { return CallStack.toString(CallStack.exceptionStack()); } @@ -782,6 +788,15 @@ class CoolUtil return r; } + /** + * Quantizes a value to a certain amount. + * Example: `quantize(2.5543, 1)` will return `2.0` + * Example: `quantize(2.5543, 10)` will return `2.5` + * Example: `quantize(2.5543, 100)` will return `2.55` + * + * @param Value Value to quantize + * @param Quant Quantization amount + */ @:noUsing public static inline function quantize(Value:Float, Quant:Float) { return Math.fround(Value * Quant) / Quant; } @@ -799,9 +814,19 @@ class CoolUtil frontEnd.music = music; } + /** + * Gets the FlxEase from a string. + * @param mainEase Main ease + * @param suffix Suffix (Ignored if `mainEase` is `linear`) + */ @:noUsing public static inline function flxeaseFromString(mainEase:String, suffix:String) return Reflect.field(FlxEase, mainEase + (mainEase == "linear" ? "" : suffix)); + /** + * Sorts an array alphabetically. + * @param array Array to sort + * @param lowercase Whenever the array should be sorted in lowercase + */ public static function sortAlphabetically(array:Array, ?lowercase:Bool=false) { array.sort(function(a1, a2):Int { if(lowercase) { @@ -815,6 +840,11 @@ class CoolUtil return array; } + /** + * Pushes an element to an array, but only if it doesn't already exist. + * @param array Array to push to + * @param element Element to push + */ public static inline function pushOnce(array:Array, element:T) { #if (haxe >= "4.0.0") if (!array.contains(element)) @@ -826,6 +856,11 @@ class CoolUtil } #if !(haxe >= "4.0.0") + /** + * Checks if an array contains an element. + * @param array Array to check + * @param element Element to check + */ public static inline function contains(array:Array, element:T) { return array.indexOf(element) != -1; } @@ -927,6 +962,12 @@ class CoolUtil return result.join(separator); } + /** + * Deep flattens an array. + * Example: `deepFlatten([1, [2, 3], 4])` will return `[1, 2, 3, 4]` + * @param arr Array to flatten + * @param result Result array + */ public static function deepFlatten(arr:Array, ?result:Array):Array { if(arr == null) return []; if(result == null) result = []; @@ -942,7 +983,7 @@ class CoolUtil } /** - * SFXs to play using `playMenuSFX`. + * SFXs to play using `CoolUtil.playMenuSFX`. */ enum abstract CoolSfx(Int) from Int { var SCROLL = 0; diff --git a/source/funkin/backend/utils/MemoryUtil.hx b/source/funkin/backend/utils/MemoryUtil.hx index cd27cb0e..0d42e475 100644 --- a/source/funkin/backend/utils/MemoryUtil.hx +++ b/source/funkin/backend/utils/MemoryUtil.hx @@ -14,6 +14,12 @@ import openfl.system.System; using StringTools; +/** + * Tools that are related to memory. + * Including garbage collection, and memory usage, and hardware info. + * + * DISCLAIMER: Hardware info is only available on Native platforms. +**/ class MemoryUtil { public static var disableCount:Int = 0; @@ -34,12 +40,18 @@ class MemoryUtil { public static function init() {} + /** + * Does a minor garbage collection. + */ public static function clearMinor() { #if (cpp || java || neko) Gc.run(false); #end } + /** + * Does a full garbage collection. + */ public static function clearMajor() { #if cpp Gc.run(true); @@ -51,18 +63,29 @@ class MemoryUtil { #end } + /** + * Enables garbage collection. + */ public static function enable() { #if (cpp || hl) Gc.enable(true); #end } + /** + * Disables garbage collection. + * Fyi: doesn't fully disable garbage collection, but prevents it from running as much. + */ public static function disable() { #if (cpp || hl) Gc.enable(false); #end } + /** + * Gets the total memory of the system. + * Output depends on the hardware. + */ public static function getTotalMem():Float { #if windows @@ -76,6 +99,10 @@ class MemoryUtil { #end } + /** + * Gets the current memory usage of the app. + * DISCLAIMER: This gets the memory usage that is taken up by Haxe, not the actual memory usage of the app. + */ public static inline function currentMemUsage() { #if cpp return Gc.memInfo64(Gc.MEM_INFO_USAGE); @@ -89,6 +116,10 @@ class MemoryUtil { } + /** + * Gets the memory type of the system. + * Output depends on the platform, and hardware. + */ public static function getMemType():String { #if windows var memoryMap:Map = [ diff --git a/source/funkin/backend/utils/SortedArrayUtil.hx b/source/funkin/backend/utils/SortedArrayUtil.hx index ac317811..6afc0603 100644 --- a/source/funkin/backend/utils/SortedArrayUtil.hx +++ b/source/funkin/backend/utils/SortedArrayUtil.hx @@ -1,14 +1,16 @@ package funkin.backend.utils; /** - * All types of utils only usable in a sorted array. + * Tools to work with sorted arrays, in a more efficient way. + * + * DISCLAIMER: All types of utils only usable in a sorted array. */ class SortedArrayUtil { /** * Gets the index of a possible new element of an Array of T using an efficient algorithm. * @param array Array of T to check in * @param getVal Function that returns the position value of T - * @return Index + * @return The index of the element */ public static inline function binarySearch(array:Array, val:Float, getVal:T->Float):Int { if (array.length <= 0) return 0; // if the array is empty, it should be equal to zero (the beginning) @@ -46,4 +48,15 @@ class SortedArrayUtil { if (val != null) array.insert(binarySearch(array, getVal(val), getVal), val); } + + /** + * Removes from a sorted array, using binary search. + * @param array Array to remove from + * @param val Value to remove + * @param getVal Function that returns the value that needs to be sorted + */ + public static inline function removeSorted(array:Array, val:T, getVal:T->Float) { + if (val != null) + array.splice(binarySearch(array, getVal(val), getVal), 1); + } } \ No newline at end of file diff --git a/source/funkin/backend/utils/WindowUtils.hx b/source/funkin/backend/utils/WindowUtils.hx index 571f781a..43cd5f8d 100644 --- a/source/funkin/backend/utils/WindowUtils.hx +++ b/source/funkin/backend/utils/WindowUtils.hx @@ -3,9 +3,9 @@ package funkin.backend.utils; import openfl.Lib; class WindowUtils { - public static var winTitle(default, set):String; - private static function set_winTitle(value:String):String { - winTitle = value; + public static var title(default, set):String; + private static function set_title(value:String):String { + title = value; updateTitle(); return value; } @@ -28,7 +28,7 @@ class WindowUtils { static var __triedClosing:Bool = false; public static inline function resetClosing() __triedClosing = false; - public static inline function init() { + @:dox(hide) public static inline function init() { resetTitle(); resetClosing(); @@ -41,18 +41,27 @@ class WindowUtils { }); } + /** + * Resets the window title to the application name and resets the prefix and suffix. + **/ public static inline function resetTitle() { - winTitle = Lib.application.meta["name"]; + title = Lib.application.meta["name"]; resetAffixes(); } + /** + * Resets the prefix and suffix. + **/ public static inline function resetAffixes() { prefix = suffix = ""; updateTitle(); } + /** + * Updates the window title to have the current title and prefix/suffix. + **/ public static inline function updateTitle() - Lib.application.window.title = '$prefix$winTitle$suffix'; + Lib.application.window.title = '$prefix$title$suffix'; // backwards compat @:noCompletion public static var endfix(get, set):String; @@ -62,4 +71,12 @@ class WindowUtils { @:noCompletion private static function get_endfix():String { return suffix; } + + @:noCompletion public static var winTitle(get, set):String; + @:noCompletion private static function get_winTitle():String { + return title; + } + @:noCompletion private static function set_winTitle(value:String):String { + return title = value; + } } \ No newline at end of file diff --git a/source/funkin/backend/utils/XMLUtil.hx b/source/funkin/backend/utils/XMLUtil.hx index 95cb576a..0748323e 100644 --- a/source/funkin/backend/utils/XMLUtil.hx +++ b/source/funkin/backend/utils/XMLUtil.hx @@ -5,7 +5,6 @@ import flixel.util.typeLimit.OneOfTwo; import funkin.backend.FunkinSprite.XMLAnimType; import funkin.backend.FunkinSprite; import funkin.game.Character; -import funkin.backend.system.ErrorCode; import funkin.backend.FunkinSprite.XMLAnimType; import flixel.util.FlxColor; import haxe.xml.Access; @@ -18,17 +17,53 @@ import haxe.xml.Access; using StringTools; +@:dox(hide) +enum abstract ErrorCode(Int) { + var OK = 0; + var FAILED = 1; + var MISSING_PROPERTY = 2; + var TYPE_INCORRECT = 3; + var VALUE_NULL = 4; + var REFLECT_ERROR = 5; +} + +@:dox(hide) typedef TextFormat = { text:String, format:Dynamic } /** * Class made to make XML parsing easier. + * Used in Stage.hx, Character.hx, and more. */ class XMLUtil { - /** * Applies a property XML node to an object. + * The format for the XML is as follows: + * ```xml + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * + * ``` + * * @param object Object to which the xml property will be applied * @param property `property` node. + * @return Error code (0 = OK, 1 = FAILED, 2 = MISSING_PROPERTY, 3 = TYPE_INCORRECT, 4 = VALUE_NULL, 5 = REFLECT_ERROR) */ public static function applyXMLProperty(object:Dynamic, property:Access):ErrorCode { if (!property.has.name || !property.has.type || !property.has.value) { @@ -47,7 +82,8 @@ class XMLUtil { var value:Dynamic = switch(property.att.type.toLowerCase()) { case "f" | "float" | "number": Std.parseFloat(property.att.value); - case "i" | "int" | "integer" | "color": Std.parseInt(property.att.value); + case "i" | "int" | "integer": Std.parseInt(property.att.value); + case "c" | "color": FlxColor.fromString(property.att.value); case "s" | "string" | "str" | "text": property.att.value; case "b" | "bool" | "boolean": property.att.value.toLowerCase() == "true"; default: return TYPE_INCORRECT; @@ -72,7 +108,11 @@ class XMLUtil { } /** - * Overrides a sprite based on a XML node. + * Sets the properties of a sprite based on a XML node. + * @param spr The sprite + * @param node The XML node + * @param parentFolder The parent folder + * @param defaultAnimType The default animation type */ public static function loadSpriteFromXML(spr:FunkinSprite, node:Access, parentFolder:String = "", defaultAnimType:XMLAnimType = BEAT):FunkinSprite { if (parentFolder == null) parentFolder = ""; @@ -188,6 +228,11 @@ class XMLUtil { /** * Creates a new sprite based on a XML node. + * @param node The XML node + * @param parentFolder The parent folder + * @param defaultAnimType The default animation type + * @param cl The class to create (advanced) + * @param args The arguments to pass to the class (advanced) */ public static inline function createSpriteFromXML(node:Access, parentFolder:String = "", defaultAnimType:XMLAnimType = BEAT, ?cl:Class, ?args:Array):FunkinSprite { if(cl == null) cl = FunkinSprite; @@ -195,6 +240,12 @@ class XMLUtil { return loadSpriteFromXML(Type.createInstance(cl, args), node, parentFolder, defaultAnimType); } + /** + * Extracts an animation from an XML node. + * @param anim The animation node + * @param animType The animation type + * @param loop Whether the animation should loop + **/ public static function extractAnimFromXML(anim:Access, animType:XMLAnimType = NONE, loop:Bool = false):AnimData { var animData:AnimData = { name: null, @@ -233,6 +284,11 @@ class XMLUtil { return addAnimToSprite(sprite, extractAnimFromXML(anim, animType, loop)); } + /** + * Adds an animation to a sprite. + * @param sprite The sprite + * @param animData The animation data (gotten from `extractAnimFromXML`) + **/ public static function addAnimToSprite(sprite:FlxSprite, animData:AnimData):ErrorCode { if (animData.name != null) { if (animData.fps <= 0 #if web || animData.fps == null #end) animData.fps = 24; @@ -308,6 +364,17 @@ class XMLUtil { return node; } + /** + * Gets the text formats from an XML node. + * The format for the XML is as follows: + * ```xml + * Hello World + * ``` + * + * @param _node The XML node + * @param currentFormat The current format + * @param parsedSegments The parsed segments + **/ public static function getTextFormats(_node:OneOfTwo, currentFormat:Dynamic = null, parsedSegments:Array = null):Array { var node:Xml = cast _node; if (currentFormat == null) From aec73ab2b65ab8b2bfc18a3bb1393623da497913 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Mon, 16 Dec 2024 04:37:18 +0100 Subject: [PATCH 18/26] Added some more documentation --- commandline/commands/Setup.hx | 6 +- source/funkin/backend/MusicBeatGroup.hx | 3 + source/funkin/backend/MusicBeatState.hx | 4 + source/funkin/backend/MusicBeatSubstate.hx | 4 + .../funkin/backend/chart/FNFLegacyParser.hx | 4 + source/funkin/backend/chart/PsychParser.hx | 4 + source/funkin/backend/scripting/Script.hx | 19 +++++ source/funkin/backend/scripting/ScriptPack.hx | 62 ++++++++++++++- .../funkin/backend/shaders/BlendModeEffect.hx | 2 + .../funkin/backend/shaders/OverlayShader.hx | 1 + source/funkin/backend/shaders/WiggleEffect.hx | 3 + source/funkin/game/HudCamera.hx | 7 ++ source/funkin/game/NoteGroup.hx | 12 ++- source/funkin/game/Stage.hx | 31 ++++++++ source/funkin/game/Strum.hx | 77 +++++++++++++++++-- source/funkin/game/StrumLine.hx | 40 +++++++++- source/funkin/options/Options.hx | 4 + source/funkin/options/type/ArrayOption.hx | 3 + source/funkin/options/type/Checkbox.hx | 3 + source/funkin/options/type/IconOption.hx | 4 + source/funkin/options/type/NewOption.hx | 3 + source/funkin/options/type/NumOption.hx | 3 + source/funkin/options/type/OptionType.hx | 4 + source/funkin/options/type/PortraitOption.hx | 4 + source/funkin/options/type/TextOption.hx | 3 + 25 files changed, 298 insertions(+), 12 deletions(-) diff --git a/commandline/commands/Setup.hx b/commandline/commands/Setup.hx index f93645e0..600211ab 100644 --- a/commandline/commands/Setup.hx +++ b/commandline/commands/Setup.hx @@ -269,13 +269,13 @@ class Setup { prettyPrint("Installing Microsoft Visual Studio Community (Dependency)"); // thanks to @crowplexus for these two lines! - Nex - Sys.command("curl -# -O https://download.visualstudio.microsoft.com/download/pr/3105fcfe-e771-41d6-9a1c-fc971e7d03a7/8eb13958dc429a6e6f7e0d6704d43a55f18d02a253608351b6bf6723ffdaf24e/vs_Community.exe"); - Sys.command("vs_Community.exe --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 -p"); + command("curl -# -O https://download.visualstudio.microsoft.com/download/pr/3105fcfe-e771-41d6-9a1c-fc971e7d03a7/8eb13958dc429a6e6f7e0d6704d43a55f18d02a253608351b6bf6723ffdaf24e/vs_Community.exe"); + command("vs_Community.exe --add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --add Microsoft.VisualStudio.Component.Windows10SDK.19041 -p"); FileSystem.deleteFile("vs_Community.exe"); prettyPrint('If it didn\'t say it before: Because of this component if you want to compile you have to restart the device.'); Sys.print("Do you wish to do it now [y/n]? "); - if(Sys.stdin().readLine().toLowerCase() == "y") Sys.command("shutdown /r /t 0 /f"); + if(Sys.stdin().readLine().toLowerCase() == "y") command("shutdown /r /t 0 /f"); } } diff --git a/source/funkin/backend/MusicBeatGroup.hx b/source/funkin/backend/MusicBeatGroup.hx index 5cccf0f6..0e723ecd 100644 --- a/source/funkin/backend/MusicBeatGroup.hx +++ b/source/funkin/backend/MusicBeatGroup.hx @@ -2,6 +2,9 @@ package funkin.backend; import funkin.backend.system.interfaces.IBeatReceiver; +/** + * Group of FlxSprites, if the sprite implements `IBeatReceiver`, then beatHit, stepHit and measureHit will be called. +**/ class MusicBeatGroup extends FlxTypedSpriteGroup implements IBeatReceiver { public function beatHit(curBeat:Int) { for(e in members) if (e is IBeatReceiver) ({var _:IBeatReceiver = cast e;_;}).beatHit(curBeat); diff --git a/source/funkin/backend/MusicBeatState.hx b/source/funkin/backend/MusicBeatState.hx index a35641e4..5bbdab62 100644 --- a/source/funkin/backend/MusicBeatState.hx +++ b/source/funkin/backend/MusicBeatState.hx @@ -13,6 +13,10 @@ import funkin.backend.system.framerate.Framerate; import funkin.backend.system.interfaces.IBeatReceiver; import funkin.options.PlayerSettings; +/** + * Base class for all the states. + * Handles the scripts, the transitions, and the beat and step events. +**/ class MusicBeatState extends FlxState implements IBeatReceiver { private var lastBeat:Float = 0; diff --git a/source/funkin/backend/MusicBeatSubstate.hx b/source/funkin/backend/MusicBeatSubstate.hx index 49025664..6cd2858f 100644 --- a/source/funkin/backend/MusicBeatSubstate.hx +++ b/source/funkin/backend/MusicBeatSubstate.hx @@ -11,6 +11,10 @@ import funkin.backend.system.Controls; import funkin.backend.system.interfaces.IBeatReceiver; import funkin.options.PlayerSettings; +/** + * Base class for all the sub states. + * Handles the scripts, the transitions, and the beat and step events. +**/ class MusicBeatSubstate extends FlxSubState implements IBeatReceiver { private var lastBeat:Float = 0; diff --git a/source/funkin/backend/chart/FNFLegacyParser.hx b/source/funkin/backend/chart/FNFLegacyParser.hx index 3d8cb597..2ba3e809 100644 --- a/source/funkin/backend/chart/FNFLegacyParser.hx +++ b/source/funkin/backend/chart/FNFLegacyParser.hx @@ -3,6 +3,10 @@ package funkin.backend.chart; import funkin.backend.chart.ChartData.ChartEvent; import funkin.backend.system.Conductor; +/** + * Legacy FNF chart parser. + * This is for charts that that were made before v0.5.0. +**/ class FNFLegacyParser { public static function parse(data:Dynamic, result:ChartData) { // base fnf chart parsing diff --git a/source/funkin/backend/chart/PsychParser.hx b/source/funkin/backend/chart/PsychParser.hx index 3249780e..731857cc 100644 --- a/source/funkin/backend/chart/PsychParser.hx +++ b/source/funkin/backend/chart/PsychParser.hx @@ -5,6 +5,10 @@ import funkin.backend.chart.FNFLegacyParser.SwagSection; import funkin.backend.chart.FNFLegacyParser.SwagSong; import funkin.backend.system.Conductor; +/** + * Parser for Psych Charts. + * Both for pre-v1.0.0 and v1.0.0 charts. +**/ class PsychParser { // Already parsed in sections public static var ignoreEvents:Array = [ diff --git a/source/funkin/backend/scripting/Script.hx b/source/funkin/backend/scripting/Script.hx index 8dde2413..111ece87 100644 --- a/source/funkin/backend/scripting/Script.hx +++ b/source/funkin/backend/scripting/Script.hx @@ -8,6 +8,7 @@ import lime.app.Application; @:allow(funkin.backend.scripting.ScriptPack) /** * Class used for scripting. + * Use `Script.create` to create a script. */ class Script extends FlxBasic implements IFlxDestroyable { /** @@ -16,6 +17,9 @@ class Script extends FlxBasic implements IFlxDestroyable { */ public static var staticVariables:Map = []; + /** + * Gets the default variables for a script. + */ public static function getDefaultVariables(?script:Script):Map { return [ // Haxe related stuff @@ -141,6 +145,10 @@ class Script extends FlxBasic implements IFlxDestroyable { return redirects; } + /** + * Gets the default defines for a script. + * Includes all of the defines that the build was compiled with. + */ public static function getDefaultPreprocessors():Map { var defines = funkin.backend.system.macros.DefinesMacro.defines; defines.set("CODENAME_ENGINE", true); @@ -182,6 +190,10 @@ class Script extends FlxBasic implements IFlxDestroyable { private var didLoad:Bool = false; + /** + * Remapped filenames. + * Used for trace messages, to show what mod the script is from. + */ public var remappedNames:Map = []; /** @@ -366,7 +378,14 @@ class Script extends FlxBasic implements IFlxDestroyable { private function onCall(func:String, parameters:Array):Dynamic { return null; } + /** + * Called when the script is created. + * @param path Path to the script + */ public function onCreate(path:String) {} + /** + * Called when the script is loaded. + */ public function onLoad() {} } \ No newline at end of file diff --git a/source/funkin/backend/scripting/ScriptPack.hx b/source/funkin/backend/scripting/ScriptPack.hx index 32c590fc..4e9af4f7 100644 --- a/source/funkin/backend/scripting/ScriptPack.hx +++ b/source/funkin/backend/scripting/ScriptPack.hx @@ -3,6 +3,9 @@ package funkin.backend.scripting; import flixel.util.FlxStringUtil; import funkin.backend.scripting.events.CancellableEvent; +/** + * Used to group multiple scripts together, and easily be able to call them. +**/ @:access(CancellableEvent) class ScriptPack extends Script { public var scripts:Array