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]);
17 void Dump_Weapon_Settings(void)
19 float i, x, totalsettings = 0;
20 for(i = WEP_FIRST; i <= WEP_LAST; ++i)
22 // step 1: clear the queue
24 for(x = 0; x <= MAX_WEP_CONFIG; ++x)
25 { wep_config_queue[x] = string_null; }
27 // step 2: build new queue
28 WEP_ACTION(i, WR_CONFIG);
31 heapsort(WEP_CONFIG_COUNT, W_Config_Queue_Swap, W_Config_Queue_Compare, world);
33 // step 4: write queue
34 WEP_CONFIG_WRITETOFILE(sprintf(
38 (((get_weaponinfo(i)).spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "")
40 for(x = 0; x <= WEP_CONFIG_COUNT; ++x) { WEP_CONFIG_WRITETOFILE(wep_config_queue[x]) }
41 WEP_CONFIG_WRITETOFILE("// }}}\n")
44 print(sprintf("#%d: %s: %d settings...\n", i, W_Name(i), WEP_CONFIG_COUNT));
45 totalsettings += WEP_CONFIG_COUNT;
48 // clear queue now that we're finished
50 for(x = 0; x <= MAX_WEP_CONFIG; ++x)
51 { wep_config_queue[x] = string_null; }
54 print(sprintf("Totals: %d weapons, %d settings\n", (i - 1), totalsettings));