Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
config.qc
Go to the documentation of this file.
1#include "config.qh"
2
3#if defined(CSQC)
4#elif defined(MENUQC)
5#elif defined(SVQC)
6 #include <common/util.qh>
7 #include <common/weapons/all.qh>
8#endif
9
10// ==========================
11// Balance Config Generator
12// ==========================
13
14void W_Config_Queue(string setting)
15{
17 config_queue[WEP_CONFIG_COUNT++] = setting;
18}
19
20void W_Config_Queue_Swap(int root, int child, entity pass)
21{
22 string oldroot = config_queue[root];
23 config_queue[root] = config_queue[child];
24 config_queue[child] = oldroot;
25}
26
27float W_Config_Queue_Compare(int root, int child, entity pass)
28{
29 return strcmp(config_queue[root], config_queue[child]);
30}
31
33{
34 int totalweapons = 0, totalsettings = 0;
35 int wepcount = 1;
36 #define WEP_CONFIG_WRITETOFILE(str) write_String_To_File(wep_config_file, str, wep_config_alsoprint)
37
39 "// ************************************************************************************ //\n"
40 "// ** WARNING - MANUALLY EDIT THIS FILE WITH CAUTION ** //\n"
41 "// ** ** //\n"
42 "// ** This file can be automatically generated with the command 'dumpweapons'. ** //\n"
43 "// ** This is useful to create custom weapon balance configs, after changing some ** //\n"
44 "// ** weapon balance cvars in-game. ** //\n"
45 "// ** If you are creating a custom weapon balance config file, delete this. ** //\n"
46 "// ** ** //\n"
47 "// ** If you are just editing the default weapon balance (bal-wep-xonotic.cfg), ** //\n"
48 "// ** please keep this comment as it contains helpful documentation. ** //\n"
49 "// ** ** //\n"
50 "// ** These are the default weapon-related balance config settings, categorized by ** //\n"
51 "// ** weapon. ** //\n"
52 "// ** Other default settings are in balance-xonotic.cfg, which executes this file. ** //\n"
53 "// ** Other wep balance configs like bal-wep-nexuiz25.cfg first execute this, then ** //\n"
54 "// ** override some settings. ** //\n"
55 "// ** Therefore any changes made to the default balance here will affect all ** //\n"
56 "// ** bal-wep-*.cfg files, unless you override it in such files. ** //\n"
57 "// ** ** //\n"
58 "// ** If you add a new weapon cvar, remove a weapon cvar, or rename a weapon cvar, ** //\n"
59 "// ** please regenerate this file with that command, or manually add it here. ** //\n"
60 "// ** ** //\n"
61 "// ************************************************************************************ //\n"
62 "\n");
63
64 FOREACH(Weapons, it != WEP_Null, {
65 if(it.spawnflags & WEP_FLAG_SPECIALATTACK)
66 continue; // never include the attacks
67 // step 1: clear the queue
69 for (int x = 0; x < MAX_CONFIG_SETTINGS; ++x)
71
72 // step 2: build new queue
73 it.wr_config(it);
74
76 {
77 LOG_INFOF("\n^1Dumping aborted^7: hit MAX_CONFIG_SETTINGS (%d) limit\n\n", MAX_CONFIG_SETTINGS);
78 break;
79 }
80
81 // step 3: sort queue
83
84 // step 4: write queue
86 "// {{{ #%d: %s%s\n",
87 wepcount,
88 it.m_name,
89 ((it.spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "")
90 ));
91 for (int x = 0; x < WEP_CONFIG_COUNT; ++x)
93 WEP_CONFIG_WRITETOFILE("// }}}\n");
94
95 // step 5: debug info
96 LOG_INFOF("#%d: %s: %d settings...", i, it.m_name, WEP_CONFIG_COUNT);
97 totalweapons += 1;
98 totalsettings += WEP_CONFIG_COUNT;
99 wepcount += 1;
100 });
101 #undef WEP_CONFIG_WRITETOFILE
102
103 // extra information
105 LOG_INFOF("Totals: %d weapons, %d settings", totalweapons, totalsettings);
106
107 // clear queue now that we're finished
109 for (int x = 0; x < MAX_CONFIG_SETTINGS; ++x)
111}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
string config_queue[MAX_CONFIG_SETTINGS]
Definition util.qh:27
const int MAX_CONFIG_SETTINGS
Definition util.qh:26
#define strcmp
#define pass(name, colormin, colormax)
Weapons
Definition guide.qh:113
#define FOREACH(list, cond, body)
Definition iter.qh:19
#define LOG_INFOF(...)
Definition log.qh:66
string string_null
Definition nil.qh:9
#define NULL
Definition post.qh:14
ERASEABLE void heapsort(int n, swapfunc_t swap, comparefunc_t cmp, entity pass)
Definition sort.qh:9
void W_Config_Queue_Swap(int root, int child, entity pass)
Definition config.qc:20
#define WEP_CONFIG_WRITETOFILE(str)
void Dump_Weapon_Settings()
Definition config.qc:32
void W_Config_Queue(string setting)
Definition config.qc:14
float W_Config_Queue_Compare(int root, int child, entity pass)
Definition config.qc:27
int WEP_CONFIG_COUNT
Definition config.qh:12
const int WEP_FLAG_MUTATORBLOCKED
Definition weapon.qh:219
const int WEP_FLAG_SPECIALATTACK
Definition weapon.qh:227