about summary refs log tree commit diff
path: root/scripts/gen_keys.py
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2010-05-29 07:25:38 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2010-05-29 07:25:38 +0000
commit72c06a258940696093f255fb1061beb58e1cdd0b (patch)
tree36b9a7712eec2d4f07837eab9c38ef1c5af85319 /scripts/gen_keys.py
parente56feb597bc743677633432f77513b02907fd169 (diff)
downloadzcatch-72c06a258940696093f255fb1061beb58e1cdd0b.tar.gz
zcatch-72c06a258940696093f255fb1061beb58e1cdd0b.zip
copied refactor to trunk
Diffstat (limited to 'scripts/gen_keys.py')
-rw-r--r--scripts/gen_keys.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/scripts/gen_keys.py b/scripts/gen_keys.py
index 4e772799..6a275468 100644
--- a/scripts/gen_keys.py
+++ b/scripts/gen_keys.py
@@ -1,7 +1,7 @@
 import sys, os
 
 # genereate keys.h file
-f = file("src/engine/e_keys.h", "w")
+f = file("src/engine/keys.h", "w")
 
 keynames = []
 for i in range(0, 512):
@@ -42,23 +42,23 @@ print >>f, "};"
 print >>f, ""
 print >>f, "#endif"
 
-
 # generate keynames.c file
-f = file("src/engine/e_keynames.c", "w")
+f = file("src/engine/client/keynames.h", "w")
 print >>f, '/* AUTO GENERATED! DO NOT EDIT MANUALLY! */'
 print >>f, ''
+print >>f, '#ifndef KEYS_INCLUDE'
+print >>f, '#error do not include this header!'
+print >>f, '#endif'
+print >>f, ''
 print >>f, "#include <string.h>"
 print >>f, ""
-print >>f, "static const char key_strings[512][16] ="
+print >>f, "const char g_aaKeyStrings[512][16] ="
 print >>f, "{"
 for n in keynames:
 	print >>f, '\t"%s",'%n
 
 print >>f, "};"
 print >>f, ""
-print >>f, "const char *inp_key_name(int k) { if (k >= 0 && k < 512) return key_strings[k]; else return key_strings[0]; }"
-print >>f, "int inp_key_code(const char *key_name) { int i; if (!strcmp(key_name, \"-?-\")) return -1; else for (i = 0; i < 512; i++) if (!strcmp(key_strings[i], key_name)) return i; return -1; }"
-print >>f, ""
 
 f.close()