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#if defined(CSQC)
18{
19 localcmd(sprintf("\nimpulse %d\n", imp.impulse));
20}
21
22#define IMPULSE_ALIAS(alias, id) localcmd("\nalias " #alias " \"", id ,"\"\n")
23#else
24#define IMPULSE_ALIAS(alias, id)
25#endif
26
27#define REGISTER_IMPULSE(id, n) _REGISTER_IMPULSE(IMP_##id, id, n)
28#define _REGISTER_IMPULSE(id, alias, n) \
29 REGISTER(IMPULSES, id, m_id, new_pure(Impulse)) \
30 { \
31 this.impulse = n; \
32 IMPULSE_ALIAS(alias, "impulse " #n); \
33 }
34
35#define LEGACY_IMPULSE_ID(alias, id) LEGACY_IMPULSE(alias, id, sprintf("impulse %d", IMP_##alias.impulse))
36
37void _impCheck(string s, string alias)
38{
39 // this is inside a function to avoid expanding it on compilation everytime
40 if (s == alias)
41 LOG_FATALF("LEGACY_IMPULSE: would define a recursive alias for '%s', use LEGACY_IMPULSE_ID instead", s);
42}
43
44#define LEGACY_IMPULSE(alias, id, new) \
45 STATIC_INIT(legacy_##alias) { \
46 string s = new; \
47 _impCheck(s, #alias); \
48 IMPULSE_ALIAS(alias, s); \
49 } \
50 SHUTDOWN(legacy_##alias) { IMPULSE_ALIAS(alias, "impulse " #id); }
51
52// keep xonotic-client.cfg up to date
53#define X(slot, imp) \
54 REGISTER_IMPULSE(weapon_group_##slot, imp) \
55 LEGACY_IMPULSE(weapon_group_##slot, imp, "impulse " #imp)
56X(1, 1)
57X(2, 2)
58X(3, 3)
59X(4, 4)
60X(5, 5)
61X(6, 6)
62X(7, 7)
63X(8, 8)
64X(9, 9)
65X(0, 14)
66#undef X
67
68// keep xonotic-client.cfg up to date
69#define X(slot, dir, imp) \
70 REGISTER_IMPULSE(weapon_priority_##slot##_##dir, imp) \
71 LEGACY_IMPULSE(weapon_priority_##slot##_##dir, imp, "impulse " #imp)
72X(0, prev, 200)
73X(1, prev, 201)
74X(2, prev, 202)
75X(3, prev, 203)
76X(4, prev, 204)
77X(5, prev, 205)
78X(6, prev, 206)
79X(7, prev, 207)
80X(8, prev, 208)
81X(9, prev, 209)
82
83X(0, best, 210)
84X(1, best, 211)
85X(2, best, 212)
86X(3, best, 213)
87X(4, best, 214)
88X(5, best, 215)
89X(6, best, 216)
90X(7, best, 217)
91X(8, best, 218)
92X(9, best, 219)
93
94X(0, next, 220)
95X(1, next, 221)
96X(2, next, 222)
97X(3, next, 223)
98X(4, next, 224)
99X(5, next, 225)
100X(6, next, 226)
101X(7, next, 227)
102X(8, next, 228)
103X(9, next, 229)
104#undef X
105
106// direct weapons
107// keep xonotic-client.cfg up to date
108#define X(i, imp) \
109 REGISTER_IMPULSE(weapon_byid_##i, imp)
110X(0, 230)
111X(1, 231)
112X(2, 232)
113X(3, 233)
114X(4, 234)
115X(5, 235)
116X(6, 236)
117X(7, 237)
118X(8, 238)
119X(9, 239)
120X(10, 240)
121X(11, 241)
122X(12, 242)
123X(13, 243)
124X(14, 244)
125X(15, 245)
126X(16, 246)
127X(17, 247)
128X(18, 248)
129X(19, 249)
130X(20, 250)
131X(21, 251)
132X(22, 252)
133X(23, 253)
134#undef X
135
136REGISTER_IMPULSE(weapon_next_byid, 10)
137LEGACY_IMPULSE(_weapnext_2, 10, "weapon_next_byid")
138
139REGISTER_IMPULSE(weapon_prev_byid, 12)
140LEGACY_IMPULSE(_weapprev_2, 12, "weapon_prev_byid")
141
142REGISTER_IMPULSE(weapon_next_bygroup, 18)
143LEGACY_IMPULSE(_weapnext_0, 18, "weapon_next_bygroup")
144
145REGISTER_IMPULSE(weapon_prev_bygroup, 19)
146LEGACY_IMPULSE(_weapprev_0, 19, "weapon_prev_bygroup")
147
148REGISTER_IMPULSE(weapon_next_bypriority, 15)
149LEGACY_IMPULSE(_weapnext_1, 15, "weapon_next_bypriority")
150
151REGISTER_IMPULSE(weapon_prev_bypriority, 16)
152LEGACY_IMPULSE(_weapprev_1, 16, "weapon_prev_bypriority")
153
154REGISTER_IMPULSE(weapon_last, 11)
155LEGACY_IMPULSE(weaplast, 11, "weapon_last")
156
157REGISTER_IMPULSE(weapon_best, 13)
158LEGACY_IMPULSE(weapbest, 13, "weapon_best")
159
160REGISTER_IMPULSE(weapon_drop, 17)
161LEGACY_IMPULSE(dropweapon, 17, "weapon_drop")
162
163REGISTER_IMPULSE(weapon_reload, 20)
164LEGACY_IMPULSE(reload, 20, "weapon_reload")
165
168
169REGISTER_IMPULSE(waypoint_personal_here, 30)
170LEGACY_IMPULSE(g_waypointsprite_personal, 30, "waypoint_personal_here")
171
172REGISTER_IMPULSE(waypoint_personal_crosshair, 31)
173LEGACY_IMPULSE(g_waypointsprite_personal_p, 31, "waypoint_personal_crosshair")
174
175REGISTER_IMPULSE(waypoint_personal_death, 32)
176LEGACY_IMPULSE(g_waypointsprite_personal_d, 32, "waypoint_personal_death")
177
178REGISTER_IMPULSE(waypoint_here_follow, 33)
179LEGACY_IMPULSE(g_waypointsprite_team_helpme, 33, "waypoint_here_follow")
180
181REGISTER_IMPULSE(waypoint_here_here, 34)
182LEGACY_IMPULSE(g_waypointsprite_team_here, 34, "waypoint_here_here")
183
184REGISTER_IMPULSE(waypoint_here_crosshair, 35)
185LEGACY_IMPULSE(g_waypointsprite_team_here_p, 35, "waypoint_here_crosshair")
186
187REGISTER_IMPULSE(waypoint_here_death, 36)
188LEGACY_IMPULSE(g_waypointsprite_team_here_d, 36, "waypoint_here_death")
189
190REGISTER_IMPULSE(waypoint_danger_here, 37)
191LEGACY_IMPULSE(g_waypointsprite_team_danger, 37, "waypoint_danger_here")
192
193REGISTER_IMPULSE(waypoint_danger_crosshair, 38)
194LEGACY_IMPULSE(g_waypointsprite_team_danger_p, 38, "waypoint_danger_crosshair")
195
196REGISTER_IMPULSE(waypoint_danger_death, 39)
197LEGACY_IMPULSE(g_waypointsprite_team_danger_d, 39, "waypoint_danger_death")
198
199REGISTER_IMPULSE(waypoint_clear_personal, 47)
200LEGACY_IMPULSE(g_waypointsprite_clear_personal, 47, "waypoint_clear_personal")
201
202REGISTER_IMPULSE(waypoint_clear, 48)
203LEGACY_IMPULSE(g_waypointsprite_clear, 48, "waypoint_clear")
204
205
206#define CHIMPULSE(id, n) _CHIMPULSE(CHIMPULSE_##id, n)
207#define _CHIMPULSE(id, n) \
208 REGISTER(IMPULSES, id, m_id, new_pure(Impulse)) \
209 { \
210 this.impulse = n; \
211 }
212
213CHIMPULSE(SPEEDRUN_INIT, 30)
214CHIMPULSE(GIVE_ALL, 99)
215CHIMPULSE(CLONE_MOVING, 140)
216CHIMPULSE(SPEEDRUN, 141)
217CHIMPULSE(CLONE_STANDING, 142)
218CHIMPULSE(TELEPORT, 143)
219CHIMPULSE(R00T, 148)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define use
#define X()
void Impulse_Send(entity imp)
Definition all.qh:17
void _impCheck(string s, string alias)
Definition all.qh:37
best
Definition all.qh:84
#define X(slot, imp)
Definition all.qh:53
#define REGISTER_IMPULSE(id, n)
Definition all.qh:27
prev
Definition all.qh:73
#define CHIMPULSE(id, n)
Definition all.qh:206
#define LEGACY_IMPULSE(alias, id, new)
Definition all.qh:44
next
Definition all.qh:95
#define LEGACY_IMPULSE_ID(alias, id)
Definition all.qh:35
#define FOREACH(list, cond, body)
Definition iter.qh:19
#define LOG_FATALF(...)
Definition log.qh:54
void localcmd(string command,...)
#define NULL
Definition post.qh:14
#define REGISTRY_SORT(...)
Definition registry.qh:128
#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
int int int imp
Definition impulse.qc:90
#define STATIC_INIT(func)
during worldspawn
Definition static.qh:32