1 // ==========================
2 // Balance Config Generator
3 // ==========================
5 void W_Config_Queue_Swap(float root, float child, entity pass)
7 string oldroot = wep_config_queue[root];
8 wep_config_queue[root] = wep_config_queue[child];
9 wep_config_queue[child] = oldroot;
12 float W_Config_Queue_Compare(float root, float child, entity pass)
14 return strcmp(wep_config_queue[root], wep_config_queue[child]);
18 for(i = 1; i <= 100; ++i)
20 r = str2chr(wep_config_queue[root], i);
21 c = str2chr(wep_config_queue[child], i);
22 if(r == c) { continue; }
23 else if(c > r) { return -1; }
31 void Dump_Weapon_Settings(void)
33 float i, x, totalsettings = 0;
34 for(i = WEP_FIRST; i <= WEP_LAST; ++i)
36 // step 1: clear the queue
38 for(x = 0; x <= MAX_WEP_CONFIG; ++x)
39 { wep_config_queue[x] = string_null; }
41 // step 2: build new queue
42 WEP_ACTION(i, WR_CONFIG);
45 heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, world);
47 // step 4: write queue
48 WEP_CONFIG_WRITETOFILE(sprintf("// {{{ #%d: %s\n", i, W_Name(i)))
49 for(x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(wep_config_queue[x]) }
50 WEP_CONFIG_WRITETOFILE("// }}}\n")
53 print(sprintf("#%d: %s: %d settings...\n", i, W_Name(i), WEP_CONFIG_COUNT));
54 totalsettings += WEP_CONFIG_COUNT;
57 // clear queue now that we're finished
59 for(x = 0; x <= MAX_WEP_CONFIG; ++x)
60 { wep_config_queue[x] = string_null; }
63 print(sprintf("Totals: %d weapons, %d settings\n", (i - 1), totalsettings));