- [Line] Fix line error when inverted in fix length mode.

This commit is contained in:
Tanasart 2023-11-19 15:05:42 +07:00
parent 0b28909dc0
commit 538e206cfb
26 changed files with 29002 additions and 24905 deletions

Binary file not shown.

File diff suppressed because it is too large Load diff

View file

@ -337,5 +337,11 @@
"points": "Points",
"text_area": "Text Area",
"safe_mode": "SAFE MODE",
"read_only": "READ ONLY",
"untitled": "Untitled",
"supporter": "Supporter",
"supporter_exclusive": "Supporter exclusive",
"" : ""
}

File diff suppressed because it is too large Load diff

View file

@ -298,7 +298,7 @@ event_inherited();
if(i == ADD_NODE_PAGE) draw_set_text(f_p0b, fa_left, fa_center, COLORS._main_text_accent);
else draw_set_text(f_p0, fa_left, fa_center, COLORS._main_text_inner);
var _is_extra = name == "Extra";
var _is_extra = name == "Supporter";
name = __txt(name);
var _tx = ui(8);

View file

@ -78,10 +78,8 @@ if(OS == os_windows && gameframe_is_minimized()) exit;
break;
default :
var tt = "";
if(is_struct(content))
tt = $"[{instanceof(content)}] {content}";
else
tt = string(content);
if(is_struct(content)) tt = $"[{instanceof(content)}] {content}";
else tt = string(content);
draw_tooltip_text(tt);
}

View file

@ -2,7 +2,7 @@
//print("===== Game Start Begin =====");
#region directory
globalvar DIRECTORY, APP_DIRECTORY, PRESIST_PREF;
globalvar DIRECTORY, APP_DIRECTORY, APP_LOCATION, PRESIST_PREF;
DIRECTORY = "";
PRESIST_PREF = {};
@ -45,7 +45,7 @@
//directory_set_current_working(DIRECTORY);
METADATA = __getdefaultMetaData();
APP_LOCATION = program_directory;
//print($"===================== WORKING DIRECTORIES =====================\n\t{working_directory}\n\t{DIRECTORY}");
#endregion

View file

@ -8,7 +8,7 @@ function filepath_resolve(path) {
var _path = path;
_path = string_replace_all(_path, "%DIR%/", DIRECTORY);
_path = string_replace_all(_path, "%APP%/", program_directory);
_path = string_replace_all(_path, "%APP%/", APP_LOCATION);
return _path;
}

View file

@ -25,10 +25,10 @@
globalvar VERSION, SAVE_VERSION, VERSION_STRING, BUILD_NUMBER;
VERSION = 11581;
VERSION = 11582;
SAVE_VERSION = 11570;
VERSION_STRING = "1.16rc1";
BUILD_NUMBER = 11581;
VERSION_STRING = "1.16rc2";
BUILD_NUMBER = 11582;
globalvar APPEND_MAP;
APPEND_MAP = ds_map_create();

View file

