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#define X(slot, imp) \
53 REGISTER_IMPULSE(weapon_group_##slot, imp) \
54 LEGACY_IMPULSE(weapon_group_##slot, imp, "impulse " #imp)
55X(1, 1)
56X(2, 2)
57X(3, 3)
58X(4, 4)
59X(5, 5)
60X(6, 6)
61X(7, 7)
62X(8, 8)
63X(9, 9)
64X(0, 14)
65#undef X
66
67#define X(slot, dir, imp) \
68 REGISTER_IMPULSE(weapon_priority_##slot##_##dir, imp) \
69 LEGACY_IMPULSE(weapon_priority_##slot##_##dir, imp, "impulse " #imp)
70X(0, prev, 200)
71X(1, prev, 201)
72X(2, prev, 202)
73X(3, prev, 203)
74X(4, prev, 204)
75X(5, prev, 205)
76X(6, prev, 206)
77X(7, prev, 207)
78X(8, prev, 208)
79X(9, prev, 209)
80
81X(0, best, 210)
82X(1, best, 211)
83X(2, best, 212)
84X(3, best, 213)
85X(4, best, 214)
86X(5, best, 215)
87X(6, best, 216)
88X(7, best, 217)
89X(8, best, 218)
90X(9, best, 219)
91
92X(0, next, 220)
93X(1, next, 221)
94X(2, next, 222)
95X(3, next, 223)
96X(4, next, 224)
97X(5, next, 225)
98X(6, next, 226)
99X(7, next, 227)
100X(8, next, 228)
101X(9, next, 229)
102#undef X
103
104// direct weapons
105
106#define X(i, imp) \
107 REGISTER_IMPULSE(weapon_byid_##i, imp)
108X(0, 230)
109X(1, 231)
110X(2, 232)
111X(3, 233)
112X(4, 234)
113X(5, 235)
114X(6, 236)
115X(7, 237)
116X(8, 238)
117X(9, 239)
118X(10, 240)
119X(11, 241)
120X(12, 242)
121X(13, 243)
122X(14, 244)
123X(15, 245)
124X(16, 246)
125X(17, 247)
126X(18, 248)
127X(19, 249)
128X(20, 250)
129X(21, 251)
130X(22, 252)
131X(23, 253)
132#undef X
133
134REGISTER_IMPULSE(weapon_next_byid, 10)
135LEGACY_IMPULSE(_weapnext_2, 10, "weapon_next_byid")
136
137REGISTER_IMPULSE(weapon_prev_byid, 12)
138LEGACY_IMPULSE(_weapprev_2, 12, "weapon_prev_byid")
139
140REGISTER_IMPULSE(weapon_next_bygroup, 18)
141LEGACY_IMPULSE(_weapnext_0, 18, "weapon_next_bygroup")
142
143REGISTER_IMPULSE(weapon_prev_bygroup, 19)
144LEGACY_IMPULSE(_weapprev_0, 19, "weapon_prev_bygroup")
145
146REGISTER_IMPULSE(weapon_next_bypriority, 15)
147LEGACY_IMPULSE(_weapnext_1, 15, "weapon_next_bypriority")
148
149REGISTER_IMPULSE(weapon_prev_bypriority, 16)
150LEGACY_IMPULSE(_weapprev_1, 16, "weapon_prev_bypriority")
151
152REGISTER_IMPULSE(weapon_last, 11)
153LEGACY_IMPULSE(weaplast, 11, "weapon_last")
154
155REGISTER_IMPULSE(weapon_best, 13)
156LEGACY_IMPULSE(weapbest, 13, "weapon_best")
157
158REGISTER_IMPULSE(weapon_drop, 17)
159LEGACY_IMPULSE(dropweapon, 17, "weapon_drop")
160
161REGISTER_IMPULSE(weapon_reload, 20)
162LEGACY_IMPULSE(reload, 20, "weapon_reload")
163
166
167REGISTER_IMPULSE(waypoint_personal_here, 30)
168LEGACY_IMPULSE(g_waypointsprite_personal, 30, "waypoint_personal_here")
169
170REGISTER_IMPULSE(waypoint_personal_crosshair, 31)
171LEGACY_IMPULSE(g_waypointsprite_personal_p, 31, "waypoint_personal_crosshair")
172
173REGISTER_IMPULSE(waypoint_personal_death, 32)
174LEGACY_IMPULSE(g_waypointsprite_personal_d, 32, "waypoint_personal_death")
175
176REGISTER_IMPULSE(waypoint_here_follow, 33)
177LEGACY_IMPULSE(g_waypointsprite_team_helpme, 33, "waypoint_here_follow")
178
179REGISTER_IMPULSE(waypoint_here_here, 34)
180LEGACY_IMPULSE(g_waypointsprite_team_here, 34, "waypoint_here_here")
181
182REGISTER_IMPULSE(waypoint_here_crosshair, 35)
183LEGACY_IMPULSE(g_waypointsprite_team_here_p, 35, "waypoint_here_crosshair")
184
185REGISTER_IMPULSE(waypoint_here_death, 36)
186LEGACY_IMPULSE(g_waypointsprite_team_here_d, 36, "waypoint_here_death")
187
188REGISTER_IMPULSE(waypoint_danger_here, 37)
189LEGACY_IMPULSE(g_waypointsprite_team_danger, 37, "waypoint_danger_here")
190
191REGISTER_IMPULSE(waypoint_danger_crosshair, 38)
192LEGACY_IMPULSE(g_waypointsprite_team_danger_p, 38, "waypoint_danger_crosshair")
193
194REGISTER_IMPULSE(waypoint_danger_death, 39)
195LEGACY_IMPULSE(g_waypointsprite_team_danger_d, 39, "waypoint_danger_death")
196
197REGISTER_IMPULSE(waypoint_clear_personal, 47)
198LEGACY_IMPULSE(g_waypointsprite_clear_personal, 47, "waypoint_clear_personal")
199
200REGISTER_IMPULSE(waypoint_clear, 48)
201LEGACY_IMPULSE(g_waypointsprite_clear, 48, "waypoint_clear")
202
203
204#define CHIMPULSE(id, n) _CHIMPULSE(CHIMPULSE_##id, n)
205#define _CHIMPULSE(id, n) \
206 REGISTER(IMPULSES, id, m_id, new_pure(Impulse)) \
207 { \
208 this.impulse = n; \
209 }
210
211CHIMPULSE(SPEEDRUN_INIT, 30)
212CHIMPULSE(GIVE_ALL, 99)
213CHIMPULSE(CLONE_MOVING, 140)
214CHIMPULSE(SPEEDRUN, 141)
215CHIMPULSE(CLONE_STANDING, 142)
216CHIMPULSE(TELEPORT, 143)
217CHIMPULSE(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:82
#define X(slot, imp)
Definition all.qh:52
#define REGISTER_IMPULSE(id, n)
Definition all.qh:27
prev
Definition all.qh:71
#define CHIMPULSE(id, n)
Definition all.qh:204
#define LEGACY_IMPULSE(alias, id, new)
Definition all.qh:44
next
Definition all.qh:93
#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