1.14.7.1 patch

This commit is contained in:
Tanasart 2023-07-29 10:10:48 +02:00
parent dd9cb05c96
commit cfbcdd393a
8 changed files with 127 additions and 54 deletions

View file

@ -57,12 +57,17 @@ function array_safe_get(arr, index, def = 0, overflow = ARRAY_OVERFLOW._default)
}
function array_push_create(arr, val) {
gml_pragma("forceinline");
if(!is_array(arr)) return [ val ];
array_push(arr, val);
return arr;
}
function array_get_decimal(arr, index, color = false) {
gml_pragma("forceinline");
if(!is_array(arr)) return 0;
if(frac(index) == 0) return array_safe_get(arr, index);
var v0 = array_safe_get(arr, floor(index));
@ -77,6 +82,7 @@ function array_exists(arr, val) {
gml_pragma("forceinline");
self.__temp_val = val;
if(!is_array(arr)) return false;
return array_any(arr, function(_val, _ind) {
return isEqual(_val, self.__temp_val);
});
@ -84,53 +90,70 @@ function array_exists(arr, val) {
function array_empty(arr) {
gml_pragma("forceinline");
return array_length(arr) == 0;
return is_array(arr) && array_length(arr) == 0;
}
function array_find(arr, val) {
gml_pragma("forceinline");
self.__temp_val = val;
if(!is_array(arr)) return -1;
return array_find_index(arr, function(_val, _ind) {
return isEqual(_val, self.__temp_val);
});
}
function array_remove(arr, val) {
gml_pragma("forceinline");
if(!is_array(arr)) return;
if(!array_exists(arr, val)) return;
var ind = array_find(arr, val);
array_delete(arr, ind, 1);
}
function array_push_unique(arr, val) {
gml_pragma("forceinline");
if(!is_array(arr)) return;
if(array_exists(arr, val)) return;
array_push(arr, val);
}
function array_insert_unique(arr, ind, val) {
gml_pragma("forceinline");
if(!is_array(arr)) return;
if(array_exists(arr, val)) return;
array_insert(arr, ind, val);
}
function array_append(arr, arr0) {
gml_pragma("forceinline");
if(!is_array(arr)) return arr;
if(!is_array(arr0)) return arr;
for( var i = 0, n = array_length(arr0); i < n; i++ )
array_push(arr, arr0[i]);
return arr;
}
function array_merge() {
gml_pragma("forceinline");
var arr = [];
for( var i = 0; i < argument_count; i++ ) {
for( var i = 0; i < argument_count; i++ )
array_append(arr, argument[i]);
}
return arr;
}
function array_clone(arr) {
if(!is_array(arr))
return arr;
gml_pragma("forceinline");
if(!is_array(arr)) return arr;
var _res = [];
for( var i = 0, n = array_length(arr); i < n; i++ )
@ -139,24 +162,30 @@ function array_clone(arr) {
}
function array_min(arr) {
if(array_length(arr) == 0) return 0;
gml_pragma("forceinline");
if(!is_array(arr) || array_length(arr) == 0) return 0;
var mn = arr[0];
for( var i = 0, n = array_length(arr); i < n; i++ )
mn = min(mn, arr[i]);
return mn;
for( var i = 0, n = array_length(arr); i < n; i++ )
mn = min(mn, arr[i]);
return mn;
}
function array_max(arr) {
if(array_length(arr) == 0) return 0;
gml_pragma("forceinline");
if(!is_array(arr) || array_length(arr) == 0) return 0;
var mx = arr[0];
for( var i = 0, n = array_length(arr); i < n; i++ )
mx = max(mx, arr[i]);
return mx;
for( var i = 0, n = array_length(arr); i < n; i++ )
mx = max(mx, arr[i]);
return mx;
}
function array_get_dimension(arr) {
gml_pragma("forceinline");
return is_array(arr)? array_length(arr) : 1;
}

View file

@ -5,10 +5,10 @@ function buffer_get_color(buffer, _x, _y, w, h) {
return c;
}
function buffer_get_string(buffer, text = true) {
function buffer_get_string(buffer, text = true, limit = 400) {
buffer_seek(buffer, buffer_seek_start, 0);
var len = buffer_get_size(buffer);
var ss = "";
var len = min(limit, buffer_get_size(buffer));
var ss = "";
for (var i = 0; i < len; i++) {
var _r = buffer_read(buffer, buffer_u8);

View file

@ -163,7 +163,7 @@ function draw_tooltip_atlas(atlas) {
}
function draw_tooltip_buffer(buff) {
var txt = buffer_get_string(buff, false);
var txt = buffer_get_string(buff, false, 400);
var len = string_length(txt);
if(len > 400) txt = string_copy(txt, 1, 400);

View file

@ -92,10 +92,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
VERSION = 11470;
VERSION = 11471;
SAVE_VERSION = 11470;
VERSION_STRING = "1.14.7";
BUILD_NUMBER = 11470;
VERSION_STRING = "1.14.7.1";
BUILD_NUMBER = 11471;
globalvar APPEND_MAP;
APPEND_MAP = ds_map_create();
@ -233,6 +233,4 @@
#region debug
global.FLAG = {};
global.FLAG.expression_debug = false;
#endregion

View file

@ -112,11 +112,11 @@ function Node_Canvas(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
var _dim = inputs[| 0].getValue();
var cDep = attrDepth();
if(!is_surface(canvas_surface))
if(!is_surface(canvas_surface)) {
canvas_surface = surface_create_from_buffer(_dim[0], _dim[1], canvas_buffer);
else if(surface_get_width(canvas_surface) != _dim[0] || surface_get_height(canvas_surface) != _dim[1]) {
} else if(surface_get_width(canvas_surface) != _dim[0] || surface_get_height(canvas_surface) != _dim[1]) {
buffer_delete(canvas_buffer);
canvas_buffer = buffer_create(_dim[0] * _dim[1] * 4, buffer_fixed, 4);
canvas_buffer = buffer_create(_dim[0] * _dim[1] * 4, buffer_fixed, 4);
canvas_surface = surface_size_to(canvas_surface, _dim[0], _dim[1]);
}

View file

@ -1053,7 +1053,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
cache_value[0] = false;
}
static getValue = function(_time = PROJECT.animator.current_frame, applyUnit = true, arrIndex = 0, useCache = true) {
static getValue = function(_time = PROJECT.animator.current_frame, applyUnit = true, arrIndex = 0, useCache = false) {
if(type == VALUE_TYPE.trigger)
useCache = false;
@ -1064,6 +1064,7 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
cache_hit &= cache_value[2] != undefined;
cache_hit &= connect_type == JUNCTION_CONNECT.input;
cache_hit &= unit.reference == noone || unit.mode == VALUE_UNIT.constant;
cache_hit &= !expUse;
if(cache_hit) {
global.cache_hit++;
@ -1161,10 +1162,11 @@ function NodeValue(_name, _node, _connect, _type, _value, _tooltip = "") constru
//print($"========== EXPRESSION CALLED ==========");
//print(debug_get_callstack(8));
//printIf(global.FLAG.expression_debug, "==================== EVAL BEGIN ====================");
if(global.EVALUATE_HEAD != noone && global.EVALUATE_HEAD == self) {
//noti_warning($"Expression evaluation error : recursive call detected.");
} else {
printIf(global.LOG_EXPRESSION, "==================== EVAL BEGIN {expTree} ====================");
global.EVALUATE_HEAD = self;
var params = {
name: name,

View file

@ -1,4 +1,6 @@
#region data
global.LOG_EXPRESSION = false;
global.EVALUATE_HEAD = noone;
global.EQUATION_PRES = ds_map_create();
@ -162,7 +164,7 @@ function functionStringClean(fx) {
if(condition == noone) return 0;
var res = condition.eval(params);
printIf(global.FLAG.expression_debug, $"<<<<<< IF {res} >>>>>>");
printIf(global.LOG_EXPRESSION, $"<<<<<< IF {res} >>>>>>");
if(res) return if_true == noone? 0 : if_true.eval(params);
else return if_false == noone? 0 : if_false.eval(params);
@ -210,16 +212,16 @@ function functionStringClean(fx) {
static eval = function(params = {}) {
if(itr_array) {
var _arr = cond_arr.eval(params);
printIf(global.FLAG.expression_debug, $"<<<<<< FOR EACH {_arr} >>>>>>");
printIf(global.LOG_EXPRESSION, $"<<<<<< FOR EACH {_arr} >>>>>>");
for( var i = 0, n = array_length(_arr); i < n; i++ ) {
var val = _arr[i];
params[$ cond_iter] = val;
printIf(global.FLAG.expression_debug, $"<< ITER {i}: {cond_iter} = {val} >>");
printIf(global.LOG_EXPRESSION, $"<< ITER {i}: {cond_iter} = {val} >>");
action.eval(params);
}
} else {
printIf(global.FLAG.expression_debug, "<< FOR >>");
printIf(global.LOG_EXPRESSION, "<< FOR >>");
cond_init.eval(params);
while(cond_term.eval(params)) {
@ -252,7 +254,7 @@ function functionStringClean(fx) {
if(is_string(val)) val = string_trim(val);
//printIf(global.FLAG.expression_debug, $" [ get struct {params}[{val}] ]");
//printIf(global.LOG_EXPRESSION, $" [ get struct {params}[{val}] ]");
if(struct_has(params, val))
return struct_try_get(params, val);
@ -337,8 +339,8 @@ function functionStringClean(fx) {
_l[i] = getVal(l[i], params);
var res = _ev(_l);
printIf(global.FLAG.expression_debug, $"Function {symbol}{_l} = {res}");
printIf(global.FLAG.expression_debug, "====================");
printIf(global.LOG_EXPRESSION, $"Function {symbol}{_l} = {res}");
printIf(global.LOG_EXPRESSION, "====================");
return res;
}
@ -382,11 +384,11 @@ function functionStringClean(fx) {
} else
res = eval_real(v1, v2);
printIf(global.FLAG.expression_debug, $"|{v1}|{symbol}|{v2}| = {res}");
printIf(global.FLAG.expression_debug, $"symbol : {symbol}");
printIf(global.FLAG.expression_debug, $"l : | {typeof(l)} |{l}|");
printIf(global.FLAG.expression_debug, $"r : | {typeof(r)} |{r}|");
printIf(global.FLAG.expression_debug, "====================");
printIf(global.LOG_EXPRESSION, $"|{v1}|{symbol}|{v2}| = {res}");
printIf(global.LOG_EXPRESSION, $"symbol : {symbol}");
printIf(global.LOG_EXPRESSION, $"l : | {typeof(l)} |{l}|");
printIf(global.LOG_EXPRESSION, $"r : | {typeof(r)} |{r}|");
printIf(global.LOG_EXPRESSION, "====================");
return res;
}
@ -535,7 +537,7 @@ function functionStringClean(fx) {
var _ch = "";
var in_str = false;
printIf(global.FLAG.expression_debug, $"===== Evaluating function: {fx} =====");
printIf(global.LOG_EXPRESSION, $"===== Evaluating function: {fx} =====");
while(l <= len) {
ch = string_char_at(fx, l);
@ -668,8 +670,8 @@ function functionStringClean(fx) {
if(!is_struct(tree))
tree = new __funcTree("", tree);
//print(tree);
//print("");
printIf(global.LOG_EXPRESSION, tree);
printIf(global.LOG_EXPRESSION, "");
return tree;
}

View file

@ -1,5 +1,7 @@
//draw
function draw_surface_safe(surface, _x = 0, _y = 0) {
gml_pragma("forceinline");
if(!is_surface(surface)) return;
__channel_pre(surface);
@ -7,6 +9,8 @@ function draw_surface_safe(surface, _x = 0, _y = 0) {
__channel_pos(surface);
}
function draw_surface_stretched_safe(surface, _x, _y, _w, _h) {
gml_pragma("forceinline");
if(!is_surface(surface)) return;
__channel_pre(surface);
@ -14,6 +18,8 @@ function draw_surface_stretched_safe(surface, _x, _y, _w, _h) {
__channel_pos(surface);
}
function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) {
gml_pragma("forceinline");
if(!is_surface(surface)) return;
__channel_pre(surface);
@ -21,6 +27,8 @@ function draw_surface_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col
__channel_pos(surface);
}
function draw_surface_tiled_safe(surface, _x, _y) {
gml_pragma("forceinline");
if(!is_surface(surface)) return;
__channel_pre(surface);
@ -28,6 +36,8 @@ function draw_surface_tiled_safe(surface, _x, _y) {
__channel_pos(surface);
}
function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c_white, _alpha = 1) {
gml_pragma("forceinline");
if(!is_surface(surface)) return;
__channel_pre(surface);
@ -35,6 +45,8 @@ function draw_surface_tiled_ext_safe(surface, _x, _y, _xs = 1, _ys = 1, _col = c
__channel_pos(surface);
}
function draw_surface_part_ext_safe(surface, _l, _t, _w, _h, _x, _y, _xs = 1, _ys = 1, _rot = 0, _col = c_white, _alpha = 1) {
gml_pragma("forceinline");
if(!is_surface(surface)) return;
__channel_pre(surface);
@ -46,6 +58,8 @@ function draw_surface_part_ext_safe(surface, _l, _t, _w, _h, _x, _y, _xs = 1, _y
#macro __surface_free surface_free
function surface_free_safe(surface) {
gml_pragma("forceinline");
if(!is_surface(surface)) return;
__surface_free(surface);
}
@ -123,6 +137,8 @@ function surface_verify(surf, w, h, format = surface_rgba8unorm) {
//get
function surface_get_pixel(surface, _x, _y) {
gml_pragma("forceinline");
if(!is_surface(surface)) return;
var f = surface_get_format(surface);
var px = surface_getpixel(surface, _x, _y);
@ -132,6 +148,8 @@ function surface_get_pixel(surface, _x, _y) {
}
function surface_get_pixel_ext(surface, _x, _y) {
gml_pragma("forceinline");
if(!is_surface(surface)) return;
var f = surface_get_format(surface);
var px = surface_getpixel_ext(surface, _x, _y);
@ -141,29 +159,29 @@ function surface_get_pixel_ext(surface, _x, _y) {
}
//create
function surface_create_empty(w, h) {
var s = surface_create(w, h);
function surface_create_empty(w, h, format = surface_rgba8unorm) {
gml_pragma("forceinline");
var s = surface_create(w, h, format);
surface_clear(s);
return s;
}
function surface_create_size(surface, format = surface_rgba8unorm) {
var s = surface_create_valid(surface_get_width(surface), surface_get_height(surface), format);
surface_set_target(s);
DRAW_CLEAR
surface_reset_target();
return s;
gml_pragma("forceinline");
return surface_create_valid(surface_get_width(surface), surface_get_height(surface), format);
}
function surface_create_valid(w, h, format = surface_rgba8unorm) {
var s = surface_create(surface_valid_size(w), surface_valid_size(h), format);
surface_set_target(s);
DRAW_CLEAR
surface_reset_target();
return s;
gml_pragma("forceinline");
return surface_create_empty(surface_valid_size(w), surface_valid_size(h), format);
}
function surface_create_from_buffer(w, h, buff, format = surface_rgba8unorm) {
gml_pragma("forceinline");
if(buff < 0) return;
var s = surface_create_valid(surface_valid_size(w), surface_valid_size(h), format);
buffer_set_surface(buff, s, 0);
@ -252,10 +270,14 @@ function surface_size_to(surface, width, height, format = noone) {
if(ww == width && hh == height) return surface;
surface_resize(surface, width, height);
surface_clear(surface);
return surface;
}
function surface_clear(surface) {
gml_pragma("forceinline");
if(!is_surface(surface)) return;
surface_set_target(surface);
DRAW_CLEAR
@ -263,6 +285,8 @@ function surface_clear(surface) {
}
function surface_copy_from(dst, src, format = noone) {
gml_pragma("forceinline");
surface_set_target(dst);
DRAW_CLEAR
BLEND_OVERRIDE;
@ -272,6 +296,8 @@ function surface_copy_from(dst, src, format = noone) {
}
function surface_clone(surface, source = noone, format = noone) {
gml_pragma("forceinline");
if(!is_surface(surface)) return noone;
source = surface_verify(source, surface_get_width(surface), surface_get_height(surface), format == noone? surface_get_format(surface) : format);
@ -288,6 +314,8 @@ function surface_clone(surface, source = noone, format = noone) {
//in-place modification
function surface_stretch(surf, _w, _h) {
gml_pragma("forceinline");
if(!is_surface(surf)) return noone;
_w = surface_valid_size(_w);
@ -304,6 +332,8 @@ function surface_stretch(surf, _w, _h) {
}
function surface_mirror(surf, _h, _v) {
gml_pragma("forceinline");
if(!is_surface(surf)) return noone;
var _surf = surface_create_size(surf);
@ -322,6 +352,8 @@ function surface_mirror(surf, _h, _v) {
//others
function surface_copy_size(dest, source, format = noone) {
gml_pragma("forceinline");
if(!is_surface(dest)) return;
if(!is_surface(source)) return;
@ -334,6 +366,8 @@ function surface_copy_size(dest, source, format = noone) {
}
function surface_valid_size(s) {
gml_pragma("forceinline");
if(is_infinity(s)) return 1;
s = toNumber(s);
if(!is_real(s)) return 1;
@ -341,6 +375,8 @@ function surface_valid_size(s) {
}
function surface_array_free(arr) {
gml_pragma("forceinline");
if(!is_array(arr)) {
if(is_surface(arr)) surface_free(arr);
return;
@ -367,6 +403,8 @@ function surface_array_clone(arr) {
}
function surface_array_serialize(arr) {
gml_pragma("forceinline");
var _arr = __surface_array_serialize(arr);
return json_stringify(_arr);
}
@ -393,6 +431,8 @@ function __surface_array_serialize(arr) {
}
function surface_array_deserialize(arr, index = -1) {
gml_pragma("forceinline");
var _arr = json_try_parse(arr);
return index == -1? __surface_array_deserialize(_arr) : __surface_array_deserialize(_arr[index]);
}
@ -448,6 +488,8 @@ function surface_format_get_bytes(format) {
}
function surface_get_size(surface) {
gml_pragma("forceinline");
var sw = surface_get_width(surface);
var sh = surface_get_height(surface);
var sz = sw * sh * surface_format_get_bytes(surface_get_format(surface));