diff options
author | Tor Andersson <tor@ccxvii.net> | 2023-04-14 11:42:12 +0200 |
---|---|---|
committer | Tor Andersson <tor@ccxvii.net> | 2023-05-03 18:48:16 +0200 |
commit | 21d853ac27ed3751087750051dd97e68a0502c3b (patch) | |
tree | b23d7e00163fcfb342c37a4c6f7ef885d79756ca /tools | |
parent | 662c74265ea9c3bdeb04fea06abcc659c01085e8 (diff) | |
download | andean-abyss-21d853ac27ed3751087750051dd97e68a0502c3b.tar.gz |
Simplify 5.1.3 affected events with new instruction pair.
if_space <condition1>
or_space <condition2>
Gets compiled to:
if can_vm_place(1, s => <condition1>)
space 1 <condition1>
else
space 1 <condition2>
endif
Interleaving if/else and space/endspace is safe.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/gencode.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tools/gencode.js b/tools/gencode.js index 30f12c9..df8f0f1 100644 --- a/tools/gencode.js +++ b/tools/gencode.js @@ -43,6 +43,17 @@ for (let line of fs.readFileSync("events.txt", "utf-8").split("\n")) { console.log("// SHADED " + line[1]) break + case "if_space": + emit([ "if", "()=>can_vm_space(1,(s)=>" + line.slice(1).join(" ") + ")" ]) + emit([ "space", true, 1, 1, "(s)=>" + line.slice(1).join(" ") ]) + emit([ "else" ]) + break + + case "or_space": + emit([ "space", true, 1, 1, "(s)=>" + line.slice(1).join(" ") ]) + emit([ "endif" ]) + break + case "space_no_undo": emit([ "space", false, line[1], line[1], "(s)=>" + line.slice(2).join(" ") ]) break |