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