27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
+
|
20 = CONFLICT
21 = COLLIDEBY
22 = COLLIDE
23 = COLLIDING
24 = BLOCKED
25 = CONNECT
26 = NEXTWARP
27 = CLICK
`.split("\n").map(x=>/^ *([0-9]+) = ([^ ]*) *$/.exec(x)).filter(x=>x);
const standard_sound_names=[];
`
SPLASH
POUR
DOOR
GLASS
|
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
|
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
+
-
+
+
+
+
-
-
-
+
+
+
-
-
+
+
+
|
222 QUOTE
`.replace(/([0-9]+) +([A-Z][A-Z0-9_]*)/g,(x,y,z)=>{
heromesh_key_names[y]=z;
});
[..."ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"].forEach(x=>{
heromesh_key_names[x.charCodeAt()]=x;
});
const msgkeys=Object.create(null); // In case some message names are also sound names
console.log("// Auto-generated! Do not modify directly!");
standard_message_names.forEach(([a,b,c])=>console.log("#define MSG_"+c+" "+b));
standard_message_names.forEach(([a,b,c])=>{
msgkeys[c]=true;
console.log("#define MSG_"+c+" "+b);
});
console.log("#ifdef HEROMESH_MAIN");
console.log("const char*const standard_message_names[]={");
standard_message_names.forEach(([a,b,c])=>console.log(" \""+c+"\","));
console.log("};");
console.log("#endif");
standard_sound_names.forEach((x,y)=>console.log("#define SND_"+x+" "+y));
console.log("#ifdef HEROMESH_MAIN");
console.log("const char*const standard_sound_names[]={");
standard_sound_names.forEach(x=>{
if(msgkeys[x]) console.log("#ifdef HEROMESH_CONV_MAIN");
console.log("const char*const standard_sound_names[]={");
standard_sound_names.forEach(x=>console.log(" \""+x+"\","));
console.log(" \""+x+"\",");
if(msgkeys[x]) console.log("#endif");
});
console.log("};");
console.log("const char*const heromesh_key_names[256]={");
Object.keys(heromesh_key_names).forEach(x=>console.log(" ["+x+"]=\""+heromesh_key_names[x]+"\","));
console.log("};");
console.log("#endif");
|