Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
config.qc File Reference
#include "config.qh"
Include dependency graph for config.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WEP_CONFIG_WRITETOFILE(str)

Functions

void Dump_Weapon_Settings ()
void W_Config_Queue (string setting)
float W_Config_Queue_Compare (int root, int child, entity pass)
void W_Config_Queue_Swap (int root, int child, entity pass)

Macro Definition Documentation

◆ WEP_CONFIG_WRITETOFILE

#define WEP_CONFIG_WRITETOFILE ( str)
Value:
ERASEABLE void write_String_To_File(int fh, string str, bool alsoprint)
Definition util.qc:1375
bool wep_config_alsoprint
Definition config.qh:10
int wep_config_file
Definition config.qh:9

Referenced by Dump_Weapon_Settings().

Function Documentation

◆ Dump_Weapon_Settings()

void Dump_Weapon_Settings ( )

Definition at line 32 of file config.qc.

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}
string config_queue[MAX_CONFIG_SETTINGS]
Definition util.qh:27
const int MAX_CONFIG_SETTINGS
Definition util.qh:26
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)
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

References config_queue, FOREACH, heapsort(), LOG_INFOF, MAX_CONFIG_SETTINGS, NULL, string_null, W_Config_Queue_Compare(), W_Config_Queue_Swap(), Weapons, WEP_CONFIG_COUNT, WEP_CONFIG_WRITETOFILE, WEP_FLAG_MUTATORBLOCKED, and WEP_FLAG_SPECIALATTACK.

◆ W_Config_Queue()

void W_Config_Queue ( string setting)

Definition at line 14 of file config.qc.

15{
17 config_queue[WEP_CONFIG_COUNT++] = setting;
18}

References config_queue, MAX_CONFIG_SETTINGS, and WEP_CONFIG_COUNT.

◆ W_Config_Queue_Compare()

float W_Config_Queue_Compare ( int root,
int child,
entity pass )

Definition at line 27 of file config.qc.

28{
29 return strcmp(config_queue[root], config_queue[child]);
30}
#define strcmp

References config_queue, entity(), pass, and strcmp.

Referenced by Dump_Weapon_Settings().

◆ W_Config_Queue_Swap()

void W_Config_Queue_Swap ( int root,
int child,
entity pass )

Definition at line 20 of file config.qc.

21{
22 string oldroot = config_queue[root];
23 config_queue[root] = config_queue[child];
24 config_queue[child] = oldroot;
25}

References config_queue, entity(), and pass.

Referenced by Dump_Weapon_Settings().