From aec73ab2b65ab8b2bfc18a3bb1393623da497913 Mon Sep 17 00:00:00 2001 From: Ne_Eo Date: Mon, 16 Dec 2024 04:37:18 +0100 Subject: [PATCH] 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