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#ifdef SVQC
4 #include <common/util.qh>
5 #include <common/weapons/all.qh>
6#endif
7
8// ==========================
9// Balance Config Generator
10// ==========================
11
12void W_Config_Queue(string setting)
13{
15 config_queue[WEP_CONFIG_COUNT++] = setting;
16}
17
18void W_Config_Queue_Swap(int root, int child, entity pass)
19{
20 string oldroot = config_queue[root];
21 config_queue[root] = config_queue[child];
22 config_queue[child] = oldroot;
23}
24
25float W_Config_Queue_Compare(int root, int child, entity pass)
26{
27 return strcmp(config_queue[root], config_queue[child]);
28}
29
31{
32 int totalsettings = 0;
33 int totalweapons = 0;
34 #define WEP_CONFIG_WRITETOFILE(str) \
35 write_String_To_File(wep_config_file, str, wep_config_alsoprint)
36
38 "// ************************************************************************************ //\n"
39 "// ** WARNING - MANUALLY EDIT THIS FILE WITH CAUTION ** //\n"
40 "// ** ** //\n"
41 "// ** This file can be automatically generated with the command 'dumpweapons'. ** //\n"
42 "// ** This is useful to create custom weapon balance configs, after changing some ** //\n"
43 "// ** weapon balance cvars in-game. ** //\n"
44 "// ** If you are creating a custom weapon balance config file, delete this. ** //\n"
45 "// ** ** //\n"
46 "// ** If you are just editing the default weapon balance (bal-wep-xonotic.cfg), ** //\n"
47 "// ** please keep this comment as it contains helpful documentation. ** //\n"
48 "// ** ** //\n"
49 "// ** These are the default weapon-related balance config settings, categorized by ** //\n"
50 "// ** weapon. ** //\n"
51 "// ** Other default settings are in balance-xonotic.cfg, which executes this file. ** //\n"
52 "// ** Other wep balance configs like bal-wep-nexuiz25.cfg first execute this, then ** //\n"
53 "// ** override some settings. ** //\n"
54 "// ** Therefore any changes made to the default balance here will affect all ** //\n"
55 "// ** bal-wep-*.cfg files, unless you override it in such files. ** //\n"
56 "// ** ** //\n"
57 "// ** If you add a new weapon cvar, remove a weapon cvar, or rename a weapon cvar, ** //\n"
58 "// ** please regenerate this file with that command, or manually add it here. ** //\n"
59 "// ** ** //\n"
60 "// ************************************************************************************ //\n"
61 "\n");
62
63 int x;
64 FOREACH(Weapons, it != WEP_Null,
65 {
66 if (it.spawnflags & WEP_FLAG_SPECIALATTACK)
67 continue; // never include the attacks
68 // step 1: clear the queue
70 for (x = 0; x < MAX_CONFIG_SETTINGS; ++x)
72
73 // step 2: build new queue
74 it.wr_config(it);
75
77 {
78 LOG_INFOF("\n^1Dumping aborted^7: hit MAX_CONFIG_SETTINGS (%d) limit\n\n", MAX_CONFIG_SETTINGS);
79 break;
80 }
81
82 // step 3: sort queue
84
85 // step 4: write queue
87 "// {{{ #%d: %s%s\n",
88 totalweapons + 1,
89 it.m_name,
90 ((it.spawnflags & WEP_FLAG_MUTATORBLOCKED) ? " (MUTATOR WEAPON)" : "")
91 ));
92 for (x = 0; x < WEP_CONFIG_COUNT; ++x)
94 WEP_CONFIG_WRITETOFILE("// }}}\n");
95
96 // step 5: debug info
97 LOG_INFOF("#%d: %s: %d settings...", i, it.m_name, WEP_CONFIG_COUNT);
98 ++totalweapons;
99 totalsettings += WEP_CONFIG_COUNT;
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 (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:18
#define WEP_CONFIG_WRITETOFILE(str)
void Dump_Weapon_Settings()
Definition config.qc:30
void W_Config_Queue(string setting)
Definition config.qc:12
float W_Config_Queue_Compare(int root, int child, entity pass)
Definition config.qc:25
int WEP_CONFIG_COUNT
Definition config.qh:12
const int WEP_FLAG_MUTATORBLOCKED
Definition weapon.qh:261
const int WEP_FLAG_SPECIALATTACK
Definition weapon.qh:269