Add pi optimizations

This commit is contained in:
Murturtle 2024-09-29 02:40:43 -07:00 committed by GitHub
parent bf2c2e2800
commit 1dc4669521
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -135,6 +135,19 @@ var main;(function(){`
);
}
);
if(globalThis.optimizePi){
patchedFile = patchedFile.replaceAll(
/3\.1415927410125732 \/ 180/i,
"0.01745"
);
patchedFile = patchedFile.replaceAll(
/3\.1415927410125732/i,
"3.14159"
);
}
const extractInstanceMethodRegex =
/^[\t ]*function \S+?_\S+?_\S+?\((\$this)?/gm; // /^[\t ]*function \S+?_\S+?_\S+?\(\$this/gm
const extractInstanceMethodFullNameRegex = /function (\S*?)\(/gm; // /function (\S*?)\(\$this/gm
@ -197,6 +210,8 @@ var main;(function(){`
);
//Edge cases. sigh
//Done: add support for static properties on classes with constructors like this: function nmcg_GuiMainMenu() {
patchedFile = patchedFile.replaceAll(
/function [a-z]+?_([a-zA-Z\$]+?)\(\) \{/gm,
(match) => {