]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/weapons/config.qc
Merge branch 'TimePath/unified_weapons' into 'master'
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / weapons / config.qc
1 #if defined(CSQC)
2 #elif defined(MENUQC)
3 #elif defined(SVQC)
4         #include "../../dpdefs/progsdefs.qh"
5     #include "../../dpdefs/dpextensions.qh"
6     #include "../util.qh"
7     #include "config.qh"
8     #include "all.qh"
9 #endif
10
11 // ==========================
12 //  Balance Config Generator
13 // ==========================
14
15 void W_Config_Queue_Swap(int root, int child, entity pass)
16 {
17         string oldroot = wep_config_queue[root];
18         wep_config_queue[root] = wep_config_queue[child];
19         wep_config_queue[child] = oldroot;
20 }
21
22 float W_Config_Queue_Compare(int root, int child, entity pass)
23 {
24         return strcmp(wep_config_queue[root], wep_config_queue[child]);
25 }
26
27 void Dump_Weapon_Settings(void)
28 {
29         int i, x, totalsettings = 0;
30         for(i = WEP_FIRST; i <= WEP_LAST; ++i)
31         {
32                 // step 1: clear the queue
33                 WEP_CONFIG_COUNT = 0;
34                 for(x = 0; x <= MAX_WEP_CONFIG; ++x)
35                         { wep_config_queue[x] = string_null; }
36
37                 // step 2: build new queue
38                 Weapon w = get_weaponinfo(i);
39                 w.wr_config(w);
40
41                 // step 3: sort queue
42                 heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, world);
43
44                 // step 4: write queue
45                 WEP_CONFIG_WRITETOFILE(sprintf(
46                         "// {{{ #%d: %s%s\n",
47                         i,
48                         WEP_NAME(i),
49                         (((get_weaponinfo(i)).spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "")
50                 ));
51                 for(x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(wep_config_queue[x]); }
52                 WEP_CONFIG_WRITETOFILE("// }}}\n");
53
54                 // step 5: debug info
55                 LOG_INFO(sprintf("#%d: %s: %d settings...\n", i, WEP_NAME(i), WEP_CONFIG_COUNT));
56                 totalsettings += WEP_CONFIG_COUNT;
57         }
58
59         // clear queue now that we're finished
60         WEP_CONFIG_COUNT = 0;
61         for(x = 0; x <= MAX_WEP_CONFIG; ++x)
62                 { wep_config_queue[x] = string_null; }
63
64         // extra information
65         LOG_INFO(sprintf("Totals: %d weapons, %d settings\n", (i - 1), totalsettings));
66 }