]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/config.qh
Commands: move dump commands to their respective systems
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / config.qh
1 #ifndef WEAPONS_CONFIG_H
2 #define WEAPONS_CONFIG_H
3
4 #ifdef SVQC
5 // ==========================
6 //  Balance Config Generator
7 // ==========================
8
9 void Dump_Weapon_Settings(void);
10 int wep_config_file;
11 bool wep_config_alsoprint;
12
13 const int MAX_WEP_CONFIG = 256;
14 int WEP_CONFIG_COUNT;
15 string wep_config_queue[MAX_WEP_CONFIG];
16
17 #define WEP_CONFIG_QUEUE(a) { \
18         wep_config_queue[WEP_CONFIG_COUNT] = a; \
19         ++WEP_CONFIG_COUNT; }
20
21 #define WEP_CONFIG_WRITETOFILE(a) do { \
22         fputs(wep_config_file, a); \
23         if(wep_config_alsoprint) { LOG_INFO(a); } \
24 } while(0)
25
26 #define WEP_CONFIG_WRITE_CVARS_NONE(wepname,name) \
27         { WEP_CONFIG_QUEUE( \
28                 sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
29                 cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
30
31 #define WEP_CONFIG_WRITE_CVARS_PRI(wepname,name) WEP_CONFIG_WRITE_CVARS_NONE(wepname, primary_##name)
32 #define WEP_CONFIG_WRITE_CVARS_SEC(wepname,name) WEP_CONFIG_WRITE_CVARS_NONE(wepname, secondary_##name)
33 #define WEP_CONFIG_WRITE_CVARS_BOTH(wepname,name) \
34         WEP_CONFIG_WRITE_CVARS_PRI(wepname, name) \
35         WEP_CONFIG_WRITE_CVARS_SEC(wepname, name)
36
37 #define WEP_CONFIG_WRITE_CVARS(wepid,wepname,mode,name) WEP_CONFIG_WRITE_CVARS_##mode(wepname, name)
38
39 #define WEP_CONFIG_WRITE_PROPS_string(wepname,name) \
40         { WEP_CONFIG_QUEUE( \
41                 sprintf("set g_balance_%s_%s \"%s\"\n", #wepname, #name, \
42                 cvar_string(sprintf("g_balance_%s_%s", #wepname, #name)))) }
43
44 #define WEP_CONFIG_WRITE_PROPS_float(wepname,name) \
45         { WEP_CONFIG_QUEUE( \
46                 sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
47                 cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
48
49 #define WEP_CONFIG_WRITE_PROPS(wepid,wepname,type,prop,name) WEP_CONFIG_WRITE_PROPS_##type(wepname,name)
50 #endif
51 #endif