]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/config.qh
Working on new system which does not need macro defines inside macros
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / config.qh
1 // ==========================
2 //  Balance Config Generator
3 // ==========================
4
5 void Dump_Weapon_Settings(void);
6 float wep_config_file;
7 float wep_config_alsoprint;
8
9 #define MAX_WEP_CONFIG 256
10 float WEP_CONFIG_COUNT;
11 string wep_config_queue[MAX_WEP_CONFIG];
12
13 #define WEP_CONFIG_QUEUE(a) { \
14         wep_config_queue[WEP_CONFIG_COUNT] = a; \
15         ++WEP_CONFIG_COUNT; }
16
17 #define WEP_CONFIG_WRITETOFILE(a) { \
18         fputs(wep_config_file, a); \
19         if(wep_config_alsoprint) { print(a); } }
20
21 #define WEP_CONFIG_WRITE_CVARS_MO_PRI(wepname,name) \
22         { WEP_CONFIG_QUEUE( \
23                 sprintf("set g_balance_%s_primary_%s %g\n", #wepname, #name, \
24                 cvar(sprintf("g_balance_%s_primary_%s", #wepname, #name)))) }
25
26 #define WEP_CONFIG_WRITE_CVARS_MO_SEC(wepname,name) \
27         { WEP_CONFIG_QUEUE( \
28                 sprintf("set g_balance_%s_secondary_%s %g\n", #wepname, #name, \
29                 cvar(sprintf("g_balance_%s_secondary_%s", #wepname, #name)))) }
30                 
31 #define WEP_CONFIG_WRITE_CVARS_MO_BOTH(wepname,name) \
32         { WEP_CONFIG_QUEUE( \
33                 sprintf("set g_balance_%s_primary_%s %g\n", #wepname, #name, \
34                 cvar(sprintf("g_balance_%s_primary_%s", #wepname, #name)))) } \
35         { WEP_CONFIG_QUEUE( \
36                 sprintf("set g_balance_%s_secondary_%s %g\n", #wepname, #name, \
37                 cvar(sprintf("g_balance_%s_secondary_%s", #wepname, #name)))) }
38
39 #define WEP_CONFIG_WRITE_CVARS_MO_NONE(wepname,name) \
40         { WEP_CONFIG_QUEUE( \
41                 sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
42                 cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
43
44 #define WEP_CONFIG_WRITE_CVARS(wepid,wepname,mode,name) WEP_CONFIG_WRITE_CVARS_##mode(wepname, name)
45
46 // WEAPONTODO: remove prop
47 #define WEP_CONFIG_WRITE_PROPS(wepid,wepname,unused,name) \
48         { WEP_CONFIG_QUEUE( \
49                 sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
50                 cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }