From 2650fafad8ac8c9526b6bdc5d171d80ee1a661ff Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Sun, 30 Apr 2023 15:14:38 +0100 Subject: [PATCH 1/2] GML parser can now read asset names as tokens --- .../SnapBufferReadGML/SnapBufferReadGML.gml | 43 +++++++++++++++++-- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/scripts/SnapBufferReadGML/SnapBufferReadGML.gml b/scripts/SnapBufferReadGML/SnapBufferReadGML.gml index 71f0a7b..986dae2 100644 --- a/scripts/SnapBufferReadGML/SnapBufferReadGML.gml +++ b/scripts/SnapBufferReadGML/SnapBufferReadGML.gml @@ -126,7 +126,15 @@ function __SnapBufferReadGMLParser(_buffer, _buffer_size) constructor } else { - show_error("SNAP:\n\nLine " + string(line) + ", unexpected token " + string(token) + "\nis_string = " + string(token_is_string) + "\nis_real = " + string(token_is_real) + "\nis_symbol = " + string(token_is_symbol) + "\n ", true); + var _asset_index = try_to_find_asset_index(token); + if (_asset_index >= 0) + { + token = _asset_index; + } + else + { + show_error("SNAP:\n\nLine " + string(line) + ", unexpected token " + string(token) + "\nis_string = " + string(token_is_string) + "\nis_real = " + string(token_is_real) + "\nis_symbol = " + string(token_is_symbol) + "\n ", true); + } } } @@ -216,7 +224,15 @@ function __SnapBufferReadGMLParser(_buffer, _buffer_size) constructor } else { - show_error("SNAP:\n\nLine " + string(line) + ", unexpected token " + string(token) + "\nis_string = " + string(token_is_string) + "\nis_real = " + string(token_is_real) + "\nis_symbol = " + string(token_is_symbol) + "\n ", true); + var _asset_index = try_to_find_asset_index(token); + if (_asset_index >= 0) + { + token = _asset_index; + } + else + { + show_error("SNAP:\n\nLine " + string(line) + ", unexpected token " + string(token) + "\nis_string = " + string(token_is_string) + "\nis_real = " + string(token_is_real) + "\nis_symbol = " + string(token_is_symbol) + "\n ", true); + } } } @@ -355,7 +371,15 @@ function __SnapBufferReadGMLParser(_buffer, _buffer_size) constructor } else { - show_error("SNAP:\n\nLine " + string(line) + ", unexpected token " + string(token) + "\nis_string = " + string(token_is_string) + "\nis_real = " + string(token_is_real) + "\nis_symbol = " + string(token_is_symbol) + "\n ", true); + var _asset_index = try_to_find_asset_index(token); + if (_asset_index >= 0) + { + token = _asset_index; + } + else + { + show_error("SNAP:\n\nLine " + string(line) + ", unexpected token " + string(token) + "\nis_string = " + string(token_is_string) + "\nis_real = " + string(token_is_real) + "\nis_symbol = " + string(token_is_symbol) + "\n ", true); + } } } @@ -469,5 +493,18 @@ function __SnapBufferReadGMLParser(_buffer, _buffer_size) constructor } } + static try_to_find_asset_index = function(_asset) + { + static _constantStruct = __DynamoGMLConstants(); + + if (!is_string(_asset)) return _asset; + + var _index = asset_get_index(_asset); + if (_index >= 0) return _index; + + if (!variable_struct_exists(_constantStruct, _asset)) return -1; + return _constantStruct[$ _asset]; + } + read_root(); } \ No newline at end of file From aa4ffbc8ce24d285db0f15675b3520eeec029e9f Mon Sep 17 00:00:00 2001 From: Juju Adams Date: Sun, 30 Apr 2023 15:15:53 +0100 Subject: [PATCH 2/2] 5.8.1 --- README.md | 2 +- options/windows/options_windows.yy | 2 +- scripts/__SnapSystem/__SnapSystem.gml | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3fe7470..5ae7566 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -

SNAP 5.8.0

+

SNAP 5.8.1

Data format converters for GameMaker Studio 2022 LTS by @jujuadams

diff --git a/options/windows/options_windows.yy b/options/windows/options_windows.yy index 3a642f8..77f33fc 100644 --- a/options/windows/options_windows.yy +++ b/options/windows/options_windows.yy @@ -4,7 +4,7 @@ "name": "Windows", "option_windows_display_name": "SNAP", "option_windows_executable_name": "${project_name}.exe", - "option_windows_version": "5.8.0.0", + "option_windows_version": "5.8.1.0", "option_windows_company_info": "@jujuadams", "option_windows_product_info": "SNAP", "option_windows_copyright_info": "@jujuadams 2023", diff --git a/scripts/__SnapSystem/__SnapSystem.gml b/scripts/__SnapSystem/__SnapSystem.gml index 4224e45..4ad4e24 100644 --- a/scripts/__SnapSystem/__SnapSystem.gml +++ b/scripts/__SnapSystem/__SnapSystem.gml @@ -1,4 +1,4 @@ -#macro __SNAP_VERSION "5.8.0" -#macro __SNAP_DATE "2023-04-27" +#macro __SNAP_VERSION "5.8.1" +#macro __SNAP_DATE "2023-04-30" show_debug_message("SNAP: Welcome to SNAP by @jujuadams! This is version " + __SNAP_VERSION + ", " + __SNAP_DATE); \ No newline at end of file