From f2f69b1b0332b7e6291fe1466b6d87364949ee21 Mon Sep 17 00:00:00 2001 From: Tanasart Date: Sun, 5 Nov 2023 10:19:19 +0700 Subject: [PATCH] Fix restart buton not working. --- objects/o_crash_handler/Draw_64.gml | 2 ++ objects/o_main/Create_0.gml | 3 +-- objects/o_main/Other_2.gml | 7 ++---- objects/o_main/Step_1.gml | 1 + scripts/debug/debug.gml | 1 + scripts/node_cache/node_cache.gml | 2 ++ scripts/node_cache_array/node_cache_array.gml | 2 ++ scripts/node_cache_base/node_cache_base.gml | 22 ++++++++++++------- scripts/node_data/node_data.gml | 2 +- shaders/sh_find_boundary/sh_find_boundary.fsh | 8 +++---- 10 files changed, 30 insertions(+), 20 deletions(-) diff --git a/objects/o_crash_handler/Draw_64.gml b/objects/o_crash_handler/Draw_64.gml index 392a8150a..5f5a0d785 100644 --- a/objects/o_crash_handler/Draw_64.gml +++ b/objects/o_crash_handler/Draw_64.gml @@ -127,6 +127,8 @@ draw_sprite_ext(s_noti_icon_error, 0, 18, 18, 0.5, 0.5, 0, c_white, 1); if(point_in_rectangle(mouse_mx, mouse_my, bx0, by0, bx0 + bw, by0 + bh)) { if(mouse_check_button_pressed(mb_left)) { + EnvironmentUnsetVariable("process_id"); + var path = executable_get_pathname(); shell_execute_async(path, "--crashed"); } diff --git a/objects/o_main/Create_0.gml b/objects/o_main/Create_0.gml index 895db41f7..69e82124b 100644 --- a/objects/o_main/Create_0.gml +++ b/objects/o_main/Create_0.gml @@ -2,8 +2,7 @@ #region log var path = "log_temp.txt"; var f = file_text_open_append(path); - var t = _log_template(); - file_text_write_string(f, "[MESSAGE] " + t + "session begin" + "\n"); + file_text_write_string(f, $"[MESSAGE] {_log_template()}session begin\n"); file_text_close(f); gpu_set_tex_mip_enable(mip_off); diff --git a/objects/o_main/Other_2.gml b/objects/o_main/Other_2.gml index 504e91b4b..76a5f80b6 100644 --- a/objects/o_main/Other_2.gml +++ b/objects/o_main/Other_2.gml @@ -41,8 +41,8 @@ PRESIST_PREF.path = DIRECTORY; json_save_struct(perstPath, PRESIST_PREF); - directory_verify(DIRECTORY); + directory_set_current_working(DIRECTORY); METADATA = __getdefaultMetaData(); #endregion @@ -105,8 +105,7 @@ if(parameter_count() > 1) { var path = parameter_string(1); if(path == "--crashed") { - if(PREFERENCES.show_crash_dialog) - dialogCall(o_dialog_crashed); + if(PREFERENCES.show_crash_dialog) dialogCall(o_dialog_crashed); } else { path = string_replace_all(path, "\n", ""); path = string_replace_all(path, "\"", ""); @@ -114,8 +113,6 @@ if(file_exists(path) && filename_ext(path) == ".pxc") { file_open_parameter = path; alarm[2] = 3; - - directory_set_current_working(DIRECTORY); } } } diff --git a/objects/o_main/Step_1.gml b/objects/o_main/Step_1.gml index 31cd02c4e..d9604fb51 100644 --- a/objects/o_main/Step_1.gml +++ b/objects/o_main/Step_1.gml @@ -26,6 +26,7 @@ _HOVERING_ELEMENT = noone; window_set_cursor(CURSOR); _cursor = CURSOR; } + CURSOR = cr_default; if(!gameframe_is_minimized() && (win_wp != WIN_W || win_hp != WIN_H) && (WIN_W > 1 && WIN_H > 1)) { diff --git a/scripts/debug/debug.gml b/scripts/debug/debug.gml index d3cfb083b..826f6a08d 100644 --- a/scripts/debug/debug.gml +++ b/scripts/debug/debug.gml @@ -12,6 +12,7 @@ #endregion function _log_template() { + gml_pragma("forceinline"); return $"{current_year}/{current_month}/{current_day} {string_lead_zero(current_hour, 2)}:{string_lead_zero(current_minute, 2)}:{string_lead_zero(current_second, 2)} > "; } diff --git a/scripts/node_cache/node_cache.gml b/scripts/node_cache/node_cache.gml index 7bc1346c6..4e5de3eaf 100644 --- a/scripts/node_cache/node_cache.gml +++ b/scripts/node_cache/node_cache.gml @@ -52,6 +52,8 @@ function Node_Cache(_x, _y, _group = noone) : __Node_Cache(_x, _y, _group) const } #endregion static postDeserialize = function() { #region + refreshCacheGroup(); + if(!struct_has(load_map, "cache")) return; cache_content = json_try_parse(load_map.cache); cache_loading_progress = 0; diff --git a/scripts/node_cache_array/node_cache_array.gml b/scripts/node_cache_array/node_cache_array.gml index ec63576e3..cb44dcfea 100644 --- a/scripts/node_cache_array/node_cache_array.gml +++ b/scripts/node_cache_array/node_cache_array.gml @@ -76,6 +76,8 @@ function Node_Cache_Array(_x, _y, _group = noone) : __Node_Cache(_x, _y, _group) } #endregion static postDeserialize = function() { #region + refreshCacheGroup(); + if(!struct_has(load_map, "cache")) return; cache_content = json_try_parse(load_map.cache); cache_loading_progress = 0; diff --git a/scripts/node_cache_base/node_cache_base.gml b/scripts/node_cache_base/node_cache_base.gml index 96045761e..956a43437 100644 --- a/scripts/node_cache_base/node_cache_base.gml +++ b/scripts/node_cache_base/node_cache_base.gml @@ -30,22 +30,33 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor } #endregion static enableNodeGroup = function() { #region + if(LOADING || APPENDING) return; + for( var i = 0, n = array_length(cache_group_members); i < n; i++ ) cache_group_members[i].renderActive = true; clearCache(true); } #endregion static disableNodeGroup = function() { #region + if(LOADING || APPENDING) return; + if(IS_PLAYING && CURRENT_FRAME == TOTAL_FRAMES - 1) for( var i = 0, n = array_length(cache_group_members); i < n; i++ ) cache_group_members[i].renderActive = false; } #endregion static refreshCacheGroup = function() { #region - cache_group_members = array_create(array_length(attributes.cache_group)); + cache_group_members = []; + for( var i = 0, n = array_length(attributes.cache_group); i < n; i++ ) { - cache_group_members[i] = PROJECT.nodeMap[? attributes.cache_group[i]]; - cache_group_members[i].cache_group = self; + if(!ds_map_exists(PROJECT.nodeMap, attributes.cache_group[i])) { + print($"Node not found {attributes.cache_group[i]}"); + continue; + } + + var _node = PROJECT.nodeMap[? attributes.cache_group[i]]; + array_push(cache_group_members, _node); + _node.cache_group = self; } } #endregion @@ -226,9 +237,4 @@ function __Node_Cache(_x, _y, _group = noone) : Node(_x, _y, _group) constructor draw_set_alpha(1); } #endregion - - static attributeDeserialize = function(attr) { #region - struct_override(attributes, attr); - refreshCacheGroup(); - } #endregion } \ No newline at end of file diff --git a/scripts/node_data/node_data.gml b/scripts/node_data/node_data.gml index 83c7b8e02..b88826fed 100644 --- a/scripts/node_data/node_data.gml +++ b/scripts/node_data/node_data.gml @@ -1681,7 +1681,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x else node_id = load_map.id; PROJECT.nodeMap[? node_id] = self; - //print($"D Adding node {node_id} to {PROJECT.path} [{ds_map_size(PROJECT.nodeMap)}]"); + //print($"Adding node {node_id} to {PROJECT.path} [{ds_map_size(PROJECT.nodeMap)}]"); if(struct_has(load_map, "name")) setDisplayName(load_map.name); diff --git a/shaders/sh_find_boundary/sh_find_boundary.fsh b/shaders/sh_find_boundary/sh_find_boundary.fsh index 765896f17..7aeb74f9e 100644 --- a/shaders/sh_find_boundary/sh_find_boundary.fsh +++ b/shaders/sh_find_boundary/sh_find_boundary.fsh @@ -20,7 +20,7 @@ void main() { for( i = 0.; i < _w; i++ ) for( j = 0.; j < _h; j++ ) { col = texture2D( texture, vec2(i, j) / dimension); - if(col.r > 0.) { + if(col.a > 0.) { gl_FragColor = vec4(i); return; } @@ -29,7 +29,7 @@ void main() { for( i = 0.; i < _h; i++ ) for( j = bbox.x; j < _w; j++ ) { col = texture2D( texture, vec2(j, i) / dimension); - if(col.r > 0.) { + if(col.a > 0.) { gl_FragColor = vec4(i); return; } @@ -38,7 +38,7 @@ void main() { for( i = _w; i >= bbox.x; i-- ) for( j = bbox.y; j < _h; j++ ) { col = texture2D( texture, vec2(i, j) / dimension); - if(col.r > 0.) { + if(col.a > 0.) { gl_FragColor = vec4(i); return; } @@ -47,7 +47,7 @@ void main() { for( i = _h; i >= bbox.y; i-- ) for( j = bbox.x; j <= bbox.z; j++ ) { col = texture2D( texture, vec2(j, i) / dimension); - if(col.r > 0.) { + if(col.a > 0.) { gl_FragColor = vec4(i); return; }