From 8b4fd02d0ca6a1b74b64f356955e651314cee10b Mon Sep 17 00:00:00 2001 From: MonX94 Date: Tue, 15 Aug 2023 17:16:30 +0300 Subject: [PATCH] fix 'clip to fax/frz' functions to account for float numbers --- ua.NecrosCopy.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ua.NecrosCopy.lua b/ua.NecrosCopy.lua index 66d1169..2915ea6 100644 --- a/ua.NecrosCopy.lua +++ b/ua.NecrosCopy.lua @@ -19,8 +19,8 @@ function fucks(subs,sel) t=l.text if not t:match("\\i?clip%(m") and not t:match("//i?clip%(m") then t_error("Missing \\clip on line #"..i-line0..".",1) end - cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4=t:match("clip%(m ([%d%-]+) ([%d%-]+) l ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+)") - if not cx1 then cx1,cy1,cx2,cy2=t:match("clip%(m ([%d%-]+) ([%d%-]+) l ([%d%-]+) ([%d%-]+)") end + cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4=t:match("clip%(m ([%d%-%.]+) ([%d%-%.]+) l ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+)") + if not cx1 then cx1,cy1,cx2,cy2=t:match("clip%(m ([%d%-%.]+) ([%d%-%.]+) l ([%d%-%.]+) ([%d%-%.]+)") end if not cx1 then t_error("Line #"..i-line0..": Not enough clip points. 2 required.",1) end sr=stylechk(subs,l.style) nontra=t:gsub("\\t%b()","") @@ -79,8 +79,8 @@ function frozt(subs,sel) local l=subs[i] local text=l.text if not text:match("\\i?clip%(m") and not text:match("//i?clip%(m") then t_error("Missing \\clip on line #"..i-line0..".\nAborting.",1) end - cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4=text:match("clip%(m ([%d%-]+) ([%d%-]+) l ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+) ([%d%-]+)") - if not cx1 then cx1,cy1,cx2,cy2=text:match("clip%(m ([%d%-]+) ([%d%-]+) l ([%d%-]+) ([%d%-]+)") end + cx1,cy1,cx2,cy2,cx3,cy3,cx4,cy4=text:match("clip%(m ([%d%-%.]+) ([%d%-%.]+) l ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+) ([%d%-%.]+)") + if not cx1 then cx1,cy1,cx2,cy2=text:match("clip%(m ([%d%-%.]+) ([%d%-%.]+) l ([%d%-%.]+) ([%d%-%.]+)") end if not cx1 then t_error("Line #"..i-line0..": Not enough clip points. 2 required.",1) end local ad,op,tang,ang1,rota ad=cx2-cx1 @@ -410,8 +410,8 @@ function shad3(subs,sel) text2=addtag3('\\1a&HFE&',text2) txt=text2 if l==1 then txt=text end line2.text=txt - :gsub("\\xshad([%d%.%-]+)",function(a) xx=tostring(f*a) xx=xx:gsub("([%d%-]+%.%d%d)%d+","%1") return "\\xshad"..xx end) - :gsub("\\yshad([%d%.%-]+)",function(a) yy=tostring(f*a) yy=yy:gsub("([%d%-]+%.%d%d)%d+","%1") return "\\yshad"..yy end) + :gsub("\\xshad([%d%.%-]+)",function(a) xx=tostring(f*a) xx=xx:gsub("([%d%-%.]+%.%d%d)%d+","%1") return "\\xshad"..xx end) + :gsub("\\yshad([%d%.%-]+)",function(a) yy=tostring(f*a) yy=yy:gsub("([%d%-%.]+%.%d%d)%d+","%1") return "\\yshad"..yy end) line2.layer=layer+(lay-l) subs.insert(i+1,line2) end