Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
config.qc File Reference
#include "config.qh"
#include <common/util.qh>
#include <common/weapons/all.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:1473
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 30 of file config.qc.

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}
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:18
#define WEP_CONFIG_WRITETOFILE(str)
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

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 12 of file config.qc.

13{
15 config_queue[WEP_CONFIG_COUNT++] = setting;
16}

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 25 of file config.qc.

26{
27 return strcmp(config_queue[root], config_queue[child]);
28}
#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 18 of file config.qc.

19{
20 string oldroot = config_queue[root];
21 config_queue[root] = config_queue[child];
22 config_queue[child] = oldroot;
23}

References config_queue, entity(), and pass.

Referenced by Dump_Weapon_Settings().