]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/config.qh
#pragma once
[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 const int MAX_WEP_CONFIG = 256;
13 int WEP_CONFIG_COUNT;
14 string wep_config_queue[MAX_WEP_CONFIG];
15
16 #define WEP_CONFIG_QUEUE(a) { \
17         wep_config_queue[WEP_CONFIG_COUNT] = a; \
18         ++WEP_CONFIG_COUNT; }
19
20 #define WEP_CONFIG_WRITETOFILE(a) MACRO_BEGIN { \
21         fputs(wep_config_file, a); \
22         if(wep_config_alsoprint) { LOG_INFO(a); } \
23 } MACRO_END
24
25
26 #define WEP_CONFIG_WRITE_CVARS(wepname, name, T) WEP_CONFIG_WRITE_PROPS_##T(wepname, name)
27
28 #define WEP_CONFIG_WRITE_PROPS_string(wepname, name) \
29         { WEP_CONFIG_QUEUE( \
30                 sprintf("set g_balance_%s_%s \"%s\"\n", #wepname, #name, \
31                 cvar_string(sprintf("g_balance_%s_%s", #wepname, #name)))) }
32
33 #define WEP_CONFIG_WRITE_PROPS_float(wepname, name) \
34         { WEP_CONFIG_QUEUE( \
35                 sprintf("set g_balance_%s_%s %g\n", #wepname, #name, \
36                 cvar(sprintf("g_balance_%s_%s", #wepname, #name)))) }
37
38 #endif