Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
all.qh
Go to the documentation of this file.
1#pragma once
2
4#include "config.qh"
5
6#include "turret.qh"
7
8REGISTRY(Turrets, BITS(5))
9#define get_turretinfo(i) REGISTRY_GET(Turrets, i)
10REGISTER_REGISTRY(Turrets)
11REGISTRY_CHECK(Turrets)
12
13#define TR_PROPS_COMMON(P, class, prefix) \
14 P(class, prefix, aim_firetolerance_dist, float) \
15 P(class, prefix, aim_maxpitch, float) \
16 P(class, prefix, aim_maxrot, float) \
17 P(class, prefix, aim_speed, float) \
18 P(class, prefix, ammo_max, float) \
19 P(class, prefix, ammo_recharge, float) \
20 P(class, prefix, health, float) \
21 P(class, prefix, respawntime, float) \
22 P(class, prefix, shot_dmg, float) \
23 P(class, prefix, shot_force, float) \
24 P(class, prefix, shot_radius, float) \
25 P(class, prefix, shot_refire, float) \
26 P(class, prefix, shot_speed, float) \
27 P(class, prefix, shot_spread, float) \
28 P(class, prefix, shot_volly, float) \
29 P(class, prefix, shot_volly_refire, float) \
30 P(class, prefix, target_range, float) \
31 P(class, prefix, target_range_min, float) \
32 P(class, prefix, target_range_optimal, float) \
33 P(class, prefix, target_select_anglebias, float) \
34 P(class, prefix, target_select_missilebias, float) \
35 P(class, prefix, target_select_playerbias, float) \
36 P(class, prefix, target_select_rangebias, float) \
37 P(class, prefix, target_select_samebias, float) \
38 P(class, prefix, track_accel_pitch, float) \
39 P(class, prefix, track_accel_rot, float) \
40 P(class, prefix, track_blendrate, float) \
41 P(class, prefix, track_type, float) \
42 /**/
43
44#define TR_PROPS(L, class, prefix) \
45 L(TR_CONFIG_BEGIN, TR_CONFIG, TR_CONFIG_END, class, prefix) \
46 /**/
47
48#define TR_CONFIG(class, turname, fld, T) _TR_CONFIG(class, fld, T, turname)
49#ifdef SVQC
50 #define TR_CONFIG_BEGIN(class) METHOD(class, tr_config, void(class this)) {
51 #define _TR_CONFIG(class, fld, T, turname) if (#turname == this.netname) TUR_CONFIG_WRITE_CVARS(turname, fld, T);
52 #define TR_CONFIG_END() }
53#else
54 #define TR_CONFIG_BEGIN(class)
55 #define _TR_CONFIG(class, fld, T, turname)
56 #define TR_CONFIG_END()
57#endif
58
59#define DEFAULT_FILENAME "turrets_dump.cfg"
60// NOTE: dumpeffectinfo, dumpnotifs, dumpturrets and dumpweapons use similar code
61GENERIC_COMMAND(dumpturrets, "Dump all turrets into " DEFAULT_FILENAME, false)
62{
63 switch(request)
64 {
66 {
67 #ifdef SVQC
68 tur_config_file = -1;
70 string filename = argv(1);
71
72 if(filename == "")
73 {
74 filename = DEFAULT_FILENAME;
76 }
77 else if(filename == "-")
78 {
79 filename = DEFAULT_FILENAME;
81 }
82 tur_config_file = fopen(filename, FILE_WRITE);
83
84 if(tur_config_file >= 0)
85 {
87 LOG_INFOF("Dumping turrets... File located in ^2data/data/%s^7.", filename);
89 tur_config_file = -1;
91 }
92 else
93 {
94 LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename);
95 }
96 #else
97 LOG_INFO("Turrets dump command only works with sv_cmd.");
98 #endif
99 return;
100 }
101
102 default:
104 {
105 LOG_HELP("Usage:^3 ", GetProgramCommandPrefix(), " dumpturrets [<filename>]");
106 LOG_HELPF(" Where <filename> is the file to write (default is %s),", DEFAULT_FILENAME);
107 LOG_HELP(" if supplied with '-' output to console as well as default,");
108 LOG_HELP(" if left blank, it will only write to default.");
109 return;
110 }
111 }
112}
113#undef DEFAULT_FILENAME
114
115
116const int TUR_FIRST = 1;
117#define TUR_LAST (REGISTRY_COUNT(Turrets) - 1)
118
119#define REGISTER_TURRET(id, inst) REGISTER(Turrets, TUR, id, m_id, inst)
120
125REGISTRY_DEFINE_GET(Turrets, TUR_Null)
126
127#include "turret/_mod.qh"
#define BITS(n)
Definition bits.qh:9
bool m_hidden
Definition all.qh:122
ATTRIB(Turret, m_icon, string)
icon
const int CMD_REQUEST_COMMAND
Definition command.qh:3
const int CMD_REQUEST_USAGE
Definition command.qh:4
#define GENERIC_COMMAND(id, description, menubased)
Definition reg.qh:12
const float FILE_WRITE
#define true
Definition csprogsdefs.qh:5
#define GetProgramCommandPrefix()
Definition generic.qh:25
#define LOG_HELP(...)
Definition log.qh:85
#define LOG_INFO(...)
Definition log.qh:65
#define LOG_HELPF(...)
Definition log.qh:86
#define LOG_INFOF(...)
Definition log.qh:66
void fclose(float fhandle)
float fopen(string filename, float mode)
string argv(float n)
#define DEFAULT_FILENAME
Definition all.qh:164
#define NEW(cname,...)
Definition oo.qh:117
#define CLASS(...)
Definition oo.qh:145
#define ENDCLASS(cname)
Definition oo.qh:281
#define REGISTER_REGISTRY(id)
Definition registry.qh:229
#define REGISTRY(id, max)
Declare a new registry.
Definition registry.qh:26
#define REGISTRY_CHECK(id)
Definition registry.qh:175
#define REGISTRY_DEFINE_GET(id, null)
Definition registry.qh:40
#define REGISTER_TURRET(id, inst)
Definition all.qh:119
const int TUR_FIRST
Definition all.qh:116
void Dump_Turret_Settings()
Definition config.qc:45
float tur_config_alsoprint
Definition config.qh:10
float tur_config_file
Definition config.qh:9