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