883082c97d02ed22df2c6910c1123542f2d09818
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / config.qh
1 #pragma once
2
3 #ifdef SVQC
4 // ==========================
5 //  Balance Config Generator
6 // ==========================
7
8 void Dump_Weapon_Settings();
9 int wep_config_file;
10 bool wep_config_alsoprint;
11
12 int WEP_CONFIG_COUNT;
13 #define WEP_CONFIG_QUEUE(a) { \
14         config_queue[WEP_CONFIG_COUNT] = a; \
15         ++WEP_CONFIG_COUNT; }
16
17 #define WEP_CONFIG_WRITETOFILE(a) MACRO_BEGIN \
18         fputs(wep_config_file, a); \
19         if(wep_config_alsoprint) { LOG_INFO(a); } \
20 MACRO_END
21
22
23 #define WEP_CONFIG_WRITE_CVARS(wepname, name, T) WEP_CONFIG_WRITE_PROPS_##T(wepname, name)
24
25 #define WEP_CONFIG_WRITE_PROPS_string(wepname, name) \
26         { WEP_CONFIG_QUEUE( \
27                 sprintf("set g_balance_%s_%s \"%s\"\n", #wepname, #name, \
28                 cvar_string(sprintf("g_balance_%s_%s", #wepname, #name)))) }
29
30 #define WEP_CONFIG_WRITE_PROPS_float(wepname, name) \
31         { WEP_CONFIG_QUEUE( \
32                 sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
33                 cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
34
35 #endif