@@ -4,7 +4,6 @@ import flixel.util.FlxDestroyUtil.IFlxDestroyable;
44import flixel .util .FlxStringUtil ;
55import haxe .io .Path ;
66import lime .app .Application ;
7- import haxe .macro .Expr ;
87
98@:allow (funkin.backend.scripting. ScriptPack )
109/**
@@ -38,166 +37,116 @@ class Script extends FlxBasic implements IFlxDestroyable
3837 private static var _defaultVariablesTemplate : Map <String , Dynamic > = null ;
3938
4039 private static function buildDefaultVariables (): Map <String , Dynamic >
41- {
42- return generateDefaultVariables ();
43- }
44-
45- private static macro function generateDefaultVariables (): Expr
46- {
47- return macro [
48- $a {getHaxeDefaultsVariables ()},
49- $a {getOpenFLDefaultsVariables ()},
50- $a {getFlixelDefaultsVariables ()},
51- $a {getFoxliteDefaultsVariables ()},
52- $a {getCNEDefaultsVariables ()},
53- ];
54- }
55-
56- // Haxe related stuff
57- private static function getHaxeDefaultsVariables (): Array <Expr >
5840 {
5941 return [
60- macro " Std" => Std ,
61- macro " Math" => Math ,
62- macro " Reflect" => Reflect ,
63- macro " StringTools" => StringTools ,
64- macro " Json" => haxe. Json ,
65- macro " Xml" => Xml ,
66- macro " Type" => Type ,
67- macro " Date" => Date ,
68- macro " Lambda" => Lambda ,
69- #if sys macro " Sys" => Sys , #end
70- ];
71- }
72-
73- // OpenFL related stuff
74- private static function getOpenFLDefaultsVariables (): Array <Expr >
75- {
76- return [
77- macro " BlendMode" => CoolUtil .getMacroAbstractClass (" openfl.display.BlendMode" ),
78- macro " Assets" => openfl.utils. Assets ,
79- macro " Application" => lime.app. Application ,
80- macro " Main" => funkin.backend.system. Main ,
81- ];
82- }
83-
84- // Flixel related stuff
85- private static function getFlixelDefaultsVariables (): Array <Expr >
86- {
87- return [
88- macro " FlxG" => flixel. FlxG ,
89- macro " FlxSprite" => flixel. FlxSprite ,
90- macro " FlxBasic" => flixel. FlxBasic ,
91- macro " FlxCamera" => flixel. FlxCamera ,
92- macro " FlxEase" => flixel.tweens. FlxEase ,
93- macro " FlxTween" => flixel.tweens. FlxTween ,
94- macro " FlxSound" => flixel.sound. FlxSound ,
95- macro " FlxAssets" => flixel.system. FlxAssets ,
96- macro " FlxMath" => flixel.math. FlxMath ,
97- macro " FlxGroup" => flixel.group. FlxGroup ,
98- macro " FlxTypedGroup" => flixel.group. FlxGroup . FlxTypedGroup ,
99- macro " FlxSpriteGroup" => flixel.group. FlxSpriteGroup ,
100- macro " FlxTypeText" => flixel.addons.text. FlxTypeText ,
101- macro " FlxText" => flixel.text. FlxText ,
102- macro " FlxTimer" => flixel.util. FlxTimer ,
103- macro " FlxPoint" => CoolUtil .getMacroAbstractClass (" flixel.math.FlxPoint" ),
104- macro " FlxAxes" => CoolUtil .getMacroAbstractClass (" flixel.util.FlxAxes" ),
105- macro " FlxColor" => CoolUtil .getMacroAbstractClass (" flixel.util.FlxColor" ),
106- ];
107- }
108-
109- // Foxlite related stuff
110- private static function getFoxliteDefaultsVariables (): Array <Expr >
111- {
112- return [
113- macro " FoxScene" => foxlite. FoxScene ,
114- macro " FoxCamera" => foxlite. FoxCamera ,
115- macro " FoxFPSCamera" => foxlite.extras. FoxFPSCamera ,
116- macro " FoxRenderer" => foxlite.renderer. FoxRenderer ,
117- macro " FoxLoaderUtil" => foxlite.loaders. FoxLoaderUtil ,
118- macro " FoxModel" => foxlite. FoxModel ,
119- macro " FoxQuadMesh" => foxlite.mesh. FoxQuadMesh ,
120- macro " FoxCubeMesh" => foxlite.mesh. FoxCubeMesh ,
121- macro " FoxMaterial" => foxlite.material. FoxMaterial ,
122- macro " FoxShader" => foxlite. FoxShader ,
123- macro " FoxTexture" => foxlite.texture. FoxTexture ,
124- macro " FoxCache" => foxlite. FoxCache ,
125- macro " FoxRenderMetrics" => foxlite.flixel. FoxRenderMetrics ,
126- macro " FoxFunkinSprite" => foxlite.funkin. FoxFunkinSprite ,
127- macro " FoxFlxSprite" => foxlite.flixel. FoxFlxSprite ,
128- macro " FoxPanoramaSky" => foxlite.sky. FoxPanoramaSky ,
129- macro " FoxStencilAction" => foxlite.stencil. FoxStencilAction ,
130- macro " FoxOBJLoader" => foxlite.loaders. FoxOBJLoader ,
131- macro " FoxMTLLoader" => foxlite.loaders. FoxMTLLoader ,
132- macro " FoxDirectionalLight" => foxlite.lights. FoxDirectionalLight ,
133- macro " FoxLayer" => CoolUtil .getMacroAbstractClass (" foxlite.FoxLayer" ),
134- macro " FoxEaseType" => CoolUtil .getMacroAbstractClass (" foxlite.animation.FoxEaseType" ),
135- macro " FoxInstanceUpdateMode" => CoolUtil .getMacroAbstractClass (" foxlite.instancing.FoxInstanceUpdateMode" ),
136- macro " FoxAreaLightShape" => CoolUtil .getMacroAbstractClass (" foxlite.lights.FoxAreaLightShape" ),
137- macro " FoxLightType" => CoolUtil .getMacroAbstractClass (" foxlite.lights.FoxLightType" ),
138- macro " FoxBlendMode" => CoolUtil .getMacroAbstractClass (" foxlite.material.FoxBlendMode" ),
139- macro " FoxDepthCompareMode" => CoolUtil .getMacroAbstractClass (" foxlite.material.FoxDepthCompareMode" ),
140- macro " FoxStencilCompareMode" => CoolUtil .getMacroAbstractClass (" foxlite.stencil.FoxStencilCompareMode" ),
141- macro " FoxTriangleFace" => CoolUtil .getMacroAbstractClass (" foxlite.material.FoxTriangleFace" ),
142- macro " FoxMeshBufferType" => CoolUtil .getMacroAbstractClass (" foxlite.mesh.FoxMeshBufferType" ),
143- macro " FoxQuadFace" => CoolUtil .getMacroAbstractClass (" foxlite.mesh.FoxQuadFace" ),
144- macro " FoxStencilActionType" => CoolUtil .getMacroAbstractClass (" foxlite.stencil.FoxStencilActionType" ),
145- macro " FoxCubemapSide" => CoolUtil .getMacroAbstractClass (" foxlite.texture.FoxCubemapSide" ),
146- macro " FoxMipFilter" => CoolUtil .getMacroAbstractClass (" foxlite.texture.FoxMipFilter" ),
147- macro " FoxTextureFilter" => CoolUtil .getMacroAbstractClass (" foxlite.texture.FoxTextureFilter" ),
148- macro " FoxWrapMode" => CoolUtil .getMacroAbstractClass (" foxlite.texture.FoxWrapMode" ),
149- ];
150- }
42+ // Haxe related stuff
43+ " Std" => Std ,
44+ " Math" => Math ,
45+ " Reflect" => Reflect ,
46+ " StringTools" => StringTools ,
47+ " Json" => haxe. Json ,
48+ " Xml" => Xml ,
49+ " Type" => Type ,
50+ " Date" => Date ,
51+ " Lambda" => Lambda ,
52+ #if sys " Sys" => Sys , #end
53+
54+ // OpenFL & Lime related stuff
55+ " BlendMode" => CoolUtil .getMacroAbstractClass (" openfl.display.BlendMode" ),
56+ " Assets" => openfl.utils. Assets ,
57+ " Application" => lime.app. Application ,
58+ " Main" => funkin.backend.system. Main ,
59+
60+ // Flixel related stuff
61+ " FlxG" => flixel. FlxG ,
62+ " FlxSprite" => flixel. FlxSprite ,
63+ " FlxBasic" => flixel. FlxBasic ,
64+ " FlxCamera" => flixel. FlxCamera ,
65+ " FlxEase" => flixel.tweens. FlxEase ,
66+ " FlxTween" => flixel.tweens. FlxTween ,
67+ " FlxSound" => flixel.sound. FlxSound ,
68+ " FlxAssets" => flixel.system. FlxAssets ,
69+ " FlxMath" => flixel.math. FlxMath ,
70+ " FlxGroup" => flixel.group. FlxGroup ,
71+ " FlxTypedGroup" => flixel.group. FlxGroup . FlxTypedGroup ,
72+ " FlxSpriteGroup" => flixel.group. FlxSpriteGroup ,
73+ " FlxTypeText" => flixel.addons.text. FlxTypeText ,
74+ " FlxText" => flixel.text. FlxText ,
75+ " FlxTimer" => flixel.util. FlxTimer ,
76+ " FlxPoint" => CoolUtil .getMacroAbstractClass (" flixel.math.FlxPoint" ),
77+ " FlxAxes" => CoolUtil .getMacroAbstractClass (" flixel.util.FlxAxes" ),
78+ " FlxColor" => CoolUtil .getMacroAbstractClass (" flixel.util.FlxColor" ),
79+
80+ #if (THREE_D_SUPPORT && foxlite)
81+ // Foxlite stuff
82+ " FoxScene" => foxlite. FoxScene , " FoxCamera" => foxlite. FoxCamera , " FoxFPSCamera" => foxlite.extras. FoxFPSCamera , " FoxRenderer" =>
83+ foxlite.renderer. FoxRenderer , " FoxLoaderUtil" => foxlite.loaders. FoxLoaderUtil , " FoxModel" => foxlite. FoxModel , " FoxQuadMesh" =>
84+ foxlite.mesh. FoxQuadMesh , " FoxCubeMesh" => foxlite.mesh. FoxCubeMesh , " FoxMaterial" => foxlite.material. FoxMaterial , " FoxShader" =>
85+ foxlite. FoxShader , " FoxTexture" => foxlite.texture. FoxTexture , " FoxCache" => foxlite. FoxCache , " FoxRenderMetrics" =>
86+ foxlite.flixel. FoxRenderMetrics , " FoxFunkinSprite" => foxlite.funkin. FoxFunkinSprite , " FoxFlxSprite" => foxlite.flixel. FoxFlxSprite ,
87+ " FoxPanoramaSky" => foxlite.sky. FoxPanoramaSky , " FoxStencilAction" => foxlite.stencil. FoxStencilAction , " FoxOBJLoader" =>
88+ foxlite.loaders. FoxOBJLoader , " FoxMTLLoader" => foxlite.loaders. FoxMTLLoader , " FoxDirectionalLight" => foxlite.lights. FoxDirectionalLight ,
89+ " FoxLayer" => CoolUtil .getMacroAbstractClass (" foxlite.FoxLayer" ), " FoxEaseType" => CoolUtil .getMacroAbstractClass (" foxlite.animation.FoxEaseType" ),
90+ " FoxInstanceUpdateMode" => CoolUtil .getMacroAbstractClass (" foxlite.instancing.FoxInstanceUpdateMode" ), " FoxAreaLightShape" =>
91+ CoolUtil .getMacroAbstractClass (" foxlite.lights.FoxAreaLightShape" ), " FoxLightType" =>
92+ CoolUtil .getMacroAbstractClass (" foxlite.lights.FoxLightType" ), " FoxBlendMode" => CoolUtil .getMacroAbstractClass (" foxlite.material.FoxBlendMode" ),
93+ " FoxDepthCompareMode" => CoolUtil .getMacroAbstractClass (" foxlite.material.FoxDepthCompareMode" ), " FoxStencilCompareMode" =>
94+ CoolUtil .getMacroAbstractClass (" foxlite.stencil.FoxStencilCompareMode" ), " FoxTriangleFace" =>
95+ CoolUtil .getMacroAbstractClass (" foxlite.material.FoxTriangleFace" ), " FoxMeshBufferType" =>
96+ CoolUtil .getMacroAbstractClass (" foxlite.mesh.FoxMeshBufferType" ), " FoxQuadFace" => CoolUtil .getMacroAbstractClass (" foxlite.mesh.FoxQuadFace" ),
97+ " FoxStencilActionType" => CoolUtil .getMacroAbstractClass (" foxlite.stencil.FoxStencilActionType" ), " FoxCubemapSide" =>
98+ CoolUtil .getMacroAbstractClass (" foxlite.texture.FoxCubemapSide" ), " FoxMipFilter" => CoolUtil .getMacroAbstractClass (" foxlite.texture.FoxMipFilter" ),
99+ " FoxTextureFilter" => CoolUtil .getMacroAbstractClass (" foxlite.texture.FoxTextureFilter" ), " FoxWrapMode" =>
100+ CoolUtil .getMacroAbstractClass (" foxlite.texture.FoxWrapMode" ),
101+ #end
151102
152- private static function getCNEDefaultsVariables (): Array <Expr >
153- {
154- return [
155- macro " engine" => {
103+ // Engine related stuff
104+ " engine" => {
156105 commit : Flags .COMMIT_NUMBER ,
157106 hash : Flags .COMMIT_HASH ,
158107 build : 2675 , // 2675 being the last build num before it was removed
159108 name : " Codename Engine"
160109 },
161- macro " ModState" => funkin.backend.scripting. ModState ,
162- macro " ModSubState" => funkin.backend.scripting. ModSubState ,
163- macro " PlayState" => funkin.game. PlayState ,
164- macro " GameOverSubstate" => funkin.game. GameOverSubstate ,
165- macro " HealthIcon" => funkin.game. HealthIcon ,
166- macro " HudCamera" => funkin.game. HudCamera ,
167- macro " Note" => funkin.game. Note ,
168- macro " Strum" => funkin.game. Strum ,
169- macro " StrumLine" => funkin.game. StrumLine ,
170- macro " Character" => funkin.game. Character ,
171- macro " Boyfriend" => funkin.game. Character , // for compatibility
172- macro " PauseSubState " => funkin.menus. PauseSubState ,
173- macro " PauseSubstate " => funkin.menus. PauseSubState , // miss-spelling
174- macro " FreeplayState " => funkin.menus. FreeplayState ,
175- macro " MainMenuState " => funkin.menus. MainMenuState ,
176- macro " StoryMenuState" => funkin.menus. StoryMenuState ,
177- macro " TitleState" => funkin.menus. TitleState ,
178- macro " Options" => funkin.options. Options ,
179- macro " Paths" => funkin.backend.assets. Paths ,
180- macro " Conductor" => funkin.backend.system. Conductor ,
181- macro " FunkinShader" => funkin.backend.shaders. FunkinShader ,
182- macro " CustomShader" => funkin.backend.shaders. CustomShader , // deprecated
183- macro " FunkinText" => funkin.backend. FunkinText ,
184- macro " FlxAnimate" => animate. FlxAnimate ,
185- macro " FunkinSprite" => funkin.backend. FunkinSprite ,
186- macro " Alphabet" => funkin.menus.ui. Alphabet ,
187- macro " Flags" => funkin.backend.system. Flags ,
188-
189- macro " CoolUtil" => funkin.backend.utils. CoolUtil ,
190- macro " IniUtil" => funkin.backend.utils. IniUtil ,
191- macro " XMLUtil" => funkin.backend.utils. XMLUtil ,
192- #if sys macro " ZipUtil" => funkin.backend.utils. ZipUtil , #end
193- macro " MarkdownUtil" => funkin.backend.utils. MarkdownUtil ,
194- macro " EngineUtil" => funkin.backend.utils. EngineUtil ,
195- macro " ThreadUtil" => funkin.backend.utils. ThreadUtil ,
196- macro " MemoryUtil" => funkin.backend.utils. MemoryUtil ,
197- macro " BitmapUtil" => funkin.backend.utils. BitmapUtil ,
110+ " ModState" => funkin.backend.scripting. ModState ,
111+ " ModSubState" => funkin.backend.scripting. ModSubState ,
112+ " PlayState" => funkin.game. PlayState ,
113+ " GameOverSubstate" => funkin.game. GameOverSubstate ,
114+ " HealthIcon" => funkin.game. HealthIcon ,
115+ " HudCamera" => funkin.game. HudCamera ,
116+ " Note" => funkin.game. Note ,
117+ " Strum" => funkin.game. Strum ,
118+ " StrumLine" => funkin.game. StrumLine ,
119+ " Character" => funkin.game. Character ,
120+ " Boyfriend" => funkin.game. Character , // for compatibility
121+ " PauseSubstate " => funkin.menus. PauseSubState ,
122+ " FreeplayState " => funkin.menus. FreeplayState ,
123+ " MainMenuState " => funkin.menus. MainMenuState ,
124+ " PauseSubState " => funkin.menus. PauseSubState ,
125+ " StoryMenuState" => funkin.menus. StoryMenuState ,
126+ " TitleState" => funkin.menus. TitleState ,
127+ " Options" => funkin.options. Options ,
128+ " Paths" => funkin.backend.assets. Paths ,
129+ " Conductor" => funkin.backend.system. Conductor ,
130+ " FunkinShader" => funkin.backend.shaders. FunkinShader ,
131+ " CustomShader" => funkin.backend.shaders. CustomShader , // deprecated
132+ " FunkinText" => funkin.backend. FunkinText ,
133+ " FlxAnimate" => animate. FlxAnimate ,
134+ " FunkinSprite" => funkin.backend. FunkinSprite ,
135+ " Alphabet" => funkin.menus.ui. Alphabet ,
136+ " Flags" => funkin.backend.system. Flags ,
137+
138+ " CoolUtil" => funkin.backend.utils. CoolUtil ,
139+ " IniUtil" => funkin.backend.utils. IniUtil ,
140+ " XMLUtil" => funkin.backend.utils. XMLUtil ,
141+ #if sys " ZipUtil" => funkin.backend.utils. ZipUtil , #end
142+ " MarkdownUtil" => funkin.backend.utils. MarkdownUtil ,
143+ " EngineUtil" => funkin.backend.utils. EngineUtil ,
144+ " ThreadUtil" => funkin.backend.utils. ThreadUtil ,
145+ " MemoryUtil" => funkin.backend.utils. MemoryUtil ,
146+ " BitmapUtil" => funkin.backend.utils. BitmapUtil ,
198147
199148 #if TRANSLATIONS_SUPPORT
200- macro " TranslationUtil" => funkin.backend.utils. TranslationUtil , macro " translate" => funkin.backend.utils. TranslationUtil .get ,
149+ " TranslationUtil" => funkin.backend.utils. TranslationUtil , " translate" => funkin.backend.utils. TranslationUtil .get ,
201150 #end
202151 ];
203152 }
0 commit comments