Merge branch 'master' into Mario/turrets
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / config.qh
1 #ifndef TURRETS_CONFIG_H
2 #define TURRETS_CONFIG_H
3
4 #ifdef SVQC
5
6 void Dump_Turret_Settings(void);
7 float tur_config_file;
8 float tur_config_alsoprint;
9
10 #define MAX_TUR_CONFIG 256
11 float TUR_CONFIG_COUNT;
12 string tur_config_queue[MAX_TUR_CONFIG];
13
14 #define TUR_CONFIG_QUEUE(a) { \
15         tur_config_queue[TUR_CONFIG_COUNT] = a; \
16         ++TUR_CONFIG_COUNT; }
17
18 #define TUR_CONFIG_WRITETOFILE(a) { \
19         fputs(tur_config_file, a); \
20         if(tur_config_alsoprint) { print(a); } }
21
22 #define TUR_CONFIG_WRITE_CVARS(turret,name) \
23                 { TUR_CONFIG_QUEUE( \
24                         sprintf("set g_turrets_unit_%s_%s %g\n", #turret, #name, \
25                         cvar(sprintf("g_turrets_unit_%s_%s", #turret, #name)))) } \
26
27 #define TUR_CONFIG_SETTINGS(tursettings) \
28         #define TUR_ADD_CVAR(turret,name) TUR_CONFIG_WRITE_CVARS(turret,name) \
29         tursettings \
30         #undef TUR_ADD_CVAR
31
32 #endif
33
34 #endif