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
3REGISTRY(IMPULSES, 255)
4REGISTER_REGISTRY(IMPULSES)
5REGISTRY_SORT(IMPULSES)
6
8STATIC_INIT(IMPULSES_renumber)
9{
10 FOREACH(IMPULSES, true, it.m_id = i);
11}
12REGISTRY_CHECK(IMPULSES)
13
14.void(entity this) impulse_handle;
15
16#ifdef CSQC
18{
19 localcmd(sprintf("\nimpulse %d\n", imp.impulse));
20}
21
22#define IMPULSE_ALIAS(alias, n) localcmd("\nalias " #alias " \"impulse " #n "\"\n")
23#else
24#define IMPULSE_ALIAS(alias, n)
25#endif
26
27// keep xonotic-client.cfg up to date
28#define REGISTER_IMPULSE(id, n) _REGISTER_IMPULSE(IMP_##id, id, n)
29#define _REGISTER_IMPULSE(id, alias, n) \
30 REGISTER(IMPULSES, id, m_id, new_pure(Impulse)) \
31 { \
32 this.impulse = n; \
33 IMPULSE_ALIAS(alias, n); \
34 }
35
36#define X(slot, imp) \
37 REGISTER_IMPULSE(weapon_group_##slot, imp)
38X(1, 1)
39X(2, 2)
40X(3, 3)
41X(4, 4)
42X(5, 5)
43X(6, 6)
44X(7, 7)
45X(8, 8)
46X(9, 9)
47X(0, 14)
48#undef X
49
50#define X(slot, dir, imp) \
51 REGISTER_IMPULSE(weapon_priority_##slot##_##dir, imp)
52X(0, prev, 200)
53X(1, prev, 201)
54X(2, prev, 202)
55X(3, prev, 203)
56X(4, prev, 204)
57X(5, prev, 205)
58X(6, prev, 206)
59X(7, prev, 207)
60X(8, prev, 208)
61X(9, prev, 209)
62
63X(0, best, 210)
64X(1, best, 211)
65X(2, best, 212)
66X(3, best, 213)
67X(4, best, 214)
68X(5, best, 215)
69X(6, best, 216)
70X(7, best, 217)
71X(8, best, 218)
72X(9, best, 219)
73
74X(0, next, 220)
75X(1, next, 221)
76X(2, next, 222)
77X(3, next, 223)
78X(4, next, 224)
79X(5, next, 225)
80X(6, next, 226)
81X(7, next, 227)
82X(8, next, 228)
83X(9, next, 229)
84#undef X
85
86// direct weapons
87#define X(i, imp) \
88 REGISTER_IMPULSE(weapon_byid_##i, imp)
89X(0, 230)
90X(1, 231)
91X(2, 232)
92X(3, 233)
93X(4, 234)
94X(5, 235)
95X(6, 236)
96X(7, 237)
97X(8, 238)
98X(9, 239)
99X(10, 240)
100X(11, 241)
101X(12, 242)
102X(13, 243)
103X(14, 244)
104X(15, 245)
105X(16, 246)
106X(17, 247)
107X(18, 248)
108X(19, 249)
109X(20, 250)
110X(21, 251)
111X(22, 252)
112X(23, 253)
113#undef X
114
115REGISTER_IMPULSE(weapon_next_byid, 10)
116REGISTER_IMPULSE(weapon_prev_byid, 12)
117REGISTER_IMPULSE(weapon_next_bygroup, 18)
118REGISTER_IMPULSE(weapon_prev_bygroup, 19)
119REGISTER_IMPULSE(weapon_next_bypriority, 15)
120REGISTER_IMPULSE(weapon_prev_bypriority, 16)
121
122REGISTER_IMPULSE(weapon_last, 11)
123REGISTER_IMPULSE(weapon_best, 13)
124REGISTER_IMPULSE(weapon_drop, 17)
125REGISTER_IMPULSE(weapon_reload, 20)
126
127// umm...
128#pragma push_macro("use")
129#undef use
131#pragma pop_macro("use")
132
133REGISTER_IMPULSE(waypoint_personal_here, 30)
134REGISTER_IMPULSE(waypoint_personal_crosshair, 31)
135REGISTER_IMPULSE(waypoint_personal_death, 32)
136REGISTER_IMPULSE(waypoint_here_follow, 33)
137REGISTER_IMPULSE(waypoint_here_here, 34)
138REGISTER_IMPULSE(waypoint_here_crosshair, 35)
139REGISTER_IMPULSE(waypoint_here_death, 36)
140REGISTER_IMPULSE(waypoint_danger_here, 37)
141REGISTER_IMPULSE(waypoint_danger_crosshair, 38)
142REGISTER_IMPULSE(waypoint_danger_death, 39)
143REGISTER_IMPULSE(waypoint_clear_personal, 47)
144REGISTER_IMPULSE(waypoint_clear, 48)
145
146
147// cheat impulses
148#define CHIMPULSE(id, n) _CHIMPULSE(CHIMPULSE_##id, n)
149#define _CHIMPULSE(id, n) \
150 REGISTER(IMPULSES, id, m_id, new_pure(Impulse)) \
151 { \
152 this.impulse = n; \
153 }
154
155CHIMPULSE(SPEEDRUN_INIT, 30)
156CHIMPULSE(GIVE_ALL, 99)
157CHIMPULSE(CLONE_MOVING, 140)
158CHIMPULSE(SPEEDRUN, 141)
159CHIMPULSE(CLONE_STANDING, 142)
160CHIMPULSE(TELEPORT, 143)
161CHIMPULSE(R00T, 148)
162
163
164#undef IMPULSE_ALIAS
165#undef REGISTER_IMPULSE
166#undef _REGISTER_IMPULSE
167#undef CHIMPULSE
168#undef _CHIMPULSE
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define use
#define X()
void Impulse_Send(entity imp)
Definition all.qh:17
best
Definition all.qh:64
#define X(slot, imp)
Definition all.qh:36
#define REGISTER_IMPULSE(id, n)
Definition all.qh:28
prev
Definition all.qh:53
#define CHIMPULSE(id, n)
Definition all.qh:148
next
Definition all.qh:75
#define FOREACH(list, cond, body)
Definition iter.qh:19
void localcmd(string command,...)
#define NULL
Definition post.qh:14
#define REGISTRY_SORT(...)
Definition registry.qh:163
#define REGISTER_REGISTRY(id)
Definition registry.qh:270
#define REGISTRY(id, max)
Declares a new registry.
Definition registry.qh:23
#define REGISTRY_CHECK(id)
Definition registry.qh:213
#define REGISTRY_DEFINE_GET(id, null)
Definition registry.qh:50
int int int imp
Definition impulse.qc:90
#define STATIC_INIT(func)
during worldspawn
Definition static.qh:33