@ -1,10 +1,10 @@
#region locale
globalvar LOCALE, TEST_LOCALE, LOCALE_USE_DEFAULT;
LOCALE = {}
globalvar LOCALE, TEST_LOCALE, LOCALE_DEF;
LOCALE = {}
TEST_LOCALE = false;
LOCALE_USE_DEFAULT = true;
LOCALE_DEF = true;
function __initLocale() {
function __initLocale() { #region
var lfile = $"data/locale/en.zip";
var root = $"{DIRECTORY}Locale";
@ -13,16 +13,16 @@
zip_unzip(lfile, root);
loadLocale();
}
} #endregion
function __locale_file(file) {
function __locale_file(file) { #region
var dirr = $"{DIRECTORY}Locale/{PREFERENCES.local}";
if(!directory_exists(dirr) || !file_exists(dirr + file))
dirr = $"{DIRECTORY}Locale/en";
return dirr + file;
}
} #endregion
function loadLocale() {
function loadLocale() { #region
LOCALE.word = json_load_struct(__locale_file("/words.json"));
LOCALE.ui = json_load_struct(__locale_file("/UI.json"));
LOCALE.node = json_load_struct(__locale_file("/nodes.json"));
@ -32,9 +32,9 @@
LOCALE.fontDir = directory_exists(fontDir)? fontDir : noone;
print("FONT DIR: " + fontDir);
}
} #endregion
function __txtx(key, def = "") {
function __txtx(key, def = "") { #region
INLINE
if(key == "") return "";
@ -46,15 +46,15 @@
return "";
}
if(LOCALE_USE_DEFAULT) return def;
if(LOCALE_DEF) return def;
if(struct_has(LOCALE.word, key)) return LOCALE.word[$ key];
if(struct_has(LOCALE.ui, key)) return LOCALE.ui[$ key];
return def;
}
} #endregion
function __txt(txt, prefix = "") {
function __txt(txt, prefix = "") { #region
INLINE
if(txt == "") return "";
@ -68,46 +68,68 @@
}
return "";
}
if(LOCALE_USE_DEFAULT) return txt;
if(LOCALE_DEF) return txt;
return __txtx(prefix + key, txt);
}
} #endregion
function __txta(txt) {
function __txta(txt) { #region
var _txt = __txt(txt);
for(var i = 1; i < argument_count; i++)
_txt = string_replace_all(_txt, "{" + string(i) + "}", string(argument[i]));
return _txt;
}
} #endregion
function __txt_node_name(node, def = "") {
function __txt_node_name(node, def = "") { #region
INLINE
if(LOCALE_USE_DEFAULT) return def;
if(TEST_LOCALE) {
if(!struct_has(LOCALE.node, node)) {
show_debug_message($"LOCALE [NODE]: \"{node}\": \"{def}\",");
return def;
}
return "";
}
if(LOCALE_DEF) return def;
if(!struct_has(LOCALE.node, node))
return def;
if(TEST_LOCALE) return "";
return def;
}
return LOCALE.node[$ node].name;
} #endregion
function __txt_node_tooltip(node, def = "") {
function __txt_node_tooltip(node, def = "") { #region
INLINE
if(LOCALE_USE_DEFAULT) return def;
if(TEST_LOCALE) {
if(!struct_has(LOCALE.node, node)) {
show_debug_message($"LOCALE [TIP]: \"{node}\": \"{def}\",");
return def;
}
return "";
}
if(LOCALE_DEF) return def;
if(!struct_has(LOCALE.node, node))
return def;
if(TEST_LOCALE) return "";
return LOCALE.node[$ node].tooltip;
}
} #endregion
function __txt_junction_name(node, type, index, def = "") {
function __txt_junction_name(node, type, index, def = "") { #region
INLINE
if(LOCALE_USE_DEFAULT) return def;
if(TEST_LOCALE) {
if(!struct_has(LOCALE.node, node)) {
show_debug_message($"LOCALE [JNAME]: \"{node}\": \"{def}\",");
return def;
}
return "";
}
if(LOCALE_DEF) return def;
if(!struct_has(LOCALE.node, node))
return def;
@ -116,14 +138,21 @@
var lst = type == JUNCTION_CONNECT.input? nde.inputs : nde.outputs;
if(index >= array_length(lst)) return def;
if(TEST_LOCALE) return "";
return lst[index].name;
}
} #endregion
function __txt_junction_tooltip(node, type, index, def = "") {
function __txt_junction_tooltip(node, type, index, def = "") { #region
INLINE
if(LOCALE_USE_DEFAULT) return def;
if(TEST_LOCALE) {
if(!struct_has(LOCALE.node, node)) {
show_debug_message($"LOCALE [JTIP]: \"{node}\": \"{def}\",");
return def;
}
return "";
}
if(LOCALE_DEF) return def;
if(!struct_has(LOCALE.node, node))
return def;
@ -132,14 +161,21 @@
var lst = type == JUNCTION_CONNECT.input? nde.inputs : nde.outputs;
if(index >= array_length(lst)) return def;
if(TEST_LOCALE) return "";
return lst[index].tooltip;
}
} #endregion
function __txt_junction_data(node, type, index, def = []) {
function __txt_junction_data(node, type, index, def = []) { #region
INLINE
return def;
if(TEST_LOCALE) {
if(!struct_has(LOCALE.node, node)) {
show_debug_message($"LOCALE [DDATA]: \"{node}\": \"{def}\",");
return def;
}
return [ "" ];
}
if(LOCALE_DEF) return def;
if(!struct_has(LOCALE.node, node))
return def;
@ -151,7 +187,6 @@
if(!struct_has(lst[index], "display_data"))
return def;
if(TEST_LOCALE) return [ "" ];
return lst[index].display_data;
}
} #endregion
#endregion

