From 01995a4f3a96ff219a8023fc11d413d9d3dca431 Mon Sep 17 00:00:00 2001
From: Miepee <38186597+Miepee@users.noreply.github.com>
Date: Sun, 12 Jun 2022 18:49:34 +0200
Subject: [PATCH] Add some GMS2.3 Methods
Fixes #464
---
UndertaleModLib/Compiler/BuiltinList.cs | 17 +++++++++++++++++
UndertaleModTool/Resources/GML.xshd | 1 +
2 files changed, 18 insertions(+)
diff --git a/UndertaleModLib/Compiler/BuiltinList.cs b/UndertaleModLib/Compiler/BuiltinList.cs
index 82ae1f703..92bfacc3d 100644
--- a/UndertaleModLib/Compiler/BuiltinList.cs
+++ b/UndertaleModLib/Compiler/BuiltinList.cs
@@ -844,6 +844,17 @@ public void Initialize(UndertaleData data)
Functions["texture_get_height"] = new FunctionInfo(this, 1);
Functions["texture_global_scale"] = new FunctionInfo(this, 1);
Functions["texture_get_uvs"] = new FunctionInfo(this, 1);
+ if (data?.GeneralInfo?.Major >= 2)
+ {
+ Functions["texture_prefetch"] = new FunctionInfo(this, 1);
+ Functions["texture_flush"] = new FunctionInfo(this, 1);
+ Functions["texture_debug_messages"] = new FunctionInfo(this, 1);
+ Functions["texture_is_ready"] = new FunctionInfo(this, 1);
+ Functions["texturegroup_get_textures"] = new FunctionInfo(this, 1);
+ Functions["texturegroup_get_sprites"] = new FunctionInfo(this, 1);
+ Functions["texturegroup_get_fonts"] = new FunctionInfo(this, 1);
+ Functions["texturegroup_get_tilesets"] = new FunctionInfo(this, 1);
+ }
if (data?.GeneralInfo?.Major >= 2 || data?.GeneralInfo?.Minor >= 3) // Since 1.3?
{
Functions["draw_enable_swf_aa"] = new FunctionInfo(this, 1);
@@ -1093,6 +1104,12 @@ public void Initialize(UndertaleData data)
Functions["array_equals"] = new FunctionInfo(this, 2);
Functions["array_create"] = new FunctionInfo(this, -1);
Functions["array_copy"] = new FunctionInfo(this, 5);
+ if (data?.GMS2_3 == true)
+ {
+ Functions["method"] = new FunctionInfo(this, 2);
+ Functions["method_get_self"] = new FunctionInfo(this, 1);
+ Functions["method_get_index"] = new FunctionInfo(this, 1);
+ }
Functions["typeof"] = new FunctionInfo(this, 1);
Functions["variable_global_exists"] = new FunctionInfo(this, 1);
Functions["variable_global_get"] = new FunctionInfo(this, 1);
diff --git a/UndertaleModTool/Resources/GML.xshd b/UndertaleModTool/Resources/GML.xshd
index 5dc13d3c0..c1ecc1407 100644
--- a/UndertaleModTool/Resources/GML.xshd
+++ b/UndertaleModTool/Resources/GML.xshd
@@ -59,6 +59,7 @@
then
mod
div
+ @@this@@