Free Hero Mesh

Diff
Login
This is a mirror of the main repository for Free Hero Mesh. New tickets and changes will not be accepted at this mirror.

Differences From Artifact [01a8b0753e]:

To Artifact [05c2728680]:


1
2
3
4

5
6
7
8
9
10
11
12
13
14
15
16


17

18
19
20
21
22
23
24
"use strict";
const fs=require("fs");
const names_file=fs.readFileSync("names.js","ascii").split("\n");
const data_file=fs.readFileSync("instruc","ascii").split("\n");

const do_sound_names=x=>{
  if(!x || x[0]=="`") return;
  if(x[0]=="c") return f=()=>0;
  let y=/^ *([A-Za-z_0-9]+) *$/.exec(x);
  if(y) return data_file.push("#"+y[1]);
};
const do_message_names=x=>{
  if(x.startsWith("const standard_sound_names=")) {
    data_file.push("(0300)");
    return f=do_sound_names;
  }
  let y=/^ *([0-9]+) = ([^ ]*) *$/.exec(x);


  if(y) data_file.push("#"+y[2]+" ("+(Number(y[1])+0x0200).toString(16)+")");

};
let f=x=>{
  if(x.startsWith("const standard_message_names=")) f=do_message_names;
};
names_file.forEach(x=>f(x)); // not .forEach(f); the function to use varies
let curnum=0;
const names=Object.create(null);




>




|







>
>
|
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"use strict";
const fs=require("fs");
const names_file=fs.readFileSync("names.js","ascii").split("\n");
const data_file=fs.readFileSync("instruc","ascii").split("\n");
const msgkeys=Object.create(null);
const do_sound_names=x=>{
  if(!x || x[0]=="`") return;
  if(x[0]=="c") return f=()=>0;
  let y=/^ *([A-Za-z_0-9]+) *$/.exec(x);
  if(y && !msgkeys[y[1]]) return data_file.push("#"+y[1]);
};
const do_message_names=x=>{
  if(x.startsWith("const standard_sound_names=")) {
    data_file.push("(0300)");
    return f=do_sound_names;
  }
  let y=/^ *([0-9]+) = ([^ ]*) *$/.exec(x);
  if(y) {
    msgkeys[y[2]]=true;
    data_file.push("#"+y[2]+" ("+(Number(y[1])+0x0200).toString(16)+")");
  }
};
let f=x=>{
  if(x.startsWith("const standard_message_names=")) f=do_message_names;
};
names_file.forEach(x=>f(x)); // not .forEach(f); the function to use varies
let curnum=0;
const names=Object.create(null);