View file

@ -72,11 +72,11 @@ function Node_3D_Repeat(_x, _y, _group = noone) : Node_3D(_x, _y, _group) constr
var _Asca = _data[11];
var _inst = _data[12];
if(_mode == 1 && !is_array(_object)) return noone;
var _amo = _mode == 1? array_length(_object) : _data[2];
var _scene = new __3dGroup();
if(_mode == 1 && !is_array(_object)) return _scene;
var _amo = _mode == 1? array_length(_object) : _data[2];
for( var i = 0; i < _amo; i++ ) {
var _obj = _mode == 1? _object[i] : _object;
if(_obj == noone) continue;

View file

@ -60,7 +60,7 @@ function Node_Boolean(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) c
if(!active) return;
if(_s < 0.75) return;
var _name = display_name == ""? name : display_name;
var _name = renamed? display_name : name;
if(_name == "") return;
var hid = getInputData(1);

View file

@ -47,9 +47,9 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
PROJECT.modified = true;
run_in(1, function() {
if(display_name != "") return;
resetInternalName();
display_name = __txt_node_name(instanceof(self), name);
if(!LOCALE_DEF || TESTING) renamed = true;
});
RENDER_ALL_REORDER
@ -392,7 +392,8 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
} #endregion
static getFullName = function() { #region
return display_name == ""? name : "[" + name + "] " + display_name;
INLINE
return renamed? "[" + name + "] " + display_name : name;
} #endregion
static addInput = function(junctionFrom, shift = input_fix_len) { #region
@ -856,7 +857,7 @@ function Node(_x, _y, _group = PANEL_GRAPH.getCurrentContext()) : __Node_Base(_x
if(!active) return;
draw_name = false;
var _name = display_name == ""? name : display_name;
var _name = renamed? display_name : name;
if(_name == "") return;
if(_s < 0.75) return;
draw_name = true;

View file

@ -218,10 +218,10 @@ function Node_Export(_x, _y, _group = noone) : Node(_x, _y, _group) constructor
gifski = filepath_resolve(PREFERENCES.gifski_path) + "win/gifski.exe";
ffmpeg = filepath_resolve(PREFERENCES.ffmpeg_path) + "bin/ffmpeg.exe";
if(!file_exists(converter) || !file_exists(magick)) noti_warning("No ImageMagick deteced, please make sure the installation is complete and ImageMagick path is set properly in preference.");
if(!file_exists(webp)) noti_warning("No webp deteced, please make sure the installation is complete and webp path is set properly in preference.");
if(!file_exists(gifski)) noti_warning("No gifski deteced, please make sure the installation is complete and gifski path is set properly in preference.");
if(!file_exists(ffmpeg)) noti_warning("No ffmpeg deteced, please make sure the installation is complete and ffmpeg path is set properly in preference.");
if(!file_exists(converter) || !file_exists(magick)) noti_warning($"No ImageMagick detected at {magick}, please make sure the installation is complete and ImageMagick path is set properly in preference.");
if(!file_exists(webp)) noti_warning($"No webp detected at {webp}, please make sure the installation is complete and webp path is set properly in preference.");
if(!file_exists(gifski)) noti_warning($"No gifski detected at {gifski}, please make sure the installation is complete and gifski path is set properly in preference.");
if(!file_exists(ffmpeg)) noti_warning($"No ffmpeg detected at {ffmpeg}, please make sure the installation is complete and ffmpeg path is set properly in preference.");
static onValueUpdate = function(_index) { #region
var form = getInputData(3);

View file

@ -58,7 +58,7 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
static drawNodeBase = function(xx, yy, _s) { #region
draw_sprite_stretched_ext(bg_spr, 0, xx, yy, w * _s, h * _s, color, alpha);
var txt = display_name == ""? name : display_name;
var txt = renamed? display_name : name;
hover_progress = lerp_float(hover_progress, name_hover, 2);
@ -126,7 +126,7 @@ function Node_Frame(_x, _y, _group = noone) : Node(_x, _y, _group) constructor {
var xx = x * _s + _x;
var yy = y * _s + _y;
var txt = display_name == ""? name : display_name;
var txt = renamed? display_name : name;
draw_set_font(f_h5);
var ww = string_width(txt) + 24 + 8;
var hh = string_height("l") + 8;

View file

@ -225,6 +225,7 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
var _prog_total = 0; //Record how far the pointer have moved so far
var points = [];
var wght;
var _pathPng;
if(_useDistance) {
_pathStr *= _pathLength;
@ -246,15 +247,17 @@ function Node_Line(_x, _y, _group = noone) : Node_Processor(_x, _y, _group) cons
if(_prog_next == segmentLength)
_segIndex = (_segIndex + 1) % array_length(_segLength);
_pathPng = _ratInv? _pathLength - _prog_curr : _prog_curr;
} else {
if(_prog_curr >= 1) //Wrap overflow path
_prog_next = frac(_prog_curr);
else
_prog_next = min(_prog_curr + _stepLen, 1); //Move forward _stepLen or _total (if less) stop at 1
_pathPng = _ratInv? 1 - _prog_curr : _prog_curr;
}
wght = 1;
var _pathPng = _ratInv? 1 - _prog_curr : _prog_curr;
if(_useDistance) {
p = _pat.getPointDistance(_pathPng, i, p);
if(struct_has(_pat, "getWeightRatio"))

View file

@ -100,7 +100,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
draw_sprite_ext(s_patreon_supporter, 1, spr_x, spr_y, 1, 1, 0, COLORS._main_accent, 1);
if(point_in_circle(_mx, _my, spr_x, spr_y, 10)) TOOLTIP = "Supporter exclusive";
if(point_in_circle(_mx, _my, spr_x, spr_y, 10)) TOOLTIP = __txt("Supporter exclusive");
}
} #endregion
@ -146,7 +146,7 @@ function NodeObject(_name, _spr, _node, _create, tags = []) constructor { #regio
draw_sprite_ext(s_patreon_supporter, 1, spr_x, spr_y, 1, 1, 0, COLORS._main_accent, 1);
if(point_in_circle(_mx, _my, spr_x, spr_y, 10)) TOOLTIP = "Supporter exclusive";
if(point_in_circle(_mx, _my, spr_x, spr_y, 10)) TOOLTIP = __txt("Supporter exclusive");
}
return tx;

View file

@ -1268,7 +1268,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
tt = __txt("Global");
} else {
var _cnt = node_context[| i];
tt = _cnt.display_name == ""? _cnt.name : _cnt.display_name;
tt = _cnt.renamed? _cnt.display_name : _cnt.name;
}
tw = string_width(tt);
@ -1514,7 +1514,7 @@ function Panel_Graph(project = PROJECT) : PanelContent() constructor {
dragGraph();
var context = getCurrentContext();
if(context != noone) title_raw += " > " + (context.display_name == ""? context.name : context.display_name);
if(context != noone) title_raw += " > " + (context.renamed? context.display_name : context.name);
bg_color = context == noone? COLORS.panel_bg_clear : merge_color(COLORS.panel_bg_clear, context.getColor(), 0.05);
draw_clear(bg_color);

View file

@ -732,7 +732,7 @@ function Panel_Inspector() : PanelContent() constructor {
tb_node_name.setFocusHover(pFOCUS, pHOVER);
tb_node_name.align = fa_center;
tb_node_name.format = TEXT_AREA_FORMAT.node_title;
var txt = inspecting.display_name == ""? inspecting.name : inspecting.display_name;
var txt = inspecting.renamed? inspecting.display_name : inspecting.name;
tb_node_name.draw(ui(64), ui(14), w - ui(128), ui(32), txt, [mx, my]);
draw_set_text(f_p1, fa_center, fa_center, COLORS._main_text_sub);
@ -795,7 +795,7 @@ function Panel_Inspector() : PanelContent() constructor {
inspecting = noone;
if(inspecting) {
title = inspecting.display_name == ""? inspecting.name : inspecting.display_name;
title = inspecting.renamed? inspecting.display_name : inspecting.name;
inspecting.inspectorStep();
drawInspectingNode();
} else {

View file

@ -647,10 +647,10 @@ function Panel_Menu() : PanelContent() constructor {
#region title
var txt = "";
if(PROJECT.safeMode) txt += "[SAFE MODE] ";
if(PROJECT.readonly) txt += "[READ ONLY] ";
if(PROJECT.safeMode) txt += $"[{__txt("SAFE MODE")}] ";
if(PROJECT.readonly) txt += $"[{__txt("READ ONLY")}] ";
txt += PROJECT.path == ""? "Untitled" : filename_name(PROJECT.path);
txt += PROJECT.path == ""? __txt("Untitled") : filename_name(PROJECT.path);
if(PROJECT.modified) txt += "*";
txt += " - Pixel Composer";
if(ALPHA) txt += " ALPHA";
@ -742,7 +742,7 @@ function Panel_Menu() : PanelContent() constructor {
var _ib = COLORS._main_text_sub;
if(pHOVER && point_in_rectangle(mx, my, _cx - 12, _cy - 12, _cx + 12, _cy + 12)) {
TOOLTIP = "Supporter";
TOOLTIP = __txt("Supporter");
_ib = COLORS._main_accent;
}

View file

@ -33,7 +33,7 @@ function Panel_Nodes() : PanelContent() constructor {
for( var i = 0; i < ds_list_size(_list); i++ ) {
var node = _list[| i];
var name = node.display_name == ""? node.name : node.display_name;
var name = node.renamed? node.display_name : node.name;
if(string_lower(search_string) != "" && string_lower(string_pos(search_string, name)) == 0)
continue;

View file

@ -615,7 +615,7 @@ function Panel_Preview() : PanelContent() constructor {
var _node = getNodePreview();
if(_node)
title = _node.display_name == ""? _node.name : _node.display_name;
title = _node.renamed? _node.display_name : _node.name;
if(splitView == 0 && tileMode == 0 && is_surface(preview_surface[0])) {
var node = preview_node[0];

View file

@ -129,7 +129,7 @@ function Panel_Tunnels() : PanelContent() constructor {
draw_sprite_ui(THEME.tunnel, 0, ui(32), _y + ui(10), 0.75, 0.75, 0, COLORS._main_icon);
draw_set_text(f_p1, fa_left, fa_center, COLORS._main_text_sub);
draw_text(ui(32 + 16), _y + ui(10), _node.display_name == ""? _node.name : _node.display_name);
draw_text(ui(32 + 16), _y + ui(10), _node.renamed? _node.display_name : _node.name);
if(point_in_rectangle(_m[0], _m[1], 0, _y, ww, _y + ui(20)))

View file

@ -198,7 +198,7 @@
var f = json_load_struct(DIRECTORY + "key_nodes.json");
struct_override(HOTKEYS_CUSTOM, f);
LOCALE_USE_DEFAULT = PREFERENCES.local == "en";
LOCALE_DEF = PREFERENCES.local == "en";
directory_verify(filepath_resolve(PREFERENCES.temp_path));
}

View file

@ -87,7 +87,7 @@ function timelineItemNode(node) : timelineItem() constructor {
draw_set_color(itHover == self? COLORS._main_text_accent : COLORS._main_text);
var txx = lx + ui(24);
if(nameType == 0 || nameType == 1 || node.display_name == "") {
if(nameType == 0 || nameType == 1 || !node.renamed) {
draw_set_alpha(0.6);
draw_text_add(txx, _y + lh / 2 - ui(2), nodeName);
txx += tw;

View file

@ -49,4 +49,6 @@ function audioObject(sample = 8, channel = 2) constructor {
static getChannel = function() { return mono? 1 : channels; }
static getData = function() { return mono? soundF : sound; }
static toString = function() { return $"\{duration:{duration}, channels:{channels}\}"; }
}